LAMMPS 专题

LAMMPS 显式加速后缀与生效样式

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

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

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

选择条件#

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

条件目录 主要样式 运行模式
p100-hybrid-omp bond_style harmonic, angle_style harmonic, dihedral_style opls, pair_style hybrid/overlay, kspace_style pppm, fix drude, fix shake, fix tgnpt/drude, compute temp/drude, fix ave/time, compute property/atom, dump custom gpu
p100-cmap-pppm pair_style lj/charmmfsw/coul/long/kk, kspace_style pppm, bond_style harmonic, angle_style charmm, dihedral_style charmmfsw, improper_style harmonic, fix cmap, fix shake, fix nvt kokkos
p100-spring pair_style lj/charmm/coul/long/kk, bond_style harmonic, angle_style charmm, dihedral_style charmm, improper_style harmonic, kspace_style pppm, fix nvt, fix spring, fix shake kokkos
p100-qeq pair_style reaxff/kk, compute property/atom, compute reduce, fix nve, fix qeq/reax kokkos
p100-deform pair_style zero, fix deform, compute temp/kk, compute temp/deform/kk kokkos
p100-efield pair_style reaxff/kk, fix acks2/reaxff/kk, fix nvt, fix efield, fix wall/reflect, compute property/atom, compute reduce, dump custom kokkos
p100-enforce2d pair_style colloid/kk, fix npt, fix enforce2d kokkos
v100-spring pair_style lj/charmm/coul/long/kk, bond_style harmonic, angle_style charmm, dihedral_style charmm, improper_style harmonic, kspace_style pppm, fix nvt, fix spring, fix shake kokkos
v100-cmap-pppm pair_style lj/charmmfsw/coul/long/kk, kspace_style pppm, bond_style harmonic, angle_style charmm, dihedral_style charmmfsw, improper_style harmonic, fix cmap, fix shake, fix nvt kokkos
v100-enforce2d pair_style colloid/kk, fix npt, fix enforce2d kokkos
v100-efield pair_style reaxff/kk, fix acks2/reaxff/kk, fix nvt, fix efield, fix wall/reflect, compute property/atom, compute reduce, dump custom kokkos
v100-deform pair_style zero, fix deform, compute temp/kk, compute temp/deform/kk kokkos
v100-hybrid-omp bond_style harmonic, angle_style harmonic, dihedral_style opls, pair_style hybrid/overlay, kspace_style pppm, fix drude, fix shake, fix tgnpt/drude, compute temp/drude, fix ave/time, compute property/atom, dump custom gpu
v100-qeq pair_style reaxff/kk, compute property/atom, compute reduce, fix nve, fix qeq/reax kokkos

输入与提交#

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

# 250 butane system for drude polarizability example (Langevin)

units real
boundary p p p

atom_style full
bond_style harmonic
angle_style harmonic
dihedral_style opls
special_bonds lj/coul 0.0 0.0 0.5

pair_style hybrid/overlay lj/cut/coul/long 8.0 8.0 thole 2.089 8.0
pair_modify mix geometric tail yes
kspace_style pppm 1.0e-4

read_data data.butane

comm_modify vel yes

group gBUTANE molecule 1:250
group gCORES type 1 2 3
group gDRUDES type 4 5

pair_coeff    1    1 lj/cut/coul/long 0.065997 3.500000 # C3H C3H
pair_coeff    1    2 lj/cut/coul/long 0.065997 3.500000 # C3H C2H
pair_coeff    1    3 lj/cut/coul/long 0.044496 2.958040 # C3H H
pair_coeff    2    2 lj/cut/coul/long 0.065997 3.500000 # C2H C2H
pair_coeff    2    3 lj/cut/coul/long 0.044496 2.958040 # C2H H
pair_coeff    3    3 lj/cut/coul/long 0.029999 2.500000 # H H
pair_coeff    *  4*5 lj/cut/coul/long 0.000000 0.000000 # No lj for drudes
pair_coeff    1    * thole 1.368000
pair_coeff    2    * thole 1.368000
pair_coeff    4    * thole 1.368000
pair_coeff    5    * thole 1.368000

neighbor 2.0 bin

variable vTEMP   equal 260.0
variable vTEMP_D equal 1.0
variable vPRESS  equal 1.0

velocity gCORES  create ${vTEMP} 12345
velocity gDRUDES create ${vTEMP_D} 12345

fix fDRUDE all drude C C N D D

fix fSHAKE gCORES shake 0.0001 20 0 b 2 4

fix fNVT all tgnpt/drude temp ${vTEMP} ${vTEMP} 100.0 ${vTEMP_D} 20.0 iso ${vPRESS} ${vPRESS} 1000.0

compute cTEMP all temp/drude

thermo_style custom step etotal ke temp pe ebond eangle edihed eimp evdwl ecoul elong press vol c_cTEMP[1] c_cTEMP[2] f_fNVT[1] f_fNVT[2] f_fNVT[3]
thermo 50

timestep 0.5
variable Vhist equal vol
fix hist all ave/time 10 1 10 c_cTEMP[1] c_cTEMP[2] v_Vhist file Drude-temperatures.dat
compute atominfo all property/atom mol q
dump coords all custom 100 trajectory.lammpstrj id type c_atominfo[1] c_atominfo[2] x y z vx vy vz
dump_modify coords sort id
run 0
info system fixes accelerator out overwrite active-styles.txt

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

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/p100-hybrid-omp
tail -n 35 native.out

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

Loop time of 2.525e-06 on 4 procs for 0 steps with 4500 atoms
Total wall time: 0:00:00

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

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

本次输出示例#

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

   Step         TotEng         KinEng          Temp          PotEng         E_bond        E_angle        E_dihed        E_impro         E_vdwl         E_coul         E_long         Press          Volume       c_cTEMP[1]     c_cTEMP[2]     f_fNVT[1]      f_fNVT[2]      f_fNVT[3]   
         0   6535.5229      2714.74        248.45112      3820.783       3724.3278      140.75328      1.4735401      0             -518.77975      595169.42     -594696.41      4439.79        55742.797      334.61375      18.435655      235.53872      344.96036      18.435655    
Loop time of 2.525e-06 on 4 procs for 0 steps with 4500 atoms

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

查看配图

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

100%查看原图 ↗