开始进行lammps手册的学习啦,跟着Manual一边翻译一边做吧!(转载)

转载自:http://blog.sina.com.cn/s/blog_64813e370100ngsz.html

注明:黄色部分基本上为不懂的部分,红色字体为所做注释

一、各种文件的介绍:

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, improper_style, kspace_modify, kspace_style, pair_coeff, 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 command将binary files存入硬盘中,之后用read-restart命令可将binary file读出。或者可转为text data files,经read-data命令读出。restart2data

    涉及到的命令:

1         run command

syntax

    run N keyword values……(N= # of timesteps; zero or more keyword/value pairs may be appended; keyword= upto or start or stop or pre or post or every)

Examples:

run 10000  # 运行10000步;N=0意味着直接把现系统的热力学值输出

run 1000000 upto  # 从当前开始一直运行至upto所指定的数值(该语句意为运行至10000000步止)

run 100 start 0 stop 1000

run 1000 pre no post yes

run 100000 start 0 stop 1000000 every 1000 "print Protein Rg = $r"

run 100000 every 1000 NULL

 

(补充说明 fix 指令:

Syntax:

fix ID group−ID style args

· ID = user−assigned name for the fix  ID是用户自己定义的名字,便于通过fix定义

· group−ID = ID of the group of atoms to apply the fix to

· style = one of a long list of possible style names (see below)

· args = arguments used by a particular style

Examples:

fix 1 all nve

fix 3 all nvt temp 300.0 300.0 0.01

fix mine top setforce 0.0 NULL 0.0

fix指令的用途是对一组原子进行定义,可以用于更新原子的位置、速度、控制温度、加常力、施加边界条件等。当两个或更多fix在同一过程中作用时,根据程序中的先后顺序执行fix指令。Fix指令可通过unfix指令来消除,形式为unfix fix-ID)

 

对于run 100 start 0 stop 1000 这个语句来说,主要与fix语句配合使用。

fix 1 all nvt 200.0 300.0 1.0     这两个指令的功能是在接下来的1000步运行中,每

run 1000                              步的温度都要从200度升到300度

 

fix 1 all nvt 200.0 300.0 1.0      对于左侧的一组指令,温度随着从0到10000步的执行

run 1000 start 0 stop 10000         逐渐升至300.0度,是一个发生在整个过程的渐变行为

run 1000 start 0 stop 10000

...

run 1000 start 0 stop 10000(共10个)

 

至于pre and post大概是这样的,pre no 的意思是跳过初始设定阶段,如果以下的计算是承接之前运行命令的话(意思是采用之前的参数)  但是如果该run指令是第一个指令是,该设定会被忽略。

注意:当两次运行指令之间使用了修改设定值的命令时(比如fix等),pre no是不允许的,必须重新设定,否则报错 

 

若是post no,则跳过full timing summary, 输出one-line summary timing

 

Every 的作用是将一个run分成一系列较短的runs 

variable q equal x[100]                   

run 6000 every 2000 "print Coord = $q"

每运行2000步输出一次某原子的x坐标值

Default:

The option defaults are start = the current timestep, stop = current timestep + N, pre = yes, and post = yes.   在run语句中的缺省值

 

2 restart command (将binary files存入硬盘)  restart文件是lammps的一种输出文件形式

Syntax:

restart 0          N = write a restart file every this many timesteps

restart N root    root = filename to which timestep # is appended

restart N file1 file file1,file2 = two full filenames, toggle between them when writing file

 

Examples:

restart 0

restart 1000 poly.restart

restart 1000 restart.*.equil

restart 10000 poly.%.1 poly.%.2

 

restart 0 意味着不输出restart files。与dump文件一样,restart不能包含两个wild card characters(即通配符)。若filename中含有*号,则它会被目前的值所代替(该情况只在仅有一个filename的情况下成立)

原文地址:https://www.cnblogs.com/sysu/p/10817328.html