Unexpected limitations on the length of data in mp_api

Unexpected limitations on the length of data in mp_api

I met a prolem that there seemed to be unexpected limitations on the length of data, using


This is similar to the one as reported in

for matid in df[‘material_id’]:
stru=mpr.get_structure_by_material_id(matid, final=False)

To be more specific, in my case I can only get 25 entries using get_structure_by_material_id,
13 entries using get_bandstructure_by_material_id, 8 entries using get_dos_by_matrial_id.
No errors come out, but the execution of python did not proceed after then.

On the other hand, it was confirmed that using mpr.summary.search can get all structures
(more than 300 structures).

Thank you.

It’s hard to say anything about your specific case without the exact list of material_ids you are querying. However, running MPRester queries within a for loop is usually not the best practice as you are likely to get rate-limited by the API. Also, in your specific query, you are asking for initial structures (final=False) – are you sure that is what you want?

Would suggest trying something like this instead:

from mp_api.client import MPRester
with MPRester() as mpr:
    docs = mpr.summary.search(material_ids=df["material_id"].tolist(), fields=["structure", "material_id"])
1 Like

Thank you very much. I can download any list of structures using the method as you suggested.

However, I cannot get a list of band structures in the same way, for example, for entries in Li-Fe-O with energy above hull less than 0.1, using mpr.electronic_structure.search, as it returns BandStructureData containing only a summary. Could you please give some suggestions?

I can now download a list of bandstructure without any problem, using get_bandstructure_by_material_id in a loop. However, there are still only 8 entries in the result by the loop using get_dos_by_material_id and the loop did not proceed further.

On the other hand, if I run the python script again with the remaining material-ids, dos data can be immediately downloaded.

Thread closed due to inactivity, please open a new thread to address related issues.