LAMMPS 专题

LAMMPS GPU 软核、MSM 与 DPD

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

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

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

选择条件#

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

条件目录 主要样式 运行模式
v100-soft-long-full-kspace-GPU pair_style lj/cut/coul/long/soft/gpu, kspace_style ewald gpu
v100-MSM-full-kspace-GPU pair_style lj/cut/coul/msm/gpu, kspace_style msm gpu
p100-soft-long-full-kspace-CPU pair_style lj/cut/coul/long/soft, kspace_style ewald gpu
p100-soft-cut-GPU-reuse-CPU-reference pair_style lj/cut/coul/cut/soft/gpu gpu
p100-MSM-full-kspace-CPU pair_style lj/cut/coul/msm, kspace_style msm gpu
p100-DPD-Slater-GPU-electrolyte pair_style dpd/coul/slater/long/gpu, kspace_style pppm, fix nve, compute property/atom, compute reduce, fix ave/time, dump custom gpu

输入与提交#

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

units metal
atom_style charge
boundary p p p
atom_modify map array
newton off
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
set atom 1 charge .2
set atom 2 charge -.2
neighbor .3 bin
neigh_modify every 1 delay 0 check yes
pair_style lj/cut/coul/long/soft/gpu 2.0 .5 10.0 9.5
pair_coeff * * .28 3.1 .5
pair_modify table 0
kspace_style ewald 1e-6
kspace_modify gewald .3
thermo 1
thermo_style custom step atoms pe evdwl ecoul elong
thermo_modify norm no format float %.16e
set atom 2 x 1.1999000000
run 0
print "1.2000000000 -0.0001000000 1.1999000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-0.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 1.2000000000
run 0
print "1.2000000000 0.0000000000 1.2000000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-1.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 1.2001000000
run 0
print "1.2000000000 0.0001000000 1.2001000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-2.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 1.4999000000
run 0
print "1.5000000000 -0.0001000000 1.4999000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-3.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 1.5000000000
run 0
print "1.5000000000 0.0000000000 1.5000000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-4.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 1.5001000000
run 0
print "1.5000000000 0.0001000000 1.5001000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-5.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 1.9999000000
run 0
print "2.0000000000 -0.0001000000 1.9999000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-6.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 2.0000000000
run 0
print "2.0000000000 0.0000000000 2.0000000000 $(pe:%.16e) $(fx[1]:%.16e)" append energy-force.dat screen no
write_dump all custom forces-7.dump id type q x y z fx fy fz modify sort id format float %.16e
set atom 2 x 2.0001000000
# 完整输入见附件

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

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

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

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

查看输出#

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

cd work-new/v100-soft-long-full-kspace-GPU
tail -n 35 native.out

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

Loop time of 1.168e-06 on 1 procs for 0 steps with 2 atoms
Loop time of 1.187e-06 on 1 procs for 0 steps with 2 atoms
Loop time of 1.172e-06 on 1 procs for 0 steps with 2 atoms
Loop time of 1.162e-06 on 1 procs for 0 steps with 2 atoms
Loop time of 1.164e-06 on 1 procs for 0 steps with 2 atoms
Total wall time: 0:00:00

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

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

本次输出示例#

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

   Step        Atoms        PotEng         E_vdwl         E_coul         E_long    
         0           2  1.4580777610647992e+01 1.4812061309814453e+01 -4.4304184615612030e-02 -1.8697951455084857e-01
Loop time of 3.176e-06 on 1 procs for 0 steps with 2 atoms

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

查看配图

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

100%查看原图 ↗