LAMMPS 专题

LAMMPS 成键相互作用的 CPU 加速后缀

用实际完成的 LAMMPS 输入展示参数、提交和结果文件,附各条件的操作记录。

更新于 2026-11-18约 10 分钟阅读按任务与环境选择适用配置
阅读本篇目录

下载输入、Slurm 作业与实际结果。本例使用 LAMMPS 30 Sep 2026 的 P100 构建。附件保存 43 个已完成条件,按输入保留相互作用与操作参数。

选择条件#

解压并进入 lammps-bonded-cpu-suffixes-operations。CASES 每行对应一个作业数组索引,inputs 保存条件输入,reference 保存实际输出。gpu 条件使用 GPU 构建,其中普通 CPU 样式按输入直接运行;kokkos 条件启用 Kokkos。

条件目录 主要样式 运行模式
corrected-CHARMMFSW-cases-dihedral-charmmfsw-omp dihedral_style charmmfsw/omp, pair_style lj/charmmfsw/coul/charmmfsh gpu
cases-angle-fourier-simple-omp angle_style fourier/simple/omp, pair_style lj/cut gpu
cases-dihedral-helix-omp dihedral_style helix/omp, pair_style lj/cut gpu
cases-angle-cosine-shift-exp-omp angle_style cosine/shift/exp/omp, pair_style lj/cut gpu
cases-bond-nonlinear-omp bond_style nonlinear/omp, pair_style lj/cut gpu
cases-angle-mwlc-omp angle_style mwlc/omp, pair_style lj/cut gpu
cases-bond-morse-omp bond_style morse/omp, pair_style lj/cut gpu
cases-angle-quartic-omp angle_style quartic/omp, pair_style lj/cut gpu
cases-bond-gaussian-omp bond_style gaussian/omp, pair_style lj/cut gpu
cases-bond-class2-omp bond_style class2/omp, pair_style lj/cut gpu
cases-angle-cosine-squared-omp angle_style cosine/squared/omp, pair_style lj/cut gpu
cases-angle-fourier-omp angle_style fourier/omp, pair_style lj/cut gpu
cases-dihedral-spherical-omp dihedral_style spherical/omp, pair_style lj/cut gpu
cases-dihedral-nharmonic-omp dihedral_style nharmonic/omp, pair_style lj/cut gpu
cases-angle-cross-omp angle_style cross/omp, pair_style lj/cut gpu
cases-bond-harmonic-shift-cut-omp bond_style harmonic/shift/cut/omp, pair_style lj/cut gpu
cases-dihedral-charmm-intel dihedral_style charmm/intel, pair_style lj/cut/intel gpu
cases-angle-cosine-periodic-omp angle_style cosine/periodic/omp, pair_style lj/cut gpu
cases-dihedral-multi-harmonic-omp dihedral_style multi/harmonic/omp, pair_style lj/cut gpu
cases-bond-mm3-omp bond_style mm3/omp, pair_style lj/cut gpu
cases-angle-cosine-omp angle_style cosine/omp, pair_style lj/cut gpu
cases-angle-mm3-omp angle_style mm3/omp, pair_style lj/cut gpu
cases-angle-cosine-delta-omp angle_style cosine/delta/omp, pair_style lj/cut gpu
cases-bond-fene-expand-omp bond_style fene/expand/omp, pair_style lj/cut gpu
cases-angle-gaussian-omp angle_style gaussian/omp, pair_style lj/cut gpu
cases-dihedral-fourier-intel dihedral_style fourier/intel, pair_style lj/cut/intel gpu
cases-dihedral-fourier-omp dihedral_style fourier/omp, pair_style lj/cut gpu
cases-dihedral-cosine-shift-exp-omp dihedral_style cosine/shift/exp/omp, pair_style lj/cut gpu
cases-dihedral-opls-intel dihedral_style opls/intel, pair_style lj/cut/intel gpu
cases-dihedral-harmonic-intel dihedral_style harmonic/intel, pair_style lj/cut/intel gpu
cases-dihedral-opls-omp dihedral_style opls/omp, pair_style lj/cut gpu
cases-dihedral-class2-omp dihedral_style class2/omp, pair_style lj/cut gpu
cases-angle-class2-omp angle_style class2/omp, pair_style lj/cut gpu
cases-bond-harmonic-shift-omp bond_style harmonic/shift/omp, pair_style lj/cut gpu
cases-angle-charmm-omp angle_style charmm/omp, pair_style lj/cut gpu
cases-angle-cosine-squared-restricted-omp angle_style cosine/squared/restricted/omp, pair_style lj/cut gpu
cases-dihedral-cosine-squared-restricted-omp dihedral_style cosine/squared/restricted/omp, pair_style lj/cut gpu
cases-bond-harmonic-restrain-omp bond_style harmonic/restrain/omp, pair_style lj/cut gpu
cases-dihedral-quadratic-omp dihedral_style quadratic/omp, pair_style lj/cut gpu
cases-angle-cosine-shift-omp angle_style cosine/shift/omp, pair_style lj/cut gpu
cases-dihedral-charmm-omp dihedral_style charmm/omp, pair_style lj/cut gpu
cases-dihedral-harmonic-omp dihedral_style harmonic/omp, pair_style lj/cut gpu
cases-angle-charmm-intel angle_style charmm/intel, pair_style lj/cut/intel gpu

