MPRester: Complex queries

Hi all

I am trying to query all copper oxides with two elements whose a-axis lattice spacing is bigger than 5 A.

Without the unit cell criteria, the query works fine. However, when I include it, as above, I get no results []. This is not possible, as there are materials within the MP database for which the query is justified.

If you have any input on how to adjust the query, please let me know.


@gperren, changing it to structure.lattice.a should work.

– Jason

Hi Jason

Thank you for your feedback.


Hi Jason

While playing around with more queries, I have come up with 3 follow-up questions.

  1. The MP highlights when the calculated structure is in agreement with experimental findings. I am wondering how the comparison between calculated and experimentally determined structures is carried out? As I understand, the MP CIF files always represent the results obtained by the calculation.

  2. In my query for copper oxides, I would like to restrict the query to compounds that carry a magnetic moment. However, these compounds do not necessarily have to show long-range magnetic order. I suppose that the criterion is best achieved by

“magnetism.num_magnetic_sites”: {"$gte": 1}

  1. I would like to search for copper oxides whose lattice parameters (a,b, and c) are pairwise bigger than a certain length. Currently, this is implemented with 3 AND statements:

Is there a more elegant way to accomplish this task?

I look forward to your feedback.


Hi @gperren,

Sorry for the delayed response. Feel free to tag me in your messages so I get notified directly. For your first question, we find experimental materials by structure matching to materials in the ICSD database. The explicit details of the matching algorithm are in the fit method of the StructureMatcher class in pymatgen. For your second question, I think what you are doing is fine. For your third, you may run into setting trouble. If I were you, I would query for structures using elements, nelements, and magnetism.ordering, and do the processing manually where you can guarantee the cell setting.

– Jason