# pymatgen.analysis.defects.corrections module¶

class BandEdgeShiftingCorrection[source]

A class for BandEdgeShiftingCorrection class. Largely adapted from PyCDT code

Requires some parameters in the DefectEntry to properly function:
hybrid_cbm
CBM of HYBRID bulk calculation
hybrid_vbm
VBM of HYBRID bulk calculation
cbm
CBM of bulk calculation (or band structure calculation of bulk); calculated on same level of theory as the eigenvalues list (ex. GGA defects -> need GGA cbm
vbm
VBM of bulk calculation (or band structure calculation of bulk); calculated on same level of theory as the eigenvalues list (ex. GGA defects -> need GGA vbm
num_hole_vbm
number of free holes that were found in valence band for the defect calculation calculated in the metadata of the BandFilling Correction
num_elec_cbm
number of free electrons that were found in the conduction band for the defect calculation calculated in the metadata of the BandFilling Correction
get_correction(entry)[source]

Gets the BandEdge correction for a defect entry

class BandFillingCorrection(resolution=0.01)[source]

A class for BandFillingCorrection class. Largely adapted from PyCDT code

Requires some parameters in the DefectEntry to properly function:
eigenvalues
dictionary of defect eigenvalues, as stored in a Vasprun
kpoint_weights
kpoint weights corresponding to the dictionary of eigenvalues
potalign
potential alignment for the defect calculation Only applies to non-zero charge, When using potential alignment Correction (freysoldt or kumagai), need to divide by -q
cbm
CBM of bulk calculation (or band structure calculation of bulk); calculated on same level of theory as the eigenvalues list (ex. GGA defects -> need GGA cbm
vbm
VBM of bulk calculation (or band structure calculation of bulk); calculated on same level of theory as the eigenvalues list (ex. GGA defects -> need GGA vbm

Initializes the Bandfilling correction

Parameters: resolution (float) – energy resolution to maintain for gap states
get_correction(entry)[source]

Gets the BandFilling correction for a defect entry

perform_bandfill_corr(eigenvalues, kpoint_weights, potalign, vbm, cbm)[source]

This calculates the band filling correction based on excess of electrons/holes in CB/VB…

Note that the total free holes and electrons may also be used for a “shallow donor/acceptor”
correction with specified band shifts: +num_elec_cbm * Delta E_CBM (or -num_hole_vbm * Delta E_VBM) [this is done in the LevelShiftingCorrection class]
class FreysoldtCorrection(dielectric_const, q_model=None, energy_cutoff=520, madetol=0.0001, axis=None)[source]

A class for FreysoldtCorrection class. Largely adapated from PyCDT code

Initializes the Freysoldt Correction :param dielectric_const: Dielectric constant for the structure :type dielectric_const: float or 3x3 matrix :param q_mode: instantiated QModel object or None. Uses default parameters to instantiate QModel if None supplied :type q_mode: QModel :param energy_cutoff: Maximum energy in eV in recipripcol space to perform integration for potential correction :type energy_cutoff: int :param madeltol: Convergence criteria for the Madelung energy for potential correction :type madeltol: float :param axis: Axis to calculate correction. Averages over all three if not supplied. :type axis: int

get_correction(entry)[source]

Gets the Freysoldt correction for a defect entry :param entry: defect entry to compute Freysoldt correction on.

Requires following parameters in the DefectEntry to exist:

axis_grid (3 x NGX where NGX is the length of the NGX grid in the x,y and z axis directions. Same length as planar average lists):

A list of 3 numpy arrays which contain the cartesian axis values (in angstroms) that correspond to each planar avg potential supplied.

bulk_planar_averages (3 x NGX where NGX is the length of the NGX grid in the x,y and z axis directions.):

A list of 3 numpy arrays which contain the planar averaged electrostatic potential for the bulk supercell.

defect_planar_averages (3 x NGX where NGX is the length of the NGX grid in the x,y and z axis directions.):

A list of 3 numpy arrays which contain the planar averaged electrostatic potential for the defective supercell.
scaling_matrix (3 x 1 matrix): scaling matrix required to convert the
entry.defect.bulk_structure object into the lattice which is used by the bulk_planar_average and defect_planar_average
perform_es_corr(lattice, q, step=0.0001)[source]

Peform Electrostatic Freysoldt Correction

perform_pot_corr(axis_grid, pureavg, defavg, lattice, q, defect_position, axis, madetol=0.0001, widthsample=1.0)[source]

For performing planar averaging potential alignment

title is for name of plot, if you dont want a plot then leave it as None widthsample is the width (in Angstroms) of the region in between defects where the potential alignment correction is averaged

plot(axis, title=None, saved=False)[source]

Plots the planar average electrostatic potential against the Long range and short range models from Freysoldt