API Reference
QSpin.Parameters — Module
Defines the ParameterType used by parameters arguments to QSpin equation-of-motion functions.
QSpin.Parameters.ParameterType — Type
Static type for parameter arguments that QSpin functions take.
QSpin.Grids.CartGrid — Method
Set up a uniform Cartesian grid, applicable for the Fourier spectral method.
Arguments
CompDomain::Array{Float64}: The half computational domain size. Input as an array for [Lx,Ly,Lz], and up to 3D.GridSize::Array{Float64}: The number of grid points in each dimension. Input as an array of the form [Nx,Ny,Nz], and up to 3D.
QSpin.Grids.Pfft_Lzψ — Method
Return a function that computes the quantum angular momentum using the Fourier spectral method.
The angular momentum operator along the z-axis is given by
$\mathcal{L}_z = -\mathrm{i} \left(x \frac{\partial}{\partial y} - y \frac{\partial}{\partial x} \right).$
The returned function has signature Lz(ψ, parameters, time).
The various coordinate matrices can be obtained via the CartGrid function in Grids.jl. The plans for the forward and inverse Fourier transforms can be generated using the plan_{i}fft function(s) provided by FFTW.
Arguments
X::Array{Float64}: x-coordinate matrix.Y::Array{Float64}: y-coordinate matrix.Kx::Array{Float64}: kx-coordinate matrix.Ky::Array{Float64}: ky-coordinate matrix.PFFT::: Plan for forward FFT.PiFFT::: Plan for inverse FFT.
QSpin.Grids.Pfft_ke — Method
Return a function that computes the quantum kinetic energy term in Schrodinger-type equations.
Namely, return a function that computes $-\nabla^2 \psi$, given $\psi$, using the Fourier spectral method. The returned function has signature kinetic_energy(ψ, parameters, time).
The k-square matrix can be obtained from the CartGrid function in Grids.jl. The plans for the forward and inverse Fourier transforms can be generated using the plan_{i}fft function(s) provided by FFTW.
Arguments
KE_mtx::AbstractArray: k-square matrix for computing kinetic energy in momentum space. This can be obtained by using the k-matrices inCartGridfunction inGrids.jl.PFFT::: Plan for forward FFT.PiFFT::: Plan for inverse FFT.
Returns
kinetic_energy::Function: Function that evaluates the kinetic energy.
QSpin.Grids.fft_Lzψ — Method
Return a function that computes the quantum angular momentum using the Fourier spectral method.
The angular momentum operator along the z-axis is given by
$\mathcal{L}_z = -\mathrm{i} \left(x \frac{\partial}{\partial y} - y \frac{\partial}{\partial x} \right).$
The returned function has signature Lz(ψ, parameters, time).
The various coordinate matrices can be obtained via the CartGrid function in Grids.jl.
TODO: Combine with Pfft_Lzψ, below.
Arguments
X::Array{Float64}: x-coordinate matrix.Y::Array{Float64}: y-coordinate matrix.Kx::Array{Float64}: kx-coordinate matrix.Ky::Array{Float64}: ky-coordinate matrix.
QSpin.Grids.fft_ke — Method
Return a function that computes the quantum kinetic energy term in Schrodinger-type equations.
Namely, return a function that computes $-\nabla^2 \psi$, given $\psi$, using the Fourier spectral method. The returned function has signature kinetic_energy(ψ, parameters, time).
The k-square matrix can be obtained from the CartGrid function in Grids.jl.
TODO: Combine this function with Pfft_ke, above.
Arguments
KE_mtx::AbstractArray: k-square matrix for computing kinetic energy in momentum space. This can be obtained by using the k-matrices inCartGridfunction inGrids.jl.
Returns
kinetic_energy::Function: Function that evaluates the kinetic energy.
QSpin.Hamiltonian.hamiltonian! — Function
Construct a Hamiltonian from a Kinetic and Potential energy.
Returns a function H!(dψ, ψ, parameters, time) that evaluates the Hamiltonian $\mathcal{H}$ formed from the given kinetic ($K$) and potential ($V$) energy functions at the given time:
$\mathcal{H}(\psi, t) = \mathrm{irt} \times \left( K(\psi, t) + V(\psi, t) \right),$
where $\mathrm{irt}$ is a given propagation factor.
The KineticEnergy and PotentialEnergy functions are assumed to take (ψ, parameters, time) as positional arguments, and return the value of the respective energy quantities.
Arguments
KineticEnergy::Function: Function that computes the kinetic energy term in the equation of motion.PotentialEnergy::Function: Function that computes the potential energy term in the equation of motion.irt::Complex64: Propagation factor, which can be -1 for imaginary time evolution, -im for real time evolution, or a general complex value for a dissipative evolution, namely, dGPE.
Returns
H!::Function: The Hamiltonian formed from the kinetic and potential energies
QSpin.OdeSolve.evolve — Function
Time-evolve an equation of motion using OrdinaryDiffEq (DE).
This is a thin wrapper around DE.ODEProblem and DE.solve. The keyword arguments in solver_options are handed directly to DE.solve. See their documentation for the full range of options.
The equation of motion provided is expected to have signature (dψ, ψ, parameters, t), where dψ is the array to which the output is to be written in-place. ψ, parameters, and t are the current field, parameters of the problem, and current time respectively.
Arguments
eom!::Function: Equation of motion.ψ0::AbstractArray: Initial field value.t_start::Float64: Start time for system evolution.t_end::Float64: End time for system evolution.p::NamedTuple: Problem parameters, to pass toDE.ODEProblem.solver_options: Keyword arguments that will be passed toDE.solve.
Returns
solution: Solution object for the problem that was time-evolved.
QSpin.OdeSolve.evolve_rk4 — Method
Time-evolve an equation of motion using the RK4 Runge-Kutta 4-th order method.
Arguments
ψ0::AbstractArray: Initial value for the field at time 0.dt::Float64: Timestep interval (used as the integral timestep in RK4).Dt::Float64: Time interval between recorded field values.t_end::Float64: End time for equation evolution.eom::Function: The equation of motion of the problem.
Returns
ψall::AbstractArray: Field values at recorded timestamps.ψall[..., i]is the field value at timetspan[i].tspan::Vector{Float64}: Timestamps at which field values were recorded.
QSpin.OdeSolve.ode_rk4 — Method
Integrate an equation of motion using the Runge-Kutta 4-th order method.
Arguments
u::AbstractArray: The target solution of the equation of motion.δt::Float64: The integrating time step.time::Float64: Current time.eom::Function: The equation of motion of the problem.
Returns
un::AbstractArray: Field value at timetime + δt.