Unable to get all chemical potentials for GaAs using pymatgen

I am trying to obtain all the chemical potentials for GaAs using pymatgen using data from vasprun.xml files (attached here) in the location PhaseDiagram/mp-id_material/vasprun.xml
vasprun_As.xml (1.2 MB)
vasprun_Ga.xml (2.2 MB)
vasprun_GaAs.xml (3.8 MB)
. However, the following code only outputs the chemical potential for the As-rich limit. How do I get it to output the Ga-rich limit as well? I notice that pd.qhull_entries for some reason is missing the Ga phase.

from pymatgen.io.vasp import Vasprun
from monty.serialization import dumpfn
from monty.json import MontyEncoder
from pymatgen.analysis.phase_diagram import PhaseDiagram
import os

pdfile = os.path.join(’/mnt/c/users/21083089/Desktop/pycdt/examples’, ‘PhaseDiagram’)

#Load bulk As, Ga and GaAs
personal_entry_list = []
for structfile in os.listdir(pdfile):
if os.path.exists(os.path.join(pdfile, structfile, ‘vasprun.xml’)):
try:
vr = Vasprun(
os.path.join(pdfile, structfile, ‘vasprun.xml’),
parse_potcar_file=False)
personal_entry_list.append(vr.get_computed_entry())
except:
print('Could not load ',structfile)

#Add bulk GaAs
vr_path = os.path.join(pdfile, ‘mp-2534_GaAs’, ‘vasprun.xml’)
bulk_vr = Vasprun(vr_path)
bulk_ce = bulk_vr.get_computed_entry()
bulk_composition = bulk_ce.composition
redcomp = bulk_composition.reduced_composition
personal_entry_list.append(bulk_ce)

#compute chemical potentials
pd = PhaseDiagram(personal_entry_list)
chem_lims = pd.get_all_chempots(redcomp)
print(chem_lims)
#print(pd.qhull_entries)

Any help would be appreciated.

The chemical potential for Ga is equal to the per atom energy of Ga metal. Chemical potentials for defects in binaries are bounded by:

\mu_{GaAs} = \mu_{Ga} + \mu_{As}
\mu_{Ga} \leq \mu_{Ga}^{0}
\mu_{As} \leq \mu_{As}^{0}

You can use these relations to figure out the other chemical potential

Hi @Nicholas_Winner, thanks for the reply. I am aware of these equations but I’m just wondering why the following code I used with pymatgen does not output the Ga-rich chemical potential. Just wondering if it is a bug or maybe something I did wrong?

Also, would anyone happen to know how to construct the chemical potential equations for a ternary alloy such as Hg0.25Cd0.75Te? Where 0.25 of atom sites are occupied by Hg and 0.75 of atom sites are occupied by Cd.

Hi @nigel_hew,

Perhaps the chemical potential diagram class in pymatgen would be useful to you?

https://pymatgen.org/pymatgen.analysis.chempot_diagram.html

Hi @mattmcdermott, thanks for the suggestion, I will check it out.