LAMMPS全局超动力学操作
hyper/global原生输入、无偏置对照、逐步boost与方法时钟积分的实操。
阅读本篇目录
本组使用LAMMPS30Sep2026的原生REPLICA功能:四个粒子中,1号粒子沿x跨越解析双阱,另外三个局域谐振子作为陪伴自由度。所有粒子还在各自的y/z势阱内运动。使用LJ约化单位,图中X是占位标签,不代表某种真实元素;能垒1不是1 eV。
模型为1号粒子的 U=(x²−1)²+5(y+3)²+5z²,其他粒子为 U=5(x+1)²+5[y−(2id−5)]²+5z²。初态x=−1,另一稳态x=+1,解析能垒为1。这里用来学习输入、事件和时钟;材料扩散率还需要适合材料的势函数、事件定义、去相关和统计收敛。
这个解析外场模型仅演示原生命令、偏置表达式、事件文件和方法时钟。邻近对、qfactor和Vmax的选择没有证明满足真实过渡态处偏置为零等动力学条件;以下方法时钟不能作为本模型已验证的真实跃迁时间或材料扩散率。实际材料要检查这些条件、事件去相关和参数收敛。
下载原生输入、实际输出、CSV和图片,解压到个人目录:
mkdir hyper-demo
cd hyper-demo
curl -fL https://yuansuan.top/assets/downloads/full-function/lammps-hyper-wave84-73ba3ce03eab.zip -o examples.zip
unzip examples.zip
sbatch submit.slurm
提交脚本会依次运行各个小算例,然后自动提取数据、导出结构和画图。使用 lammps/30Sep2026-p100-gpu 基础模块,原生GCC13.3、OpenMPI5.0.10、CUDA12.8构建;后处理用 ase/3.29.0。这些命令走CPU/MPI路径,并不因模块名字含gpu而自动使用GPU力计算。脚本申请一个CPU核和一个P100配额;三个方法在单进程内依次运行。
完成后,在解压目录运行:
module purge
module load ase/3.29.0
python analyze.py work
python export_events.py work
python plot_results.py work
已有实算结果位于 reference/,想先读图时可把后处理参数work换为reference。新计算请重新解压到新目录,保留自己的既有结果。
1 顺序与文件#
先建立模型及热浴,再用 compute event 定义淬火稳态位移判据,然后定义hyper/global偏置,最后调用hyper。包中还实际运行了 hyper ... NULL event 的无偏置对照,以及独立的局域模式。
2 完整全局输入#
variable replica equal 1
units lj
atom_style atomic
atom_modify map array sort 0 0.0
boundary f f f
region box block -5 5 -8 8 -5 5 units box
create_box 1 box
mass 1 1
create_atoms 1 single -1 -3 0 units box
create_atoms 1 single -1 -1 0 units box
create_atoms 1 single -1 1 0 units box
create_atoms 1 single -1 3 0 units box
pair_style zero 2.5
pair_coeff * *
neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes
variable dy atom y-(2*id-5)
variable active atom id==1
variable U atom v_active*(x*x-1)*(x*x-1)+(1-v_active)*5*(x+1)*(x+1)+5*v_dy*v_dy+5*z*z
variable Fx atom -v_active*4*x*(x*x-1)-(1-v_active)*10*(x+1)
variable Fy atom -10*v_dy
variable Fz atom -10*z
fix field all addforce v_Fx v_Fy v_Fz energy v_U
fix_modify field energy yes
compute physicalT all temp
compute_modify physicalT extra/dof 0
thermo 1000
thermo_style custom step c_physicalT pe ke
thermo_modify norm no format float %.16g
displace_atoms all random .01 .01 .01 19475 units box
velocity all create 0.3 32613 mom no rot no dist gaussian temp physicalT
fix integrate all nve
variable bathseed equal 12341+17*v_replica
fix bath all langevin 0.3 0.3 0.2 ${bathseed} zero no
compute event all event/displace 1.0
timestep .005
min_style cg
comm_modify cutoff 4.0
dump events all custom 1000000 events.dump id type x y z
dump_modify events sort id format float %.16g
fix boost all hyper/global 2.3 .10 .10 .3
variable g0 equal f_boost
variable b0 atom v_g0
variable g1 equal f_boost[1]
variable b1 atom v_g1
variable g2 equal f_boost[2]
variable b2 atom v_g2
variable g3 equal f_boost[3]
variable b3 atom v_g3
variable g4 equal f_boost[4]
variable b4 atom v_g4
variable g5 equal f_boost[10]
variable b5 atom v_g5
variable g6 equal f_boost[11]
variable b6 atom v_g6
dump trajectory all custom 1 trajectory.dump id type x y z vx vy vz v_b0 v_b1 v_b2 v_b3 v_b4 v_b5 v_b6
dump_modify trajectory sort id format float %.16g
hyper 30000 20 boost event min 0.0 1.0e-8 500 1000 dump events
print "FINAL_HYPER $(f_boost[10]:%.16g)" file hyper-time.dat screen no
undump trajectory
unfix boost
unfix bath
run 0
write_dump all custom final.dump id type x y z vx vy vz fx fy fz modify sort id format float %.16g
print "COMPLETE $(step:%.0f) $(pe:%.16g)" file complete.dat screen no
初态在稳态附近加入0.01的随机微扰,并设置热速度。这里的“bond”是淬火后距离小于cutbond的邻近粒子对,不要求data文件里存在化学键。
fix boost all hyper/global 2.3 .10 .10 .3
hyper 30000 20 boost event min 0.0 1.0e-8 500 1000 dump events
参数依次为邻近对距离2.3、偏置归零应变0.10、最大偏置0.10、温度0.30;热浴保持同温度。hyper运行30000步,每20步淬火检查事件,触发时重建邻近对。固定盒子、静态外场与时间相关fix的限制见官方说明。
3 在计算资源里单独调用#
module purge
module load lammps/30Sep2026-p100-gpu
mkdir manual-global
cp inputs/global/in.lammps manual-global/
cd manual-global
lmp -in in.lammps
cd ..
整包之后用这些命令提取:
head -6 work/analysis/global-history.csv
cat work/cases/global/hyper-time.dat
head -8 work/analysis/global-events.csv
4 偏置与方法时钟#
本例原生输出满足:
strain = abs((r-r0)/r0)
bias = Vmax*[1-(strain/q)^2] (strain < q)
bias = 0 (strain >= q)
boost = exp(bias/T)
method_time = sum(boost*dt)
T使用LJ约化温度。输入通过全局equal变量再供atom变量读取,将这些诊断列一起写入trajectory.dump;这是输出诊断,不会增加另一份偏置力。

实际30000步对应MD约化时间150,全局模式报告的方法时钟156.200228665,其时钟比例约1.041335。对照和全局模式各检测1次稳态变化。比例是偏置定义的方法时钟比例,不是软件运行速度提升1.041倍。

完整CSV保留每一步诊断,后处理按dt=0.005积分,并与原生最终hyper-time.dat对应。不是只用最后一步boost乘总步数。
5 看实际事件结构#
python export_events.py work
head -8 work/analysis/global-events.xyz
原生events.dump最前面有初始淬火稳态,以及普通dump额外输出的Step0热态。analyze.py明确核对后者与连续轨迹初帧一致,将它从“稳态事件”表中分开,原始文件保留。导出的全局XYZ含初始稳态和1次实际事件,共2帧,不能按等间隔MD处理。
继续看 局域hyper与boostostat。原生说明见 hyper 与 hyper/global。