LAMMPS 扩展对势的 Kokkos 操作
用实际完成的 LAMMPS 输入展示参数、提交和结果文件,附各条件的操作记录。
阅读本篇目录
下载输入、Slurm 作业与实际结果。本例使用 LAMMPS 30 Sep 2026 的 P100 构建。附件保存 72 个已完成条件,按输入保留相互作用与操作参数。
选择条件#
解压并进入 lammps-pair-kokkos-expanded-operations。CASES 每行对应一个作业数组索引,inputs 保存条件输入,reference 保存实际输出。gpu 条件使用 GPU 构建,其中普通 CPU 样式按输入直接运行;kokkos 条件启用 Kokkos。
| 条件目录 | 主要样式 | 运行模式 |
|---|---|---|
v100-007-lj_cubic |
pair_style lj/cubic/kk |
kokkos |
v100-027-lj_cut_coul_cut_soft |
pair_style lj/cut/coul/cut/soft/kk |
kokkos |
v100-015-mie_cut |
pair_style mie/cut/kk |
kokkos |
v100-013-lj_smooth_linear |
pair_style lj/smooth/linear/kk |
kokkos |
v100-017-nm_cut |
pair_style nm/cut/kk |
kokkos |
v100-030-coul_dsf |
pair_style coul/dsf/kk |
kokkos |
v100-024-lj_class2_coul_cut |
pair_style lj/class2/coul/cut/kk |
kokkos |
v100-025-lj_class2_coul_long |
pair_style lj/class2/coul/long/kk, kspace_style pppm |
kokkos |
v100-008-lj_gromacs |
pair_style lj/gromacs/kk |
kokkos |
v100-033-coul_slater_cut |
pair_style coul/slater/cut/kk |
kokkos |
v100-028-coul_cut |
pair_style coul/cut/kk |
kokkos |
v100-032-coul_wolf |
pair_style coul/wolf/kk |
kokkos |
v100-026-lj_cut_soft |
pair_style lj/cut/soft/kk |
kokkos |
v100-006-lennard_mdf |
pair_style lennard/mdf/kk |
kokkos |
v100-001-born_gauss |
pair_style born/gauss/kk |
kokkos |
v100-010-lj_mdf |
pair_style lj/mdf/kk |
kokkos |
v100-019-nm_cut_coul_cut |
pair_style nm/cut/coul/cut/kk |
kokkos |
v100-014-lj96_cut |
pair_style lj96/cut/kk |
kokkos |
v100-005-harmonic_cut |
pair_style harmonic/cut/kk |
kokkos |
v100-020-nm_cut_coul_long |
pair_style nm/cut/coul/long/kk, kspace_style pppm |
kokkos |
v100-022-wf_cut |
pair_style wf/cut/kk |
kokkos |
v100-034-coul_slater_long |
pair_style coul/slater/long/kk, kspace_style pppm |
kokkos |
v100-004-gauss_cut |
pair_style gauss/cut/kk |
kokkos |
v100-016-morse_smooth_linear |
pair_style morse/smooth/linear/kk |
kokkos |
v100-021-ufm |
pair_style ufm/kk |
kokkos |
v100-003-cosine_squared |
pair_style cosine/squared/kk |
kokkos |
v100-018-nm_cut_split |
pair_style nm/cut/split/kk |
kokkos |
v100-012-lj_smooth |
pair_style lj/smooth/kk |
kokkos |
v100-009-lj_gromacs_coul_gromacs |
pair_style lj/gromacs/coul/gromacs/kk |
kokkos |
v100-002-buck_mdf |
pair_style buck/mdf/kk |
kokkos |
v100-023-lj_class2 |
pair_style lj/class2/kk |
kokkos |
v100-031-coul_long |
pair_style coul/long/kk, kspace_style pppm |
kokkos |
v100-000-beck |
pair_style beck/kk |
kokkos |
v100-035-coul_diel |
pair_style coul/diel/kk |
kokkos |
v100-029-coul_debye |
pair_style coul/debye/kk |
kokkos |
v100-011-lj_pirani |
pair_style lj/pirani/kk |
kokkos |
p100-035-coul_diel |
pair_style coul/diel/kk |
kokkos |
p100-017-nm_cut |
pair_style nm/cut/kk |
kokkos |
p100-031-coul_long |
pair_style coul/long/kk, kspace_style pppm |
kokkos |
p100-000-beck |
pair_style beck/kk |
kokkos |
p100-006-lennard_mdf |
pair_style lennard/mdf/kk |
kokkos |
p100-023-lj_class2 |
pair_style lj/class2/kk |
kokkos |
p100-008-lj_gromacs |
pair_style lj/gromacs/kk |
kokkos |
p100-007-lj_cubic |
pair_style lj/cubic/kk |
kokkos |
p100-001-born_gauss |
pair_style born/gauss/kk |
kokkos |
p100-016-morse_smooth_linear |
pair_style morse/smooth/linear/kk |
kokkos |
p100-030-coul_dsf |
pair_style coul/dsf/kk |
kokkos |
p100-011-lj_pirani |
pair_style lj/pirani/kk |
kokkos |
p100-026-lj_cut_soft |
pair_style lj/cut/soft/kk |
kokkos |
p100-004-gauss_cut |
pair_style gauss/cut/kk |
kokkos |
p100-009-lj_gromacs_coul_gromacs |
pair_style lj/gromacs/coul/gromacs/kk |
kokkos |
p100-018-nm_cut_split |
pair_style nm/cut/split/kk |
kokkos |
p100-005-harmonic_cut |
pair_style harmonic/cut/kk |
kokkos |
p100-028-coul_cut |
pair_style coul/cut/kk |
kokkos |
p100-015-mie_cut |
pair_style mie/cut/kk |
kokkos |
p100-033-coul_slater_cut |
pair_style coul/slater/cut/kk |
kokkos |
p100-019-nm_cut_coul_cut |
pair_style nm/cut/coul/cut/kk |
kokkos |
p100-010-lj_mdf |
pair_style lj/mdf/kk |
kokkos |
p100-013-lj_smooth_linear |
pair_style lj/smooth/linear/kk |
kokkos |
p100-012-lj_smooth |
pair_style lj/smooth/kk |
kokkos |
p100-022-wf_cut |
pair_style wf/cut/kk |
kokkos |
p100-021-ufm |
pair_style ufm/kk |
kokkos |
p100-025-lj_class2_coul_long |
pair_style lj/class2/coul/long/kk, kspace_style pppm |
kokkos |
p100-032-coul_wolf |
pair_style coul/wolf/kk |
kokkos |
p100-014-lj96_cut |
pair_style lj96/cut/kk |
kokkos |
p100-029-coul_debye |
pair_style coul/debye/kk |
kokkos |
p100-024-lj_class2_coul_cut |
pair_style lj/class2/coul/cut/kk |
kokkos |
p100-003-cosine_squared |
pair_style cosine/squared/kk |
kokkos |
p100-002-buck_mdf |
pair_style buck/mdf/kk |
kokkos |
p100-034-coul_slater_long |
pair_style coul/slater/long/kk, kspace_style pppm |
kokkos |
p100-020-nm_cut_coul_long |
pair_style nm/cut/coul/long/kk, kspace_style pppm |
kokkos |
p100-027-lj_cut_coul_cut_soft |
pair_style lj/cut/coul/cut/soft/kk |
kokkos |
输入与提交#
第一组的输入如下。单位、边界条件和参数以对应 in.lammps 为准。
units metal
atom_style charge
boundary p p p
atom_modify map array
region box block -20 20 -20 20 -20 20
create_box 1 box
create_atoms 1 single 0 0 0 units box
create_atoms 1 single 1.2 0 0 units box
mass 1 1.0
pair_style lj/cubic/kk
pair_coeff * * 1.0 0.8908987
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
thermo_style custom step atoms pe press
thermo_modify norm no format float %.16g
set atom 2 x 1.1999000000
run 0
print "1.2000000000 -0.0001000000 1.1999000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-00.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 1.2000000000
run 0
print "1.2000000000 0.0000000000 1.2000000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-01.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 1.2001000000
run 0
print "1.2000000000 0.0001000000 1.2001000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-02.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 1.4999000000
run 0
print "1.5000000000 -0.0001000000 1.4999000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-03.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 1.5000000000
run 0
print "1.5000000000 0.0000000000 1.5000000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-04.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 1.5001000000
run 0
print "1.5000000000 0.0001000000 1.5001000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-05.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 1.9999000000
run 0
print "2.0000000000 -0.0001000000 1.9999000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-06.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 2.0000000000
run 0
print "2.0000000000 0.0000000000 2.0000000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-07.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 2.0001000000
run 0
print "2.0000000000 0.0001000000 2.0001000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-08.dump id type q x y z fx fy fz modify sort id format float %.16g
set atom 2 x 2.4999000000
run 0
print "2.5000000000 -0.0001000000 2.4999000000 $(pe:%.16g) $(fcm(all,x):%.16g)" append energy.dat screen no
write_dump all custom forces-09.dump id type q x y z fx fy fz modify sort id format float %.16g
# 完整输入见附件
在附件根目录提交第一组或所选条件。
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-007-lj_cubic
tail -n 35 native.out
本次第一组的原生日志片段如下。
Loop time of 3.6844e-05 on 1 procs for 0 steps with 2 atoms
Loop time of 3.5746e-05 on 1 procs for 0 steps with 2 atoms
Loop time of 3.6599e-05 on 1 procs for 0 steps with 2 atoms
Loop time of 3.6989e-05 on 1 procs for 0 steps with 2 atoms
Loop time of 3.6477e-05 on 1 procs for 0 steps with 2 atoms
Total wall time: 0:00:00
原始输入若包含 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 Press
0 2 -0.5451520504951498 -25.76977001388876
Loop time of 3.3973e-05 on 1 procs for 0 steps with 2 atoms
需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。