diff --git a/docs/src/InfinitePotentialWell3D.md b/docs/src/InfinitePotentialWell3D.md index 7688bae..de7c830 100644 --- a/docs/src/InfinitePotentialWell3D.md +++ b/docs/src/InfinitePotentialWell3D.md @@ -14,7 +14,7 @@ Antique.InfinitePotentialWell3D #### Potential ```@docs; canonical=false -Antique.V(::InfinitePotentialWell3D, ::Any, ::Any, ::Any) +Antique.V(::InfinitePotentialWell3D, ::Any...) ``` #### Eigenvalues @@ -24,7 +24,7 @@ Antique.E(::InfinitePotentialWell3D) #### Eigenfunctions ```@docs; canonical=false -Antique.ψ(::InfinitePotentialWell3D, ::Any, ::Any, ::Any) +Antique.ψ(::InfinitePotentialWell3D, ::Any...) ``` ## Usage & Examples @@ -33,16 +33,14 @@ Antique.ψ(::InfinitePotentialWell3D, ::Any, ::Any, ::Any) ```@example IPW3D using Antique -IPW3D = InfinitePotentialWell3D(Lx=1.0, Ly=1.0, Lz=1.0, m=1.0, ℏ=1.0) +IPW3D = InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0) ; #hide ``` Parameters: ```@repl IPW3D -IPW3D.Lx -IPW3D.Ly -IPW3D.Lz +IPW3D.L IPW3D.m IPW3D.ℏ ``` @@ -50,14 +48,36 @@ IPW3D.ℏ Eigenvalues: ```@repl IPW3D -E(IPW3D, nx=1, ny=1, nz=1) -E(IPW3D, nx=2, ny=1, nz=1) -E(IPW3D, nx=1, ny=2, nz=1) -E(IPW3D, nx=1, ny=1, nz=2) -E(IPW3D, nx=2, ny=2, nz=1) -E(IPW3D, nx=2, ny=1, nz=2) -E(IPW3D, nx=1, ny=2, nz=2) -E(IPW3D, nx=2, ny=2, nz=2) +E(IPW3D, n=[1,1,1]) +E(IPW3D, n=[2,1,1]) +E(IPW3D, n=[1,2,1]) +E(IPW3D, n=[1,1,2]) +E(IPW3D, n=[2,2,1]) +E(IPW3D, n=[2,1,2]) +E(IPW3D, n=[1,2,2]) +E(IPW3D, n=[2,2,2]) +``` + +Wave functions: + +```@example IPW3D +using CairoMakie + +# settings +f = Figure() +ax = Axis(f[1,1], xlabel=L"$x$", ylabel=L"$\psi(x,0.5,0.5)$") + +# plot +w1 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[1,1,1])) +w2 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[2,1,1])) +w3 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[1,2,1])) +w4 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[3,1,1])) +w5 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[4,1,1])) + +# legend +axislegend(ax, [w1, w2, w3, w4, w5], [L"n=[1,1,1]", L"n=[2,1,1]", L"n=[1,2,1]", L"n=[3,1,1]", L"n=[4,1,1]"], position=:lb) + +f ``` ## Testing diff --git a/src/InfinitePotentialWell3D.jl b/src/InfinitePotentialWell3D.jl index ae48a6d..bd1847f 100644 --- a/src/InfinitePotentialWell3D.jl +++ b/src/InfinitePotentialWell3D.jl @@ -2,43 +2,35 @@ export InfinitePotentialWell3D, V, E, ψ # parameters @kwdef struct InfinitePotentialWell3D - Lx = 1.0 - Ly = 1.0 - Lz = 1.0 + L = [1.0, 1.0, 1.0] m = 1.0 ℏ = 1.0 end # potential -function V(model::InfinitePotentialWell3D, x,y,z) - Lx = model.Lx - Ly = model.Ly - Lz = model.Lz - return (0 = ∫ψₙ*ψₙdx = δᵢⱼ @@ -14,31 +13,40 @@ println(raw""" ```""") @testset "<ψᵢ|ψⱼ> = ∫ψₙ*ψₙdx = δᵢⱼ" begin - println("ix | iy | iz | jx | jy | jz | analytical | numerical ") - println("-- | -- | -- | -- | -- | -- | ----------------- | ----------------- ") - # for ix in 1:2 - # for iy in 1:2 - # for iz in 1:2 - # for jx in 1:2 - # for jy in 1:2 - # for jz in 1:2 - # analytical = ((ix==jx && iy==jy && iz==jz) ? 1 : 0) - # numerical = quadgk(x -> - # quadgk(y -> - # quadgk(z -> - # conj(ψ(IPW3D, x,y,z, nx=ix, ny=iy, nz=iz)) * ψ(IPW3D, x,y,z, nx=jx, ny=jy, nz=jz) - # , 0.0, IPW3D.Lz, maxevals=10)[1] - # , 0.0, IPW3D.Ly, maxevals=10)[1] - # , 0.0, IPW3D.Lz, maxevals=10)[1] - # acceptance = iszero(analytical) ? isapprox(analytical, numerical, atol=1e-2) : isapprox(analytical, numerical, rtol=1e-2) - # @printf("%2d | %2d | %2d | %2d | %2d | %2d | %17.12f | %17.12f %s\n", ix, iy, iz, jx, jy, jz, analytical, numerical, acceptance ? "✔" : "✗") - # @test acceptance - # end - # end - # end - # end - # end - # end + for IPW3D in [ + InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0) + InfinitePotentialWell3D(L=[1.2,3.4,4.5], m=1.0, ℏ=1.0) + InfinitePotentialWell3D(L=[1.2,3.4,4.5], m=2.0, ℏ=1.0) + InfinitePotentialWell3D(L=[1.2,3.4,4.5], m=1.0, ℏ=2.0) + ] + @show IPW3D + println("ix | iy | iz | jx | jy | jz | analytical | numerical ") + println("-- | -- | -- | -- | -- | -- | ----------------- | ----------------- ") + for ix in 1:2 + for iy in 1:2 + for iz in 1:2 + for jx in 1:2 + for jy in 1:2 + for jz in 1:2 + analytical = ((ix==jx && iy==jy && iz==jz) ? 1 : 0) + numerical = quadgk(x -> + quadgk(y -> + quadgk(z -> + conj(ψ(IPW3D, x,y,z, n=[ix,iy,iz])) * ψ(IPW3D, x,y,z, n=[jx,jy,jz]) + , 0.0, IPW3D.L[3], maxevals=10)[1] + , 0.0, IPW3D.L[2], maxevals=10)[1] + , 0.0, IPW3D.L[1], maxevals=10)[1] + acceptance = iszero(analytical) ? isapprox(analytical, numerical, atol=1e-5) : isapprox(analytical, numerical, rtol=1e-5) + @printf("%2d | %2d | %2d | %2d | %2d | %2d | %17.12f | %17.12f %s\n", ix, iy, iz, jx, jy, jz, analytical, numerical, acceptance ? "✔" : "✗") + @test acceptance + end + end + end + end + end + end + println() + end end println("""``` @@ -113,33 +121,41 @@ are given by the sum of 2 Taylor series: ``` ```""") -ψTψ(IPW3D, x,y,z; nx=0,ny=0,nz=0, Δx=0.01,Δy=0.01,Δz=0.01) = -IPW3D.ℏ^2/(2*IPW3D.m) * conj(ψ(IPW3D,x,y,z,nx=nx,ny=ny,nz=nz)) * ( - ( ψ(IPW3D,x+Δx,y,z,nx=nx,ny=ny,nz=nz) -2*ψ(IPW3D,x,y,z,nx=nx,ny=ny,nz=nz) + ψ(IPW3D,x-Δx,y,z,nx=nx,ny=ny,nz=nz) ) / Δx^2 + - ( ψ(IPW3D,x,y+Δy,z,nx=nx,ny=ny,nz=nz) -2*ψ(IPW3D,x,y,z,nx=nx,ny=ny,nz=nz) + ψ(IPW3D,x,y-Δy,z,nx=nx,ny=ny,nz=nz) ) / Δy^2 + - ( ψ(IPW3D,x,y,z+Δz,nx=nx,ny=ny,nz=nz) -2*ψ(IPW3D,x,y,z,nx=nx,ny=ny,nz=nz) + ψ(IPW3D,x,y,z-Δz,nx=nx,ny=ny,nz=nz) ) / Δz^2 +ψTψ(IPW3D, x, y, z; n=[1,1,1], Δx=0.01, Δy=0.01, Δz=0.01) = -IPW3D.ℏ^2/(2*IPW3D.m) * conj(ψ(IPW3D,x,y,z,n=n)) * ( + ( ψ(IPW3D,x+Δx,y,z,n=n) -2*ψ(IPW3D,x,y,z,n=n) + ψ(IPW3D,x-Δx,y,z,n=n) ) / Δx^2 + + ( ψ(IPW3D,x,y+Δy,z,n=n) -2*ψ(IPW3D,x,y,z,n=n) + ψ(IPW3D,x,y-Δy,z,n=n) ) / Δy^2 + + ( ψ(IPW3D,x,y,z+Δz,n=n) -2*ψ(IPW3D,x,y,z,n=n) + ψ(IPW3D,x,y,z-Δz,n=n) ) / Δz^2 ) @testset "<ψₙ|H|ψₙ> = ∫ψₙ*Tψₙdx = Eₙ" begin - println(" nx | ny | nz | analytical | numerical ") - println(" -- | --- | --- | ----------------- | ----------------- ") - # for nx in [1,2] - # for ny in [1,2] - # for nz in [1,2] - # IPW3D = InfinitePotentialWell3D(Lx=1.0,Ly=2.0,Lz=3.0) - # analytical = E(IPW3D,nx=nx,ny=ny,nz=nz) - # numerical = quadgk(x -> - # quadgk(y -> - # quadgk(z -> - # ψTψ(IPW3D, x, y, z, nx=nx, ny=ny, nz=nz, Δx=IPW3D.Lx*0.0001, Δy=IPW3D.Ly*0.0001, Δz=IPW3D.Lz*0.0001) - # , 0, IPW3D.Lz, maxevals=5)[1] - # , 0, IPW3D.Ly, maxevals=5)[1] - # , 0, IPW3D.Lz, maxevals=5)[1] - # acceptance = iszero(analytical) ? isapprox(analytical, numerical, atol=1e-1) : isapprox(analytical, numerical, rtol=1e-1) - # @test acceptance - # @printf(" %2d | %3d | %3d | %17.12f | %17.12f %s\n", nx, ny, nz, numerical, analytical, acceptance ? "✔" : "✗") - # end - # end - # end + for IPW3D in [ + InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0) + InfinitePotentialWell3D(L=[1.2,3.4,4.5], m=1.0, ℏ=1.0) + InfinitePotentialWell3D(L=[1.2,3.4,4.5], m=2.0, ℏ=1.0) + InfinitePotentialWell3D(L=[1.2,3.4,4.5], m=1.0, ℏ=2.0) + ] + @show IPW3D + println(" nx | ny | nz | analytical | numerical ") + println(" -- | -- | -- | ----------------- | ----------------- ") + for nx in [1,2] + for ny in [1,2] + for nz in [1,2] + analytical = E(IPW3D,n=[nx,ny,nz]) + numerical = quadgk(x -> + quadgk(y -> + quadgk(z -> + ψTψ(IPW3D, x, y, z, n=[nx,ny,nz], Δx=IPW3D.L[1]*0.0001, Δy=IPW3D.L[2]*0.0001, Δz=IPW3D.L[3]*0.0001) + , 0, IPW3D.L[3], maxevals=5)[1] + , 0, IPW3D.L[2], maxevals=5)[1] + , 0, IPW3D.L[1], maxevals=5)[1] + acceptance = iszero(analytical) ? isapprox(analytical, numerical, atol=1e-5) : isapprox(analytical, numerical, rtol=1e-5) + @test acceptance + @printf(" %2d | %2d | %2d | %17.12f | %17.12f %s\n", nx, ny, nz, numerical, analytical, acceptance ? "✔" : "✗") + end + end + end + println() + end end println("""```""") \ No newline at end of file diff --git a/test/result/InfinitePotentialWell3D.log b/test/result/InfinitePotentialWell3D.log index e35501a..ac3f50d 100644 --- a/test/result/InfinitePotentialWell3D.log +++ b/test/result/InfinitePotentialWell3D.log @@ -5,8 +5,278 @@ ``` ``` +IPW3D = InfinitePotentialWell3D([1.0, 1.0, 1.0], 1.0, 1.0) ix | iy | iz | jx | jy | jz | analytical | numerical -- | -- | -- | -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 1 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + +IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 1.0) +ix | iy | iz | jx | jy | jz | analytical | numerical +-- | -- | -- | -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 1 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + +IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 2.0, 1.0) +ix | iy | iz | jx | jy | jz | analytical | numerical +-- | -- | -- | -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 1 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + +IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 2.0) +ix | iy | iz | jx | jy | jz | analytical | numerical +-- | -- | -- | -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 1 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 1 | 2 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 1 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 1 | 2 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 1 | 2 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 1 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 1 | 2 | 2 | 1 | 2 | 1.000000000000 | 1.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 1 | 2 | 2 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 1 | 1 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 1 | 1.000000000000 | 1.000000000000 ✔ + 2 | 2 | 1 | 2 | 2 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 1 | 2 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 1 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 1 | 2 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 1 | 2 | 0.000000000000 | 0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 1 | 0.000000000000 | -0.000000000000 ✔ + 2 | 2 | 2 | 2 | 2 | 2 | 1.000000000000 | 1.000000000000 ✔ + ``` #### Eigenvalues @@ -71,7 +341,53 @@ are given by the sum of 2 Taylor series: \end{aligned} ``` ``` - nx | ny | nz | analytical | numerical - -- | --- | --- | ----------------- | ----------------- +IPW3D = InfinitePotentialWell3D([1.0, 1.0, 1.0], 1.0, 1.0) + nx | ny | nz | analytical | numerical + -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 14.804406476266 | 14.804406601634 ✔ + 1 | 1 | 2 | 29.608812468115 | 29.608813203268 ✔ + 1 | 2 | 1 | 29.608812464319 | 29.608813203268 ✔ + 1 | 2 | 2 | 44.413218454572 | 44.413219804902 ✔ + 2 | 1 | 1 | 29.608812464319 | 29.608813203268 ✔ + 2 | 1 | 2 | 44.413218454573 | 44.413219804902 ✔ + 2 | 2 | 1 | 44.413218455735 | 44.413219804902 ✔ + 2 | 2 | 2 | 59.217624443289 | 59.217626406536 ✔ + +IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 1.0) + nx | ny | nz | analytical | numerical + -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 4.097525875573 | 4.097525911937 ✔ + 1 | 1 | 2 | 4.828607653006 | 4.828607719425 ✔ + 1 | 2 | 1 | 5.378183833979 | 5.378183922459 ✔ + 1 | 2 | 2 | 6.109265611538 | 6.109265729947 ✔ + 2 | 1 | 1 | 14.378363364341 | 14.378363829739 ✔ + 2 | 1 | 2 | 15.109445141491 | 15.109445637227 ✔ + 2 | 2 | 1 | 15.659021323388 | 15.659021840261 ✔ + 2 | 2 | 2 | 16.390103100677 | 16.390103647749 ✔ + +IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 2.0, 1.0) + nx | ny | nz | analytical | numerical + -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 2.048762937787 | 2.048762955969 ✔ + 1 | 1 | 2 | 2.414303826503 | 2.414303859713 ✔ + 1 | 2 | 1 | 2.689091916990 | 2.689091961230 ✔ + 1 | 2 | 2 | 3.054632805769 | 3.054632864974 ✔ + 2 | 1 | 1 | 7.189181682171 | 7.189181914869 ✔ + 2 | 1 | 2 | 7.554722570746 | 7.554722818613 ✔ + 2 | 2 | 1 | 7.829510661694 | 7.829510920130 ✔ + 2 | 2 | 2 | 8.195051550338 | 8.195051823874 ✔ + +IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 2.0) + nx | ny | nz | analytical | numerical + -- | -- | -- | ----------------- | ----------------- + 1 | 1 | 1 | 16.390103502294 | 16.390103647749 ✔ + 1 | 1 | 2 | 19.314430612024 | 19.314430877701 ✔ + 1 | 2 | 1 | 21.512735335918 | 21.512735689837 ✔ + 1 | 2 | 2 | 24.437062446150 | 24.437062919789 ✔ + 2 | 1 | 1 | 57.513453457366 | 57.513455318954 ✔ + 2 | 1 | 2 | 60.437780565964 | 60.437782548907 ✔ + 2 | 2 | 1 | 62.636085293552 | 62.636087361042 ✔ + 2 | 2 | 2 | 65.560412402708 | 65.560414590995 ✔ + ``` diff --git a/test/runtests.jl b/test/runtests.jl index e7ed737..f9a8b72 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -10,7 +10,7 @@ using LaTeXStrings using SpecialFunctions @testset "Antique.jl" begin - for model in Antique.models # [:CoulombTwoBody, :HydrogenAtom] + for model in [:InfinitePotentialWell3D] # Antique.models result = @capture_out begin include("./$(model).jl") end