分子动力学模拟是基于传统的分子力场,对分子构象进行不断迭代演化的一个过程。虽然计算量相比于量子化学已经缩减了很多,但是由于大型分子体系下近邻表的存在,以及PME算法本身的复杂性,所以实际上分子动力学模拟工具的计算性能,会是使用者最为关注的要点之一。SPONGE版本可以支持GPU加速的分子动力学模拟计算,凭借其极高的效率以及模块化的设计,在一众的分子模拟软件中脱颖而出。本文着重介绍SPONGE-2.0版本的安装与基本使用。

安装与使用
关于新版的SPONGE,如果是Windows的机器,建议可以使用Windows操作系统的就不要再套一层WSL,会有一定的性能损失,这里直接在Windows环境下做编译构建。
安装pixi
首先是需要安装一个pixi,直接用powershell执行下述指令即可:
bash
> iwr -useb https://pixi.sh/install.ps1 | iex
This script will automatically download and install Pixi (latest) for you.
Getting it from this url: https://github.com/prefix-dev/pixi/releases/latest/download/pixi-x86_64-pc-windows-msvc.zip
The binary will be installed into 'C:\Users\dechi\.pixi\bin'
Adding C:\Users\dechi\.pixi\bin to PATH
You may need to restart your shell
安装完成后要重启powershell生效。重启后可以看一下pixi的版本:
bash
> pixi --version
pixi 0.73.0
使用pixi安装开发环境
先用git把项目clone到本地,从powershell进入到项目的根目录:
bash
> ls
目录: xxx\SPONGE
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2026/7/16 9:45 .git
d----- 2026/7/16 9:40 .github
d----- 2026/7/16 9:40 benchmarks
d----- 2026/7/16 9:40 cmake
d----- 2026/7/16 9:40 docs
d----- 2026/7/16 9:40 packaging
d----- 2026/7/16 9:40 plugins
d----- 2026/7/16 9:40 scripts
d----- 2026/7/16 9:40 skills
d----- 2026/7/16 9:40 SPONGE
-a---- 2026/7/16 9:40 197 .clang-format
-a---- 2026/7/16 9:40 311 .gitignore
-a---- 2026/7/16 9:40 921 CMakeLists.txt
-a---- 2026/7/16 9:40 5154 LICENSE
-a---- 2026/7/16 9:40 19529 opt.log
-a---- 2026/7/16 9:40 710089 pixi.lock
-a---- 2026/7/16 9:40 9903 pixi.toml
-a---- 2026/7/16 9:40 1261 README.md
-a---- 2026/7/16 9:40 1317 README_en.md
-a---- 2026/7/16 9:40 141 ruff.toml
然后执行pixi的环境构建(根据本地环境的硬件条件参数决定使用哪一个环境):
bash
> pixi install -e dev-cuda12
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
⠄ preparing packages [━━━━━━━━────────────] 88/96 libcublas (+7) @ 833.2 KiB/s ⠠ installing [━━━─────────────────] 88/96 queued: cuda-nvcc-dev_win-64
具体的环境依赖表如下图所示:

