LAMMPS 专题

LAMMPS 扩展势接口操作

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

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

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

选择条件#

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

条件目录 主要样式 运行模式
producer-p100-aip-water-2dm-base pair_style hybrid/overlay, bond_style harmonic, angle_style harmonic, kspace_style pppm/tip4p, compute pair, compute temp gpu
producer-p100-saip-metal-tmd-base pair_style hybrid/overlay, compute pair gpu
producer-p100-saip-metal-tmd-opt pair_style hybrid/overlay, compute pair gpu
producer-p100-aip-water-2dm-opt pair_style hybrid/overlay, bond_style harmonic, angle_style harmonic, kspace_style pppm/tip4p, compute pair, compute temp gpu
producer-p100-saip-metal-opt pair_style hybrid/overlay, compute pair gpu
producer-p100-ilp-tmd-opt pair_style hybrid/overlay, compute pair gpu
producer-p100-ilp-tmd-base pair_style hybrid/overlay, compute pair gpu
producer-p100-saip-metal-base pair_style hybrid/overlay, compute pair gpu

输入与提交#

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

# Initialization
units           metal
boundary        p p p
atom_style      full
processors      * * 1     # domain decomposition over x and y
read_data       dependency-2428b0de3c.data
mass            1 12.0107   # carbon    mass (g/mole) 
mass            2 15.9994   # oxygen    mass (g/mole) 
mass            3 1.008     # hydrogen  mass (g/mole) 
# Separate atom groups
group           gr    molecule 1
group           water molecule 2
######################## Potential defition ##############################
# Interlayer potential
pair_style  hybrid/overlay  aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5
####################################################################
pair_coeff  1 1   none
pair_coeff  2 2   lj/cut/tip4p/long    8.0313e-3  3.1589          # O-O
pair_coeff  2 3   lj/cut/tip4p/long    0.0 0.0                    # O-H
pair_coeff  3 3   lj/cut/tip4p/long    0.0 0.0                    # H-H
pair_coeff  * *   aip/water/2dm        COH.DMC.aip.water.2dm C Ow Hw  # C-H2O    
# bond and angle
bond_style        harmonic
bond_coeff        1     0.0  0.9572
angle_style       harmonic
angle_coeff       1     0.0  104.52
# define kspace calculation
kspace_style      pppm/tip4p 1E-5
# Neighbor update settings
neighbor        2.0 bin
neigh_modify every 1 delay 5 check yes page 1000000 one 100000
####################################################################
# Calculate pair energy
compute         1 all pair lj/cut/tip4p/long
compute         2 all pair aip/water/2dm
compute         wt water temp
variable        TIP4P  equal  c_1
variable        EILP   equal  c_2     # total interlayer energy
variable        temp_wt equal c_wt
############# Output ##############
thermo_style    custom step etotal pe ke v_TIP4P v_EILP  v_temp_wt
thermo          100
thermo_modify   lost error


thermo 1
thermo_modify norm no format float %.16e
run 0
write_dump all custom atoms-forces.dump id type mol x y z fx fy fz modify sort id format float %.16e

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

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/producer-p100-aip-water-2dm-base
tail -n 35 native.out

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

Loop time of 1.768e-06 on 1 procs for 0 steps with 936 atoms
Total wall time: 0:00:00

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

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

本次输出示例#

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

   Step         TotEng         PotEng         KinEng        v_TIP4P         v_EILP       v_temp_wt   
         0  -1.5837027556976643e+01 -1.9486010974597832e+01 3.6489834176211882e+00 1.8937245931394719e+02 -1.5743747858579178e+00 1.9741093866784325e+02
Loop time of 1.768e-06 on 1 procs for 0 steps with 936 atoms

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

查看配图

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

100%查看原图 ↗