【综合文库】
lammps简要使用说明
李小椿
北京航空航天大学物理科学与核能工程学院
bestlxc@163.com
更新于:2022年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 查看全文