LAMMPS 专题

LAMMPS 偶极与力矩原子属性

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

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

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

选择条件#

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

条件目录 主要样式 运行模式
v100-dipole angle_style dipole/kk, pair_style zero kokkos
p100-dipole angle_style dipole/kk, pair_style zero kokkos
p100-dipole-cpu-reference angle_style dipole, pair_style zero gpu

输入与提交#

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

units metal
atom_style hybrid angle dipole sphere
atom_modify map array
boundary f f f
angle_style dipole/kk
region box block -10 10 -10 10 -10 10
create_box 1 box angle/types 1 extra/angle/per/atom 1 extra/special/per/atom 4
create_atoms 1 single 1.2 0 0 units box
create_atoms 1 single 0 0 0 units box
create_atoms 1 single 0 1.2 0 units box
mass 1 1
set group all dipole 1 0 0
set group all diameter 1.0
set group all mass 1.0
create_bonds single/angle 1 1 2 3
angle_coeff 1 2.1 180.0
pair_style zero 10
pair_coeff * *
neighbor 0.3 bin
neigh_modify delay 0 every 1 check yes
thermo_style custom step atoms pe eangle
thermo_modify norm no format float %.16g
set atom 1 dipole 0.3421141108774901 0.9396584140731697 0
run 0
print "70.0 -0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-00.dump id type x y z fx fy fz mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole 0.3420201433256688 0.9396926207859083 0
run 0
print "70.0 0.0 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-01.dump id type x y z fx fy fz mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole 0.3419261723536461 0.9397268181017208 0
run 0
print "70.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 mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole 9.999999983338356e-05 0.999999995 0
run 0
print "90.0 -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 mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole 6.123233995736766e-17 1 0
run 0
print "90.0 0.0 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-04.dump id type x y z fx fy fz mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -9.999999983326108e-05 0.999999995 0
run 0
print "90.0 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 mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -0.341926172353646 0.9397268181017209 0
run 0
print "110.0 -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 mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -0.3420201433256687 0.9396926207859084 0
run 0
print "110.0 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 mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -0.3421141108774899 0.9396584140731697 0
run 0
print "110.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 mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -0.6427110020284169 0.7661087180496174 0
run 0
print "130.0 -0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-09.dump id type x y z fx fy fz mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -0.6427876096865394 0.766044443118978 0
run 0
print "130.0 0.0 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-10.dump id type x y z fx fy fz mux muy muz tqx tqy tqz modify sort id format float %.16g
set atom 1 dipole -0.6428642109167857 0.7659801605278942 0
run 0
print "130.0 0.0001 $(pe:%.16g) $(eangle:%.16g)" append energy.dat screen no
write_dump all custom forces-11.dump id type x y z fx fy fz mux muy muz tqx tqy tqz modify sort id format float %.16g
write_data generated.data nocoeff

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

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-dipole
tail -n 35 native.out

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

Loop time of 0.000159367 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000157976 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000157661 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000158662 on 1 procs for 0 steps with 3 atoms
Loop time of 0.000163098 on 1 procs for 0 steps with 3 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        E_angle    
         0           3  0.9089090705236824 0.9089090705236824
Loop time of 0.000157611 on 1 procs for 0 steps with 3 atoms

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

查看配图

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

100%查看原图 ↗