Registry / ai-ml / mace-torch

mace-torch

JSON →
library0.3.16pypypi✓ verified 84d ago

MACE (Multi-Atomic Cluster Expansion) is a machine learning force field architecture based on equivariant message passing, implemented in PyTorch. Version 0.3.16 requires Python >=3.9 and is actively maintained on GitHub (ACEsuit/mace). Release cadence is irregular, approximately every 3-6 months.

pip install mace-torch
INSTALL
IMPORT
SIG · MACE-TORCH
M
mace-torch
ai-mlpythonv0.3.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MACECalculator
from mace.calculators import MACECalculator
from mace import MACECalculator
MACECalculator is in the calculators submodule, not top-level
mace_mp
from mace.calculators import mace_mp
from mace import mace_mp
mace_mp is a function in calculators; direct import fails
load_model
from mace.calculators import load_model

Initialize the MACE-MP-0 model and compute energy for a water molecule.

import torch from ase import Atoms from mace.calculators import MACECalculator # Download default MACE-MP-0 model calc = MACECalculator(model_path='large', device='cuda' if torch.cuda.is_available() else 'cpu') # Create a water molecule atoms = Atoms('H2O', positions=[[0, 0, 0], [0, 0, 0.957], [0.957, 0, 0]], cell=[10, 10, 10]) atoms.calc = calc energy = atoms.get_potential_energy() print(f"Energy: {energy:.6f} eV")
Debug
Known issues
breakingIn version 0.3.0+, the model path API changed: 'large' and 'small' strings now download the model automatically instead of using 'MACE_MP_0' keyword.
fix
Use model_path='large' or 'medium' or 'small' to download the default models. For custom models, provide the path to .model file.
affects: <0.3.0
gotchaMACECalculator expects ASE Atoms objects; directly passing numpy arrays or torch tensors will raise errors.
fix
Always wrap atomic data in an ase.Atoms object before passing to calculator.
affects: all
gotchaThe model requires considerable GPU memory for large systems (thousands of atoms). Out-of-memory errors are common if batch size is too large.
fix
Reduce system size or use CPU offloading. For very large systems, consider splitting into chunks.
affects: all
Errors
Common errors & fixes
AttributeError: module 'mace' has no attribute 'calculators'
The mace-torch package is not installed; only the mace package (old version) is installed.
fix
pip install mace-torch --upgrade
KeyError: 'MACE_MP_0'
The model name string is not a valid key; in newer versions models are downloaded via 'large'/'small' instead.
fix
Use calc = MACECalculator(model_path='large') instead of model_path='MACE_MP_0'
RuntimeError: Expected tensor to be on GPU, but found tensor on CPU
Mixing devices: model was loaded on GPU but input atoms are on CPU or vice versa.
fix
Ensure device consistency: pass device='cuda' or device='cpu' explicitly to MACECalculator.
ImportError: cannot import name 'MACECalculator' from 'mace'
Using the old top-level import path that changed in v0.3.0.
fix
Use 'from mace.calculators import MACECalculator'.
Upgrade
Version history
0.3.16latest on PyPI · released May 10, 2026
Audit
Dependencies
torchrequiredCore computation and tensor operations
e3nnrequiredEquivariant neural network operations
pytorch-lightningoptionalTraining framework (optional if using custom training loop)
Agent activity
44 hits · last 30 days
node
42
OpenAI (training)
1
Resources