# Energy above the hull

Hi, I’m trying to calculate the e_above_hull of entry (mp-771246). I can find that the e_above_hull is 0.045 eV/atom from the materials website. However, when i try to use the following code to calculate the e_above_hull, it gives 0.015 eV/atom. So I’m wonder which is resonable value ?

``````from pymatgen.core import Element
from pymatgen.analysis.phase_diagram import PhaseDiagram
from pymatgen.ext.matproj import MPRester
from itertools import combinations
import os
mpr=MPRester("-----------------")
mid="mp-771246"
if os.path.exists('entries.json'):
else:
dentries={}
elms=['Li',"V","Te","O"]
for i in range(1,len(elms)+1):
for comb in combinations(elms,i):
if len(comb)==1:
key=comb[0]
dentries[key]=mpr.get_entries(key)
else:
key='-'.join(list(comb))
dentries[key]=mpr.get_entries(key)
print(key,len(dentries[key]))

entries=[]
for key in dentries.keys():
entries.extend(dentries[key])
dumpfn(entries,'entries.json',indent=4)
te=entries[-1] # this one is mp-771246
print(te)
pd=PhaseDiagram(entries=entries)
dumpfn(pd.as_dict(),'pd.json',indent=4)
print(pd.get_e_above_hull(te))
``````

output:

``````mp-771246 ComputedEntry - Li2 V3 Te1 O8 (Li2V3TeO8)
Energy (Uncorrected)     = -94.9128  eV (-6.7795  eV/atom)
Correction               = -11.0180  eV (-0.7870  eV/atom)
Energy (Final)           = -105.9308 eV (-7.5665  eV/atom)
MP2020 anion correction (oxide): -5.4960   eV (-0.3926  eV/atom)
MP2020 anion correction (Te): -0.4220   eV (-0.0301  eV/atom)
MP2020 GGA/GGA+U mixing correction (V): -5.1000   eV (-0.3643  eV/atom)
Parameters:
run_type               = GGA+U
is_hubbard             = True
pseudo_potential       = {'functional': 'PBE', 'labels': ['Li_sv', 'V_pv', 'Te', 'O'], 'pot_type': 'paw'}
hubbards               = {'Li': 0.0, 'V': 3.25, 'Te': 0.0, 'O': 0.0}
potcar_symbols         = ['PBE Li_sv', 'PBE V_pv', 'PBE Te', 'PBE O']
oxide_type             = oxide
Data:
oxide_type             = oxide
oxidation_states       = {'Li': 1.0, 'V': 5.0, 'Te': -1.0, 'O': -2.0}
0.01495586022919504
``````
1 Like

Hi @haidi-ustc,

I confirmed that the energy above hull you calculated (0.01496 eV/atom) is correct. This is also the value that results when using the Phase Diagram app on the (old) MP website. FYI you should be able to speed up the downloading of entries in your code by using `mpr.get_entries_in_chemsys("Li-V-Te-O")`… i.e., no need to do the combinations approach yourself as it is already built into this other method.

@mkhorton – is this a possible problem with the ThermoBuilder? Seems to have the same error on the new site.

1 Like

Good question @mattmcdermott, I will pass that over to @munrojm

It looks like the difference in energy is coming from the lack of an anion correction to Te within the built thermo entry. With the newer thermo builder, the corrections for this material are applied using oxidation state data from a bond valence analysis. From my perspective, it seems like the value of 0.045 eV/atom is more correct here? Perhaps you can comment, @mattmcdermott ?