A Swiss Army Knife for Graph Neural Networks in Materials Science ✛

Original: "Materials Graph Library (MatGL), an open-source graph deep learning library for materials science and chemistry"
arXiv:2503.03837 · 2025-03-05 · CC BY 4.0 · 3 min
MatGL brings together five graph architectures and ready-made interatomic potentials in one open library.

A Swiss Army knife is simple: one handle, many blades, each for its own task. Grab what you need and get to work. In materials science, graph neural networks have long resembled a scattered set of tools: MEGNet sat in the TensorFlow drawer, M3GNet in the PyTorch drawer, and CHGNet in a separate box with its own scripts. To transfer a model to new data or compare architectures, you had to improvise adapters. The MatGL library brings these blades together into one handle.

Inside are five architectures: MEGNet, M3GNet, CHGNet, TensorNet, and SO3Net. They are built from shared modules: layers, pooling, activation functions. It's like a knife with a common mechanism: only the blade shape changes. Training runs through PyTorch Lightning, allowing calculations to scale across multiple GPUs. For interatomic potentials, functions that predict energy from atomic positions, a Potential class is implemented. It automatically handles energy normalization and computes forces, stresses, and Hessians via automatic differentiation. Interfaces to ASE and LAMMPS let you run structure relaxation and molecular dynamics with a single command.

The pretrained M3GNet potential in MatGL predicts energy and forces for a crystal of 1000 atoms in fractions of a second, whereas a DFT calculation of the same system would take hours on a supercomputer.

Benchmarks on four datasets show that MatGL reproduces the accuracy of the original models. On QM9, the free energy prediction error for M3GNet is 0.025 eV, for TensorNet 0.027 eV, and for SO3Net 0.025 eV; MEGNet lags with 0.037 eV. On Matbench for formation energy, M3GNet, TensorNet, and SO3Net give an error of 0.020–0.024 eV/atom, while MEGNet gives 0.037 eV/atom. For potentials on ANI-1x, the equivariant SO3Net achieves a force error of 0.035 eV/Å, compared to 0.075 eV/Å for M3GNet with transfer learning. On crystals from the Materials Project, CHGNet outperforms M3GNet and TensorNet: an energy error of 19.9 meV/atom versus 23.0 and 30.3 meV/atom. Inference speed for TensorNet on QM9 is 14.9 seconds for 6541 molecules on a single RTX 3090, while MEGNet takes 12 seconds but with worse accuracy.

Previously, each graph model for materials lived in its own repository with its own data format and training method. Now there is a unified library where five architectures, pretrained potentials, and interfaces to simulators work through a common API. The developers assembled modular layers and data pipelines on top of DGL and PyTorch Lightning, then ran all models through identical benchmarks. Materials scientists can immediately run property predictions and molecular dynamics without diving into the details of each architecture. This lowers the barrier for experimentalists and speeds up reproducibility. Unlike neighboring works that focus on a single architecture or on reinforcement learning, MatGL offers five models at once and connects them to ASE and LAMMPS, turning the library into a platform for the full cycle, from data to molecular dynamics.

The next step is support for multi-GPU training and working with databases exceeding millions of structures. The authors plan to use memory-mapped databases for storing graphs to lift memory limitations. This will allow training universal potentials on the entire Materials Project and running molecular dynamics for systems with hundreds of thousands of atoms. The Swiss Army knife doesn't stay in the drawer; it unfolds for new tasks.

The pretrained M3GNet potential in MatGL predicts the energy and forces for a crystal of 1000 atoms in fractions of a second, whereas a DFT calculation of the same system would take hours on a supercomputer.

Concepts
machine learning materials graph neural network deep learning in medical imaging molecular property prediction protein language model neural network physics modeling graphite dataset Large Language Models generative model medical image to genomic mapping machine learned interatomic potential materials science Graphs neural network crystal imaging