LAMMPS 角势与 Kokkos 操作
用实际完成的 LAMMPS 输入展示参数、提交和结果文件,附各条件的操作记录。
阅读本篇目录
下载输入、Slurm 作业与实际结果。本例使用 LAMMPS 30 Sep 2026 的 P100 构建。附件保存 69 个已完成条件,按输入保留相互作用与操作参数。
选择条件#
解压并进入 lammps-all-angle-kokkos-operations。CASES 每行对应一个作业数组索引,inputs 保存条件输入,reference 保存实际输出。gpu 条件使用 GPU 构建,其中普通 CPU 样式按输入直接运行;kokkos 条件启用 Kokkos。
| 条件目录 | 主要样式 | 运行模式 |
|---|---|---|
p100-mm3 |
bond_style zero, angle_style mm3/kk, pair_style zero |
kokkos |
p100-mm3-cpu-reference |
bond_style zero, angle_style mm3, pair_style zero |
gpu |
p100-cosine_squared |
bond_style zero, angle_style cosine/squared/kk, pair_style zero |
kokkos |
p100-cosine_squared-cpu-reference |
bond_style zero, angle_style cosine/squared, pair_style zero |
gpu |
p100-class2xe |
bond_style zero, angle_style class2xe/kk, pair_style zero |
kokkos |
p100-class2xe-cpu-reference |
bond_style zero, angle_style class2xe, pair_style zero |
gpu |
p100-harmonic |
bond_style zero, angle_style harmonic/kk, pair_style zero |
kokkos |
p100-harmonic-cpu-reference |
bond_style zero, angle_style harmonic, pair_style zero |
gpu |
p100-cosine_squared_restricted |
bond_style zero, angle_style cosine/squared/restricted/kk, pair_style zero |
kokkos |
p100-cosine_squared_restricted-cpu-reference |
bond_style zero, angle_style cosine/squared/restricted, pair_style zero |
gpu |
p100-cosine_periodic |
bond_style zero, angle_style cosine/periodic/kk, pair_style zero |
kokkos |
p100-cosine_periodic-cpu-reference |
bond_style zero, angle_style cosine/periodic, pair_style zero |
gpu |
p100-class2 |
bond_style zero, angle_style class2/kk, pair_style zero |
kokkos |
p100-class2-cpu-reference |
bond_style zero, angle_style class2, pair_style zero |
gpu |
p100-cosine_delta |
bond_style zero, angle_style cosine/delta/kk, pair_style zero |
kokkos |
p100-cosine_delta-cpu-reference |
bond_style zero, angle_style cosine/delta, pair_style zero |
gpu |
p100-cross |
bond_style zero, angle_style cross/kk, pair_style zero |
kokkos |
p100-cross-cpu-reference |
bond_style zero, angle_style cross, pair_style zero |
gpu |
p100-cosine_shift_exp |
bond_style zero, angle_style cosine/shift/exp/kk, pair_style zero |
kokkos |
p100-cosine_shift_exp-cpu-reference |
bond_style zero, angle_style cosine/shift/exp, pair_style zero |
gpu |
p100-charmm |
bond_style zero, angle_style charmm/kk, pair_style zero |
kokkos |
p100-charmm-cpu-reference |
bond_style zero, angle_style charmm, pair_style zero |
gpu |
p100-gaussian |
bond_style zero, angle_style gaussian/kk, pair_style zero |
kokkos |
p100-gaussian-cpu-reference |
bond_style zero, angle_style gaussian, pair_style zero |
gpu |
p100-mwlc |
bond_style zero, angle_style mwlc/kk, pair_style zero |
kokkos |
p100-mwlc-cpu-reference |
bond_style zero, angle_style mwlc, pair_style zero |
gpu |
p100-fourier |
bond_style zero, angle_style fourier/kk, pair_style zero |
kokkos |
p100-fourier-cpu-reference |
bond_style zero, angle_style fourier, pair_style zero |
gpu |
p100-spica |
bond_style zero, angle_style spica/kk, pair_style lj/spica/kk |
kokkos |
p100-spica-cpu-reference |
bond_style zero, angle_style spica, pair_style lj/spica |
gpu |
p100-sdk |
bond_style zero, angle_style sdk/kk, pair_style lj/spica/kk |
kokkos |
p100-sdk-cpu-reference |
bond_style zero, angle_style sdk, pair_style lj/spica |
gpu |
p100-quartic |
bond_style zero, angle_style quartic/kk, pair_style zero |
kokkos |
p100-quartic-cpu-reference |
bond_style zero, angle_style quartic, pair_style zero |
gpu |
p100-table |
bond_style zero, angle_style table/kk, pair_style zero |
kokkos |
p100-table-cpu-reference |
bond_style zero, angle_style table, pair_style zero |
gpu |
p100-fourier_simple |
bond_style zero, angle_style fourier/simple/kk, pair_style zero |
kokkos |
p100-fourier_simple-cpu-reference |
bond_style zero, angle_style fourier/simple, pair_style zero |
gpu |
p100-hybrid |
bond_style zero, angle_style hybrid/kk, pair_style zero |
kokkos |
p100-hybrid-cpu-reference |
bond_style zero, angle_style hybrid, pair_style zero |
gpu |
p100-cosine |
bond_style zero, angle_style cosine/kk, pair_style zero |
kokkos |
p100-cosine-cpu-reference |
bond_style zero, angle_style cosine, pair_style zero |
gpu |
p100-class2_p6 |
bond_style zero, angle_style class2/p6/kk, pair_style zero |
kokkos |
p100-class2_p6-cpu-reference |
bond_style zero, angle_style class2/p6, pair_style zero |
gpu |
p100-cosine_shift |
bond_style zero, angle_style cosine/shift/kk, pair_style zero |
kokkos |
p100-cosine_shift-cpu-reference |
bond_style zero, angle_style cosine/shift, pair_style zero |
gpu |
v100-class2_p6 |
bond_style zero, angle_style class2/p6/kk, pair_style zero |
kokkos |
v100-gaussian |
bond_style zero, angle_style gaussian/kk, pair_style zero |
kokkos |
v100-cosine_squared_restricted |
bond_style zero, angle_style cosine/squared/restricted/kk, pair_style zero |
kokkos |
v100-cosine_squared |
bond_style zero, angle_style cosine/squared/kk, pair_style zero |
kokkos |
v100-cosine_delta |
bond_style zero, angle_style cosine/delta/kk, pair_style zero |
kokkos |
v100-class2 |
bond_style zero, angle_style class2/kk, pair_style zero |
kokkos |
v100-sdk |
bond_style zero, angle_style sdk/kk, pair_style lj/spica/kk |
kokkos |
v100-class2xe |
bond_style zero, angle_style class2xe/kk, pair_style zero |
kokkos |
v100-harmonic |
bond_style zero, angle_style harmonic/kk, pair_style zero |
kokkos |
v100-table |
bond_style zero, angle_style table/kk, pair_style zero |
kokkos |
v100-charmm |
bond_style zero, angle_style charmm/kk, pair_style zero |
kokkos |
v100-cosine_shift_exp |
bond_style zero, angle_style cosine/shift/exp/kk, pair_style zero |
kokkos |
v100-fourier |
bond_style zero, angle_style fourier/kk, pair_style zero |
kokkos |
v100-spica |
bond_style zero, angle_style spica/kk, pair_style lj/spica/kk |
kokkos |
v100-fourier_simple |
bond_style zero, angle_style fourier/simple/kk, pair_style zero |
kokkos |
v100-quartic |
bond_style zero, angle_style quartic/kk, pair_style zero |
kokkos |
v100-mm3 |
bond_style zero, angle_style mm3/kk, pair_style zero |
kokkos |
v100-hybrid |
bond_style zero, angle_style hybrid/kk, pair_style zero |
kokkos |
v100-cross |
bond_style zero, angle_style cross/kk, pair_style zero |
kokkos |
v100-cosine_periodic |
bond_style zero, angle_style cosine/periodic/kk, pair_style zero |
kokkos |
v100-mwlc |
bond_style zero, angle_style mwlc/kk, pair_style zero |
kokkos |
v100-cosine_shift |
bond_style zero, angle_style cosine/shift/kk, pair_style zero |
kokkos |
v100-cosine |
bond_style zero, angle_style cosine/kk, pair_style zero |
kokkos |
输入与提交#
第一组的输入如下。单位、边界条件和参数以对应 in.lammps 为准。
units metal
atom_style full
atom_modify map array
boundary f f f
bond_style zero
angle_style mm3/kk
read_data model.data
bond_coeff 1
angle_coeff 1 100.0 107.0
pair_style zero 10.0
pair_coeff * *
special_bonds lj/coul 0 0 0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
thermo_style custom step atoms pe eangle
thermo_modify norm no format float %.16g
set atom 3 x 0.4104241719908026 y 1.12763114494309 z 0
run 0
print "70.0 -1 0.0 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-00.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.4103241719908026 y 1.12763114494309 z 0
run 0
print "70.0 0 -0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-01.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.4105241719908025 y 1.12763114494309 z 0
run 0
print "70.0 0 0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-02.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.4104241719908026 y 1.12753114494309 z 0
run 0
print "70.0 1 -0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-03.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.4104241719908026 y 1.12773114494309 z 0
run 0
print "70.0 1 0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-04.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.4104241719908026 y 1.12763114494309 z -0.0001
run 0
print "70.0 2 -0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-05.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.4104241719908026 y 1.12763114494309 z 0.0001
run 0
print "70.0 2 0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-06.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 7.347880794884119e-17 y 1.2 z 0
run 0
print "90.0 -1 0.0 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-07.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x -9.999999999992652e-05 y 1.2 z 0
run 0
print "90.0 0 -0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-08.dump id type x y z fx fy fz modify sort id format float %.16g
set atom 3 x 0.0001000000000000735 y 1.2 z 0
run 0
print "90.0 0 0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
# 完整输入见附件
在附件根目录提交第一组或所选条件。
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/p100-mm3
tail -n 35 native.out
本次第一组的原生日志片段如下。
Loop time of 0.000725073 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000881057 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000662809 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000658024 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000645906 on 1 procs for 0 steps with 3 atoms
Total wall time: 0:00:01
原始输入若包含 dump、数据表或其他导出命令,相应文件会保存在该条件目录。附件提供的参考数据文件为 energy.dat, forces-00.dump, forces-01.dump, forces-02.dump, forces-03.dump, forces-04.dump。按自己的体系修改输入时,保留对应势函数文件、单位和原子样式设置。
再次运行前,将已有的同名 work-new 条件目录改名保存。
本次输出示例#
第一组原生热力学输出的开头如下,列名由该组输入的 thermo_style 设置。
Step Atoms PotEng E_angle
0 3 69.69895991656712 69.69895991656712
Loop time of 0.000823785 on 1 procs for 0 steps with 3 atoms
需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。