NequIP

Model Introduction

NequIP 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.

Reference implementation: https://github.com/mir-group/nequip

Model Description

This repository provides the OneScience-integrated NequIP model code, OAM-L model weights, and runnable examples for training, fine-tuning, and inference. The model/ directory corresponds only to src/onescience/models/nequip/ in the main OneScience repository; training utilities, data-processing tools, and other shared modules are provided by the installed OneScience package.

The included OAM-L weights are:

File Purpose
weight/NequIP-OAM-L-0.1.nequip.pth Compiled model for ASE single-point energy, atomic force, and stress inference
weight/NequIP-OAM-L-0.1.nequip.zip NequIP package for OAM-L fine-tuning and checkpoint inference

Use Cases

Use case Description
Interatomic-potential training Train a NequIP model using the example configurations and ASE extxyz data
Pretrained-model fine-tuning Fine-tune the OAM-L package using data labeled with energy and forces
Single-point energy and force inference Predict the energy, atomic forces, and stress of a structure with a compiled model or fine-tuned checkpoint
Structure relaxation Optimize atomic positions with ASE
Energy-volume curve Scan the volume of a periodic crystal and calculate the corresponding energy
Slurm/DCU training Submit single-device or multi-device jobs using the included configurations and launch scripts

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 --model OneScience-Group/NequIP --local-dir ./NequIP
cd NequIP

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 FCC Cu dataset as an example, download it from Hugging Face to data/ in the repository root:

hf download --dataset OneScience-Group/FCC_Cu --local-dir ./data

After downloading, the raw data is located at data/data/FCC_Cu/raw/fcu.xyz. The dataset contains 6,855 structures, each with 52 atoms of C, H, O, and Cu. It uses an ASE-readable extxyz format and includes periodic cells together with energy and force labels. For production training or fine-tuning, use data consistent with the target system, label definitions, and units.

The training scripts read models and data from shared directories. Set the paths for your cluster before training or fine-tuning:

export ONESCIENCE_MODELS_DIR=/path/to/onescience-models
export ONESCIENCE_DATASETS_DIR=/path/to/onescience-datasets

To use the OAM-L weights included in this repository, copy them into the shared model directory:

mkdir -p "$ONESCIENCE_MODELS_DIR/NequIP"
cp weight/NequIP-OAM-L-0.1.nequip.pth "$ONESCIENCE_MODELS_DIR/NequIP/"
cp weight/NequIP-OAM-L-0.1.nequip.zip "$ONESCIENCE_MODELS_DIR/NequIP/"

Training

Generate minimal smoke-test data and run local training:

python demo/prepare_smoke_data.py
bash demo/run.sh --config configs/tutorial_smoke.yaml

Download the official FCU tutorial data and submit a training job:

python demo/download_tutorial_data.py
bash demo/run.sh --config configs/tutorial_fcu.yaml --submit

The eight-DCU configurations run locally or submit to Slurm automatically, depending on the currently available resources:

bash demo/run.sh --config configs/tutorial_smoke_8dcu.yaml
bash demo/run.sh --config configs/tutorial_fcu_8dcu.yaml

Outputs are written to outputs/ by default. The actual wait time for a training job depends on the cluster queue and available resources.

Model Weights

This repository includes the OAM-L trained weights:

e83a1d656f8b19b55d2f05708c83e054612f713e9a1b06266aa010db58e56517  weight/NequIP-OAM-L-0.1.nequip.pth
5d01a4fab228abb3cdb6ace0033f93993729956bca6a42234a2a8816825b9a0f  weight/NequIP-OAM-L-0.1.nequip.zip

Fine-Tuning

Validate the OAM-L fine-tuning workflow with generated smoke-test data:

python demo/prepare_smoke_data.py
bash demo/run.sh --config configs/oam_l_finetune_smoke.yaml --submit

Use the production fine-tuning configuration:

bash demo/run.sh --config configs/oam_l_finetune.yaml --submit

