<LI>style = <I>delete</I> or <I>index</I> or <I>loop</I> or <I>world</I> or <I>universe</I> or
<I>uloop</I> or <I>string</I> or <I>format</I> or <I>getenv</I> or <I>file</I> or <I>atomfile</I> or <I>python</I> or <I>equal</I> or <I>atom</I>
<PRE><I>delete</I> = no args
<I>index</I> args = one or more strings
<I>loop</I> args = N
N = integer size of loop, loop from 1 to N inclusive
<I>loop</I> args = N pad
N = integer size of loop, loop from 1 to N inclusive
pad = all values will be same length, e.g. 001, 002, ..., 100
<I>loop</I> args = N1 N2
N1,N2 = loop from N1 to N2 inclusive
<I>loop</I> args = N1 N2 pad
N1,N2 = loop from N1 to N2 inclusive
pad = all values will be same length, e.g. 050, 051, ..., 100
<I>world</I> args = one string for each partition of processors
<I>universe</I> args = one or more strings
<I>uloop</I> args = N
N = integer size of loop
<I>uloop</I> args = N pad
N = integer size of loop
pad = all values will be same length, e.g. 001, 002, ..., 100
<I>string</I> arg = one string
<I>format</I> args = vname fstr
vname = name of equal-style variable to evaluate
fstr = C-style format string
<I>getenv</I> arg = one string
<I>file</I> arg = filename
<I>atomfile</I> arg = filename
<I>python</I> arg = function
<I>equal</I> or <I>atom</I> args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references
numbers = 0.0, 100, -5.4, 2.8e-4, etc
constants = PI, version, on, off, true, false, yes, no
thermo keywords = vol, ke, press, etc from <AHREF ="thermo_style.html">thermo_style</A>
<TR><TD>Math operators</TD><TD> (), -x, x+y, x-y, x*y, x/y, x^y, x%y, x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x || y, !x</TD></TR>
<P>Group functions are specified as keywords followed by one or two
parenthesized arguments. The first argument <I>ID</I> is the group-ID.
The <I>dim</I> argument, if it exists, is <I>x</I> or <I>y</I> or <I>z</I>. The <I>dir</I>
argument, if it exists, is <I>xmin</I>, <I>xmax</I>, <I>ymin</I>, <I>ymax</I>, <I>zmin</I>, or
<I>zmax</I>. The <I>dimdim</I> argument, if it exists, is <I>xx</I> or <I>yy</I> or <I>zz</I>
or <I>xy</I> or <I>yz</I> or <I>xz</I>.
</P>
<P>The group function count() is the number of atoms in the group. The
group functions mass() and charge() are the total mass and charge of
the group. Xcm() and vcm() return components of the position and
velocity of the center of mass of the group. Fcm() returns a
component of the total force on the group of atoms. Bound() returns
the min/max of a particular coordinate for all atoms in the group.
Gyration() computes the radius-of-gyration of the group of atoms. See
the <AHREF ="compute_gyration.html">compute gyration</A> command for a definition
of the formula. Angmom() returns components of the angular momentum
of the group of atoms around its center of mass. Torque() returns
components of the torque on the group of atoms around its center of
mass, based on current forces on the atoms. Inertia() returns one of
6 components of the symmetric inertia tensor of the group of atoms
around its center of mass, ordered as Ixx,Iyy,Izz,Ixy,Iyz,Ixz.
Omega() returns components of the angular velocity of the group of
atoms around its center of mass.
</P>
<P>Region functions are specified exactly the same way as group functions
except they take an extra final argument <I>IDR</I> which is the region ID.
The function is computed for all atoms that are in both the group and
the region. If the group is "all", then the only criteria for atom
inclusion is that it be in the region.
</P>
<HR>
<H4>Special Functions
</H4>
<P>Special functions take specific kinds of arguments, meaning their
arguments cannot be formulas themselves.
</P>
<P>The sum(x), min(x), max(x), ave(x), trap(x), and slope(x) functions
each take 1 argument which is of the form "c_ID" or "c_ID[N]" or
"f_ID" or "f_ID[N]". The first two are computes and the second two
are fixes; the ID in the reference should be replaced by the ID of a
compute or fix defined elsewhere in the input script. The compute or
fix must produce either a global vector or array. If it produces a
global vector, then the notation without "[N]" should be used. If
it produces a global array, then the notation with "[N]" should be
used, when N is an integer, to specify which column of the global
array is being referenced.
</P>
<P>These functions operate on the global vector of inputs and reduce it
to a single scalar value. This is analagous to the operation of the
<AHREF ="compute_reduce.html">compute reduce</A> command, which invokes the same
functions on per-atom and local vectors.
</P>
<P>The sum() function calculates the sum of all the vector elements. The
min() and max() functions find the minimum and maximum element
respectively. The ave() function is the same as sum() except that it
divides the result by the length of the vector.
</P>
<P>The trap() function is the same as sum() except the first and last
elements are multiplied by a weighting factor of 1/2 when performing
the sum. This effectively implements an integration via the
trapezoidal rule on the global vector of data. I.e. consider a set of
points, equally spaced by 1 in their x coordinate: (1,V1), (2,V2),
..., (N,VN), where the Vi are the values in the global vector of
length N. The integral from 1 to N of these points is trap(). When
appropriately normalized by the timestep size, this function is useful
for calculating integrals of time-series data, like that generated by
the <AHREF ="fix_ave_correlate.html">fix ave/correlate</A> command.
</P>
<P>The slope() function uses linear regression to fit a line to the set
of points, equally spaced by 1 in their x coordinate: (1,V1), (2,V2),
..., (N,VN), where the Vi are the values in the global vector of
length N. The returned value is the slope of the line. If the line
has a single point or is vertical, it returns 1.0e20.
</P>
<P>The gmask(x) function takes 1 argument which is a group ID. It
can only be used in atom-style variables. It returns a 1 for
atoms that are in the group, and a 0 for atoms that are not.
</P>
<P>The rmask(x) function takes 1 argument which is a region ID. It can
only be used in atom-style variables. It returns a 1 for atoms that
are in the geometric region, and a 0 for atoms that are not.
</P>
<P>The grmask(x,y) function takes 2 arguments. The first is a group ID,
and the second is a region ID. It can only be used in atom-style
variables. It returns a 1 for atoms that are in both the group and
region, and a 0 for atoms that are not in both.
</P>
<P>The next(x) function takes 1 argument which is a variable ID (not
"v_foo", just "foo"). It must be for a file-style or atomfile-style
variable. Each time the next() function is invoked (i.e. each time
the equal-style or atom-style variable is evaluated), the following
steps occur.
</P>
<P>For file-style variables, the current string value stored by the
file-style variable is converted to a numeric value and returned by
the function. And the next string value in the file is read and
stored. Note that if the line previously read from the file was not a
numeric string, then it will typically evaluate to 0.0, which is
likely not what you want.
</P>
<P>For atomfile-style variables, the current per-atom values stored by
the atomfile-style variable are returned by the function. And the
next set of per-atom values in the file is read and stored.
</P>
<P>Since file-style and atomfile-style variables read and store the first
line of the file or first set of per-atoms values when they are
defined in the input script, these are the value(s) that will be
returned the first time the next() function is invoked. If next() is
invoked more times than there are lines or sets of lines in the file,
the variable is deleted, similar to how the <AHREF ="next.html">next</A> command
operates.
</P>
<HR>
<H4>Feature Functions
</H4>
<P>Feature functions allow to probe the running LAMMPS executable for
whether specific features are either active, defined, or available.
The functions take two arguments, a <I>category</I> and a corresponding
<I>argument</I>. The arguments are strings thus cannot be formulas
themselves (only $-style immediate variable expansion is possible).
Return value is either 1.0 or 0.0 depending on whether the function
evaluates to true or false, respectively.
</P>
<P>The <I>is_active()</I> function allows to query for active settings which
are grouped by categories. Currently supported categories and
arguments are:
</P>
<UL><LI><I>package</I> (argument = <I>cuda</I> or <I>gpu</I> or <I>intel</I> or <I>kokkos</I> or <I>omp</I>)
<LI><I>newton</I> (argument = <I>pair</I> or <I>bond</I> or <I>any</I>)
<LI><I>pair</I> (argument = <I>single</I> or <I>respa</I> or <I>manybody</I> or <I>tail</I> or <I>shift</I>)
<LI><I>comm_style</I> (argument = <I>brick</I> or <I>tiled</I>)
<LI><I>min_style</I> (argument = any of the compiled in minimizer styles)
<LI><I>run_style</I> (argument = any of the compiled in run styles)
<LI><I>atom_style</I> (argument = any of the compiled in atom styles)
<LI><I>pair_style</I> (argument = any of the compiled in pair styles)
<LI><I>bond_style</I> (argument = any of the compiled in bond styles)
<LI><I>angle_style</I> (argument = any of the compiled in angle styles)
<LI><I>dihedral_style</I> (argument = any of the compiled in dihedral styles)
<LI><I>improper_style</I> (argument = any of the compiled in improper styles)
<LI><I>kspace_style</I> (argument = any of the compiled in kspace styles)
</UL>
<P>Most of the settings are self-explanatory, the <I>single</I> argument in the
<I>pair</I> category allows to check whether a pair style supports a
Pair::single() function as needed by compute group/group and others
features or LAMMPS, <I>respa</I> allows to check whether the inner/middle/outer
mode of r-RESPA is supported. In the various style categories,
the checking is also done using suffix flags, if available and enabled.
</P>
<P>Example 1: disable use of suffix for pppm when using GPU package (i.e. run it on the CPU concurrently to running the pair style on the GPU), but do use the suffix otherwise (e.g. with USER-OMP).
</P>
<PRE>pair_style lj/cut/coul/long 14.0
if $(is_active(package,gpu)) then "suffix off"
kspace_style pppm
</PRE>
<P>Example 2: use r-RESPA with inner/outer cutoff, if supported by pair style, otherwise fall back to using pair and reducing the outer time step