Notebook 1 Functions
Below are the functions pertaining to the analytic solutions to the 3D PIB system used in Notebook 1.
|
Numeric representation of the normalized 3D PIB wavefunction. |
|
Calculates energy of 3D PIB state. |
|
Displays LaTeX equation of 3D wavefunction. |
|
Displays LaTeX equation of energy. |
|
Displays and saves isosurface of 3D PIB wavefunction. |
- NB1_functions.psi_reg(x, y, z, q_nx=1, q_ny=1, q_nz=1, lx=1, ly=1, lz=1)
Numeric representation of the normalized 3D PIB wavefunction.
- Parameters:
x (float) – Cartesian spatial x variable.
y (float) – Idem for y.
z (float) – Idem for z.
q_nx (int) – Quantum number specifying the state along x.
q_ny (int) – Idem for y.
q_nz (int) – Idem for z.
lx (int) – Box dimension along x in Bohr.
ly (int) – Idem for y.
lz (int) – Idem for z.
- Returns:
Wavefunction evaluated at a point or array if input x, y, z are arrays.
Example:
>>> # value of the wavefunction at the center of a 3x3x3 box >>> # in the state 111 >>> psi_reg(1.5, 1.5, 1.5, 1, 1, 1, 3, 3, 3) 0.5443310539518174
- NB1_functions.psi_ener(qnx, qny, qnz, lx, ly, lz)
Calculates energy of 3D PIB state.
- Parameters:
qnx (int) – Quantum number specifying the state along x.
qny (int) – Idem for y.
qnz (int) – Idem for z.
lx (int) – Box dimension along x in Bohr.
ly (int) – Idem for y.
lz (int) – Idem for z.
- Returns:
Float energy value in Ha.
Example:
>>> # Energy of 111 state of an 8x8x3 box >>> psi_ener(1, 1, 1, 8, 8, 3) 0.702524
- NB1_functions.markdown_wvfn(q_nx, q_ny, q_nz, lx, ly, lz)
Displays LaTeX equation of 3D wavefunction.
- Parameters:
q_nx (int) – Quantum number specifying the state along x.
q_ny (int) – Idem for y.
q_nz (int) – Idem for z.
lx (int) – Box dimension along x in Bohr.
ly (int) – Idem for y.
lz (int) – Idem for z.
Example:
>>> # Wavefunction of 321 state in 8x8x3 box >>> markdown_wvfn(3, 2, 1, 8, 8, 3)
\[\text{State:}\ \ \psi_{3,2,1}(x,y,z)=\sqrt{\frac{8}{(8)(8)(3)}}\sin\bigg(\frac{3\pi x}{8}\bigg)\sin\bigg(\frac{2\pi y}{8}\bigg)\sin\bigg(\frac{1\pi z}{3}\bigg)\]
- NB1_functions.markdown_ener(l_x, l_y, l_z)
Displays LaTeX equation of energy.
- Parameters:
l_x (int) – Box dimension along x in Bohr.
l_y (int) – Idem for y.
l_z (int) – Idem for z.
Example:
>>> # Energy expression for a 16x8x3 Box >>> markdown_ener(16, 8, 3)
\[E_{n_x,n_y,n_z}= \frac{\pi^2}{2}\bigg[\bigg(\frac{n_x}{16}\bigg)^2 + \bigg(\frac{n_y}{8}\bigg)^2 +\bigg(\frac{n_z}{3}\bigg)^2\bigg]\]
- NB1_functions.isoplotter(nx_val, ny_val, nz_val, lx, ly, lz, psi_square=False, plot_save=True, plotting_lib='plotly')
Displays and saves isosurface of 3D PIB wavefunction.
- Parameters:
nx_val (int) – Quantum number specifying the state along x.
ny_val (int) – Idem for y.
nz_val (int) – Idem for z.
lx (int) – Box dimension along x in Bohr.
ly (int) – Idem for y.
lz (int) – Idem for z.
psi_square (bool) – calculate prob. density (true) or wavefunction (false)
plot_save (bool) – save a .png file of display
plotting_lib (str) – 3d plotting library to use (plotly or ipyvol)
Example:
>>> # Render the 321 state of a 8x8x3 PIB system >>> isoplotter(3, 2, 1, 8, 8, 3, psi_square=False, plot_save=False, plotting_lib='plotly')
>>> # Render the 512 probability density of a 16x8x3 PIB system >>> isoplotter(5, 1, 2, 16, 8, 3, psi_square=True, plot_save=False, plotting_lib='plotly')