# pymatgen.entries.compatibility module¶

class AnionCorrection(*args, **kwargs)[source]

Correct anion energies to obtain the right formation energies. Note that this depends on calculations being run within the same input set.

Parameters: config_file – Path to the selected compatibility.yaml config file. correct_peroxide – Specify whether peroxide/superoxide/ozonide corrections are to be applied or not.
class AqueousCorrection(*args, **kwargs)[source]

This class implements aqueous phase compound corrections for elements and H2O.

Parameters: config_file – Path to the selected compatibility.yaml config file.
class Compatibility(corrections)[source]

Bases: monty.json.MSONable

The Compatibility class combines a list of corrections to be applied to an entry or a set of entries. Note that some of the Corrections have interdependencies. For example, PotcarCorrection must always be used before any other compatibility. Also, GasCorrection(“MP”) must be used with PotcarCorrection(“MP”) (similarly with “MIT”). Typically, you should use the specific MaterialsProjectCompatibility and MITCompatibility subclasses instead.

Parameters: corrections – List of corrections to apply.
explain(entry)[source]

Prints an explanation of the corrections that are being applied for a given compatibility scheme. Inspired by the “explain” methods in many database methodologies.

Parameters: entry – A ComputedEntry.
get_corrections_dict(entry)[source]

Returns the corrections applied to a particular entry.

