Code

MatterGen

A generative model for inorganic materials design.

openmaterials.ai / codes / MatterGen

MatterGen: a diffusion model that generates stable inorganic crystals

A diffusion model denoising atom types, coordinates and lattice together, pretrained on stable crystals and fine-tuned with adapters toward a chemistry, symmetry or property.

What it is and how it works

Noise to crystal in one process

The forward process masks atom types, spreads coordinates to a uniform wrapped distribution and pulls the lattice toward a cubic cell at the training-set density. An equivariant score network reverses all three at once.

Adapter fine-tuning

Adapter modules injected into every layer take an encoded property label. Classifier-free guidance then steers sampling to a chemistry, space group or scalar target.

Training data

Alex-MP-20 has 607,683 structures of up to 20 atoms from the Materials Project and Alexandria. Stability is judged on the 850,384-structure Alex-MP-ICSD hull (Zeni 2025).

Outputs and filters

MatterGen writes unit cells as CIF files. MatterSim pre-relaxes and filters them before DFT, and a structure matcher checks uniqueness and novelty.

Property targets

Fine-tuned on 605,000 magnetic density labels, 42,000 band gaps and 5,000 bulk moduli, then sampled at targets of 0.20 A^-3, 3.0 eV and 400 GPa (Zeni 2025).

Results in the papers

  • 78%samples within 0.1 eV/atom of the MP hullZeni 2025
  • 0.076 ARMSD to the DFT minimum for 95% of structuresZeni 2025
  • >2,000ICSD structures rediscovered, unseen in trainingZeni 2025

TaCr2O6 synthesised to a bulk modulus target

In the MatterGen paper, sampling at a 200 GPa target gave TaCr2O6, 222 GPa by DFT. The synthesised, disordered sample measured up to 169 GPa, within 20% of the target. Zeni 2025

New phases on the V-Sr-O hull

In the MatterGen paper, the model found three new structures, four overall, on the combined V-Sr-O hull, where substitution found three and random structure search one. Zeni 2025

Low supply-chain-risk magnets

In the MatterGen paper, a model tuned to magnetic density 0.2 A^-3 and HHI 1,250 generated SUN structures near both targets and nearly removed Co and Gd from its proposals. Zeni 2025

How it is used

  1. Choose a model

    The base model for open sampling, or one fine-tuned for a chemistry, symmetry or property.

  2. Set the target

    A chemical system such as Li-Co-O, a space group, or a value such as 400 GPa bulk modulus.

  3. Sample structures

    Generate batches of unit cells by reverse diffusion and write them as CIF files.

  4. Pre-relax and filter

    Relax with MatterSim, drop unstable candidates, then compute energy above hull with DFT.

  5. Match against databases

    Keep structures that are unique among samples and new against Alex-MP-ICSD.

Sources: Zeni 2025.https://openmaterials.ai/codes/mattergen/
What MatterGen is, how it works and what it is used for, from the papers listed as sources. Every number links to its paper.Poster pageDownload the poster (PNG, 1920 x 1080)

What MatterGen is

MatterGen is a diffusion model that generates inorganic crystal structures, optionally conditioned on composition, symmetry or target properties such as band gap or bulk modulus. On the map it serves the generated-structure quantity.

In more detail

A diffusion process built for crystals

A crystal is a unit cell with atom types A, fractional coordinates X and lattice L. Each has its own corruption process. Coordinates diffuse under a wrapped normal that respects periodicity and tends to uniform, with the noise scaled by cell size. The lattice diffuses in a symmetric form toward a cubic cell at the average atomic density of the training data. Atom types diffuse in categorical space toward a masked state. The score network outputs invariant scores for types and equivariant scores for coordinates and lattice, so the symmetries are not learned from data. Fine-tuning adds adapter modules in every layer and uses classifier-free guidance at sampling time (Zeni 2025).

Numerics and scale

