当前位置:
文档之家› 关于lammps学习的一点汇总
关于lammps学习的一点汇总
不管采用什么途径,只要data文件格式符合要求,lammps就可以读入 Materials studio结合msi2lmp写入data文件 在MS搭建好模型 在Modules中选择Discover模块,将Forcefield设置为cvff
Calculate之后将构型文件Export,保存为*.car *.cor类型
方程中包含了所有的原子核及电子的哈密度量和波函数
密度泛函理论:
H ( (r )) E ( (r ))
用电子密度代替电子坐标,减少自由的计算
分子动力学模拟 ? :解牛顿运动方程的过程
Fi (t ) a i (t ) 利用 mi ,先由各个原子的位置计算系统的势能,
得到各个原子所受的力及加速度,然后计算各原子在经过△T之后
不同的atom_style, data文件格式不尽相同
定义原子坐标的格式
atomic charge full hybrid atom-ID atom-type x y z atom-ID atom-type q x y z atom-ID molecule-ID atom-type q x y z atom-ID atom-type x y z sub-style1 sub-style2 ….
的位置及速度;由新的位置计算系统的势能,得到各原子的受力及
加速度。反复循环,就可以得到系统中原子的运动轨迹并输出相关
的热力学数据。
优势: 把整个原子作为一个质点进行模拟,减少了自由度的计算, 加大了可计算的体系的空间和时间尺度,简化数据处理和 分析。
二、Lammps软件的基本介绍
Lammps?
Large-scale Atomic/Molecular Massively Parallel Simulator
大规模原子/分子并行模拟器 简单的来说,Lammps就是一个可根植于Windows和Linux系统 的经典分子动力学代码;根据不同的边界条件和初始条件对相互 作用的分子,原子,宏观粒子集合进行牛顿运动方程积分,并输 出相关的热力学数据。
优点: 免费开源的代码;可以根据需要修改、扩展计算程序(C++) 可对固、液、气三种状态的物质进行模拟 能模拟多种模型体系(原子,聚合物,有机分子,粒子材料) 模拟体系可达上百万个粒子(计算资源) 方便的并行计算
(4)Run a simulation 使用run命令开始一个分子动力学模拟; 用minimize命令来实施能量最小化(molecular statics)
Initialization units Syntax: units style style = lj or real or metal or si or cgs or electron Examples: units lj units metal dimension Syntax: dimension N N = 2 or 3 Examples: dimension 3
In文件结构 一般分为4个部分:Initialization, Atom definition, Settings, Run a simulation
(1) Initialization
模拟体系之前, 一些参数必须要被设置. 相关的命令有:units, dimension, boundary, atom_style 等.
直接export保存为*.car *.cor类型 将保存的两个文件**.car和**.mdf 复制到msi2lmp的工作路径 在msi2lmp路径下执行 ./msi2lmp.exe ** -class I -frc cvff > data.**
settings
力场参数(势函数的调用) pair_style pair_coeff Examples: pair_style eam/alloy pair_coeff * * AlCu.eam.alloy Al Cu pair_style eam/alloy pair_coeff * * AlCu.eam.alloy Al Al Al Cu pair_style pair_coeff pair_style pair_coeff eam 1 1 Al.eam eam 2 2 Cu.eam pair_style eam/alloy pair_coeff * * AlCu.eam.alloy Cu Al
#关键字:定义原子质量 #定义第一种原子质量 #定义第二种原子质量 #关键字:定义原子坐标
1 2 3 4 5 6 7 8 9 10
1 1 1 1 1 2 2 2 2 2
0.000000000 0.000000000 2.022364706 2.022364706 0.000000000 2.022364706 0.000000000 2.022364706 0.000000000 2.022364706
模拟流程:
三、Lammps模拟的相关命令
一般而言,一个Lammps工作目录需要包含以下几个文件;
La件(in文件)
势函数文件(…eam.alloy , …tersoff, …sw)
data文件(体系的初始构型)
MPI并行文件(多核运行计算)
脚本文件的内容及书写格式
boundary Fixed boundary (f)
Free boundary (s)
柔性边界 (m): 允许边界上的粒子有微小 移动以反映内层粒子的作用力施加到它 们身上的情况
Periodic boundary (p)
Syntax: boundary x y z x, y, z = p or s or f or m, one or two letters Examples: boundary p p f boundary p fs p boundary s f fm 边界条件不同,模拟所得到的结果会有所不同,应根据实际模拟的 问题和选用的系综来选取合适的边界条件
pair_style eam/alloy pair_coeff * * AlCu.eam.alloy Cu
neighbor neighbor cutoff distance = force cutoff + skin distance Syntax: neighbor skin style skin = extra distance beyond force cutoff (distance units) style = bin or nsq or multi Examples: neighbor 0.3 bin neighbor 2.0 nsq 三种算法(处理器分配的原子数) bin: N/P nsq: (N/P)^2 默认值 2.0 bin for units = real or metal, skin = 2.0 Angstroms
0.000000000 33.825999948 #原子坐标:原子编号 原子类型 x坐标 y坐标 z坐标 0.000000000 102.667499948 2.022364706 33.825999948 2.022364706 102.667499948 2.022364706 35.850749948 0.000000000 35.850749948 0.000000000 37.875499948 2.022364706 37.875499948 2.022364706 39.900249948 0.000000000 39.900249948
(3)settings 原子信息定义好后, 要定义一系列的设置: 力场系数、模拟参数、输出选项 等. 力场系数可以通过这些命令定义: pair_style , pair_coeff , bond_coeff , angle_coeff 等。 各种模拟参数由这些命令设置: neighbor, group, timestep, reset_timestep , run_style , min_style. fix命令是lammps中很重要的一个命令, 它包括很多子命令, 对体系施加 一系列的约束条件,选择系综等等. 设定 lammps进行各种计算: compute, variable. 输出选项由thermo, dump, restart命令设置.
外部搭建模型
LAMMPS 2013 data file for alcucouple 61968 atoms #总原子数 #注释行
2 atom types
#原子类型
#模拟盒子x方向尺寸 #模拟盒子y方向尺寸 #模拟盒子z方向尺寸
0.000000000 68.760400000 xlo xhi 0.000000000 68.760400000 ylo yhi 0.000000000 186.420900000 zlo zhi Masses 1 26.982000 2 63.546001 Atoms
atom_style Syntax: atom_style style args style = atomic or body or charge or dipole or electron or full or molecular or peri or sphere or tri or hybrid Examples: atom_style atomic atom_style full
bonds = # of bonds in system angles = # of angles in system dihedrals = # of dihedrals in system impropers = # of impropers in system bond types = # of bond types in system angle types = # of angle types in system dihedral types = # of dihedral types in system improper types = # of improper types in system