lammp中文手册

更新时间:2024-01-14 21:48:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

lammps简要使用说明

李小椿

北京航空航天大学物理科学与核能工程学院

bestlxc@163.com

更新于:2010年2月1日星期一

目录

lammps简要使用说明 .......................................................................................................................................................... 1

LAMMPS介绍 ................................................................................................................................................................. 4 文件 ................................................................................................................................................................................ 4 1. 系统初始化..................................................................................................................................................................... 4

units lj/real/metal/si/cgs ................................................................................................................................................. 4 atom_style angle/atomic/bond/charge/dipole/dpd/ellipsoid/full/granular/molecular/hybrid ..................................... 5 atom_modify map/first ................................................................................................................................................... 5 dimension N ,N=2/3 ......................................................................................................................................................... 5 boundary x y z, default=boundary p p p ......................................................................................................................... 5 newton flag/flag1 flag2 ................................................................................................................................................... 5 communicate single/multi group/cutoff ......................................................................................................................... 5 processors Px Py Pz ......................................................................................................................................................... 6 2. 创建模拟晶胞 ................................................................................................................................................................. 6

lattice none/sc/bcc/fcc/hcp/diamond/sq/sq2/hex/custom scale keyword values ......................................................... 6 region ID style block/cylinder/prism/sphere/union/intersect args keyword value ........................................................ 6 group ID region/type/id/molecule/subtract/union/intersect ......................................................................................... 6 create_box N region?ID .................................................................................................................................................. 7 create_atoms type box/region/single args keyword values ............................................................................................ 7 delete_atoms group/region/overlap/porosity args ........................................................................................................ 7 read_restart file/read_date file ....................................................................................................................................... 7 set atom/group/region ID keyword values ..................................................................................................................... 8 displace_atoms group?ID move/ramp/random args keyword value .............................................................................. 8 displace_box group?ID parameter args ... keyword value …........................................................................................... 9 change_box ortho/triclinic .............................................................................................................................................. 9 replicate nx ny nz ............................................................................................................................................................ 9 3. 设置 ................................................................................................................................................................................ 9

mass I value ..................................................................................................................................................................... 9 velocity group?ID create/set/scale/ramp/zero args keyword value ............................................................................... 9 timestep dt .................................................................................................................................................................... 10 reset_timestep N ........................................................................................................................................................... 10 neighbor skin bin/nsq/multi ......................................................................................................................................... 10 neigh_modify keyword values....................................................................................................................................... 10 4. 输出 .............................................................................................................................................................................. 10

dump ID group?ID bond/dcd/xtc/xyz/custom N file args ............................................................................................. 10 dump_modify dump?ID format/scale/image/flush/unwrap/every/precision/region/thresh values ........................... 11 undump dump?ID ......................................................................................................................................................... 11 thermo_style one/multi/custom(args) ......................................................................................................................... 11 thermo_modify lost/norm/flush/line/format/temp/press value ................................................................................. 12

1

thermo N ....................................................................................................................................................................... 12 print string ..................................................................................................................................................................... 12 restart N root ................................................................................................................................................................. 13 write_restart file ........................................................................................................................................................... 13 echo none/screen/log/both .......................................................................................................................................... 13 log filename .................................................................................................................................................................. 13 5. FIX.................................................................................................................................................................................. 13

fix ID group?ID style args .............................................................................................................................................. 13 系综相关....................................................................................................................................................................... 15 力和速度的控制 ........................................................................................................................................................... 15 计算特定量................................................................................................................................................................... 16 模拟晶胞的控制 ........................................................................................................................................................... 18 模拟过程的控制 ........................................................................................................................................................... 18 unfix fix-id ...................................................................................................................................................................... 19 6. COMPUTE ...................................................................................................................................................................... 19

compute ID group?ID style args .................................................................................................................................... 19 compute ID group?ID ackland/atom ............................................................................................................................. 19 compute ID group?ID centro/atom ............................................................................................................................... 19 compute ID group?ID coord/atom cutoff ..................................................................................................................... 20 compute ID group?ID damage/atom ............................................................................................................................ 20 compute ID group?ID displace/atom fix?ID .................................................................................................................. 20 compute ID group?ID group/group group2?ID ............................................................................................................. 20 compute ID group?ID ke ............................................................................................................................................... 20 compute ID group?ID ke/atom ..................................................................................................................................... 20 compute ID group?ID pe (keyword=pair/bond/angle/dihedral/improper/kspace) ...................................................... 20 compute ID group?ID pe/atom (keyword=pair/bond/angle/dihedral/improper) ........................................................ 20 compute ID group?ID pressure temp?ID keyword=ke/pair/bond/angle/dihedral/improper/kspace/fix ..................... 20 compute ID group?ID reduce mode=sum/min/max input1 input2 … .......................................................................... 20 compute ID group?ID stress/atom (keyword= ke/pair/bond/angle/dihedral/improper/kspace/fix) ........................... 21 compute_modify compute?ID keyword value .............................................................................................................. 21 compute ID group?ID temp .......................................................................................................................................... 21 compute ID group?ID temp/com .................................................................................................................................. 21 compute ID group?ID temp/deform ............................................................................................................................. 21 compute ID group?ID temp/partial xflag yflag zflag ..................................................................................................... 21 compute ID group?ID temp/ramp vdim vlo vhi dim clo chi keyword value .................................................................. 21 compute ID group?ID temp/region region?ID .............................................................................................................. 21 uncompute compute-ID ................................................................................................................................................ 21 7. 势函数 .......................................................................................................................................................................... 21

pair_style ....................................................................................................................................................................... 21 pair_style tersoff ........................................................................................................................................................... 22 kspace_style .................................................................................................................................................................. 23 kspace_modify .............................................................................................................................................................. 23 pair_write itype jtype N r/rsq/bitmap inner outer file keyword Qi Qj.......................................................................... 23 8. 运行 .............................................................................................................................................................................. 24

run N upto/start/stop/pre/post/every values ............................................................................................................... 24 run_style verlet/respa(args) .......................................................................................................................................... 24 minimize etol ftol maxiter maxeval ............................................................................................................................... 24

2

min_style cg/sd ............................................................................................................................................................. 24 min_modify dmax 0.2 (default=0.1).............................................................................................................................. 24 temper........................................................................................................................................................................... 24 clear ............................................................................................................................................................................... 24 9. 其他 .............................................................................................................................................................................. 25 variable name delete/index/loop/world/universe/uloop/equal/atom ........................................................................ 25 next variables ................................................................................................................................................................ 26 jump file label ............................................................................................................................................................... 26 label string ..................................................................................................................................................................... 26 if value1 operator value2 then command1 else command2 ........................................................................................ 26 include filename ............................................................................................................................................................ 27 shell cd/mkdir/mv/rm/rmdir ........................................................................................................................................ 27 10. 模拟方法论 ........................................................................................................................................................... 27

缺陷的生成................................................................................................................................................................... 27 晶格常数....................................................................................................................................................................... 27 迁移 .............................................................................................................................................................................. 27 表面 .............................................................................................................................................................................. 28 立方晶系弹性常数 ....................................................................................................................... 错误!未定义书签。

3

LAMMPS介绍

LAMMPS= Large-scale Atomic/Molecular Massively Parallel Simulator. http://lammps.sandia.gov ? Sandia National Laboratories

命令行选项:-in file输入文件;-log file 输出文件;-screen file屏幕输出文件;-echo style,输入文件内容是否输出到输出文件和屏幕,style=none/screen/log/both (default=log)。 特点:免费,C++,并行,集成大量势函数

并行:mpirun -nolocal -machinefile node -np $ncpu /opt/lammps/lmp_mpi -in in -screen log.screen & 串行:/opt/lammps/lmp

串行:/opt/lammps/lmp -screen log.screen -in in

文件

in.*文件:输入文件,控制整个计算过程。

每一非空行都被认为是一条命令(大小写敏感,极少有命令或参数大写的)。

读入一行执行一行,有些命令在其他命令后有效,有些命令要用到其他命令的输出, in文件中各命令的顺序可能会对计算产生影响,但大部分情况下不会有影响。 每行后的“&” 表示续行(类似fortran)。“#”表示注释(类似bash)。

每行命令中的不同字段由空格或者制表符分隔开来,每个字段可以由字母、数字、下划线、或标点符号构成。 每行命令中第一个字段表示命令名,之后的字段都是相关的参数。

提醒:注意单位。命令使用时一定一定要注意他们的默认设置,否则错了你都找不到北。很多命令都是在需要修改默认值的情况下才特别设置的。

log.lammps:记录了整个计算过程屏幕上显示的所有信息。

dump文件:输出应力、能量、原子位置、速度等,由dump命令控制输出文件。 restart文件:断点续算文件,由write_restart命令控制。

1. 系统初始化

units lj/real/metal/si/cgs default=units lj

units定义单位系统,该命令定义了input里所有变量的单位。 Units Real Metal Si cgs g/mol Kg G 质量 g/mol Ang m cm 距离 Ang Ps s S 时间 fs 能量 速度 力 温度 压力 粘度 电荷 lj mass or m sigma, where x* = x / sigma tau, where tau = t* = t (epsilon / m / sig-ma^2)^1/2 Kc/mol eV J ergs epsilon, where E* = E / epsilon Aug/fs Aug/ps m/s cm/s sigma/tau, where v* = v tau / sigma Kc/mol/Aug eV/Aug N dynes epsilon/sigma, where f* = f sigma / epsilon K K K K reduced LJ temperature, where T* = T Kb / epsilon atm Bar Pa dyne/cm^2;1.0e-6bars reduced LJ pressure, P* = P sigma^3 / epsilon Poise Poise Pa*s Poise reduced LJ viscosity, eta* = eta sigma^3 / ep-silon / tau multiple of multiple of C statcoulombs or esu reduced LJ charge, where q* = q / (4 pi perm0 electron charge electron sigma epsilon)^1/2 (+1.0 is a pro-charge (+1.0 ton) is a proton) charge*Aug charge*Aug C*m statcoul?cm = 10^18 reduced LJ dipole, moment where *mu = mu / 4

偶极

debye (4 pi perm0 sigma^3 epsilon)^1/2 子 V/Aug V/m statvolt/cm or force/charge, where E* = E (4 pi perm0 sigma 电场V/Aug dyne/esu epsilon)^1/2 sigma / epsilon 强度 1Aug=1e-10 m=1e-8 cm

1ps=1e-12 s, 1fs=1e-15 s, 1ps=1000 fs

1eV=23.0445512 Kc/mol, 1ev=3.8276e-23 Kc, 1eV=1.60217733e-19 J, 1eV=1.60217733e-12 erg, 1mol=6.0221367e23 1J=0.23884 c, 1erg=1e-7 J, 1Kc=4186.8 J, 1Kc=4.1868e10 erg, 1Kc=2.6126e22 eV 1atm=1.01325 bar =101325 Pa, 1bar=100000 Pa

atom_style angle/atomic/bond/charge/dipole/dpd/ellipsoid/full/granular/molecular/hybrid

default=atom_style atomic

定义使用什么样的原子类型,决定了原子的属性,该命令应该在其他命令前。 style = angle/atomic/bond/charge/dipole/dpd/ellipsoid/full/granular/molecular/hybrid

atom_modify map/first

定义并行计算如何求最近邻 atom_modify map array/hash map定义了并行计算求最近邻的方法,array表示每个CPU都储存领域列表,hash表示每个CPU只储存在分配在本CPU的领域列表,array更快,但是体系特别大的时候会消耗更多系统内存。 atom_modify first groupID

允许某一组原子在领域列表是作为第一个原子。

dimension N ,N=2/3 default=dimension 3

设置模拟的维度,进行2维模拟前要先使用该命令设置模拟盒子。该命令应在创建晶胞前。

boundary x y z, default=boundary p p p

boundary p p f boundary p fs p boundary s f fm

设置晶胞在3个方向的边界条件,该命令应在创建晶胞前。x/y/z = p/s/f/m/2个字母组合,2个字母组合表示第一个字母分配给下表面,第二个字母分配给上表面。p必须应用到上下两个表面。 p=周期性

f=不是周期性,固定的,如果原子走出表面,可能丢失; s is non?periodic and shrink?wrapped

m is non?periodic and shrink?wrapped with a minimum value。

newton flag/flag1 flag2

Default=newton on

flag = on or off for both pairwise and bonded interactions flag1 = on or off for pairwise interactions flag2 = on or off for bonded interactions

This command turns Newton's 3rd law on or off for pairwise and bonded interactions.

communicate single/multi group/cutoff

communicate multi

communicate multi group solvent communicate single cutoff 5.0 定义并行计算中CPU通讯方式。

5

processors Px Py Pz

Specify how processors are mapped as a 3d logical grid to the global simulation box. Px,Py,Pz = # of processors in each dimension of a 3d grid

2. 创建模拟晶胞

lattice none/sc/bcc/fcc/hcp/diamond/sq/sq2/hex/custom scale keyword values

lattice fcc 3.52 lattice hex 0.85

lattice sq 0.8 origin 0.0 0.5 0.0 orient x 1 1 0 orient y ?1 1 0

lattice custom 3.52 a1 1.0 0.0 0.0 a2 0.5 1.0 0.0 a3 0.0 0.0 0.5 basis 0.0 0.0 0.0 basis 0.5 0.5 0.5 lattice none

定义一个计算点阵,sc/bcc/fcc/hcp/diamond为三维点阵,sq/sq2/hex为二维点阵。

scale=晶格常数(非LJ unit) && reduced density rho* (for LJ units)。同时,该命令将改变系统长度单位为三个方向的基矢长度,特别注意。

origin:定义点阵的起点。将点阵平移 x,y,z 个晶格常数。0

orient dim ijk:将点阵旋转,dim为xyz,ijk为晶向指数,注意旋转后的三个基矢必须还是正交的。切符合右手规则。

spacing dx dy dz:分别定义在xyz三个方向的间隔。 custom:自定义晶胞基矢和间隔。

basis x y z:fractional coords of a basis atom

region ID style block/cylinder/prism/sphere/union/intersect args keyword value

region 1 block ?3.0 5.0 INF 10.0 INF INF region 2 sphere 0.0 0.0 0.0 5 side out

region void cylinder y 2 3 5 ?5.0 EDGE units box region 1 prism 0 10 0 10 0 10 2 0 0

region outside union 4 side1 side2 side3 side4 定义一个空间区域。

block xlo xhi ylo yhi zlo zhi:正交区域。

cylinder dim c1 c2 radius lo hi:定义圆柱,dim=xyz,c1,c2为圆柱轴在其它方向坐标,radius为半径,lo,hi为圆柱在轴向范围。

prism xlo xhi ylo yhi zlo zhi xy xz yz:棱柱体,xy = y在x方向倾斜量,xz,yz类似。 sphere x y z radius(半径):球面

union N reg?ID1 reg?ID2:多个区域的并集,N为数目 intersect N reg?ID1 reg?ID2 :多个区域的交集,N为数目 side out=定义的区域为描述的几何空间之外。默认为side in。

units lattice以晶格常数为单位(默认),units box表示以units定义的标准距离单位定义区域。特别注意这个问题。 EDGE=当前模拟盒子定义的边界;INF=无限大。

group ID region/type/id/molecule/subtract/union/intersect

group edge region regstrip

group water type 3 4 !类型为3、4 group sub id <= 150 !id小于150

group polyA molecule 50 250 !分子序号在50-250间(含)。 group boundary subtract all a2 a3 !a1-a2-a2 group boundary union lower upper !lower+upper

6

group boundary intersect upper flow !lower .and. upper

region ID:一次性操作,以后原子跑出区域依然属于这个组。

type/id/molecule:支持列表,逻辑符号(>=,==,!=),between,比如50 250 表示50-250 subtract two or more group IDs:第一个组减去后面的组 union one or more group IDs:并集 intersect two or more group IDs:交集

all这个组已经提前定义好了,包含所有的原子。包括all在内总共不能超过32个组。

create_box N region?ID

create_box 2 box

N = # of atom types to use in this simulation原子种类 region?ID = ID of region to use as simulation domain

在区域中创建一个模拟box,含N种原子,使用前应该先定义一个区域

create_atoms type box/region/single args keyword values

create_atoms 1 box

create_atoms 3 region regsphere basis 2 3 create_atoms 3 single 0 0 5 units box

create_atoms 1 box:在模拟盒子中产生原子种类为1的原子,必须先有create_box定义模拟box。lattice也应先定义。

region:在区域内创建原子。

create_atoms 1 single 0.0 0.0 0.0:增加单个原子,原子种类为1,坐标为0.0 0.0 0.0,可以用于产生间隙原子。 basis:给单胞内原子指定不同原子类型,参见lattice的custom选项。

units lattice以晶格常数为单位(默认),units box表示以units定义的标准距离单位定义区域。特别注意这个问题。 四面体间隙0.5 0.25 0.0;八面体间隙0.5 0.5 0.0

delete_atoms group/region/overlap/porosity args

delete_atoms group edge delete_atoms region sphere

delete_atoms overlap 0.3 all all

delete_atoms overlap 0.5 solvent colloid delete_atoms porosity cube 0.1 group ID:删除组中原子 region ID:删除区域中原子

overlap cutoff gid1 gid2:cutoff为两个原子间最近距离,必须一个原子在一个组,另一个在另外一个组,这样属于第一个组的原子将会被删除。两个组可以是一样的名字,比如all。由于算法问题,不同CPU可能删除原子数可能不一样,当可以保证最后没有距离在cutoff内的原子对。

porosity region?ID fraction seed:特定比例的原子讲被删除, fraction为比例,seed为随机数seed。同样不同CPU结果可能不一样。

删除组groupid中的原子,删除区域regionid中的原子,可以产生一系列空位 指定位置产生一个空位:

region 1 sphere 0.000000 0.000000 0.000000 0.01 delete_atoms region 1

read_restart file/read_date file

read_restart file

从重启文件中读入坐标等 read_date filename

从file中读取坐标,具体坐标格式可以参照example Position data for Silicon-Carbon system 1400 atoms 7 1 0.00 0.00 0.00 Masses 1 183.8 Atoms 1 1 2 1 3 1 4 1

atom types 44.75985925 xlo xhi 50.000 ylo yhi 31.650 zlo zhi 0 0 0 2.237992963 2.237992963 0 0 4.475985925 0 2.237992963 6.713978888 0 set atom/group/region ID keyword values

set group solvent type 2

set group solvent type/fraction 2 0.5 12393 set group edge bond 4 set region half charge 0.5 set atom 100 x 0.5 vx 1.0 set atom 1492 type 3

对指定的多个原子设置特定的属性。

type/fraction:按比例设置指定的原子到新的type。

set keywords

type atom-type:设置原子种类。

type/fraction type fraction seed:按比例设置指定的原子到新的种类。type=新原子种类,fraction=比例 mol molecule-ID:设置分子种类。 x,y,z value = 原子坐标 (长度单位) vx,vy,vz value = 速度分量 (速度单位)

charge atomic-charge = 设置电荷 (charge units)

dipole values = x y z,x,y,z = orientation of dipole moment vector dipole/random value = seed

quat values = a b c theta,a,b,c = unit vector to rotate particle around via right?hand rule,theta = rotation angle in degrees quat/random value = seed

diameter value = particle diameter (distance units)

density value = particle density (mass/distance^3 units) volume value = particle volume (distance^3 units)

image nx ny nz:定义原子分配到那个镜像。nx,ny,nz = which periodic image of the simulation box the atom is in bond value = bond type for all bonds between selected atoms angle value = angle type for all angles between selected atoms

dihedral value = dihedral type for all dihedrals between selected atoms improper value = improper type for all impropers between selected atoms

displace_atoms group?ID move/ramp/random args keyword value

displace_atoms top move 0 ?5 0 units box

displace_atoms all random 1.0e-3 1.0e-3 1.0e-3 617 displace_atoms flow ramp x 0.0 5.0 y 2.0 20.5

displace_atoms group?ID style args :移动一组原子。 move delx dely delz:在xyz三个方向移动的距离。 random dx dy dz seed:随机移动原子

ramp ddim dlo dhi dim clo chi:ddim=xyz,dim=xyz,在ddim方向移动原子,移动范围为dlo-dhi,移动距离根据原子在dim方向的坐标大小来决定,小于cho移动dlo,大于chi移动dhi。

8

displace_box group?ID parameter args ... keyword value …

displace_box all xy final ?2.0 z final 0.0 5.0 units box displace_box all x scale 1.1 y volume z volume

displace_box group?ID parameter改变模拟盒子的形状、体积

change_box ortho/triclinic

change_box ortho 把模拟晶胞从三斜转换为正交晶胞 change_box triclinic 把模拟晶胞从正交转换为三斜晶胞 lammps默认是正交晶胞

replicate nx ny nz

nx,ny,nz = replication factors in each dimension,整数。

复制现有的模拟晶胞。原子属性也同时复制。1表示不变。

3. 设置

mass I value

mass 1 1.0 mass * 62.5 mass 2* 62.5

设置不同种类的原子质量。

Mass也可以由read_data命令从data文件读入。 pair_eam在eam势文件里设置了原子质量。 原子种类描述方法:* *n m* m*n 开始模拟前必须先定义原子质量。

velocity group?ID create/set/scale/ramp/zero args keyword value

velocity all create 300.0 4928459 rot yes dist gaussian velocity border set NULL 4.0 3.0 sum yes units box velocity flow scale 300.0

velocity flow ramp lattice vx 0.0 5.0 y 5 25 temp mytemp velocity all zero linear

velocity group?ID create/set/scale/ramp/zero create temp seed:随机产生指定温度的速度。

set vx vy vz:把这个group的速度设置成vx,vy,vz。 scale temp:标度到指定温度。 NULL为不变。 ramp vx/vy/vz vlo vhi x/y/z clo chi:产生速度梯度。

zero linear/angular:linear=总线速度为零,angular=总角速度为零。

dist uniform/gaussion:create速度分布是均匀分布还是高斯分布,默认均匀分布。 sum yes/no:新速度是叠加到之前的速度。否=替换之前的速度。(not zero) mom yes/no:for create,产生的总线速度=0 rot yes/no:for create,产生的总角速度=0

temp compute-id:指定计算温度方法。(for create/scale) loop all/local/geom:定义并行计算中原子速度产生方法。

units box/lattice:for set/ramp,使用说明坐标,box为绝对坐标,lattice为点阵坐标。 default: dist=uniform; sum=no; mom=yes; rot=no; loop=all

9

timestep dt

为接下来的MD计算定义时间步长。

也可以由fix dt/reset或run_style respa定义变化的时间步长。 Default:

timestep = 0.005 tau for units = lj timestep = 1.0 fmsec for units = real timestep = 0.001 psec for units = metal

timestep = 1.0e?8 sec (10 nsec) for units = si or cgs

reset_timestep N

reset_timestep 0

reset_timestep 4000000 重设时间步到指定值。

read_data/create_box设置时间步为0。 read_restart设置时间步为上次计算值。

不能用在dump/restart已经有输出的时候,这样会打乱文件输出。

neighbor skin bin/nsq/multi

neighbor skin style, style=bin/nsq/multi, (default: 2.0 bin for units = real or metal,) ?neighbor 2.0 bin This command sets parameters that affect the building of pairwise neighbor lists.

定义求最近邻的截断半径,bin模式在最长cutoff的基础上加2.0A作为新的截断半径

neigh_modify keyword values

neigh_modify every 20 delay 10 check yes

定义求最近邻原子数的方法,每隔20步更新最近邻,上次更新后10步内不更新,check设置判断原子是否大步移动,从而决定更新。

4. 输出

dump ID group?ID bond/dcd/xtc/xyz/custom N file args

dump myDump all atom 100 dump.atom dump 2 subgroup atom 50 dump.run.bin

dump 4a all custom 100 dump.myforce.* id type x y vx fx

dump 4b flow custom 100 dump.%.myforce id type c_myF[3] v_ke dump 1 all xtc 1000 file.xtc

定义一个输出,包含各种物理量,每隔N步输出到file中。

atom:文本文件,含原子坐标,ID,种类会输出到文件中。可用VMD打开。 custom:定制如何输出dump文件。

dcd:二进制文件,用于CHARMM,NAMD,Xplor,VMD xtc:二进制文件,用于GROMACS,VMD

xyz:简单文本文件,含原子坐标,种类,可用VMD打开。 文件名称规则:

file.%.* :*表示时间步,%表示CPU ID

file.bin:输出二进制文件。(可用binary2txt转换成文本) file.gz:输出gzipped文件。

10

dump custom args id = atom ID

mol = molecule ID type = atom type

x,y,z = unscaled atom coordinates xs,ys,zs = scaled atom coordinates

xu,yu,zu = unwrapped atom coordinates ix,iy,iz = box image that the atom is in vx,vy,vz = atom velocities fx,fy,fz = forces on atoms q = atom charge

mux,muy,muz = orientation of dipolar atom radius = radius of extended spherical particle

omegax,omegay,omegaz = angular velocity of extended particle

angmomx,angmomy,angmomz = angular momentum of extended particle quatw,quati,quatj,quatk = quaternion components for aspherical particles tqx,tqy,tqz = torque on extended particles

c_ID = per?atom scalar value calculated by a compute with ID

c_ID[N] = Nth component of per?atom vector calculated by a compute with ID f_ID = per?atom scalar value calculated by a fix with ID

f_ID[N] = Nth component of per?atom vector calculated by a fix with ID v_name = per?atom value calculated by an atom?style variable with name

dump_modify dump?ID format/scale/image/flush/unwrap/every/precision/region/thresh values

dump_modify 1 format \dump_modify myDump image yes scale no flush yes

dump_modify 1 region mySphere thresh x <0.0 thresh epair >= 3.2 dump_modify xtcdump precision 10000 定义如何输出dump文件。

default:scale=yes; image=no; flush=yes; unwrap=no; thresh=none format string:输出格式。

scale yes/no:是否输出归一化坐标。

image yes/no:是否输出原子穿越边界次数。 flush yes/no:是否实时输出。 every N:重新设定输出间隔

region Rid:只输出区域内原子。

thresh attribute operation value:设置条件,只输出符合条件。 attribute=dump custom args operation= “ ” “>=” “==” “!=”

unwrap yes/no:dcd/xtc,输出未穿过边界的坐标。 precision N:xtc,定义输出精度。10-1000000

undump dump?ID

关闭之前定义的dump。关闭和dump关联的文件。

thermo_style one/multi/custom(args) thermo_style multi

thermo_style custom step temp pe etotal press vol v_abc default = thermo_style one

custom args:定制要输出什么信息

one=\otal press“

multi=\ 可能会产生一些compute,可通过compute_modify修改。 compute thermo_temp all temp

compute thermo_press all pressure thermo_temp compute thermo_pe all pe

11

该命令应在创建晶胞后使用。

thermo_style custom args step = timestep atoms = # of atoms

cpu = elapsed CPU time temp = temperature press = pressure

pe = total potential energy ke = kinetic energy

etotal = total energy (pe + ke)

enthalpy = enthalpy (etotal + press*vol) evdwl = VanderWaal pairwise energy ecoul = Coulombic pairwise energy

epair = pairwise energy (evdwl + ecoul + elong + etail) ebond = bond energy eangle = angle energy edihed = dihedral energy eimp = improper energy

emol = molecular energy (ebond + eangle + edihed + eimp) elong = long?range kspace energy

etail = VanderWaal energy long?range tail correction vol = volume

lx,ly,lz = box lengths in x,y,z

xlo,xhi,ylo,yhi,zlo,zhi = box boundaries

xy,xz,yz = box tilt for triclinic (non?orthogonal) simulation boxes pxx,pyy,pzz,pxy,pxz,pyz = 6 components of pressure tensor c_ID = global scalar value calculated by a compute with ID

c_ID[N] = Nth component of global vector calculated by a compute with ID f_ID = global scalar value calculated by a fix with ID

f_ID[N] = Nth component of global vector calculated by a fix with ID v_name = global value calculated by an equal?style variable with name

thermo_modify lost/norm/flush/line/format/temp/press value

thermo_modify lost ignore flush yes

thermo_modify temp myTemp format 3 .8g thermo_modify line multi format float %g 定制热力学信息如何输出。

default:lost=error; norm=no(real);flush=no。 lost error/warn/ignore:发现原子丢失如何处理。 norm yes/no:是/否输出原子平均。 flush yes/no:是/否实时输出。

line one/multi:输出一行;一行限制为3变量。 format M string:定义输出格式。 temp compute-id:如何计算温度。 press compute-id:如何计算压力。

注意temp和press的顺序。因为press已经定义了自己的温度计算方法,如果temp在press前,将覆盖其定义,如果temp在press后则不受影响。

thermo N

default = thermo 0

每隔N步输出热力学信息到屏幕上。 N=0表示只在开始和结束输出。

print string

print \

12

print \输出字符串,以双引号括起。 可以使用变量。

restart N root

restart 0

restart 1000 poly.restart restart 1000 restart.*.equil restart 10000 poly.%.1 poly.%.2

default = restart 0:不输出重启文件。

root = filename to which timestep # is appended

restart N file1 file2:file1,file2 = two full filenames, 在两个文件之间交替书写。 两个广义字符:*:表示以当前的时间步替换; %:以CPU id替换

第一步不会产生重启文件。run:最后一步不会产生重启文件,除非刚好是N倍数。minimize:最后一步会产生重启文件。

write_restart file

write_restart restart.equil write_restart poly.%.*

把当前模拟状态输出到一个续算文件中。 两个广义字符:

*:表示以当前的时间步替换 %:以CPU id替换

restart2data可以转为文本文件。

echo none/screen/log/both

定义输入文件是否输出到屏幕和log。 命令行选项会替换这个命令。

log filename

打开一个新的log文件,之后的信息将输出到新log文件中。 文件名可以是变量。

系统默认的log文件是log.lammps

5. FIX

fix ID group?ID style args

在计算过程中,对组中原子做特定的计算。fix不同于compute,compute是一次性计算,fix是在这个计算过程中,每一个时间步长都会计算的值。如果有多个fix,按顺序执行,不同的顺序可能产生不同的结果。 fix-ID可以是文本数字和下划线。

fix可以通过unfix命令来删除。如果多次指定同一ID的fix,将会删除之前的fix。和unfix的效果一样。 fix计算两类量,一类是全局量,一类是每个原子的量。全局量有一些和原子数成正比(extensive),有一些是无关的。 ? addforce ? add a force to each atom

? aveforce ? add an averaged force to each atom

? ave/atom ? compute per?atom time?averaged quantities

13

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

ave/spatial ? output per?atom quantities by layer ave/time ? output time?averaged compute quantities bond/break ? break bonds on the fly bond/create ? create bonds on the fly bond/swap ? Monte Carlo bond swapping

box/relax ? relax box size during energy minimization com ? compute a center?of?mass

coord/original ? store original coords of each atom deform ? change the simulation box size/shape deposit ? add new atoms above a surface

drag ? drag atoms towards a defined coordinate

dt/reset ? reset the timestep based on velocity, forces efield ? impose electric field on system

enforce2d ? zero out z?dimension velocity and force evaporate ? remove atoms from simulation periodically freeze ? freeze atoms in a granular simulation

gravity ? add gravity to atoms in a granular simulation gyration ? compute radius of gyration

heat ? add/subtract momentum?conserving heat indent ? impose force due to an indenter langevin ? Langevin temperature control lineforce ? constrain atoms to move in a line

msd ? compute mean?squared displacement (i.e. diffusion coefficient) momentum ? zero the linear and/or angular momentum of a group of atoms nph ? constant NPH time integration via Nose/Hoover npt ? constant NPT time integration via Nose/Hoover npt/asphere ? NPT for aspherical particles npt/sphere ? NPT for spherical particles nve ? constant NVE time integration

nve/asphere ? NVT for aspherical particles nve/limit ? NVE with limited step length nve/noforce ? NVE without forces (v only) nve/sphere ? NVT for spherical particles

nvt ? constant NVT time integration via Nose/Hoover nvt/asphere ? NVT for aspherical particles

nvt/sllod ? NVT for NEMD with SLLOD equations nvt/sphere ? NVT for spherical particles

orient/fcc ? add grain boundary migration force planeforce ? constrain atoms to move in a plane

poems ? constrain clusters of atoms to move as coupled rigid bodies pour ? pour new atoms into a granular simulation domain press/berendsen ? pressure control by Berendsen barostat print ? print text and variables during a simulation rdf ? compute radial distribution functions

reax/bonds ? write out ReaxFF bond information

recenter ? constrain the center?of?mass position of a group of atoms rigid ? constrain one or more clusters of atoms to move as a rigid body setforce ? set the force on each atom

shake ? SHAKE constraints on bonds and/or angles spring ? apply harmonic spring force to group of atoms spring/rg ? spring on radius of gyration of group of atoms spring/self ? spring from each atom to its origin

