Query a materials database for candidates by band gap and stability, understand where computed data are reliable, and screen with pandas.
Why it matters
Materials development used to be mostly trial and error: make a sample, test it, adjust. Today a team can screen tens of thousands of compounds in an afternoon using open databases of computed and measured properties, then spend lab time only on the most promising few. Materials informatics is that combination of databases, data skills and judgement. It is increasingly part of job descriptions for materials scientists in batteries, photovoltaics, catalysts and alloys.
The databases
- The Materials Project (https://materialsproject.org): computed properties (formation energy, stability, band structure, elastic constants) for over 150,000 inorganic materials, from density functional theory (DFT). Free account; web interface and a Python API (
mp-api). Checked on 2026-10-23. - AFLOW and OQMD: other large DFT databases with their own APIs.
- Crystallography Open Database and the ICSD (commercial): experimental crystal structures.
- NIST data resources and handbooks (ASM, CRC) for measured properties such as thermal and mechanical data.
- Your own lab data, which is often the most valuable and the least organized.
Key fields and what they mean
- Formation energy (eV/atom): energy to form the compound from its elements. Negative is favourable.
- Energy above hull (eV/atom): how far a compound is above the most stable combination of phases at that composition.
0means it is on the convex hull (predicted stable). Small positive values (tens of meV/atom) are often still makeable as metastable phases; large values usually are not. - Band gap (eV): the energy gap between valence and conduction bands; it decides whether a material is a metal, semiconductor or insulator, and which light it absorbs.
- Density, crystal system, space group, elastic moduli, and an ID (such as
mp-149for silicon) that you should record with any data you use.
Know the limits of computed data
DFT with the common PBE functional underestimates band gaps, often by 30 to 50% or more. Silicon's computed PBE gap is about 0.6 eV against a measured 1.12 eV. Use computed gaps to rank candidates and set loose filters, then check promising ones against experimental values or higher-level calculations. Other caveats: properties are for perfect crystals at 0 K, without defects, grain boundaries or temperature effects. Data is only as good as its provenance, so record the database version and IDs.
Querying the Materials Project API
With a free API key, a typical query in your own Python environment looks like this (it needs the network, so it does not run in the browser exercise):
from mp_api.client import MPRester
with MPRester("YOUR_API_KEY") as mpr:
docs = mpr.materials.summary.search(
band_gap=(1.0, 2.0),
energy_above_hull=(0, 0.0),
fields=["material_id", "formula_pretty", "band_gap", "density"],
)
Keep the key out of your code and notebooks (use an environment variable), respect the API's rate limits, and save the raw results with the date so your screening is reproducible.
Screening with pandas
Once results are in a DataFrame, screening is filtering, sorting and grouping:
mask = df["band_gap_ev"].between(1.0, 2.0) & (df["e_above_hull_ev"] <= 0.0)
shortlist = df[mask].sort_values("band_gap_ev")
df.groupby("crystal_system")["density_g_cm3"].mean()
You will often need to parse chemical formulas (count atoms, find which elements are present) to filter out compounds with toxic, scarce or expensive elements. A small regular expression, ([A-Z][a-z]?)(\d*), splits "Al2O3" into element and count pairs; libraries such as pymatgen do this and much more in a full Python environment.
Worked example
Suppose you want a stable absorber for a solar-cell layer, with a band gap in the computed range 1.0 to 2.0 eV (remember the underestimate: the real gaps will be higher). From an illustrative table of fourteen records:
- Filter
band_gap_evbetween 1.0 and 2.0 ande_above_hull_ev <= 0: CdS, GaN and TiO2 (rutile) pass. Fe2O3 drops out because it sits 31 meV/atom above the hull, and ZnS at 2.02 eV is just outside the range. Relax the hull limit to 0.05 eV/atom and Fe2O3 comes back as a metastable candidate. - Sort by gap, then add filters for cost and toxicity (cadmium is a regulatory concern).
- Check the survivors against measured gaps and literature before any lab work.
Machine learning extends the same workflow: models trained on database entries predict properties of compounds that have not been computed yet. They inherit every bias of their training data, so validation against held-out and experimental data is essential.
Common mistakes
- Taking computed band gaps at face value.
- Treating "energy above hull = 0" as "easy to make": synthesis conditions, kinetics and precursors still decide.
- Losing provenance: no database version, no IDs, no query date.
- Committing API keys to shared notebooks or repositories.
Recap
- Open databases (Materials Project, AFLOW, OQMD, COD) let you screen thousands of materials by computed properties.
- Energy above hull measures stability; computed PBE band gaps are underestimates and good for ranking only.
- Screening is filtering, sorting, grouping and formula parsing in pandas; validate before you make anything.
Try it
Open the Do tab to screen an illustrative materials table with pandas and parse chemical formulas.