I am using Pymatgen to analyze phase diagrams, and I have noticed that the coefficients for the decomposition products of certain unstable phases are not quite correct.

As I understand it, when a balanced chemical equation is given as C = XA + YB, the ‘get_decomp_and_e_above_hull’ function in Pymatgen, by default, should print out xA + yB, with x and y normalized so that x + y = 1 (x = X/(X+Y), y = Y/(X+Y)).

However, when I run the code for the simple case of B2S3,

decomp, ehull = pd.get_decomp_and_e_above_hull(PDEentry_for_B2S3)
data[“Decomposition”].append(" + “.join([”%.2f s" (v, k.composition.reduced_formula) for k, v in decomp.items()]))

the output shows 0.60 BS2 + 0.40 BS instead of the expected 0.50 BS2 + 0.50 BS. According to the balanced equation B2S3 = 1 BS2 + 1 BS, the coefficients should be 1/2 for each product. I’m curious to know what algorithm Pymatgen uses to obtain the values of 0.6 and 0.4.

This is another issue related to composition normalization, which has to do with phase diagram construction. For some more background on this, please see my recent post about the calculation of formation energies:

According to the documentation of the PhaseDiagram.get_decomp_and_e_above_hull method, it returns the decomposition coefficients of normalized compositions. Normalized compositions are represented as having one total atom. For example, B2S3 becomes B0.4S0.6.

This means if you want to write the decomposition of B2S3 into BS2 and BS, you would actually write: