Question Regarding pymatgen API

25 views
Skip to first unread message

Shreyas Muralidharan

unread,
Jul 27, 2016, 2:03:29 PM7/27/16
to Materials Project Development Group
Hello,


I am wondering if it is possible to query for compound types, such as ABO3 compounds, while still providing other descriptors to query for.
This first example does the compound type part, but other descriptors such as spacegroup, are shown with the "criteria" type of query(second picture).
How would I go about combining these two?

Thanks!


Donny Winston

unread,
Jul 27, 2016, 3:05:12 PM7/27/16
to Materials Project Development Group
Yes. MPRester has a static method `parse_criteria`, and strings given as the first argument to MPRester.query are passed to `parse_criteria` to produce a criteria dict. Thus, you can first parse string criteria to a dict, and then update that dict with additional criteria before passing it as the argument to MPRester.query. For example:

from pymatgen import MPRester

m = MPRester()
criteria = m.parse_criteria("**O3")
other_criteria = {
    "spacegroup.crystal_system": "orthorhombic"
}
criteria.update(other_criteria)
data = m.query(criteria=criteria,
               properties=["material_id", "pretty_formula", "energy"])

Best,
Donny
Reply all
Reply to author
Forward
0 new messages