LAMMPS 球形粒子的 fix 与属性
用实际完成的 LAMMPS 输入展示参数、提交和结果文件,附各条件的操作记录。
阅读本篇目录
下载输入、Slurm 作业与实际结果。本例使用 LAMMPS 30 Sep 2026 的 P100 构建。附件保存 24 个已完成条件,按输入保留相互作用与操作参数。
选择条件#
解压并进入 lammps-sphere-fix-attributes-operations。CASES 每行对应一个作业数组索引,inputs 保存条件输入,reference 保存实际输出。gpu 条件使用 GPU 构建,其中普通 CPU 样式按输入直接运行;kokkos 条件启用 Kokkos。
| 条件目录 | 主要样式 | 运行模式 |
|---|---|---|
p100-settorque_atom |
pair_style lj/cut/kk, fix addtorque/atom/kk, fix nve/sphere/kk, fix settorque/atom/kk, dump custom |
kokkos |
p100-settorque_atom-cpu-reference |
pair_style lj/cut, fix addtorque/atom, fix nve/sphere, fix settorque/atom, dump custom |
gpu |
p100-freeze |
pair_style lj/cut/kk, fix nve/sphere/kk, fix freeze/kk, dump custom |
kokkos |
p100-freeze-cpu-reference |
pair_style lj/cut, fix nve/sphere, fix freeze, dump custom |
gpu |
p100-nvt_sphere |
pair_style lj/cut/kk, fix nvt/sphere/kk, dump custom |
kokkos |
p100-nvt_sphere-cpu-reference |
pair_style lj/cut, fix nvt/sphere, dump custom |
gpu |
p100-npt_sphere |
pair_style lj/cut/kk, fix npt/sphere/kk, dump custom |
kokkos |
p100-npt_sphere-cpu-reference |
pair_style lj/cut, fix npt/sphere, dump custom |
gpu |
p100-damping_cundall |
pair_style lj/cut/kk, fix addtorque/atom/kk, fix nve/sphere/kk, fix damping/cundall/kk, dump custom |
kokkos |
p100-damping_cundall-cpu-reference |
pair_style lj/cut, fix addtorque/atom, fix nve/sphere, fix damping/cundall, dump custom |
gpu |
p100-viscous_nonlinear |
pair_style lj/cut/kk, fix nve/sphere/kk, fix viscous/nonlinear/kk, dump custom |
kokkos |
p100-viscous_nonlinear-cpu-reference |
pair_style lj/cut, fix nve/sphere, fix viscous/nonlinear, dump custom |
gpu |
p100-nph_sphere |
pair_style lj/cut/kk, fix nph/sphere/kk, dump custom |
kokkos |
p100-nph_sphere-cpu-reference |
pair_style lj/cut, fix nph/sphere, dump custom |
gpu |
p100-addtorque_atom |
pair_style lj/cut/kk, fix addtorque/atom/kk, fix nve/sphere/kk, dump custom |
kokkos |
p100-addtorque_atom-cpu-reference |
pair_style lj/cut, fix addtorque/atom, fix nve/sphere, dump custom |
gpu |
v100-nph_sphere |
pair_style lj/cut/kk, fix nph/sphere/kk, dump custom |
kokkos |
v100-settorque_atom |
pair_style lj/cut/kk, fix addtorque/atom/kk, fix nve/sphere/kk, fix settorque/atom/kk, dump custom |
kokkos |
v100-npt_sphere |
pair_style lj/cut/kk, fix npt/sphere/kk, dump custom |
kokkos |
v100-damping_cundall |
pair_style lj/cut/kk, fix addtorque/atom/kk, fix nve/sphere/kk, fix damping/cundall/kk, dump custom |
kokkos |
v100-freeze |
pair_style lj/cut/kk, fix nve/sphere/kk, fix freeze/kk, dump custom |
kokkos |
v100-nvt_sphere |
pair_style lj/cut/kk, fix nvt/sphere/kk, dump custom |
kokkos |
v100-viscous_nonlinear |
pair_style lj/cut/kk, fix nve/sphere/kk, fix viscous/nonlinear/kk, dump custom |
kokkos |
v100-addtorque_atom |
pair_style lj/cut/kk, fix addtorque/atom/kk, fix nve/sphere/kk, dump custom |
kokkos |
输入与提交#
第一组的输入如下。单位、边界条件和参数以对应 in.lammps 为准。
units lj
atom_style sphere
atom_modify map array
boundary p p p
lattice fcc 0.8442
region box block 0 4 0 4 0 4
create_box 1 box
create_atoms 1 box
set group all diameter 1.0
set group all mass 1.0
set group all omega 0.1 0.2 0.3
displace_atoms all random 0.02 0.02 0.02 20261117 units box
pair_style lj/cut/kk 2.5
pair_coeff * * 1.0 1.0
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
velocity all create 1.0 314159 mom yes rot yes dist gaussian loop geom
timestep 0.0005
thermo_style custom step atoms temp ke pe etotal press vol
thermo_modify norm no format float %.16g
thermo 10
run 0
write_dump all custom before.dump id type x y z xu yu zu vx vy vz fx fy fz radius mass omegax omegay omegaz tqx tqy tqz modify sort id format float %.16g
fix source_torque all addtorque/atom/kk 0.04 0.05 0.06
fix integrate all nve/sphere/kk
fix demo all settorque/atom/kk 0.01 0.02 0.03
run 0
write_dump all custom after.dump id type x y z xu yu zu vx vy vz fx fy fz radius mass omegax omegay omegaz tqx tqy tqz modify sort id format float %.16g
dump trajectory all custom 10 trajectory.dump id type x y z xu yu zu vx vy vz fx fy fz radius mass omegax omegay omegaz tqx tqy tqz
dump_modify trajectory sort id format float %.16g
run 100
write_dump all custom final.dump id type x y z xu yu zu vx vy vz fx fy fz radius mass omegax omegay omegaz tqx tqy tqz 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/p100-settorque_atom
tail -n 35 native.out
本次第一组的原生日志片段如下。
Loop time of 7.8069e-05 on 1 procs for 0 steps with 256 atoms
Loop time of 7.9368e-05 on 1 procs for 0 steps with 256 atoms
Loop time of 0.0633763 on 1 procs for 100 steps with 256 atoms
Total wall time: 0:00:01
原始输入若包含 dump、数据表或其他导出命令,相应文件会保存在该条件目录。附件提供的参考数据文件为 after.dump, before.dump, final.dump, trajectory.dump。按自己的体系修改输入时,保留对应势函数文件、单位和原子样式设置。
再次运行前,将已有的同名 work-new 条件目录改名保存。
本次输出示例#
第一组原生热力学输出的开头如下,列名由该组输入的 thermo_style 设置。
Step Atoms Temp KinEng PotEng TotEng Press Volume
0 256 1 382.5 -1730.537704051356 -1348.037704051356 -5.302958160626596 303.2456763800047
Loop time of 7.8069e-05 on 1 procs for 0 steps with 256 atoms
需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。