Stationary states¶
Generated from the docstrings in the source code.
eigensolver
¶
Direct eigensolver for H = −ℏ²/2m ∇² + V(r) on 1D/2D/3D grids.
The Hamiltonian is never stored: it is applied matrix-free with FFTs and handed to LOBPCG, preconditioned by the inverse kinetic operator in k-space. For a real potential the spectral Hamiltonian is real-symmetric, so the eigenvectors are real.
eigenstates(grid, potential, n_states: int = 6, hbar: float = 1.0, m: float = 1.0, tol: float = None, max_iter: int = 1000, seed: int = 0, method: str = 'auto', workers: int = -1) -> Tuple[np.ndarray, List]
¶
Lowest n_states eigenpairs of H.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
(auto, lobpcg, lanczos)
|
'lanczos' uses ARPACK (robust, best for small grids); 'lobpcg' uses a k-space preconditioned block solver (fast for large 2D/3D grids). 'auto' picks Lanczos below 20 000 grid points. |
'auto'
|
tol
|
float
|
Lanczos: relative eigenvalue accuracy (default 1e-12). LOBPCG: residual-norm tolerance (default 1e-6); the eigenvalue error scales as the residual squared. |
None
|
seed
|
int
|
Seed of the deterministic random starting block (LOBPCG). |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
energies |
(ndarray, shape(n_states))
|
Ascending eigenvalues. |
states |
list of WaveFunction
|
Normalised eigenfunctions (∫|ψ|² dV = 1). Degenerate levels are returned as an arbitrary orthonormal basis of their subspace. |
Source code in quantumlab/stationary/eigensolver.py
imaginary_time
¶
Imaginary-time propagation (ψ ← e^{−Hτ}ψ / ‖·‖) for ground and excited states, including the nonlinear Gross–Pitaevskii ground state.
The converged state of 2nd-order Strang imaginary-time stepping differs from the exact eigenstate by O(dτ²); the reported energy is evaluated with the exact spectral Hamiltonian, so its error is O(dτ⁴) for the ground state.
ground_state(grid, potential, dtau: float = 0.01, nonlinearity: float = 0.0, initial=None, tol: float = 1e-11, max_steps: int = 50000, check_interval: int = 20, hbar: float = 1.0, m: float = 1.0, orthogonal_to: Optional[List] = None, workers: int = -1, rotation: float = 0.0, backend='numpy')
¶
Relax to the lowest-energy state by imaginary-time propagation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtau
|
float or sequence of float
|
Imaginary time step. A decreasing sequence runs a continuation: the
large steps relax slow modes (e.g. of vortex lattices) in few steps,
the small ones lower the O(dτ²) error floor. |
0.01
|
nonlinearity
|
float
|
Gross–Pitaevskii coupling g (ψ normalised to 1). g = 0 gives the linear Schrödinger ground state. |
0.0
|
initial
|
WaveFunction or ndarray
|
Starting guess. A good guess (e.g. Thomas–Fermi) speeds convergence. |
None
|
tol
|
float
|
Stop when the energy changes by less than |
1e-11
|
orthogonal_to
|
list of WaveFunction
|
States projected out after each step (Gram–Schmidt), used to obtain excited states of the linear problem. |
None
|
rotation
|
float
|
Angular velocity Ω of a frame rotating about z (2D/3D). Energies and μ are then those of H − ΩL_z. Above the critical Ω the GP ground state contains vortices; imaginary time only reaches it if the guess breaks rotational symmetry (e.g. an imprinted vortex or a lattice seed). |
0.0
|
backend
|
(numpy, cupy, auto)
|
Where the propagation runs (see |
'numpy'
|
Returns:
| Name | Type | Description |
|---|---|---|
wf |
WaveFunction
|
|
info |
ConvergenceInfo
|
|
Source code in quantumlab/stationary/imaginary_time.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
excited_states(grid, potential, n_states: int, dtau: float = 0.01, tol: float = 1e-11, max_steps: int = 50000, seed: int = 0, hbar: float = 1.0, m: float = 1.0, workers: int = -1)
¶
Lowest n_states eigenstates of the linear Hamiltonian, found one by one
with imaginary time + Gram–Schmidt against the states already converged.
Starting guesses are seeded random fields (deterministic for a fixed seed).
Returns:
| Name | Type | Description |
|---|---|---|
energies |
ndarray
|
|
states |
list of WaveFunction
|
|
infos |
list of ConvergenceInfo
|
|
Source code in quantumlab/stationary/imaginary_time.py
coupled_ground_state(grid, potentials, couplings, initial, dtau: float = 0.005, tol: float = 1e-11, max_steps: int = 50000, check_interval: int = 20, hbar: float = 1.0, m: float = 1.0, rotation: float = 0.0, backend='numpy', workers: int = -1)
¶
Lowest-energy state of coupled Gross–Pitaevskii equations by imaginary
time, at fixed populations N_i given by the norms of initial.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial
|
sequence of WaveFunction or ndarray
|
One starting state per component. For immiscible mixtures the guess should break the symmetry between the components (e.g. displaced clouds); a symmetric guess can stay on a symmetric saddle point. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
states |
tuple of WaveFunction
|
|
info |
CoupledConvergenceInfo
|
|
Source code in quantumlab/stationary/imaginary_time.py
conjugate_gradient
¶
Ground states by preconditioned nonlinear conjugate gradient on the sphere ‖ψ‖² = N (Antoine, Levitt & Tang, J. Comput. Phys. 343, 92 (2017)).
Imaginary-time propagation is a first-order method whose fixed point carries an O(dτ²) error, and soft modes (vortex lattices, elongated condensates) relax in it as exp(−Δτ) with a tiny gap Δ. Minimising the energy directly removes both problems: the fixed point is an exact stationary state, so the residual ‖Hψ − μψ‖ can be driven to small values, and conjugate directions converge on soft modes much faster than steepest descent.
The preconditioner is P = P_T^½ P_V P_T^½ with P_T = (α + ℏ²k²/2m)⁻¹ in Fourier space and P_V = (α + V + g|ψ|²)⁻¹ in real space, which tames both the kinetic and the potential stiffness.
ground_state_pcg(grid, potential, initial=None, nonlinearity: float = 0.0, rotation: float = 0.0, tol: float = 1e-08, max_iter: int = 10000, hbar: float = 1.0, m: float = 1.0, callback=None, callback_interval: int = 100, workers: int = -1)
¶
Minimise E[ψ] = ⟨ψ|−ℏ²∇²/2m + V − ΩL_z|ψ⟩ + (g/2)∫|ψ|⁴ at fixed norm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial
|
WaveFunction or ndarray
|
Starting state; its norm N is kept. For vortex states start from a guess with vortices (e.g. from damped dynamics or imaginary time). |
None
|
tol
|
float
|
Stop when the residual ‖Hψ − μψ‖/√N falls below |
1e-08
|
callback
|
callable
|
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
wf |
WaveFunction
|
|
info |
ConvergenceInfo
|
|
Source code in quantumlab/stationary/conjugate_gradient.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
hamiltonian
¶
apply_hamiltonian(psi: np.ndarray, grid, V: np.ndarray, hbar: float = 1.0, m: float = 1.0, nonlinearity: float = 0.0, workers: int = -1, rotation: float = 0.0) -> np.ndarray
¶
Hψ = −ℏ²/2m ∇²ψ + (V + g|ψ|²)ψ − Ω L_z ψ with all derivatives evaluated
spectrally (exact for band-limited ψ on the periodic grid). L_z is taken
about the z axis, matching SplitOperatorSolver(rotation=Ω).