Phase diagram analysis for ABC(DH4) type of compounds


Is there a way to treat DH4 as an ion while doing the phase diagram analysis in ABC(DH4) type of compounds? I want to draw ternary phase diagram for such compounds. Thanks in advance.

Hi Hemanta,

This isn’t possible on the website but is possible using pymatgen:

Hi Shyamd,

Thank you so much. Yes, I am using pymatgen, but not sure how can I specify DH4 as single ions in the following piece of script

entries = rester.get_entries_in_chemsys([“A”, “B”, “C”, “D”, “H”])

pd = PhaseDiagram(entries)

ref_entries = [e for e in entries if e.composition.reduced_formula == “A”]

u_ref_0 = min(ref_entries, key=lambda e: e.energy_per_atom).energy_per_atom

el_profile = PhaseDiagram(entries).get_element_profile(element=Element(“A”),

I want to generate element profile diagram as well. Thanks again.

Use the CompoundPhaseDiagram class I linked the docs for rather than a regular PhaseDiagram.

When I do the following as you suggested it reports the attribute error.

pd = CompoundPhaseDiagram(entries, Composition(“DH4”))

AttributeError: Element has no attribute fractional_composition!

Thank you so much for helping me on this issue.

The second kwarg (keyword argument) takes a list of Compositions according to the docs. So you should use at minimum [Composition("DH4")]. It might need the other terminal compositions still so something like: [Composition("A"), Composition("B"), Composition("C"), Composition("DH4")]

In the future, its useful to provide more lines around the error statement. The errors are only useful with the context of where they are thrown.

Thank you so much for the suggestions. It helped alot.

hi this is the tittle given to as

Hi Shyamd,

I wanted to get the diagram similar to element profile diagram with such components. Is there a way to make it with

p1 = CompoundPhaseDiagram(entries, [Composition(“A”), Composition('B"), Composition(“C”), Composition("(DH)4"], normalize_terminal_compositions=True)

I’m not sure I understand the question. It looks like you have code that should work? Did it not?