Examples
API query examples with the MPRester client.
Summary Queries
Structure data for silicon (mp-149)
from mp_api.client import MPRester
with MPRester("your_api_key_here") as mpr:
docs = mpr.materials.summary.search(material_ids=["mp-149"], fields=["structure"])
structure = docs[0].structure
# -- Shortcut for a single Materials Project ID:
structure = mpr.get_structure_by_material_id("mp-149")Querying ICSD ID
from mp_api.client import MPRester
with MPRester("your_api_key_here") as mpr:
mp_docs = mpr.materials.summary.search(fields=["material_id", "database_IDs"])
icsd_to_mpid = {}
for mp_doc in mp_docs:
mpid = str(mp_doc.material_id)
for icsd_id in mp_doc.database_IDs.get("icsd",[]):
if icsd_id not in icsd_to_mpid:
icsd_to_mpid[icsd_id] = []
icsd_to_mpid[icsd_id].append(mpid)Find all Materials Project IDs for entries with dielectric data
Calculation (task) IDs and types for silicon (mp-149)
Band gaps for all materials containing only Si and O
Chemical formulas for all materials containing at least Si and O
Material IDs for all ternary oxides with the form ABC3
Stable materials (on the GGA/GGA+U hull) with large band gaps (>3eV)
Electronic Structure
Band structures for silicon (mp-149)
Density of states for silicon (mp-149)
VASP Input Parameters (e.g. NELECT)
Get task-id associated with DOS (mp-149)
Phonons
Band structure for silicon (mp-149)
Density of states for silicon (mp-149)
XAS
XAS for TiO2 element O K edge:
Charge Density
Charge density for silicon (mp-149)
Phase Diagram
Phase diagram for the Li-Fe-O chemical system
Querying amorphous materials
Searching by Crystal Prototype: Example — Perovskite
1. Search by Robocrystallographer Description
2. Search by Provenance Tags and Remarks
3. Combine Results
4. (Optional) Fetch Structures
Querying specialized calculations like DFPT
Identifying Materials with Specific Structural Dimensionalities
Finding Materials by Dimension in a Chemical System
Searching for All Dimensional Forms
Last updated
Was this helpful?