Adding Energy Corrections to Custom Entries
from pymatgen.io.vasp import Vasprun
from pymatgen.entries.computed_entries import ComputedStructureEntry
from pymatgen.entries.compatibility import MaterialsProject2020Compatibility
vasprun = Vasprun("vasprun.xml")
processed_entry = ComputedStructureEntry(
structure = vasprun.structures[-1],
energy = vasprun.final_energy,
parameters = {'run_type': 'GGA', 'potcar_symbols': vasprun.potcar_symbols}
)
processed_entry.energy_adjustments = MaterialsProject2020Compatibility().get_adjustments(cse)from pymatgen.entries.compatibility import MaterialsProject2020Compatibility
from pymatgen.analysis.bond_valence import BVAnalyzer
#if oxidation states are not known a-priori, use Bond Valences to assign them
try:
bva = BVAnalyzer()
entry.data["oxidation_states"] = {
site.species.elements[0].name : bva.get_valences(entry.structure)[i]
for i, site in enumerate(entry.structure)
}
except Exception as exc:
oxi_states = entry.composition.oxi_state_guesses()
if len(oxi_states) > 0:
entry.data["oxidation_states"] = oxi_states[0]
processed_entry = MaterialsProject2020Compatibility()
processed_entry.process_entry(entry)Last updated
Was this helpful?