Infinite Potential Well 3D (Particle in a 3D-Box)

The three-dimensional infinite potential well (particle in a 3D-box) is one of the simplest models for a three-dimensional quantum mechanical system.

Definitions

Antique.InfinitePotentialWell3DType

Model

This model is described with the time-independent Schrödinger equation

\[ \hat{H} \psi(x,y,z) = E \psi(x,y,z),\]

and the Hamiltonian

\[ \hat{H} = - \frac{\hbar^2}{2m} \left(\frac{\partial^2}{\partial x ^2} + \frac{\partial^2}{\partial y ^2} + \frac{\partial^2}{\partial z ^2}\right) + V(x,y,z).\]

Parameters are specified with the following struct:

IPW3D = InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0)

$L$ is a vector of the lengths of the box in $x$,$y$,$z$-direction, $m$ is the mass of the particle and $\hbar$ is the reduced Planck constant (Dirac's constant).

References

  • [9] D. A. McQuarrie, J. D. Simon, Physical chemistry : a molecular approach (University Science Books, 1997), (https://mitpress.mit.edu/9781940380216/physical-chemistry/) p.90, 3-9. The Problem of a Particle in a Three-Dimensional Box Is a Simple Extension of the One-Dimensional Case
source

Potential

Antique.VMethod

V(model::InfinitePotentialWell3D, x)

\[V(x,y,z) = \left\{ \begin{array}{ll} 0 & 0 \leq x \leq L_x \ \mathrm{and}\ 0 \leq y \leq L_y \ \mathrm{and}\ 0 \leq z \leq L_z \\ \infty & \mathrm{elsewhere} \end{array} \right.\]

source

Eigenvalues

Antique.EMethod

E(model::InfinitePotentialWell3D; n::Vector{Int}=[1,1,1])

\[E_{n_x,n_y,n_z} = \frac{\hbar^2 n_x^2 \pi^2}{2 m L_x^2} + \frac{\hbar^2 n_y^2 \pi^2}{2 m L_y^2} + \frac{\hbar^2 n_z^2 \pi^2}{2 m L_z^2}\]

source

Eigenfunctions

Antique.ψMethod

ψ(model::InfinitePotentialWell3D, x; n::Vector{Int}=[1,1,1])

The wave functions can be expressed as products of wave functions in a one-dimensional box.

\[\begin{aligned} \psi_{n_x,n_y,n_z}(x,y,z) &= \psi_{n_x}(x) \times \psi_{n_y}(y) \times \psi_{n_z}(z) \\ &= \sqrt{\frac{2}{L_x}} \sin \frac{n_x \pi x}{L_x} \times \sqrt{\frac{2}{L_y}} \sin \frac{n_y \pi y}{L_y} \times \sqrt{\frac{2}{L_z}} \sin \frac{n_z \pi z}{L_z} \end{aligned}\]

source

Usage & Examples

Install Antique.jl for the first use and run using Antique before each use. The energy E(), wave function ψ() and potential V() will be exported. In this system, the model is generated by InfinitePotentialWell3D and several parameters Lx, Ly, Lz, m and are set as optional arguments.

using Antique
IPW3D = InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0)

Parameters:

julia> IPW3D.L3-element Vector{Float64}:
 1.0
 1.0
 1.0
julia> IPW3D.m1.0
julia> IPW3D.ℏ1.0

Eigenvalues:

julia> E(IPW3D, n=[1,1,1])14.804406601634037
julia> E(IPW3D, n=[2,1,1])29.608813203268078
julia> E(IPW3D, n=[1,2,1])29.608813203268078
julia> E(IPW3D, n=[1,1,2])29.608813203268074
julia> E(IPW3D, n=[2,2,1])44.41321980490211
julia> E(IPW3D, n=[2,1,2])44.41321980490211
julia> E(IPW3D, n=[1,2,2])44.41321980490211
julia> E(IPW3D, n=[2,2,2])59.21762640653615

Wave functions:

using CairoMakie

# settings
fig = Figure()
axis = Axis(fig[1,1], xlabel=L"$x$", ylabel=L"$\psi(x,0.5,0.5)$")

# plot
lines!(axis, 0..1, x -> ψ(IPW3D, [x,0.5,0.5], n=[1,1,1]), label=L"n=[1,1,1]")
lines!(axis, 0..1, x -> ψ(IPW3D, [x,0.5,0.5], n=[2,1,1]), label=L"n=[2,1,1]")
lines!(axis, 0..1, x -> ψ(IPW3D, [x,0.5,0.5], n=[1,2,1]), label=L"n=[1,2,1]")
lines!(axis, 0..1, x -> ψ(IPW3D, [x,0.5,0.5], n=[3,1,1]), label=L"n=[3,1,1]")
lines!(axis, 0..1, x -> ψ(IPW3D, [x,0.5,0.5], n=[4,1,1]), label=L"n=[4,1,1]")

# legend
axislegend(axis, position=:lb, framevisible=false)

fig
Example block output

Testing

Unit testing and Integration testing were done using numerical integration (QuadGK.jl). The test script is here.

Normalization & Orthogonality of $\psi_{n_x,n_y,n_z}(x,y,z)$

\[\int_{0}^{L_x}\int_{0}^{L_y}\int_{0}^{L_z} \psi_{i_x,i_y,i_z}^\ast(x,y,z) \psi_{j_x,j_y,j_z}(x,y,z) ~\mathrm{d}x \mathrm{d}y\mathrm{d}z = \delta_{i_x,j_x}\delta_{i_y,j_y}\delta_{i_z,j_z}\]

IPW3D = Antique.InfinitePotentialWell3D(L=[1.0, 1.0, 1.0], m=1.0, ħ=1.0)
ix | iy | iz | jx | jy | jz |     analytical |      numerical 
-- | -- | -- | -- | -- | -- | -------------- | -------------- 
 1 |  1 |  1 |  1 |  1 |  1 |    1.000000000 |    0.999960857 ✔
 1 |  1 |  1 |  1 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  1 |  1 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  1 |  1 |  2 |  2 |    0.000000000 |   -0.000000352 ✔
 1 |  1 |  1 |  2 |  1 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  1 |  2 |  1 |  2 |    0.000000000 |   -0.000000352 ✔
 1 |  1 |  1 |  2 |  2 |  1 |    0.000000000 |    0.000000352 ✔
 1 |  1 |  1 |  2 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  2 |  1 |  1 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  2 |  1 |  1 |  2 |    1.000000000 |    0.999921251 ✔
 1 |  1 |  2 |  1 |  2 |  1 |    0.000000000 |   -0.000000352 ✔
 1 |  1 |  2 |  1 |  2 |  2 |    0.000000000 |   -0.000001273 ✔
 1 |  1 |  2 |  2 |  1 |  1 |    0.000000000 |    0.000000352 ✔
 1 |  1 |  2 |  2 |  1 |  2 |    0.000000000 |   -0.000001273 ✔
 1 |  1 |  2 |  2 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  2 |  2 |  2 |  2 |    0.000000000 |   -0.000000307 ✔
 1 |  2 |  1 |  1 |  1 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  2 |  1 |  1 |  1 |  2 |    0.000000000 |   -0.000000352 ✔
 1 |  2 |  1 |  1 |  2 |  1 |    1.000000000 |    0.999921251 ✔
 1 |  2 |  1 |  1 |  2 |  2 |    0.000000000 |   -0.000001273 ✔
 1 |  2 |  1 |  2 |  1 |  1 |    0.000000000 |   -0.000000352 ✔
 1 |  2 |  1 |  2 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 1 |  2 |  1 |  2 |  2 |  1 |    0.000000000 |   -0.000001273 ✔
 1 |  2 |  1 |  2 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  2 |  1 |  1 |  1 |    0.000000000 |   -0.000000352 ✔
 1 |  2 |  2 |  1 |  1 |  2 |    0.000000000 |   -0.000001273 ✔
 1 |  2 |  2 |  1 |  2 |  1 |    0.000000000 |   -0.000001273 ✔
 1 |  2 |  2 |  1 |  2 |  2 |    1.000000000 |    0.999966006 ✔
 1 |  2 |  2 |  2 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  2 |  2 |  1 |  2 |    0.000000000 |   -0.000000307 ✔
 1 |  2 |  2 |  2 |  2 |  1 |    0.000000000 |   -0.000000307 ✔
 1 |  2 |  2 |  2 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  1 |  1 |  1 |  1 |  1 |    0.000000000 |   -0.000000000 ✔
 2 |  1 |  1 |  1 |  1 |  2 |    0.000000000 |    0.000000352 ✔
 2 |  1 |  1 |  1 |  2 |  1 |    0.000000000 |   -0.000000352 ✔
 2 |  1 |  1 |  1 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  1 |  1 |  2 |  1 |  1 |    1.000000000 |    0.999921251 ✔
 2 |  1 |  1 |  2 |  1 |  2 |    0.000000000 |   -0.000001273 ✔
 2 |  1 |  1 |  2 |  2 |  1 |    0.000000000 |   -0.000001273 ✔
 2 |  1 |  1 |  2 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  1 |  2 |  1 |  1 |  1 |    0.000000000 |   -0.000000352 ✔
 2 |  1 |  2 |  1 |  1 |  2 |    0.000000000 |   -0.000001273 ✔
 2 |  1 |  2 |  1 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 2 |  1 |  2 |  1 |  2 |  2 |    0.000000000 |   -0.000000307 ✔
 2 |  1 |  2 |  2 |  1 |  1 |    0.000000000 |   -0.000001273 ✔
 2 |  1 |  2 |  2 |  1 |  2 |    1.000000000 |    0.999966006 ✔
 2 |  1 |  2 |  2 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 2 |  1 |  2 |  2 |  2 |  2 |    0.000000000 |   -0.000001072 ✔
 2 |  2 |  1 |  1 |  1 |  1 |    0.000000000 |    0.000000352 ✔
 2 |  2 |  1 |  1 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 2 |  2 |  1 |  1 |  2 |  1 |    0.000000000 |   -0.000001273 ✔
 2 |  2 |  1 |  1 |  2 |  2 |    0.000000000 |   -0.000000307 ✔
 2 |  2 |  1 |  2 |  1 |  1 |    0.000000000 |   -0.000001273 ✔
 2 |  2 |  1 |  2 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 2 |  2 |  1 |  2 |  2 |  1 |    1.000000000 |    0.999966006 ✔
 2 |  2 |  1 |  2 |  2 |  2 |    0.000000000 |   -0.000001072 ✔
 2 |  2 |  2 |  1 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  2 |  1 |  1 |  2 |    0.000000000 |   -0.000000307 ✔
 2 |  2 |  2 |  1 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  2 |  1 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  2 |  2 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  2 |  2 |  1 |  2 |    0.000000000 |   -0.000001072 ✔
 2 |  2 |  2 |  2 |  2 |  1 |    0.000000000 |   -0.000001072 ✔
 2 |  2 |  2 |  2 |  2 |  2 |    1.000000000 |    1.003329100 ✔

IPW3D = Antique.InfinitePotentialWell3D(L=[1.2, 3.4, 4.5], m=2.0, ħ=3.0)
ix | iy | iz | jx | jy | jz |     analytical |      numerical 
-- | -- | -- | -- | -- | -- | -------------- | -------------- 
 1 |  1 |  1 |  1 |  1 |  1 |    1.000000000 |    0.999991924 ✔
 1 |  1 |  1 |  1 |  1 |  2 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  1 |  1 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  1 |  1 |  2 |  2 |    0.000000000 |   -0.000002863 ✔
 1 |  1 |  1 |  2 |  1 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  1 |  2 |  1 |  2 |    0.000000000 |    0.000001684 ✔
 1 |  1 |  1 |  2 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  1 |  2 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  2 |  1 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  2 |  1 |  1 |  2 |    1.000000000 |    0.999991538 ✔
 1 |  1 |  2 |  1 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  1 |  2 |  1 |  2 |  2 |    0.000000000 |   -0.000001109 ✔
 1 |  1 |  2 |  2 |  1 |  1 |    0.000000000 |   -0.000001684 ✔
 1 |  1 |  2 |  2 |  1 |  2 |    0.000000000 |   -0.000000982 ✔
 1 |  1 |  2 |  2 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 1 |  1 |  2 |  2 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  1 |  1 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  1 |  1 |  1 |  2 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  1 |  1 |  2 |  1 |    1.000000000 |    0.999990967 ✔
 1 |  2 |  1 |  1 |  2 |  2 |    0.000000000 |    0.000001136 ✔
 1 |  2 |  1 |  2 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  1 |  2 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 1 |  2 |  1 |  2 |  2 |  1 |    0.000000000 |   -0.000000971 ✔
 1 |  2 |  1 |  2 |  2 |  2 |    0.000000000 |   -0.000000257 ✔
 1 |  2 |  2 |  1 |  1 |  1 |    0.000000000 |   -0.000002863 ✔
 1 |  2 |  2 |  1 |  1 |  2 |    0.000000000 |   -0.000001109 ✔
 1 |  2 |  2 |  1 |  2 |  1 |    0.000000000 |    0.000001136 ✔
 1 |  2 |  2 |  1 |  2 |  2 |    1.000000000 |    1.000155810 ✔
 1 |  2 |  2 |  2 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  2 |  2 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 1 |  2 |  2 |  2 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 1 |  2 |  2 |  2 |  2 |  2 |    0.000000000 |    0.000000532 ✔
 2 |  1 |  1 |  1 |  1 |  1 |    0.000000000 |   -0.000000000 ✔
 2 |  1 |  1 |  1 |  1 |  2 |    0.000000000 |   -0.000001684 ✔
 2 |  1 |  1 |  1 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  1 |  1 |  1 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  1 |  1 |  2 |  1 |  1 |    1.000000000 |    0.999969140 ✔
 2 |  1 |  1 |  2 |  1 |  2 |    0.000000000 |   -0.000001096 ✔
 2 |  1 |  1 |  2 |  2 |  1 |    0.000000000 |   -0.000001058 ✔
 2 |  1 |  1 |  2 |  2 |  2 |    0.000000000 |    0.000000184 ✔
 2 |  1 |  2 |  1 |  1 |  1 |    0.000000000 |    0.000001684 ✔
 2 |  1 |  2 |  1 |  1 |  2 |    0.000000000 |   -0.000000982 ✔
 2 |  1 |  2 |  1 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 2 |  1 |  2 |  1 |  2 |  2 |    0.000000000 |   -0.000000000 ✔
 2 |  1 |  2 |  2 |  1 |  1 |    0.000000000 |   -0.000001096 ✔
 2 |  1 |  2 |  2 |  1 |  2 |    1.000000000 |    1.000133755 ✔
 2 |  1 |  2 |  2 |  2 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  1 |  2 |  2 |  2 |  2 |    0.000000000 |   -0.000000620 ✔
 2 |  2 |  1 |  1 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  1 |  1 |  1 |  2 |    0.000000000 |   -0.000000000 ✔
 2 |  2 |  1 |  1 |  2 |  1 |    0.000000000 |   -0.000000971 ✔
 2 |  2 |  1 |  1 |  2 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  1 |  2 |  1 |  1 |    0.000000000 |   -0.000001058 ✔
 2 |  2 |  1 |  2 |  1 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  1 |  2 |  2 |  1 |    1.000000000 |    1.000133185 ✔
 2 |  2 |  1 |  2 |  2 |  2 |    0.000000000 |   -0.000000000 ✔
 2 |  2 |  2 |  1 |  1 |  1 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  2 |  1 |  1 |  2 |    0.000000000 |    0.000000000 ✔
 2 |  2 |  2 |  1 |  2 |  1 |    0.000000000 |   -0.000000257 ✔
 2 |  2 |  2 |  1 |  2 |  2 |    0.000000000 |    0.000000532 ✔
 2 |  2 |  2 |  2 |  1 |  1 |    0.000000000 |    0.000000184 ✔
 2 |  2 |  2 |  2 |  1 |  2 |    0.000000000 |   -0.000000620 ✔
 2 |  2 |  2 |  2 |  2 |  1 |    0.000000000 |   -0.000000000 ✔
 2 |  2 |  2 |  2 |  2 |  2 |    1.000000000 |    1.005576194 ✔

Eigenvalues

\[\begin{aligned} E_n &= \int_0^L \psi^\ast_n(x) \hat{H} \psi_n(x) ~\mathrm{d}x \\ &= \int_0^L \psi^\ast_n(x) \left[ \hat{V} + \hat{T} \right] \psi(x) ~\mathrm{d}x \\ &= \int_0^L \psi^\ast_n(x) \left[ 0 - \frac{\hbar^2}{2m} \frac{\mathrm{d}^{2}}{\mathrm{d} x^{2}} \right] \psi(x) ~\mathrm{d}x \\ &\simeq \int_0^L \psi^\ast_n(x) \left[ -\frac{\hbar^2}{2m} \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^{2}} \right] ~\mathrm{d}x. \end{aligned}\]

Where, the difference formula for the 2nd-order derivative:

\[\begin{aligned} % 2\psi(x) % + \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} % + O\left(\Delta x^{4}\right) % &= % \psi(x+\Delta x) % + \psi(x-\Delta x) % \\ % \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} % &= % \psi(x+\Delta x) % - 2\psi(x) % + \psi(x-\Delta x) % - O\left(\Delta x^{4}\right) % \\ % \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} % &= % \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^{2}} % - \frac{O\left(\Delta x^{4}\right)}{\Delta x^{2}} % \\ \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} &= \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^{2}} + O\left(\Delta x^{2}\right) \end{aligned}\]

