您的当前位置:首页正文

lammps模拟实例详解

2023-01-09 来源:客趣旅游网
# Big colloid particles and small LJ particles

units lj

This command sets the style of units used for a simulation. It determines the units of all quantities specified in the input script and data file, as well as quantities output to the screen, log file, and dump files. Typically, this command is used at the very beginning of an input script. 这个指令设定模拟的格式,它决定了在输入脚本文件和数据文件以及在屏幕上显示的输出物,日志文件和垃圾文件中所有的单元格式。典型的是,它经常用于输入脚本的开头

For style lj, all quantities are unitless. Without loss of generality, LAMMPS sets the fundamental quantities mass, sigma, epsilon, and the Boltzmann constant = 1. The masses, distances, energies you specify are multiples of these fundamental values. The formulas relating the reduced or unitless quantity (with an asterisk) to the same quantity with units is also given. Thus you can use the mass & sigma & epsilon values for a specific material and convert the results from a unitless LJ simulation into physical quantities.

对于lj格式,所有数量都是无量纲的。不失一般性的,lammps设定了基本量 质量 sigma epsilon 和波尔兹曼常数=1。你定义的 质量,距离,能量 是这些基本值的倍数。公式把衰减量或者是无量纲量(用*)和单元给出的相同的量关联起来。因此你可以用mass,sigma,epsilon值表示一个具体材料并且改变一个无量纲lj模拟的物理量的结果。

mass = mass or m

distance = sigma, where x* = x / sigma

time = tau, where tau = t* = t (epsilon / m / sigma^2)^1/2

energy = epsilon, where E* = E / epsilon

velocity = sigma/tau, where v* = v tau / sigma

force = epsilon/sigma, where f* = f sigma / epsilon

torque = epsilon, where t* = t / epsilon

temperature = reduced LJ temperature, where T* = T Kb / epsilon

pressure = reduced LJ pressure, where P* = P sigma^3 / epsilon

dynamic viscosity = reduced LJ viscosity, where eta* = eta sigma^3 / epsilon / tau

charge = reduced LJ charge, where q* = q / (4 pi perm0 sigma epsilon)^1/2

dipole = reduced LJ dipole, moment where *mu = mu / (4 pi perm0 sigma^3 epsilon)^1/2

electric field = force/charge, where E* = E (4 pi perm0 sigma epsilon)^1/2 sigma / epsilon

density = mass/volume, where rho* = rho sigma^dim

atom_style atomic 原子类型 atomic(原子的)

Define what style of atoms to use in a simulation. This determines what attributes are associated with the atoms. This command must be used before a simulation is setup via a read_data, read_restart, or create_box command.

定义在模拟中用到的原子类型,这个决定了与原子有关的属性,这个命令必须用在模拟被设定之前 通过 read_data, read_restart, or create_box

Atomic only the default values coarse-grain liquids, solids, metals

Atomic 附加属性是只是默认值 用于粗粒液体,固体和金属的模拟

dimension 2 二维

lattice sq 0.01 建造一个sq类型的二维晶格,lj折合密度rho*=0.01

Lattice Define a lattice for use by other commands. In LAMMPS, a lattice is simply a set of points in space, determined by a unit cell with basis atoms, that is replicated infinitely in all dimensions. The arguments of the lattice command can be used to define a wide variety of crystallographic lattices.

Lattice 指令定义了一个其他指令可以使用的晶格,在lammps中,一个晶格是一个空间中简单的点集,被基本原子构成的所有维度中无限复制的晶胞在所决定。Lattice指令

额参数可以被用来定义各种各样的晶格。

A lattice is used by LAMMPS in two ways. First, the create_atoms command creates atoms on the lattice points inside the simulation box. Note that thecreate_atoms command allows different atom types to be assigned to different basis atoms of the lattice. Second, the lattice spacing in the x,y,z dimensions implied by the lattice, can be used by other commands as distance units (e.g. create_box, region and velocity), which are often convenient to use when the underlying problem geometry is atoms on a lattice. 一个lattice 明令在lammps中有两种实用方式,首先, create_atoms command 在模拟盒子内部的格点上创建原子。注意,ecreate_atoms command允许不同的原子类型去分配到晶格中不同的基本原子。第二,晶格间距在x,y,z轴分量隐含在晶格中,可以被其他命令应用作为距离单元。这个距离单元当潜在问题的几何构型是在晶格中的原子的时候经常被方便的使用。

A lattice consists of a unit cell, a set of basis atoms within that cell, and a set of transformation parameters (scale, origin, orient) that map the unit cell into the simulation box. The vectors a1,a2,a3 are the edge vectors of the unit cell. This is the nomenclature for \"primitive\" vectors in solid-state crystallography, but in LAMMPS the unit cell they determine does not have to be a \"primitive cell\" of minimum volume. 一个晶格由晶胞,晶胞内部的基本原子构成的集合,一个将晶胞绘制入模拟盒子的基本参数构成的集合构成。矢量a1,a2,a3是晶胞的棱矢量,在固态物理学里面用术语primitive矢量来表示。但是在lammps中不一定要用最小体积的原胞来定义晶胞

Lattice应用:

lattice style scale keyword values

style = none or sc or bcc or fcc or hcp or diamond or sq or sq2 or hex or custom

scale = scale factor between lattice and simulation box

for style none:

scale is not specified (nor any optional arguments)

for all other styles:

scale = reduced density rho* (for LJ units)

scale = lattice constant in distance units (for non-LJ units)

Lattices of style sq and sq2 are 2d lattices that define a square unit cell with edge length = 1.0. This means a1 = 1 0 0 and a2 = 0 1 0. A sq lattice has 1 basis atom at the lower-left corner of the square. A sq2 lattice has 2 basis atoms, one at the corner and one at the center of the square.

sq and sq2格式的晶格是一个2维晶格 这个晶格定义了一个棱长为1.0的直角晶胞

的2维晶胞。这意味着a1=1 0 0 ,a2=0 1 0。一个sq晶格在正方形左下角有一个基本的原子。Sq2则有两个基本原子,一个在角落另一个在正方形的中心。

For unit style lj, the scale argument is the Lennard-Jones reduced density, typically written as rho*. LAMMPS converts this value into the multiplicative factor via the formula \"factor^dim = rho/rho*he lattice unit cell and N = the number of basis atoms in the unit cell (described below), and dim = 2 or 3 for the dimensionality of the simulation. Effectively, this means that if LJ particles of size sigma = 1.0 are used in the simulation, the lattice of particles will be at the desired reduced density. 对于li单元,scale是 Lennard-Jones折算密度,典型写为 rho*。Lammps通过公式\"factor^dim = rho/rho*\"将这个值转变为倍增因子。Rho=N/V,v=晶格单元的体积,n=晶胞中基本原子的数量,dim根据模拟的维度等于2或者3。实际上这表明如果在模拟中使用的lj粒子的sigma=1.0,那么晶格中的粒子将会有预期的折算密度。

region box block 0 30 0 30 -0.5 0.5

在空间xlo=0,xhi=30,ylo=0,yhi=30,zlo=—0.5,zhi=0.5的范围内创建区域。

Region This command defines a geometric region of space. Various other commands use regions. For example, the region can be filled with atoms via the create_atomscommand. Or a bounding box around the region, can be used to define the simulation box via the create_box command. Or the surface of the region can be used as a boundary wall via thefix wall/region command. Region指令定义了一个几何空间。许多的其他的指令都用这条指令,比如,空间可以被原子充满通过create_atomscommand。或者是一个区域周围的边界盒子可以被用来定义迷你盒子通过 create_box command.或者空间表面可以作为一个边界框使用通过指令 thefix

wall/region .

A box value selects standard distance units as defined by the units command, e.g. Angstroms for units = real or metal. A lattice value means the distance units are in lattice spacings. The lattice command must have been previously used to define the lattice spacings which are used as follows:一个box值选用被units明令定义的距离标准单位。如A对应的units= real or metal.一个lattice值意味着距离单元在晶格间距内。Lattice指令必须已经在之前被用于定义晶格间距如:

