Abstract
Graph deep learning models, which incorporate a natural inductive bias for a collection of atoms, are of immense interest in materials science and chemistry. Here, we introduce the Materials Graph Library (MatGL), an open-source graph deep learning library for materials science and chemistry. Built on top of the popular Deep Graph Library (DGL) and Python Materials Genomics (Pymatgen) packages, our intention is for MatGL to be an extensible "batteries-included" library for the development of advanced graph deep learning models for materials property predictions and interatomic potentials. At present, MatGL has efficient implementations for both invariant and equivariant graph deep learning models, including the Materials 3-body Graph Network (M3GNet), MatErials Graph Network (MEGNet), Crystal Hamiltonian Graph Network (CHGNet), TensorNet and SO3Net architectures. MatGL also includes a variety of pre-trained universal interatomic potentials (aka "foundational materials models (FMM)") and property prediction models are also included for out-of-box usage, benchmarking and fine-tuning. Finally, MatGL includes support for Pytorch Lightning for rapid training of models.
Introduction
In recent years, Graph Neural Networks (GNNs) have become the gold standard for predicting materials properties because they naturally represent atoms as nodes and bonds as edges. However, the software landscape has been fragmented. Most GNN implementations are tied to a single research paper, built on different backends (TensorFlow, JAX, or PyTorch Geometric), and lack easy-to-use interfaces for actual molecular dynamics (MD) simulations.
The Materials Graph Library (MatGL) addresses this gap by providing a high-performance, extensible library that handles the entire pipeline: from raw chemical data to efficient graph training and production-grade simulations.
The MatGL Ecosystem
MatGL is built on a robust stack: Deep Graph Library (DGL) for graph operations, PyTorch for the deep learning backend, and PyTorch Lightning for scalable training. The library's architecture is designed for modularity and ease of use across the entire materials science workflow.
As shown in the ecosystem overview, MatGL provides a GraphConverter to turn Pymatgen objects into DGL graphs, a Potential class to handle the physics of interatomic potentials (like calculating forces from energy gradients), and direct interfaces for LAMMPS and ASE.
Model Architectures
MatGL implements two main classes of GNNs: Invariant and Equivariant models. Invariant models use scalar features like bond distances and angles, making them computationally efficient for crystal systems. Equivariant models ensure that tensorial properties transform correctly under rotations, which is crucial for complex molecular environments.
The choice of DGL over other backends was deliberate; benchmarks show DGL is more memory-efficient and faster when training on the large, complex graphs typical of materials science.
Datasets and Benchmarking
The authors benchmarked MatGL using several industry-standard datasets:
- QM9: 130,831 organic molecules for property prediction.
- Matbench: A suite of bulk crystal properties including formation energy and moduli.
- ANI-1x: Approximately 5 million molecular conformers for organic interatomic potentials.
- MPF-2021.2.8: A subset of the Materials Project containing over 185,000 crystal structures and their relaxation trajectories.
Key Insights and Results
- State-of-the-Art Accuracy: On the QM9 dataset, models like SO3Net achieved a Mean Absolute Error (MAE) of just 0.025 eV for free energy.
- Inference Speed: TensorNet emerged as a "sweet spot" model, offering high accuracy with inference times under 15 seconds for large test sets—significantly faster than higher-rank equivariant models.
- The "Noisy Data" Challenge: While equivariant models (like SO3Net) are superior for molecules, they are highly sensitive to "noise" in DFT data. In large crystal databases where DFT convergence settings might be less strict, invariant models like CHGNet often prove more stable and accurate.
- Foundational Models (FMMs): MatGL ships with pre-trained "universal" potentials, allowing researchers to perform geometry relaxations or MD simulations on almost any inorganic crystal without needing to train a model from scratch.
- Transfer Learning: Fine-tuning a pre-trained M3GNet model (M3GNet-TL) on specific datasets significantly speeds up convergence and reduces error by 10-15%.
Conclusion
MatGL provides a unified, "batteries-included" framework for graph deep learning in materials science. By bridging the gap between model development and large-scale simulation, it empowers researchers to move seamlessly from training property predictors to running production-grade atomistic simulations in LAMMPS or ASE. Future work will focus on memory-mapped databases for multi-million structure datasets and further optimizing multi-GPU parallelization for next-generation foundational models.
Summary updated