输入与提交#

第一组的输入如下。单位、边界条件和参数以对应 in.lammps 为准。

clear
units real
atom_style full
boundary f f f
read_data model.data
dihedral_style charmmfsw/omp
dihedral_coeff 1 2.0 3 180 0.0

pair_style lj/charmmfsw/coul/charmmfsh 3.0 4.0
pair_coeff * * 0.0 1.0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
group moving id 4
displace_atoms moving move 0.0 -2.7990381056766580 -0.7499999999999999 units box
thermo 1
thermo_style custom step atoms pe edihed
thermo_modify norm no format float %.16e
run 0
print "-150.00000000 $(edihed:%.16e)" append energies.dat screen no
write_dump all custom forces-00.dump id type x y z fx fy fz modify sort id

clear
units real
atom_style full
boundary f f f
read_data model.data
dihedral_style charmmfsw/omp
dihedral_coeff 1 2.0 3 180 0.0

pair_style lj/charmmfsw/coul/charmmfsh 3.0 4.0
pair_coeff * * 0.0 1.0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
group moving id 4
displace_atoms moving move 0.0 -1.1117714323462189 -1.4488887394336025 units box
thermo 1
thermo_style custom step atoms pe edihed
thermo_modify norm no format float %.16e
run 0
print "-75.00000000 $(edihed:%.16e)" append energies.dat screen no
write_dump all custom forces-01.dump id type x y z fx fy fz modify sort id

clear
units real
atom_style full
boundary f f f
read_data model.data
dihedral_style charmmfsw/omp
dihedral_coeff 1 2.0 3 180 0.0

pair_style lj/charmmfsw/coul/charmmfsh 3.0 4.0
pair_coeff * * 0.0 1.0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
group moving id 4
# 完整输入见附件

在附件根目录提交第一组或所选条件。

sbatch --array=0 run.slurm
# 按 CASES 的完整列表提交
sbatch run.slurm

脚本申请一个 MPI 任务、一个 CPU 核和一张 P100,根据 MODES 加载对应模块。实际调用保存在 cases.json,例如第一组的命令参数为:

lmp -k off -pk omp 1 -echo both -in in.lammps > native.out

查看输出#

结果写入 work-new/条件名。先查看日志中的实际热力学表与结束信息。

cd work-new/corrected-CHARMMFSW-cases-dihedral-charmmfsw-omp
tail -n 35 native.out

本次第一组的原生日志片段如下。

Loop time of 2.919e-06 on 2 procs for 0 steps with 4 atoms
Loop time of 2.28e-06 on 2 procs for 0 steps with 4 atoms
Loop time of 2.129e-06 on 2 procs for 0 steps with 4 atoms
Loop time of 2.17e-06 on 2 procs for 0 steps with 4 atoms
Loop time of 2.199e-06 on 2 procs for 0 steps with 4 atoms
Total wall time: 0:00:00

原始输入若包含 dump、数据表或其他导出命令,相应文件会保存在该条件目录。附件提供的参考数据文件为 energies.dat, forces-00.dump, forces-01.dump, forces-02.dump, forces-03.dump, forces-04.dump。按自己的体系修改输入时,保留对应势函数文件、单位和原子样式设置。

再次运行前,将已有的同名 work-new 条件目录改名保存。

本次输出示例#

第一组原生热力学输出的开头如下,列名由该组输入的 thermo_style 设置。

   Step        Atoms        PotEng        E_dihed    
         0           4  2.0000000000000000e+00 2.0000000000000000e+00
Loop time of 2.919e-06 on 2 procs for 0 steps with 4 atoms

需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。

查看配图

放大后可滚动查看细节,按 Esc 关闭。

100%查看原图 ↗