MACE
Model Introduction
MACE is a machine-learning interatomic potential (MLIP) for molecular and materials systems. Built on an E(3)-equivariant graph neural network, it predicts the energies and forces of atomic structures.
Paper: MACE: Higher order equivariant message passing neural networks for fast and accurate force fields
Reference implementation: https://github.com/ACEsuit/mace
Model Description
MACE uses an E(3)-equivariant graph neural network architecture and is trained with HDF5/XYZ data. It supports energy and force prediction and structure optimization for molecular and materials systems.
Use Cases
| Use case | Description |
|---|---|
| Interatomic-potential training | Read HDF5/XYZ data with a standard configuration and train a MACE model |
| Distributed-training preflight | Check multi-GPU/multi-node settings and ensure that data paths and statistics are consistent |
| Validation-set evaluation | Report energy- and force-related error metrics on the validation set during training |
| Custom data migration | Adapt an existing configuration to your own HDF5/XYZ data and statistics file |
| Environment connectivity check | Use the preflight script to verify the OneScience MatChem environment, PyYAML, h5py, and data readability |
Usage
1. Using OneCode
Try intelligent, one-click AI4S programming in the OneCode online environment:
Try intelligent, one-click AI4S programming
2. Manual Installation and Usage
Hardware requirements
- A GPU or DCU is recommended for training.
- A CPU can be used for import checks and small-configuration connectivity tests, but full training will be slow.
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version matching the current cluster, is recommended.
Download the Model Package
hf download OneScience-Group/MACE
cd mace
Install the Runtime Environment
DCU environment
# Activate DTK and conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
GPU environment
# Activate conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
Training Data
Training data is not bundled with this repository. Using the introductory DMC dataset as an example, download it from Hugging Face to data/ in the repository root:
hf download OneScience-Group/DMC --repo-type dataset
After downloading, the data is located at data/data/DMC/. scripts/demo/run.sh automatically sets the repository root as ONESCIENCE_DATASETS_DIR, so you do not need to set this variable manually for the paths in the configuration file to resolve.
Other configurations, such as ani1x_8dcu.yaml and water_*.yaml, require the corresponding datasets and adjusted data paths in the YAML files.
Training
Single GPU:
bash scripts/demo/run.sh --config scripts/demo/configs/DMC.yaml
Multiple GPUs:
# Eight-GPU example; launch.launcher must be set to torchrun in the configuration
bash scripts/demo/run.sh --config scripts/demo/configs/ani1x_8dcu.yaml
SLURM:
bash scripts/demo/run.sh --config scripts/demo/configs/ani1x_8dcu.yaml --submit
Trained Weights
This repository does not currently include trained weights. You can obtain them by following the training procedure above.
Official OneScience Resources
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- The MACE-related code comes from the MatChem examples in the OneScience project and refers to the upstream MACE project (https://github.com/ACEsuit/mace). The upstream MACE code is released under the MIT License.
- If you use MACE training results in research, please cite the original MACE paper, the relevant OneScience projects, and the datasets used.
中文说明
模型简介
MACE 是一种面向分子与材料体系的原子间机器学习势函数(machine-learning interatomic potential,MLIP)。它基于 E(3) 等变图神经网络,预测原子结构的能量和力。
论文《MACE:用于快速准确构建力场的高阶等变消息传递神经网络》
参考实现 https://github.com/ACEsuit/mace
模型描述
MACE 使用 E(3) 等变图神经网络架构和 HDF5/XYZ 数据进行训练,支持分子与材料体系的能量和力预测以及结构优化。
使用场景
| 使用场景 | 说明 |
|---|---|
| 原子间势函数训练 | 使用标准配置读取 HDF5/XYZ 数据并训练 MACE 模型 |
| 分布式训练前置检查 | 检查多 GPU/多节点设置,并确认数据路径和统计量一致 |
| 验证集评估 | 在训练过程中报告验证集上与能量和力相关的误差指标 |
| 自定义数据迁移 | 将既有配置适配到自己的 HDF5/XYZ 数据及统计文件 |
| 环境连通性检查 | 使用前置检查脚本验证 OneScience MatChem 环境、PyYAML、h5py 和数据可读性 |
使用方法
1. 使用 OneCode
在 OneCode 在线环境中体验智能一键 AI4S 编程。
2. 手动安装与使用
硬件要求
- 建议使用 GPU 或 DCU 进行训练。
- 可使用 CPU 进行导入检查和小配置连通性测试,完整训练会较慢。
- DCU 用户必须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的与当前集群匹配的版本。
下载模型包
hf download OneScience-Group/MACE
cd mace
安装运行环境
DCU 环境
# Activate DTK and conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
GPU 环境
# Activate conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# uv installation is also supported
pip install onescience[matchem-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
训练数据
本仓库未随附训练数据。以入门 DMC 数据集为例,可从 Hugging Face 下载至仓库根目录下的 data/。
hf download OneScience-Group/DMC --repo-type dataset
下载后,数据位于 data/data/DMC/。scripts/demo/run.sh 会自动将仓库根目录设为 ONESCIENCE_DATASETS_DIR,因此无需手动设置该变量即可解析配置文件中的路径。
其他配置如 ani1x_8dcu.yaml 和 water_*.yaml,需要对应的数据集,并需要调整 YAML 文件中的数据路径。
训练
单 GPU
bash scripts/demo/run.sh --config scripts/demo/configs/DMC.yaml
多 GPU
# Eight-GPU example; launch.launcher must be set to torchrun in the configuration
bash scripts/demo/run.sh --config scripts/demo/configs/ani1x_8dcu.yaml
SLURM
bash scripts/demo/run.sh --config scripts/demo/configs/ani1x_8dcu.yaml --submit
训练权重
本仓库目前不包含已训练权重。可按上述训练流程获得这些权重。
OneScience 官方资源
| 平台 | OneScience 主仓库 | Skills 仓库 |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
引用与许可证
- MACE 相关代码来自 OneScience 项目的 MatChem 示例,并参考上游 MACE 项目 (https://github.com/ACEsuit/mace)。上游 MACE 代码按 MIT 许可证发布。
- 如果在研究中使用 MACE 的训练结果,请引用 MACE 原始论文、相关 OneScience 项目及所用数据集。
- Downloads last month
- 13