File 1DSchrodinger.c¶
Solve 1D Schrodinger equation.
Defines
-
Y_EPS
¶ Starting point for ode solver. Default value = 0.1
-
ode
¶ Use RK4 as the default ODE solver
-
findZero
(x1, y1, x2, y2)¶ Find zero between x1 and x2 of function y(x), s.t. \( y(x_n) = 0 \) using linear interpolation, i.e assuming y1 and y2 are of opposite signs and returning \( x_n \).
-
MINPSI
¶ The min cutoff for integral of wavefunctions
Functions
-
inline double
numerov
(double step, numpyint N, double y0, double y1, double E, const double *V, const double *m, double *y)¶ An ODE solver using Numerov’s method for \( -\frac{d}{dx}(\frac{\hbar^2}{2m(x)} \frac{dy(x)}{dx}) + V(x) y(x) = E y(x) \) with starting \( x_0 \) and \( y_0 \), \( y_1 \), ends at \( x_0 + N \times step \). No normalization imposed.
- Return
psiend the last element of y
- Parameters
[in] step
: \( \Delta x \), stepsize[in] N
: number of steps[in] y0
: value of y at \( x_0 \)[in] y1
: value of y at \( x_0 + step \)[in] E
: energy, unit eV[in] V
: V[n] is the potential at \( x = x_0 + n \times step \)[in] m
: m[n] is the effective mass at \( x = x_0 + n \times step \). m is in unit m0 (free electron mass)[out] y
: value of y at \( x = x_0 + n \times step \).
-
inline double
rk4
(double step, numpyint N, double y0, double y1, double E, const double *V, const double *m, double *y)¶ An ODE solver using RK4 method for \( -\frac{d}{dx}(\frac{\hbar^2}{2m(x)} \frac{dy(x)}{dx}) + V(x) y(x) = E y(x) \) with starting \( x_0 \) and \( y_0 \), \( y_1 \), ends at \( x_0 + N \times step \). No normalization imposed. See numerov() for arguments explaination
-
void
FillPsi
(double step, numpyint N, const double *EigenEs, numpyint EN, const double *V, double *m, double *psis, numpyint *starts, numpyint *ends, Band *const mat)¶ Fill in wavefunctions in \( \psi \)‘s accroding to eigen energy in EigenEs. \( \psi + i N \times sizeof(double) \) is the wavefunction with Energy EigenEs[i] The result is normalized to 1 (so psi is unit sqrt(Angstrom^-1)) if mat == NULL or the normalization defined in mat.
- Parameters
[in] step
: step size[in] N
: number of steps[in] EigenEs
: list of eigen energies[in] EN
: number of eigen energies we consider[in] V
: V[n] is the potential at \( x = x_0 + n \times step \)[in] m
: m[n] is the effective mass at \( x = x_0 + n \times step \), in unit \( m_0 \) (free electron mass), used only when mat=Null[in] starts
:[in] ends
: wavefuntion limited to psi[starts[i]:ends[i]][in] mat
: is a pointer to band structure, for updating effective mass according to energy and perform normalization. When it’s NULL it means using constant mass with parabolic kinetic energy.[out] psis
: \( \psi + i N \times sizeof(double) \) is the wavefunction with energy EigenEs[i].
-
numpyint
Solve1D
(double step, numpyint N, const double *Es, numpyint EN, const double *V, double *m, Band *const mat, double *EigenE)¶ Solve 1D Schrodinger’s equation with potential \( V \) and effective mass \( m \) in the region \( x_0 \leq x < x_0 + step \times N \). Boundary condition: wavefunction is zero at boundaries.
Method: First scan in energy Es[0:EN] and look for zeros(EigenE) by either simple linear interpolation if SIMPLE is defined; or calculate zero using secant method if SIMPLE is not defined.
Es should be in small to large order.
- Return
total number of eigen states found.
- Parameters
[in] step
: step size[in] N
: number of steps[in] Es
: initial search range of eigen energy[in] EN
: number of eigen energy to find[in] V
: potential[in] m
: effective mass[in] mat
: is a pointer to band structure[out] EigenE
: eigen energy
-
double
LOphononScatter
(double step, numpyint N, double kl, const double *psi_ij)¶ Calculate the LO phonon scattering rate
- Return
\(I_{ij} = \int\mathrm dx\mathrm dy\, \psi_i(x)\psi_j(x) \exp\left[-k_l|x-y|\right]\psi_i(y)\psi_j(y) \)
- Parameters
[in] step
: step size in unit Angstrom[in] N
: number of steps[in] kl
: wavevector of LO phonon in unit m^-1. This is DIFFERENT than the step unit for convience to use kl.[in] psi_ij
: \(\psi_i \psi_j\) wavefunction overlap
-
double
LOtotal
(double step, numpyint N, const double *kls, const double *psi_ijs, const double *fjs, numpyint Nj)¶ Calculate sum LO phonon scattering rate from psi_i to all psi_j’s
- Return
\(\sum_j f_j I_{ij} = \sum_j f_j \int\mathrm dx\mathrm dy\, \psi_i(x)\psi_j(x) \exp\left[-k_l|x-y|\right]\psi_i(y)\psi_j(y) \)
- Parameters
[in] step
: step size in unit Angstrom[in] N
: number of steps[in] kls
: wavevector of LO phonon between psi_i to psi_j’s in unit m^-1[in] psi_ijs
: psi_j = psi_js[n*N] \(\psi_i\psi_j\) overlap between \(\psi_i\) and \(\psi_j\) wavefunction[in] fjs
: the factor \(f_j\) before \(I_{ij}\) before sum[in] Nj
: number of psi_j
-
int
isMP
()¶ Check if openMP is loaded.