LAMMPS 专题

LAMMPS 蒙特卡洛系综与观测量

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

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

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

选择条件#

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

条件目录 主要样式 运行模式
sgcmc-minimum-domain-sgcmc-FeCu-VC-SGC pair_style eam/fs, fix npt, fix sgcmc, dump custom gpu
charge-regulation-pH6 pair_style lj/cut/coul/long, kspace_style ewald, fix nve, compute temp, fix langevin, fix charge/regulation, dump custom gpu
hmc-flexible-LJ pair_style lj/cut, fix nve, fix hmc, dump custom gpu
hmc-rigid-SPCE pair_style lj/cut/coul/long, kspace_style pppm, bond_style harmonic, angle_style harmonic, fix rigid/small, fix hmc, dump custom gpu
charge-regulation-pH8 pair_style lj/cut/coul/long, kspace_style ewald, fix nve, compute temp, fix langevin, fix charge/regulation, dump custom gpu
atom-swap-symmetric-labels-mu0 pair_style lj/cut, fix nvt, fix atom/swap, compute property/atom, compute reduce, fix ave/time, dump custom gpu
gcmc-LJ-mu-2.25 pair_style lj/cut, fix gcmc, fix ave/time, dump custom gpu
gcmc-LJ-mu-1.25 pair_style lj/cut, fix gcmc, fix ave/time, dump custom gpu
atom-swap-symmetric-labels-mu1 pair_style lj/cut, fix nvt, fix atom/swap, compute property/atom, compute reduce, fix ave/time, dump custom gpu
widom-Kob-Andersen pair_style lj/cut, fix widom, fix langevin, fix nve, dump custom gpu

输入与提交#

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

# general variables
variable        temperature equal 700
variable        size equal 8

# variables for 'fix sgcmc'
variable        nsteps_mc     equal 100
variable        swap_fraction equal 0.2
variable        temperature_mc equal ${temperature}
variable        deltamu equal -0.70
variable        target_concentration equal 0.02
variable        kappa equal 1e3

# general settings
units           metal
atom_style      atomic

# set up structure
boundary        p p p
lattice         bcc 2.88
region          box block 0 ${size}  0 ${size}  0 ${size}
create_box      2 box
create_atoms    1 box
reset_timestep  0
timestep        0.0025

# set up interaction
pair_style      eam/fs
pair_coeff      * * FeCu.pasianot.eamfs Fe Cu

# initialize velocities
variable        double_temp equal ${temperature}*2
velocity        all create ${double_temp} 428459 dist gaussian loop geom

# what and how to run
fix             integrate all npt &
                temp ${temperature} ${temperature} 1.7 &
                aniso 0.0 0.0 1.5
fix             mc all sgcmc ${nsteps_mc} ${swap_fraction} ${temperature_mc} ${deltamu} &
                randseed 324234 &
                variance ${kappa} ${target_concentration}

# set up output
thermo          100
thermo_style    custom step temp atoms pe press &
                lx ly lz f_mc[1] f_mc[2] f_mc[3] f_mc[4]
dump history all custom 100 atoms-history.dump id type x y z
dump_modify history sort id

run             2000


write_data final.data

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

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/sgcmc-minimum-domain-sgcmc-FeCu-VC-SGC
tail -n 35 native.out

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

   Step          Temp         Atoms        PotEng         Press            Lx             Ly             Lz          f_mc[1]        f_mc[2]        f_mc[3]        f_mc[4]    
Loop time of 4.34957 on 1 procs for 2000 steps with 1024 atoms
Total wall time: 0:00:04

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

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

本次输出示例#

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

   Step          Temp         Atoms        PotEng         Press            Lx             Ly             Lz          f_mc[1]        f_mc[2]        f_mc[3]        f_mc[4]    
         0   1400                1024  -4216.9463     -28869.333      23.04          23.04          23.04          0              0              1              0            
       100   728.66107           1024  -4128.0594      10788.059      22.910895      22.907431      22.891308      3              197            0.99707031     0.0029296875 
       200   643.95988           1024  -4114.0221     -2727.1904      22.9709        22.992724      22.970996      1              199            0.99609375     0.00390625   
需要根据你的体系选择资源?联系讨论计算需求。实际可用软件与权限,以当前账户和运行环境为准。

查看配图

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

100%查看原图 ↗