openmaterials.ai / codes / MatGL

MatGL: graph potentials for the periodic table, M3GNet and CHGNet

Graph neural network potentials trained on Materials Project relaxation trajectories for 89 elements, one of which also predicts the magnetic moment on every site.

What it is and how it works

Three-body graphs, 89 elements

Atoms are nodes, bonds are edges, and bond angles enter through a bond graph. Energies, forces, stresses and, in CHGNet, magnetic moments come from one network pretrained on the Materials Project.

M3GNet architecture

Bond features are updated from all other bonds at the same atom, angles expanded in spherical Bessel functions and harmonics. Three blocks, 227,549 weights (Chen 2022).

CHGNet charge constraint

CHGNet predicts site magnetic moments from the atom features and trains on them as a target, so the latent space separates valence states such as V3+ and V4+ (Deng 2023).

Inputs and outputs

A crystal structure with lattice and positions in, total energy out. Forces and stresses follow by automatic differentiation with respect to coordinates and strain.

Training data

M3GNet learned from 187,687 ionic steps of 62,783 compounds. CHGNet learned from MPtrj, 1,580,395 configurations with 7,944,833 magnetic moments (Chen 2022, Deng 2023).

Interfaces

Both models run as ASE calculators with structures from pymatgen. Relaxations use the FIRE optimizer, and CHGNet energies feed cluster expansions in smol (Deng 2023).

What people do with it

  • 0.035 eVenergy MAE per atom, M3GNet on its test setChen 2022
  • 31,664,858hypothetical crystals relaxed with M3GNetChen 2022
  • 0.032 muBmagnetic moment MAE of CHGNet on MPtrj testDeng 2023

Screening 31 million hypothetical crystals

In the M3GNet paper, relaxing 31,664,858 substituted ICSD prototypes left 1,849,096 below the MP hull. Of the 1000 lowest, 999 were stable by DFT and none were in MP. Chen 2022

Charge disproportionation in LixMnO2

In the CHGNet paper, a 1.5 ns run at 1100 K turned orthorhombic Li0.5MnO2 into a spinel-like phase about 50 meV per oxygen lower, with Mn2+ rising sharply near 0.8 ns. Deng 2023

Softening across 1000 unseen compounds

For over 90% of 1000 WBM compounds, M3GNet and CHGNet forces fall below DFT with fitted slopes under 1. One extra configuration cut CHGNet force MAE from 0.190 to 0.166 eV/A. Deng 2025

How it is used

  1. Load a pretrained model

    Pick M3GNet for energies, forces and stresses, or CHGNet when magnetic moments matter.

  2. Build a structure

    A pymatgen Structure or ASE Atoms object, any composition of the 89 covered elements.

  3. Relax or run MD

    Relax positions and cell with FIRE, or integrate NVT dynamics at a 2 fs step through ASE.

  4. Read the outputs

    Energy in eV, forces in eV/A, stress in eV/A^3 and, for CHGNet, magnetic moments in muB.