are given by the sum of 2 Taylor series:

\[\begin{aligned} \psi(x+\Delta x) &= \psi(x) + \frac{\mathrm{d} \psi(x)}{\mathrm{d} x} \Delta x + \frac{1}{2!} \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} + \frac{1}{3!} \frac{\mathrm{d}^{3} \psi(x)}{\mathrm{d} x^{3}} \Delta x^{3} + O\left(\Delta x^{4}\right), \\ \psi(x-\Delta x) &= \psi(x) - \frac{\mathrm{d} \psi(x)}{\mathrm{d} x} \Delta x + \frac{1}{2!} \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} - \frac{1}{3!} \frac{\mathrm{d}^{3} \psi(x)}{\mathrm{d} x^{3}} \Delta x^{3} + O\left(\Delta x^{4}\right). \end{aligned}\]

IPW3D = Antique.InfinitePotentialWell3D(L=[1.0, 1.0, 1.0], m=1.0, ħ=1.0)
 nx | ny | nz |     analytical |      numerical 
 -- | -- | -- | -------------- | -------------- 
  1 |  1 |  1 |   14.803827112 |   14.804406602 ✔
  1 |  1 |  2 |   29.606481543 |   29.608813203 ✔
  1 |  2 |  1 |   29.606481543 |   29.608813203 ✔
  1 |  2 |  2 |   44.411710033 |   44.413219805 ✔
  2 |  1 |  1 |   29.606481543 |   29.608813203 ✔
  2 |  1 |  2 |   44.411710033 |   44.413219805 ✔
  2 |  2 |  1 |   44.411710033 |   44.413219805 ✔
  2 |  2 |  2 |   59.414767779 |   59.217626407 ✔

IPW3D = Antique.InfinitePotentialWell3D(L=[1.2, 3.4, 4.5], m=2.0, ħ=3.0)
 nx | ny | nz |     analytical |      numerical 
 -- | -- | -- | -------------- | -------------- 
  1 |  1 |  1 |   18.438717690 |   18.438866604 ✔
  1 |  1 |  2 |   21.728550862 |   21.728734737 ✔
  1 |  2 |  1 |   24.201609025 |   24.201827651 ✔
  1 |  2 |  2 |   27.495979260 |   27.491695785 ✔
  2 |  1 |  1 |   64.700640522 |   64.702637234 ✔
  2 |  1 |  2 |   68.001599692 |   67.992505368 ✔
  2 |  2 |  1 |   70.474983233 |   70.465598281 ✔
  2 |  2 |  2 |   74.166741200 |   73.755466415 ✔