# Calculation stoichiometry for E_above_hull in "Rb2In4O7"

Hi all,

I plot the compound phase diagram using pymatgen.analysis.phase_diagram code in “Rb2O” and “In2O3”
And, I find “Rb2In4O7” ternary compound.

However, i don’t know why the the fraction of “Rb2O” is approximately 0.21 in this compound? (see upload image)

I think this compound contains two “In2O3” and one “Rb2O”.
So I calculate the fraction of “Rb2O” is 0.33 and “In2O3” is 0.66.

Or, please guide me with the code for calculating stoichmetry.

Thanks

** plotting code of compound phase diagram**
from pymatgen.core.composition import Composition
from pymatgen.analysis.phase_diagram import *
with MPRester(“MP-code”) as mpr:
entries = mpr.get_entries_in_chemsys([‘Rb’, ‘In’, ‘O’])
cpd = CompoundPhaseDiagram(entries, [Composition(“In2O3”), Composition(“Rb2O”)])
compound_plotter = PDPlotter(cpd, show_unstable=1)
compound_plotter.show()

Hi @Hyeon_Woo_Kim, great question about a confusing point. The “Fraction” x-axis label in the plot you attached shows the fraction of the normalized terminal composition. (This is a bit misleading with the way the annotations are currently shown in the plotter).

There is an argument in the `CompoundPhaseDiagram` class that distinguishes between normalized and non-normalized diagrams:

``````normalize_terminal_compositions (bool): Whether to normalize the
terminal compositions to a per atom basis. If normalized,
the energy above hulls will be consistent
for comparison across systems. Non-normalized terminals are
more intuitive in terms of compositional breakdowns.
``````

If you re-plot with this parameter set to `False`, it should match the compositional breakdown you described (0.33 instead of 0.23). Let me know if you have any more questions!

1 Like

Hi, @mattmcdermott My confusion was solved by using “normalize_terminal_compositions” option.
Very thanks !

I have another question.
To calculate the E_above hull of “Rb2In4O7” in the plotted graph(see upload image),
I did the calculation but the result is different.(Materialsproject = -0.429 eV/atom, My_work = -0.188 eV/atom)

I calculated it as the difference between the energy of the reactant versus the energy of the product, but I am confused why my calculations are wrong. (please see upload image)

To your second question, this is again related to the normalization of compositions, which affects how you balance the equation you wrote. The equation you describe for E_above_hull is actually not the energy above hull (which would be zero) but similar to the equation for the reaction enthalpy, \Delta H_{\textrm{rxn}} for the reaction \ce{Rb2O + 2 InO3 -> Rb2In4O7}. The reaction enthalpy for this balanced reaction should be -1.286 eV or -0.0989 eV/atom, which is actually the number in the green box on the image in your first post.

The number you calculated (-0.188), should match this per-atom number if you repeat the calculation after ensuring that it is stoichiometrically balanced. This could be done using the reaction above, or by multiplying the term in parentheses (E_{\ce{Rb2O}}*0.33 + E_{\ce{In2O3}}*0.667) by a factor of 3. Once you calculate the energy from this reaction, you should divide by the total number of atoms being reacted (13 atoms) to get the -0.0989 eV/atom number.

The -0.429 eV/atom number that is in the compound phase diagram you plotted is somewhat enigmatic, because it is the result of setting the normalization to `False`. I think this means that the energy is calculated from a non-balanced reaction, so perhaps it should not be used…

@mattmcdermott thanks for explaining this to me.

I have now cleared this confusion using normalized composition fraction.

You’re awesome!

1 Like