temp/berendsen ? temperature control by Berendsen thermostat temp/rescale ? temperature control by velocity rescaling

thermal/conductivity ? Muller?Plathe kinetic energy exchange for thermal conductivity calculation tmd ? guide a group of atoms to a new configuration

ttm ? two?temperature model for electronic/atomic coupling

viscosity ? Muller?Plathe momentum exchange for viscosity calculation

14

? ? ? ? ?

viscous ? viscous damping for granular simulations wall/gran ? frictional wall(s) for granular simulations wall/lj126 ? Lennard?Jones 12?6 wall wall/lj93 ? Lennard?Jones 9?3 wall wall/reflect ? reflecting wall(s)

? wiggle ? oscillate walls and frozen atoms

系综相关

fix ID group?ID nph p?style args keyword value ...

fix ID group?ID npt Tstart Tstop Tdamp p?style args keyword value ... fix ID group?ID nve

fix ID group?ID nve/limit xmax fix ID group?ID nve

fix ID group?ID nvt Tstart Tstop Tdamp keyword value ...

fix ID group?ID press/berendsen p?style args keyword value ... fix ID group?ID temp/berendsen Tstart Tstop Tdamp

fix ID group?ID temp/rescale N Tstart Tstop window fraction keyword values ...

fix ID group?ID langevin Tstart Tstop damp seed keyword values ... fix 3 boundary langevin 1.0 1.0 1000.0 699483 fix 1 all langevin 1.0 1.1 100.0 48279 scale 3 1.5 对组内原子运用Langevin恒温方法。

fix_modify fix?ID keyword value ... keyword = temp or press or energy

temp value = compute ID that calculates a temperature press value = compute ID that calculates a pressure

energy value = yes or no. For fixes that calculate a contribution to the potential energy of the system, the energy keyword will include that contribution in thermodynamic output of potential energy.

力和速度的控制

fix ID group?ID addforce fx fy fz fix kick flow addforce 1.0 0.0 0.0

给组内原子增加特定的力,fx,fy,fz为三个方向的力的大小。比如原子重力。

fix ID group?ID aveforce fx fy fz

fix pressdown topwall aveforce 0.0 ?1.0 0.0 fix 2 bottomwall aveforce NULL ?1.0 0.0

设置改组原子的力为fd_averaged+fd,即为各方向的平均值+外力,所以组内每个原子的力都一样。NULL表示这个方向的力不改变,0.0表示设置改方向的力为平均值。

fix ID group?ID efield ex ey ez

给电荷原子增加一个外加电场。F=qE

fix ID group?ID enforce2d fix 5 all enforce2d

设置Z方向的力和速度为0,用于2D模拟。

fix ID group?ID heat N efflux fix 3 qin heat 1 1.0 fix 4 qout heat 1 ?1.0

给组内原子增加一个非平动能。

15

sum是对组内原子相应的变量的求和,返回一个总和,min和max返回的是组内的最小值。 如果只有一个input,返回一个标量,如果多个inpu,返回的是多分量的矢量。

compute ID group?ID stress/atom (keyword= ke/pair/bond/angle/dihedral/improper/kspace/fix)

compute peratom all stress/atom

compute p all reduce sum c_peratom[1] c_peratom[2] c_peratom[3] variable press equal ?(c_p[1]+c_p[2]+c_p[3])/(3*vol) thermo_style custom step temp etotal press v_press

计算组内每个原子的应力张量,包含6个分量,sxx,syy,szz,szy,sxz,syz,用1-6来表示。

compute_modify compute?ID keyword value

keyword = extra or dynamic

extra value = N,N of extra degrees of freedom to subtract

dynamic value = yes or no,do or do not recompute the number of atoms contributing to the temperature thermo value = yes or no,yes/no = do or do not add contributions from fixes to the potential energy

compute ID group?ID temp

计算组内原子的温度。

compute ID group?ID temp/com

计算组内原子的温度,减去质心速度。

compute ID group?ID temp/deform

计算组内原子的温度,减去晶胞形状带来的影响。

compute ID group?ID temp/partial xflag yflag zflag

计算组内原子的温度,减去质心速度的特定分量带来的影响。xflag,yflag,zflag=1/0

compute ID group?ID temp/ramp vdim vlo vhi dim clo chi keyword value

计算组内原子的温度,减去特定的速度梯度。

compute ID group?ID temp/region region?ID

计算某一区域的温度。

uncompute compute-ID

删除一个compute,这同样也会删除由compute_modify带来的影响。

7. 势函数

pair_style

? pair_style none ? turn off pairwise interactions

21

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

?

? ? ? ? ? ? ?

?

pair_style hybrid ? multiple styles of pairwise interactions

pair_style hybrid/overlay ? multiple styles of superposed pairwise interactions pair_style airebo ? AI?REBO potential

pair_style born/coul/long ? Born?Mayer?Huggins with long?range Coulomb pair_style buck ? Buckingham potential

pair_style buck/coul/cut ? Buckingham with cutoff Coulomb

pair_style buck/coul/long ? Buckingham with long?range Coulomb pair_style colloid ? integrated colloidal potential pair_style coul/cut ? cutoff Coulombic potential

pair_style coul/debye ? cutoff Coulombic potential with Debye screening pair_style coul/long ? long?range Coulombic potential pair_style dipole/cut ? point dipoles with cutoff

pair_style dpd ? dissipative particle dynamics (DPD) pair_style eam ? embedded atom method (EAM) pair_style eam/opt ? optimized version of EAM pair_style eam/alloy ? alloy EAM

pair_style eam/alloy/opt ? optimized version of alloy EAM pair_style eam/fs ? Finnis?Sinclair EAM

pair_style eam/fs/opt ? optimized version of Finnis?Sinclair EAM pair_style gayberne ? Gay?Berne ellipsoidal potential

pair_style gran/hertz/history ? granular potential with Hertzian interactions pair_style gran/hooke ? granular potential with history effects

pair_style gran/hooke/history ? granular potential without history effects

pair_style lj/charmm/coul/charmm ? CHARMM potential with cutoff Coulomb pair_style lj/charmm/coul/charmm/implicit ? CHARMM for implicit solvent pair_style lj/charmm/coul/long ? CHARMM with long?range Coulomb

pair_style lj/charmm/coul/long/opt ? optimized version of CHARMM with long?range Coulomb pair_style lj/class2 ? COMPASS (class 2) force field with no Coulomb pair_style lj/class2/coul/cut ? COMPASS with cutoff Coulomb

pair_style lj/class2/coul/long ? COMPASS with long?range Coulomb pair_style lj/cut ? cutoff Lennard?Jones potential with no Coulomb pair_style lj/cut/opt ? optimized version of cutoff LJ pair_style lj/cut/coul/cut ? LJ with cutoff Coulomb

