Summary
Using mp-api (mpr.materials.robocrys) to search for perovskites and the search seems to be missing at least one key entry (mp-732337) that it should be returning (after examining the robocrys entry on the website).
Issue
mp-api search for “perovskite” does NOT yield mp-732337 in the results.
Expected Behavior
robocrys search for “perovskite” should yield mp-732337
Things tried already
- Checking database version → 2025.06.09 (latest)
- Checked robocrys version → 2.10. This is behind current 2.11 version and could be the issue. If so, is there any way to access 2.11?
- Try with other search terms [‘Pnma’, ‘Pb’] → DOES yield mp-732337
Code to reproduce
from mp_api.client import MPRester
import os
API_KEY_MP = os.environ['API_KEY_MP']
with MPRester(API_KEY_MP) as mpr:
rc_entries = mpr.materials.robocrys.search(
keywords=['perovskite'],
)
material_ids = [rcdoc.material_id for rcdoc in rc_entries]
'mp-732337' in material_ids
Thanks @kdmiller, looks like something isn’t going right with the search
function. While we fix this, you can use the following code to get all 8,509 docs with ‘perovskite’ in the description:
with MPRester(use_document_model=False) as mpr:
robocrys_docs = mpr.materials.robocrys.search_docs()
perovskite_docs = [doc for doc in robocrys_docs if 'perovskite' in doc['description'].lower()]
That has the downside of pulling all robocrys docs, but you can always save a copy locally to use later:
from monty.serialization import loadfn, dumpfn
# to save to disk
dumpfn(robocrys_docs,"all_robocrys_docs.json.gz")
# to load from disk
robocrys_docs_copy = loadfn("all_robocrys_docs.json.gz")
- Checked robocrys version → 2.10. This is behind current 2.11 version and could be the issue. If so, is there any way to access 2.11?
Run pip install --upgrade robocrys
from a terminal
Very helpful, thanks. This workaround is great.
As for the search issues, I also noticed that the output from searching with keywords=['perovskite']
yielded quite a few duplicate entries which differed only in the robocrys descriptions (and these differences seemed to be different kinds of encodings for the sub/superscripts in the formulae e.g. Nbв‚‚Seв‚ѓ
vs Nb₂Se₃
).