54 std::vector<double>
phi;
92 void init_gaussian(
double x0,
double y0,
double kx,
double ky,
double sigma);
107 inline int at(
int i,
int j)
const {
return i *
N + j; }
109 double prob(
int i,
int j)
const {
110 const auto z =
psi[
at(i,j)];
111 return z.real()*z.real() + z.imag()*z.imag();
125 void kick_V(
double tau);
126 void sweep_x(
double tau);
127 void sweep_y(
double tau);
Crank-Nicolson ADI solver for 2D parabolic equations via fiber sweeps.
Dense vector with optional GPU storage, templated over scalar type T.
int N
Interior grid points per axis.
num::Vector V
NxN potential (real, length N^2)
double L
Domain length ([0,L]x[0,L])
double compute_energy() const
<psi|H|psi> using 5-point Laplacian and the potential.
void set_mode(int k)
Set psi to the k-th eigenmode (modes must be computed first).
void init_gaussian(double x0, double y0, double kx, double ky, double sigma)
Gaussian wavepacket: psi = A*exp(-(r-r0)^2/sigma^2)*exp(i*k*r), then normalised.
std::vector< EigenMode > modes
void compute_modes(int k=8)
double prob(int i, int j) const
double h
Grid spacing = L/(N+1)
num::CVector psi
NxN wavefunction (complex, length N^2)
void set_potential(Potential p, double param=0.0)
Build potential and recompute Thomas factorisations.
double compute_norm() const
integral|psi|^2 dA (Gauss-Legendre over each grid strip).
int at(int i, int j) const
double phase_ang(int i, int j) const
void step()
Advance one full time step (Strang splitting).
@ DoubleSlit
Double-slit wall – interference.
@ Barrier
Single vertical barrier with one gap – tunnelling.
@ CircularWell
V = 0 inside radius R, V = V0 outside (Bessel eigenstates)
@ Harmonic
V = 1/2*omega^2*r^2 (coherent state dynamics)
@ Free
V = 0 (free particle)
const char * potential_name(Potential p)
double exact_energy
Analytical eigenvalue if available (CircularWell)
std::vector< double > phi
NxN real wavefunction, L^2-normalised.
double energy
Ritz eigenvalue (~= energy)
double norm
integral|psi|^2 dA (should stay ~= 1)
int n_modes
Number of computed eigenmodes.
double step_ms
Wall time for one step()
double energy
<H> = integralpsi* H psi dA