#==========模型基本设置========== units metal dimension 3 newton on boundary p p p atom_style atomic neighbor 2.0 bin neigh_modify delay 0 every 1 check yes variable dt equal 0.0005 timestep ${dt} #==========读取文件========== read_data 2.dat mass 1 95.94 mass 2 32.066 pair_style sw pair_coeff * * mos2.sw Mo S #==========分块参数========== variable X1 equal xlo variable X2 equal xhi variable Nlay equal 50 variable Dscale equal 1/${Nlay} variable Len equal ${X2}-${X1} variable Dz equal ${Len}/${Nlay} #==========修复:分离固定端和热源========== # 左侧:固定端(0-2*Dz) + 热源(2*Dz-10*Dz) variable BL1 equal ${X1}+0*${Dz} variable BL2 equal ${X1}+2*${Dz} # 固定端范围 variable HL1 equal ${X1}+2*${Dz} # 热源起始 variable HL2 equal ${X1}+10*${Dz} # 热源结束 # 右侧:冷源(40*Dz-48*Dz) + 固定端(48*Dz-50*Dz) variable CR1 equal ${X2}-10*${Dz} # 冷源起始 variable CR2 equal ${X2}-2*${Dz} # 冷源结束 variable BR1 equal ${X2}-2*${Dz} variable BR2 equal ${X2}+0*${Dz} # 固定端范围 #==========区域定义========== region fixed_L block INF ${BL2} INF INF INF INF units box region fixed_R block ${BR1} INF INF INF INF INF units box group fixed_L region fixed_L group fixed_R region fixed_R # 热源和冷源只在活动区域 region Hot block ${HL1} ${HL2} INF INF INF INF units box region Cold block ${CR1} ${CR2} INF INF INF INF units box group Hot region Hot group Cold region Cold group Mo type 1 group S type 2 group mobile subtract all fixed_L fixed_R #==========能量最小化========== thermo 1000 thermo_style custom step temp pxx pyy pzz press vol min_style cg minimize 1.0e-8 1.0e-8 10000 1000000 reset_timestep 0 #==========初始速度========== velocity all create 300 898758 mom yes rot yes dist gaussian #==========NVT弛豫========== fix 1 all nvt temp 300 300 0.1 dump 1 all custom 2000 nvt.xyz id type x y z thermo 2000 thermo_style custom step temp pe ke etotal vol pxx pyy pzz press run 200000 unfix 1 undump 1 reset_timestep 0 #==========固定两端========== velocity fixed_L set 0 0 0 velocity fixed_R set 0 0 0 fix fixL fixed_L setforce 0 0 0 fix fixR fixed_R setforce 0 0 0 #==========积分(只对活动原子)========== fix 5 all nve #==========冷热源(Langevin恒温器)========== fix 3 Hot langevin 325 325 0.1 14565 tally yes fix 4 Cold langevin 275 275 0.1 16576 tally yes #==========空间分块定义========== compute chunk_T all chunk/atom bin/1d x lower ${Dscale} units reduced #==========能量统计========== variable Time equal step variable EL equal f_3 variable ER equal f_4 fix E_out all print 2000 "${Time} ${EL} ${ER}" file Ener_equ.dat title "Time E1 E2" screen no #==========第一阶段:建立稳态========== thermo 2000 thermo_style custom step temp ke pe etotal press vol run 2000000 reset_timestep 0 compute ke_atom all ke/atom variable temp_atom atom c_ke_atom/1.5/8.625e-5 #==========第二阶段:统计========== fix ave_T all ave/chunk 10 500 1500000 chunk_T temp file temp_profile.dat norm sample #==========输出文件========== dump 1 all custom 50000 nemd_stable.xyz id type x y z v_temp_atom dump 2 all custom 200 voutput_all.lammpstrj id type vx vy vz dump_modify 2 sort id dump 3 S custom 200 voutput_S1.lammpstrj id type vx vy vz dump_modify 3 sort id dump 4 Mo custom 200 voutput_Mo1.lammpstrj id type vx vy vz dump_modify 4 sort id #==========热力学输出========== thermo 2000 thermo_style custom step temp ke pe etotal press vol run 2000000