Of 1,024 generated structures relaxed with DFT, 78% lie within 0.1 eV/atom of the Materials Project hull and 75% within 0.1 eV/atom of the Alex-MP-ICSD hull. For 95% of structures the RMSD to the DFT-relaxed geometry is below 0.076 A. Uniqueness is 100% at 1,000 samples and 52% at 10 million, and 61% of samples are new. Trained on MP-20 only, MatterGen-MP yields 60% more SUN structures than CDVAE and DiffCSP with 50% lower RMSD. Scaling the training set to Alex-MP-20 adds another 70% in SUN rate and cuts RMSD five times. In quinary systems it reached the hull with 10,240 samples against about 70,000 for substitution and 600,000 for random structure search (Zeni 2025).

Data and code

Training structures come from the Materials Project v2022.10.28 and Alexandria, both CC BY 4.0, and the test reference adds ICSD release 2023.1. The MatterSim force field pre-relaxes the generated candidates and screens them for phonon stability before DFT. The microsoft/mattergen repository holds the source code, the Alex-MP datasets and the CIF files of the paper. On the map MatterGen serves the generated-structure quantity, batches of unit cells written to CIF (Zeni 2025).

Validation

The bulk modulus models were sampled at 50, 100, 150 and 200 GPa, 8,192 candidates each. Among them 101 matched experimentally verified ICSD structures absent from training, and DFT moduli for 95 of these agree with the targets to an MAE of 23 GPa and an RMSE of 32 GPa. One of four synthesis candidates, TaCr2O6, formed with 98% phase purity by Rietveld refinement. With a budget of 180 DFT property calculations the model found 18 SUN structures above 0.2 A^-3 magnetic density and 106 above 400 GPa bulk modulus, against 40 for screening. The jointly fine-tuned magnet model rediscovered 67 synthesised disordered ICSD structures (Zeni 2025).

What it computes on the map

1 quantity, drawn by tier with the data flow between them. Dashed boxes are intermediate quantities. Select one for its formula and the other codes that compute it.

Open the full mapShare this submap
Embed this submap
<iframe src="https://openmaterials.ai/m/c56731602651/00000000000001?embed=1" title="MatterGen on the OpenMaterials map" width="100%" height="480" loading="lazy" style="border:1px solid #EBEBEB;border-radius:6px"></iframe>

Each quantity with the interface the representation records.

  • StructureMatterGen generator.generate(batch_size, num_batches, output_dir) -> pymatgen Structures written to CIF (mattergen_wrapper.py:130-145); dimensionless generated artifact

References

The code

The papers that describe the code; cite them when you use it.

  1. C. Zeni, R. Pinsler, D. Zügner et al., A generative model for inorganic materials design, Nature, 2025. doi.org/10.1038/s41586-025-08628-5

Applications

Highly cited studies that cite the code, with a few picked by hand.

  1. N. J. Szymanski, C. J. Bartel, Establishing baselines for generative discovery of inorganic crystals, Materials Horizons, 2025. doi.org/10.1039/d5mh00010f
  2. C. Parida, D. Roy, J. M. G. Lastra et al., Mining Chemical Space with Generative Models for Battery Materials, Batteries &amp; Supercaps, 2025. doi.org/10.1002/batt.202500309
  3. C. Su, J. Lu, Y. Fu et al., A Machine-Learning-Accelerated Approach for Room-Temperature Phase Diagram Predictions, The Journal of Physical Chemistry Letters, 2026. doi.org/10.1021/acs.jpclett.6c01568
  4. H. A. Cortés, B. K. Das, H. Früchtl et al., Garnets Li7La3M2O13 (M = Ta, Nb): Stable phases and superior ionic conductors?, Journal of Power Sources, 2026. doi.org/10.1016/j.jpowsour.2026.240034

How to cite

C. Zeni, R. Pinsler, D. Zugner, et al., A generative model for inorganic materials design (MatterGen), Nature 639, 624 (2025)

doi.org/10.1038/s41586-025-08628-5