LAMMPS 专题

LAMMPS 键力曲线导出

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

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

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

选择条件#

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

条件目录 主要样式 运行模式
v100-nonlinear-kk-host bond_style nonlinear/kk/host, pair_style lj/cut/kk kokkos
v100-harmonic-shift-kk-host bond_style harmonic/shift/kk/host, pair_style lj/cut/kk kokkos
v100-class2-kk-host bond_style class2/kk/host, pair_style lj/cut/kk kokkos
v100-quartic-exp-kk-host bond_style quartic/exp/kk/host, pair_style lj/cut/kk kokkos
v100-gaussian-kk-host bond_style gaussian/kk/host, pair_style lj/cut/kk kokkos
v100-morse-kk-host bond_style morse/kk/host, pair_style lj/cut/kk kokkos
v100-nonlinear-kk bond_style nonlinear/kk, pair_style lj/cut/kk kokkos
v100-harmonic-restrain-kk bond_style harmonic/restrain/kk, pair_style lj/cut/kk kokkos
v100-harmonic-shift-cut-kk-device bond_style harmonic/shift/cut/kk/device, pair_style lj/cut/kk kokkos
v100-gaussian-kk bond_style gaussian/kk, pair_style lj/cut/kk kokkos
v100-quartic-exp-kk-device bond_style quartic/exp/kk/device, pair_style lj/cut/kk kokkos
v100-harmonic-restrain-kk-device bond_style harmonic/restrain/kk/device, pair_style lj/cut/kk kokkos
v100-class2-kk-device bond_style class2/kk/device, pair_style lj/cut/kk kokkos
v100-fene-expand-kk bond_style fene/expand/kk, pair_style lj/cut/kk kokkos
v100-fene-expand-kk-device bond_style fene/expand/kk/device, pair_style lj/cut/kk kokkos
v100-morse-kk bond_style morse/kk, pair_style lj/cut/kk kokkos
v100-gaussian-kk-device bond_style gaussian/kk/device, pair_style lj/cut/kk kokkos
v100-mm3-kk-device bond_style mm3/kk/device, pair_style lj/cut/kk kokkos
v100-fene-expand-kk-host bond_style fene/expand/kk/host, pair_style lj/cut/kk kokkos
v100-harmonic-shift-cut-kk bond_style harmonic/shift/cut/kk, pair_style lj/cut/kk kokkos
v100-harmonic-restrain-kk-host bond_style harmonic/restrain/kk/host, pair_style lj/cut/kk kokkos
v100-morse-kk-device bond_style morse/kk/device, pair_style lj/cut/kk kokkos
v100-harmonic-shift-cut-kk-host bond_style harmonic/shift/cut/kk/host, pair_style lj/cut/kk kokkos
v100-class2-kk bond_style class2/kk, pair_style lj/cut/kk kokkos
v100-mm3-kk bond_style mm3/kk, pair_style lj/cut/kk kokkos
v100-harmonic-shift-kk-device bond_style harmonic/shift/kk/device, pair_style lj/cut/kk kokkos
v100-nonlinear-kk-device bond_style nonlinear/kk/device, pair_style lj/cut/kk kokkos
v100-mm3-kk-host bond_style mm3/kk/host, pair_style lj/cut/kk kokkos
v100-harmonic-shift-kk bond_style harmonic/shift/kk, pair_style lj/cut/kk kokkos
v100-quartic-exp-kk bond_style quartic/exp/kk, pair_style lj/cut/kk kokkos
p100-mm3-kk bond_style mm3/kk, pair_style lj/cut/kk kokkos
p100-mm3-kk-cpu-reference bond_style mm3, pair_style lj/cut gpu
p100-nonlinear-kk bond_style nonlinear/kk, pair_style lj/cut/kk kokkos
p100-nonlinear-kk-cpu-reference bond_style nonlinear, pair_style lj/cut gpu
p100-gaussian-kk-device bond_style gaussian/kk/device, pair_style lj/cut/kk kokkos
p100-harmonic-shift-kk-device bond_style harmonic/shift/kk/device, pair_style lj/cut/kk kokkos
p100-quartic-exp-kk-device bond_style quartic/exp/kk/device, pair_style lj/cut/kk kokkos
p100-harmonic-shift-kk-host bond_style harmonic/shift/kk/host, pair_style lj/cut/kk kokkos
p100-gaussian-kk-host bond_style gaussian/kk/host, pair_style lj/cut/kk kokkos
p100-fene-expand-kk bond_style fene/expand/kk, pair_style lj/cut/kk kokkos
p100-fene-expand-kk-cpu-reference bond_style fene/expand, pair_style lj/cut gpu
p100-morse-kk-device bond_style morse/kk/device, pair_style lj/cut/kk kokkos
p100-harmonic-restrain-kk-host bond_style harmonic/restrain/kk/host, pair_style lj/cut/kk kokkos
p100-morse-kk bond_style morse/kk, pair_style lj/cut/kk kokkos
p100-morse-kk-cpu-reference bond_style morse, pair_style lj/cut gpu
p100-class2-kk-host bond_style class2/kk/host, pair_style lj/cut/kk kokkos
p100-class2-kk-device bond_style class2/kk/device, pair_style lj/cut/kk kokkos
p100-harmonic-shift-cut-kk-device bond_style harmonic/shift/cut/kk/device, pair_style lj/cut/kk kokkos
p100-gaussian-kk bond_style gaussian/kk, pair_style lj/cut/kk kokkos
p100-gaussian-kk-cpu-reference bond_style gaussian, pair_style lj/cut gpu
p100-harmonic-restrain-kk bond_style harmonic/restrain/kk, pair_style lj/cut/kk kokkos
p100-harmonic-restrain-kk-cpu-reference bond_style harmonic/restrain, pair_style lj/cut gpu
p100-harmonic-shift-cut-kk-host bond_style harmonic/shift/cut/kk/host, pair_style lj/cut/kk kokkos
p100-mm3-kk-device bond_style mm3/kk/device, pair_style lj/cut/kk kokkos
p100-quartic-exp-kk-host bond_style quartic/exp/kk/host, pair_style lj/cut/kk kokkos
p100-nonlinear-kk-host bond_style nonlinear/kk/host, pair_style lj/cut/kk kokkos
p100-harmonic-shift-kk bond_style harmonic/shift/kk, pair_style lj/cut/kk kokkos
p100-harmonic-shift-kk-cpu-reference bond_style harmonic/shift, pair_style lj/cut gpu
p100-harmonic-restrain-kk-device bond_style harmonic/restrain/kk/device, pair_style lj/cut/kk kokkos
p100-nonlinear-kk-device bond_style nonlinear/kk/device, pair_style lj/cut/kk kokkos
p100-quartic-exp-kk bond_style quartic/exp/kk, pair_style lj/cut/kk kokkos
p100-quartic-exp-kk-cpu-reference bond_style quartic/exp, pair_style lj/cut gpu
p100-fene-expand-kk-host bond_style fene/expand/kk/host, pair_style lj/cut/kk kokkos
p100-class2-kk bond_style class2/kk, pair_style lj/cut/kk kokkos
p100-class2-kk-cpu-reference bond_style class2, pair_style lj/cut gpu
p100-fene-expand-kk-device bond_style fene/expand/kk/device, pair_style lj/cut/kk kokkos
p100-harmonic-shift-cut-kk bond_style harmonic/shift/cut/kk, pair_style lj/cut/kk kokkos
p100-harmonic-shift-cut-kk-cpu-reference bond_style harmonic/shift/cut, pair_style lj/cut gpu
p100-morse-kk-host bond_style morse/kk/host, pair_style lj/cut/kk kokkos
p100-mm3-kk-host bond_style mm3/kk/host, pair_style lj/cut/kk kokkos