For style block, the lattice spacing in dimension x is applied to xlo and xhi, similarly the spacings in dimensions y,z are applied to ylo/yhi and zlo/zhi.

对于block格式,晶格间距在x轴上被应用于xlo and xhi。y,z轴情况相似。

create_box 2 box 在上述空间内建在一个有两种原子类型的模拟箱

This command creates a simulation box based on the specified region. Thus a region command must first be used to define a geometric domain.这条指令在被指定的区域内创建一个模拟盒子,因此一个region指令必须首先被用来定义一个几何区域。

The argument N is the number of atom types that will be used in the simulation.参数n是在模拟中使用到的原子类型。

create_atoms 1 box

This command creates atoms on a lattice, or a single atom, or a random

collection of atoms, as an alternative to reading in their coordinates explicitly via a read_data or read_restart command. A simulation box must already exist, which is typically created via the create_box command. Before using this command, a lattice must also be defined using the lattice command. The only exceptions are for the single style with units = box or the random style 这条指令在晶格中创造原子,或者创造一个简单原子,或是创造一个随即收集的原子,作为读取他们明确坐标的替代物,通过read_data or read_restart指令,一个模拟盒子必须已经存在,盒子可以通过create_box 指令创建。在用这条指令之前,一个晶格也必须用lattice指令定义。

For the box style, the create_atoms command fills the entire simulation box with atoms on the lattice. If your simulation box is periodic, you should insure its size is a multiple of the lattice spacings, to avoid unwanted atom overlaps at the box boundaries. If your box is periodic and a multiple of the lattice spacing in a particular dimension, LAMMPS is careful to put exactly one atom at the boundary (on either side of the box), not zero or two. 对于box格式, create_atoms 指令将整个模拟盒子用晶格上的原子填充。如果模拟盒子是周期性的,你必须确保它的大小是一个晶格间距的整数倍以避免边界上不必要的原子重叠。若箱在特定的维度是周期性的,并且它的大小是一个晶格间距的整数倍,lammps就会在边界两侧各放一个原子。

set group all type/fraction 2 0.96 2398

set style ID keyword values ...

Set one or more properties of one or more atoms. Since atom properties are initially ass igned by the read_data, read_restart or create_atoms commands, this

command changes those assignments. This can be useful for overriding the default values assigned by the create_atoms command (e.g. charge = 0.0). It can be useful for altering pairwise and molecular force interactions, since force-field coefficients are defined in terms of types. It can be used to change the labeling of atoms by atom type or molecule ID when they are output in dump files. It can be useful for debugging purposes; i.e. positioning an atom at a precise location to compute subsequent forces or energy. 设定一个或多个原子的一个或多个属性。自从原子属性被 read_data, read_restart or create_atoms 指令所分配,这个命令改变他们的参数。这个对于通过 create_atoms command来重置默认值是很有用处的。当力场参数依据类型被定义后,这条指令对于变更成对的或是分子的相互作用力是有用的。该指令可以被用来改变原子的标识通过在他们在dump files中输出的时候改变原子类型或是分子id来完成。这条指令也对调试目标是有用的。定位一个特定的原子的位置,计算后来的力量或能量。

The style group selects all the atoms in the specified group. The style region selects all the atoms in the specified geometric region. Group格式选择所有的原子在指定的群里。Region格式选择在制定几何区域内德所有原子。

Keyword type/fraction sets the atom type for a fraction of the selected atoms. The actual number of atoms changed is not guaranteed to be exactly the requested fraction, but should be statistically close. Random numbers are used in such a way that a particular atom is changed or not changed, regardless of how many processors are being used. 关键词type/fraction 设定一部分指定原子的原子类型。真实的原子改变的数量不被保证正是需要的部分,但是应该是统计接近的。随机数在一个特定原子是改变或是不变的时候被使用,不管多少处理器被使用。

type/fraction values = type fraction seed type = new atom type fraction = fraction of selected atoms to set to new atom type seed = random # seed (positive integer) mass

