01 / 17
AI for Materials Science  ·  Lecture 06 (Complete Beginner-to-Research Edition)

Inorganic & Crystal Materials Informatics:
Pymatgen, Simulated XRD, Convex Hulls & High-Throughput Screening

Zesheng Liu
Laboratory of Organic Electronics, Linköping University
Modules 06a–06b  |  Periodic Crystals, Space Groups, AFLOW (N = 27,767) & Perovskite Stability (N = 1,929)
Linköping University Laboratory of Organic Electronics

Lecture 06 roadmap: from unit cells to virtual screening funnels

Bridging crystallography, thermodynamics, and composition-based ML across Notebooks 06a–06b
PART 1 · MODULE 06a

Crystal Structures & Databases

Periodic boundary conditions (PBC), Bravais lattices & 230 space groups, building crystals & supercell defects in pymatgen, CIF files, COD & Materials Project API.

PART 2 · MODULE 06b

XRD & Thermodynamic Stability

Bragg's law, systematic extinction in Diamond Si, Anatase vs. Rutile TiO2 fingerprinting, convex hull stability (Ehull), and Goldschmidt tolerance factor.

PART 3 · MODULE 06b

CBFV Band-Gap ML & HTVS

Magpie composition-based feature vectors, 2-stage Metal/Non-metal + Eg modeling on AFLOW, the chemistry extrapolation cliff, and high-throughput screening funnels.

Inorganic materials informatics combines crystallographic representation (Pymatgen), thermodynamic physics (convex hulls), and composition ML to screen 10⁴+ candidates.
Linköping University Laboratory of Organic Electronics

Why SMILES fails for crystals: Periodic Boundary Conditions

A crystal is not a finite molecular graph—it is an infinite periodic lattice defined by (a, b, c) + fractional basis
MOLECULES (MODULES 01–05)

Finite Graphs (SMILES / RDKit)

  • Discrete covalent bonds with well-defined valences.
  • Isolated finite atoms: no periodic images.
  • Standard exchange format: SMILES / SDF.
CRYSTALS (MODULE 06)

Infinite Periodic Lattices (Pymatgen)

  • Defined by 3×3 lattice matrix L + fractional coordinates f ∈ [0, 1)3.
  • Atoms wrap across unit-cell walls (PBC); bonding is metallic, ionic, or covalent.
  • Standard exchange format: CIF (Crystallographic Information File).
To represent an inorganic solid in code, you need three ingredients: lattice vectors (a, b, c, α, β, γ), species, and fractional coordinates inside [0, 1)³.
Linköping University Laboratory of Organic Electronics

Building classic crystal prototypes from space groups

One line of Structure.from_spacegroup(...) expands asymmetric Wyckoff sites into full unit cells
Building classic crystal prototypes from space groups
Symmetry compresses crystal descriptions dramatically: NaCl, Diamond Si, and BaTiO₃ each need only 1–3 asymmetric-unit atoms plus their space group.
Linköping University Laboratory of Organic Electronics

Open crystal databases: COD & Materials Project

Where inorganic ML datasets come from—combining experimental crystallography with high-throughput DFT
EXPERIMENTAL · COD

Crystallography Open Database

  • 500,000+ experimentally solved crystal structures (XRD / neutron).
  • 100% open access, no API key required—direct CIF download via REST.
  • Ideal ground truth for real synthesizable structures and polymorphism.
COMPUTATIONAL · MATERIALS PROJECT & AFLOW

High-Throughput DFT Repositories

  • 150,000+ (MP) to 3.5M+ (AFLOW) DFT-relaxed crystals with uniform settings.
  • Provides formation energies, Eabove_hull, band gaps, elastic tensors, and DOS.
  • Query by chemical system (chemsys="Ti-O") or property window via mp-api.
Experimental databases (COD/ICSD) tell you what has been synthesized; DFT repositories (MP/AFLOW/OQMD) supply uniform labels for ML training.
Linköping University Laboratory of Organic Electronics

Simulated XRD & systematic extinction in Diamond Si

Bragg's law (2dhkl sinθ = nλ) gives peak positions; the structure factor Fhkl determines which peaks vanish
Simulated XRD & systematic extinction in Diamond Si
Diamond Si's two-atom basis causes exact destructive interference at (200)—XRD peak absences directly reveal space-group symmetry!
Linköping University Laboratory of Organic Electronics

Phase identification: Anatase vs. Rutile TiO2

Identical chemical formula (TiO2), completely different crystal symmetry, band gap, and photocatalytic activity
Phase identification: Anatase vs. Rutile TiO2
Simulated XRD from Pymatgen lets you match experimental powder patterns against candidate polymorphs in milliseconds.
Linköping University Laboratory of Organic Electronics

Thermodynamic convex hull: ΔHf < 0 does NOT mean stable!

A phase is thermodynamically stable only if it sits ON the lower convex hull against all competing decompositions
Thermodynamic convex hull: &Delta;Hf &lt; 0 does NOT mean stable!
Always screen by Energy Above Hull (E_above_hull ≤ 50 meV/atom), not raw formation energy—competing phases can still decompose a negative-ΔH_f compound!
Linköping University Laboratory of Organic Electronics

