How does get_entries_in_chemsys() get the compositions


Regarding the “mpr.get_entries_in_chemsys()” how does this function include the possible subsystem list of material ids in a chemical space (among a large database) that will be necessary to build the phase diagram? What is the underlying algorithm that selects possible compositions in a chemical space?

NB: I cannot find the source code on the Pymatgen website.


This function queries entries in the MP thermo database by a full combinatorial expansion into all possible chemical subystems.

For example, say you want to build entries for the Ba-Ti-O ternary phase diagram. If you wrote a query yourself you would need to ask for 3 \choose 1 + 3 \choose 2 + 3 \choose 3 =7 chemical subsystems:

["Ba", "Ti", "O", "Ba-Ti", "Ba-O", "Ti-O", "Ba-Ti-O"]

The lines which accomplish this are in the Materials Project API source code here:

1 Like