# pymatgen.analysis.defects.core module¶

class Defect(structure, defect_site, charge=0.0)[source]

Bases: monty.json.MSONable

Abstract class for a single point defect

Initializes an abstract defect

Parameters: structure – Pymatgen Structure without any defects defect_site (Site) – site for defect within structure must have same lattice as structure charge – (int or float) defect charge default is zero, meaning no change to NELECT after defect is created in the structure
bulk_structure

Returns the structure without any defects.

charge

Returns the charge of a defect

copy()[source]

Convenience method to get a copy of the defect.

Returns: A copy of the Defect.
defect_composition

Returns the defect composition as a Composition object

generate_defect_structure(supercell=(1, 1, 1))[source]

Given structure and defect_site (and type of defect) should return a defect_structure that is charged :param supercell: supercell integer, vector, or scaling matrix :type supercell: int, [3x1], or [[]] (3x3)

multiplicity

Returns the multiplicity of a defect site within the structure (needed for concentration analysis)

name

Returns a name for this defect

set_charge(new_charge=0.0)[source]

Sets the overall charge :param charge: new charge to set :type charge: float

site

Returns the defect position as a site object

class DefectCorrection[source]

Bases: monty.json.MSONable

A Correction class modeled off the computed entry correction format

correct_entry(entry)[source]

Corrects a single entry.

Parameters: entry – A DefectEntry object. An processed entry. CompatibilityError if entry is not compatible.
get_correction(entry)[source]

Returns correction for a single entry.

Parameters: entry – A DefectEntry object. A single dictionary with the format correction_name: energy_correction CompatibilityError if entry is not compatible.
class DefectEntry(defect, uncorrected_energy, corrections=None, parameters=None, entry_id=None)[source]

Bases: monty.json.MSONable

An lightweight DefectEntry object containing key computed data for many defect analysis.

Parameters: defect – A Defect object from pymatgen.analysis.defects.core uncorrected_energy (float) – Energy of the defect entry. Usually the difference between the final calculated energy for the defect supercell - the perfect supercell energy corrections ([Correction]) – List of Correction classes (from pymatgen.analysis.defects.corrections) which correct energy due to charge (e.g. Freysoldt or Kumagai) or other factors (e.g. Shallow level shifts) parameters (dict) – An optional dict of calculation parameters and data to use with correction schemes (examples of parameter keys: supercell_size, axis_grid, bulk_planar_averages defect_planar_averages ) entry_id (obj) – An id to uniquely identify this defect, can be any MSONable type
Optional:

note that if you intend to use this defect entry with Charge Corrections but the bulk_structure stored in defect is not the final supercell, then ‘scaling_matrix’ must be stored in parameters

for example: parameters = {‘scaling_matrix’: [3,3,3]}
bulk_structure
charge
copy()[source]

Convenience method to get a copy of the DefectEntry.

Returns: A copy of the DefectEntry.
defect_concentration(chemical_potentials, temperature=300, fermi_level=0.0)[source]

Get the defect concentration for a temperature and Fermi level. :param temperature: the temperature in K :param fermi_level: the fermi level in eV (with respect to the VBM)

Returns: defects concentration in cm^-3
energy

Returns the corrected energy of the entry

formation_energy(chemical_potentials=None, fermi_level=0)[source]

Computes the formation energy for a defect taking into account a given chemical potential and fermi_level

multiplicity
name

Returms the defect name

site
class Interstitial(structure, defect_site, charge=0.0, site_name=u'', multiplicity=1)[source]

Subclass of Defect to capture essential information for a single Interstitial defect structure.

Initializes an interstial defect. User must specify multiplity. Default is 1 :param structure: Pymatgen Structure without any defects :param defect_site: the site for the interstial :type defect_site: Site :param charge: (int or float) defect charge

default is zero, meaning no change to NELECT after defect is created in the structure
Parameters: site_name – allows user to give a unique name to defect, since Wyckoff symbol/multiplicity is insufficient to categorize the defect type default is no name. multiplicity (int) – multiplicity default is 1,
defect_composition
generate_defect_structure(supercell=(1, 1, 1))[source]

Returns Defective Interstitial structure, decorated with charge :param supercell: supercell integer, vector, or scaling matrix :type supercell: int, [3x1], or [[]] (3x3)

multiplicity

Returns the multiplicity of a defect site within the structure (needed for concentration analysis)

name

Returns a name for this defect

class Substitution(structure, defect_site, charge=0.0)[source]

Subclass of Defect to capture essential information for a single Substitution defect structure.

Initializes an abstract defect

Parameters: structure – Pymatgen Structure without any defects defect_site (Site) – site for defect within structure must have same lattice as structure charge – (int or float) defect charge default is zero, meaning no change to NELECT after defect is created in the structure
defect_composition
generate_defect_structure(supercell=(1, 1, 1))[source]

Returns Defective Substitution structure, decorated with charge :param supercell: supercell integer, vector, or scaling matrix :type supercell: int, [3x1], or [[]] (3x3)

multiplicity

Returns the multiplicity of a defect site within the structure (needed for concentration analysis)

name

Returns a name for this defect

class Vacancy(structure, defect_site, charge=0.0)[source]

Subclass of Defect to capture essential information for a single Vacancy defect structure.

Initializes an abstract defect

Parameters: structure – Pymatgen Structure without any defects defect_site (Site) – site for defect within structure must have same lattice as structure charge – (int or float) defect charge default is zero, meaning no change to NELECT after defect is created in the structure
defect_composition
generate_defect_structure(supercell=(1, 1, 1))[source]

Returns Defective Vacancy structure, decorated with charge :param supercell: supercell integer, vector, or scaling matrix :type supercell: int, [3x1], or [[]] (3x3)

multiplicity

Returns the multiplicity of a defect site within the structure (needed for concentration analysis)

name

Returns a name for this defect