LAMMPS 双温度模型设置
用实际完成的 LAMMPS 输入展示参数、提交和结果文件,附各条件的操作记录。
阅读本篇目录
下载输入、Slurm 作业与实际结果。本例使用 LAMMPS 30 Sep 2026 的 P100 构建。附件保存 4 个已完成条件,按输入保留相互作用与操作参数。
选择条件#
解压并进入 lammps-two-temperature-variants-operations。CASES 每行对应一个作业数组索引,inputs 保存条件输入,reference 保存实际输出。gpu 条件使用 GPU 构建,其中普通 CPU 样式按输入直接运行;kokkos 条件启用 Kokkos。
| 条件目录 | 主要样式 | 运行模式 |
|---|---|---|
TTM-grid |
pair_style eam/fs, fix nve, fix ttm/grid, compute pe/atom, compute ke/atom, compute chunk/atom, fix ave/chunk, dump custom, compute property/grid, dump grid |
gpu |
TTM-thermal |
pair_style eam/fs, fix nve, fix ttm/thermal, compute pe/atom, compute ke/atom, compute chunk/atom, fix ave/chunk, dump custom |
gpu |
TTM-mod |
pair_style sw, fix nve, fix ttm/mod, compute pe/atom, compute ke/atom, compute chunk/atom, fix ave/chunk, dump custom |
gpu |
TTM-cascade |
pair_style eam/fs, fix nve, fix ttm/cascade, compute pe/atom, compute ke/atom, compute temp, compute chunk/atom, fix ave/chunk, dump custom, compute property/grid, dump grid |
gpu |
输入与提交#
第一组的输入如下。单位、边界条件和参数以对应 in.lammps 为准。
units metal
atom_style atomic
newton off on
boundary p p p
variable latc equal 2.87
lattice bcc ${latc}
variable xmax equal 10.0
variable xmin equal -10.0
variable ymax equal 10.0
variable ymin equal -10.0
variable zmax equal 10.0
variable zmin equal -10.0
region sim_box block ${xmin} ${xmax} ${ymin} ${ymax} ${zmin} ${zmax} &
units lattice
create_box 1 sim_box
region atom_box block ${xmin} ${xmax} ${ymin} ${ymax} ${zmin} ${zmax} &
units lattice
create_atoms 1 region atom_box
mass 1 55.845
pair_style eam/fs
pair_coeff * * dependency-d7b15f435a.fs Fe
neighbor 2.0 bin
neigh_modify every 5 delay 0 check yes
fix 1 all nve
fix twotemp all ttm/grid 342785 1.2470e-5 0.087614 &
0.005365 29.5917 47.5679 58.4613 10 10 10 set 1800.0
compute pe all pe/atom
compute ke all ke/atom
timestep 0.0001
thermo 100
thermo_style custom step temp etotal f_twotemp[1] f_twotemp[2]
thermo_modify format float "%20.16g"
# dump output
#compute 1 all property/grid 10 10 10 id ix iy iz
#dump 1 all grid 100 tmp.dump c_1:grid:data[*] f_twotemp:grid:data
#dump_modify 1 sort 1
#compute 10 all property/grid 10 10 10 id xc yc zc
#fix ave all ave/grid 10 10 100 10 10 10 f_twotemp:grid:data
#dump ave all grid 100 tmp.dump.ave &
# c_10:grid:data[*] f_ave:grid:data
#dump_modify ave sort id
#dump vtk all grid/vtk 100 tmp.dump.*.vtk f_ave:grid:data
#dump_modify vtk sort id buffer no
# run simulation
compute cellchunks all chunk/atom bin/3d x lower 0.1 y lower 0.1 z lower 0.1 units reduced
fix atomtemp all ave/chunk 100 1 100 cellchunks temp file atomic-cell-T.dat
thermo_modify norm no
dump atoms all custom 100 atoms-history.dump id type x y z vx vy vz c_pe c_ke
dump_modify atoms sort id format float %.16e
compute gridcells all property/grid 10 10 10 id xc yc zc
dump electron all grid 100 electron-T-grid.dump c_gridcells:grid:data[*] f_twotemp:grid:data
run 1000
write_data final.data
write_restart final.restart
在附件根目录提交第一组或所选条件。
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/TTM-grid
tail -n 35 native.out
本次第一组的原生日志片段如下。
Step Temp TotEng f_twotemp[1] f_twotemp[2]
Loop time of 1.88539 on 2 procs for 1000 steps with 16000 atoms
Total wall time: 0:00:03
原始输入若包含 dump、数据表或其他导出命令,相应文件会保存在该条件目录。附件提供的参考数据文件为 atomic-cell-T.dat, electron-T-grid.dump。按自己的体系修改输入时,保留对应势函数文件、单位和原子样式设置。
再次运行前,将已有的同名 work-new 条件目录改名保存。
本次输出示例#
第一组原生热力学输出的开头如下,列名由该组输入的 thermo_style 设置。
Step Temp TotEng f_twotemp[1] f_twotemp[2]
0 0 -65934.44894330099 371.9188105082191 0
100 16.86513541619201 -65897.41134905875 334.6331691902215 0.3145031627141779
200 26.91795279604144 -65864.04218589491 301.2617208168109 0.3335613394079657
需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。