Couple of things to consider:
- If you’re retrieving a lot of structures or repeatedly have to run the same queries, it’s much more performant to download all structures, save them to disk and post-filter (see here for a start)
- You don’t need to call
mpr.get_structure_by_material_id(). The structure should already be in yourstructureslist and accessible viastructure_summary.structure.
HTH