nonrad.scaling module
Utilities for scaling the capture coefficient.
This module provides various utilities that are necessary to scale the capture coefficient to the final value.
- nonrad.scaling.charged_supercell_scaling(wavefunc: ndarray, lattice: ndarray, def_coord: ndarray, cutoff: float = 0.02, limit: float = 5.0, fig=None, full_range=False) float[source]
Estimate the interaction between the defect and bulk wavefunction.
This function estimates the interaction between the defect and bulk wavefunction due to spurious effects as a result of using a charged supercell. The radial distribution of the bulk wavefunction is compared to a perfectly homogenous wavefunction to estimate the scaling.
- Parameters:
wavefunc (np.array(dim=(NX, NY, NZ))) – bulk wavefunction in real-space on a NX by NY by NZ FFT grid
lattice (np.array(dim=(3, 3))) – real-space lattice vectors for your system
def_coord (np.array(dim=(3,))) – cartesian coordinates of defect position
cutoff (float) – cutoff for determining zero slope regions
limit (float) – upper limit for windowing procedure
fig (matplotlib.figure.Figure) – optional figure object to plot diagnostic information (recommended)
full_range (bool) – determines if full range of first plot is shown
- Returns:
estimated scaling value to apply to the capture coefficient
- Return type:
float
- nonrad.scaling.charged_supercell_scaling_VASP(wavecar_path: str, bulk_index: int, def_index: int = -1, def_coord: ndarray | None = None, cutoff: float = 0.02, limit: float = 5.0, spin: int = 0, kpoint: int = 1, fig=None, full_range=False) float[source]
Estimate the interaction between the defect and bulk wavefunction.
This function estimates the interaction between the defect and bulk wavefunction due to spurious effects as a result of using a charged supercell. The radial distribution of the bulk wavefunction is compared to a perfectly homogenous wavefunction to estimate the scaling.
Either def_index or def_coord must be specified.
If you get wonky results with def_index, try using def_coord as there may be a problem with finding the defect position if the defect charge is at the boundary of the cell.
- Parameters:
wavecar_path (str) – path to the WAVECAR file that contains the relevant wavefunctions
def_index (int) – index of the defect and bulk wavefunctions in the WAVECAR file
bulk_index (int) – index of the defect and bulk wavefunctions in the WAVECAR file
def_coord (np.array(dim=(3,))) – cartesian coordinates of defect position
cutoff (float) – cutoff for determining zero slope regions
limit (float) – upper limit for windowing procedure
spin (int) – spin channel to read from (0 - up, 1 - down)
kpoint (int) – kpoint to read from (defaults to the first kpoint)
fig (matplotlib.figure.Figure) – optional figure object to plot diagnostic information (recommended)
full_range (bool) – determines if full range of first plot is shown
- Returns:
estimated scaling value to apply to the capture coefficient
- Return type:
float
- nonrad.scaling.distance_PBC(a: ndarray, b: ndarray, lattice: ndarray) float[source]
Compute the distance between a and b on the lattice with periodic BCs.
- Parameters:
a (np.array) – points in cartesian coordinates
b (np.array) – points in cartesian coordinates
lattice (np.array) – lattice to use to compute PBC
- Returns:
distance
- Return type:
float
- nonrad.scaling.find_charge_center(density: ndarray, lattice: ndarray) ndarray[source]
Compute the center of the charge density.
- Parameters:
density (np.array) – density of the wavecar returned by wavecar.fft_mesh
lattice (np.array) – lattice to use to compute PBC
- Returns:
position of the center in cartesian coordinates
- Return type:
np.array
- nonrad.scaling.radial_distribution(density: ndarray, point: ndarray, lattice: ndarray) tuple[ndarray, ndarray][source]
Compute the radial distribution.
Computes the radial distribution of the density around the given point with the defined lattice.
- Parameters:
density (np.array) – density of the wavecar returned by wavecar.fft_mesh
point (np.array) – position of the defect in cartesian coordinates
lattice (np.array) – lattice to use to compute PBC
- Returns:
r (np.array) – array of radii that the density corresponds to
n (np.array) – array of densities at the corresponding radii
- nonrad.scaling.sommerfeld_parameter(T: float | ndarray, Z: int, m_eff: float, eps0: float, dim: int = 3, x0: float = 0.001, method: str = 'Integrate') float | ndarray[source]
Compute the T-dependent Sommerfeld parameter.
Computes the sommerfeld parameter at a given temperature using the definitions in R. Pässler et al., phys. stat. sol. (b) 78, 625 (1976). We assume that theta_{b,i}(T) ~ T.
- Parameters:
T (float, np.array(dtype=float)) – temperature in K
Z (int) – Z = Q / q where Q is the charge of the defect and q is the charge of the carrier. Z < 0 corresponds to attractive centers and Z > 0 corresponds to repulsive centers
m_eff (float) – effective mass of the carrier in units of m_e (electron mass)
eps0 (float) – static dielectric constant
dim (int) – dimension of the system (3, 2, or 1)
x0 (float) – cutoff length for 1D evaluation
method (str) – specify method for evaluating sommerfeld parameter (‘Integrate’ or ‘Analytic’). The default is recommended as the analytic equation may introduce significant errors for the repulsive case at high T.
- Returns:
sommerfeld factor evaluated at the given temperature
- Return type:
float, np.array(dtype=float)
- nonrad.scaling.thermal_velocity(T: float | ndarray, m_eff: float)[source]
Calculate the thermal velocity at a given temperature.
- Parameters:
T (float, np.array(dtype=float)) – temperature in K
m_eff (float) – effective mass in electron masses
- Returns:
thermal velocity at the given temperature in cm s^{-1}
- Return type:
float, np.array(dtype=float)