当前位置:文档之家› 关于lammps学习的一点汇总

关于lammps学习的一点汇总


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
模拟流程:
三、Lammps模拟的相关命令
一般而言,一个Lammps工作目录需要包含以下几个文件;
Lammps执行程序


脚本文件(in文件)
势函数文件(…eam.alloy , …tersoff, …sw)


data文件(体系的初始构型)
MPI并行文件(多核运行计算)
脚本文件的内容及书写格式
的位置及速度;由新的位置计算系统的势能,得到各原子的受力及
加速度。反复循环,就可以得到系统中原子的运动轨迹并输出相关
的热力学数据。
优势: 把整个原子作为一个质点进行模拟,减少了自由度的计算, 加大了可计算的体系的空间和时间尺度,简化数据处理和 分析。
二、Lammps软件的基本介绍
Lammps?
Large-scale Atomic/Molecular Massively Parallel Simulator
大规模原子/分子并行模拟器 简单的来说,Lammps就是一个可根植于Windows和Linux系统 的经典分子动力学代码;根据不同的边界条件和初始条件对相互 作用的分子,原子,宏观粒子集合进行牛顿运动方程积分,并输 出相关的热力学数据。
优点: 免费开源的代码;可以根据需要修改、扩展计算程序(C++) 可对固、液、气三种状态的物质进行模拟 能模拟多种模型体系(原子,聚合物,有机分子,粒子材料) 模拟体系可达上百万个粒子(计算资源) 方便的并行计算
#关键字:定义原子质量 #定义第一种原子质量 #定义第二种原子质量 #关键字:定义原子坐标
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
直接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 25999948 #原子坐标:原子编号 原子类型 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
In文件结构 一般分为4个部分:Initialization, Atom definition, Settings, Run a simulation
(1) Initialization
模拟体系之前, 一些参数必须要被设置. 相关的命令有:units, dimension, boundary, atom_style 等.
Atom definition lammps内部搭建模型 Al块体结构 lattice fcc 4.0495 #定义晶格类型 region box block 0 10 0 10 0 10 #定义模拟盒子的大小 create_box 1 box #创建模拟盒子 create_atoms 1 box #在模拟盒子中创建原子 NaCl结构 lattice custom $x a1 1.0 0.0 0.0 a2 0.0 1.0 0.0 a3 0.0 0.0 1.0 & basis 0.0 0.0 0.0 basis 0.5 0.5 0.0 basis 0.5 0.0 0.5 basis 0.0 0.5 0.5 & basis 0.5 0.5 0.5 basis 0.0 0.0 0.5 basis 0.0 0.5 0.0 basis 0.5 0.0 0.0 region box block 0 5 0 5 0 5 create_box 2 box 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
(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命令设置.
(2) Atom definition
lammps提供3种方式定义原子: ① 按照晶格的方式创建原子, 相关命令: lattice, region, create_box , create_atoms . ② 通过read_data 或 read_restart 命令从data或restart文件读入(可包含 出原子坐标之外的一些信息) ③ 已经设置好的原子可以用replicate命令复制以生成一个更大规模的 模拟体系.
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
不同的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 ….
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
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 边界条件不同,模拟所得到的结果会有所不同,应根据实际模拟的 问题和选用的系综来选取合适的边界条件
(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
相关主题