1 9 第一种原子类型质量为 9 g/mol

mass 2 1 第二种原子类型质量为 1 g/mol

velocity all create 1.44 87287 loop geom

velocity group-ID style args keyword value ...

Set or change the velocities of a group of atoms in one of several styles. For each style, there are required arguments and optional keyword/value parameters. Not all options are used by each style. Each option has a default as listed below.

设定或是改变在一个或是几个类型里一群原子的速度。对于每个类型,都有需要的参数和可选项keyword/value参数。不是所有的可选项都在每一个类型中使用到,每一个可选项有一个默认值。

The create style generates an ensemble of velocities using a random number generator with the specified seed as the specified temperature. Creat类型引发了全

体的速度用一个被指定温度指定的种子的随即数发生器。

group-ID = ID of group of atoms whose velocity will be changed

create args = temp seed

temp = temperature value (temperature units)

seed = random # seed (positive integer)

loop value = all or local or geom The loop option is used by create in the following ways.

If loop = geom, then each processor loops over only its atoms. For each atom a unique random number seed is created, based on the atom's xyz coordinates. A velocity is generated using that seed. This is a fast loop and the velocity assigned to a particular atom will be the same, independent of how many processors are used.对于每个原子都有基于xyz坐标的独一无二的随机数产生。这是一个快速回路并且分配给特别原子的速度将是一样的,独立于有多少处理器被使用。

Note that the loop geom option will not necessarily assign identical velocities for two simulations run on different machines. This is because the computations based on xyz coordinates are sensitive to tiny differences in the double-precision value for a coordinate as stored on a particular machine.geom 选项将不必要对不同机器上运行的两个模拟分配完全相同的速度。这是因为基于xyz坐标的运算指令对储存在

一个特定机器的双精度坐标值的微小变化是敏感的。

If units = box, the velocities and coordinates specified in the velocity command are in the standard units described by the units command (e.g. Angstroms/fmsec for real units). 如果units = box,被velocity command 指定的速度和坐标是被the units command描述的标准单元

# multi neighbor and comm for efficiency

neighbor 1 multi

neighbor skin style

skin = extra distance beyond force cutoff (distance units)

style = bin or nsq or multi

This command sets parameters that affect the building of pairwise neighbor lists. All atom pairs within a neighbor cutoff distance equal to the their force cutoff plus the skin distance are stored in the list. Typically, the larger the skin distance, the less often neighbor lists need to be built, but more pairs must be checked for possible force interactions every timestep. The default value for skin depends on the choice of units for the simulation; see the default values below. 这个指令设定影响成对建造的邻域列表的参数。所有截止距离等于它的力的截断距离加上缓冲距离的原子对都被储存在列表里。代表性的是,缓冲距离越大所需要构建的临域列表越小,但是每一

步的时候必须检查更多的原子对间可能的相互作用。缓冲距离的默认值依靠模拟单元的选择。

The skin distance is also used to determine how often atoms migrate to new processors if the check option of the neigh_modify command is set to yes. Atoms are migrated (communicated) to new processors on the same timestep that neighbor lists are re-built. 那种距离也被用来定义如果检查neigh_modify command设定的是yes的情况下,原子迁移至新的处理器一次要多长时间。在neighbor 列表被重新构建的同一步里原子迁移到新的处理器内。

The style value selects what algorithm is used to build the list.

Style值构建列表的算法。

The multi style is a modified binning algorithm that is useful for systems with a wide range of cutoff distances, e.g. due to different size particles. For the bin style, the bin size is set to 1/2 of the largest cutoff distance between any pair of atom types and a single set of bins is defined to search over for all atom types. This can be inefficient if one pair of types has a very long cutoff, but other type pairs have a much shorter cutoff. For style multithe bin size is set to 1/2 of the shortest cutoff distance and multiple sets of bins are defined to search over for different atom types. This imposes some extra setup overhead, but the searches themselves may be much faster for the short-cutoff cases. multi 风格是一个改良的bining算法,对于有广泛截止距离的系统有很大作用。举例来说由于不同的粒子大小,对于bin风格,bin大小设定为任意两个原子类型之间最大的截止距离1/2,并且bin的基本设置被定义来搜

