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.

Parameters
  • step[in] \( \Delta x \), stepsize

  • N[in] number of steps

  • y0[in] value of y at \( x_0 \)

  • y1[in] value of y at \( x_0 + step \)

  • E[in] energy, unit eV

  • V[in] V[n] is the potential at \( x = x_0 + n \times step \)

  • m[in] m[n] is the effective mass at \( x = x_0 + n \times step \). m is in unit m0 (free electron mass)

  • y[out] value of y at \( x = x_0 + n \times step \).

Returns

psiend the last element of y

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
  • step[in] step size

  • N[in] number of steps

  • EigenEs[in] list of eigen energies

  • EN[in] number of eigen energies we consider

  • V[in] V[n] is the potential at \( x = x_0 + n \times step \)

  • m[in] 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

  • starts[in]

  • ends[in] wavefuntion limited to psi[starts[i]:ends[i]]

  • mat[in] 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.

  • psis[out] \( \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.

Parameters
  • step[in] step size

  • N[in] number of steps

  • Es[in] initial search range of eigen energy

  • EN[in] number of eigen energy to find

  • V[in] potential

  • m[in] effective mass

  • mat[in] is a pointer to band structure

  • EigenE[out] eigen energy

Returns

total number of eigen states found.

double LOphononScatter(double step, numpyint N, double kl, const double *psi_ij)

Calculate the LO phonon scattering rate

Parameters
  • step[in] step size in unit Angstrom

  • N[in] number of steps

  • kl[in] wavevector of LO phonon in unit m^-1. This is DIFFERENT than the step unit for convience to use kl.

  • psi_ij[in] \(\psi_i \psi_j\) wavefunction overlap

Returns

\(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) \)

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

Parameters
  • step[in] step size in unit Angstrom

  • N[in] number of steps

  • kls[in] wavevector of LO phonon between psi_i to psi_j’s in unit m^-1

  • psi_ijs[in] psi_j = psi_js[n*N] \(\psi_i\psi_j\) overlap between \(\psi_i\) and \(\psi_j\) wavefunction

  • fjs[in] the factor \(f_j\) before \(I_{ij}\) before sum

  • Nj[in] number of psi_j

Returns

\(\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) \)

numpyint invAlpha()

Checkpoint for python-C interface. Output 137.

int isMP()

Check if openMP is loaded.