pair_style lj/cut/coul/debye ? LJ with Debye screening added to Coulomb pair_style lj/cut/coul/long ? LJ with long?range Coulomb

pair_style lj/cut/coul/long/tip4p ? LJ with long?range Coulomb for TIP4P water pair_style lj/expand ? Lennard?Jones for variable size particles pair_style lj/gromacs ? GROMACS?style Lennard?Jones potential

pair_style lj/gromacs/coul/gromacs ? GROMACS?style LJ and Coulombic potential pair_style lj/smooth ? smoothed Lennard?Jones potential pair_style lubricate ? hydrodynamic lubrication forces

pair_style meam ? modified embedded atom method (MEAM) pair_style morse ? Morse potential

pair_style morse/opt ? optimized version of Morse potential pair_style peri/pmb ? peridynamic PMB potential pair_style reax ? ReaxFF potential

pair_style resquared ? Everaers RE?Squared ellipsoidal potential pair_style soft ? Soft (cosine) potential

pair_style sw ? Stillinger?Weber 3?body potential pair_style table ? tabulated pair potential pair_style tersoff ? Tersoff 3?body potential

pair_style tersoff/zbl ? Tersoff/ZBL 3?body potential pair_style yukawa ? Yukawa potential

pair_style tersoff

pair_style tersoff

pair_coeff * * WH.tersoff W H

22

tersoff势,tersoff势参数从WH.tersoff读取,包含两种元素WH

E?1Vij, Vij?fC(rij)[fR(rij)?bijfA(rij)], fR(rij)?Aexp(??1r), fA(rij)??Bexp(??2r) ??2ii?j?1,r?R-D?11?r?R?fC(r)???sin(),R?r?D

2D?22r?R?D0,??bij?(1???)nnij?12nc2c2, ?ij??fC(rik)g(?)exp[) ?(rij?rik)], g(?)??ijk(1?2?22dd?(cos??cos?)k(?i,j)0m3m每一行格式:特别注意每一行中R,D为I-K元素间的R,D。注意元素名称与pair_coeff一致。

element 1, element 2, element 3,m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A # Tersoff parameters for various elements and mixtures # multiple entries can be added to this file, LAMMPS reads the ones it needs # these entries are in LAMMPS \# A,B = eV; lambda1,lambda2,lambda3 = 1/Angstroms; R,D = Angstroms # other quantities are unitless # format of a single entry (one or more lines): # element 1, element 2, element 3, # m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A # The following GaN potential is from J. Nord, K. Albe, P. Erhart # and K. Nordlund, J. Phys.: Condens. Matter, 15, 5649(2003). # This file is from Xiaowang Zhou, xzhou @ sandia.gov Ga Ga Ga 1.0 0.007874 1.846 1.918000 0.75000 -0.301300 1.0 1.0 1.44970 410.132 2.87 0.15 1.60916 535.199 N N N 1.0 0.766120 0.000 0.178493 0.20172 -0.045238 1.0 1.0 2.38426 423.769 2.20 0.20 3.55779 1044.77 Ga Ga N 1.0 0.001632 0.000 65.20700 2.82100 -0.518000 1.0 1.0 0.00000 0.00000 2.90 0.20 0.00000 0.00000 Ga N N 1.0 0.001632 0.000 65.20700 2.82100 -0.518000 1.0 1.0 2.63906 3864.27 2.90 0.20 2.93516 6136.44 N Ga Ga 1.0 0.001632 0.000 65.20700 2.82100 -0.518000 1.0 1.0 2.63906 3864.27 2.90 0.20 2.93516 6136.44 N Ga N 1.0 0.766120 0.000 0.178493 0.20172 -0.045238 1.0 1.0 0.00000 0.00000 2.20 0.20 0.00000 0.00000 N N Ga 1.0 0.001632 0.000 65.20700 2.82100 -0.518000 1.0 1.0 0.00000 0.00000 2.90 0.20 0.00000 0.00000 Ga N Ga 1.0 0.007874 1.846 1.918000 0.75000 -0.301300 1.0 1.0 0.00000 0.00000 2.87 0.15 0.00000 0.00000

kspace_style

Define a K?space solver for LAMMPS to use each timestep to compute long?range Coulombic interactions or long?range 1/r^N interactions.

kspace_modify

pair_write itype jtype N r/rsq/bitmap inner outer file keyword Qi Qj

pair_write 1 3 500 r 1.0 10.0 table.txt LJ

pair_write 1 1 1000 rsq 2.0 8.0 table.txt Yukawa_1_1 ?0.5 0.5

计算两种原子间的对势势函数。其中itype,jtype为原子种类,N为计算点,r/rsq/bitmap为计算间隔方法,inner,outer为计算的截断距离,file为输出文件名,keyword为文件中的注释名,Qi,Qj 为ij电荷(可选)

23

8. 运行

run N upto/start/stop/pre/post/every values

run 10000

run 1000000 upto

run 100 start 0 stop 1000 run 1000 pre no post yes

run 100000 start 0 stop 1000000 every 1000 print \run 100000 every 1000 NULL

upto:从现在开始,总共运行N步。

start N1/stop N2:对于多个运算,总的起始步和结束步,可以影响fix pre/post yes/no:是否进行前期设置和后期分析

every M cmd:每M步运行后面的命令。将会中断计算执行后面命令,再重新开始计算。这个会变成N/M个计算。NULL表示空命令。

default:pre=yes; post=yes

run_style verlet/respa(args) run_style决定用什么算法。

respa: rRESPA multi?timescale integrator (Tuckerman) run_style verlet: velocity-verlet。(default)

run_style respa 4 2 2 2 bond 1 dihedral 2 pair 3 kspace 4

run_style respa 4 2 2 2 bond 1 dihedral 2 inner 3 5.0 6.0 outer 4 kspace 4

minimize etol ftol maxiter maxeval

minimize 1.0e?4 1.0e?6 100 1000 minimize 0.0 1.0e?8 1000 100000 minimize etol ftol maxiter maxeval 能量最小化,驰豫,分子静力学。

etol能量收敛精度,ftol力收敛精度,maxiter最大迭代次数,maxeval最大评估数 minimize 与初始温度设置无关。

min_style cg/sd

default= min_style cg

最小化算法,cg=conjugate gradient共轭梯度,sd=steepest descent最速下降。

min_modify dmax 0.2 (default=0.1)

最小化算法中,原子最大移动距离。

temper

clear

(commands for 1st simulation) clear

(commands for 2nd simulation)

重新开始另一个任务,将删除所有原子,重置所有设置,释放内存。用于在一个in文件里运行多个任务。 以下设置不会被影响:计算路径,log状态,变量,echo状态

24

9. 其他

variable name delete/index/loop/world/universe/uloop/equal/atom

variable x index run1 run2 run3 run4 run5 run6 run7 run8 variable LoopVar loop $n variable beta equal temp/3.0

variable b1 equal x[234]+0.5*vol variable b1 equal \variable b equal xcm(mol1,x)/2.0 variable b equal c_myTemp variable b atom x[]*y[]/vol

variable temp world 300.0 310.0 320.0 ${Tfinal} variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 variable x uloop 15 variable x delete

定义一个变量。并给变量赋值。变量定义后不会立即赋值,特别注意变量不能多次定义,当变量循环完成后,将删除变量。变量与junp结合,可以实现循环。引用变量:多字符${LoopVar};单字符$i。 index string1 string2:定义一个变量等于一系列值。 loop N:定义变量为一系列整数,从1-N。

world/universe/uloop:并行计算为不同CPU使用不同变量。 delete:删除变量。

循环实现方法: variable a loop 10 label loop [commands] next a jump in loop equal/atom:给变量赋予给定的表达式,equal计算平均值,atom对每个原子都计算,可能的值和操作如下表。 thermo keywords可以接受和thermo_style custom里已有的格式。 group里面,dim=x, y, z; dir=xmin, xmax, ymin, ymax, zmin, zmax. 其中count()为原子数,mass()为总质量,其他类似。 Number 0.2, 100, 1.0e20, ?15.4, etc Thermo keywords vol, pe, ebond, etc Math operations (), ?x, x+y, x?y, x*y, x/y, x^y, sqrt(x), exp(x), ln(x), log(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), ceil(x), floor(x), round(x) Group functions count(ID), mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), fcm(ID,dim), bound(ID,dir), gyration(ID), ke(ID) Region functions count(ID,IDR), mass(ID,IDR), charge(ID,IDR), xcm(ID,dim,IDR), vcm(ID,dim,IDR), fcm(ID,dim,IDR), bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR) Atom values mass[N], type[N], x[N], y[N], z[N], vx[N], vy[N], vz[N], fx[N], fy[N], fz[N] Atom vectors mass[], type[], x[], y[], z[], vx[], vy[], vz[], fx[], fy[], fz[] Compute refer-c_ID, c_ID[2], c_ID[N], c_ID[N][2], c_ID[], c_ID[][2] ences Fix references f_ID, f_ID[2], f_ID[N], f_ID[N][2], f_ID[], f_ID[][2] Other variables v_abc, v_abc[N], v_abc[] 对于compute的引用说明如下表。 c_ID scalar value of a global compute c_ID[2] vector component of a global compute c_ID[N] single atom's scalar value of a per?atom compute c_ID[N][M] single atom's vector component of a per?atom compute 25