Perovskite stability: Ehull & Goldschmidt tolerance factor

Combining thermodynamic hull distributions (N = 1,929 oxides) with geometric packing physics (t)
Perovskite stability: Ehull &amp; Goldschmidt tolerance factor
Simple physics priors like Goldschmidt's tolerance factor t narrow vast chemical spaces before you ever launch an expensive DFT calculation.
Linköping University Laboratory of Organic Electronics

Composition-Based Feature Vectors (CBFV / Magpie)

How to featurize ANY chemical formula without knowing its 3D crystal structure yet
Composition-Based Feature Vectors (CBFV / Magpie)
CBFV turns any stoichiometry into a fixed-length vector of weighted elemental statistics—fast and universal, but blind to polymorphs (e.g., graphite vs. diamond).
Linköping University Laboratory of Organic Electronics

Two-stage band-gap ML on AFLOW: Classification + Regression

Because ~50% of inorganic crystals are metals (Eg = 0 eV), separate metal/non-metal classification from non-metal regression
Two-stage band-gap ML on AFLOW: Classification + Regression
A two-stage pipeline (classify metal vs. non-metal first, then regress E_g on non-metals) prevents zero-inflation from distorting band-gap predictions.
Linköping University Laboratory of Organic Electronics

The extrapolation cliff: random-split R2 is an illusion!

Holding out an entire chemical family (all Fluorides) exposes how composition ML struggles on unseen chemistry
The extrapolation cliff: random-split R2 is an illusion!
Random splits measure interpolation between near-identical stoichiometries; always validate inorganic models with Leave-One-Cluster/Element-Out (LOCO) splits!
Linköping University Laboratory of Organic Electronics

High-Throughput Virtual Screening (HTVS) funnel

Chaining cheap ML filters, thermodynamic hull checks, and element sustainability to shortlist ~20 lab targets from 27,767 crystals
High-Throughput Virtual Screening (HTVS) funnel
HTVS puts cheap models at the top of the funnel and expensive DFT/experiments at the bottom—turning impossible searches into focused discovery.
Linköping University Laboratory of Organic Electronics

A crystal structure is not the whole material: history & heuristics

Bridging idealized 0 K DFT lattices with real experimental synthesis, defects, and pre-DFT chemical rules
REAL MATERIALS HAVE A HISTORY

Nominal Formula ≠ Measured Solid

  • Off-stoichiometry & defects: You weigh out TiO2, but annealing atmosphere yields TiO2−x with oxygen vacancies!
  • Processing is a sequence: Identical eutectoid steel gives pearlite or martensite depending on cooling rate.
  • Operating conditions: Aqueous electrocatalysts require Pourbaix diagrams (pH–potential stability), not just 0 K Ehull.
STAGE-0 SCREENING & REPRESENTATION LADDER

From SMACT Rules to Local Environments

  • Chemical heuristics (SMACT): Enforce charge neutrality + Pauling electronegativity to prune 109 compositions in seconds.
  • Global structure: Unit-cell volume/atom, density & space group break polymorph degeneracy.
  • Local 3D fingerprints (ACSF / SOAP → GNNs): Smooth radial/angular shells feed directly into Lecture 10 MLIPs!
Always match your representation to the physics: stoichiometry + SMACT for hypothetical screening, structure/process features when polymorphs and defects govern properties.
Linköping University Laboratory of Organic Electronics

Breaking the polymorph ceiling: NOMAD TCOs & Radial Fingerprints

Adding unit-cell geometry slashes (Al,Ga,In)2O3 error; smooth radial symmetry functions (G2) bridge to Crystal GNNs
Breaking the polymorph ceiling: NOMAD TCOs &amp; Radial Fingerprints
Unit-cell volume and Gaussian radial shells resolve polymorphs that pure CBFV collapses—setting the exact mathematical stage for Lecture 10's CGCNN & MACE!
Linköping University Laboratory of Organic Electronics

Summary (Take home notes)

  • Periodic crystals need lattices + basis: Use pymatgen.Structure, space groups, and CIF files to build, analyze symmetry, and create defect supercells.
  • XRD fingerprints symmetry & polymorphs: Bragg's law gives peak positions while structure factors cause systematic extinctions (e.g., Diamond Si (200) = 0).
  • Hull stability beats formation energy: Always evaluate Eabove_hull against competing phases; combine with geometric priors like Goldschmidt t.
  • CBFV enables structure-free screening: Stoichiometry-weighted Magpie statistics predict metal/non-metal & band gaps fast—but cannot distinguish polymorphs.
  • Audit extrapolation with chemistry splits: Random splits overstate inorganic ML accuracy; use Leave-One-Group-Out splits and multi-stage HTVS funnels.
Linköping University Laboratory of Organic Electronics

Thanks for your listening

Zesheng Liu  ·  zesheng.liu@liu.se
AI for Materials Science  ·  Lecture 06  |  Next: Hands-on Practice in 06c_exercises.ipynb
Linköping University Laboratory of Organic Electronics