ml-mace-finetune
Fine-tune MACE 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-mace-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-mace-finetune
What's inside
- Skill name
ml-mace-finetune- Description
- Fine-tune MACE machine learning interatomic potentials on custom datasets.
- License
- MIT
- Instructions
- 155 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (10)
- SKILL.md
- README.md · examples/mace-wbm-finetune/
- finetune_config.yaml · examples/mace-wbm-finetune/
- label_distributions.png · examples/mace-wbm-finetune/
- training_history.json · examples/mace-wbm-finetune/
- training_history.png · examples/mace-wbm-finetune/
- valid.xyz · examples/mace-wbm-finetune/
- extract_mace_logs.py · scripts/
- generate_mace_config.py · scripts/
- prepare_mace_data.py · scripts/
SKILL.md (first lines)
# MACE Fine-tuning
## Goal
To evaluate and improve the accuracy of a foundation MACE potential for a specific chemical system or physical property using the provided Python fine-tuning script and data-augmentation.
## 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. **Benchmarking**: Predict results on the new labels and benchmark the foundation model using [ml-mlip-benchmark](../ml-mlip-benchmark/SKILL.md).
16. **Data Preparation**: Execute `scripts/prepare_mace_data.py` to convert JSON structures to `.xyz` data files.
17. **Config Generation**: Execute `scripts/generate_mace_config.py` using the `.xyz` data to produce `finetune_config.yaml`.
18. **Fine-Tuning**: Execute `mace_run_train --config /path/to/finetune_config.yaml` to begin fine-tuning natively on the GPU.
19. **Validation**: Verify convergence and compare against the benchmarked foundation metrics.
20. **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.
## Training Configuration
MACE fine-tuning is divided into a data preparation step, a configuration generation step, and a standard native training run. The script `scripts/prepare_mace_data.py` generates `.xyz` files, and `scripts/generate_mace_config.py` converts arguments into a fully-formed `finetune_config.yaml` configuration compatible with the MACE default parser.
### Basic Arguments (Data Prep Script)
| Key | Type | Default | Description |
|:----|:-----|:--------|:------------|
| `--data` | str | (Required) | Path to JSON file containing ASE/pymatgen structure dictionaries |
| `--output-dir` | str | `./fine_tuning_data` | Directory to save the converted .xyz data |
| `--val-split` | float | 0.1 | Fraction of data to set aside for validation |
| `--seed` | int | 42 | Random seed for validation splitting |
| `--vasp-stress-conversion`| flag | - | If set, multiplies stress values by -1/160.2x to convert VASP raw kB to eV/ų |
### Basic Arguments (Configuration Generation Script)
| Key | Type | Default | Description |
|:----|:-----|:--------|:------------|
| `--train-file` | str | (Required) | Path to the converted `train.xyz` data |
| `--valid-file` | str | None | Path to the `valid.xyz` data |
| `--model` | str | `MACE-MP-small` | Base model name or path to a checkpoint |
| `--epochs` | int | 100 | Number of training epochs |
| `--lr` | float | 0.01 | Peak learning rate for training |
| `--batch-size` | int | 2 | Training batch size |
| `--output-dir` | str | `./fine_tuning` | Directory to save the fine-tuned model and logs |
| `--device` | str | `cuda` | Target compute device (`cuda` or `cpu`) |
> [!NOTE]
> If you have created a dedicated research directory for your current workflow (e.g. using the `create_research_dir` tool), you should set the `--output-dir` argument to a folder within that active research directory to keep all artifacts and models organized.
### Model Freezing and Heads (Configuration Generation Script)
| Key | Type | Default | Choices | Description |
|:----|:-----|:--------|:--------|:------------|
| `--freeze-backbone` | flag | N/A | Add flag | Freeze backbone (interaction blocks); only readout heads are trained. |
| `--reinit-head` | flag | N/A | Add flag | Re-initialize readout weights. When absent (default), pre-trained readout is preserved. |
| `--multiheads` | flag | N/A | Add flag | Enable multi-head fine-tuning (adds new head while keeping existing ones). |
### Advanced Parameters (Manual YAML Injection)
> [!IMPORTANT]
> The following parameters govern Optimizer, Regularization, and Scheduling. They are **NOT** exposed via the `prepare_mace_data.py` CLI. Note that `prepare_mace_data.py` exposes `--energy-weight`, `--forces-weight` (default 10.0), and `--stress-weight` which inject cleanly into the initial YAML. For all other properties below, you must manually append the keys to the generated `finetune_config.yaml` file prior to running `mace_run_train`.
#### Optimizer & Regularization
| Key | Type | Default | Choices / Range | Description |
|:----|:-----|:--------|:----------------|:------------|
| `optimizer` | str | `"adam"` | `"adam"`, `"adamw"`, `"schedulefree"` | Optimizer type. |
| `weight_decay` | float | 5e-7 | ≥0 | L2 weight decay. |
| `amsgrad` | bool | True | `True`, `False` | Use AMSGrad variant of Adam. |
| `clip_grad` | float | 10.0 | >0 or None | Maximum gradient norm for clipping. Set to None to disable. |
| `ema` | bool | True | `True`, `False` | Enable exponential moving average of model weights. |
| `ema_decay` | float | 0.99 | 0–1 | EMA decay rate. Higher = more smoothing. |
### LR Scheduler
| Key | Type | Default | Choices / Range | Description |
|:----|:-----|:--------|:----------------|:------------|
| `scheduler` | str | `"ReduceLROnPlateau"` | `"ReduceLROnPlateau"`, `"ExponentialLR"` | LR scheduler type. |
| `lr_factor` | float | 0.8 | 0–1 | Factor by which LR is reduced on plateau (for ReduceLROnPlateau). |
| `scheduler_patience` | int | 50 | ≥1 | Epochs without improvement before reducing LR (for ReduceLROnPlateau). |
| `lr_scheduler_gamma` | float | 0.9993 | 0–1 | Per-epoch multiplicative decay factor (for ExponentialLR). |
**ReduceLROnPlateau** (default): Monitors validation loss. When loss stops improving for `scheduler_patience` epochs, LR is multiplied by `lr_factor`.
**ExponentialLR**: LR decays every epoch by `lr_scheduler_gamma`. At epoch *n*: `LR = learning_rate × lr_scheduler_gamma^n`.
### Early Stopping
| Key | Type | Default | Choices / Range | Description |
|:----|:-----|:--------|:----------------|:------------|
| `patience` | int | 2048 | ≥1 | Stop training after this many epochs without improvement. |
> [!NOTE]
> Default `patience=2048` effectively disables early stopping. Set lower (e.g., 100–200) if you want to stop early.
### Loss Function
| Key | Type | Default | Choices | Description |
|:----|:-----|:--------|:--------|:------------|
| `loss` | str | `"weighted"` | `"weighted"`, `"universal"`, etc. | Loss function type. `"universal"` is auto-set by data script when stress data is detected. |
| `energy_weight` | float | 1.0 | ≥0 | Weight for energy loss (exposed via CLI). |
| `forces_weight` | float | 10.0 | ≥0 | Weight for forces loss (exposed via CLI). |
| `stress_weight` | float | 1.0 | ≥0 | Weight for stress loss (exposed via CLI). |
| `compute_forces` | bool | True | `True`, `False` | Include forces in training. |
| `compute_stress` | bool | False | `True`, `False` | Include stress in training (auto-enabled by data script). |
> [!WARNING]
> **Stress Units**: MACE expects stress in `eV/ų`. Raw VASP stress obtained directly via some JSON files may be in kilo-Bar (`kB`), which is ~160x larger and will cause catastrophic training divergence. 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_mace_data.py` to automatically scale them by `-1/160.2x`. For more details on unit standardization, see @[skills/general-property-units/SKILL.md].
> [!WARNING]
> **Learning rate sensitivity for MACE-OMAT**: The official MACE docs recommend `lr=0.01` for MACE-MP-0, but MACE-OMAT-0-small requires `lr=1e-4` to avoid divergence. Higher values (1e-3, 0.01) cause catastrophic forgetting even with frozen backbone + EMA.
> [!IMPORTANT]
> The generated `finetune_config.yaml` maps exactly to `mace_run_train` arguments. You can open and manually modify the YAML file before running `mace_run_train` to inject any advanced parameter.
- [MACE Si-O fine-tuning with frozen backbone](examples/mace-sio-frozen/) — MACE-OMAT-0-small, 10 epochs
Usage:
```bash
# 1. Prepare Data
${CLAUDE_SKILL_DIR}/../../venv/run mlip python ${CLAUDE_SKILL_DIR}/scripts/prepare_mace_data.py \
--data /path/to/training_data.json \
--output-dir ./mace_finetuned_dataFrom 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 5, 2026 (23 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-mace-finetune skill. Agent Mart. https://agentmart.dev/skills/learningmatter-mit-ml-mace-finetune (last updated 2026-10-24)