输入与提交#

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

clear
units real
atom_style full
boundary f f f
read_data model.data
special_bonds lj/coul 0.0 1.0 1.0
bond_style nonlinear/kk/host
bond_coeff 1 10.0 1.5 0.8
pair_style lj/cut/kk 4.0
pair_coeff * * 0.0 1.0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
group moving id 2
thermo 1
thermo_style custom step atoms pe ebond
thermo_modify norm no format float %.16e
run 0
# Initialize each harmonic/restrain reference at exactly1.5Angstrom, then distort.
displace_atoms moving move -0.3000000000000000 0.0 0.0 units box
run 0
print "1.20000000 $(ebond:%.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
special_bonds lj/coul 0.0 1.0 1.0
bond_style nonlinear/kk/host
bond_coeff 1 10.0 1.5 0.8
pair_style lj/cut/kk 4.0
pair_coeff * * 0.0 1.0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
group moving id 2
thermo 1
thermo_style custom step atoms pe ebond
thermo_modify norm no format float %.16e
run 0
# Initialize each harmonic/restrain reference at exactly1.5Angstrom, then distort.
displace_atoms moving move -0.1499999999999999 0.0 0.0 units box
run 0
print "1.35000000 $(ebond:%.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
special_bonds lj/coul 0.0 1.0 1.0
bond_style nonlinear/kk/host
bond_coeff 1 10.0 1.5 0.8
pair_style lj/cut/kk 4.0
# 完整输入见附件

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

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

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

lmp -k on g 1 -sf kk -pk kokkos newton on neigh half gpu/aware off -echo both -in in.lammps > native.out

查看输出#

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

cd work-new/v100-nonlinear-kk-host
tail -n 35 native.out

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

Loop time of 0.000179378 on 1 procs for 0 steps with 2 atoms
Loop time of 0.000175823 on 1 procs for 0 steps with 2 atoms
Loop time of 0.000178574 on 1 procs for 0 steps with 2 atoms
Loop time of 0.000171719 on 1 procs for 0 steps with 2 atoms
Loop time of 0.000184902 on 1 procs for 0 steps with 2 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_bond    
         0           2  0.0000000000000000e+00 0.0000000000000000e+00
Loop time of 0.00019753 on 1 procs for 0 steps with 2 atoms

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

查看配图

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

100%查看原图 ↗