Provide production fine-tuning data through ONESCIENCE_DATASETS_DIR in an ASE-readable extxyz format. Every frame must contain at least energy and forces; element types, units, and label definitions must be consistent with the OAM-L package and configuration.

Inference

Use the compiled model for single-point energy, atomic force, and stress prediction:

python single_point.py --compiled-model weight/NequIP-OAM-L-0.1.nequip.pth
python single_point.py \
  --compiled-model weight/NequIP-OAM-L-0.1.nequip.pth \
  --input structure.cif \
  --output outputs/single_point.json

Calculate an energy-volume curve and perform structure relaxation:

python energy_volume.py
python structure_relaxation.py --fmax 0.05 --steps 100 --output-dir outputs/oam_l_relax

Run inference with a checkpoint produced by fine-tuning:

python single_point.py \
  --checkpoint outputs/<run>/checkpoints/best.ckpt \
  --package weight/NequIP-OAM-L-0.1.nequip.zip \
  --output outputs/<run>/single_point.json

Official OneScience Resources

Citation and License

  • The NequIP-related code comes from the OneScience MatChem integration and refers to the upstream NequIP project (https://github.com/mir-group/nequip). The OneScience integration code follows the Apache License 2.0 used by the main repository.
  • If you use NequIP or OAM-L training results in research, please cite the original NequIP paper, the relevant OneScience projects, and the datasets used.
  • Redistribution rights for the OAM-L model weights are governed by the original OneScience/OAM-L release terms. Confirm the applicable rights and restrictions before use.
  • The FCC Cu dataset is published separately at OneScience-Group/FCC_Cu. Its license and provenance are documented on the dataset card and by its upstream source.

中文说明

模型简介

NequIP 是用于分子和材料体系的机器学习原子间势函数(machine-learning interatomic potential,MLIP)。它基于 E(3) 等变图神经网络,预测原子结构的能量和力。

参考实现见 https://github.com/mir-group/nequip

模型描述

本仓库提供集成到 OneScience 的 NequIP 模型代码、OAM-L 模型权重,以及可运行的训练、微调(fine-tuning)和推理(inference)示例。model/ 目录仅对应 OneScience 主仓库中的 src/onescience/models/nequip/。训练工具、数据处理工具和其他共享模块由已安装的 OneScience 包提供。

随包提供的 OAM-L 权重如下。

文件 用途
weight/NequIP-OAM-L-0.1.nequip.pth 用于 ASE 单点能量、原子力和应力推理的编译模型
weight/NequIP-OAM-L-0.1.nequip.zip 用于 OAM-L 微调和模型权重(检查点)(checkpoint)推理的 NequIP 包

使用场景

使用场景 说明
原子间势函数训练 使用示例配置和 ASE extxyz 数据训练 NequIP 模型
预训练模型微调 使用标注有能量和力的数据微调 OAM-L 包
单点能量和力推理 使用编译模型或微调后的模型权重(检查点)预测结构的能量、原子力及应力
结构弛豫 使用 ASE 优化原子位置
能量与体积曲线 扫描周期晶体的体积并计算相应能量
Slurm/DCU 训练 使用随包提供的配置和启动脚本提交单设备或多设备作业

使用指南

1. 使用 OneCode

通过 OneCode 在线环境体验智能一键 AI4S 编程。

体验智能一键 AI4S 编程

2. 手动安装与使用

硬件要求

  • 训练建议使用 GPU 或 DCU。
  • CPU 可用于导入检查和小规模配置连通性测试,完整训练速度较慢。
  • DCU 用户须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的适配当前集群的版本。

下载模型包

hf download --model OneScience-Group/NequIP --local-dir ./NequIP
cd NequIP

安装运行环境

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

训练数据

本仓库未附带训练数据。以入门 FCC Cu 数据集为例,从 Hugging Face 下载至仓库根目录下的 data/。

hf download --dataset OneScience-Group/FCC_Cu --local-dir ./data

下载后,原始数据位于 data/data/FCC_Cu/raw/fcu.xyz。数据集包含 6,855 个结构,每个结构有 52 个原子,元素为 C、H、O 和 Cu。数据采用 ASE 可读的 extxyz 格式,并包含周期晶胞以及能量和力标签。正式训练或微调时,使用与目标体系、标签定义和单位一致的数据。

训练脚本从共享目录读取模型和数据。请在训练或微调前设置集群路径。

export ONESCIENCE_MODELS_DIR=/path/to/onescience-models
export ONESCIENCE_DATASETS_DIR=/path/to/onescience-datasets

若要使用本仓库附带的 OAM-L 权重,请将其复制到共享模型目录。

mkdir -p "$ONESCIENCE_MODELS_DIR/NequIP"
cp weight/NequIP-OAM-L-0.1.nequip.pth "$ONESCIENCE_MODELS_DIR/NequIP/"
cp weight/NequIP-OAM-L-0.1.nequip.zip "$ONESCIENCE_MODELS_DIR/NequIP/"

训练

生成最小冒烟测试数据并运行本地训练。

python demo/prepare_smoke_data.py
bash demo/run.sh --config configs/tutorial_smoke.yaml

下载官方 FCU 教程数据并提交训练作业。

python demo/download_tutorial_data.py
bash demo/run.sh --config configs/tutorial_fcu.yaml --submit

八 DCU 配置根据当前可用资源在本地运行,或自动提交到 Slurm。

bash demo/run.sh --config configs/tutorial_smoke_8dcu.yaml
bash demo/run.sh --config configs/tutorial_fcu_8dcu.yaml

输出默认写入 outputs/。训练作业的实际等待时间取决于集群队列和可用资源。

模型权重

本仓库包含以下已训练的 OAM-L 权重。

e83a1d656f8b19b55d2f05708c83e054612f713e9a1b06266aa010db58e56517  weight/NequIP-OAM-L-0.1.nequip.pth
5d01a4fab228abb3cdb6ace0033f93993729956bca6a42234a2a8816825b9a0f  weight/NequIP-OAM-L-0.1.nequip.zip

微调

使用生成的冒烟测试数据验证 OAM-L 微调流程。

python demo/prepare_smoke_data.py
bash demo/run.sh --config configs/oam_l_finetune_smoke.yaml --submit

使用正式微调配置。

bash demo/run.sh --config configs/oam_l_finetune.yaml --submit

通过 ONESCIENCE_DATASETS_DIR 提供 ASE 可读的 extxyz 格式正式微调数据。每帧必须至少包含 energy 和 forces。元素类型、单位和标签定义必须与 OAM-L 包及配置一致。

推理

使用编译模型预测单点能量、原子力和应力。

python single_point.py --compiled-model weight/NequIP-OAM-L-0.1.nequip.pth
python single_point.py \
  --compiled-model weight/NequIP-OAM-L-0.1.nequip.pth \
  --input structure.cif \
  --output outputs/single_point.json

计算能量与体积曲线并执行结构弛豫。

python energy_volume.py
python structure_relaxation.py --fmax 0.05 --steps 100 --output-dir outputs/oam_l_relax

使用微调产生的模型权重(检查点)运行推理。

python single_point.py \
  --checkpoint outputs/<run>/checkpoints/best.ckpt \
  --package weight/NequIP-OAM-L-0.1.nequip.zip \
  --output outputs/<run>/single_point.json

OneScience 官方资源

引用与许可证

  • NequIP 相关代码来自 OneScience MatChem 集成,并参考上游 NequIP 项目(https://github.com/mir-group/nequip )。OneScience 集成代码遵循主仓库使用的 Apache License 2.0。
  • 如果在研究中使用 NequIP 或 OAM-L 训练结果,请引用 NequIP 原始论文、相关 OneScience 项目和使用的数据集。
  • OAM-L 模型权重的再分发权利受最初的 OneScience/OAM-L 发布条款约束。使用前请确认适用权利和限制。
  • FCC Cu 数据集在 OneScience-Group/FCC_Cu 单独发布。其许可证和来源记录在数据集卡及上游来源中。
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support