ml-matgl-finetune

Fine-tune MatGL interatomic potentials on labeled atomistic datasets with PyTorch Lightning.

144|21|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/learningmatter-mit/AtomisticSkills --skill ml-matgl-finetune
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ml-matgl-finetune
Source: https://github.com/learningmatter-mit/AtomisticSkills/tree/main/.agents/skills/ml-matgl-finetune
Command: npx skills add https://github.com/learningmatter-mit/AtomisticSkills --skill ml-matgl-finetune

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires matgl, pymatgen, ase, numpy, torch, lightning, dgl, pytorch-lightning, scipy, and includes scripts (resource) components.

What problem does it solve?

ML interatomic potentials often underperform for a specific material system or property, requiring users to fine-tune a foundation MatGL model for their labeled dataset.

Core Features & Use Cases

  • Prepare MatGL-ready training data: Convert JSON structure dictionaries (with energy/forces/stress) into the MatGL MGLDataset input format, including optional VASP stress unit conversion.
  • Run GPU fine-tuning end-to-end: Train a MatGL foundation model using PyTorch Lightning with configurable learning rate, epochs, and multi-term loss weights (energy, forces, stress).
  • Validate and register the trained checkpoint: Track training/validation metrics and save a fine-tuned checkpoint for reuse in subsequent workflows.

Use case example: You have a curated dataset of DFT-labeled structures (energies, forces, and stresses) for a catalyst family and want higher-accuracy predictions from a CHGNet/MatGL-like foundation potential by adapting it to your chemistry and thermodynamic regime.

Quick Start

Run fine-tuning for your labeled dataset by executing the provided prepare_matgl_data.py and train_matgl.py scripts inside the matgl-agent environment, starting with your input JSON file path and the base foundation model name.

Frequently Asked Questions about ml-matgl-finetune

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fine-tune machine learning interatomic potentials for a specific material system?

Fine-tune machine learning interatomic potentials by adapting a MatGL foundation model to your labeled dataset, improving energy, force, and stress prediction accuracy. The process uses PyTorch Lightning on GPU to train a model checkpoint tailored to your target chemistry.

When do I need to fine-tune a MatGL foundation model?

Fine-tune a MatGL foundation model when off-the-shelf interatomic potentials underperform for your specific catalyst family or thermodynamic regime. Adapting the model with DFT-labeled structures increases prediction accuracy for your target chemical system's energy, forces, and stress.

What data format is required to train atomistic machine learning potentials with MatGL?

Training atomistic machine learning potentials with MatGL requires a dataset JSON file containing structure fields alongside energy, forces, and stress labels. The workflow converts this JSON into the MatGL MGLDataset input format, including optional VASP stress unit conversion to eV/ų.

Can I configure the loss weights for energy, forces, and stress during MatGL training?

You can configure multi-term loss weights for energy, forces, and stress during MatGL training. The PyTorch Lightning training script allows you to set learning rate, epochs, and loss weights to prioritize specific properties for your target chemical system.

Does MatGL fine-tuning support VASP stress unit conversion for atomistic datasets?

MatGL fine-tuning supports optional VASP stress unit conversion, transforming raw stress labels into eV/ų during data preparation. This ensures accurate stress calculations when training the interatomic potential on DFT-labeled atomistic datasets.

What are the limitations of using MatGL for atomistic machine learning fine-tuning?

MatGL fine-tuning requires pre-labeled DFT datasets with energy, forces, and stress fields, meaning it cannot generate training data itself. Users must also have a GPU environment configured with PyTorch Lightning and DGL dependencies to execute the training scripts.