索所有的原子类型。如果子类型有很长的截至距离这可能是低效的,但是其他的类型可能会有断的截至距离。例如对于multithe bin大小被设置成两个原子类型之间最小的截止距离1/2 ,并且bins在multiple中得设置来定义搜索不同的原子类型。这个利用其它的设置控制信息,但是搜索本身对于短截止距离的情况可能是很快的。

neigh_modify delay 0

neigh_modify keyword values

delay value = N

N = delay building until this many steps since last build

自上次构建neighbor列表之后无延迟

communicate multi

communicate style keyword value

style = single or multi

This command sets the style of inter-processor communication that occurs each timestep as atom coordinates and other properties are exchanged between neighboring processors and stored as properties of ghost atoms. 这条指令设置在在每一步中发生的处理器之间的交流方式,就想原子坐标和其他的属性在相近的处理器之间交换并且作为ghost原子储存。

For many systems this is an efficient algorithm, but for systems with widely varying cutoffs for different type pairs, the multi style can be faster. In this case, each atom type is assigned its own distance cutoff for communication purposes, and fewer atoms will be communicated. 对于很多的系统这会是有效的算法。但是对于有着广泛截止距离的不同类型的原子对,multi格式会更快一些,既然这样,每一个类型的原子为了交流(信息)被分配自己的截至距离,很少的原子会被联系。

# colloid potential

pair_style colloid 12.5

pair_style style args

style = one of the styles from the list below

args = arguments used by a particular style

Set the formula(s) LAMMPS uses to compute pairwise interactions. In LAMMPS, pair potentials are defined between pairs of atoms that are within a cutoff distance and the set of active interactions typically changes over time. See the bond_style command to define potentials between pairs of bonded atoms, which typically remain in place for the duration of a simulation. 设置lammps实用的公式来计算成对发生的相互作用力。在lammps中电位对。被定义在两个在截止距离内的原子之间,有活性的相互作用的设置随时间典型变化。

In LAMMPS, pairwise force fields encompass a variety of interactions, some of which include many-body effects, e.g. EAM, Stillinger-Weber, Tersoff, REBO potentials. They are still classified as \"pairwise\" potentials because the set of interacting atoms changes with time (unlike molecular bonds) and thus a neighbor list is used to find nearby interacting atoms. 在lammps中承兑发生的力场包括大量的相互作用,有些包括多体作用。这些依然被分类为 \"pairwise\" potentials因为原子相互作用的设置随时间变化并且因此neighbor列表被用来发现在相互作用附近的原子。

pair_style colloid - integrated(完全的) colloidal(胶体) potential

pair_style colloid cutoff

cutoff = global cutoff for colloidal interactions (distance units) 对于胶体的相互作用球形的截至距离。

pair_coeff 1 1 1.0 1.0 5.0 5.0 12.5

pair_coeff 1 2 5.0 1.0 5.0 0.0 7.0

pair_coeff 2 2 10.0 1.0 0.0 0.0 2.5

pair_coeff I J args

I,J = atom types (see asterisk form below)

args = coefficients for one or more pairs of atom types

Specify the pairwise force field coefficients for one or more pairs of atom types. The number and meaning of the coefficients depends on the pair style. Pair coefficients can also be set in the data file read by the read_data command or in a restart file. 为一个或更多原子类型制定成对的力场系数。系数的数量和意义取决于pair style 。每一个系数也可以在数据文件中被设定。在read data 指令或是在一个重启文件。

I and J can be specified in one of two ways. Explicit numeric values can be used for each, as in the 1st example above. I <= J is required. LAMMPS sets the coefficients for the symmetric J,I interaction to the same values. I和J可以被定义在通过两种方式。明确的数值可以被用于每个, I <= J 是必须的。Lammps设置对称的i,j相互作用系数是一样的。

The following coefficients must be defined for each pair of atoms types via the pair_coeff command 紧跟的系数一定通过 pair_coeff command 被确定为每一个原子对类型

