这段LAMMPS代码描述了一系列分子动力学模拟材料的熔化温度,主要包括系统的加热、稳态保持、数据输出以及模拟的重启文件保存。
================================
#============================================================================
clear
dimension 3
boundary p p p
units metal
dimension 3:设置系统的维度为三维。
boundary p p p:设置边界条件为周期性边界(p表示periodic),分别沿x、y、z方向。
units metal:使用金属单位制,这意味着温度是用开尔文(K),时间是皮秒(ps),能量是eV,长度是Å。
============================================================================
atom_style atomic
variable a_param equal 2.8665
variable a equal ${a_param}
variable xdim equal 18
variable ydim equal 18
#variable zdim equal 160
#variable zdim_sol equal ${zdim}/2.0
atom_style atomic:指定使用原子类型的体系,没有考虑分子、键等复杂结构。
variable a_param equal 2.8665:定义晶格常数为2.8665 Å,代表一种体心立方(bcc)晶格的原子间距。
variable xdim equal 18,variable ydim equal 18:定义晶胞的x和y方向维度为18个晶格常数。
#============================================================================
# #
# Initial simulation setup #
# #
#============================================================================
lattice bcc ${a} orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region box block 0 ${xdim} 0 ${ydim} 0 120
create_box 1 box
create_atoms 1 region box
lattice bcc ${a} orient ...:创建体心立方(bcc)晶格,晶格常数为变量a,并定义x、y、z方向的晶格取向。
region box block 0 ${xdim} 0 ${ydim} 0 120:定义一个尺寸为xdim×ydim×120的长方体区域作为模拟区域。
create_box 1 box:在该区域内创建一个盒子,用来容纳1种原子类型。
create_atoms 1 region box:在指定区域box内生成原子。
============================================================================
region liq1 block 0 ${xdim} 0 ${ydim} 0 30
region sol block 0 ${xdim} 0 ${ydim} 30 90
region liq2 block 0 ${xdim} 0 ${ydim} 90 120
group lq1 region liq1
group sl region sol
group lq2 region liq2
group lq_all union lq1 lq2
region liq1,region sol,region liq2:分别定义三个局部区域,分别代表固体区域和两个液体区域(liq1和liq2)。
group lq1,group sl,group lq2:将各区域内的原子分组。
group lq_all union lq1 lq2:将liq1和liq2合并成一个总液体分组。
============================================================================
pair_style eam/fs
pair_coeff * * Fe_5.eam.fs Fe
neighbor 2.0 bin
neigh_modify every 1 delay 0 check yes
pair_style eam/fs:使用嵌入原子法(EAM)配位势,适用于金属。
pair_coeff * * Fe_5.eam.fs Fe:定义铁原子的EAM势文件Fe_5.eam.fs。
neighbor 2.0 bin:设置邻居列表的搜索半径为2 Å。
neigh_modify every 1 delay 0 check yes:每步更新邻居列表,减少计算开销。
============================================================================
reset_timestep 0
timestep 0.001
fix 7 all box/relax iso 0.0 vmax 0.001
min_style cg
min_modify dmax 0.1
minimize 1.0e-25 1.0e-20 5000 10000
unfix 7
reset_timestep 0:将时间步重置为0。
timestep 0.001:设置时间步长为0.001 ps。
fix 7 all box/relax iso 0.0 vmax 0.001:进行等压(各方向压力相等)的盒子体积松弛,使系统接近最低能量状态。
min_style cg:使用共轭梯度法进行能量最小化。
min_modify dmax 0.1:调整每次最小化迭代的最大步长。
minimize ...:进行能量最小化,指定收敛标准。
============================================================================
velocity all create 100 481516
fix 1 all npt temp 100 300 2 aniso 0.0 0.0 2 drag 1.0
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
run 200000
unfix 1
velocity all create 100 481516:给所有原子初始速度,使其温度为100 K,种子为481516。
fix 1 all npt temp 100 300 2 aniso 0.0 0.0 2 drag 1.0:使用NPT方法控制系统温度从100 K升高到300 K,压力各向异性保持0。
thermo 100:每100步输出热力学数据。
thermo_style custom ...:自定义输出热力学数据项,包括步数、势能、盒子尺寸、压力和温度。
run 200000:运行200,000步,模拟体系在300 K下的平衡过程。
unfix 1:取消fix 1的操作。
============================================================================
fix 1 all npt temp 300 1750 2 aniso 0.0 0.0 2 drag 1.0
dump 1 all custom 50000 dump.r1820.* id type fx fy fz vx vy vz
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
run 350000
unfix 1
undump 1
============================================================================
fix 1 all npt temp 300 1750 2 aniso 0.0 0.0 2 drag 1.0:
fix命令用于对整个系统(all)施加恒温恒压(NPT)控制。
K加热到1750 K,其中2 ps为温度松弛时间常数。
y, z)分别调整,目标压力为0。2 ps为压力松弛时间常数。
drag 1.0 用来减少体积振荡。
dump 1 all custom 50000 dump.r1820. id type fx fy fz vx vy vz*:
dump命令用于每50000步输出一次数据,文件名格式为dump.r1820.*。
fy, fz)、以及速度(vx, vy, vz)。
thermo 100:
每100步输出一次热力学数据。
thermo_style custom step pe lx ly lz press pxx pyy pzz temp:
自定义热力学输出格式,包括步数(step)、势能(pe)、系统尺寸(lx, ly, lz)、总压力(press)和各方向的压力分量(pxx, pyy, pzz)、温度(temp)。
run 350000:
运行35万步,模拟系统在加热过程中逐步达到1750 K。
unfix 1 和 undump 1:
unfix命令移除前面定义的fix操作。
undump命令停止数据输出。
============================================================================
velocity sl scale 1750 units box
velocity lq_all create 2000 481516
fix 1 lq_all npt temp 2000 2000 2.0 aniso 0.0 0.0 2.0 drag 1.0
dump 1 all custom 50000 dump.lq1npt.* id type x y z fx fy fz vx vy vz
thermo 1000
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
run 300000
unfix 1
undump 1
============================================================================
velocity sl scale 1750 units box:
velocity命令将sl组的速度按温度1750 K进行缩放。
velocity lq_all create 2000 481516:
velocity命令为lq_all组的原子生成符合2000 K温度的随机速度,481516是随机数种子。
fix 1 lq_all npt temp 2000 2000 2.0 aniso 0.0 0.0 2.0 drag 1.0:
对lq_all组施加恒温恒压控制,保持系统温度在2000 K。
仍然是各向异性压力控制,且压力目标值为0。
dump 1 all custom 50000 dump.lq1npt. id type x y z fx fy fz vx vy vz*:
每50000步输出一次自定义原子数据,文件名为dump.lq1npt.*。
thermo 1000:
每1000步输出一次热力学数据。
run 300000:
运行30万步,保持系统温度在2000 K。
unfix 1 和 undump 1:
移除NPT控制并停止数据输出。
============================================================================
velocity sl scale 1750 units box
fix 1 lq_all npt temp 2000 1820 2.0 aniso 0.0 0.0 2.0 drag 1.0
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
dump 8 all custom 10000 dump.lq1820.* id type x y z fx fy fz vx vy vz
run 300000
unfix 1
undump 8
============================================================================
velocity sl scale 1750 units box:
将sl组的速度调整到对应1750 K的值。
fix 1 lq_all npt temp 2000 1820 2.0 aniso 0.0 0.0 2.0 drag 1.0:
通过NPT控制使lq_all组从2000 K冷却到1820 K。
thermo 100:
每100步输出一次热力学数据。
dump 8 all custom 10000 dump.lq1820. id type x y z fx fy fz vx vy vz*:
每10000步输出一次数据,文件名为dump.lq1820.*。
run 300000:
运行30万步,模拟系统冷却到1820 K。
unfix 1 和 undump 8:
移除NPT控制并停止数据输出。
============================================================================
fix 1 all npt temp 1820 1820 2.0 aniso 0.0 0.0 2.0 drag 1.0
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
variable step_present equal step
variable T_present equal temp
variable P_present equal press
variable PE_present equal pe
variable E_present equal etotal
fix def1 all print 100 "${step_present} ${T_present} ${P_present} ${PE_present} ${E_present}" file melting.dat screen no
dump 8 all custom 10000 dump.eq1820.* id type x y z fx fy fz vx vy vz
run 800000
unfix 1
undump 8
write_restart coext_01.data
fix 1 all npt temp 1820 1820 2.0 aniso 0.0 0.0 2.0 drag 1.0:
对整个系统施加恒温恒压控制,保持温度为1820 K,并继续各向异性压力控制。
thermo 100:
每100步输出一次热力学数据。
thermo_style custom:
与之前一样,输出步数、势能、盒子尺寸、压力、温度等信息。
variable命令定义了一些变量:
当前的步数。 :
T_present: 当前的温度。
P_present: 当前的压力。
PE_present: 当前的势能。
E_present: 当前的总能量。
fix def1 all print:
每100步将这些变量的值输出到文件melting.dat中,并且不输出到屏幕。
:
每10000步输出一次自定义的原子数据,文件名为dump.eq1820.*。
run 800000:
运行80万步,系统保持在1820 K。
unfix 1 和 undump 8:
移除NPT控制并停止数据输出。
完整LAMMPS输入文件:
#============================================================================
clear
dimension 3
boundary p p p
units metal
atom_style atomic
variable a_param equal 2.8665
variable a equal ${a_param}
variable xdim equal 18
variable ydim equal 18
#variable zdim equal 160
#variable zdim_sol equal ${zdim}/2.0
#============================================================================
# #
# Initial simulation setup #
# #
#============================================================================
lattice bcc ${a} orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region box block 0 ${xdim} 0 ${ydim} 0 120
create_box 1 box
create_atoms 1 region box
region liq1 block 0 ${xdim} 0 ${ydim} 0 30
region sol block 0 ${xdim} 0 ${ydim} 30 90
region liq2 block 0 ${xdim} 0 ${ydim} 90 120
group lq1 region liq1
group sl region sol
group lq2 region liq2
group lq_all union lq1 lq2
pair_style eam/fs
pair_coeff * * Fe_5.eam.fs Fe
neighbor 2.0 bin
neigh_modify every 1 delay 0 check yes
reset_timestep 0
timestep 0.001
fix 7 all box/relax iso 0.0 vmax 0.001
min_style cg
min_modify dmax 0.1
minimize 1.0e-25 1.0e-20 5000 10000
unfix 7
velocity all create 100 481516
fix 1 all npt temp 100 300 2 aniso 0.0 0.0 2 drag 1.0
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
run 200000
unfix 1
fix 1 all npt temp 300 1750 2 aniso 0.0 0.0 2 drag 1.0
dump 1 all custom 50000 dump.r1820.* id type fx fy fz vx vy vz
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
run 350000
unfix 1
undump 1
velocity sl scale 1750 units box
velocity lq_all create 2000 481516
fix 1 lq_all npt temp 2000 2000 2.0 aniso 0.0 0.0 2.0 drag 1.0
dump 1 all custom 50000 dump.lq1npt.* id type x y z fx fy fz vx vy vz
thermo 1000
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
run 300000
unfix 1
undump 1
velocity sl scale 1750 units box
fix 1 lq_all npt temp 2000 1820 2.0 aniso 0.0 0.0 2.0 drag 1.0
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
dump 8 all custom 10000 dump.lq1820.* id type x y z fx fy fz vx vy vz
run 300000
unfix 1
undump 8
fix 1 all npt temp 1820 1820 2.0 aniso 0.0 0.0 2.0 drag 1.0
thermo 100
thermo_style custom step pe lx ly lz press pxx pyy pzz temp
variable step_present equal step
variable T_present equal temp
variable P_present equal press
variable PE_present equal pe
variable E_present equal etotal
fix def1 all print 100 "${step_present} ${T_present} ${P_present} ${PE_present} ${E_present}" file melting.dat screen no
dump 8 all custom 10000 dump.eq1820.* id type x y z fx fy fz vx vy vz
run 800000
unfix 1
undump 8
write_restart coext_01.data
================================
以上是我们分享的一些经验或者文章的搬运,或有不足,欢迎大家指出。若留言未回复,重要的消息可以留言再提醒一下,因为超过48小时不可回复。
如有侵权,请联系我们立马删除!
【文献分享】分子动力学模拟 + LAMMPS + 熔化温度 + 晶体缺陷 + 熔化方法 LAMMPS 文献:金属熔化行为的局域原子结构模拟与分析 LAMMPS 文献:9 种熔化温度模拟方法的总结与比较(三):两相方法、单相方法以及缺陷方法 LAMMPS 文献:使用两相法计算熔化温度的软件(二) LAMMPS 文献:使用两相法自动计算熔化温度的软件(一) 关于一篇带有 LAMMPS 输入文件的文章(三) 关于一篇带有 LAMMPS 输入文件的文章(二) 关于一篇带有 LAMMPS 输入文件的文章 表面能的计算 & lammps输入脚本 (二) 表面能的计算 & lammps输入脚本(一) 表面能的计算 & lammps输入脚本 脚本分享】LAMMPS 计算熔化温度 :单相法 + 孔洞法 + 两相法 【LAMMPS 输入文件】J. Chem. Theory Comput.:利用反应力场研究金属和金属氧化物的熔点和晶体生长动力学