This notebook illustrates how to apply and obtain an explanation of energy corrections used in the Materials Project database.
Author: Ryan Kingsbury
Date: May 2021
The Materials Project API (
ComputedEntry objects that contain information about DFT calculations. By default, these objects have adjustments applied to the energies of certain elements to reduce certain systematic errors. See our documentation for complete details.
As of Spring 2021,
ComputedEntry are processed using the
MaterialsProject2020Compatibility class in pymatgen by default. The legacy correction scheme, used from 2010-2020, is still available in
# Uncomment the subsequent lines in this cell to install dependencies for Google Colab. # !pip install pymatgen==2022.7.19
from pymatgen.entries.compatibility import ( MaterialsProject2020Compatibility, MaterialsProjectCompatibility, ) from pymatgen.ext.matproj import MPRester
# retrieve with MPRester() as m: entries = m.get_entries_in_chemsys("Cl-Mo-O") entry = entries
You can examine the energy corrections via the
ComputedEntry. This attribute contains a list of each energy correction that has been applied.
If you want even more detail, you can examine an indiviual
EnergyAdjustment (one element of the list)
If you want to use the old corrections, or apply your own, you can re-process the
ComputedEntry obtained from
MPRester using a
Compatibility class. The
.process_entries method will remove any previously-applied energy corrections and re-process the entry in-place.
compat = MaterialsProjectCompatibility() entries = compat.process_entries(entries)
[ConstantEnergyAdjustment: Name: MP Anion Correction Value: -2.809 eV Uncertainty: nan eV Description: Constant energy adjustment (-2.809 eV) Generated by: MaterialsProjectCompatibility, ConstantEnergyAdjustment: Name: MP Advanced Correction Value: -28.248 eV Uncertainty: nan eV Description: Constant energy adjustment (-28.248 eV) Generated by: MaterialsProjectCompatibility]
Notice how the energy adjustments have changed. The class name, description and values are all different. You will also notice that the descriptions of the legacy corrections are less verbose than those of the modern
If you want to remove all corrections from a
ComputedEntry, simply set
energy_adjustments to an empty list. You can verify that you have removed corrections by checking the
energy_per_atom and the
correction_per_atom of the
ComputedEntry before and after.
entries.energy_adjustments =  entries.energy_per_atom
Alternatively, you can simply pass
compatible_only=False to the
MPRester call when you download data.
# retrieve with MPRester() as m: entries = m.get_entries_in_chemsys("Cl-Mo-O", compatible_only=False) entry = entries