lammps案例:气体扩散模拟代码_初始化

分享一个气体扩散模拟案例。

在三维空间内随机填充100个气体原子,初始化温度后,原子获得初始速度。

在nve系综下,原子在lj力场下势能和动能相互转化,产生扩散现象。

温度越高,扩散速度越快。

代码已经全部注释,仅供参考。

in文件代码如下:

#气体粒子数量
variable npart equal 100
#模拟基本参数设置
units lj
dimension 3
atom_style atomic
boundary p p p
neighbor 0.5 bin
neigh_modify every 1 delay 0 check yes
#三维box尺寸
region box block -10 10 -10 10 -10 10
#生成box
create_box 1 box
#随机产生100个气体原子
create_atoms 1 random ${npart} 324523 box
#设置摩尔质量1
mass 1 1
#力场设置,soft势
pair_style soft 1.0
pair_coeff * * 10.0
#温度初始化
velocity all create 2.0 34234123 dist gaussian
#能量最小化
minimize 1e-4 1e-4 1000 1000
reset_timestep 0
#保存轨迹文件
dump img all atom 1000 gas.xyz
#设置nve系综
fix 1 all nve
#热力学输出
thermo_style custom step temp ke pe
thermo 100
#模拟步长
timestep 0.001
#运行100000步
run 100000

更多lammps案例请关注微信公众号:lammps加油站

lammps案例:气体扩散模拟代码_初始化_02