然后就坐等安装完成即可,安装完成会有如下信息提示:
bash
✔ The dev-cuda12 environment has been installed.
使用pixi环境编译构建SPONGE-2.0
核心指令就是:
bash
> pixi run -e dev-cuda12 configure # CMake configure
> pixi run -e dev-cuda12 compile # build and install into the environment
运行过程如下所示:
bash
> pixi run -e dev-cuda12 configure
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
✨ Pixi task (configure in dev-cuda12): cmake -S . -B build-$PIXI_ENVIRONMENT_NAME -G Ninja -DPARALLEL='cuda' -DCUDA_ARCH='all-major' -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX"
-- The C compiler identification is MSVC 19.44.35222.0
-- The CXX compiler identification is MSVC 19.44.35222.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
...
> pixi run -e dev-cuda12 compile
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
✨ Pixi task (compile in dev-cuda12): cmake --build build-$PIXI_ENVIRONMENT_NAME --config Release --target install --parallel 4
[4/108] Building CUDA object CMakeFiles\SPONGE.dir\SPONGE\common.cpp.obj
...
安装验证
通过运行以下两个指令,可以查看SPONGE-2.0是否被正确安装:
bash
> pixi run -e dev-cuda12 which SPONGE
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
xxx/.pixi/envs/dev-cuda12/bin/SPONGE
> pixi run -e dev-cuda12 SPONGE --help
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
____ ____ ___ _ _ ____ _____
/ ___|| _ \ / _ \| \ | |/ ___| ____|
\___ \| |_) | | | | \| | | _| _|
___) | __/| |_| | |\ | |_| | |___
|____/|_| \___/|_| \_|\____|_____|
SPONGE Version:
v2.0.0-beta.1 2026-04-01 April Fools' Day
Sub-package:
SPONGE, for general-purpose molecular dynamics simulations
Citation:
Huang, Y. - P., Xia, Y., Yang, L., Wei, J., Yang, Y.I.and Gao, Y.Q. (2022), SPONGE: A GPU - Accelerated Molecular Dynamics Package with Enhanced Sampling and AI - Driven Algorithms.Chin.J.Chem., 40 : 160 - 168. https ://doi.org/10.1002/cjoc.202100456
Working Directory:
xxx\SPONGE
SPONGE Path:
xxx\SPONGE\.pixi\envs\dev-cuda12\bin\SPONGE.exe
Start Wall Time:
Thu Jul 16 12:20:01 2026
MD TASK NAME:
Default SPONGE MD Task Name
START INITIALIZING CONTROLLER
Start initializing GPU
Compiled by CUDA 12.8
1 device(s) found:
Device 0:
Name: NVIDIA GeForce RTX 3080 Ti Laptop GPU
Memory: 16.0 GB
Compute Capability: 86
Rank 0: Device 0
Compiled by CUDA ARCH 8.0
Runtime CUDA ARCH 8.6
End initializing GPU
MPI is not enabled
structure last modify date is 20260216
END INITIALIZING CONTROLLER
spongeErrorMissingCommand raised by Xponge::Native_Load_Mass
Missing required command(s)
Reason:
no atom_numbers found. No mass_in_file is provided
SPONGE-2.0案例测试
新建一个workspace路径,在workspace路径下新建一个mdin.spg.toml文件,内容如下:
txt
md_name = "NVT water"
mode = "nvt"
step_limit = 50000
dt = 0.002
cutoff = 8.0
default_in_file_prefix = "D:\\xxx\\SPONGE\\benchmarks\\performance\\nonortho\\statics\\WAT_nonortho\\WAT"
constrain_mode = "SHAKE"
thermostat = "middle_langevin"
thermostat_tau = 0.1
thermostat_seed = 2026
target_temperature = 300.0
write_information_interval = 1000
这里要注意Windows系统和Linux系统下的路径写法不同。然后运行,输出如下:
bash
> pixi run -e dev-cuda12 SPONGE -mdin workspace/mdin.spg.toml
WARN the lock file is up-to-date but uses an older format (v6), run `pixi lock` to upgrade to v7 for improved reproducibility
____ ____ ___ _ _ ____ _____
/ ___|| _ \ / _ \| \ | |/ ___| ____|
\___ \| |_) | | | | \| | | _| _|
___) | __/| |_| | |\ | |_| | |___
|____/|_| \___/|_| \_|\____|_____|
SPONGE Version:
v2.0.0-beta.1 2026-04-01 April Fools' Day
Sub-package:
SPONGE, for general-purpose molecular dynamics simulations
Citation:
Huang, Y. - P., Xia, Y., Yang, L., Wei, J., Yang, Y.I.and Gao, Y.Q. (2022), SPONGE: A GPU - Accelerated Molecular Dynamics Package with Enhanced Sampling and AI - Driven Algorithms.Chin.J.Chem., 40 : 160 - 168. https ://doi.org/10.1002/cjoc.202100456
Working Directory:
D:\xxx\SPONGE\workspace
SPONGE Path:
D:\xxx\SPONGE\.pixi\envs\dev-cuda12\bin\SPONGE.exe
Start Wall Time:
Thu Jul 16 14:13:14 2026
MD TASK NAME:
NVT
START INITIALIZING CONTROLLER
Start initializing GPU
Compiled by CUDA 12.8
1 device(s) found:
Device 0:
Name: NVIDIA GeForce RTX 3080 Ti Laptop GPU
Memory: 16.0 GB
Compute Capability: 86
Rank 0: Device 0
Compiled by CUDA ARCH 8.0
Runtime CUDA ARCH 8.6
End initializing GPU
MPI is not enabled
structure last modify date is 20260216
END INITIALIZING CONTROLLER
START INITIALIZING CV CONTROLLER:
CV CONTROLLER IS NOT INITIALIZING
START INITIALIZING MD CORE:
Mode set to NVT
skin set to 2.00 Angstrom
cutoff set to 8.00 Angstrom
Start reading excluded list from Xponge:
End reading excluded list from Xponge
Start reading residue list from Xponge:
residue_numbers is 1081
End reading residue list from Xponge
dt set to 0.002000 ps
structure last modify date is 20260216
END INITIALIZING MD CORE
START INITIALIZING MIDDLE LANGEVIN DYNAMICS:
atom_numbers is 4324
target temperature is 300.00 K
friction coefficient is 10.00 ps^-1
random seed is 2026
structure last modify date is 20260216
END INITIALIZING MIDDLE LANGEVIN DYNAMICS
START INITIALIZING LENNADR JONES INFORMATION:
atom_numbers is 4324
atom_LJ_type_number is 2
Start initializing long range LJ correction
Total C6 factor is 4.279219e+09
long range correction factor is: -2.917440e+06
End initializing long range LJ correction
structure last modify date is 20260216
END INITIALIZING LENNADR JONES INFORMATION
START INITIALIZING FEP SOFT CORE FOR LJ AND COULOMB:
END INITIALIZING LENNADR JONES SOFT CORE INFORMATION
START INITIALIZING PME:
PME backend library: cuFFT
grid_spacing: 1.000000 Angstrom
fftx: 40
ffty: 40
fftz: 36
beta: 0.348639
structure last modify date is 20260216
END INITIALIZING PME
PAIRWISE FORCE IS NOT INITIALIZED
NB14 IS NOT INITIALIZED
START INITIALIZING BOND (Xponge::system):
bond_numbers is 3243
structure last modify date is 20260216
END INITIALIZING BOND
START INITIALIZING CONSTRAIN:
constrain pair number is 3243
END INITIALIZING CONSTRAIN
START INITIALIZING SETTLE:
rigid triangle numbers is 1081
rigid pair numbers is 0
remaining simple constrain pair numbers is 0
END INITIALIZING SETTLE
SHAKE IS NOT INITIALIZED
START INITIALIZING VIRTUAL ATOM
Start reading virtual levels
Virtual Atoms Max Level is 1
Virtual Atoms Number is 1081
FF Virtual Atoms Number is 1081
CV Virtual Atoms Number is 0
End reading virtual levels
Start reading virtual type numbers in different levels
Virutual level 0:
Virtual type 2 atom numbers is 1081
End reading virtual type numbers in different levels
Start reading information for every virtual atom
End reading information for every virtual atom
structure last modify date is 20260216
END INITIALIZING VIRTUAL ATOM
START INITIALIZING NEIGHBOR LIST:
Max number of neighbors for one atom: 1200
initializing grids
Nx: 7 Ny: 6 Nz: 5
Max number of atoms in one grid: 150
Max number of ghosts in one grid: 150
initializing updator
The interval to refresh the neighbor list: 0
The permit of the skin to refresh the neighbor list: 0.500000
is_needed_half: true
is_needed_full: false
END INITIALIZING NEIGHBOR LIST
START INITIALIZING STEER CV:
0 CV(s) found for steer
STEER CV IS NOT INITIALIZED
START INITIALIZING RESTRAIN CV:
0 CV(s) found for restrain
RESTRAIN CV IS NOT INITIALIZED
META IS NOT INITIALIZED
Molecule numbers: 1081
md_info->ug.ug_numbers: 1081
START INITIALIZING SOLVENT LJ:
the solvent is 4-point
the number of solvent atoms is 4324 (started from Residue #0)
structure last modify date is 20260216
END INITIALIZING SOLVENT LJ
MPI process total: MPI_size=1, PP_MPI_size=1, PM_MPI_size=1
MPI process partition: MPI_rank=0, PP_MPI_rank=0, PM_MPI_rank=0
DOMAIN DECOMPOSITION BEGIN
domain decomposition update_interval = 100
DOMAIN DECOMPOSITION END
nx=1, ny=1, nz=1
pm_nx= 1, pm_ny= 1, pm_nz= 1
max_atom_numbers=4324, max_res_numbers=1081
rank_id=0, atom_numbers=4324, residue_numbers=1081
------------------------------------------------------------------------------------------------------------
step = 1000, time = 2.000, temperature = 308.42,
potential = -10924.47, eff_pot = -1.0924472e+04, LJ_short = 2101.51,
LJ_long = -88.68, LJ = 2012.83, PM = -12937.30,
bond = 0.00,
------------------------------------------------------------------------------------------------------------
step = 50000, time = 100.000, temperature = 305.21,
potential = -11018.82, eff_pot = -1.1018824e+04, LJ_short = 2082.22,
LJ_long = -88.68, LJ = 1993.54, PM = -13012.37,
bond = 0.00,
------------------------------------------------------------------------------------------------------------
Time Summary:
Rank 0 | Initialization | 1.056046 seconds
Rank 0 | Iteration | 3.380093 seconds
Rank 0 | neighbor searching | 5.646920 seconds
Rank 0 | Calculate_Force | 17.161953 seconds
------------------------------------------------------------------------------------------------------------
Stop Wall Time: Thu Jul 16 14:13:38 2026
Core Run Wall Time: 22.457450 seconds
Core Run Speed: 384.735260 ns/day
这就表示运行成功了。
总结概要
分子动力学模拟是基于传统的分子力场,对分子构象进行不断迭代演化的一个过程。虽然计算量相比于量子化学已经缩减了很多,但是由于大型分子体系下近邻表的存在,以及PME算法本身的复杂性,所以实际上分子动力学模拟工具的计算性能,会是使用者最为关注的要点之一。SPONGE版本可以支持GPU加速的分子动力学模拟计算,凭借其极高的效率以及模块化的设计,在一众的分子模拟软件中脱颖而出。本文着重介绍SPONGE-2.0版本的安装与基本使用。
版权声明
本文首发链接为:https://dechinphy.github.io/posts/bfe06f02.html
作者ID:DechinPhy
更多原著文章请参考:https://dechinphy.github.io/