GPU-accelerated MACE interatomic potential inference on Apple Silicon via MLX
Project description
MACE-MLX
Drop-in MLX replacement for MACE on Apple Silicon. 2-4x faster than PyTorch CPU.
Install
pip install mace-mlx
For development:
git clone https://github.com/Mastreina/mace-mlx
cd mace-mlx
pip install -e ".[dev]"
Quick Start
Change one import line -- everything else stays the same:
# Before (PyTorch MACE)
from mace.calculators import mace_mp
# After (MACE-MLX)
from mace_mlx.calculators import mace_mp
Complete example:
from ase.build import bulk
from mace_mlx.calculators import mace_mp
calc = mace_mp(model="medium-mpa-0")
si = bulk('Si', 'diamond', a=5.43) * (2, 2, 2)
si.calc = calc
energy = si.get_potential_energy() # eV
forces = si.get_forces() # eV/Ang
stress = si.get_stress() # eV/Ang^3 (Voigt)
print(f"Energy: {energy:.4f} eV")
print(f"Max force: {forces.max():.4f} eV/Ang")
Supported Models
| Model Family | Variants | Status |
|---|---|---|
| MACE-MP-0 | small, medium, large | Supported |
| MACE-MP-0b | small, medium | Supported |
| MACE-MP-0b2 | small, medium, large | Supported |
| MACE-MP-0b3 | medium | Supported |
| MACE-MPA-0 | medium (new default) | Supported |
| MACE-OMAT-0 | small, medium | Supported |
| MACE-MatPES | PBE, R2SCAN | Supported |
| MACE-MH-1 | 6 heads (multi-head) | Supported |
Performance
MACE-MP-0 Small on Apple Silicon (energy + forces):
| System | Atoms | MLX (ms) | CPU (ms) | MPS (ms) |
|---|---|---|---|---|
| Water | 3 | 3.5 | 8.0 | 16.7 |
| Si 2x2x2 | 16 | 4.1 | 16.3 | 17.5 |
| Cu 3x3x3 | 27 | 7.6 | 25.7 | 21.3 |
| Si 3x3x3 | 54 | 10.9 | 31.7 | 25.5 |
| Al 3x3x3 | 27 | 6.0 | 21.5 | 19.8 |
API
mace_mp(model="small", device="gpu", default_dtype="float32", head=None)
Factory function matching mace.calculators.mace_mp. Auto-downloads models on first use.
mace_off(model="small", device="gpu", default_dtype="float32")
Factory function for MACE-OFF organic chemistry models.
MACECalculator (alias: MACEMLXCalculator)
ASE Calculator class. Accepts the same parameters plus model_path and skin (neighbor list cache distance, default 0.5 Ang).
Citation
@article{batatia2022mace,
title={MACE: Higher order equivariant message passing neural networks for fast and accurate force fields},
author={Batatia, Ilyes and Kov{\'a}cs, D{\'a}vid P{\'e}ter and Simm, Gregor NC and Ortner, Christoph and Cs{\'a}nyi, G{\'a}bor},
journal={Advances in Neural Information Processing Systems},
year={2022}
}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mace_mlx-0.2.0.tar.gz.
File metadata
- Download URL: mace_mlx-0.2.0.tar.gz
- Upload date:
- Size: 107.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c597412aeb44e531a1378e4824f63c949576e5059bbc4bcde36cf01364a4c0fa
|
|
| MD5 |
a1d8de742e1dd907bef0e4b7e9d02f76
|
|
| BLAKE2b-256 |
121f0cd6f29105d5ab3e37668879e0fe7d5f336690e28a13228c0aa5e842c5da
|
File details
Details for the file mace_mlx-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mace_mlx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 66.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfb56b0df92a897afef776f4613948a74fa7836fe4e65c82433b431f2c83d38e
|
|
| MD5 |
c0a0ed3e349f15a36f963b91354befb4
|
|
| BLAKE2b-256 |
c01c95748b194a3e7bf67f9d5f53a2c1c8791767626bf7488e1f4061183db70b
|