Hello,
Apologies for bumping an old post, but I’m interested in knowing how to calculate the e_above_hull
using my own DFT-calculated data.
Below is the code I used, and following that, the error message that I received.
from pymatgen.ext.matproj import MPRester
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter, CompoundPhaseDiagram
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.core import Composition
# from pymatgen.analysis.pourbaix_diagram import PourbaixDiagram, PourbaixEntry, PourbaixAnalyzer # StableEntry
# from pymatgen.analysis.phase_diagram import PhaseDiagram, PDAnalyzer, ConvexHullAnalyzer
# from pymatgen.analysis.pour import ConvexHullAnalyzer
# Assuming you have a list of computed entries (e.g., from a database)
entries = [
ComputedEntry(Composition("Y4N4"), -164.774553),
ComputedEntry(Composition("Y16Ti16O56"), -1377.12118691),
ComputedEntry(Composition("Y8Ti4O20"), -532.80516856),
ComputedEntry(Composition("Y4Ti4O8N4"), -322.86938277),
ComputedEntry(Composition("Y2"), -55.73665798),
ComputedEntry(Composition("N8"), -74.18410792),
ComputedEntry(Composition("O6"), -36.28556130),
ComputedEntry(Composition("Ti3"), -48.18069328),
] # List of entries with structure and energy
pd = PhaseDiagram(entries)
# Create a ConvexHullAnalyzer
# hull_analyzer = ConvexHullAnalyzer(entries)
# For a specific compound, e.g., La2Ti2O7
compound = Composition("Y4Ti4O8N4")
energy_above_hull = pd.get_e_above_hull(compound)
print(f"Energy above hull for {compound}: {energy_above_hull:.4f} eV")
And this is the error that I get:
/usr/local/lib/python3.10/dist-packages/pymatgen/analysis/phase_diagram.py in get_decomp_and_e_above_hull(self, entry, allow_negative, check_stable, on_error)
758 except Exception as exc:
759 if on_error == "raise":
--> 760 raise ValueError(f"Unable to get decomposition for {entry}") from exc
761 if on_error == "warn":
762 warnings.warn(f"Unable to get decomposition for {entry}, encountered {exc}")
ValueError: Unable to get decomposition for Y4 Ti4 O8 N4
I have several questions regarding this code and the science/equations behind formation energy, decomposition energy and energy above hull. I am inexperienced in both Python codes and materials thermodynamic stabilities, so forgive me if the questions are somewhat vague or confusing.
-
Is there a way I can modify this code to make this work? Should I include more reference structures? What other calculations am I missing in order to calculate the energy above hull?
-
What does the equation of energy above hull looks like, and how does it differ with the equation of formation energy?
Thank you for your time!
Edit 1:
I managed to fix the error by modifying a certain part of the code into this:
# For a specific compound, e.g., La2Ti2O7
compound = ComputedEntry(Composition("Y4Ti4O8N4"), -322.86938277)
But now I get this input, and I am unsure on how to interpret it. Is it saying that the material is on the convex hull, or am I using the wrong reference materials which results into this?
Available compositions in entries:
Y4 N4
Y16 Ti16 O56
Y8 Ti4 O20
Y4 Ti4 O8 N4
Y2
N8
O6
Ti3
Energy above hull for None ComputedEntry - Y4 Ti4 N4 O8 (YTiNO2)
Energy (Uncorrected) = -322.8694 eV (-16.1435 eV/atom)
Correction = 0.0000 eV (0.0000 eV/atom)
Energy (Final) = -322.8694 eV (-16.1435 eV/atom)
Energy Adjustments:
None
Parameters:
Data:: 0.0000 eV