2024年2月8日发(作者:)
lammps输入文件命令中文详解
作者: 御剑江湖收录日期: 2011-03-31 发布日期: 2011-03-24
Commands
描述了lammps输入文件的格式和在定义lammps模拟所需要的命令.
1.1 LAMMPS input script
我们用lammps做分子动力学模拟, 需要一个输入文件. lammps在执行计算的时候, 从这个文本文件中逐行读入命令. 大多数情况,
lammps输入文件中各个命令的顺序并不是很重要. 但是你要注意以下几点:
(1) lammps并不是将你的输入文件全部读入之后才开始进行计算的, 或者说, 每条命令在它被读入之后就会起作用了. 注意, 下面两组命令的执行效果是不相同的.
timestep 0.5
run 100
run 100
和
run 100
timestep 0.5
run 100
(2) 有些命令只有在另一些命令已经被定义的情况下才有效. 例如如果你要设定一组原子的温度, 那么用group命令定义哪些原子属于这个组才行.
(3) 还有一种情况就是: 命令B要用到命A设置的一些数值, 这样你也不能颠倒这两个命令的顺序.
每个命令的详细介绍中的Restrictions部分会说明要使用该命令定义的时候哪些命令必须要被预先定义.
如果你的输入文件书写的格式有问题, lammps在执行的时候会提示ERROR或者WARNING , 出现类似信息时, 你可以到手册的第九章
中查询原因.
1.2 Parsing rules
输入文件中的每一非空行都被认为是一条命令. lammps中命令的书写是对大小写敏感的, 不过一般的命令和参数都是小写的, 大写字母用于极少数的情况.
(1) 命令行后的& 表示这一行跟下一行是同一条命令. 这一点跟FORTRAN很像.
(2) 命令行最开始的# 表示这一行在执行过程中被忽略, 你可以用它来写注释.
(3) $ 是跟声明变量有关系的, 我暂时还没用到过, 具体请参阅variable命令的详细介绍.
(4) 命令行被tabs, spaces间隔成各个“words”, 注意这里的“words”可以包含字母、数字、下划线、或标点符号.
(5) 一行中第一个词是命令名, 后续的词是相关的参数.
(6) 双引号内的文字空格被整体地当作一个参数, 其中的# 或$ 就没有前面说的作用了.
1.3 Input script structure
lammps的输入文件一般分为4个部分Initialization, Atom
definition, Settings, Run a simulation
后面的两个部分可以按照需要多次重复. Remember that almost
all the commands need only be used if a non-default value is
desired.
(1) Initialization
在你的模拟体系定义之前, 一些参数必须要被设置. 相关的命令有:units, dimension, newton, processors, boundary, atom_style,
atom_modify.
units: 选择单位系统, lammps提供了lj、real、metal三种单位系统
dimension: 2d模拟还是3d模拟, 默认是3d
boundary: 边界条件:周期性边界or自由边界
atom_style: 定义你的模拟体系中的原子属性, 注意这个style要区分后面设置力场参数时命令里提到的atom type
还有, 这些命令告诉lammps在你的模拟中使用何种力场:
pair_style, bond_style, angle_style, dihedral_style, improper_style.
(2) Atom definition
lammps提供3种方式定义原子:
①通过read_data或read_restart命令从data或restart文件读入, 这些文件可以
包含分子拓扑结构信息.
②按照晶格的方式创建原子(不包含分子拓扑信息), 你会用到这几个命令: lattice, region, create_box, create_atoms.
③已经设置好的原子可以用replicate命令复制以生成一个更大规模的模拟体系.
(3)Settings
原子和分子的拓扑信息定义好后, 你要制定一系列的设置: 力场系数、模拟参数、输出选项等等.
力场系数可以通过这些命令定义: pair_coeff, bond_coeff,
angle_coeff, dihedral_coeff, improper_coeff, kspace_style,
dielectric, special_bonds. 注意, 其实力场系数也可以在data文件中制定, 详见read_data命令介绍.
各种模拟参数由这些命令设置: neighbor, neigh_modify, group,
timestep, reset_timestep, run_style, min_style, min_modify.
我觉得fix命令是lammps中很重要的一个命令, 它包括很多子命令, 可以施加一系列的边界条件、时间积分、诊断选项等等.
模拟过程中通过下面的命令制定lammps进行各种计算:
compute, compute_modify, variable.
输出选项由thermo, dump, restart命令设置.
(4)Run a simulation
使用run命令开始一个分子动力学模拟, 用minimize命令来实施能量最小化(molecular statics), 使用temper命令来进行parallel
tempering(replica-exchange) simulation.
1.4 Commands listed by category
这一节分门别类地列出了lammps的所有命令. 注意有些命令的有些选项是特定的lammps package的一部分, 也就是说只有在编译lammps的时候包括了这些packages, 这些命令才能被使用. 默认情况下编译lammps并不包括所有的packages. 这些依赖关系在相关命令的详细介绍中Restrictions部分中列出了.
Initialization: atom_modify, atom_style, boundary, dimension,
newton, processors, units
Atom definition: create_atoms, create_box, lattice, read_data,
read_restart, region, replicate
Force fields: angle_coeff, angle_style, bond_coeff, bond_style,
dielectric, dihedral_coeff, dihedral_style, improper_coeff,
pair_coeff, improper_style, kspace_modify, kspace_style,
pair_modify, pair_style, pair_write, special_bonds
Settings: communicate, dipole, group, mass, min_modify,
min_style, neigh_modify, neighbor, reset_timestep, run_style, set,
shape, timestep, velocity
Fixes: fix, fix_modify, unfix
Computes: compute, compute_modify, uncompute
Output:
Actions:
dump, dump_modify, restart, thermo,
thermo_modify, thermo_style, undump, write_restart
delete_atoms, delete_bonds, displace_atoms,
displace_box, minimize, run, temper
Miscellaneous: clear, echo, if, include, jump, label, log, next,
print, shell, variable
作者:御剑江湖
一、各种文件的介绍:
1 in file:建立该文件以便程序的写入
2 log file:写入状态信息(if the switch is used?)
3 screen file 决定结果的是否进行屏幕输出
4 var name file 定义一个变量,name指变量名,可为字母也可为字符串,形式$x / $ {abc}
二、屏幕输出:
结果显示在屏幕上,同时在log file 中。开始前LAMMPS计算出所需的存储空间,运行中每隔几个时步显示一次热力学状态,直至输出最终状态。
Loop time of 49.002 on 2 procs for 2004 atoms 该部分显示了几个大类的计算时间
Pair time (%) = 35.0495 (71.5267)
Bond time (%) = 0.092046 (0.187841)
Kspce time (%) = 6.42073 (13.103)
Neigh time (%) = 2.73485 (5.5811)
Comm time (%) = 1.50291 (3.06703)
Outpt time (%) = 0.013799 (0.0281601)
Other time (%) = 2.13669 (4.36041)
Nlocal: 1002 ave, 1015 max, 989 min 每个处理器中特定原子的数目Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 8720 ave, 8724 max, 8716 min
Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 354141 ave, 361422 max, 346860 min Histogram: 1
0 0 0 0 0 0 0 0 1
Total # of neighbors = 708282
Ave neighs/atom = 353.434
Ave special neighs/atom = 2.34032
Number of reneighborings = 42
Dangerous reneighborings = 2
当运用了能量最小化命令进行能量最小化时,还将出现如下所示语句:
Minimization stats:
E initial, next?to?last, final = ?0.895962 ?2.94193 ?2.94342
(显示初终能量以及next-to-last 循环的能量)
Gradient 2?norm init/final= 1920.78 20.9992 (给出能量梯度,即所有原子的受力)
Gradient inf?norm init/final= 304.283 9.61216 2-form是力向量的长度,inf-form是最大构成?
Iterations = 36 循环次数
Force evaluations = 177 对力进行评定的次数
当程序中有kspace_style long?range Coulombics solve,将会显示以下语句:
FFT time (% of Kspce) = 0.200313 (8.34477) 完成3d FFT计算的时间及在总时间中占的百分比
FFT Gflps 3d 1d?only = 2.31074 9.19989
每秒执行的浮点指令次数(flops)为5N*log(2N),N为3维晶体中的节点数The 3d rate is with communication; the 1d rate
iswithout (just the 1d FFTs).
在GPU(图形处理单元)上的运行
三、指令系统介绍(*)
一般来说指令的顺序并不重要,胆在以下几种情况中必须注意:
1 LAMMPS并不是全部读完所有指令才执行,而是读一行执行一次,因此下面的两组语句是不同的:
timestep 0.5 以下的两个模拟其步长均为0.5 fmsec
run 100
run 100
run 100 第一个模拟采用缺省值步长为1 fmsec
timestep 0.5
run 100 第二个采用步长为0.5 fmsec
2 某些指令只在其他指令之后才生效,如要得到系统温度必须先进行各种定义
3 若A指令在B之前,B可以引用A定义的变量
四、语法规则
在LAMMPS中要区分大小写,一般指令名称用小写字母,文件及用户定义ID Strings 用大写。
LAMMPS对每行语句的语法要求如下:
1 当语句太长一行放不下时,在语句一行结束的时候输入字符“”表示下一行的语句接着上一行继续。
2 在#之后输入的字符认为是评论语句,是无用的,但有例外
3 紧跟在$后定义变量(之前讲过)
4 单词间用空格隔开
5 第一个词为指令名,接下来的字母全都为自变量(arguments)
6 If you want text with spaces to be treated as a single
argument, it can be enclosed in double quotes
五、输入的语句结构
一个普通的LAMMPS程序通常由以下四部分组成:
1 初始化
2 原子定义
3 设定
4 进行模拟
初始化阶段:设定所需参数,相关各项命令,引入所需的力场参数
相关命令介绍:
1 units command
语句形式:
units style
· style = lj or real or metal or si or cgs or electron
Examples:
units metal
units lj
该语句定义了单元类型,除了LJ类型,其他物理常量来自于某网,定义实际单元的热能
=4.184J。
而在LJ类型中,所有变量都是无单位的(参考陈义龙的论文)实际量换算成简化单位量有系列公式。
以下列出了换算关系及其它各种类型中所使用的标准单位。
This command cannot be used after the simulation box is
defined by a read_data or create_box command.
缺省状态默认为LJ类型
2 语句形式:
dimension N
· N = 2 or 3 例如:dimension 2
一般缺省为3d模拟,2d模拟的话要在建立simulation box之前进行设定(其余省略)
COMMANDS LISTED BY CATEGORY
以下列出的LAMMPS命令以按类分好,其分类情况如下:
初始化指令:atom_modify, atom_style, boundary, dimension,
newton, processors, units
原子定义指令:create_atoms, create_box, lattice, read_data,
read_restart, region, replicate
力场指令:angle_coeff, angle_style, bond_coeff, bond_style,
dielectric, dihedral_coeff, dihedral_style, improper_coeff,
pair_coeff, improper_style, kspace_modify, kspace_style,
pair_modify, pair_style, pair_write, special_bonds
设定指令:communicate, dipole, group, mass, min_modify,
min_style, neigh_modify, neighbor, reset_timestep, run_style, set,
shape, timestep, velocity
FIXES fix, fix_modify, unfix
Computes: compute, compute_modify, uncompute
Output:
dump, dump_modify, restart, thermo, thermo_modify,
thermo_style, undump, write_restart
Actions:
delete_atoms, delete_bonds, displace_atoms, displace_box,
minimize, prd, run, temper
Miscellaneous:
clear, echo, if, include, jump, label, log, next, print, shell,
variable
六how to discussions()
重启一个模拟。有3种方法继续长的LAMMPS程序。在同一个程序中可多次使用运行命令。每次运行都会接着上一条运行指令(run
command)进行。Binary file 使用restart
本文发布于:2024-02-08 13:20:26,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170736962667566.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |