pymatgen.analysis.defects.core module

class Defect(structure, defect_site, charge=0.0, multiplicity=None)[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 (assuming use_structure_charge=True in vasp input set)

  • multiplicity (int) – multiplicity of defect within the supercell can be supplied by user. if not specified, then space group symmetry analysis is used to generate multiplicity.

property bulk_structure

Returns the structure without any defects.

property charge

Returns the charge of a defect

copy()[source]

Convenience method to get a copy of the defect.

Returns

A copy of the Defect.

abstract property defect_composition

Returns the defect composition as a Composition object

abstract 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)

abstract get_multiplicity()[source]

Method to determine multiplicity. For non-Interstitial objects, also confirms that defect_site is a site in bulk_structure.

property multiplicity

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

abstract property 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

property 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.

Returns

An processed entry.

Raises

CompatibilityError if entry is not compatible.

abstract get_correction(entry)[source]

Returns correction for a single entry.

Parameters

entry – A DefectEntry object.

Returns

A single dictionary with the format correction_name: energy_correction

Raises

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 (dict) – Dict of corrections for defect formation energy. All values will be summed and added to the defect formation energy.

  • 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

as_dict()[source]

Json-serializable dict representation of DefectEntry

property bulk_structure
property 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]

Compute 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

property energy

Returns the corrected energy of the entry

formation_energy(chemical_potentials=None, fermi_level=0)[source]
Compute the formation energy for a defect taking into account a given chemical potential and fermi_level
Args:
chemical_potentials (dict): Dictionary of elemental chemical potential values.

Keys are Element objects within the defect structure’s composition. Values are float numbers equal to the atomic chemical potential for that element.

fermi_level (float): Value corresponding to the electron chemical potential.

If “vbm” is supplied in parameters dict, then fermi_level is referenced to the VBM. If “vbm” is NOT supplied in parameters dict, then fermi_level is referenced to the calculation’s absolute Kohn-Sham potential (and should include the vbm value provided by a band structure calculation)

Returns

Formation energy value (float)

classmethod from_dict(d)[source]

Reconstitute a DefectEntry object from a dict representation created using as_dict().

Args:

d (dict): dict representation of DefectEntry.

Returns:

DefectEntry object

property multiplicity
property name

Returms the defect name

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

Bases: pymatgen.analysis.defects.core.Defect

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

Initializes an interstial defect. :param structure: Pymatgen Structure without any defects :param defect_site: the site for the interstitial :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 (assuming use_structure_charge=True in vasp input set)

Parameters
  • site_name – allows user to give a unique name to defect, since Wyckoff symbol/multiplicity is sometimes insufficient to categorize the defect type. default is no name beyond multiplicity.

  • multiplicity (int) –

    multiplicity of defect within the supercell can be supplied by user. if not specified, then space group symmetry is used to generator interstitial sublattice

    NOTE: multiplicity generation will not work for interstitial complexes, where multiplicity may depend on additional factors (ex. orientation etc.) If defect is not a complex, then this process will yield the correct multiplicity, provided that the defect does not undergo significant relaxation.

property defect_composition

Returns the defect composition as a Composition object

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

Returns Defective Interstitial structure, decorated with charge If bulk structure had any site properties, all of these properties are removed in the resulting defect structure

Parameters

supercell (int, [3x1], or [[]] (3x3)) – supercell integer, vector, or scaling matrix

get_multiplicity()[source]

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

property name

Returns a name for this defect

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

Bases: pymatgen.analysis.defects.core.Defect

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 (assuming use_structure_charge=True in vasp input set)

  • multiplicity (int) – multiplicity of defect within the supercell can be supplied by user. if not specified, then space group symmetry analysis is used to generate multiplicity.

property defect_composition

Returns the defect composition as a Composition object

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

Returns Defective Substitution structure, decorated with charge. If bulk structure had any site properties, all of these properties are removed in the resulting defect structure.

Parameters

supercell (int, [3x1], or [[]] (3x3)) – supercell integer, vector, or scaling matrix

get_multiplicity()[source]

Returns the multiplicity of a defect site within the structure (needed for concentration analysis) and confirms that defect_site is a site in bulk_structure.

property name

Returns a name for this defect

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

Bases: pymatgen.analysis.defects.core.Defect

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 (assuming use_structure_charge=True in vasp input set)

  • multiplicity (int) – multiplicity of defect within the supercell can be supplied by user. if not specified, then space group symmetry analysis is used to generate multiplicity.

property defect_composition

Returns the defect composition as a Composition object

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)

get_multiplicity()[source]

Returns the multiplicity of a defect site within the structure (needed for concentration analysis) and confirms that defect_site is a site in bulk_structure.

property name

Returns a name for this defect

create_saturated_interstitial_structure(interstitial_def, dist_tol=0.1)[source]

this takes a Interstitial defect object and generates the sublattice for it based on the structure’s space group. Useful for understanding multiplicity of an interstitial defect in thermodynamic analysis.

NOTE: if large relaxation happens to interstitial or

defect involves a complex then there may be additional degrees of freedom that need to be considered for the multiplicity.

Parameters

dist_tol – changing distance tolerance of saturated structure, allowing for possibly overlapping sites but ensuring space group is maintained

Returns

Structure object decorated with interstitial site equivalents