Legacy API data
Accessing Legacy Materials Project Structures
Recommended: Using the Next-Gen API (mp-api) — Tasks Endpoint
mp-api) — Tasks Endpointfrom mp_api.client import MPRester
with MPRester() as mpr:
tasks = mpr.materials.tasks.search(task_ids=['mvc-13350', 'mvc-16068', 'mvc-13133', 'mp-867303']) # Each item in 'tasks' contains the structure and associated information for task in tasks: print(task.task_id, task.structure)Legacy API (not recommended, will cease operation in September 2025)
pip install 'pymatgen==2022.7.25'from pymatgen.ext.matproj import MPRester as MPResterLegacy from pymatgen.core import Structure LEGACY_API_KEY = "your_legacy_api_key_here" # 19-character string query = {"formula": "FeO"} # Or any other valid query with MPResterLegacy(LEGACY_API_KEY) as mpr: materials = mpr.query(query, ["material_id", "cif"], mp_decode=False) structures_by_mpid = { doc["material_id"] : Structure.from_str(doc["cif"], fmt="cif") for doc in materials }
Last updated
Was this helpful?