lammps模拟过程中的简单建模方法及举例


    在分子模拟过程中,建立合适的模型是模拟进行的首要前提。但在lammps中只能建立简单的模型,当遇到复杂的模型时,则需要通过atomsk等专业软件进行辅助。本文介绍了在lammps中的简单模型建立,希望能够帮助初学者加深对模型建立的了解。

1.lammps建模方法

 1.lattice:确定晶格类型和晶格常数
 2.region:确定区域
 3.create_box:创建盒子,设置原子类型
 4.create_atoms:创建指定类型的原子
 5.mass:设置原子摩尔质量
 6.write_data:保存原子结构

2.lammps建模案例

 1.石墨烯建模

lattice    custom 1.421 a1 3 0 0 a2 0 1.732 0 a3 0 0 2 & 
basis      0 0 0 &      
basis      0.33 0 0 &
basis      0.5 0.5 0 &
basis      0.833 0.5 0
#自定义晶格,1.421碳碳单键的长度,a1 a2 a3为晶格xyz轴方向尺寸(以键长倍数表示),&换行符
# basis填充原子,xyz坐标(键长倍数)

 in文件:

#石墨烯建模

units                metal                #单位
dimension            3                       #纬度
boundary             p p p                 #边界条件
atom_style           atomic              #原子类型

lattice              custom 1.421 a1 3 0 0 a2 0 1.732 0 a3 0 0 2 &      
basis                0 0 0 &
basis                0.33 0 0 &
basis                0.5 0.5 0 &
basis                0.833 0.5 0     #自定义晶格,&表示换行

region               box block 0 10 0 10 0 1 units lattice           #模拟区域,单位:晶格长度
create_box           1 box                                                           #创建盒子
create_atoms         1 box                                                           #生成类型1的原子

mass                 1 12.011                                                      #设置原子类型1的摩尔质量
write_data           graphene.data                                            #保存模型

 2.Ni/graphene建模

region       box block 0 20 0 20 0 20 units box   #模拟区域,使用盒子的单位
create_box   2 box                                #设置box中2种原子

#生成Ni
lattice      fcc 3.52                             #Ni晶格
create_atoms   1 box                              #生成类型1的原子

#删除中间Ni层
region          Ni_del block INF INF INF INF 10 13 units box  #设置删除区域,使用盒子的单位
delete_atoms    region Ni_del                                 #删除某区域原子

 in文件:

# 基本参数
units                 metal                          #单位
dimension             3                                 #纬度
boundary              p p p                           #边界条件

#构建模型
lattice               fcc 3.52                                                      #Ni晶格
region                box block 0 20 0 20 0 20 units box            #定义模拟区域,使用盒子的单位
create_box            2 box                                                          #box区域中2种原子
create_atoms          1 box                                                           #生成类型1的原子
region                Ni_del block INF INF INF INF 10 13 units box         #定义替换区域
delete_atoms          region Ni_del                                               #删除某区域原子

#生成石墨烯层
lattice               custom 2.4768 a1 1 0 0 a2 0 1.732 0 a3 0 0 1.3727 &
basis                 0 0.33333 0 &
basis                 0 0.66667 0 &
basis                 0.5 0.16667 0 &
basis                 0.5 0.83333 0
region                Gp block 0 20 0 20 10 13 units box          #定义石墨烯区域
create_atoms          2 region Gp                                              #生成类型2的原子

#设定原子质量
mass                 1 58.6934                                #Ni
mass                 2 12.011                                  #C

#保存模型
write_data           NiGp.xyz                  

 3.TiC建模

lattice      custom 4.33565 a1 1 0 0 a2 0 1 0 a3 0 0 1 &
basis        0 0 0 &
basis        0 0.5 0.5 &
basis        0.5 0 0.5 &
basis        0.5 0.5 0 &
basis        0.5 0 0 &
basis        0.5 0.5 0.5 &
basis        0 0 0.5 &
basis        0 0.5 0    # basis前四个Ti原子,后四个C原子