A (energy units)

sigma (distance units)

d1 (distance units)

d2 (distance units)

cutoff (distance units)

A is the Hamaker energy prefactor A是Hamaker能量速率

Sigma is the size of the solvent particle or the constituent particles integrated over in the colloidal particle sigma是溶剂粒子的大小或是胶体粒子的整体的粒子构成。fix

1 all npt temp 2.0 2.0 1.0 iso 0.0 1.0 10.0 drag 1.0 &

mtk no pchain 0 tchain 1

fix 2 all enforce2d

fix ID group-ID style args

ID = user-assigned name for the 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

Set a fix that will be applied to a group of atoms. In LAMMPS, a \"fix\" is any operation that is applied to the system during timestepping or minimization.设置一个fix会应用为一个原子群里。在lammps里面一个\"fix\"是一个任意的操作在整个时间步伐里应用于系统中。

Temp恒温器的温度 iso恒压器的压强

In some cases (e.g. for solids) the pressure (volume) and/or temperature of the system can oscillate undesirably when a Nose/Hoover barostat and thermostat is applied. The optional drag keyword will damp these oscillations ,在一些情况里当Nose/Hoover恒温器或是恒压器使用时,系统的温度或是压强会不受人欢迎的震动drag会抑制这些振动。

The mtk keyword controls whether or not the correction terms due to Martyna, Tuckerman, and Klein are included in the equations of motion (Martyna). Specifying no reproduces the original Hoover barostat, whose volume probability distribution function differs from the true NPT and NPH ensembles by a factor of 1/V. Hence using yes is more correct, but in many cases the difference is negligible. Mtk控制是否修正包括Martyna, Tuckerman, and Klein在内的方程的移动。指定原始的hoover恒温器(其体积分布系数与真实的npt或是nph的体积分布系数有1/V的不同)没有再现。使用yes是更精确的但多数时候不同时可以忽略的。

the number and meaning of the vector values depends on which fix is used and the settings for keywords tchain and pchain, which specify the number of Nose/Hoover chains for the thermostat and barostat. 矢量值的数量和意义取决于那个fix被使用以及 tchain and pchain的设定。 tchain and pchain 指定恒温器和恒压器的Nose/Hoover链条的数目。If no thermostatting is done, thentchain is 0. .its value

is 1 ifcouple xyz is used or couple xy for a 2d simulation,

包括 enforce2d

Zero out the z-dimension velocity and force on each atom in the group. 将每

个群里的原子z轴的力和速率清零。

dump 1 all atom 200 dump.colloid

dump ID group-ID style N file args

ID = user-assigned name for the dump

group-ID = ID of the group of atoms to be dumped

style = atom or cfg or dcd or xtc or xyz or image or local or custom

N = dump every this many timesteps

file = name of file to write dump info to

args = list of arguments for a particular style

Dump a snapshot of atom quantities to one or more files every N timesteps in one of several styles. 每n步里在一个或是多个格式里面倾倒一段数量的原子至一个或是多个文件里

thermo_style custom step temp epair etotal press vol

Set the style and content for printing thermodynamic data to the screen and log file.

设定屏幕或是长文件中热力学数据得格式和内容。

Style custom is the most general setting and allows you to specify which of the keywords listed above you want printed on each thermodynamic timestep. Thus the custom style provides a flexible means of outputting essentially any desired quantity as a simulation proceeds. custom 格式是最一般的设置并且允许你在你想打印出的每一个热力学时间步伐中设定关键字列表。因此custom格式提供一个灵活的方式输出所有原来渴望的值作为模拟的数据。

step = timestep时间步伐

temp = temperature温度

epair = pairwise energy (evdwl + ecoul + elong + etail)相互作用能量

etotal = total energy (pe + ke)总能量

press = pressure压力

vol = volume体积

thermo 1000N = output thermodynamics every N timesteps 每N步输出一

次热动力学量的结果

timestep 0.005时间步长0.005

run 50000

走50000下

因篇幅问题不能全部显示,请点此查看更多更全内容