c_ID[] per?atom scalar from a per?atom compute c_ID[][M] per?atom vector component from a per?atom compute 对于变量的引用说明如下表。 v_ID scalar value of a non atom?style variable v_ID[N] single atom's scalar value from an atom?style variable v_ID[] per?atom value from an atom?style variable

next variables

next x

next a t x myTemp

给变量指派下一个值,如果后面接多个变量,这几个变量必须是同一类型的变量。 如果next后面的变量用尽了,将导致跳过下一个jump命令。 variable d index run1 run2 run3 run4 run5 run6 run7 run8 shell cd $d read_data data.polymer run 10000 shell cd .. clear next d jump in.polymer

jump file label

转到别的输入文件,如果含label就会跳转到文件的label中。如果label不存在,将终止计算。 注意和include不同,跳过去后,不回返回到原来文件处继续执行。

对于loop变量,当变量值通过next都使用完了,会跳过下一个jump命令。

label string

定义某行为一个标签。用于jump命令。 variable a loop 10 label loop dump 1 all atom 100 file.$a run 10000 undump 1 next a jump in loop 双重循环: label loopa variable a loop 5 label loopb variable b loop 5 print \run 10000 if $b > 2 then \next b jump in loopb label break variable b delete next a jump in loopa

if value1 operator value2 then command1 else command2

if ${steps} > 1000 then exit

if $x <= $y then \if ${eng} > 0.0 then \

26

if ${eng} > ${eng_previous} then \value1 = 1st value

operator = \\ value2 = 2nd value then = required word

command1 = command to execute if condition is met else = optional word

command2 = command to execute if condition is not met (optional argument) 如果命令不是有效的lammps命令,将会导致程序终止。比如exit。

include filename

插入别的输入文件,类似于Fortran。

文件名可以是变量,这样可以 用于不同处理器计算不同任务。可以设计用于循环。

shell cd/mkdir/mv/rm/rmdir

shell cd sub1 shell cd ..

shell mkdir tmp1 tmp2 tmp3 shell rmdir tmp1

shell mv log.lammps hold/log.1 shell rm TMP/file1 TMP/file2

Linux shell,执行基本的linux命令。

lammps不会检测是否执行成功,以及错误信息。

10. 模拟方法论

缺陷的生成

# vacancy

region 1 sphere 0 0 0 0.01 delete_atoms region 1 # interstitial

create_atoms 2 single 0 0 0 # substitutional set atom 1 type 2

或者: vacancy + interstitial

晶格常数

variable i loop 100

variable latcont equal 4.0+$i*0.001 lattice fcc ${latcont} minimize 1e-8 1e-8 100 1000

关键原理:做一个循环,计算不同晶格常数下体系的能量,最低的就是稳定结构。

迁移

方法一:fix ID group?ID setforce fx fy fz,设置原子在迁移方向的力为0 1. 间隙原子从四面体间隙途径八面体间隙迁移至四面体间隙 lattice bcc 3.1650

create_atoms 2 single $x 0.5 0.0

27

fix 2 diffusion setforce 0.0 NULL NULL

关键原理:设置迁移原子X方向的力为0,让其只能在yz平面移动。 2. 间隙原子从四面体间迁移至四面体间隙

lattice bcc 3.165 orient x 1 1 0 orient y -1 1 0 orient z 0 0 1 create_atoms 2 single $x 0.5 0.0

fix 2 diffusion setforce 0.0 NULL NULL

关键原理:变换点阵的基矢,逆顺时针转45度,这样可以保证迁移方向为x方向。再设置x方向力为0。 方法二:fix ID group?ID planeforce x y z,设置原子只能在某个平面内移动。

表面

(100)表面

boundary p p fm lattice bcc 3.165 (110)表面

lattice bcc 3.165 orient x -1 1 0 orient y 0 0 1 orient z 1 1 0 (112)表面

lattice bcc 3.165 orient x -1 1 0 orient y -1 -1 1 orient z 1 1 2

关键原理:设置Z方向为非周期性边界条件。变换点阵的基矢,使Z轴垂直于表面。

28

本文来源:https://www.bwwdw.com/article/i0jo.html

Top