-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ajarifi/main
add Delta potential
- Loading branch information
Showing
15 changed files
with
723 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
```@meta | ||
CurrentModule = Antique | ||
``` | ||
|
||
# Delta Potential | ||
|
||
The Delta potential is one of the simplest models for quantum mechanical system in 1D. | ||
It always has one bound state and its wave function has a cusp at the origin. | ||
|
||
## Defitions | ||
|
||
This model is described with the time-independent Schrödinger equation | ||
|
||
```math | ||
\hat{H} \psi(x) = E \psi(x), | ||
``` | ||
|
||
and the Hamiltonian | ||
```math | ||
\hat{H} = - \frac{\hbar^2}{2m} \frac{\mathrm{d}^2}{\mathrm{d}x ^2} + V(x). | ||
``` | ||
|
||
Parameters are specified with the following struct. | ||
|
||
#### Parameters | ||
|
||
```@docs | ||
DeltaPotential | ||
``` | ||
|
||
#### Potential | ||
```@docs | ||
V(::DeltaPotential) | ||
``` | ||
|
||
#### Eigen Values | ||
```@docs | ||
E(::DeltaPotential) | ||
``` | ||
|
||
#### Eigen Functions | ||
```@docs | ||
ψ(::DeltaPotential) | ||
``` | ||
|
||
## Usage & Examples | ||
|
||
[Install Antique.jl](@ref Install) for the first use and run `using Antique` before each use. The energy `E()`, wavefunction `ψ()`, potential `V()` and some other functions are suppoted. In this system, the model is generated by `DeltaPotential` and several parameters `α`, `m` and `ℏ` are set as optional arguments. | ||
|
||
```julia | ||
using Antique | ||
DP = DeltaPotential(α=1.0, m=1.0, ℏ=1.0) | ||
``` | ||
|
||
|
||
|
||
|
||
Parameters: | ||
|
||
```julia | ||
julia> DP.α | ||
1.0 | ||
|
||
julia> DP.m | ||
1.0 | ||
|
||
julia> DP.ℏ | ||
1.0 | ||
``` | ||
|
||
|
||
|
||
Eigen values: | ||
|
||
```julia | ||
julia> E(DP) | ||
-0.5 | ||
``` | ||
|
||
|
||
|
||
Wave functions: | ||
|
||
```julia | ||
DP = DeltaPotential(α=0.1, m=0.5, ℏ=0.1) | ||
x = LinRange(-2,2,500); | ||
|
||
using Plots | ||
plot(x, x->ψ(DP,x), linewidth=3) | ||
plot!(xlim=[-2,2], ylim=[0,2.5], legend=false) | ||
plot!(xlabel="x", ylabel="ψ(x)", title="Delta Potential") | ||
``` | ||
|
||
![](./assets/fig//DeltaPotential_4_1.png) | ||
|
||
|
||
|
||
## Testing | ||
|
||
Unit testing and Integration testing were done using numerical integration ([QuadGK.jl](https://juliamath.github.io/QuadGK.jl/stable/)). The test script is [here](https://github.com/ohno/Antique.jl/blob/main/test/DeltaPotential.jl). | ||
|
||
#### Normalization of $\psi(x)$ | ||
|
||
```math | ||
\int_{-\infty}^{\infty} \psi^\ast(x) \psi(x) ~\mathrm{d}x = 1 | ||
``` | ||
|
||
``` | ||
α | m | ℏ | analytical | numerical | ||
--- | --- | --- | ----------------- | ----------------- | ||
0.1 | 0.1 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
0.1 | 0.1 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
0.1 | 0.1 | 7.0 | 1.000000000000 | 1.000004676239 ✔ | ||
0.1 | 1.0 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
0.1 | 1.0 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
0.1 | 1.0 | 7.0 | 1.000000000000 | 0.999999999999 ✔ | ||
0.1 | 7.0 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
0.1 | 7.0 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
0.1 | 7.0 | 7.0 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 0.1 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 0.1 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 0.1 | 7.0 | 1.000000000000 | 0.999999999999 ✔ | ||
1.0 | 1.0 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 1.0 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 1.0 | 7.0 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 7.0 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 7.0 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
1.0 | 7.0 | 7.0 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 0.1 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 0.1 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 0.1 | 7.0 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 1.0 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 1.0 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 1.0 | 7.0 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 7.0 | 0.1 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 7.0 | 1.0 | 1.000000000000 | 1.000000000000 ✔ | ||
7.0 | 7.0 | 7.0 | 1.000000000000 | 1.000000000000 ✔ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
```@meta | ||
CurrentModule = Antique | ||
``` | ||
|
||
# Delta Potential | ||
|
||
The Delta potential is one of the simplest models for quantum mechanical system in 1D. | ||
It always has one bound state and its wave function has a cusp at the origin. | ||
|
||
## Defitions | ||
|
||
This model is described with the time-independent Schrödinger equation | ||
|
||
```math | ||
\hat{H} \psi(x) = E \psi(x), | ||
``` | ||
|
||
and the Hamiltonian | ||
```math | ||
\hat{H} = - \frac{\hbar^2}{2m} \frac{\mathrm{d}^2}{\mathrm{d}x ^2} + V(x). | ||
``` | ||
|
||
Parameters are specified with the following struct. | ||
|
||
#### Parameters | ||
|
||
```@docs | ||
DeltaPotential | ||
``` | ||
|
||
#### Potential | ||
```@docs | ||
V(::DeltaPotential) | ||
``` | ||
|
||
#### Eigen Values | ||
```@docs | ||
E(::DeltaPotential) | ||
``` | ||
|
||
#### Eigen Functions | ||
```@docs | ||
ψ(::DeltaPotential) | ||
``` | ||
|
||
## Usage & Examples | ||
|
||
[Install Antique.jl](@ref Install) for the first use and run `using Antique` before each use. The energy `E()`, wavefunction `ψ()`, potential `V()` and some other functions are suppoted. In this system, the model is generated by `DeltaPotential` and several parameters `α`, `m` and `ℏ` are set as optional arguments. | ||
|
||
```julia; cache = :all; results = "hidden" | ||
using Antique | ||
DP = DeltaPotential(α=1.0, m=1.0, ℏ=1.0) | ||
``` | ||
|
||
Parameters: | ||
|
||
```julia; term = true | ||
DP.α | ||
DP.m | ||
DP.ℏ | ||
``` | ||
|
||
Eigen values: | ||
|
||
```julia; term = true | ||
E(DP) | ||
``` | ||
|
||
Wave functions: | ||
|
||
```julia | ||
DP = DeltaPotential(α=0.1, m=0.5, ℏ=0.1) | ||
x = LinRange(-2,2,500); | ||
|
||
using Plots | ||
plot(x, x->ψ(DP,x), linewidth=3) | ||
plot!(xlim=[-2,2], ylim=[0,2.5], legend=false) | ||
plot!(xlabel="x", ylabel="ψ(x)", title="Delta Potential") | ||
``` | ||
|
||
## Testing | ||
|
||
Unit testing and Integration testing were done using numerical integration ([QuadGK.jl](https://juliamath.github.io/QuadGK.jl/stable/)). The test script is [here](https://github.com/ohno/Antique.jl/blob/main/test/DeltaPotential.jl). | ||
|
||
```julia; line_width = 500 | ||
println(Antique.load("../../test/result/DeltaPotential.log")) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
export DeltaPotential, V, E, ψ | ||
|
||
# Parameters | ||
@kwdef struct DeltaPotential | ||
α = 1.0 | ||
m = 1.0 | ||
ℏ = 1.0 | ||
end | ||
|
||
# Potential | ||
function V(model::DeltaPotential, x) | ||
return x==0 ? -Inf : 0 | ||
end | ||
|
||
# Energy | ||
function E(model::DeltaPotential) | ||
α = model.α | ||
m = model.m | ||
ℏ = model.ℏ | ||
return -(m*α^2)/(2*ℏ^2) | ||
end | ||
|
||
# Wave Function | ||
function ψ(model::DeltaPotential, x) | ||
α = model.α | ||
m = model.m | ||
ℏ = model.ℏ | ||
return sqrt(m*α)/ℏ * exp.(-m*α*abs.(x)/ℏ^2) | ||
end | ||
|
||
# Documents | ||
|
||
@doc raw""" | ||
`DeltaPotential(α=1.0, m=1.0, ℏ=1.0)` | ||
``\alpha`` is the potential strength, ``m`` is the mass of particle and ``\hbar`` is the reduced Planck constant (Dirac's constant). | ||
""" DeltaPotential | ||
|
||
@doc raw""" | ||
`V(model::DeltaPotential; x)` | ||
```math | ||
V(x) = -\alpha \delta(x). | ||
``` | ||
""" V(model::DeltaPotential) | ||
|
||
@doc raw""" | ||
`E(model::DeltaPotential)` | ||
```math | ||
E = - \frac{m\alpha^2}{2\hbar^2} | ||
``` | ||
""" E(model::DeltaPotential) | ||
|
||
@doc raw""" | ||
`ψ(model::DeltaPotential, x)` | ||
```math | ||
\psi(x) = \frac{\sqrt{m\alpha}}{\hbar} \mathrm{e}^{-m\alpha |x|/\hbar^2} | ||
``` | ||
""" ψ(model::DeltaPotential) |
Oops, something went wrong.