ml-matgl-finetune
Fine-tune MatGL machine learning interatomic potentials on custom datasets.
Skill by learningmatter-mit
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/learningmatter-mit-ml-matgl-finetune
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/ml-matgl-finetune
What's inside
- Skill name
ml-matgl-finetune- Description
- Fine-tune MatGL machine learning interatomic potentials on custom datasets.
- License
- MIT
- Instructions
- 86 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (10)
- SKILL.md
- README.md · examples/matgl-wbm-finetune/
- checkpoint_roundtrip.json · examples/matgl-wbm-finetune/
- finetune_record.json · examples/matgl-wbm-finetune/
- training_history.json · examples/matgl-wbm-finetune/
- training_history.png · examples/matgl-wbm-finetune/
- verify_checkpoint.py · examples/matgl-wbm-finetune/
- generate_matgl_config.py · scripts/
- prepare_matgl_data.py · scripts/
- train_matgl.py · scripts/
SKILL.md (first lines)
# MatGL Fine-tuning
## Goal
To evaluate and improve the accuracy of a foundation MatGL potential (e.g., CHGNet, TensorNet) for a specific chemical system or physical property using the provided Python fine-tuning script.
## Instructions
1. **Prepare Labeled Dataset**: Obtain diverse structures with high-fidelity labels (energy, forces, stress). See the `/benchmark-finetuning` workflow for details.
2. **Custom Data Conversion**: Read the source data format and write a customized conversion script if needed, formatting it for the subsequent preparation step.
3. **Data Preparation**: Execute `scripts/prepare_matgl_data.py` to process JSON structures and split into training and validation sets.
4. **Fine-Tuning**: Execute `scripts/train_matgl.py` to begin fine-tuning natively on the GPU using PyTorch Lightning.
5. **Validation**: Verify convergence and compare against the benchmarked foundation metrics.
6. **Registration**: Use the `register_model` tool to register the newly fine-tuned model checkpoint into the local registry so future research tasks can discover and reuse it.
## Usage
### 1. Data Preparation
Convert your dataset into the appropriate JSON format for MatGL training:
```bash
${CLAUDE_SKILL_DIR}/../../venv/run mlip python ${CLAUDE_SKILL_DIR}/scripts/prepare_matgl_data.py \
--data /path/to/training_data.json \
--model CHGNet-PES-MatPES-PBE-1M-2026.9 \
--val-split 0.1 \
--output-dir ./matgl_finetuned
```
### 2. Run Training
Fine-tune the model using the prepared data:
```bash
${CLAUDE_SKILL_DIR}/../../venv/run mlip python ${CLAUDE_SKILL_DIR}/scripts/train_matgl.py \
--train-data ./matgl_finetuned/train_data.json \
--val-data ./matgl_finetuned/val_data.json \
--model CHGNet-PES-MatPES-PBE-1M-2026.9 \
--epochs 10 \
--lr 1e-3 \
--batch-size 4 \
--freeze-backbone \
--output-dir ./matgl_finetuned
```
## Training Configuration
MatGL fine-tuning is divided into a data preparation step (formatting nested dictionaries and converting lists) and a native training run utilizing PyTorch Lightning.
### Data Preparation Arguments (`prepare_matgl_data.py`)
| Key | Type | Default | Description |
|:----|:-----|:--------|:------------|
| `--data` | str | (Required) | Path to JSON file containing ASE/pymatgen structure dictionaries |
| `--model` | str | `CHGNet-PES-MatPES-PBE-1M-2026.9` | Base model name or path to a checkpoint |
| `--output-dir` | str | `./fine_tuning` | Directory to save the processed data |
| `--val-split` | float | 0.1 | Fraction of data to set aside for validation |
| `--seed` | int | 42 | Random seed for splitting validation data |
| `--vasp-stress-conversion`| flag | - | If set, multiplies stress values by -1/160.2x to convert VASP raw kB to eV/ų |
### Training Arguments (`train_matgl.py`)
| Key | Type | Default | Description |
|:----|:-----|:--------|:------------|
| `--train-data` | str | (Required) | Path to JSON file containing training data |
| `--val-data` | str | None | Path to JSON file containing validation data (optional) |
| `--model` | str | `CHGNet-PES-MatPES-PBE-1M-2026.9` | Base model name or path to a checkpoint |
| `--epochs` | int | 10 | Number of training epochs |
| `--lr` | float | 1e-3 | Learning rate |
| `--batch-size` | int | 4 | Training batch size |
| `--device` | str | `auto` | Target compute device (`cuda` or `cpu`) |
| `--output-dir` | str | `./fine_tuning` | Directory to save the fine-tuned model and logs |
| `--freeze-backbone` | flag | - | Freeze backbone (interaction blocks); only readout heads are trained |
| `--reinit-head` | flag | - | Re-initialize readout head weights |
| `--scheduler` | str | `CosineAnnealingLR` | `CosineAnnealingLR` or `ReduceLROnPlateau` |
| `--patience` | int | None | Early stopping patience (epochs) |
| `--energy-weight` | float | 1.0 | Loss weight for energy |
| `--force-weight` | float | 1.0 | Loss weight for forces |
| `--stress-weight` | float | 0.1 | Loss weight for stress |
## Constraints
- **Data Size**: For small datasets, `--freeze-backbone` is strongly recommended to prevent catastrophic forgetting.
- **Reference Energies (`element_refs`)**: If your fine-tuning data is computed using the same DFT functional (e.g., PBE) as the foundation model's original training data, you should reuse the foundation model's original isolated atom reference energies instead of re-fitting them. This maintains thermodynamic compatibility across the periodic table.
- **Environment**: Runs in the `mlip` environment (`venv/run mlip ...`). MatGL >= 4 uses PyTorch Geometric only; there is no DGL backend.
- **Stress Units**: MatGL inherently converts stress internally to GPa, however the standard expected inputs directly into its JSON files are `eV/ų`. Raw VASP stress obtained directly via some JSON files may be in kilo-Bar (`kB`). The Atomate2 MCP tool handles this conversion automatically when `convert_units=True`. However, if your JSON labels contain raw `kB` stress, you MUST pass the `--vasp-stress-conversion` flag to `scripts/prepare_matgl_data.py` to automatically scale them by `-1/160.2x`. For more details on unit standardization, see @[skills/general-property-units/SKILL.md].
---
**Author:** Bowen Deng
**Contact:** [GitHub @learningmatter-mit](https://github.com/learningmatter-mit)From learningmatter-mit/AtomisticSkills, MIT.
More from learningmatter-mit/AtomisticSkills
- 0.681score
drug-complex-system-builder
learningmatter-mit
Build a solvated, charge-neutralized protein-ligand complex for OpenMM molecular dynamics simulation.
SkillAFreshness: A★ 183Claude Code +9 - 0.681score
drug-binding-site-definition
learningmatter-mit
Define a docking search box (center coordinates + box dimensions in Angstroms) from a co-crystal ligand, binding-site residues, or a saved JSON specification.
SkillAFreshness: A★ 183Claude Code +9 - 0.681score
drug-mmpbsa-gbsa
learningmatter-mit
Compute single-trajectory MM-GBSA and / or MM-PBSA binding free energy estimates from a protein-ligand MD trajectory.
SkillAFreshness: A★ 183Claude Code +9 - 0.681score
drug-pocket-detection
learningmatter-mit
Identify and rank ligandable pockets on a protein structure or model using geometry (fpocket) or an ML predictor (P2Rank).
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
chem-sorption-relax
learningmatter-mit
Prepares supercells for porous frameworks based on minimum interplanar distance and relaxes them using standard MLIP relaxation tools.
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
drug-protein-ligand-md
learningmatter-mit
Run a protein-ligand MD simulation in OpenMM with energy minimization, restrained equilibration, and production NPT, producing trajectory and checkpoint files…
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
chem-db-qmof
learningmatter-mit
Query the Quantum MOF (QMOF) database via Materials Project's MPContribs platform for DFT-computed properties (bandgap) and optimized crystal structures of…
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
chem-bond-dissociation
learningmatter-mit
Calculate homolytic and heterolytic bond dissociation energies (BDEs) for all single bonds in a molecule using MLIPs with RDKit fragmentation.
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
chem-hazard-toxicity
learningmatter-mit
Extract explicit safety warnings, GHS classifications, LD50 toxicity profiles, and acute oral toxicity triage from PubChem PUG VIEW.
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
drug-redocking-rmsd
learningmatter-mit
Compute symmetry-corrected heavy-atom RMSD between docked poses and a reference crystal ligand to validate docking protocols.
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
drug-pose-validation
learningmatter-mit
Validate docked or generated ligand poses for physical plausibility using PoseBusters, filtering out chemically invalid or clashing poses before downstream…
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
chem-dft-orca-optimization
learningmatter-mit
Run DFT geometry optimization (minimization or TS search) on a molecular structure using ORCA via SCINE/ReaDuct wrapper.
SkillAFreshness: A★ 183Claude Code +9
Signals
- Stars
- 183
- Forks
- 31
- Open issues
- 0
- Last commit (this folder)
- Oct 11, 2026 (17 days ago)
- Last release
- Oct 6, 2026 (22 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Website
- arxiv.org/abs/2605.24002
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from learningmatter-mit
- 0.681score
drug-binding-site-definition
learningmatter-mit
Define a docking search box (center coordinates + box dimensions in Angstroms) from a co-crystal ligand, binding-site residues, or a saved JSON specification.
SkillAFreshness: A★ 183Claude Code +9 - 0.681score
drug-complex-system-builder
learningmatter-mit
Build a solvated, charge-neutralized protein-ligand complex for OpenMM molecular dynamics simulation.
SkillAFreshness: A★ 183Claude Code +9 - 0.681score
drug-mmpbsa-gbsa
learningmatter-mit
Compute single-trajectory MM-GBSA and / or MM-PBSA binding free energy estimates from a protein-ligand MD trajectory.
SkillAFreshness: A★ 183Claude Code +9 - 0.681score
drug-pocket-detection
learningmatter-mit
Identify and rank ligandable pockets on a protein structure or model using geometry (fpocket) or an ML predictor (P2Rank).
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
drug-pose-validation
learningmatter-mit
Validate docked or generated ligand poses for physical plausibility using PoseBusters, filtering out chemically invalid or clashing poses before downstream…
SkillAFreshness: A★ 183Claude Code +9 - 0.678score
chem-sorption-relax
learningmatter-mit
Prepares supercells for porous frameworks based on minimum interplanar distance and relaxes them using standard MLIP relaxation tools.
SkillAFreshness: A★ 183Claude Code +9
Cite this page
ml-matgl-finetune skill. Agent Mart. https://agentmart.dev/skills/learningmatter-mit-ml-matgl-finetune (last updated 2026-10-24)