create_atoms   2 box &
basis        1 1 &
basis        2 1 &
basis        3 1 &
basis        4 1 &
basis        5 2 &
basis        6 2 &
basis        7 2 &
basis        8 2      # basis前四个类型1原子,后四个类型2原子

 in文件:

#基本参数
units       metal     #单位
dimension   3           #纬度
boundary    p p p     #边界条件

#建立模型
lattice          custom 4.33565 a1 1 0 0 a2 0 1 0 a3 0 0 1 &
basis            0 0 0 &
basis            0 0.5 0.5 &
basis            0.5 0 0.5 &
basis            0.5 0.5 0 &
basis            0.5 0 0 &
basis            0.5 0.5 0.5 &
basis            0 0 0.5 &
basis            0 0.5 0     #自定义晶格,前四个Ti原子,后四个C原子
region          box block 0 10 0 10 0 10   #模拟区域
create_box      2 box        #设置2种原子类型
create_atoms     2 box &
basis            1 1 &
basis            2 1 &
basis            3 1 &
basis            4 1 &
basis            5 2 &
basis            6 2 &
basis            7 2 &
basis            8 2      # 自定义填充原子,basis前四个类型1原子,后四个类型2原子

#设置相对原子质量
mass           1 47.867    #Ti
mass           2 12.011    #C

#保存模型
write_data   TiC.data

 4.Cu孪晶建模

#创建下部分Cu
lattice fcc 3.61 origin 0.6 0.5 0 orient x 1 1 -2 orient y 1 1 1 orient z 1 -1 0
# orient重新定义晶向,(默认x 100,y 010,z 001),xyz方向遵守右手法则,origin使晶格偏移以便于对齐
region upper block 0 10 0 5 0 10  #模拟区域
create_atoms 1 region upper
group upper region upper

#创建上部分Cu,上下部分晶格取向不同
lattice fcc 3.61 origin 0 0.2 0 orient x -1 -1 2 orient y 1 1 1 orient z -1 1 0
region lower block 0 10 5 10 0 10
create_atoms 2 region lower
group lower region lower

 in文件:

units                 metal                      #单位                             
dimension             3                             #纬度
boundary              p p p                      #边界条件
atom_style            atomic                    #原子类型

#创建盒子
lattice               fcc 3.61 orient x 1 1 -2 orient y 1 1 1 orient z 1 -1 0
region                box block 0 10 0 10 0 10                     #使用晶格尺寸创建区域
create_box            2 box                                                   #盒子区域两种原子

#创建上部分Cu
lattice               fcc 3.61 origin 0.6 0.5 0 orient x 1 1 -2 orient y 1 1 1 orient z 1 -1 0  #晶格重定向,晶格偏移
region                upper block 0 10 0 5 0 10   #上部区域
create_atoms          1 region upper                    #上部区域生成类型1的原子
group                 upper region upper            #将上部原子定义为组upper

#创建下部分Cu
lattice               fcc 3.61 origin 0 0.2 0 orient x -1 -1 2 orient y 1 1 1 orient z -1 1 0      #晶格重定向,晶格偏移
region                lower block 0 10 5 10 0 10     #下部区域
create_atoms          2 region lower                        #下部区域生成类型2的原子
group                 lower region lower                  #将下部原子定义为组lower

#设置相对原子质量
mass                   1 63.546
mass                   2 63.546

#保存模型
write_data             Cu_twin.data
3.Atomsk建模

 1.create:创建
 语法:atomsk --create 晶格类型 晶格常数 元素名称 文件名称
 举例:

atomsk --create bcc 2.856 Fe Fe.xsf
atomsk --create fcc 3.597 Cu Cu.xsf
atomsk --create hcp 3.21 5.213 Mg Mg.xsf  #密排六方
atomsk --create rocksalt 5.64 Na Cl NaCl.xsf  

 2.duplicate:复制
 语法:atomsk -duplicate x y z
 举例:

atomsk --create bcc 3.155 W W.xsf
atomsk W.xsf -duplicate 3 4 10 W.lmp
#两条命令合并
atomsk --create bcc 3.155 W -duplicate 3 4 10 W.lmp

 3.石墨烯建模

 命令:

atomsk --create graphite 3.21 5.213 C gp.xsf  #创建石墨
atomsk gp.xsf -cut above 0.2 Z graphene.xsf  #cut命令将z坐标0.2以上的碳原子切掉

 盒子改为正交:

atomsk --create graphite 3.21 5.213 C -cut above 0.2 Z -orthogonal-cell graphene.xsf  #改为正交
atomsk graphene.xsf -duplicate 10 10 1 final.lmp  #复制扩胞

 4.单壁CNT建模

atomsk --create nanotube 2.6 8 0 C CNT.lmp
#移动到盒子中间:
atomsk --create nanotube 2.6 8 0 C -shift 0.5*box 0.5*box 0.0 CNT.lmp
#shift x y z xyz方向移动距离
#复制扩胞
atomsk --create nanotube 2.6 8 0 C -shift 0.5*box 0.5*box 0.0 -duplicate 1 1 6 CNT.lmp
4.set type/ratio命令

    set type/ratio命令将某类型的原子,按比例随机选择原子,并将其转换为其他原子,常用于高熵合金的建模。

set type typr_ID type/ratio type_new fraction seed

type_ID:初始原子类型
type_new:将要转换的原子类型
fraction:新原子占初始原子类型的比例,fraction = type_new/type_ID
seed:随机种子

# 代码实例,高熵合金,AlCuFeMgSi合金,比例1:1:1:1:1
# 将type 1的原子转换为其他类型原子
set type 1 type/ratio 2 0.2 87393                # 0.2 = 0.2/1.0
set type 1 type/ratio 3 0.25 87393               # 0.25 = 0.2/0.8
set type 1 type/ratio 4 0.3333 87393             # 0.33333 = 0.2/0.6    
set type 1 type/ratio 5 0.5 87393                # 0.5 = 0.2/0.4
# 设置原子类型
mass 1 26.982                      #Al
mass 2 63.546                      #Cu
mass 3 55.845                      #Fe
mass 4 24.305                      #Mg
mass 5 28.085                      #Si
5.replicate命令

    replicate命令不仅可以创建超晶胞(对原胞的扩展,比如3* 3,2* 2等),还可以创造具有阵列特征的结构。

replicate nx ny nz

nx、ny、nz在xyz方向上复制的分数

# 代码实例,在xyz方向上分别扩大2、3、2倍
replicate 2 3 2
6.CIF文件

    CIF又称为晶体学信息文件,包含了每个晶体的详细信息,如晶胞参数、原子坐标等。
    绝大多数的已知晶体都可以从该网站下载CIF文件,https://next-gen.materialsproject.org/materials
在CIF文件中,以CsCl为例:

_cell_length_a   7.06201400
_cell_length_b   7.06201400
_cell_length_c   7.06201400
# 为lattice custom中a1 a2 a3三个基矢的长度

_cell_angle_alpha   90.00000000
_cell_angle_beta   90.00000000
_cell_angle_gamma   90.00000000
# 为三个基矢之间的夹角度数

Cs+  Cs0  1  0.00000000  0.00000000  0.00000000  1
Cs+  Cs1  1  0.00000000  0.50000000  0.50000000  1
Cs+  Cs2  1  0.50000000  0.00000000  0.50000000  1
Cs+  Cs3  1  0.50000000  0.50000000  0.00000000  1
Cl-  Cl4  1  0.50000000  0.00000000  0.00000000  1
Cl-  Cl5  1  0.50000000  0.50000000  0.50000000  1
Cl-  Cl6  1  0.00000000  0.00000000  0.50000000  1
Cl-  Cl7  1  0.00000000  0.50000000  0.00000000  1
# 为Cs原子和Cl原子坐标,可以直接写在lattice custom中
  • 7
    点赞
  • 58
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值