How are the energy above the convex hull values calculated in Materials Project?
I was assuming it is calculated using the following procedure:
For a compound A, find all other compounds whose elements form a subset of A’s elements, then construct a phase diagram using pymatgen.CompoundPhaseDiagram and calculate ehull and decomposition using this function.
(Let’s call the values it returns PMG-ehull, in contrast to values retrieved from materials project, MP-ehull)
While usually PMG-ehull is consistent with MP-ehull, in a few (thousand?) cases they are inconsistent. Here is a notebook of my implementation.
You need to use pymatgen.analysis.phase_diagram.PhaseDiagramnotCompoundPhaseDiagram, the latter sets the compounds to zero formation enthalpy by definition, and the hull values for the latter are then quoted relative to the compounds. If the compounds are unstable/metastable, you will then get very different answers.
All Materials Project hulls are calculated using the pymatgenPhaseDiagram, so the results are 1-to-1 equivalent.
Thank you Matt for clarifying this. I think I actually used pymatgen.analysis.phase_diagram.PhaseDiagram in my notebook
from schema import Compound # class for compounds in MP
from pymatgen.analysis.phase_diagram import PhaseDiagram
from pymatgen.core.composition import Composition
from pymatgen.entries.computed_entries import ComputedEntry
# wrapper for pymatgen EATCH calculator
def find_pmgehull(
reactant: Compound, products: list[Compound],
):
c_e = ComputedEntry(Composition(reactant.normalized_formula), reactant.formation_energy_per_atom,
entry_id=reactant.mpid)
cp_es = []
for cp in products:
cp_es.append(ComputedEntry(Composition(cp.normalized_formula), cp.formation_energy_per_atom, entry_id=cp.mpid))
pdEntries = [c_e, ] + cp_es
pd = PhaseDiagram(pdEntries)
decomp, ehull = pd.get_decomp_and_e_above_hull(c_e)
return ehull
Using this find_pmgehull I was able to get consistent MP-ehull and PMG-ehull for ~121 K compounds in Materials Project, but they are inconsistent for the remaining ~5.9 K compounds. In my notebook, I showed how they can be made consistent by removing an entry from the phase diagram (for that particular case).
Could you share the code used in Materials Project for defining PhaseDiagram and for calculating ehull?
In addition to the inconsistency, I’m getting some crazy >10 eV/atom numbers, mainly because of mp-778012 which has a formation energy of -13.569 eV/atom. Is this one of the deprecated entries?
Hi,
How to find the energy above hull for the random compound that is not existed in the Materials Project ? I have a DFT analysis results of those random compounds.
It’s done by PhaseDiagram.get_decomp_and_e_above_hull method. You need to create ComputedEntry from your calculations, just like I did in the previous post.