模型名称: isayevlab/aimnet2-wb97m-d3(AIMNet2,wB97M-D3 泛函级别的神经网络原子间势) 模型链接: https://huggingface.co/isayevlab/aimnet2-wb97m-d3 模型描述: AIMNet2 是用于快速精确分子模拟的神经网络原子间势(NNP)。输入分子原子序数与三维坐标,输出能量(eV)、原子电荷、可选原子受力(forces)。本变体以 wB97M-D3 级别理论训练,支持 14 种元素(H, B, C, N, O, F, Si, P, S, Cl, As, Se, Br, I),4 个 ensemble 成员用于不确定性估计。 模型架构: AIMNet2(嵌入层 → 共享 AEV 特征 + 消息传递 + 3×512 隐藏层 → energy_mlp 输出总能量 + AtomicShift + AtomicSum + SRCoulomb 长程库仑项 + DFTD3 色散修正) 参数规模: ~33MB(4 个 ensemble safetensors,各 8.83MB,主模型 2.2M params) 适配引擎: torch_npu(昇腾 NPU 推理引擎)
| 依赖项 | 版本 | 说明 |
|---|---|---|
| torch | 2.9.0 | |
| torch_npu | 2.9.0.post1 | |
| aimnet | 0.2.0 | pip install "aimnet[hf]"(含 nvalchemiops/warp 依赖) |
| fastapi / uvicorn / pydantic | - | 服务化推理(server.py) |
注:本模型走 aimnet 包(
AIMNet2Calculator,PyTorchModelHubMixin 格式),权重/配置放/tmp/aimnet2-wb97m-d3/。aimnet2 依赖 nvalchemiops/warp(仅支持 cpu/cuda),NPU 适配详见注意事项。
# 默认水分子 H2O,NPU 推理(energy + charges)
python inference.py --device npu:0
# 自定义分子
python inference.py --atoms "6 1 1 1 1" --coord "0,0,0 1.09,0,0 -0.363,1.027,0 -0.363,-1.027,0 0,0,0.5" --device npu:0
# CPU 完整模式(含 DFTD3 色散 + forces)
python inference.py --device cpu --forces推理流程:AIMNet2Calculator(local_dir, device=..., needs_dispersion=False) → calc.eval({"numbers":..., "coord":..., "charge":...}, forces=False) → energy/charges。
以下输出为在昇腾 Ascend 910(CANN 8.5.1 + torch_npu 2.9.0 + aimnet 0.2.0)上实测获得(水分子 H2O)。
命令:
python inference.py --device npu:0
输出:
[INFO] 模型加载完成: AIMNet2 (2.2M params, device=npu:0) [INFO] 分子: 3 原子 [8, 1, 1], coord=[[0.0, 0.0, 0.0], [0.757, 0.586, 0.0]]... [结果] energy: -2081.0294 eV [结果] charges: ['-0.6948', '0.3474', '0.3474'] [耗时] 0.314s
结果说明: 水分子输入,AIMNet2 输出总能量 -2081.03 eV 与 3 个原子的电荷(O -0.69,H +0.35/+0.35),0.314s 完成,验证了 AIMNet2 在昇腾 NPU 上的分子能量/电荷推理链路通畅。

python server.py --port 8000 --device npu:0接口:
GET /health → {"status":"ok","model":"isayevlab/aimnet2-wb97m-d3","device":"npu:0","loaded":true}POST /infer(JSON:{"atoms":[8,1,1], "coord":[[0,0,0],[0.757,0.586,0],[-0.757,0.586,0]], "charge":0})→ {"energy_eV":..., "charges":[...], "atoms":[...], "elapsed_s":...}实测(服务化):
POST /infer(H2O)→ {"energy_eV":-2081.0294,"charges":[-0.6948,0.3474,0.3474],"atoms":[8,1,1],"elapsed_s":0.327}/tmp/aimnet2-wb97m-d3/(4×8.83MB safetensors + config.json),避免占用有限的 /opt 空间,不纳入本仓库@torch.compile,torch 2.9 inductor 报 KeyError: 'cpu',torch.compile = lambda fn: fn 绕开needs_dispersion=False(能量不含 D3 色散项);如需完整 D3+forces 用 --device cpu --forcestorch.autograd.grad 在 torch_npu 上有 inplace 版本兼容问题(npuLongType is at version 10; expected version 8),NPU 模式输出 energy+charges(forces=False)atoms 与 coord 长度一致;坐标单位 Å(模型训练单位)