Hi I am wondering if there is a way to pull the number of atoms used in an api search, which is listed on the summary page when I look up a specific material id on the website.
Hi @casfrueh,
Here is an example query to get you the number of sites and number of elements for silicon (mp-149).
from mp_api.client import MPRester
with MPRester("your_api_key") as mpr:
docs = mpr.summary.search(material_ids=["mp-149"], fields=["material_id", "nsites", "nelements"]])
Does this answer your question?
– Jason
Hi Jason,
No this did not answer my question. I was able to pull nsites and elements already. But for mp-149 like in your example, the number of atoms listed on the website is 8. I was hoping to pull that when I pull the data for mp-149. But I can’t find the way to pull that info. It may not be possible. I was just wondering. Thanks for your help.
Best Regards,
Cassie
That data is taken from the number of sites in the conventional unit cell. If you want that for a given MPID I would pull the structure, ensure it is the conventional cell setting, and then take len(structure)
to get the number of sites.
– Jason