Parameters: entry – A ComputedEntry object. value}) ({correction_name
get_explanation_dict(entry)[source]

Provides an explanation dict of the corrections that are being applied for a given compatibility scheme. Inspired by the “explain” methods in many database methodologies.

Parameters: entry – A ComputedEntry. (dict) of the form {“Compatibility”: “string”, “Uncorrected_energy”: float, “Corrected_energy”: float, “Corrections”: [{“Name of Correction”: { “Value”: float, “Explanation”: “string”}]}
process_entries(entries)[source]

Process a sequence of entries with the chosen Compatibility scheme.

Parameters: entries – A sequence of entries. An list of adjusted entries. Entries in the original list which are not compatible are excluded.
process_entry(entry)[source]

Process a single entry with the chosen Corrections.

Parameters: entry – A ComputedEntry object. An adjusted entry if entry is compatible, otherwise None is returned.
exception CompatibilityError(msg)[source]

Bases: Exception

Exception class for Compatibility. Raised by attempting correction on incompatible calculation

class Correction[source]

Bases: object

A Correction class is a pre-defined scheme for correction a computed entry based on the type and chemistry of the structure and the calculation parameters. All Correction classes must implement a correct_entry method.

correct_entry(entry)[source]

Corrects a single entry.

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

Returns correction for a single entry.

Parameters: entry – A ComputedEntry object. The energy correction to be applied. CompatibilityError if entry is not compatible.
class GasCorrection(*args, **kwargs)[source]

Correct gas energies to obtain the right formation energies. Note that this depends on calculations being run within the same input set.

Parameters: config_file – Path to the selected compatibility.yaml config file.
class MITAqueousCompatibility(compat_type='Advanced', correct_peroxide=True, check_potcar_hash=False)[source]

This class implements the GGA/GGA+U mixing scheme, which allows mixing of entries. Note that this should only be used for VASP calculations using the MIT parameters (see pymatgen.io.vaspio_set MITVaspInputSet). Using this compatibility scheme on runs with different parameters is not valid.

Parameters: compat_type – Two options, GGA or Advanced. GGA means all GGA+U entries are excluded. Advanced means mixing scheme is implemented to make entries compatible with each other, but entries which are supposed to be done in GGA+U will have the equivalent GGA entries excluded. For example, Fe oxides should have a U value under the Advanced scheme. A GGA Fe oxide run will therefore be excluded under the scheme. correct_peroxide – Specify whether peroxide/superoxide/ozonide corrections are to be applied or not. check_potcar_hash (bool) – Use potcar hash to verify potcars are correct.
class MITCompatibility(compat_type='Advanced', correct_peroxide=True, check_potcar_hash=False)[source]

This class implements the GGA/GGA+U mixing scheme, which allows mixing of entries. Note that this should only be used for VASP calculations using the MIT parameters (see pymatgen.io.vaspio_set MITVaspInputSet). Using this compatibility scheme on runs with different parameters is not valid.

Parameters: compat_type – Two options, GGA or Advanced. GGA means all GGA+U entries are excluded. Advanced means mixing scheme is implemented to make entries compatible with each other, but entries which are supposed to be done in GGA+U will have the equivalent GGA entries excluded. For example, Fe oxides should have a U value under the Advanced scheme. A GGA Fe oxide run will therefore be excluded under the scheme. correct_peroxide – Specify whether peroxide/superoxide/ozonide corrections are to be applied or not. check_potcar_hash (bool) – Use potcar hash to verify potcars are correct.
class MaterialsProjectAqueousCompatibility(compat_type='Advanced', correct_peroxide=True, check_potcar_hash=False)[source]

This class implements the GGA/GGA+U mixing scheme, which allows mixing of entries. Note that this should only be used for VASP calculations using the MaterialsProject parameters (see pymatgen.io.vaspio_set.MPVaspInputSet). Using this compatibility scheme on runs with different parameters is not valid.

Parameters: compat_type – Two options, GGA or Advanced. GGA means all GGA+U entries are excluded. Advanced means mixing scheme is implemented to make entries compatible with each other, but entries which are supposed to be done in GGA+U will have the equivalent GGA entries excluded. For example, Fe oxides should have a U value under the Advanced scheme. A GGA Fe oxide run will therefore be excluded under the scheme. correct_peroxide – Specify whether peroxide/superoxide/ozonide corrections are to be applied or not. check_potcar_hash (bool) – Use potcar hash to verify potcars are correct.
class MaterialsProjectCompatibility(compat_type='Advanced', correct_peroxide=True, check_potcar_hash=False)[source]

This class implements the GGA/GGA+U mixing scheme, which allows mixing of entries. Note that this should only be used for VASP calculations using the MaterialsProject parameters (see pymatgen.io.vaspio_set.MPVaspInputSet). Using this compatibility scheme on runs with different parameters is not valid.

Parameters: compat_type – Two options, GGA or Advanced. GGA means all GGA+U entries are excluded. Advanced means mixing scheme is implemented to make entries compatible with each other, but entries which are supposed to be done in GGA+U will have the equivalent GGA entries excluded. For example, Fe oxides should have a U value under the Advanced scheme. A GGA Fe oxide run will therefore be excluded under the scheme. correct_peroxide – Specify whether peroxide/superoxide/ozonide corrections are to be applied or not. check_potcar_hash (bool) – Use potcar hash to verify potcars are correct.
class PotcarCorrection(input_set, check_hash=False)[source]

Checks that POTCARs are valid within a pre-defined input set. This ensures that calculations performed using different InputSets are not compared against each other.

Entry.parameters must contain a “potcar_symbols” key that is a list of all POTCARs used in the run. Again, using the example of an Fe2O3 run using Materials Project parameters, this would look like entry.parameters[“potcar_symbols”] = [‘PAW_PBE Fe_pv 06Sep2000’, ‘PAW_PBE O 08Apr2002’].

Parameters: input_set – InputSet object used to generate the runs (used to check for correct potcar symbols) check_hash (bool) – If true, uses the potcar hash to check for valid potcars. If false, uses the potcar symbol (Less reliable). Defaults to True ValueError if entry do not contain “potcar_symbols” key. CombatibilityError if wrong potcar symbols
get_correction(entry)[source]

Returns correction for a single entry.

Parameters: entry – A ComputedEntry object. The energy correction to be applied. CompatibilityError if entry is not compatible.
class UCorrection(*args, **kwargs)[source]

This class implements the GGA/GGA+U mixing scheme, which allows mixing of entries. Entry.parameters must contain a “hubbards” key which is a dict of all non-zero Hubbard U values used in the calculation. For example, if you ran a Fe2O3 calculation with Materials Project parameters, this would look like entry.parameters[“hubbards”] = {“Fe”: 5.3} If the “hubbards” key is missing, a GGA run is assumed.

It should be noted that ComputedEntries assimilated using the pymatgen.apps.borg package and obtained via the MaterialsProject REST interface using the pymatgen.matproj.rest package will automatically have these fields populated.

Parameters: config_file – Path to the selected compatibility.yaml config file. input_set – InputSet object (to check for the +U settings) compat_type – Two options, GGA or Advanced. GGA means all GGA+U entries are excluded. Advanced means mixing scheme is implemented to make entries compatible with each other, but entries which are supposed to be done in GGA+U will have the equivalent GGA entries excluded. For example, Fe oxides should have a U value under the Advanced scheme. A GGA Fe oxide run will therefore be excluded under the scheme.