大家好,我是小马老师。
本文讲解lammps模拟剪切过程的关键技术,以供初学者参考。
在lammps自带剪切案例代码,只不过案例是二维模型,本文以此案例为基础,改为三维模型,为使结构更加清晰,对部分代码做了改动。
剪切的原理是设置上下边界,在剪切时固定下部边界,设置上部边界一个移动速度。
模型结果:
下面是各模块代码介绍。
1.模型基本参数
units metal
boundary s p p
neighbor 2 bin
neigh_modify every 1 delay 5
atom_style atomic
timestep 0.001
在剪切x方向使用s边界,其它方向为p边界。
2.建模
lattice fcc 3.52
region box block 0 16 0 3 0 10
create_box 3 box
create_atoms 1 box
使用晶格尺寸建立box,box内共3种原子类型
3.势函数设置
pair_style eam
pair_coeff * * Ni_u3.eam
使用系统自带的eam势。
4.分组设置
region lower block INF INF INF INF INF 2
region upper block INF INF INF INF 8 INF
group lower region lower
group upper region upper
group boundary union lower upper
group mobile subtract all boundary
设置上下边界层和中间移动层。
set group lower type 2
set group upper type 3
为明确区分,把上下边界层原子类型改为2和3.
5.温度计算
compute new3d mobile temp
compute new2d mobile temp/partial 0 1 1
重新定义温度计算。
此项计算比较关键,因为有上下边界层,因此在控温时只需要对mobile组进行控温。
另外,在剪切时上层边界人为设置了一个移动速度,这部分速度不能计入温度计算,因此,new2d只计算y和z方向的温度。
6.温度初始化
velocity mobile create 300.0 5812775 temp new3d
7.弛豫
fix 1 all nve
fix 2 boundary setforce 0.0 0.0 0.0
fix 3 mobile temp/rescale 10 300.0 300.0 10.0 1.0
fix_modify 3 temp new3d
thermo 25
thermo_modify temp new3d
run 100
unfix 3
使用速度标定法对mobile组进行弛豫,使其温度稳定到300k。
8.剪切
dump 1 all atom 100 shear.xyz
velocity upper set 1.0 0 0
velocity mobile ramp vx 0.0 1.0 z 2 8 sum yes
fix 3 mobile temp/rescale 10 300.0 300.0 10.0 1.0
fix_modify 3 temp new2d
thermo 100
thermo_modify temp new2d
reset_timestep 0
run 5000
剪切过程中,上部边界x方向速度设为1(晶格单位),mobile按照z方向的尺寸设置一个速度梯度。最上端原子速度为0,下端速度为0,中间原子速度按比例设置。
mobile组控温300k,此温度只包含y和z方向的速度因素。
案例包含in.shear和Ni_u3.eam两个文件,将所有文本复制粘贴到一个文本文件,到lammps安装目录找到Ni_u3.eam文件,放到一个文件夹运行即可。
本公众号号正式推出一对一咨询辅导服务,根据课题方向不同详细讲解对应的in文件编写方法、模拟关键技术、数据后处理,经一对一咨询辅导后能够独立编写出in文件。
具体内容可查看公众号一对一培训说明:lammps一对一培训
公众号案例代码以及学习交流,请加QQ群:754749935
扫描关注微信公众号:lammps加油站。