Change Log
4.0.1
- Intermediate features now exposed via
model.feature_dict. AllMatGLModelsubclasses (TensorNet,M3GNet,CHGNet,QET,MEGNet,SO3Net,GRACE, and theTransformedTargetModelwrapper) populate afeature_dictinstance attribute on everyforwardcall. The legacyreturn_all_layer_output(forward) andreturn_features(inpredict_structurefor TensorNet / CHGNet / M3GNet, and inQET.__init__) kwargs are deprecated and emit aDeprecationWarningwhen used. They will be removed in matgl v5.
4.0.0
- DGL backend removed. All DGL implementations have been deleted. matgl now targets PyTorch Geometric exclusively. The
MATGL_BACKENDenv var and theensure_backend()helper have been removed.matgl.set_backend()is retained as a no-op stub for backwards compatibility and emits aDeprecationWarningwhen"DGL"is requested. Private_*_pyg.pymodules have been renamed to drop the_pygsuffix. If you wish to use DGL, please installmatgl<=4. - Optional JAX inference backend (
matgl.ext.jax, experimental). New subpackage that reimplements the inference path (energy + forces + stress) of theTensorNetandQETmodels in JAX. A pre-trained PyTorch potential is converted to a JAX parameter tree and JIT-compiled by XLA into one fused program, giving a portable (CPU / CUDA / Apple-Silicon) ~2-3.5x speedup over eager PyTorch for the MD / relaxation inner loop, with no NVIDIA-Warp dependency.JAXPESCalculatoris a drop-in twin ofmatgl.ext.ase.PESCalculator. Outputs match the PyTorch reference to float64 precision. Requires the optionaljaxextra (pip install matgl[jax]); inference-only. - Bug fix:
QETno longer crashes on single-atom structures. Baretorch.squeeze()calls inQET.forwardcollapsed the size-1 node dimension of a one-atom input to a 0-d scalar, raisingIndexErrorinsideElectrostaticPotential. These now use.reshape(-1), which drops only trailing feature dimensions and never the node dimension. - Bug fix:
TensorNet/QETno longer crash with the non-smoothSphericalBesselradial basis. Withrbf_type="SphericalBessel"anduse_smooth=False, the basis emitsmax_l * max_nfeatures, but the embedding / interaction inputLinearlayers were sized for onlymax_n, raising a shape-mismatchRuntimeErrorin the forward pass. The radial-basis width fed to those layers now correctly accounts formax_lin the non-smooth case (the smoothSphericalBesselandGaussianbases are unaffected).
3.0.4
- PyG
SO3Net. Newmatgl.models._so3net_pyg.SO3Netis the PyG counterpart of the existing DGLSO3Netand is now the implementation selected on the default PyG backend. The full public surface is preserved (target_propertyin{atomwise, dipole_moment, polarizability, graph},readout_typein{set2set, weighted_atom, reduce_atom},correct_charges,predict_dipole_magnitude,use_vector_representation,return_vector_representation). Forward now takes a PyGData/Batchand aggregates per-graph viascatter_add/bincountinstead ofdgl.readout_nodes/batch_num_nodes. - DGL backend deprecated. The DGL backend (
MATGL_BACKEND=DGL) is deprecated and will be removed in v4.0.0. PyG is now the only supported backend for new work.ensure_backend("DGL")(called at import time whenMATGL_BACKEND=DGL, and frommatgl.set_backend("DGL")) now emits aDeprecationWarning.
3.0.3
- GRACE (PyG) interatomic potential. New
matgl.models.GRACE(beta) joins TensorNet / M3GNet / MEGNet / QET / CHGNet / SO3Net on the PyG backend. (#779) matgl.utils.training.MGLPotentialTrainer+MGLDatasetLoader(new, PyG-only). First dataset-level Hugging Face integration in matgl: a configure-once / fit-when-asked trainer paired with a small dataset-factory class that hoists HF auth / cache config to one place.__init__stores hyperparameters; nothing heavy runs untilfit(dataset=...). (#782)MGLDatasetLoader(defaults to HFmaterialyze/matpes):loader = MGLDatasetLoader()thenloader.matpes_dataset(version="r2SCAN-2025.2")andloader.matpes_element_refs(version="r2SCAN-2025.2", element_types=...). Overriderepo_id/revision/token/cache_dirin the constructor to point at a fork or a private mirror. Element references are reorderable to the caller’selement_types. Stresses in the on-disk MatPES JSON (kbar, VASP compressive-positive) are converted to matgl’s GPa compressive-negative convention automatically; passstress_unit="GPa"to skip the conversion. For datasets (MatPES forks, custom DFT runs) already on disk,loader.from_json("/path/to/file.json", ...)skips the HF round trip entirely. The JSON file must use the same per-record schema as the MatPES dataset —structure(pymatgen-serialisable) +energy/forces/stressPES keys; any extra metadata fields are ignored.stress_unitdefaults to"kbar"(MatPES on-disk convention) and is applied consistently with the HF path. The loader returns a rawMGLDataset; splitting +MGLDataLoaderwrapping is the trainer’s job (seeMGLPotentialTrainer’sfrac_list/shuffle/random_stateloader_kwargs).MGLPotentialTrainer:MGLPotentialTrainer(model, accelerator="auto", max_epochs=100, ...)accepts the full Lightning placement vocabulary ("auto"/"cpu"/"gpu"/"cuda"/"mps"/"tpu").trainer.fit(dataset, *, atomrefs=None, save_path=None)is a small focused entry point:datasetis a pre-builtMGLDataset(random split inside_build_dataloadersviafrac_list/shuffle/random_state) or a{"train", "valid", "test"}mapping of pre-built splits. UseMGLDatasetLoaderabove to build one.atomrefsacceptsnp.ndarray/AtomRefinstance /None. UseMGLDatasetLoader().matpes_element_refs(...)to download orfit_element_refs(...)to fit locally.- Loss-term toggling follows the constructor weights: set
stress_weight=0for datasets without stress labels (cluster / dimer extxyz), andmagmom_weight/charge_weight> 0only when the dataset carries those labels. - After fit,
trainer.potential/trainer.lit_module/trainer.trainer/trainer.loaders/trainer.dataset/trainer.atomrefsare populated. Defaults: Huber loss with stress weight 0.1, batch size 32, lr 1e-3, 100 epochs, CosineAnnealingLR (decay_steps=1000,decay_alpha=0.01).
MGLDataLoadercollate auto-detect (PyG). Whencollate_fnis omitted, the loader now picks one from the training dataset’s label keys (collate_fn_graphfor property prediction,collate_fn_peswith stress / magmom / charge flags toggled to match labels), mirroring the DGL path.Subset(post-split_dataset) is peeled to reach the underlyingMGLDataset.labels. Explicitcollate_fn=always wins. (#782)fit_element_refstraining helper. Convenience function that fits per-element energy offsets from pymatgenStructures + energies vianp.linalg.lstsq, returning an array that drops directly intoPotentialLightningModule(element_refs=...)orPotential(element_refs=...). (#780)- Performance speedups (no checkpoint or public-API changes).
- Cache spherical-Bessel basis constants (zeros, normalization factors) in
__init__instead of recomputing them in everyforward. (#787) - Lower-overhead
PotentialandAtomRefforward paths on PyG: hoist.to(device)/ shape work out of the hot path, avoid redundant tensor allocations. (#783) - Port the same
Potential/AtomRefspeedups to DGL. (#786) - Opt-in
torch.compileflag onPotential(PyG) for further inference speedups. (#784) - Low-risk speedups across
Structure2Graph/Molecule2Graphconverters, the training loop, and the ASEPESCalculator. (#781)
- Cache spherical-Bessel basis constants (zeros, normalization factors) in
- Bug fix (PyG):
Potential.forwardno longer mutates the input graph. Previously the autogradpos.requires_grad_(True)/cell.requires_grad_(True)toggles were applied in place on the caller’sDataobject, which leaked grad-tracking state across reuses. The forward now operates on a shallow clone of the relevant tensors. (#785) - Fleshed out module-level docstrings for
matgl.appsandmatgl.layers, and thePotentialwrapper docstring (energy / force / stress / charge contract, stress unit, magmom / charge head gating).
3.0.2
- New
matgl.utils.callbacks.PredictionLoggerLightning callback for capturing per-epoch energy and per-atom force predictions, ground truth, and errors duringPotentialLightningModuletraining. Pairs withadd_sample_indices(dataset)to keep(n_epochs, n_samples)log columns in a stable per-sample order across shuffled training epochs. The callback persists the cumulative log to disk every epoch end so it survives a walltime cut.PredictionLoggeralso logs stress and per-atom charge whenever the wrapped potential computes them (model.calc_stresses/model.calc_charge); passlog_stress=Falseorlog_charge=Falseto opt out. New keys in the saved payload:{train,val}_stress_{preds,labels,errors}shape(n_epochs, n_samples, 3, 3)and{train,val}_charge_{preds,labels,errors}shape(n_epochs, n_atoms). (#777)
3.0.1
- PyG charge-training parity for
QET.PotentialLightningModulenow acceptscharge_weightand adds a per-atom charge loss term (Charge_MAE/Charge_RMSE) on top of energy/force/stress;Potential.forward(PyG) takestotal_charge/ext_potand returns equilibrated charges in the output tuple, mirroring the DGL pipeline. MGLDataset(PyG) gainsinclude_ref_chargeto attach per-atomq_refonto eachDataobject (consumed byLinearQeq);collate_fn_pes(PyG) gainsinclude_chargeso per-atom charge labels propagate through batches.- Renamed PyG layer classes for cross-backend consistency:
AtomRefPyG->AtomRef,NuclearRepulsionPyG->NuclearRepulsion(matching the DGL counterparts). - CI: bumped GitHub Actions to Node 24 versions (
actions/checkout@v5,actions/setup-python@v6,actions/upload-artifact@v5,actions/download-artifact@v5,astral-sh/setup-uv@v7).
3.0.0
- PyG
M3GNetandQET. New PyG implementations ofM3GNetandQETjoin the existing PyGTensorNetandMEGNet, so all four core architectures now run on the default PyG backend without DGL. - Message-passing fix (TensorNet, M3GNet, QET). Corrected the message-passing convention in the interaction and embedding blocks of
TensorNet,M3GNet, andQET(both PyG and DGL): edge messages are now aggregated onto the source (center) node so each atom correctly collects information from its neighbors. Pre-trained weights generated under the old convention are no longer numerically valid. (#758, @kenko911) - New pre-trained weights on Hugging Face.
TensorNet-PES-MatPES-PBE-2025.2, theM3GNetandQETPyG potentials, and related models have been retrained against the corrected message-passing convention and re-released on thematerialyzeHF org, which is now the canonical source for all matgl pre-trained models. - Breaking — removed legacy GitHub
pretrained_models/download fallback. TheRemoteFileclass and thePRETRAINED_MODELS_BASE_URLconfig constant have been removed, andget_available_pretrained_modelsno longer accepts theinclude_hf/include_githubarguments (it now always queries thematerialyzeHF org). - Consolidated per-backend
tensornet/m3gnet/megnet/qettest files; backend dispatch is viamatgl.config.BACKENDwithpytest.skipguarding backend-specific cases.
2.2.1
- Updated HuggingFace Repo Id to lowercase “materialyze”.
2.2.0
- Fixed an incorrect message-passing convention in the PyG and DGL
TensorNetinteraction and embedding blocks. Edge messages are now aggregated onto the source (center) node so that each atom correctly collects information from its neighbors. Pre-trained PyGTensorNetweights have been re-released to match the corrected convention. (#758, @kenko911) - Refreshed the PyG
TensorNetREADME, added a missingTrajectoryObserver, improvedPESCalculatorstress-unit handling and logging, and tightened the related unit tests. (#758, @kenko911)
2.1.2
- Added Hugging Face Hub support for loading pre-trained models, with automatic fallback checking and respect for the
MATGL_CACHEenvironment variable. - Removed the deprecated
hubconf.py(superseded by Hugging Face support). - Added
TensorNetWrapperintegrating the NVIDIAnvalchemi-toolkitfor fully GPU-resident MD/Relax workflows, including an example script for NVT MD. (#754)
2.1.1
- Merged
TensorNet(PyG) andTensorNetWarpinto a singleTensorNetclass with optional warp acceleration (use_warpparameter; auto-detected whennvalchemi-toolkit-opsis installed). - Moved warp-accelerated
TensorEmbeddingandTensorNetInteractionlayers tomatgl.layers._embedding_warpandmatgl.layers._graph_convolution_warp. - Made
nvalchemiopsan optional dependency throughout:_pymatgen_pyg,_ase_pyg, and warp layer imports all fall back gracefully to pymatgen-based neighbor list construction when the package is absent.
2.1.0
- Bug fix for accidental change of default backend.
- Training module updated for QET support.
2.0.9
- Bug fix for missing Atoms2Graph export.
2.0.7
- Refactored PyG TensorNet embedding and interaction blocks to pure PyTorch for improved compatibility. (@kenko911)
- Improved handling of stress units in
PESCalculator. (@kenko911) - Enabled returning intermediate crystal features from CHGNet and TensorNet models. (@bowen-bd)
- Added GPU-accelerated neighbor list construction and improved CUDA neighbor list performance and retry logic. (@zubatyuk)
- Integrated NVIDIA TensorNet Warp CUDA kernels into the main branch. (@atulcthakur, @zubatyuk)
- Improved QET training support via updates to
Atoms2Graph,collate_fn_pes, andMGLDataset(includinginclude_ref_charge). (@kenko911) - Documentation updates for QET, including references and DOI links. (@kenko911)
2.0.6
- Bug fix for CHGnet loading.
2.0.5
- Improved error messages for backend/model mismatch. Try to transparently handle simple situations.
2.0.4
- Bug fix for matgl.graph.data and matgl.graph.converter imports for different backends.
2.0.3
- Bug fix for matgl.ext.pymatgen import for different backends.
2.0.2
- QET (Charge-Equilibrated TensorNet) architecture and pre-trained weights are added!
- Begun a migration to Pytorch-Geometric over the now-deprecated DGL. So far, only vanilla TensorNet has been implemented in PYG). DGL models still work but require a manual setup (change of backend and installation of DGL).
1.2.7
- Use original custom RemoteFile rather than fsspec, which is very finicky with SSL connections.
- _create_directed_line_graph error handling (@bowen-bd)
- Update Import Alias for lightning (@jcwang587)
- Add nvt_nose_hoover to MD ensemble (@bowen-bd)
- Allow training of magmom when no line graph presents (@bowen-bd)
- Allow disable BondGraph in CHGNet (@bowen-bd)
1.2.6
- Fix missing torchdata dependency for Linux.
1.2.5
- Dependency pinning now is platform specific. Linux based systems can now work with latest DGL and torch.
1.2.3
- Fix dependency issues with DGL. Pinning to DGL<=2.1.0 for now, which have versions for all OSes.
1.2.1
- Bug fix for pbc dtype on Windows systems.
1.2.0
- Release of MatPES-based models.
- Pin DGL and PyTorch dependencies to 2.2.0 to ensure compatibility with Mac.
1.1.3
- Improve the memory efficiency and speed of three-body interactions. (@kenko911)
- FrechetCellFilter is added for variable cell relaxation in Relaxer class. (@kenko911)
- Smooth l1 loss function is added for training. (@kenko911)
1.1.2
- Move AtomRef Fitting to numpy to avoid bug (@BowenD-UCB)
- NVE ensemble added (@kenko911)
- Migrate from pytorch_lightning to lightning.
1.1.1
- Pin dependencies to support latest DGL 2.x. @kenko911
1.1.0
- Implementation of CHGnet + pre-trained models. (@BowenD-UCB)
1.0.0
- First 1.0.0 release to reflect the maturity of the matgl code! All changes below are the efforts of @kenko911.
- Equivariant TensorNet and SO3Net are now implemented in MatGL.
- Refactoring of M3GNetCalculator and M3GNetDataset into generic PESCalculator and MGLDataset for use with all models instead of just M3GNet.
- Training framework has been unified for all models.
- ZBL repulsive potentials has been implemented.
0.9.2
- Added Tensor Placement Calls For Ease of Training with PyTorch Lightning (@melo-gonzo).
- Allow extraction of intermediate outputs in “embedding”, “gc_1”, “gc_2”, “gc_3”, and “readout” layers for use as atom, bond, and structure features. (@JiQi535)
0.9.1
- Update Potential version numbers.
0.9.0
- set pbc_offsift and pos as float64 by @lbluque in https://github.com/materialsvirtuallab/matgl/pull/153
- Bump pytorch-lightning from 2.0.7 to 2.0.8 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/155
- add cpu() to avoid crash when using ase with GPU by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/156
- Added the united test for hessian in test_ase.py to improve the coverage score by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/157
- AtomRef Updates by @lbluque in https://github.com/materialsvirtuallab/matgl/pull/158
- Bump pymatgen from 2023.8.10 to 2023.9.2 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/160
- Remove torch.unique for finding the maximum three body index and little cleanup in united tests by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/161
- Bump pymatgen from 2023.9.2 to 2023.9.10 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/162
- Add united test for trainer.test and description in the example by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/165
- Bump pytorch-lightning from 2.0.8 to 2.0.9 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/167
- Sequence instead of list for inputs by @lbluque in https://github.com/materialsvirtuallab/matgl/pull/169
- Avoiding crashes for PES training without stresses and update pretrained models by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/168
- Bump pymatgen from 2023.9.10 to 2023.9.25 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/173
- Allow to choose distribution in xavier_init by @lbluque in https://github.com/materialsvirtuallab/matgl/pull/174
- An example for the simple training of M3GNet formation energy model is added by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/176
- Directed line graph by @lbluque in https://github.com/materialsvirtuallab/matgl/pull/178
- Bump pymatgen from 2023.9.25 to 2023.10.4 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/180
- Bump torch from 2.0.1 to 2.1.0 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/181
- Bump pymatgen from 2023.10.4 to 2023.10.11 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/183
- add testing to m3gnet potential training example by @lbluque in https://github.com/materialsvirtuallab/matgl/pull/179
- Update Training a MEGNet Formation Energy Model with PyTorch Lightning by @1152041831 in https://github.com/materialsvirtuallab/matgl/pull/185
- Bump pymatgen from 2023.10.11 to 2023.11.12 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/187
- dEdLat contribution for stress calculations is added and Universal Potentials are updated by @kenko911 in https://github.com/materialsvirtuallab/matgl/pull/189
- Bump torch from 2.1.0 to 2.1.1 by @dependabot in https://github.com/materialsvirtuallab/matgl/pull/190
New Contributors
- @1152041831 made their first contribution in https://github.com/materialsvirtuallab/matgl/pull/185
Full Changelog: https://github.com/materialsvirtuallab/matgl/compare/v0.8.5…v0.8.6
0.8.3
- Extend the functionality of ASE-interface for molecular systems and include more different ensembles. (@kenko911)
- Improve the dgl graph construction and fix the if statements for stress and atomwise training. (@kenko911)
- Refactored MEGNetDataset and M3GNetDataset classes with optimizations.
0.8.5
- Bug fix for np.meshgrid. (@kenko911)
0.8.2
- Add site-wise predictions for Potential. (@lbluque)
- Enable CLI tool to be used for multi-fidelity models. (@kenko911)
- Minor fix for model version for DIRECT model.
0.8.1
- Fixed bug with loading of models trained with GPUs.
- Updated default model for relaxations to be the
M3GNet-MP-2021.2.8-DIRECT-PES model.
0.8.0
- Fix a bug with use of set2set in M3Gnet implementation that affected intensive models such as the formation energy model. M3GNet model version is updated to 2 to invalidate previous models. Note that PES models are unaffected. (@kenko911)
0.7.1
- Minor optimizations for memory and isolated atom training (@kenko911)
0.7.0
- MatGL now supports structures with isolated atoms. (@JiQi535)
- Fourier expansion layer and generalize cutoff polynomial. (@lbluque)
- Radial bessel (zeroth order bessel). (@lbluque)
0.6.2
- Simple CLI tool
mgladded.
0.6.1
- Bug fix for training loss_fn.
0.6.0
- Refactoring of training utilities. Added example for training an M3GNet potential.
0.5.6
- Minor internal refactoring of basis expansions into
_basis.py. (@lbluque)
0.5.5
- Critical bug fix for code regression affecting pre-loaded models.
0.5.4
- M3GNet Formation energy model added, with example notebook.
- M3GNet.predict_structure method added.
- Massively improved documentation at http://matgl.ai.
0.5.3
- Minor doc and code usability improvements.
0.5.2
- Minor improvements to model versioning scheme.
- Added
matgl.get_available_pretrained_models()to help with model discovery. - Misc doc and error message improvements.
0.5.1
- Model versioning scheme implemented.
- Added convenience method to clear cache.
0.5.0
- Model serialization has been completely rewritten to make it easier to use models out of the box.
- Convenience method
matgl.load_modelis now the default way to load models. - Added a TransformedTargetModel.
- Enable serialization of Potential.
- IMPORTANT: Pre-trained models have been reserialized. These models can only be used with v0.5.0+!
0.4.0
- Pre-trained M3GNet universal potential
- Pytorch lightning training utility.
v0.3.0
- Major refactoring of MEGNet and M3GNet models and organization of internal implementations. Only key API are exposed via matgl.models or matgl.layers to hide internal implementations (which may change).
- Pre-trained models ported over to new implementation.
- Model download now implemented.
v0.2.1
- Fixes for pre-trained model download.
- Speed up M3GNet 3-body computations.
v0.2.0
- Pre-trained MEGNet models for formation energies and band gaps are now available.
- MEGNet model implemented with
predict_structureconvenience method. - Example notebook demonstrating pre-trained model usage is available.
v0.1.0
- Initial working version with m3gnet and megnet.