eSEN
Model Introduction
eSEN (equivariant Smooth Energy Network) is an equivariant graph neural network interatomic potential proposed by FAIR Chemistry. It predicts the energy, atomic forces, and stress of material structures. OneScience provides an ASE calculator and fine-tuning entry points for single-point calculations, structure relaxation, molecular dynamics, and fine-tuning on custom materials data.
Upstream implementation: FAIR-Chem/fairchem
Model Description
eSEN takes periodic atomic structure graphs as input, learns a smooth potential energy surface through rotationally equivariant representations, and obtains conservative forces from energy gradients. Different pretrained checkpoints correspond to different materials domains. Select weights whose target elemental systems and DFT labeling settings are close to your use case.
This repository contains the eSEN model code, inference scripts, an oxide PBE fine-tuning example, and multi-device launch configurations. Restricted pretrained eSEN checkpoints are not distributed with this repository.
Use Cases
| Use case | Description |
|---|---|
| Single-point calculation | Predict the total energy, atomic forces, and stress of a periodic structure |
| Structure relaxation | Optimize atomic positions and, optionally, the unit cell with ASE BFGS |
| Molecular dynamics | Run NVT trajectories with ASE Langevin dynamics |
| Oxide PBE fine-tuning | Fine-tune an MPTrj checkpoint using energy and force labels |
| Distributed fine-tuning | Support single-node multi-device and multi-node Slurm DDP |
This repository does not provide a complete pretraining workflow from random initialization. Its training entry point is intended for checkpoint fine-tuning.
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 inference and fine-tuning.
- A CPU can be used for import and configuration checks but is not recommended for production workloads.
- A DCU requires a DTK runtime matching the PyTorch build.
Download the Model Package
hf download OneScience-Group/eSEN
cd eSEN
Install the Runtime Environment
DCU environment
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[matchem-dcu] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
GPU environment
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
pip install onescience[matchem-gpu] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
Pretrained Weights
Access to pretrained eSEN checkpoints must be requested from the official FAIR Chemistry model release page. This repository neither provides nor redistributes those weights. After obtaining access, place the required checkpoint at:
weight/
├── Jd.pt # Rotation-basis file included in this repository
├── esen_30m_mptrj.pt # Add after obtaining access
├── esen_30m_omat.pt # Add after obtaining access
└── esen_30m_oam.pt # Add after obtaining access
Checkpoint details:
| Checkpoint | Training domain | Recommended use |
|---|---|---|
esen_30m_mptrj.pt |
MPTrj | PBE/PBE+U inference for inorganic crystals and fine-tuning in a similar labeling domain |
esen_30m_omat.pt |
OMat24 | A broader range of non-equilibrium inorganic structures |
esen_30m_oam.pt |
OAM | General-purpose materials pretraining starting point |
Access and download resources:
- FAIR Chemistry model page: https://huggingface.co/fairchem
- Official FAIR Chemistry repository: https://github.com/FAIR-Chem/fairchem
Jd.pt is included in the repository under weight/. The inference and fine-tuning scripts use it automatically, with no additional download or UMA dependency required.
Fine-Tuning Dataset
This repository does not include the training data. The oxide PBE example dataset is published separately on Hugging Face:
hf download OneScience-Group/oxides --repo-type dataset
The downloaded data has the following layout:
datasets/oxides/data/OXIDES/prepared/
├── train.db
├── val.db
└── test.db
The data has already been converted to ASE DB format. The default configuration uses energy and force supervision and does not train on stress. Use prepare_oxide_dataset.py to regenerate the data from the official oxide JSON files.
Inference
Predict single-point energy, forces, and stress:
python single_point.py --checkpoint weight/esen_30m_mptrj.pt
Relax a structure:
python relax.py \
--checkpoint weight/esen_30m_mptrj.pt \
--fmax 0.05 --steps 100 --output relaxed.cif
Run NVT molecular dynamics:
python md.py \
--checkpoint weight/esen_30m_mptrj.pt \
--steps 100 --temperature 300 --timestep 1.0 --output md.traj
Use --input to read CIF, POSCAR, XYZ, or any other structure format supported by ASE.
Fine-Tuning
Fine-tune on oxide PBE data with one device:
bash demo/run.sh --config configs/finetune_1dcu.yaml
Main configuration fields:
| YAML field | Purpose |
|---|---|
checkpoint |
Path to the initialization checkpoint |
train, val |
Paths to ASE DB or ASE-LMDB data |
epochs, batch_size, workers |
Number of training epochs, batch size, and data-loading workers |
lr |
AdamW learning rate |
energy_weight, force_weight, stress_weight |
Loss weight for each supervised target |
fit_element_references |
Whether to refit elemental energy references on the training set |
launch.num_nodes, launch.num_gpus |
Number of nodes and devices per node |
launch.mode |
Run directly with local or submit to Slurm with submit |
slurm.* |
Slurm partition, time limit, and CPU resources |
Use the same entry point for multi-device and multi-node jobs by selecting another YAML file:
bash demo/run.sh --config configs/finetune_2dcu.yaml
bash demo/run.sh --config configs/finetune_16dcu.yaml
When the current node has fewer visible devices than requested, or when the configuration requests multiple nodes, demo/run.sh automatically submits the job through sbatch.
Evaluate a fine-tuned checkpoint:
python evaluate.py \
--checkpoint outputs/<run>/checkpoints/esen_oxides_1dcu_finetuned.pt \
--data datasets/oxides/data/OXIDES/prepared/test.db
File Reference
| Path | Purpose |
|---|---|
model/ |
Source code for the eSEN backbone, prediction heads, and graph interface |
single_point.py |
Single-point energy, force, and stress inference |
relax.py |
Periodic structure relaxation |
md.py |
NVT molecular dynamics |
finetune.py |
Low-level checkpoint fine-tuning entry point |
evaluate.py |
Error evaluation on an independent dataset |
prepare_oxide_dataset.py |
Convert oxide JSON data to ASE DB format |
demo/run.sh |
YAML-driven local and Slurm fine-tuning entry point |
demo/configs/ |
Single-device, multi-device, and multi-node fine-tuning configurations |
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 eSEN model code is adapted from FairChem Core and follows the upstream FairChem MIT License. The model code and the included
Jd.ptfile are used under that model license. - eSEN checkpoints are not distributed with this repository. Follow the access conditions and licenses specified on the FAIR Chemistry model pages.
- When using OMat24, MPTrj, OAM, or oxide data, cite the datasets and corresponding model work actually used.
中文说明
模型简介
eSEN(equivariant Smooth Energy Network)是 FAIR Chemistry 提出的等变图神经网络原子间势。它预测材料结构的能量、原子力和应力。OneScience 提供 ASE 计算器和微调(fine-tuning)入口,用于单点计算、结构弛豫、分子动力学及在自定义材料数据上微调。
上游实现见 FAIR-Chem/fairchem
模型描述
eSEN 将周期性原子结构图作为输入,通过旋转等变表示学习光滑势能面,并从能量梯度得到保守力。不同的预训练模型权重(检查点)(checkpoints)对应不同的材料领域。请选择目标元素体系和 DFT 标注设置接近使用场景的权重。
本仓库包含 eSEN 模型代码、推理(inference)脚本、氧化物 PBE 微调示例和多设备启动配置。受限的预训练 eSEN 模型权重(检查点)未随本仓库分发。
使用场景
| 使用场景 | 说明 |
|---|---|
| 单点计算 | 预测周期性结构的总能量、原子力和应力 |
| 结构弛豫 | 使用 ASE BFGS 优化原子位置,并可选择优化晶胞 |
| 分子动力学 | 使用 ASE Langevin 动力学生成 NVT 轨迹 |
| 氧化物 PBE 微调 | 使用能量和力标签微调 MPTrj 模型权重(检查点) |
| 分布式微调 | 支持单节点多设备和多节点 Slurm DDP |
本仓库的训练入口用于微调模型权重(检查点)。从随机初始化开始的完整预训练流程未提供。
使用方法
1. 使用 OneCode
通过 OneCode 在线环境体验智能一键 AI4S 编程。
2. 手动安装与使用
硬件要求
- 建议使用 GPU 或 DCU 进行推理和微调。
- CPU 可用于导入和配置检查,正式计算任务不建议使用 CPU。
- DCU 需要与 PyTorch 构建版本匹配的 DTK 运行环境。
下载模型包
hf download OneScience-Group/eSEN
cd eSEN
安装运行环境
DCU 环境
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[matchem-dcu] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
GPU 环境
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
pip install onescience[matchem-gpu] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
预训练权重
预训练 eSEN 模型权重(检查点)的访问权限必须通过 FAIR Chemistry 官方模型发布页申请。本仓库不提供或再分发这些权重。获得访问权限后,将所需模型权重(检查点)放入以下位置。
weight/
├── Jd.pt # Rotation-basis file included in this repository
├── esen_30m_mptrj.pt # Add after obtaining access
├── esen_30m_omat.pt # Add after obtaining access
└── esen_30m_oam.pt # Add after obtaining access
模型权重(检查点)详情
| 模型权重(检查点) | 训练领域 | 推荐用途 |
|---|---|---|
esen_30m_mptrj.pt |
MPTrj | 无机晶体的 PBE/PBE+U 推理及在相似标注领域上的微调 |
esen_30m_omat.pt |
OMat24 | 范围更广的非平衡无机结构 |
esen_30m_oam.pt |
OAM | 通用材料预训练起点 |
访问与下载资源
- FAIR Chemistry 模型页面见 https://huggingface.co/fairchem
- FAIR Chemistry 官方仓库见 https://github.com/FAIR-Chem/fairchem
Jd.pt 随附在仓库的 weight/ 下。推理和微调脚本会自动使用该文件,无需额外下载或安装 UMA 依赖。
微调数据集
本仓库不包含训练数据。氧化物 PBE 示例数据集在 Hugging Face 上单独发布。
hf download OneScience-Group/oxides --repo-type dataset
下载后的数据布局如下。
datasets/oxides/data/OXIDES/prepared/
├── train.db
├── val.db
└── test.db
数据已转换为 ASE DB 格式。默认配置使用能量和力进行监督,训练不使用应力。可用 prepare_oxide_dataset.py 从官方氧化物 JSON 文件重新生成数据。
推理
使用以下命令预测单点能量、力和应力。
python single_point.py --checkpoint weight/esen_30m_mptrj.pt
使用以下命令进行结构弛豫。
python relax.py \
--checkpoint weight/esen_30m_mptrj.pt \
--fmax 0.05 --steps 100 --output relaxed.cif
使用以下命令运行 NVT 分子动力学。
python md.py \
--checkpoint weight/esen_30m_mptrj.pt \
--steps 100 --temperature 300 --timestep 1.0 --output md.traj
使用 --input 读取 CIF、POSCAR、XYZ 或 ASE 支持的其他结构格式。
微调
在一台设备上使用氧化物 PBE 数据进行微调。
bash demo/run.sh --config configs/finetune_1dcu.yaml
主要配置字段如下。
| YAML 字段 | 用途 |
|---|---|
checkpoint |
初始化模型权重(检查点)的路径 |
train, val |
ASE DB 或 ASE-LMDB 数据的路径 |
epochs, batch_size, workers |
训练轮次、批大小和数据加载进程数 |
lr |
AdamW 学习率 |
energy_weight, force_weight, stress_weight |
每个监督目标的损失权重 |
fit_element_references |
是否在训练集上重新拟合各元素的参考能量 |
launch.num_nodes, launch.num_gpus |
节点数和每个节点的设备数 |
launch.mode |
使用 local 直接运行,或使用 submit 提交到 Slurm |
slurm.* |
Slurm 分区、时间限制和 CPU 资源 |
选择另一个 YAML 文件,即可通过同一入口运行多设备和多节点任务。
bash demo/run.sh --config configs/finetune_2dcu.yaml
bash demo/run.sh --config configs/finetune_16dcu.yaml
当前节点的可见设备数少于请求数,或配置请求多个节点时,demo/run.sh 会通过 sbatch 自动提交任务。
使用以下命令评估微调后的模型权重(检查点)。
python evaluate.py \
--checkpoint outputs/<run>/checkpoints/esen_oxides_1dcu_finetuned.pt \
--data datasets/oxides/data/OXIDES/prepared/test.db
文件说明
| 路径 | 用途 |
|---|---|
model/ |
eSEN 主干网络、预测头及图接口的源代码 |
single_point.py |
单点能量、力和应力推理 |
relax.py |
周期性结构弛豫 |
md.py |
NVT 分子动力学 |
finetune.py |
模型权重(检查点)微调的底层入口 |
evaluate.py |
在独立数据集上进行误差评估 |
prepare_oxide_dataset.py |
将氧化物 JSON 数据转换为 ASE DB 格式 |
demo/run.sh |
YAML 驱动的本地与 Slurm 微调入口 |
demo/configs/ |
单设备、多设备和多节点微调配置 |
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 |
引用与许可证
- eSEN 模型代码改编自 FairChem Core,遵循上游 FairChem MIT License。模型代码及随附的
Jd.pt文件依该模型许可证使用。 - eSEN 模型权重(检查点)未随本仓库分发。请遵循 FAIR Chemistry 模型页面规定的访问条件和许可证。
- 使用 OMat24、MPTrj、OAM 或氧化物数据时,请引用实际使用的数据集和对应的模型工作。
- Downloads last month
- 8