I am considering to extract the Li-containing materials from materialsproject database, by using the
.get_dataframe(criteria={“nelements”: {"$gt": 2},“nelements”: {"$lt": 5},“elements”:{"$in":[“Li”]},
How could I exclude the transition metal-containing materials?
You’d place this inside the elements query as you have done for $in. You can get the list of transition metal elements in pymatgen by iterating over elements and passing this into your query:
transition_metals = [pmgel for pmgel in element_strs if Element(pmgel).is_transition_metal]
# then use $nin: [transition_metals]