Greetings!
I was attempting to get all the materials IDs for the chemical system “Mg-C-O-H” but when I executed the following:
from pymatgen.ext.matproj import MPRester
api_key = MPRester("MYPERSONALKEY")
api_key.get_materials_ids("Mg-C-O-H")
I got all the substances possible from the individual elements and all the other combinations. The desired was to obtain only the substances that included "Mg-C-O-H"
.
I searched everywhere and the only solution was to use wildcards but it seemed not to work, or I don’t know how to use these wildcards, or the argument for get_materials_ids
does not allow for crieria to be applied.
Thank you very much!
Hi, david.
If what you want is a quaternary materials composed of Mg-C-O-H, try the following:
from pymatgen.ext.matproj import MPRester
import pandas as pd
criteria = {“elements”:{"$all":[“Mg”,“C”,“O”,“H”]},“nelements”:4}
properties = [‘material_id’,‘pretty_formula’]
with MPRester(“iNo8MarpXCowXp6H1to”) as mpr:
data = mpr.query(criteria=criteria, properties=properties)
df = pd.DataFrame(data)
df
I was able to get a list of seven substances from materials project!
Is this what you wanted?
2 Likes
You, person, are a life savior.
Now I only need to find how to actually get those whose XRD is experimentally confirmed. Last time I checked it wasn’t implemented yet.
Thank you very much!
2 Likes