Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
estimate oxidative stability of a compound using Materials Project data. The higher (less negative) the maximum chemical potential of oxygen that is tolerated, the more stable.
from pymatgen import Composition, Element, MPRester
from pymatgen.analysis.phase_diagram import PhaseDiagram
if __name__ == "__main__":
# stuff the user needs to set
MAPI_KEY = None
FORMULA = "FeP2"
OPEN_ELEMENT = "O"
# automatic from here on down!
# add oxygen to list of elements if formula doesn't have it
comp = Composition(FORMULA)
elements = [str(x) for x in comp.elements]
if OPEN_ELEMENT not in elements:
elements.append(OPEN_ELEMENT)
# get the profile of evolution for the open element
mpr = MPRester(MAPI_KEY) # object for connecting to MP Rest interface
entries = mpr.get_entries_in_chemsys(elements, compatible_only=True)
pd = PhaseDiagram(entries)
profile = pd.get_element_profile(Element(OPEN_ELEMENT), comp)
# determine the maximum chemical potential in which the open element is not evolved/produced.
max_chempot = -float("inf")
for x in profile:
if round(x["evolution"], 5) == 0 and x["chempot"] > max_chempot:
max_chempot = x["chempot"]
print(FORMULA, max_chempot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.