git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14711 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2016-03-01 22:30:28 +00:00
parent 1145d82222
commit c67331a3bc
25 changed files with 1023 additions and 734 deletions

View File

@ -1168,10 +1168,10 @@ KOKKOS, o = USER-OMP, t = OPT.</p>
if <a class="reference internal" href="Section_start.html#start-3"><span>LAMMPS is built with the appropriate package</span></a>.</p>
<table border="1" class="docutils">
<colgroup>
<col width="30%" />
<col width="22%" />
<col width="23%" />
<col width="24%" />
<col width="30%" />
<col width="23%" />
<col width="23%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="pair_awpmd.html"><em>awpmd/cut</em></a></td>
@ -1209,28 +1209,28 @@ if <a class="reference internal" href="Section_start.html#start-3"><span>LAMMPS
<td><a class="reference internal" href="pair_meam_sw_spline.html"><em>meam/sw/spline</em></a></td>
<td><a class="reference internal" href="pair_mgpt.html"><em>mgpt</em></a></td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="pair_quip.html"><em>quip</em></a></td>
<tr class="row-even"><td><a class="reference internal" href="pair_morse.html"><em>morse/smooth/linear</em></a></td>
<td><a class="reference internal" href="pair_quip.html"><em>quip</em></a></td>
<td><a class="reference internal" href="pair_reax_c.html"><em>reax/c</em></a></td>
<td><a class="reference internal" href="pair_smd_hertz.html"><em>smd/hertz</em></a></td>
<td><a class="reference internal" href="pair_smd_tlsph.html"><em>smd/tlsph</em></a></td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="pair_smd_triangulated_surface.html"><em>smd/triangulated/surface</em></a></td>
<tr class="row-odd"><td><a class="reference internal" href="pair_smd_tlsph.html"><em>smd/tlsph</em></a></td>
<td><a class="reference internal" href="pair_smd_triangulated_surface.html"><em>smd/triangulated/surface</em></a></td>
<td><a class="reference internal" href="pair_smd_ulsph.html"><em>smd/ulsph</em></a></td>
<td><a class="reference internal" href="pair_smtbq.html"><em>smtbq</em></a></td>
<td><a class="reference internal" href="pair_sph_heatconduction.html"><em>sph/heatconduction</em></a></td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="pair_sph_idealgas.html"><em>sph/idealgas</em></a></td>
<tr class="row-even"><td><a class="reference internal" href="pair_sph_heatconduction.html"><em>sph/heatconduction</em></a></td>
<td><a class="reference internal" href="pair_sph_idealgas.html"><em>sph/idealgas</em></a></td>
<td><a class="reference internal" href="pair_sph_lj.html"><em>sph/lj</em></a></td>
<td><a class="reference internal" href="pair_sph_rhosum.html"><em>sph/rhosum</em></a></td>
<td><a class="reference internal" href="pair_sph_taitwater.html"><em>sph/taitwater</em></a></td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="pair_sph_taitwater_morris.html"><em>sph/taitwater/morris</em></a></td>
<tr class="row-odd"><td><a class="reference internal" href="pair_sph_taitwater.html"><em>sph/taitwater</em></a></td>
<td><a class="reference internal" href="pair_sph_taitwater_morris.html"><em>sph/taitwater/morris</em></a></td>
<td><a class="reference internal" href="pair_srp.html"><em>srp</em></a></td>
<td><a class="reference internal" href="pair_tersoff.html"><em>tersoff/table (o)</em></a></td>
<td><a class="reference internal" href="pair_thole.html"><em>thole</em></a></td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="pair_lj_soft.html"><em>tip4p/long/soft (o)</em></a></td>
<td>&nbsp;</td>
<tr class="row-even"><td><a class="reference internal" href="pair_thole.html"><em>thole</em></a></td>
<td><a class="reference internal" href="pair_lj_soft.html"><em>tip4p/long/soft (o)</em></a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

View File

@ -941,6 +941,7 @@ package"_Section_start.html#start_3.
"meam/spline"_pair_meam_spline.html,
"meam/sw/spline"_pair_meam_sw_spline.html,
"mgpt"_pair_mgpt.html,
"morse/smooth/linear"_pair_morse.html,
"quip"_pair_quip.html,
"reax/c"_pair_reax_c.html,
"smd/hertz"_pair_smd_hertz.html,

View File

@ -644,31 +644,31 @@ KOKKOS, o = USER-OMP, t = OPT.
These are additional pair styles in USER packages, which can be used
if :ref:`LAMMPS is built with the appropriate package <start_3>`.
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`awpmd/cut <pair_awpmd>` | :doc:`buck/mdf <pair_mdf>` | :doc:`coul/cut/soft (o) <pair_lj_soft>` | :doc:`coul/diel (o) <pair_coul_diel>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`coul/long/soft (o) <pair_lj_soft>` | :doc:`dpd/conservative <pair_dpd_conservative>` | :doc:`dpd/fdt <pair_dpd_fdt>` | :doc:`dpd/fdt/energy <pair_dpd_fdt>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`eam/cd (o) <pair_eam>` | :doc:`edip (o) <pair_edip>` | :doc:`eff/cut <pair_eff>` | :doc:`gauss/cut <pair_gauss>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`lennard/mdf <pair_mdf>` | :doc:`list <pair_list>` | :doc:`lj/charmm/coul/long/soft (o) <pair_charmm>` | :doc:`lj/cut/coul/cut/soft (o) <pair_lj_soft>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`lj/cut/coul/long/soft (o) <pair_lj_soft>` | :doc:`lj/cut/dipole/sf (go) <pair_dipole>` | :doc:`lj/cut/soft (o) <pair_lj_soft>` | :doc:`lj/cut/tip4p/long/soft (o) <pair_lj_soft>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`lj/mdf <pair_mdf>` | :doc:`lj/sdk (gko) <pair_sdk>` | :doc:`lj/sdk/coul/long (go) <pair_sdk>` | :doc:`lj/sdk/coul/msm (o) <pair_sdk>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`lj/sf (o) <pair_lj_sf>` | :doc:`meam/spline <pair_meam_spline>` | :doc:`meam/sw/spline <pair_meam_sw_spline>` | :doc:`mgpt <pair_mgpt>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`quip <pair_quip>` | :doc:`reax/c <pair_reax_c>` | :doc:`smd/hertz <pair_smd_hertz>` | :doc:`smd/tlsph <pair_smd_tlsph>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`smd/triangulated/surface <pair_smd_triangulated_surface>` | :doc:`smd/ulsph <pair_smd_ulsph>` | :doc:`smtbq <pair_smtbq>` | :doc:`sph/heatconduction <pair_sph_heatconduction>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`sph/idealgas <pair_sph_idealgas>` | :doc:`sph/lj <pair_sph_lj>` | :doc:`sph/rhosum <pair_sph_rhosum>` | :doc:`sph/taitwater <pair_sph_taitwater>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`sph/taitwater/morris <pair_sph_taitwater_morris>` | :doc:`srp <pair_srp>` | :doc:`tersoff/table (o) <pair_tersoff>` | :doc:`thole <pair_thole>` |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :doc:`tip4p/long/soft (o) <pair_lj_soft>` | | | |
+-----------------------------------------------------------------+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`awpmd/cut <pair_awpmd>` | :doc:`buck/mdf <pair_mdf>` | :doc:`coul/cut/soft (o) <pair_lj_soft>` | :doc:`coul/diel (o) <pair_coul_diel>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`coul/long/soft (o) <pair_lj_soft>` | :doc:`dpd/conservative <pair_dpd_conservative>` | :doc:`dpd/fdt <pair_dpd_fdt>` | :doc:`dpd/fdt/energy <pair_dpd_fdt>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`eam/cd (o) <pair_eam>` | :doc:`edip (o) <pair_edip>` | :doc:`eff/cut <pair_eff>` | :doc:`gauss/cut <pair_gauss>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`lennard/mdf <pair_mdf>` | :doc:`list <pair_list>` | :doc:`lj/charmm/coul/long/soft (o) <pair_charmm>` | :doc:`lj/cut/coul/cut/soft (o) <pair_lj_soft>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`lj/cut/coul/long/soft (o) <pair_lj_soft>` | :doc:`lj/cut/dipole/sf (go) <pair_dipole>` | :doc:`lj/cut/soft (o) <pair_lj_soft>` | :doc:`lj/cut/tip4p/long/soft (o) <pair_lj_soft>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`lj/mdf <pair_mdf>` | :doc:`lj/sdk (gko) <pair_sdk>` | :doc:`lj/sdk/coul/long (go) <pair_sdk>` | :doc:`lj/sdk/coul/msm (o) <pair_sdk>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`lj/sf (o) <pair_lj_sf>` | :doc:`meam/spline <pair_meam_spline>` | :doc:`meam/sw/spline <pair_meam_sw_spline>` | :doc:`mgpt <pair_mgpt>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`morse/smooth/linear <pair_morse>` | :doc:`quip <pair_quip>` | :doc:`reax/c <pair_reax_c>` | :doc:`smd/hertz <pair_smd_hertz>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`smd/tlsph <pair_smd_tlsph>` | :doc:`smd/triangulated/surface <pair_smd_triangulated_surface>` | :doc:`smd/ulsph <pair_smd_ulsph>` | :doc:`smtbq <pair_smtbq>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`sph/heatconduction <pair_sph_heatconduction>` | :doc:`sph/idealgas <pair_sph_idealgas>` | :doc:`sph/lj <pair_sph_lj>` | :doc:`sph/rhosum <pair_sph_rhosum>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`sph/taitwater <pair_sph_taitwater>` | :doc:`sph/taitwater/morris <pair_sph_taitwater_morris>` | :doc:`srp <pair_srp>` | :doc:`tersoff/table (o) <pair_tersoff>` |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
| :doc:`thole <pair_thole>` | :doc:`tip4p/long/soft (o) <pair_lj_soft>` | | |
+-----------------------------------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------+
----------

View File

@ -22,6 +22,7 @@ Syntax
c_ID[I] = Ith column of global array calculated by a compute with ID
f_ID = global vector calculated by a fix with ID
f_ID[I] = Ith column of global array calculated by a fix with ID
v_name = vector calculated by an vector-style variable with name
@ -31,7 +32,7 @@ Examples
.. parsed-literal::
compute 1 all slice 1 100 10 c_msdmol[4]
compute 1 all slice 301 400 1 c_msdmol[4]
compute 1 all slice 301 400 1 c_msdmol[4] v_myVec
Description
"""""""""""
@ -39,9 +40,9 @@ Description
Define a calculation that "slices" one or more vector inputs into
smaller vectors, one per listed input. The inputs can be global
quantities; they cannot be per-atom or local quantities.
:doc:`Computes <compute>` and :doc:`fixes <fix>` may generate any of the
three kinds of quantities. :doc:`Variables <variable>` do not generate
global vectors. The group specified with this command is ignored.
:doc:`Computes <compute>` and :doc:`fixes <fix>` and vector-style
:doc:`variables <variable>` can generate such global quantities. The
group specified with this command is ignored.
The values extracted from the input vector(s) are determined by the
*Nstart*, *Nstop*, and *Nskip* parameters. The elements of an input
@ -73,6 +74,15 @@ appended, the vector calculated by the fix is used. If a bracketed
integer is appended, the Ith column of the array calculated by the fix
is used. Users can also write code for their own fix style and :doc:`add them to LAMMPS <Section_modify>`.
If an input value begins with "v_", a variable name must follow which
has been previously defined in the input script. Only vector-style
variables can be referenced. See the :doc:`variable <variable>` command
for details. Note that variables of style *vector* define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to slice.
If a single input is specified this compute produces a global vector,
even if the length of the vector is 1. If multiple inputs are
specified, then a global array of values is produced, with the number
@ -93,15 +103,16 @@ array values from a compute as input. See :ref:`this section <howto_15>` for an
options.
The vector or array values calculated by this compute are simply
copies of values generated by computes or fixes that are input vectors
to this compute. If there is a single input vector of intensive
and/or extensive values, then each value in the vector of values
calculated by this compute will be "intensive" or "extensive",
copies of values generated by computes or fixes or variables that are
input vectors to this compute. If there is a single input vector of
intensive and/or extensive values, then each value in the vector of
values calculated by this compute will be "intensive" or "extensive",
depending on the corresponding input value. If there are multiple
input vectors, and all the values in them are intensive, then the
array values calculated by this compute are "intensive". If there are
multiple input vectors, and any value in them is extensive, then the
array values calculated by this compute are "extensive".
array values calculated by this compute are "extensive". Values
produced by a variable are treated as intensive.
The vector or array values will be in whatever :doc:`units <units>` the
input quantities are in.

View File

@ -24,6 +24,7 @@ Syntax
f_ID = global scalar calculated by a fix with ID
f_ID[I] = Ith component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
v_name[I] = Ith component of a vector-style variable with name
* zero or more keyword/arg pairs may be appended
* keyword = *type* or *ave* or *start* or *prefactor* or *file* or *overwrite* or *title1* or *title2* or *title3*
@ -82,21 +83,22 @@ specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
Each listed value can be the result of a :doc:`compute <compute>` or
:doc:`fix <fix>` or the evaluation of an equal-style
:doc:`fix <fix>` or the evaluation of an equal-style or vector-style
:doc:`variable <variable>`. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
from a compute, fix, or variable, then see the :doc:`fix ave/spatial <fix_ave_spatial>`, :doc:`fix ave/atom <fix_ave_atom>`,
or :doc:`fix ave/histo <fix_ave_histo>` commands. If you wish to sum a
per-atom quantity into a single global quantity, see the :doc:`compute reduce <compute_reduce>` command.
or :doc:`fix ave/histo <fix_ave_histo>` commands. If you wish to
convert a per-atom quantity into a single global value, see the
:doc:`compute reduce <compute_reduce>` command.
:doc:`Computes <compute>` that produce global quantities are those which
do not have the word *atom* in their style name. Only a few
:doc:`fixes <fix>` produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
:doc:`Variables <variable>` of style *equal* are the only ones that can
be used with this fix. Variables of style *atom* cannot be used,
since they produce per-atom values.
:doc:`Variables <variable>` of style *equal* and *vector* are the only
ones that can be used with this fix. Variables of style *atom* cannot
be used, since they produce per-atom values.
The input values must either be all scalars. What kinds of
correlations between input values are calculated is determined by the
@ -172,9 +174,11 @@ which must be compatible with *Nevery*, else an error will result.
Users can also write code for their own fix styles and :doc:`add them to LAMMPS <Section_modify>`.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. Only equal-style
variables can be referenced. See the :doc:`variable <variable>` command
for details. Note that variables of style *equal* define a formula
been previously defined in the input script. Only equal-style or
vector-style variables can be referenced; the latter requires a
bracketed term to specify the Ith element of the vector calculated by
the variable. See the :doc:`variable <variable>` command for details.
Note that variables of style *equal* or *vector* define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
@ -320,9 +324,9 @@ above.
* For *type* = *full*, the Npair = N^2 columns are ordered: C11, C12,
..., C1N, C21, C22, ..., C2N, C31, ..., C3N, ..., CN1, ..., CNN-1,
CNN.
The array values calculated by this fix are treated as "intensive".
If you need to divide them by the number of atoms, you must do this in
a later processing step, e.g. when using them in a
The array values calculated by this fix are treated as intensive. If
you need to divide them by the number of atoms, you must do this in a
later processing step, e.g. when using them in a
:doc:`variable <variable>`.
No parameter of this fix can be used with the *start/stop* keywords of

View File

@ -29,7 +29,8 @@ Syntax
c_ID[I] = Ith component of vector or Ith column of array calculated by a compute with ID
f_ID = scalar or vector calculated by a fix with ID
f_ID[I] = Ith component of vector or Ith column of array calculated by a fix with ID
v_name = value(s) calculated by an equal-style or atom-style variable with name
v_name = value(s) calculated by an equal-style or vector-style or atom-style variable with name
v_name[I] = value calculated by a vector-style variable with name
* zero or more keyword/arg pairs may be appended
* keyword = *mode* or *file* or *ave* or *start* or *beyond* or *overwrite* or *title1* or *title2* or *title3*
@ -93,12 +94,13 @@ different ways; see the discussion of the *beyond* keyword below.
Each input value can be an atom attribute (position, velocity, force
component) or can be the result of a :doc:`compute <compute>` or
:doc:`fix <fix>` or the evaluation of an equal-style or atom-style
:doc:`variable <variable>`. The set of input values can be either all
global, all per-atom, or all local quantities. Inputs of different
kinds (e.g. global and per-atom) cannot be mixed. Atom attributes are
per-atom vector values. See the doc page for individual "compute" and
"fix" commands to see what kinds of quantities they generate.
:doc:`fix <fix>` or the evaluation of an equal-style or vector-style or
atom-style :doc:`variable <variable>`. The set of input values can be
either all global, all per-atom, or all local quantities. Inputs of
different kinds (e.g. global and per-atom) cannot be mixed. Atom
attributes are per-atom vector values. See the doc page for
individual "compute" and "fix" commands to see what kinds of
quantities they generate.
The input values must either be all scalars or all vectors (or
arrays), depending on the setting of the *mode* keyword.
@ -195,10 +197,15 @@ Users can also write code for their own fix styles and :doc:`add them to LAMMPS
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. If *mode* = scalar, then
only equal-style variables can be used, which produce a global value.
If *mode* = vector, then only atom-style variables can be used, which
produce a per-atom vector. See the :doc:`variable <variable>` command
for details. Note that variables of style *equal* and *atom* define a
only equal-style or vector-style variables can be used, which both
produce global values. In this mode, a vector-style variable requires
a bracketed term to specify the Ith element of the vector calculated
by the variable. If *mode* = vector, then only vector-style or
atom-style variables can be used, which produce a global or per-atom
vector respectively. The vector-style variable must be used without a
bracketed term. See the :doc:`variable <variable>` command for details.
Note that variables of style *equal*, *vector*, and *atom* define a
formula which can reference individual atom properties or
thermodynamic keywords, or they can invoke other computes, fixes, or
variables when they are evaluated, so this is a very general means of
@ -325,7 +332,7 @@ divided by the total count (not including missing counts), so that the
values in the 3rd column sum to 1.0.
The vector and array values calculated by this fix are all treated as
"intensive". If this is not the case, e.g. due to histogramming
intensive. If this is not the case, e.g. due to histogramming
per-atom input values, then you will need to account for that when
interpreting the values produced by this fix.

View File

@ -23,7 +23,8 @@ Syntax
c_ID[I] = Ith component of global vector or Ith column of global array calculated by a compute with ID
f_ID = global scalar, vector, or array calculated by a fix with ID
f_ID[I] = Ith component of global vector or Ith column of global array calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
v_name = value(s) calculated by an equal-style or vector-style variable with name
v_name[I] = value calculated by a vector-style variable with name
* zero or more keyword/arg pairs may be appended
* keyword = *mode* or *file* or *ave* or *start* or *off* or *overwrite* or *title1* or *title2* or *title3*
@ -80,7 +81,7 @@ specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
Each listed value can be the result of a :doc:`compute <compute>` or
:doc:`fix <fix>` or the evaluation of an equal-style
:doc:`fix <fix>` or the evaluation of an equal-style or vector-style
:doc:`variable <variable>`. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
@ -92,9 +93,9 @@ per-atom quantity into a single global quantity, see the :doc:`compute reduce <c
do not have the word *atom* in their style name. Only a few
:doc:`fixes <fix>` produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
:doc:`Variables <variable>` of style *equal* are the only ones that can
be used with this fix. Variables of style *atom* cannot be used,
since they produce per-atom values.
:doc:`Variables <variable>` of style *equal* and *vector* are the only
ones that can be used with this fix. Variables of style *atom* cannot
be used, since they produce per-atom values.
The input values must either be all scalars or all vectors (or
arrays), depending on the setting of the *mode* keyword. In both
@ -176,14 +177,19 @@ which must be compatible with *Nevery*, else an error will result.
Users can also write code for their own fix styles and :doc:`add them to LAMMPS <Section_modify>`.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. Variables can only be
used as input for *mode* = scalar. Only equal-style variables can be
referenced. See the :doc:`variable <variable>` command for details.
Note that variables of style *equal* define a formula which can
reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying quantities to
time average.
been previously defined in the input script. If *mode* = scalar, then
only equal-style or vector-style variables can be used, which both
produce global values. In this mode, a vector-style variable requires
a bracketed term to specify the Ith element of the vector calculated
by the variable. If *mode* = vector, then only a vector-style
variable can be used, without a bracketed term. See the
:doc:`variable <variable>` command for details.
Note that variables of style *equal* and *vector* define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to time average.
----------

View File

@ -21,7 +21,8 @@ Syntax
c_ID[I] = Ith component of global vector calculated by a compute with ID
f_ID = global scalar calculated by a fix with ID
f_ID[I] = Ith component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
v_name = value calculated by an equal-style variable with name
v_name[I] = Ith component of vector-style variable with name
@ -60,18 +61,18 @@ specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
Each listed value can be the result of a :doc:`compute <compute>` or
:doc:`fix <fix>` or the evaluation of an equal-style
:doc:`fix <fix>` or the evaluation of an equal-style or vector-style
:doc:`variable <variable>`. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity.
And the global quantity must be a scalar, not a vector or array.
must produce a global quantity, not a per-atom or local quantity. And
the global quantity must be a scalar, not a vector or array.
:doc:`Computes <compute>` that produce global quantities are those which
do not have the word *atom* in their style name. Only a few
:doc:`fixes <fix>` produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
:doc:`Variables <variable>` of style *equal* are the only ones that can
be used with this fix. Variables of style *atom* cannot be used,
since they produce per-atom values.
:doc:`Variables <variable>` of style *equal* or *vector* are the only
ones that can be used with this fix. Variables of style *atom* cannot
be used, since they produce per-atom values.
The *Nevery* argument specifies on what timesteps the input values
will be used in order to be stored. Only timesteps that are a
@ -113,13 +114,15 @@ which must be compatible with *Nevery*, else an error will result.
Users can also write code for their own fix styles and :doc:`add them to LAMMPS <Section_modify>`.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. Only equal-style
variables can be referenced. See the :doc:`variable <variable>` command
for details. Note that variables of style *equal* define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to be stored by fix vector.
been previously defined in the input script. An equal-style or
vector-style variable can be referenced; the latter requires a
bracketed term to use the Ith element of the vector calculated by the
variable. See the :doc:`variable <variable>` command for details. Note
that variables of style *equal* and *vector* define a formula which
can reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying quantities to
be stored by fix vector.
----------

View File

@ -30,7 +30,7 @@ Syntax
cella, cellb, cellc, cellalpha, cellbeta, cellgamma,
c_ID, c_ID[I], c_ID[I][J],
f_ID, f_ID[I], f_ID[I][J],
v_name
v_name, v_name[I]
step = timestep
elapsed = timesteps since start of this run
elaplong = timesteps since start of initial run in a series of runs
@ -78,7 +78,8 @@ Syntax
f_ID = global scalar value calculated by a fix with ID
f_ID[I] = Ith component of global vector calculated by a fix with ID
f_ID[I][J] = I,J component of global array calculated by a fix with ID
v_name = scalar value calculated by an equal-style variable with name
v_name = value calculated by an equal-style variable with name
v_name[I] = value calculated by a vector-style variable with name
@ -348,16 +349,18 @@ option being used.
The *v_name* keyword allow the current value of a variable to be
output. The name in the keyword should be replaced by the variable
name that has been defined elsewhere in the input script. Only
equal-style variables can be referenced. See the
:doc:`variable <variable>` command for details. Variables of style
*equal* can reference per-atom properties or thermodynamic keywords,
or they can invoke other computes, fixes, or variables when evaluated,
so this is a very general means of creating thermodynamic output.
equal-style and vector-style variables can be referenced; the latter
requires a bracketed term to specify the Ith element of the vector
calculated by the variable. See the :doc:`variable <variable>` command
for details. Variables of style *equal* and *vector* define a formula
which can reference per-atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when evaluated, so
this is a very general means of creating thermodynamic output.
Note that equal-style variables are assumed to be "intensive" global
quantities, which are thus printed as-is, without normalization by
thermo_style custom. You can include a division by "natoms" in the
variable formula if this is not the case.
Note that equal-style and vector-style variables are assumed to
produce "intensive" global quantities, which are thus printed as-is,
without normalization by thermo_style custom. You can include a
division by "natoms" in the variable formula if this is not the case.
----------

View File

@ -11,7 +11,7 @@ Syntax
variable name style args ...
* name = name of variable to define
* style = *delete* or *index* or *loop* or *world* or *universe* or *uloop* or *string* or *format* or *getenv* or *file* or *atomfile* or *python* or *equal* or *atom*
* style = *delete* or *index* or *loop* or *world* or *universe* or *uloop* or *string* or *format* or *getenv* or *file* or *atomfile* or *python* or *equal* or *vector* or *atom*
.. parsed-literal::
*delete* = no args
@ -41,7 +41,7 @@ Syntax
*file* arg = filename
*atomfile* arg = filename
*python* arg = function
*equal* or *atom* args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references
*equal* or *vector* or *atom* 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 :doc:`thermo_style <thermo_style>`
@ -67,8 +67,8 @@ Syntax
feature functions = is_active(category,feature,exact), is_defined(category,id,exact)
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
compute references = c_ID, c_ID[i], c_ID[i][j]
fix references = f_ID, f_ID[i], f_ID[i][j]
compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i]
fix references = f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i]
variable references = v_name, v_name[i]
@ -109,15 +109,19 @@ string is assigned to the variable. Variables of style *equal* store
a formula which when evaluated produces a single numeric value which
can be output either directly (see the :doc:`print <print>`, :doc:`fix print <fix_print>`, and :doc:`run every <run>` commands) or as part
of thermodynamic output (see the :doc:`thermo_style <thermo_style>`
command), or used as input to an averaging fix (see the :doc:`fix ave/time <fix_ave_time>` command). Variables of style *atom* store
a formula which when evaluated produces one numeric value per atom
which can be output to a dump file (see the :doc:`dump custom <dump>`
command) or used as input to an averaging fix (see the :doc:`fix ave/spatial <fix_ave_spatial>` and :doc:`fix ave/atom <fix_ave_atom>`
command), or used as input to an averaging fix (see the :doc:`fix ave/time <fix_ave_time>` command). Variables of style *vector*
store a formula which produces a vector of such values which can be
used as input to various averaging fixes, or elements of which can be
part of thermodynamic output. Variables of style *atom* store a
formula which when evaluated produces one numeric value per atom which
can be output to a dump file (see the :doc:`dump custom <dump>` command)
or used as input to an averaging fix (see the :doc:`fix ave/chunk <fix_ave_chunk>` and :doc:`fix ave/atom <fix_ave_atom>`
commands). Variables of style *atomfile* can be used anywhere in an
input script that atom-style variables are used; they get their
per-atom values from a file rather than from a formula. Variables can
be hooked to Python functions using code you provide, so that the
variable gets its value from the evaluation of the Python code.
per-atom values from a file rather than from a formula. Variables of
style *python* can be hooked to Python functions using code you
provide, so that the variable gets its value from the evaluation of
the Python code.
.. note::
@ -143,27 +147,27 @@ simulation.
.. note::
When the input script line is encountered that defines a
variable of style *equal* or *atom* or *python* that contains a
formula or Python code, the formula is NOT immediately evaluated. It
will be evaluated every time when the variable is **used** instead. If
you simply want to evaluate a formula in place you can use as
so-called. See the section below about "Immediate Evaluation of
Variables" for more details on the topic. This is also true of a
*format* style variable since it evaluates another variable when it is
invoked.
variable of style *equal* or *vector* or *atom* or *python* that
contains a formula or Python code, the formula is NOT immediately
evaluated. It will be evaluated every time when the variable is
**used** instead. If you simply want to evaluate a formula in place you
can use as so-called. See the section below about "Immediate
Evaluation of Variables" for more details on the topic. This is also
true of a *format* style variable since it evaluates another variable
when it is invoked.
.. note::
Variables of style *equal* and *atom* can be used as inputs to
various other LAMMPS commands which evaluate their formulas as needed,
e.g. at different timesteps during a :doc:`run <run>`. Variables of
style *python* can be used in place of an equal-style variable so long
as the associated Python function, as defined by the
:doc:`python <python>` command, returns a numeric value. Thus any
command that states it can use an equal-style variable as an argument,
can also use such a python-style variable. This means that when the
LAMMPS command evaluates the variable, the Python function will be
executed.
Variables of style *equal* and *vector* and *atom* can be used
as inputs to various other LAMMPS commands which evaluate their
formulas as needed, e.g. at different timesteps during a
:doc:`run <run>`. Variables of style *python* can be used in place of
an equal-style variable so long as the associated Python function, as
defined by the :doc:`python <python>` command, returns a numeric value.
Thus any command that states it can use an equal-style variable as an
argument, can also use such a python-style variable. This means that
when the LAMMPS command evaluates the variable, the Python function
will be executed.
.. note::
@ -178,12 +182,12 @@ simulation.
script.
There are two exceptions to this rule. First, variables of style
*string*, *getenv*, *equal*, *atom*, and *python* ARE redefined each
time the command is encountered. This allows these style of variables
to be redefined multiple times in an input script. In a loop, this
means the formula associated with an *equal* or *atom* style variable
can change if it contains a substitution for another variable, e.g. $x
or v_x.
*string*, *getenv*, *equal*, *vector*, *atom*, and *python* ARE
redefined each time the command is encountered. This allows these
style of variables to be redefined multiple times in an input script.
In a loop, this means the formula associated with an *equal* or *atom*
style variable can change if it contains a substitution for another
variable, e.g. $x or v_x.
Second, as described below, if a variable is iterated on to the end of
its list of strings via the :doc:`next <next>` command, it is removed
@ -232,8 +236,8 @@ commands before the variable would become exhausted. For example,
This section describes how all the various variable styles are defined
and what they store. Except for the *equal* and *atom* styles,
which are explaine in the next section.
and what they store. Except for the *equal* and *vector* and *atom*
styles, which are explained in the next section.
Many of the styles store one or more strings. Note that a single
string can contain spaces (multiple words), if it is enclosed in
@ -402,31 +406,34 @@ that allows for equal-style variables.
----------
For the *equal* and *atom* styles, a single string is specified which
represents a formula that will be evaluated afresh each time the
variable is used. If you want spaces in the string, enclose it in
double quotes so the parser will treat it as a single argument. For
*equal* style variables the formula computes a scalar quantity, which
becomes the value of the variable whenever it is evaluated. For
*atom* style variables the formula computes one quantity for each
atom whenever it is evaluated.
For the *equal* and *vector* and *atom* styles, a single string is
specified which represents a formula that will be evaluated afresh
each time the variable is used. If you want spaces in the string,
enclose it in double quotes so the parser will treat it as a single
argument. For *equal*-style variables the formula computes a scalar
quantity, which becomes the value of the variable whenever it is
evaluated. For *vector*-style variables the formula computes a vector
of quantities, which becomes the value of the variable whenever it is
evaluated. For *atom*-style variables the formula computes one
quantity for each atom whenever it is evaluated.
Note that *equal* and *atom* variables can produce different values at
different stages of the input script or at different times during a
run. For example, if an *equal* variable is used in a :doc:`fix print <fix_print>` command, different values could be printed each
timestep it was invoked. If you want a variable to be evaluated
immediately, so that the result is stored by the variable instead of
the string, see the section below on "Immediate Evaluation of
Variables".
Note that *equal*, *vector*, and *atom* variables can produce
different values at different stages of the input script or at
different times during a run. For example, if an *equal* variable is
used in a :doc:`fix print <fix_print>` command, different values could
be printed each timestep it was invoked. If you want a variable to be
evaluated immediately, so that the result is stored by the variable
instead of the string, see the section below on "Immediate Evaluation
of Variables".
The next command cannot be used with *equal* or *atom* style
variables, since there is only one string.
The next command cannot be used with *equal* or *vector* or *atom*
style variables, since there is only one string.
The formula for an *equal* or *atom* variable can contain a variety
of quantities. The syntax for each kind of quantity is simple, but
multiple quantities can be nested and combined in various ways to
build up formulas of arbitrary complexity. For example, this is a
valid (though strange) variable formula:
The formula for an *equal*, *vector*, or *atom* variable can contain a
variety of quantities. The syntax for each kind of quantity is
simple, but multiple quantities can be nested and combined in various
ways to build up formulas of arbitrary complexity. For example, this
is a valid (though strange) variable formula:
.. parsed-literal::
@ -460,30 +467,36 @@ references, and references to other variables.
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Atom vectors | id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q |
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Compute references | c_ID, c_ID[i], c_ID[i][j] |
| Compute references | c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i] |
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Fix references | f_ID, f_ID[i], f_ID[i][j] |
| Fix references | f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i] |
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Other variables | v_name, v_name[i] |
+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Most of the formula elements produce a scalar value. A few produce a
per-atom vector of values. These are the atom vectors, compute
references that represent a per-atom vector, fix references that
represent a per-atom vector, and variables that are atom-style
variables. Math functions that operate on scalar values produce a
scalar value; math function that operate on per-atom vectors do so
element-by-element and produce a per-atom vector.
Most of the formula elements produce a scalar value. Some produce a
global or per-atom vector of values. Global vectors can be produced
by computes or fixes or by other vector-style variables. Per-atom
vectors are produced by atom vectors, compute references that
represent a per-atom vector, fix references that represent a per-atom
vector, and variables that are atom-style variables. Math functions
that operate on scalar values produce a scalar value; math function
that operate on global or per-atom vectors do so element-by-element
and produce a global or per-atom vector.
A formula for equal-style variables cannot use any formula element
that produces a per-atom vector. A formula for an atom-style variable
can use formula elements that produce either a scalar value or a
per-atom vector. Atom-style variables are evaluated by other commands
that define a :doc:`group <group>` on which they operate, e.g. a
:doc:`dump <dump>` or :doc:`compute <compute>` or :doc:`fix <fix>` command.
When they invoke the atom-style variable, only atoms in the group are
inlcuded in the formula evaluation. The variable evaluates to 0.0 for
atoms not in the group.
that produces a global or per-atom vector. A formula for a
vector-style variable can use formula elements that produce either a
scalar value or a global vector value, but cannot use a formula
element that produces a per-atom vector. A formula for an atom-style
variable can use formula elements that produce either a scalar value
or a per-atom vector, but not one that produces a global vector.
Atom-style variables are evaluated by other commands that define a
:doc:`group <group>` on which they operate, e.g. a :doc:`dump <dump>` or
:doc:`compute <compute>` or :doc:`fix <fix>` command. When they invoke
the atom-style variable, only atoms in the group are included in the
formula evaluation. The variable evaluates to 0.0 for atoms not in
the group.
----------
@ -583,11 +596,11 @@ Math Functions
Math functions are specified as keywords followed by one or more
parenthesized arguments "x", "y", "z", each of which can themselves be
arbitrarily complex formulas. In this syntax, the arguments can
represent scalar values or per-atom vectors. In the latter case, the
math operation is performed on each element of the vector. For
example, "sqrt(natoms)" is the sqrt() of a scalar, where "sqrt(y*z)"
yields a per-atom vector with each element being the sqrt() of the
product of one atom's y and z coordinates.
represent scalar values or global vectors or per-atom vectors. In the
latter case, the math operation is performed on each element of the
vector. For example, "sqrt(natoms)" is the sqrt() of a scalar, where
"sqrt(y*z)" yields a per-atom vector with each element being the
sqrt() of the product of one atom's y and z coordinates.
Most of the math functions perform obvious operations. The ln() is
the natural log; log() is the base 10 log.
@ -598,20 +611,22 @@ normal(x,y,z) function also takes 3 arguments: x = mu, y = sigma, and
z = seed. It generates a Gaussian variate centered on mu with
variance sigma^2. In both cases the seed is used the first time the
internal random number generator is invoked, to initialize it. For
equal-style variables, every processor uses the same seed so that they
each generate the same sequence of random numbers. For atom-style
variables, a unique seed is created for each processor, based on the
specified seed. This effectively generates a different random number
for each atom being looped over in the atom-style variable.
equal-style and vector-style variables, every processor uses the same
seed so that they each generate the same sequence of random numbers.
For atom-style variables, a unique seed is created for each processor,
based on the specified seed. This effectively generates a different
random number for each atom being looped over in the atom-style
variable.
.. note::
Internally, there is just one random number generator for all
equal-style variables and one for all atom-style variables. If you
define multiple variables (of each style) which use the random() or
normal() math functions, then the internal random number generators
will only be initialized once, which means only one of the specified
seeds will determine the sequence of generated random numbers.
equal-style and vector-style variables and another one for all
atom-style variables. If you define multiple variables (of each
style) which use the random() or normal() math functions, then the
internal random number generators will only be initialized once, which
means only one of the specified seeds will determine the sequence of
generated random numbers.
The ceil(), floor(), and round() functions are those in the C math
library. Ceil() is the smallest integer not less than its argument.
@ -785,19 +800,21 @@ arguments cannot be formulas themselves.
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.
"f_ID" or "f_ID[N]" or "v_name". 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. The last form of argument "v_name"
is for a vector-style variable where "name" is replaced by the name of
the variable.
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
:doc:`compute reduce <compute_reduce>` command, which invokes the same
functions on per-atom and local vectors.
These functions operate on a global vector of inputs and reduce it to
a single scalar value. This is analagous to the operation of the
:doc:`compute reduce <compute_reduce>` command, which performs similar
operations on per-atom and local vectors.
The sum() function calculates the sum of all the vector elements. The
min() and max() functions find the minimum and maximum element
@ -935,13 +952,13 @@ Atom values take an integer argument I from 1 to N, where I is the
atom-ID, e.g. x[243], which means use the x coordinate of the atom
with ID = 243. Or they can take a variable name, specified as v_name,
where name is the name of the variable, like x[v_myIndex]. The
variable can be of any style except atom or atom-file variables. The
variable is evaluated and the result is expected to be numeric and is
cast to an integer (i.e. 3.4 becomes 3), to use an an index, which
must be a value from 1 to N. Note that a "formula" cannot be used as
the argument between the brackets, e.g. x[243+10] or
x[v_myIndex+1] are not allowed. To do this a single variable can be
defined that contains the needed formula.
variable can be of any style except *vector* or *atom* or *atomfile*
variables. The variable is evaluated and the result is expected to be
numeric and is cast to an integer (i.e. 3.4 becomes 3), to use an an
index, which must be a value from 1 to N. Note that a "formula"
cannot be used as the argument between the brackets, e.g. x[243+10]
or x[v_myIndex+1] are not allowed. To do this a single variable can
be defined that contains the needed formula.
Note that the 0 < atom-ID <= N, where N is the largest atom ID
in the system. If an ID is specified for an atom that does not
@ -952,7 +969,7 @@ Atom vectors generate one value per atom, so that a reference like
evaluating the variable.
The meaning of the different atom values and vectors is mostly
self-explanatory. Mol refers to the molecule ID of an atom, and is
self-explanatory. *Mol* refers to the molecule ID of an atom, and is
only defined if an :doc:`atom_style <atom_style>` is being used that
defines molecule IDs.
@ -973,17 +990,21 @@ the ID of a compute defined elsewhere in the input script. As
discussed in the doc page for the :doc:`compute <compute>` command,
computes can produce global, per-atom, or local values. Only global
and per-atom values can be used in a variable. Computes can also
produce a scalar, vector, or array. An equal-style variable can only
use scalar values, which means a global scalar, or an element of a
global or per-atom vector or array. Atom-style variables can use the
same scalar values. They can also use per-atom vector values. A
vector value can be a per-atom vector itself, or a column of an
per-atom array. See the doc pages for individual computes to see what
kind of values they produce.
produce a scalar, vector, or array.
An equal-style variable can only use scalar values, which means a
global scalar, or an element of a global or per-atom vector or array.
A vector-style variable can use scalar values or a global vector of
values, or a column of a global array of values, Atom-style variables
can use global scalar values. They can also use per-atom vector
values. A vector value can be a per-atom vector itself, or a column
of a per-atom array. See the doc pages for individual computes to see
what kind of values they produce.
Examples of different kinds of compute references are as follows.
There is no ambiguity as to what a reference means, since computes
only produce global or per-atom quantities, never both.
There is typically no ambiguity (see exception below) as to what a
reference means, since computes only produce either global or per-atom
quantities, never both.
+------------+-------------------------------------------------------------------------------------------------------+
| c_ID | global scalar, or per-atom vector |
@ -993,14 +1014,33 @@ only produce global or per-atom quantities, never both.
| c_ID[I][J] | I,J element of global array, or atom I's Jth value in per-atom array |
+------------+-------------------------------------------------------------------------------------------------------+
For I and J, integers can be specified or a variable name, specified
as v_name, where name is the name of the variable. The rules for this
syntax are the same as for the "Atom Values and Vectors" discussion
above.
For I and J indices, integers can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the "Atom Values and
Vectors" discussion above.
If a variable containing a compute is evaluated directly in an input
script (not during a run), then the values accessed by the compute
must be current. See the discussion below about "Variable Accuracy".
One source of ambiguity for compute references is when a vector-style
variable refers to a compute that produces both a global scalar and a
global vector. Consider a compute with ID "foo" that does this,
referenced as follows by variable "a", where "myVec" is another
vector-style variable:
.. parsed-literal::
variable a vector c_foo*v_myVec
The reference "c_foo" could refer to either the global scalar or
global vector produced by compute "foo". In this case, "c_foo" will
always refer to the global scalar, and "C_foo" can be used to
reference the global vector. Similarly if the compute produces both a
global vector and global array, then "c_foo[I]" will always refer to
an element of the global vector, and "C_foo[I]" can be used to
reference the Ith column of the global array.
Note that if a variable containing a compute is evaluated directly in
an input script (not during a run), then the values accessed by the
compute must be current. See the discussion below about "Variable
Accuracy".
----------
@ -1024,8 +1064,9 @@ to see what kind of values they produce.
The different kinds of fix references are exactly the same as the
compute references listed in the above table, where "c_" is replaced
by "f_". Again, there is no ambiguity as to what a reference means,
since fixes only produce global or per-atom quantities, never both.
by "f_". Again, there is typically no ambiguity (see exception below)
as to what a reference means, since fixes only produce either global
or per-atom quantities, never both.
+------------+-------------------------------------------------------------------------------------------------------+
| f_ID | global scalar, or per-atom vector |
@ -1035,14 +1076,24 @@ since fixes only produce global or per-atom quantities, never both.
| f_ID[I][J] | I,J element of global array, or atom I's Jth value in per-atom array |
+------------+-------------------------------------------------------------------------------------------------------+
For I and J, integers can be specified or a variable name, specified
as v_name, where name is the name of the variable. The rules for this
syntax are the same as for the "Atom Values and Vectors" discussion
above.
For I and J indices, integers can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the "Atom Values and
Vectors" discussion above.
If a variable containing a fix is evaluated directly in an input
script (not during a run), then the values accessed by the fix should
be current. See the discussion below about "Variable Accuracy".
One source of ambiguity for fix references is the same ambiguity
discussed for compute references above. Namely when a vector-style
variable refers to a fix that produces both a global scalar and a
global vector. The solution is the same as for compute references.
For a fix with ID "foo", "f_foo" will always refer to the global
scalar, and "F_foo" can be used to reference the global vector. And
similarly for distinguishing between a fix's global vector versus
global array with "f_foo[I]" versus "F_foo[I]".
Note that if a variable containing a fix is evaluated directly in an
input script (not during a run), then the values accessed by the fix
should be current. See the discussion below about "Variable
Accuracy".
Note that some fixes only generate quantities on certain timesteps.
If a variable attempts to access the fix on non-allowed timesteps, an
@ -1062,32 +1113,47 @@ variables, which will cause those variables to be evaluated. The name
in the reference should be replaced by the name of a variable defined
elsewhere in the input script.
As discussed on this doc page, equal-style variables generate a global
scalar numeric value; atom-style and atomfile-style variables generate
a per-atom vector of numeric values; all other variables store a
string. The formula for an equal-style variable can use any style of
variable except an atom-style or atomfile-style (unless only a single
value from the variable is accessed via a subscript). If a
string-storing variable is used, the string is converted to a numeric
value. Note that this will typically produce a 0.0 if the string is
not a numeric string, which is likely not what you want. The formula
for an atom-style variable can use any style of variable, including
other atom-style or atomfile-style variables.
As discussed on this doc page, equal-style variables generate a single
global numeric value, vector-style variables gerarate a vector of
global numeric values, and atom-style and atomfile-style variables
generate a per-atom vector of numeric values. All other variables
store one or more strings. A vector-style variable can be referenced
wtih a
The formula for an equal-style variable can use any style of variable
including a vector_style or atom-style or atomfile-style. In these
latter cases, a subscript must be used to access a single value from
the vector-, atom-, or atomfile-style variable. If a string-storing
variable is used, the string is converted to a numeric value. Note
that this will typically produce a 0.0 if the string is not a numeric
string, which is likely not what you want.
The formula for an atom-style variable can use any style of variable,
including other atom-style or atomfile-style variables.
The formula for an atom-style variable can use any style of variable,
including other atom-style or atomfile-style variables.
Examples of different kinds of variable references are as follows.
There is no ambiguity as to what a reference means, since variables
produce only a global scalar or a per-atom vector, never both.
produce only a global scalar or global vector or per-atom vector.
+-----------+-----------------------------------+
| v_name | scalar, or per-atom vector |
+-----------+-----------------------------------+
| v_name[I] | atom I's value in per-atom vector |
+-----------+-----------------------------------+
+-----------+----------------------------------------------------------------------+
| v_name | global scalar from equal-style variable |
+-----------+----------------------------------------------------------------------+
| v_name | global vector from vector-style variable |
+-----------+----------------------------------------------------------------------+
| v_name | per-atom vector from atom-style or atomfile-style variable |
+-----------+----------------------------------------------------------------------+
| v_name[I] | Ith element of a global vector from vector-style variable |
+-----------+----------------------------------------------------------------------+
| v_name[I] | value of atom with ID = I from atom-style or atomfile-style variable |
+-----------+----------------------------------------------------------------------+
For I, an integer can be specified or a variable name, specified as
v_name, where name is the name of the variable. The rules for this
syntax are the same as for the "Atom Values and Vectors" discussion
above.
For the I index, an integer can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the "Atom Values and
Vectors" discussion above.
----------
@ -1308,9 +1374,10 @@ Restrictions
Indexing any formula element by global atom ID, such as an atom value,
requires the atom style to use a global mapping in order to look up
the vector indices. By default, only atom styles with molecular
information create global maps. The :doc:`atom_modify map <atom_modify>` command can override the default.
requires the :doc:`atom style <atom_style>` to use a global mapping in
order to look up the vector indices. By default, only atom styles
with molecular information create global maps. The :doc:`atom_modify map <atom_modify>` command can override the default, e.g. for
atomic-style atom styles.
All *universe*- and *uloop*-style variables defined in an input script
must have the same number of values.

View File

@ -143,13 +143,14 @@
c_ID[I] = Ith column of global array calculated by a compute with ID
f_ID = global vector calculated by a fix with ID
f_ID[I] = Ith column of global array calculated by a fix with ID
v_name = vector calculated by an vector-style variable with name
</pre></div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-python"><div class="highlight"><pre>compute 1 all slice 1 100 10 c_msdmol[4]
compute 1 all slice 301 400 1 c_msdmol[4]
compute 1 all slice 301 400 1 c_msdmol[4] v_myVec
</pre></div>
</div>
</div>
@ -158,9 +159,9 @@ compute 1 all slice 301 400 1 c_msdmol[4]
<p>Define a calculation that &#8220;slices&#8221; one or more vector inputs into
smaller vectors, one per listed input. The inputs can be global
quantities; they cannot be per-atom or local quantities.
<a class="reference internal" href="compute.html"><em>Computes</em></a> and <a class="reference internal" href="fix.html"><em>fixes</em></a> may generate any of the
three kinds of quantities. <a class="reference internal" href="variable.html"><em>Variables</em></a> do not generate
global vectors. The group specified with this command is ignored.</p>
<a class="reference internal" href="compute.html"><em>Computes</em></a> and <a class="reference internal" href="fix.html"><em>fixes</em></a> and vector-style
<a class="reference internal" href="variable.html"><em>variables</em></a> can generate such global quantities. The
group specified with this command is ignored.</p>
<p>The values extracted from the input vector(s) are determined by the
<em>Nstart</em>, <em>Nstop</em>, and <em>Nskip</em> parameters. The elements of an input
vector of length N are indexed from 1 to N. Starting at element
@ -187,6 +188,14 @@ the values, else an error results. If no bracketed integer is
appended, the vector calculated by the fix is used. If a bracketed
integer is appended, the Ith column of the array calculated by the fix
is used. Users can also write code for their own fix style and <a class="reference internal" href="Section_modify.html"><em>add them to LAMMPS</em></a>.</p>
<p>If an input value begins with &#8220;<a href="#id5"><span class="problematic" id="id6">v_</span></a>&#8221;, a variable name must follow which
has been previously defined in the input script. Only vector-style
variables can be referenced. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command
for details. Note that variables of style <em>vector</em> define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to slice.</p>
<p>If a single input is specified this compute produces a global vector,
even if the length of the vector is 1. If multiple inputs are
specified, then a global array of values is produced, with the number
@ -201,15 +210,16 @@ These values can be used by any command that uses global vector or
array values from a compute as input. See <a class="reference internal" href="Section_howto.html#howto-15"><span>this section</span></a> for an overview of LAMMPS output
options.</p>
<p>The vector or array values calculated by this compute are simply
copies of values generated by computes or fixes that are input vectors
to this compute. If there is a single input vector of intensive
and/or extensive values, then each value in the vector of values
calculated by this compute will be &#8220;intensive&#8221; or &#8220;extensive&#8221;,
copies of values generated by computes or fixes or variables that are
input vectors to this compute. If there is a single input vector of
intensive and/or extensive values, then each value in the vector of
values calculated by this compute will be &#8220;intensive&#8221; or &#8220;extensive&#8221;,
depending on the corresponding input value. If there are multiple
input vectors, and all the values in them are intensive, then the
array values calculated by this compute are &#8220;intensive&#8221;. If there are
multiple input vectors, and any value in them is extensive, then the
array values calculated by this compute are &#8220;extensive&#8221;.</p>
array values calculated by this compute are &#8220;extensive&#8221;. Values
produced by a variable are treated as intensive.</p>
<p>The vector or array values will be in whatever <a class="reference internal" href="units.html"><em>units</em></a> the
input quantities are in.</p>
</div>

View File

@ -21,22 +21,23 @@ input = c_ID, c_ID\[N\], f_ID, f_ID\[N\] :l
c_ID = global vector calculated by a compute with ID
c_ID\[I\] = Ith column of global array calculated by a compute with ID
f_ID = global vector calculated by a fix with ID
f_ID\[I\] = Ith column of global array calculated by a fix with ID :pre
f_ID\[I\] = Ith column of global array calculated by a fix with ID
v_name = vector calculated by an vector-style variable with name :pre
:ule
[Examples:]
compute 1 all slice 1 100 10 c_msdmol\[4\]
compute 1 all slice 301 400 1 c_msdmol\[4\] :pre
compute 1 all slice 301 400 1 c_msdmol\[4\] v_myVec :pre
[Description:]
Define a calculation that "slices" one or more vector inputs into
smaller vectors, one per listed input. The inputs can be global
quantities; they cannot be per-atom or local quantities.
"Computes"_compute.html and "fixes"_fix.html may generate any of the
three kinds of quantities. "Variables"_variable.html do not generate
global vectors. The group specified with this command is ignored.
"Computes"_compute.html and "fixes"_fix.html and vector-style
"variables"_variable.html can generate such global quantities. The
group specified with this command is ignored.
The values extracted from the input vector(s) are determined by the
{Nstart}, {Nstop}, and {Nskip} parameters. The elements of an input
@ -70,6 +71,15 @@ integer is appended, the Ith column of the array calculated by the fix
is used. Users can also write code for their own fix style and "add
them to LAMMPS"_Section_modify.html.
If an input value begins with "v_", a variable name must follow which
has been previously defined in the input script. Only vector-style
variables can be referenced. See the "variable"_variable.html command
for details. Note that variables of style {vector} define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to slice.
If a single input is specified this compute produces a global vector,
even if the length of the vector is 1. If multiple inputs are
specified, then a global array of values is produced, with the number
@ -89,15 +99,16 @@ section"_Section_howto.html#howto_15 for an overview of LAMMPS output
options.
The vector or array values calculated by this compute are simply
copies of values generated by computes or fixes that are input vectors
to this compute. If there is a single input vector of intensive
and/or extensive values, then each value in the vector of values
calculated by this compute will be "intensive" or "extensive",
copies of values generated by computes or fixes or variables that are
input vectors to this compute. If there is a single input vector of
intensive and/or extensive values, then each value in the vector of
values calculated by this compute will be "intensive" or "extensive",
depending on the corresponding input value. If there are multiple
input vectors, and all the values in them are intensive, then the
array values calculated by this compute are "intensive". If there are
multiple input vectors, and any value in them is extensive, then the
array values calculated by this compute are "extensive".
array values calculated by this compute are "extensive". Values
produced by a variable are treated as intensive.
The vector or array values will be in whatever "units"_units.html the
input quantities are in.

View File

@ -145,6 +145,7 @@ c_ID[I] = Ith component of global vector calculated by a compute with ID
f_ID = global scalar calculated by a fix with ID
f_ID[I] = Ith component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
v_name[I] = Ith component of a vector-style variable with name
</pre></div>
</div>
<ul class="simple">
@ -200,20 +201,21 @@ very long time windows.</p>
specified values may represent calculations performed by computes and
fixes which store their own &#8220;group&#8221; definitions.</p>
<p>Each listed value can be the result of a <a class="reference internal" href="compute.html"><em>compute</em></a> or
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style or vector-style
<a class="reference internal" href="variable.html"><em>variable</em></a>. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
from a compute, fix, or variable, then see the <a class="reference internal" href="fix_ave_spatial.html"><em>fix ave/spatial</em></a>, <a class="reference internal" href="fix_ave_atom.html"><em>fix ave/atom</em></a>,
or <a class="reference internal" href="fix_ave_histo.html"><em>fix ave/histo</em></a> commands. If you wish to sum a
per-atom quantity into a single global quantity, see the <a class="reference internal" href="compute_reduce.html"><em>compute reduce</em></a> command.</p>
or <a class="reference internal" href="fix_ave_histo.html"><em>fix ave/histo</em></a> commands. If you wish to
convert a per-atom quantity into a single global value, see the
<a class="reference internal" href="compute_reduce.html"><em>compute reduce</em></a> command.</p>
<p><a class="reference internal" href="compute.html"><em>Computes</em></a> that produce global quantities are those which
do not have the word <em>atom</em> in their style name. Only a few
<a class="reference internal" href="fix.html"><em>fixes</em></a> produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
<a class="reference internal" href="variable.html"><em>Variables</em></a> of style <em>equal</em> are the only ones that can
be used with this fix. Variables of style <em>atom</em> cannot be used,
since they produce per-atom values.</p>
<a class="reference internal" href="variable.html"><em>Variables</em></a> of style <em>equal</em> and <em>vector</em> are the only
ones that can be used with this fix. Variables of style <em>atom</em> cannot
be used, since they produce per-atom values.</p>
<p>The input values must either be all scalars. What kinds of
correlations between input values are calculated is determined by the
<em>type</em> keyword as discussed below.</p>
@ -271,9 +273,11 @@ calculated by the fix is used.</p>
which must be compatible with <em>Nevery</em>, else an error will result.
Users can also write code for their own fix styles and <a class="reference internal" href="Section_modify.html"><em>add them to LAMMPS</em></a>.</p>
<p>If a value begins with &#8220;<a href="#id7"><span class="problematic" id="id8">v_</span></a>&#8221;, a variable name must follow which has
been previously defined in the input script. Only equal-style
variables can be referenced. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command
for details. Note that variables of style <em>equal</em> define a formula
been previously defined in the input script. Only equal-style or
vector-style variables can be referenced; the latter requires a
bracketed term to specify the Ith element of the vector calculated by
the variable. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command for details.
Note that variables of style <em>equal</em> or <em>vector</em> define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
@ -395,9 +399,9 @@ CNN.</li>
..., C1N, C21, C22, ..., C2N, C31, ..., C3N, ..., CN1, ..., CNN-1,
CNN.</li>
</ul>
<p>The array values calculated by this fix are treated as &#8220;intensive&#8221;.
If you need to divide them by the number of atoms, you must do this in
a later processing step, e.g. when using them in a
<p>The array values calculated by this fix are treated as intensive. If
you need to divide them by the number of atoms, you must do this in a
later processing step, e.g. when using them in a
<a class="reference internal" href="variable.html"><em>variable</em></a>.</p>
<p>No parameter of this fix can be used with the <em>start/stop</em> keywords of
the <a class="reference internal" href="run.html"><em>run</em></a> command. This fix is not invoked during <a class="reference internal" href="minimize.html"><em>energy minimization</em></a>.</p>

View File

@ -23,7 +23,8 @@ value = c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l
c_ID\[I\] = Ith component of global vector calculated by a compute with ID
f_ID = global scalar calculated by a fix with ID
f_ID\[I\] = Ith component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name :pre
v_name = global value calculated by an equal-style variable with name
v_name\[I\] = Ith component of a vector-style variable with name :pre
zero or more keyword/arg pairs may be appended :l
keyword = {type} or {ave} or {start} or {prefactor} or {file} or {overwrite} or {title1} or {title2} or {title3} :l
@ -77,23 +78,23 @@ specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
Each listed value can be the result of a "compute"_compute.html or
"fix"_fix.html or the evaluation of an equal-style
"fix"_fix.html or the evaluation of an equal-style or vector-style
"variable"_variable.html. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
from a compute, fix, or variable, then see the "fix
ave/spatial"_fix_ave_spatial.html, "fix ave/atom"_fix_ave_atom.html,
or "fix ave/histo"_fix_ave_histo.html commands. If you wish to sum a
per-atom quantity into a single global quantity, see the "compute
reduce"_compute_reduce.html command.
or "fix ave/histo"_fix_ave_histo.html commands. If you wish to
convert a per-atom quantity into a single global value, see the
"compute reduce"_compute_reduce.html command.
"Computes"_compute.html that produce global quantities are those which
do not have the word {atom} in their style name. Only a few
"fixes"_fix.html produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
"Variables"_variable.html of style {equal} are the only ones that can
be used with this fix. Variables of style {atom} cannot be used,
since they produce per-atom values.
"Variables"_variable.html of style {equal} and {vector} are the only
ones that can be used with this fix. Variables of style {atom} cannot
be used, since they produce per-atom values.
The input values must either be all scalars. What kinds of
correlations between input values are calculated is determined by the
@ -164,9 +165,11 @@ Users can also write code for their own fix styles and "add them to
LAMMPS"_Section_modify.html.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. Only equal-style
variables can be referenced. See the "variable"_variable.html command
for details. Note that variables of style {equal} define a formula
been previously defined in the input script. Only equal-style or
vector-style variables can be referenced; the latter requires a
bracketed term to specify the Ith element of the vector calculated by
the variable. See the "variable"_variable.html command for details.
Note that variables of style {equal} or {vector} define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
@ -314,9 +317,9 @@ For {type} = {full}, the Npair = N^2 columns are ordered: C11, C12,
..., C1N, C21, C22, ..., C2N, C31, ..., C3N, ..., CN1, ..., CNN-1,
CNN. :l,ule
The array values calculated by this fix are treated as "intensive".
If you need to divide them by the number of atoms, you must do this in
a later processing step, e.g. when using them in a
The array values calculated by this fix are treated as intensive. If
you need to divide them by the number of atoms, you must do this in a
later processing step, e.g. when using them in a
"variable"_variable.html.
No parameter of this fix can be used with the {start/stop} keywords of

View File

@ -150,7 +150,8 @@ c_ID = scalar or vector calculated by a compute with ID
c_ID[I] = Ith component of vector or Ith column of array calculated by a compute with ID
f_ID = scalar or vector calculated by a fix with ID
f_ID[I] = Ith component of vector or Ith column of array calculated by a fix with ID
v_name = value(s) calculated by an equal-style or atom-style variable with name
v_name = value(s) calculated by an equal-style or vector-style or atom-style variable with name
v_name[I] = value calculated by a vector-style variable with name
</pre></div>
</div>
<ul class="simple">
@ -210,12 +211,13 @@ and <em>hi</em>. Values that fall outside the lo/hi bounds can be treated in
different ways; see the discussion of the <em>beyond</em> keyword below.</p>
<p>Each input value can be an atom attribute (position, velocity, force
component) or can be the result of a <a class="reference internal" href="compute.html"><em>compute</em></a> or
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style or atom-style
<a class="reference internal" href="variable.html"><em>variable</em></a>. The set of input values can be either all
global, all per-atom, or all local quantities. Inputs of different
kinds (e.g. global and per-atom) cannot be mixed. Atom attributes are
per-atom vector values. See the doc page for individual &#8220;compute&#8221; and
&#8220;fix&#8221; commands to see what kinds of quantities they generate.</p>
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style or vector-style or
atom-style <a class="reference internal" href="variable.html"><em>variable</em></a>. The set of input values can be
either all global, all per-atom, or all local quantities. Inputs of
different kinds (e.g. global and per-atom) cannot be mixed. Atom
attributes are per-atom vector values. See the doc page for
individual &#8220;compute&#8221; and &#8220;fix&#8221; commands to see what kinds of
quantities they generate.</p>
<p>The input values must either be all scalars or all vectors (or
arrays), depending on the setting of the <em>mode</em> keyword.</p>
<p>Note that the output of this command is a single histogram for all
@ -293,10 +295,14 @@ which must be compatible with <em>Nevery</em>, else an error will result.
Users can also write code for their own fix styles and <a class="reference internal" href="Section_modify.html"><em>add them to LAMMPS</em></a>.</p>
<p>If a value begins with &#8220;<a href="#id5"><span class="problematic" id="id6">v_</span></a>&#8221;, a variable name must follow which has
been previously defined in the input script. If <em>mode</em> = scalar, then
only equal-style variables can be used, which produce a global value.
If <em>mode</em> = vector, then only atom-style variables can be used, which
produce a per-atom vector. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command
for details. Note that variables of style <em>equal</em> and <em>atom</em> define a
only equal-style or vector-style variables can be used, which both
produce global values. In this mode, a vector-style variable requires
a bracketed term to specify the Ith element of the vector calculated
by the variable. If <em>mode</em> = vector, then only vector-style or
atom-style variables can be used, which produce a global or per-atom
vector respectively. The vector-style variable must be used without a
bracketed term. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command for details.</p>
<p>Note that variables of style <em>equal</em>, <em>vector</em>, and <em>atom</em> define a
formula which can reference individual atom properties or
thermodynamic keywords, or they can invoke other computes, fixes, or
variables when they are evaluated, so this is a very general means of
@ -400,7 +406,7 @@ values in that histogram bin, and the 3rd column has the bin count
divided by the total count (not including missing counts), so that the
values in the 3rd column sum to 1.0.</p>
<p>The vector and array values calculated by this fix are all treated as
&#8220;intensive&#8221;. If this is not the case, e.g. due to histogramming
intensive. If this is not the case, e.g. due to histogramming
per-atom input values, then you will need to account for that when
interpreting the values produced by this fix.</p>
<p>No parameter of this fix can be used with the <em>start/stop</em> keywords of

View File

@ -27,7 +27,8 @@ value = x, y, z, vx, vy, vz, fx, fy, fz, c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_nam
c_ID\[I\] = Ith component of vector or Ith column of array calculated by a compute with ID
f_ID = scalar or vector calculated by a fix with ID
f_ID\[I\] = Ith component of vector or Ith column of array calculated by a fix with ID
v_name = value(s) calculated by an equal-style or atom-style variable with name :pre
v_name = value(s) calculated by an equal-style or vector-style or atom-style variable with name
v_name\[I\] = value calculated by a vector-style variable with name :pre
zero or more keyword/arg pairs may be appended :l
keyword = {mode} or {file} or {ave} or {start} or {beyond} or {overwrite} or {title1} or {title2} or {title3} :l
@ -85,12 +86,13 @@ different ways; see the discussion of the {beyond} keyword below.
Each input value can be an atom attribute (position, velocity, force
component) or can be the result of a "compute"_compute.html or
"fix"_fix.html or the evaluation of an equal-style or atom-style
"variable"_variable.html. The set of input values can be either all
global, all per-atom, or all local quantities. Inputs of different
kinds (e.g. global and per-atom) cannot be mixed. Atom attributes are
per-atom vector values. See the doc page for individual "compute" and
"fix" commands to see what kinds of quantities they generate.
"fix"_fix.html or the evaluation of an equal-style or vector-style or
atom-style "variable"_variable.html. The set of input values can be
either all global, all per-atom, or all local quantities. Inputs of
different kinds (e.g. global and per-atom) cannot be mixed. Atom
attributes are per-atom vector values. See the doc page for
individual "compute" and "fix" commands to see what kinds of
quantities they generate.
The input values must either be all scalars or all vectors (or
arrays), depending on the setting of the {mode} keyword.
@ -187,10 +189,15 @@ LAMMPS"_Section_modify.html.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. If {mode} = scalar, then
only equal-style variables can be used, which produce a global value.
If {mode} = vector, then only atom-style variables can be used, which
produce a per-atom vector. See the "variable"_variable.html command
for details. Note that variables of style {equal} and {atom} define a
only equal-style or vector-style variables can be used, which both
produce global values. In this mode, a vector-style variable requires
a bracketed term to specify the Ith element of the vector calculated
by the variable. If {mode} = vector, then only vector-style or
atom-style variables can be used, which produce a global or per-atom
vector respectively. The vector-style variable must be used without a
bracketed term. See the "variable"_variable.html command for details.
Note that variables of style {equal}, {vector}, and {atom} define a
formula which can reference individual atom properties or
thermodynamic keywords, or they can invoke other computes, fixes, or
variables when they are evaluated, so this is a very general means of
@ -311,7 +318,7 @@ divided by the total count (not including missing counts), so that the
values in the 3rd column sum to 1.0.
The vector and array values calculated by this fix are all treated as
"intensive". If this is not the case, e.g. due to histogramming
intensive. If this is not the case, e.g. due to histogramming
per-atom input values, then you will need to account for that when
interpreting the values produced by this fix.

View File

@ -144,7 +144,8 @@
c_ID[I] = Ith component of global vector or Ith column of global array calculated by a compute with ID
f_ID = global scalar, vector, or array calculated by a fix with ID
f_ID[I] = Ith component of global vector or Ith column of global array calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
v_name = value(s) calculated by an equal-style or vector-style variable with name
v_name[I] = value calculated by a vector-style variable with name
</pre></div>
</div>
<ul class="simple">
@ -198,7 +199,7 @@ a file.</p>
specified values may represent calculations performed by computes and
fixes which store their own &#8220;group&#8221; definitions.</p>
<p>Each listed value can be the result of a <a class="reference internal" href="compute.html"><em>compute</em></a> or
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style or vector-style
<a class="reference internal" href="variable.html"><em>variable</em></a>. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
@ -209,9 +210,9 @@ per-atom quantity into a single global quantity, see the <a class="reference int
do not have the word <em>atom</em> in their style name. Only a few
<a class="reference internal" href="fix.html"><em>fixes</em></a> produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
<a class="reference internal" href="variable.html"><em>Variables</em></a> of style <em>equal</em> are the only ones that can
be used with this fix. Variables of style <em>atom</em> cannot be used,
since they produce per-atom values.</p>
<a class="reference internal" href="variable.html"><em>Variables</em></a> of style <em>equal</em> and <em>vector</em> are the only
ones that can be used with this fix. Variables of style <em>atom</em> cannot
be used, since they produce per-atom values.</p>
<p>The input values must either be all scalars or all vectors (or
arrays), depending on the setting of the <em>mode</em> keyword. In both
cases, the averaging is performed independently on each input value.
@ -277,14 +278,18 @@ Ith column of the global array calculated by the fix is used.</p>
which must be compatible with <em>Nevery</em>, else an error will result.
Users can also write code for their own fix styles and <a class="reference internal" href="Section_modify.html"><em>add them to LAMMPS</em></a>.</p>
<p>If a value begins with &#8220;<a href="#id5"><span class="problematic" id="id6">v_</span></a>&#8221;, a variable name must follow which has
been previously defined in the input script. Variables can only be
used as input for <em>mode</em> = scalar. Only equal-style variables can be
referenced. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command for details.
Note that variables of style <em>equal</em> define a formula which can
reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying quantities to
time average.</p>
been previously defined in the input script. If <em>mode</em> = scalar, then
only equal-style or vector-style variables can be used, which both
produce global values. In this mode, a vector-style variable requires
a bracketed term to specify the Ith element of the vector calculated
by the variable. If <em>mode</em> = vector, then only a vector-style
variable can be used, without a bracketed term. See the
<a class="reference internal" href="variable.html"><em>variable</em></a> command for details.</p>
<p>Note that variables of style <em>equal</em> and <em>vector</em> define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to time average.</p>
<hr class="docutils" />
<p>Additional optional keywords also affect the operation of this fix.</p>
<p>If the <em>mode</em> keyword is set to <em>scalar</em>, then all input values must

View File

@ -23,7 +23,8 @@ value = c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l
c_ID\[I\] = Ith component of global vector or Ith column of global array calculated by a compute with ID
f_ID = global scalar, vector, or array calculated by a fix with ID
f_ID\[I\] = Ith component of global vector or Ith column of global array calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name :pre
v_name = value(s) calculated by an equal-style or vector-style variable with name
v_name\[I\] = value calculated by a vector-style variable with name :pre
zero or more keyword/arg pairs may be appended :l
keyword = {mode} or {file} or {ave} or {start} or {off} or {overwrite} or {title1} or {title2} or {title3} :l
@ -73,7 +74,7 @@ specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
Each listed value can be the result of a "compute"_compute.html or
"fix"_fix.html or the evaluation of an equal-style
"fix"_fix.html or the evaluation of an equal-style or vector-style
"variable"_variable.html. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity. If
you wish to spatial- or time-average or histogram per-atom quantities
@ -87,9 +88,9 @@ reduce"_compute_reduce.html command.
do not have the word {atom} in their style name. Only a few
"fixes"_fix.html produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
"Variables"_variable.html of style {equal} are the only ones that can
be used with this fix. Variables of style {atom} cannot be used,
since they produce per-atom values.
"Variables"_variable.html of style {equal} and {vector} are the only
ones that can be used with this fix. Variables of style {atom} cannot
be used, since they produce per-atom values.
The input values must either be all scalars or all vectors (or
arrays), depending on the setting of the {mode} keyword. In both
@ -169,14 +170,19 @@ Users can also write code for their own fix styles and "add them to
LAMMPS"_Section_modify.html.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. Variables can only be
used as input for {mode} = scalar. Only equal-style variables can be
referenced. See the "variable"_variable.html command for details.
Note that variables of style {equal} define a formula which can
reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying quantities to
time average.
been previously defined in the input script. If {mode} = scalar, then
only equal-style or vector-style variables can be used, which both
produce global values. In this mode, a vector-style variable requires
a bracketed term to specify the Ith element of the vector calculated
by the variable. If {mode} = vector, then only a vector-style
variable can be used, without a bracketed term. See the
"variable"_variable.html command for details.
Note that variables of style {equal} and {vector} define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to time average.
:line

View File

@ -142,7 +142,8 @@
c_ID[I] = Ith component of global vector calculated by a compute with ID
f_ID = global scalar calculated by a fix with ID
f_ID[I] = Ith component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
v_name = value calculated by an equal-style variable with name
v_name[I] = Ith component of vector-style variable with name
</pre></div>
</div>
</div>
@ -175,17 +176,17 @@ thermo_style custom step v_diff
specified values may represent calculations performed by computes and
fixes which store their own &#8220;group&#8221; definitions.</p>
<p>Each listed value can be the result of a <a class="reference internal" href="compute.html"><em>compute</em></a> or
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style
<a class="reference internal" href="fix.html"><em>fix</em></a> or the evaluation of an equal-style or vector-style
<a class="reference internal" href="variable.html"><em>variable</em></a>. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity.
And the global quantity must be a scalar, not a vector or array.</p>
must produce a global quantity, not a per-atom or local quantity. And
the global quantity must be a scalar, not a vector or array.</p>
<p><a class="reference internal" href="compute.html"><em>Computes</em></a> that produce global quantities are those which
do not have the word <em>atom</em> in their style name. Only a few
<a class="reference internal" href="fix.html"><em>fixes</em></a> produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
<a class="reference internal" href="variable.html"><em>Variables</em></a> of style <em>equal</em> are the only ones that can
be used with this fix. Variables of style <em>atom</em> cannot be used,
since they produce per-atom values.</p>
<a class="reference internal" href="variable.html"><em>Variables</em></a> of style <em>equal</em> or <em>vector</em> are the only
ones that can be used with this fix. Variables of style <em>atom</em> cannot
be used, since they produce per-atom values.</p>
<p>The <em>Nevery</em> argument specifies on what timesteps the input values
will be used in order to be stored. Only timesteps that are a
multiple of <em>Nevery</em>, including timestep 0, will contribute values.</p>
@ -217,13 +218,15 @@ calculated by the fix is used.</p>
which must be compatible with <em>Nevery</em>, else an error will result.
Users can also write code for their own fix styles and <a class="reference internal" href="Section_modify.html"><em>add them to LAMMPS</em></a>.</p>
<p>If a value begins with &#8220;<a href="#id5"><span class="problematic" id="id6">v_</span></a>&#8221;, a variable name must follow which has
been previously defined in the input script. Only equal-style
variables can be referenced. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command
for details. Note that variables of style <em>equal</em> define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to be stored by fix vector.</p>
been previously defined in the input script. An equal-style or
vector-style variable can be referenced; the latter requires a
bracketed term to use the Ith element of the vector calculated by the
variable. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command for details. Note
that variables of style <em>equal</em> and <em>vector</em> define a formula which
can reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying quantities to
be stored by fix vector.</p>
</div>
<hr class="docutils" />
<div class="section" id="restart-fix-modify-output-run-start-stop-minimize-info">

View File

@ -21,7 +21,8 @@ value = c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :l
c_ID\[I\] = Ith component of global vector calculated by a compute with ID
f_ID = global scalar calculated by a fix with ID
f_ID\[I\] = Ith component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name :pre
v_name = value calculated by an equal-style variable with name
v_name\[I\] = Ith component of vector-style variable with name :pre
:ule
[Examples:]
@ -53,18 +54,18 @@ specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
Each listed value can be the result of a "compute"_compute.html or
"fix"_fix.html or the evaluation of an equal-style
"fix"_fix.html or the evaluation of an equal-style or vector-style
"variable"_variable.html. In each case, the compute, fix, or variable
must produce a global quantity, not a per-atom or local quantity.
And the global quantity must be a scalar, not a vector or array.
must produce a global quantity, not a per-atom or local quantity. And
the global quantity must be a scalar, not a vector or array.
"Computes"_compute.html that produce global quantities are those which
do not have the word {atom} in their style name. Only a few
"fixes"_fix.html produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
"Variables"_variable.html of style {equal} are the only ones that can
be used with this fix. Variables of style {atom} cannot be used,
since they produce per-atom values.
"Variables"_variable.html of style {equal} or {vector} are the only
ones that can be used with this fix. Variables of style {atom} cannot
be used, since they produce per-atom values.
The {Nevery} argument specifies on what timesteps the input values
will be used in order to be stored. Only timesteps that are a
@ -107,13 +108,15 @@ Users can also write code for their own fix styles and "add them to
LAMMPS"_Section_modify.html.
If a value begins with "v_", a variable name must follow which has
been previously defined in the input script. Only equal-style
variables can be referenced. See the "variable"_variable.html command
for details. Note that variables of style {equal} define a formula
which can reference individual atom properties or thermodynamic
keywords, or they can invoke other computes, fixes, or variables when
they are evaluated, so this is a very general means of specifying
quantities to be stored by fix vector.
been previously defined in the input script. An equal-style or
vector-style variable can be referenced; the latter requires a
bracketed term to use the Ith element of the vector calculated by the
variable. See the "variable"_variable.html command for details. Note
that variables of style {equal} and {vector} define a formula which
can reference individual atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when they are
evaluated, so this is a very general means of specifying quantities to
be stored by fix vector.
:line

File diff suppressed because one or more lines are too long

View File

@ -152,7 +152,7 @@
cella, cellb, cellc, cellalpha, cellbeta, cellgamma,
c_ID, c_ID[I], c_ID[I][J],
f_ID, f_ID[I], f_ID[I][J],
v_name
v_name, v_name[I]
step = timestep
elapsed = timesteps since start of this run
elaplong = timesteps since start of initial run in a series of runs
@ -200,7 +200,8 @@
f_ID = global scalar value calculated by a fix with ID
f_ID[I] = Ith component of global vector calculated by a fix with ID
f_ID[I][J] = I,J component of global array calculated by a fix with ID
v_name = scalar value calculated by an equal-style variable with name
v_name = value calculated by an equal-style variable with name
v_name[I] = value calculated by a vector-style variable with name
</pre>
</div>
<div class="section" id="examples">
@ -422,15 +423,17 @@ option being used.</p>
<p>The <em>v_name</em> keyword allow the current value of a variable to be
output. The name in the keyword should be replaced by the variable
name that has been defined elsewhere in the input script. Only
equal-style variables can be referenced. See the
<a class="reference internal" href="variable.html"><em>variable</em></a> command for details. Variables of style
<em>equal</em> can reference per-atom properties or thermodynamic keywords,
or they can invoke other computes, fixes, or variables when evaluated,
so this is a very general means of creating thermodynamic output.</p>
<p>Note that equal-style variables are assumed to be &#8220;intensive&#8221; global
quantities, which are thus printed as-is, without normalization by
thermo_style custom. You can include a division by &#8220;natoms&#8221; in the
variable formula if this is not the case.</p>
equal-style and vector-style variables can be referenced; the latter
requires a bracketed term to specify the Ith element of the vector
calculated by the variable. See the <a class="reference internal" href="variable.html"><em>variable</em></a> command
for details. Variables of style <em>equal</em> and <em>vector</em> define a formula
which can reference per-atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when evaluated, so
this is a very general means of creating thermodynamic output.</p>
<p>Note that equal-style and vector-style variables are assumed to
produce &#8220;intensive&#8221; global quantities, which are thus printed as-is,
without normalization by thermo_style custom. You can include a
division by &#8220;natoms&#8221; in the variable formula if this is not the case.</p>
</div>
<hr class="docutils" />
<div class="section" id="restrictions">

View File

@ -30,7 +30,7 @@ args = list of arguments for a particular style :l
cella, cellb, cellc, cellalpha, cellbeta, cellgamma,
c_ID, c_ID\[I\], c_ID\[I\]\[J\],
f_ID, f_ID\[I\], f_ID\[I\]\[J\],
v_name
v_name, v_name\[I\]
step = timestep
elapsed = timesteps since start of this run
elaplong = timesteps since start of initial run in a series of runs
@ -78,7 +78,8 @@ args = list of arguments for a particular style :l
f_ID = global scalar value calculated by a fix with ID
f_ID\[I\] = Ith component of global vector calculated by a fix with ID
f_ID\[I\]\[J\] = I,J component of global array calculated by a fix with ID
v_name = scalar value calculated by an equal-style variable with name :pre
v_name = value calculated by an equal-style variable with name
v_name\[I\] = value calculated by a vector-style variable with name :pre
:ule
[Examples:]
@ -333,16 +334,18 @@ option being used.
The {v_name} keyword allow the current value of a variable to be
output. The name in the keyword should be replaced by the variable
name that has been defined elsewhere in the input script. Only
equal-style variables can be referenced. See the
"variable"_variable.html command for details. Variables of style
{equal} can reference per-atom properties or thermodynamic keywords,
or they can invoke other computes, fixes, or variables when evaluated,
so this is a very general means of creating thermodynamic output.
equal-style and vector-style variables can be referenced; the latter
requires a bracketed term to specify the Ith element of the vector
calculated by the variable. See the "variable"_variable.html command
for details. Variables of style {equal} and {vector} define a formula
which can reference per-atom properties or thermodynamic keywords, or
they can invoke other computes, fixes, or variables when evaluated, so
this is a very general means of creating thermodynamic output.
Note that equal-style variables are assumed to be "intensive" global
quantities, which are thus printed as-is, without normalization by
thermo_style custom. You can include a division by "natoms" in the
variable formula if this is not the case.
Note that equal-style and vector-style variables are assumed to
produce "intensive" global quantities, which are thus printed as-is,
without normalization by thermo_style custom. You can include a
division by "natoms" in the variable formula if this is not the case.
:line

View File

@ -133,7 +133,7 @@
</div>
<ul class="simple">
<li>name = name of variable to define</li>
<li>style = <em>delete</em> or <em>index</em> or <em>loop</em> or <em>world</em> or <em>universe</em> or <em>uloop</em> or <em>string</em> or <em>format</em> or <em>getenv</em> or <em>file</em> or <em>atomfile</em> or <em>python</em> or <em>equal</em> or <em>atom</em></li>
<li>style = <em>delete</em> or <em>index</em> or <em>loop</em> or <em>world</em> or <em>universe</em> or <em>uloop</em> or <em>string</em> or <em>format</em> or <em>getenv</em> or <em>file</em> or <em>atomfile</em> or <em>python</em> or <em>equal</em> or <em>vector</em> or <em>atom</em></li>
</ul>
<pre class="literal-block">
<em>delete</em> = no args
@ -163,7 +163,7 @@
<em>file</em> arg = filename
<em>atomfile</em> arg = filename
<em>python</em> arg = function
<em>equal</em> or <em>atom</em> args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references
<em>equal</em> or <em>vector</em> or <em>atom</em> 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 <a class="reference internal" href="thermo_style.html"><em>thermo_style</em></a>
@ -189,8 +189,8 @@
feature functions = is_active(category,feature,exact), is_defined(category,id,exact)
atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i]
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
compute references = c_ID, c_ID[i], c_ID[i][j]
fix references = f_ID, f_ID[i], f_ID[i][j]
compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i]
fix references = f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i]
variable references = v_name, v_name[i]
</pre>
</div>
@ -227,15 +227,19 @@ string is assigned to the variable. Variables of style <em>equal</em> store
a formula which when evaluated produces a single numeric value which
can be output either directly (see the <a class="reference internal" href="print.html"><em>print</em></a>, <a class="reference internal" href="fix_print.html"><em>fix print</em></a>, and <a class="reference internal" href="run.html"><em>run every</em></a> commands) or as part
of thermodynamic output (see the <a class="reference internal" href="thermo_style.html"><em>thermo_style</em></a>
command), or used as input to an averaging fix (see the <a class="reference internal" href="fix_ave_time.html"><em>fix ave/time</em></a> command). Variables of style <em>atom</em> store
a formula which when evaluated produces one numeric value per atom
which can be output to a dump file (see the <a class="reference internal" href="dump.html"><em>dump custom</em></a>
command) or used as input to an averaging fix (see the <a class="reference internal" href="fix_ave_spatial.html"><em>fix ave/spatial</em></a> and <a class="reference internal" href="fix_ave_atom.html"><em>fix ave/atom</em></a>
command), or used as input to an averaging fix (see the <a class="reference internal" href="fix_ave_time.html"><em>fix ave/time</em></a> command). Variables of style <em>vector</em>
store a formula which produces a vector of such values which can be
used as input to various averaging fixes, or elements of which can be
part of thermodynamic output. Variables of style <em>atom</em> store a
formula which when evaluated produces one numeric value per atom which
can be output to a dump file (see the <a class="reference internal" href="dump.html"><em>dump custom</em></a> command)
or used as input to an averaging fix (see the <a class="reference internal" href="fix_ave_chunk.html"><em>fix ave/chunk</em></a> and <a class="reference internal" href="fix_ave_atom.html"><em>fix ave/atom</em></a>
commands). Variables of style <em>atomfile</em> can be used anywhere in an
input script that atom-style variables are used; they get their
per-atom values from a file rather than from a formula. Variables can
be hooked to Python functions using code you provide, so that the
variable gets its value from the evaluation of the Python code.</p>
per-atom values from a file rather than from a formula. Variables of
style <em>python</em> can be hooked to Python functions using code you
provide, so that the variable gets its value from the evaluation of
the Python code.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">As discussed in <a class="reference internal" href="Section_commands.html#cmd-2"><span>Section 3.2</span></a> of the
@ -259,27 +263,27 @@ simulation.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">When the input script line is encountered that defines a
variable of style <em>equal</em> or <em>atom</em> or <em>python</em> that contains a
formula or Python code, the formula is NOT immediately evaluated. It
will be evaluated every time when the variable is <strong>used</strong> instead. If
you simply want to evaluate a formula in place you can use as
so-called. See the section below about &#8220;Immediate Evaluation of
Variables&#8221; for more details on the topic. This is also true of a
<em>format</em> style variable since it evaluates another variable when it is
invoked.</p>
variable of style <em>equal</em> or <em>vector</em> or <em>atom</em> or <em>python</em> that
contains a formula or Python code, the formula is NOT immediately
evaluated. It will be evaluated every time when the variable is
<strong>used</strong> instead. If you simply want to evaluate a formula in place you
can use as so-called. See the section below about &#8220;Immediate
Evaluation of Variables&#8221; for more details on the topic. This is also
true of a <em>format</em> style variable since it evaluates another variable
when it is invoked.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Variables of style <em>equal</em> and <em>atom</em> can be used as inputs to
various other LAMMPS commands which evaluate their formulas as needed,
e.g. at different timesteps during a <a class="reference internal" href="run.html"><em>run</em></a>. Variables of
style <em>python</em> can be used in place of an equal-style variable so long
as the associated Python function, as defined by the
<a class="reference internal" href="python.html"><em>python</em></a> command, returns a numeric value. Thus any
command that states it can use an equal-style variable as an argument,
can also use such a python-style variable. This means that when the
LAMMPS command evaluates the variable, the Python function will be
executed.</p>
<p class="last">Variables of style <em>equal</em> and <em>vector</em> and <em>atom</em> can be used
as inputs to various other LAMMPS commands which evaluate their
formulas as needed, e.g. at different timesteps during a
<a class="reference internal" href="run.html"><em>run</em></a>. Variables of style <em>python</em> can be used in place of
an equal-style variable so long as the associated Python function, as
defined by the <a class="reference internal" href="python.html"><em>python</em></a> command, returns a numeric value.
Thus any command that states it can use an equal-style variable as an
argument, can also use such a python-style variable. This means that
when the LAMMPS command evaluates the variable, the Python function
will be executed.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
@ -294,12 +298,12 @@ will override a corresponding index variable setting in the input
script.</p>
</div>
<p>There are two exceptions to this rule. First, variables of style
<em>string</em>, <em>getenv</em>, <em>equal</em>, <em>atom</em>, and <em>python</em> ARE redefined each
time the command is encountered. This allows these style of variables
to be redefined multiple times in an input script. In a loop, this
means the formula associated with an <em>equal</em> or <em>atom</em> style variable
can change if it contains a substitution for another variable, e.g. $x
or v_x.</p>
<em>string</em>, <em>getenv</em>, <em>equal</em>, <em>vector</em>, <em>atom</em>, and <em>python</em> ARE
redefined each time the command is encountered. This allows these
style of variables to be redefined multiple times in an input script.
In a loop, this means the formula associated with an <em>equal</em> or <em>atom</em>
style variable can change if it contains a substitution for another
variable, e.g. $x or v_x.</p>
<p>Second, as described below, if a variable is iterated on to the end of
its list of strings via the <a class="reference internal" href="next.html"><em>next</em></a> command, it is removed
from the list of active variables, and is thus available to be
@ -336,8 +340,8 @@ variable a delete
</div>
<hr class="docutils" />
<p>This section describes how all the various variable styles are defined
and what they store. Except for the <em>equal</em> and <em>atom</em> styles,
which are explaine in the next section.</p>
and what they store. Except for the <em>equal</em> and <em>vector</em> and <em>atom</em>
styles, which are explained in the next section.</p>
<p>Many of the styles store one or more strings. Note that a single
string can contain spaces (multiple words), if it is enclosed in
quotes in the variable command. When the variable is substituted for
@ -479,28 +483,31 @@ python-style variable can be used in place of an equal-style variable
anywhere in an input script, e.g. as an argument to another command
that allows for equal-style variables.</p>
<hr class="docutils" />
<p>For the <em>equal</em> and <em>atom</em> styles, a single string is specified which
represents a formula that will be evaluated afresh each time the
variable is used. If you want spaces in the string, enclose it in
double quotes so the parser will treat it as a single argument. For
<em>equal</em> style variables the formula computes a scalar quantity, which
becomes the value of the variable whenever it is evaluated. For
<em>atom</em> style variables the formula computes one quantity for each
atom whenever it is evaluated.</p>
<p>Note that <em>equal</em> and <em>atom</em> variables can produce different values at
different stages of the input script or at different times during a
run. For example, if an <em>equal</em> variable is used in a <a class="reference internal" href="fix_print.html"><em>fix print</em></a> command, different values could be printed each
timestep it was invoked. If you want a variable to be evaluated
immediately, so that the result is stored by the variable instead of
the string, see the section below on &#8220;Immediate Evaluation of
Variables&#8221;.</p>
<p>The next command cannot be used with <em>equal</em> or <em>atom</em> style
variables, since there is only one string.</p>
<p>The formula for an <em>equal</em> or <em>atom</em> variable can contain a variety
of quantities. The syntax for each kind of quantity is simple, but
multiple quantities can be nested and combined in various ways to
build up formulas of arbitrary complexity. For example, this is a
valid (though strange) variable formula:</p>
<p>For the <em>equal</em> and <em>vector</em> and <em>atom</em> styles, a single string is
specified which represents a formula that will be evaluated afresh
each time the variable is used. If you want spaces in the string,
enclose it in double quotes so the parser will treat it as a single
argument. For <em>equal</em>-style variables the formula computes a scalar
quantity, which becomes the value of the variable whenever it is
evaluated. For <em>vector</em>-style variables the formula computes a vector
of quantities, which becomes the value of the variable whenever it is
evaluated. For <em>atom</em>-style variables the formula computes one
quantity for each atom whenever it is evaluated.</p>
<p>Note that <em>equal</em>, <em>vector</em>, and <em>atom</em> variables can produce
different values at different stages of the input script or at
different times during a run. For example, if an <em>equal</em> variable is
used in a <a class="reference internal" href="fix_print.html"><em>fix print</em></a> command, different values could
be printed each timestep it was invoked. If you want a variable to be
evaluated immediately, so that the result is stored by the variable
instead of the string, see the section below on &#8220;Immediate Evaluation
of Variables&#8221;.</p>
<p>The next command cannot be used with <em>equal</em> or <em>vector</em> or <em>atom</em>
style variables, since there is only one string.</p>
<p>The formula for an <em>equal</em>, <em>vector</em>, or <em>atom</em> variable can contain a
variety of quantities. The syntax for each kind of quantity is
simple, but multiple quantities can be nested and combined in various
ways to build up formulas of arbitrary complexity. For example, this
is a valid (though strange) variable formula:</p>
<div class="highlight-python"><div class="highlight"><pre>variable x equal &quot;pe + c_MyTemp / vol^(1/3)&quot;
</pre></div>
</div>
@ -548,32 +555,38 @@ references, and references to other variables.</p>
<td>id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q</td>
</tr>
<tr class="row-even"><td>Compute references</td>
<td>c_ID, c_ID[i], c_ID[i][j]</td>
<td>c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i]</td>
</tr>
<tr class="row-odd"><td>Fix references</td>
<td>f_ID, f_ID[i], f_ID[i][j]</td>
<td>f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i]</td>
</tr>
<tr class="row-even"><td>Other variables</td>
<td>v_name, v_name[i]</td>
</tr>
</tbody>
</table>
<p>Most of the formula elements produce a scalar value. A few produce a
per-atom vector of values. These are the atom vectors, compute
references that represent a per-atom vector, fix references that
represent a per-atom vector, and variables that are atom-style
variables. Math functions that operate on scalar values produce a
scalar value; math function that operate on per-atom vectors do so
element-by-element and produce a per-atom vector.</p>
<p>Most of the formula elements produce a scalar value. Some produce a
global or per-atom vector of values. Global vectors can be produced
by computes or fixes or by other vector-style variables. Per-atom
vectors are produced by atom vectors, compute references that
represent a per-atom vector, fix references that represent a per-atom
vector, and variables that are atom-style variables. Math functions
that operate on scalar values produce a scalar value; math function
that operate on global or per-atom vectors do so element-by-element
and produce a global or per-atom vector.</p>
<p>A formula for equal-style variables cannot use any formula element
that produces a per-atom vector. A formula for an atom-style variable
can use formula elements that produce either a scalar value or a
per-atom vector. Atom-style variables are evaluated by other commands
that define a <a class="reference internal" href="group.html"><em>group</em></a> on which they operate, e.g. a
<a class="reference internal" href="dump.html"><em>dump</em></a> or <a class="reference internal" href="compute.html"><em>compute</em></a> or <a class="reference internal" href="fix.html"><em>fix</em></a> command.
When they invoke the atom-style variable, only atoms in the group are
inlcuded in the formula evaluation. The variable evaluates to 0.0 for
atoms not in the group.</p>
that produces a global or per-atom vector. A formula for a
vector-style variable can use formula elements that produce either a
scalar value or a global vector value, but cannot use a formula
element that produces a per-atom vector. A formula for an atom-style
variable can use formula elements that produce either a scalar value
or a per-atom vector, but not one that produces a global vector.
Atom-style variables are evaluated by other commands that define a
<a class="reference internal" href="group.html"><em>group</em></a> on which they operate, e.g. a <a class="reference internal" href="dump.html"><em>dump</em></a> or
<a class="reference internal" href="compute.html"><em>compute</em></a> or <a class="reference internal" href="fix.html"><em>fix</em></a> command. When they invoke
the atom-style variable, only atoms in the group are included in the
formula evaluation. The variable evaluates to 0.0 for atoms not in
the group.</p>
<hr class="docutils" />
<div class="section" id="numers-constants-and-thermo-keywords">
<h3>Numers, constants, and thermo keywords<a class="headerlink" href="#numers-constants-and-thermo-keywords" title="Permalink to this headline"></a></h3>
@ -654,11 +667,11 @@ to the <a class="reference internal" href="compute_reduce.html"><em>compute redu
<p>Math functions are specified as keywords followed by one or more
parenthesized arguments &#8220;x&#8221;, &#8220;y&#8221;, &#8220;z&#8221;, each of which can themselves be
arbitrarily complex formulas. In this syntax, the arguments can
represent scalar values or per-atom vectors. In the latter case, the
math operation is performed on each element of the vector. For
example, &#8220;sqrt(natoms)&#8221; is the sqrt() of a scalar, where &#8220;sqrt(y*z)&#8221;
yields a per-atom vector with each element being the sqrt() of the
product of one atom&#8217;s y and z coordinates.</p>
represent scalar values or global vectors or per-atom vectors. In the
latter case, the math operation is performed on each element of the
vector. For example, &#8220;sqrt(natoms)&#8221; is the sqrt() of a scalar, where
&#8220;sqrt(y*z)&#8221; yields a per-atom vector with each element being the
sqrt() of the product of one atom&#8217;s y and z coordinates.</p>
<p>Most of the math functions perform obvious operations. The ln() is
the natural log; log() is the base 10 log.</p>
<p>The random(x,y,z) function takes 3 arguments: x = lo, y = hi, and z =
@ -667,19 +680,21 @@ normal(x,y,z) function also takes 3 arguments: x = mu, y = sigma, and
z = seed. It generates a Gaussian variate centered on mu with
variance sigma^2. In both cases the seed is used the first time the
internal random number generator is invoked, to initialize it. For
equal-style variables, every processor uses the same seed so that they
each generate the same sequence of random numbers. For atom-style
variables, a unique seed is created for each processor, based on the
specified seed. This effectively generates a different random number
for each atom being looped over in the atom-style variable.</p>
equal-style and vector-style variables, every processor uses the same
seed so that they each generate the same sequence of random numbers.
For atom-style variables, a unique seed is created for each processor,
based on the specified seed. This effectively generates a different
random number for each atom being looped over in the atom-style
variable.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Internally, there is just one random number generator for all
equal-style variables and one for all atom-style variables. If you
define multiple variables (of each style) which use the random() or
normal() math functions, then the internal random number generators
will only be initialized once, which means only one of the specified
seeds will determine the sequence of generated random numbers.</p>
equal-style and vector-style variables and another one for all
atom-style variables. If you define multiple variables (of each
style) which use the random() or normal() math functions, then the
internal random number generators will only be initialized once, which
means only one of the specified seeds will determine the sequence of
generated random numbers.</p>
</div>
<p>The ceil(), floor(), and round() functions are those in the C math
library. Ceil() is the smallest integer not less than its argument.
@ -821,18 +836,20 @@ inclusion is that it be in the region.</p>
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 &#8220;c_ID&#8221; or &#8220;c_ID[N]&#8221; or
&#8220;f_ID&#8221; or &#8220;f_ID[N]&#8221;. 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 &#8220;[N]&#8221; should be used. If
it produces a global array, then the notation with &#8220;[N]&#8221; 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
<a class="reference internal" href="compute_reduce.html"><em>compute reduce</em></a> command, which invokes the same
functions on per-atom and local vectors.</p>
&#8220;f_ID&#8221; or &#8220;f_ID[N]&#8221; or &#8220;v_name&#8221;. 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 &#8220;[N]&#8221; should be
used. If it produces a global array, then the notation with &#8220;[N]&#8221;
should be used, when N is an integer, to specify which column of the
global array is being referenced. The last form of argument &#8220;v_name&#8221;
is for a vector-style variable where &#8220;name&#8221; is replaced by the name of
the variable.</p>
<p>These functions operate on a global vector of inputs and reduce it to
a single scalar value. This is analagous to the operation of the
<a class="reference internal" href="compute_reduce.html"><em>compute reduce</em></a> command, which performs similar
operations 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
@ -945,13 +962,13 @@ active suffixes is tried before reporting failure.</p>
atom-ID, e.g. x[243], which means use the x coordinate of the atom
with ID = 243. Or they can take a variable name, specified as v_name,
where name is the name of the variable, like x[v_myIndex]. The
variable can be of any style except atom or atom-file variables. The
variable is evaluated and the result is expected to be numeric and is
cast to an integer (i.e. 3.4 becomes 3), to use an an index, which
must be a value from 1 to N. Note that a &#8220;formula&#8221; cannot be used as
the argument between the brackets, e.g. x[243+10] or
x[v_myIndex+1] are not allowed. To do this a single variable can be
defined that contains the needed formula.</p>
variable can be of any style except <em>vector</em> or <em>atom</em> or <em>atomfile</em>
variables. The variable is evaluated and the result is expected to be
numeric and is cast to an integer (i.e. 3.4 becomes 3), to use an an
index, which must be a value from 1 to N. Note that a &#8220;formula&#8221;
cannot be used as the argument between the brackets, e.g. x[243+10]
or x[v_myIndex+1] are not allowed. To do this a single variable can
be defined that contains the needed formula.</p>
<p>Note that the 0 &lt; atom-ID &lt;= N, where N is the largest atom ID
in the system. If an ID is specified for an atom that does not
currently exist, then the generated value is 0.0.</p>
@ -959,7 +976,7 @@ currently exist, then the generated value is 0.0.</p>
&#8220;vx&#8221; means the x-component of each atom&#8217;s velocity will be used when
evaluating the variable.</p>
<p>The meaning of the different atom values and vectors is mostly
self-explanatory. Mol refers to the molecule ID of an atom, and is
self-explanatory. <em>Mol</em> refers to the molecule ID of an atom, and is
only defined if an <a class="reference internal" href="atom_style.html"><em>atom_style</em></a> is being used that
defines molecule IDs.</p>
<p>Note that many other atom attributes can be used as inputs to a
@ -975,16 +992,19 @@ the ID of a compute defined elsewhere in the input script. As
discussed in the doc page for the <a class="reference internal" href="compute.html"><em>compute</em></a> command,
computes can produce global, per-atom, or local values. Only global
and per-atom values can be used in a variable. Computes can also
produce a scalar, vector, or array. An equal-style variable can only
use scalar values, which means a global scalar, or an element of a
global or per-atom vector or array. Atom-style variables can use the
same scalar values. They can also use per-atom vector values. A
vector value can be a per-atom vector itself, or a column of an
per-atom array. See the doc pages for individual computes to see what
kind of values they produce.</p>
produce a scalar, vector, or array.</p>
<p>An equal-style variable can only use scalar values, which means a
global scalar, or an element of a global or per-atom vector or array.
A vector-style variable can use scalar values or a global vector of
values, or a column of a global array of values, Atom-style variables
can use global scalar values. They can also use per-atom vector
values. A vector value can be a per-atom vector itself, or a column
of a per-atom array. See the doc pages for individual computes to see
what kind of values they produce.</p>
<p>Examples of different kinds of compute references are as follows.
There is no ambiguity as to what a reference means, since computes
only produce global or per-atom quantities, never both.</p>
There is typically no ambiguity (see exception below) as to what a
reference means, since computes only produce either global or per-atom
quantities, never both.</p>
<table border="1" class="docutils">
<colgroup>
<col width="10%" />
@ -1002,13 +1022,29 @@ only produce global or per-atom quantities, never both.</p>
</tr>
</tbody>
</table>
<p>For I and J, integers can be specified or a variable name, specified
as v_name, where name is the name of the variable. The rules for this
syntax are the same as for the &#8220;Atom Values and Vectors&#8221; discussion
above.</p>
<p>If a variable containing a compute is evaluated directly in an input
script (not during a run), then the values accessed by the compute
must be current. See the discussion below about &#8220;Variable Accuracy&#8221;.</p>
<p>For I and J indices, integers can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the &#8220;Atom Values and
Vectors&#8221; discussion above.</p>
<p>One source of ambiguity for compute references is when a vector-style
variable refers to a compute that produces both a global scalar and a
global vector. Consider a compute with ID &#8220;foo&#8221; that does this,
referenced as follows by variable &#8220;a&#8221;, where &#8220;myVec&#8221; is another
vector-style variable:</p>
<div class="highlight-python"><div class="highlight"><pre>variable a vector c_foo*v_myVec
</pre></div>
</div>
<p>The reference &#8220;c_foo&#8221; could refer to either the global scalar or
global vector produced by compute &#8220;foo&#8221;. In this case, &#8220;c_foo&#8221; will
always refer to the global scalar, and &#8220;C_foo&#8221; can be used to
reference the global vector. Similarly if the compute produces both a
global vector and global array, then &#8220;c_foo[I]&#8221; will always refer to
an element of the global vector, and &#8220;C_foo[I]&#8221; can be used to
reference the Ith column of the global array.</p>
<p>Note that if a variable containing a compute is evaluated directly in
an input script (not during a run), then the values accessed by the
compute must be current. See the discussion below about &#8220;Variable
Accuracy&#8221;.</p>
</div>
<hr class="docutils" />
<div class="section" id="fix-references">
@ -1027,8 +1063,9 @@ column of an per-atom array. See the doc pages for individual fixes
to see what kind of values they produce.</p>
<p>The different kinds of fix references are exactly the same as the
compute references listed in the above table, where &#8220;<a href="#id1"><span class="problematic" id="id2">c_</span></a>&#8221; is replaced
by &#8220;<a href="#id3"><span class="problematic" id="id4">f_</span></a>&#8221;. Again, there is no ambiguity as to what a reference means,
since fixes only produce global or per-atom quantities, never both.</p>
by &#8220;<a href="#id3"><span class="problematic" id="id4">f_</span></a>&#8221;. Again, there is typically no ambiguity (see exception below)
as to what a reference means, since fixes only produce either global
or per-atom quantities, never both.</p>
<table border="1" class="docutils">
<colgroup>
<col width="10%" />
@ -1046,13 +1083,22 @@ since fixes only produce global or per-atom quantities, never both.</p>
</tr>
</tbody>
</table>
<p>For I and J, integers can be specified or a variable name, specified
as v_name, where name is the name of the variable. The rules for this
syntax are the same as for the &#8220;Atom Values and Vectors&#8221; discussion
above.</p>
<p>If a variable containing a fix is evaluated directly in an input
script (not during a run), then the values accessed by the fix should
be current. See the discussion below about &#8220;Variable Accuracy&#8221;.</p>
<p>For I and J indices, integers can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the &#8220;Atom Values and
Vectors&#8221; discussion above.</p>
<p>One source of ambiguity for fix references is the same ambiguity
discussed for compute references above. Namely when a vector-style
variable refers to a fix that produces both a global scalar and a
global vector. The solution is the same as for compute references.
For a fix with ID &#8220;foo&#8221;, &#8220;f_foo&#8221; will always refer to the global
scalar, and &#8220;F_foo&#8221; can be used to reference the global vector. And
similarly for distinguishing between a fix&#8217;s global vector versus
global array with &#8220;f_foo[I]&#8221; versus &#8220;F_foo[I]&#8221;.</p>
<p>Note that if a variable containing a fix is evaluated directly in an
input script (not during a run), then the values accessed by the fix
should be current. See the discussion below about &#8220;Variable
Accuracy&#8221;.</p>
<p>Note that some fixes only generate quantities on certain timesteps.
If a variable attempts to access the fix on non-allowed timesteps, an
error is generated. For example, the <a class="reference internal" href="fix_ave_time.html"><em>fix ave/time</em></a>
@ -1066,38 +1112,53 @@ the doc pages for individual fix commands for details.</p>
variables, which will cause those variables to be evaluated. The name
in the reference should be replaced by the name of a variable defined
elsewhere in the input script.</p>
<p>As discussed on this doc page, equal-style variables generate a global
scalar numeric value; atom-style and atomfile-style variables generate
a per-atom vector of numeric values; all other variables store a
string. The formula for an equal-style variable can use any style of
variable except an atom-style or atomfile-style (unless only a single
value from the variable is accessed via a subscript). If a
string-storing variable is used, the string is converted to a numeric
value. Note that this will typically produce a 0.0 if the string is
not a numeric string, which is likely not what you want. The formula
for an atom-style variable can use any style of variable, including
other atom-style or atomfile-style variables.</p>
<p>As discussed on this doc page, equal-style variables generate a single
global numeric value, vector-style variables gerarate a vector of
global numeric values, and atom-style and atomfile-style variables
generate a per-atom vector of numeric values. All other variables
store one or more strings. A vector-style variable can be referenced
wtih a</p>
<p>The formula for an equal-style variable can use any style of variable
including a vector_style or atom-style or atomfile-style. In these
latter cases, a subscript must be used to access a single value from
the vector-, atom-, or atomfile-style variable. If a string-storing
variable is used, the string is converted to a numeric value. Note
that this will typically produce a 0.0 if the string is not a numeric
string, which is likely not what you want.</p>
<p>The formula for an atom-style variable can use any style of variable,
including other atom-style or atomfile-style variables.</p>
<p>The formula for an atom-style variable can use any style of variable,
including other atom-style or atomfile-style variables.</p>
<p>Examples of different kinds of variable references are as follows.
There is no ambiguity as to what a reference means, since variables
produce only a global scalar or a per-atom vector, never both.</p>
produce only a global scalar or global vector or per-atom vector.</p>
<table border="1" class="docutils">
<colgroup>
<col width="24%" />
<col width="76%" />
<col width="14%" />
<col width="86%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>v_name</td>
<td>scalar, or per-atom vector</td>
<td>global scalar from equal-style variable</td>
</tr>
<tr class="row-even"><td>v_name</td>
<td>global vector from vector-style variable</td>
</tr>
<tr class="row-odd"><td>v_name</td>
<td>per-atom vector from atom-style or atomfile-style variable</td>
</tr>
<tr class="row-even"><td>v_name[I]</td>
<td>atom I&#8217;s value in per-atom vector</td>
<td>Ith element of a global vector from vector-style variable</td>
</tr>
<tr class="row-odd"><td>v_name[I]</td>
<td>value of atom with ID = I from atom-style or atomfile-style variable</td>
</tr>
</tbody>
</table>
<p>For I, an integer can be specified or a variable name, specified as
v_name, where name is the name of the variable. The rules for this
syntax are the same as for the &#8220;Atom Values and Vectors&#8221; discussion
above.</p>
<p>For the I index, an integer can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the &#8220;Atom Values and
Vectors&#8221; discussion above.</p>
<hr class="docutils" />
<p><strong>Immediate Evaluation of Variables:</strong></p>
<p>If you want an equal-style variable to be evaluated immediately, it
@ -1275,9 +1336,10 @@ print &quot;Final potential energy = $e&quot;
<div class="section" id="restrictions">
<h2>Restrictions<a class="headerlink" href="#restrictions" title="Permalink to this headline"></a></h2>
<p>Indexing any formula element by global atom ID, such as an atom value,
requires the atom style to use a global mapping in order to look up
the vector indices. By default, only atom styles with molecular
information create global maps. The <a class="reference internal" href="atom_modify.html"><em>atom_modify map</em></a> command can override the default.</p>
requires the <a class="reference internal" href="atom_style.html"><em>atom style</em></a> to use a global mapping in
order to look up the vector indices. By default, only atom styles
with molecular information create global maps. The <a class="reference internal" href="atom_modify.html"><em>atom_modify map</em></a> command can override the default, e.g. for
atomic-style atom styles.</p>
<p>All <em>universe</em>- and <em>uloop</em>-style variables defined in an input script
must have the same number of values.</p>
</div>

View File

@ -13,7 +13,7 @@ variable command :h3
variable name style args ... :pre
name = name of variable to define :ulb,l
style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {string} or {format} or {getenv} or {file} or {atomfile} or {python} or {equal} or {atom} :l
style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {string} or {format} or {getenv} or {file} or {atomfile} or {python} or {equal} or {vector} or {atom} :l
{delete} = no args
{index} args = one or more strings
{loop} args = N
@ -41,7 +41,7 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st
{file} arg = filename
{atomfile} arg = filename
{python} arg = function
{equal} or {atom} args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references
{equal} or {vector} or {atom} 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 "thermo_style"_thermo_style.html
@ -67,8 +67,8 @@ style = {delete} or {index} or {loop} or {world} or {universe} or {uloop} or {st
feature functions = is_active(category,feature,exact), is_defined(category,id,exact)
atom value = id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\], q\[i\]
atom vector = id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
compute references = c_ID, c_ID\[i\], c_ID\[i\]\[j\]
fix references = f_ID, f_ID\[i\], f_ID\[i\]\[j\]
compute references = c_ID, c_ID\[i\], c_ID\[i\]\[j\], C_ID, C_ID\[i\]
fix references = f_ID, f_ID\[i\], f_ID\[i\]\[j\], F_ID, F_ID\[i\]
variable references = v_name, v_name\[i\] :pre
:ule
@ -106,16 +106,20 @@ can be output either directly (see the "print"_print.html, "fix
print"_fix_print.html, and "run every"_run.html commands) or as part
of thermodynamic output (see the "thermo_style"_thermo_style.html
command), or used as input to an averaging fix (see the "fix
ave/time"_fix_ave_time.html command). Variables of style {atom} store
a formula which when evaluated produces one numeric value per atom
which can be output to a dump file (see the "dump custom"_dump.html
command) or used as input to an averaging fix (see the "fix
ave/spatial"_fix_ave_spatial.html and "fix ave/atom"_fix_ave_atom.html
ave/time"_fix_ave_time.html command). Variables of style {vector}
store a formula which produces a vector of such values which can be
used as input to various averaging fixes, or elements of which can be
part of thermodynamic output. Variables of style {atom} store a
formula which when evaluated produces one numeric value per atom which
can be output to a dump file (see the "dump custom"_dump.html command)
or used as input to an averaging fix (see the "fix
ave/chunk"_fix_ave_chunk.html and "fix ave/atom"_fix_ave_atom.html
commands). Variables of style {atomfile} can be used anywhere in an
input script that atom-style variables are used; they get their
per-atom values from a file rather than from a formula. Variables can
be hooked to Python functions using code you provide, so that the
variable gets its value from the evaluation of the Python code.
per-atom values from a file rather than from a formula. Variables of
style {python} can be hooked to Python functions using code you
provide, so that the variable gets its value from the evaluation of
the Python code.
NOTE: As discussed in "Section 3.2"_Section_commands.html#cmd_2 of the
manual, an input script can use "immediate" variables, specified as
@ -137,25 +141,25 @@ different values when it is evaluated at different times during a
simulation.
NOTE: When the input script line is encountered that defines a
variable of style {equal} or {atom} or {python} that contains a
formula or Python code, the formula is NOT immediately evaluated. It
will be evaluated every time when the variable is [used] instead. If
you simply want to evaluate a formula in place you can use as
so-called. See the section below about "Immediate Evaluation of
Variables" for more details on the topic. This is also true of a
{format} style variable since it evaluates another variable when it is
invoked.
variable of style {equal} or {vector} or {atom} or {python} that
contains a formula or Python code, the formula is NOT immediately
evaluated. It will be evaluated every time when the variable is
[used] instead. If you simply want to evaluate a formula in place you
can use as so-called. See the section below about "Immediate
Evaluation of Variables" for more details on the topic. This is also
true of a {format} style variable since it evaluates another variable
when it is invoked.
NOTE: Variables of style {equal} and {atom} can be used as inputs to
various other LAMMPS commands which evaluate their formulas as needed,
e.g. at different timesteps during a "run"_run.html. Variables of
style {python} can be used in place of an equal-style variable so long
as the associated Python function, as defined by the
"python"_python.html command, returns a numeric value. Thus any
command that states it can use an equal-style variable as an argument,
can also use such a python-style variable. This means that when the
LAMMPS command evaluates the variable, the Python function will be
executed.
NOTE: Variables of style {equal} and {vector} and {atom} can be used
as inputs to various other LAMMPS commands which evaluate their
formulas as needed, e.g. at different timesteps during a
"run"_run.html. Variables of style {python} can be used in place of
an equal-style variable so long as the associated Python function, as
defined by the "python"_python.html command, returns a numeric value.
Thus any command that states it can use an equal-style variable as an
argument, can also use such a python-style variable. This means that
when the LAMMPS command evaluates the variable, the Python function
will be executed.
NOTE: When a variable command is encountered in the input script and
the variable name has already been specified, the command is ignored.
@ -168,12 +172,12 @@ will override a corresponding index variable setting in the input
script.
There are two exceptions to this rule. First, variables of style
{string}, {getenv}, {equal}, {atom}, and {python} ARE redefined each
time the command is encountered. This allows these style of variables
to be redefined multiple times in an input script. In a loop, this
means the formula associated with an {equal} or {atom} style variable
can change if it contains a substitution for another variable, e.g. $x
or v_x.
{string}, {getenv}, {equal}, {vector}, {atom}, and {python} ARE
redefined each time the command is encountered. This allows these
style of variables to be redefined multiple times in an input script.
In a loop, this means the formula associated with an {equal} or {atom}
style variable can change if it contains a substitution for another
variable, e.g. $x or v_x.
Second, as described below, if a variable is iterated on to the end of
its list of strings via the "next"_next.html command, it is removed
@ -216,8 +220,8 @@ variable a delete :pre
:line
This section describes how all the various variable styles are defined
and what they store. Except for the {equal} and {atom} styles,
which are explaine in the next section.
and what they store. Except for the {equal} and {vector} and {atom}
styles, which are explained in the next section.
Many of the styles store one or more strings. Note that a single
string can contain spaces (multiple words), if it is enclosed in
@ -380,32 +384,34 @@ that allows for equal-style variables.
:line
For the {equal} and {atom} styles, a single string is specified which
represents a formula that will be evaluated afresh each time the
variable is used. If you want spaces in the string, enclose it in
double quotes so the parser will treat it as a single argument. For
{equal} style variables the formula computes a scalar quantity, which
becomes the value of the variable whenever it is evaluated. For
{atom} style variables the formula computes one quantity for each
atom whenever it is evaluated.
For the {equal} and {vector} and {atom} styles, a single string is
specified which represents a formula that will be evaluated afresh
each time the variable is used. If you want spaces in the string,
enclose it in double quotes so the parser will treat it as a single
argument. For {equal}-style variables the formula computes a scalar
quantity, which becomes the value of the variable whenever it is
evaluated. For {vector}-style variables the formula computes a vector
of quantities, which becomes the value of the variable whenever it is
evaluated. For {atom}-style variables the formula computes one
quantity for each atom whenever it is evaluated.
Note that {equal} and {atom} variables can produce different values at
different stages of the input script or at different times during a
run. For example, if an {equal} variable is used in a "fix
print"_fix_print.html command, different values could be printed each
timestep it was invoked. If you want a variable to be evaluated
immediately, so that the result is stored by the variable instead of
the string, see the section below on "Immediate Evaluation of
Variables".
Note that {equal}, {vector}, and {atom} variables can produce
different values at different stages of the input script or at
different times during a run. For example, if an {equal} variable is
used in a "fix print"_fix_print.html command, different values could
be printed each timestep it was invoked. If you want a variable to be
evaluated immediately, so that the result is stored by the variable
instead of the string, see the section below on "Immediate Evaluation
of Variables".
The next command cannot be used with {equal} or {atom} style
variables, since there is only one string.
The next command cannot be used with {equal} or {vector} or {atom}
style variables, since there is only one string.
The formula for an {equal} or {atom} variable can contain a variety
of quantities. The syntax for each kind of quantity is simple, but
multiple quantities can be nested and combined in various ways to
build up formulas of arbitrary complexity. For example, this is a
valid (though strange) variable formula:
The formula for an {equal}, {vector}, or {atom} variable can contain a
variety of quantities. The syntax for each kind of quantity is
simple, but multiple quantities can be nested and combined in various
ways to build up formulas of arbitrary complexity. For example, this
is a valid (though strange) variable formula:
variable x equal "pe + c_MyTemp / vol^(1/3)" :pre
@ -440,27 +446,33 @@ Special functions: sum(x), min(x), max(x), ave(x), trap(x), \
Atom values: id\[i\], mass\[i\], type\[i\], mol\[i\], x\[i\], y\[i\], z\[i\], \
vx\[i\], vy\[i\], vz\[i\], fx\[i\], fy\[i\], fz\[i\], q\[i\]
Atom vectors: id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q
Compute references: c_ID, c_ID\[i\], c_ID\[i\]\[j\]
Fix references: f_ID, f_ID\[i\], f_ID\[i\]\[j\]
Compute references: c_ID, c_ID\[i\], c_ID\[i\]\[j\], C_ID, C_ID\[i\]
Fix references: f_ID, f_ID\[i\], f_ID\[i\]\[j\], F_ID, F_ID\[i\]
Other variables: v_name, v_name\[i\] :tb(s=:)
Most of the formula elements produce a scalar value. A few produce a
per-atom vector of values. These are the atom vectors, compute
references that represent a per-atom vector, fix references that
represent a per-atom vector, and variables that are atom-style
variables. Math functions that operate on scalar values produce a
scalar value; math function that operate on per-atom vectors do so
element-by-element and produce a per-atom vector.
Most of the formula elements produce a scalar value. Some produce a
global or per-atom vector of values. Global vectors can be produced
by computes or fixes or by other vector-style variables. Per-atom
vectors are produced by atom vectors, compute references that
represent a per-atom vector, fix references that represent a per-atom
vector, and variables that are atom-style variables. Math functions
that operate on scalar values produce a scalar value; math function
that operate on global or per-atom vectors do so element-by-element
and produce a global or per-atom vector.
A formula for equal-style variables cannot use any formula element
that produces a per-atom vector. A formula for an atom-style variable
can use formula elements that produce either a scalar value or a
per-atom vector. Atom-style variables are evaluated by other commands
that define a "group"_group.html on which they operate, e.g. a
"dump"_dump.html or "compute"_compute.html or "fix"_fix.html command.
When they invoke the atom-style variable, only atoms in the group are
inlcuded in the formula evaluation. The variable evaluates to 0.0 for
atoms not in the group.
that produces a global or per-atom vector. A formula for a
vector-style variable can use formula elements that produce either a
scalar value or a global vector value, but cannot use a formula
element that produces a per-atom vector. A formula for an atom-style
variable can use formula elements that produce either a scalar value
or a per-atom vector, but not one that produces a global vector.
Atom-style variables are evaluated by other commands that define a
"group"_group.html on which they operate, e.g. a "dump"_dump.html or
"compute"_compute.html or "fix"_fix.html command. When they invoke
the atom-style variable, only atoms in the group are included in the
formula evaluation. The variable evaluates to 0.0 for atoms not in
the group.
:line
@ -547,11 +559,11 @@ Math Functions :h4
Math functions are specified as keywords followed by one or more
parenthesized arguments "x", "y", "z", each of which can themselves be
arbitrarily complex formulas. In this syntax, the arguments can
represent scalar values or per-atom vectors. In the latter case, the
math operation is performed on each element of the vector. For
example, "sqrt(natoms)" is the sqrt() of a scalar, where "sqrt(y*z)"
yields a per-atom vector with each element being the sqrt() of the
product of one atom's y and z coordinates.
represent scalar values or global vectors or per-atom vectors. In the
latter case, the math operation is performed on each element of the
vector. For example, "sqrt(natoms)" is the sqrt() of a scalar, where
"sqrt(y*z)" yields a per-atom vector with each element being the
sqrt() of the product of one atom's y and z coordinates.
Most of the math functions perform obvious operations. The ln() is
the natural log; log() is the base 10 log.
@ -562,18 +574,20 @@ normal(x,y,z) function also takes 3 arguments: x = mu, y = sigma, and
z = seed. It generates a Gaussian variate centered on mu with
variance sigma^2. In both cases the seed is used the first time the
internal random number generator is invoked, to initialize it. For
equal-style variables, every processor uses the same seed so that they
each generate the same sequence of random numbers. For atom-style
variables, a unique seed is created for each processor, based on the
specified seed. This effectively generates a different random number
for each atom being looped over in the atom-style variable.
equal-style and vector-style variables, every processor uses the same
seed so that they each generate the same sequence of random numbers.
For atom-style variables, a unique seed is created for each processor,
based on the specified seed. This effectively generates a different
random number for each atom being looped over in the atom-style
variable.
NOTE: Internally, there is just one random number generator for all
equal-style variables and one for all atom-style variables. If you
define multiple variables (of each style) which use the random() or
normal() math functions, then the internal random number generators
will only be initialized once, which means only one of the specified
seeds will determine the sequence of generated random numbers.
equal-style and vector-style variables and another one for all
atom-style variables. If you define multiple variables (of each
style) which use the random() or normal() math functions, then the
internal random number generators will only be initialized once, which
means only one of the specified seeds will determine the sequence of
generated random numbers.
The ceil(), floor(), and round() functions are those in the C math
library. Ceil() is the smallest integer not less than its argument.
@ -727,19 +741,21 @@ arguments cannot be formulas themselves.
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.
"f_ID" or "f_ID\[N\]" or "v_name". 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. The last form of argument "v_name"
is for a vector-style variable where "name" is replaced by the name of
the variable.
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
"compute reduce"_compute_reduce.html command, which invokes the same
functions on per-atom and local vectors.
These functions operate on a global vector of inputs and reduce it to
a single scalar value. This is analagous to the operation of the
"compute reduce"_compute_reduce.html command, which performs similar
operations on per-atom and local vectors.
The sum() function calculates the sum of all the vector elements. The
min() and max() functions find the minimum and maximum element
@ -867,13 +883,13 @@ Atom values take an integer argument I from 1 to N, where I is the
atom-ID, e.g. x\[243\], which means use the x coordinate of the atom
with ID = 243. Or they can take a variable name, specified as v_name,
where name is the name of the variable, like x\[v_myIndex\]. The
variable can be of any style except atom or atom-file variables. The
variable is evaluated and the result is expected to be numeric and is
cast to an integer (i.e. 3.4 becomes 3), to use an an index, which
must be a value from 1 to N. Note that a "formula" cannot be used as
the argument between the brackets, e.g. x\[243+10\] or
x\[v_myIndex+1\] are not allowed. To do this a single variable can be
defined that contains the needed formula.
variable can be of any style except {vector} or {atom} or {atomfile}
variables. The variable is evaluated and the result is expected to be
numeric and is cast to an integer (i.e. 3.4 becomes 3), to use an an
index, which must be a value from 1 to N. Note that a "formula"
cannot be used as the argument between the brackets, e.g. x\[243+10\]
or x\[v_myIndex+1\] are not allowed. To do this a single variable can
be defined that contains the needed formula.
Note that the 0 < atom-ID <= N, where N is the largest atom ID
in the system. If an ID is specified for an atom that does not
@ -884,7 +900,7 @@ Atom vectors generate one value per atom, so that a reference like
evaluating the variable.
The meaning of the different atom values and vectors is mostly
self-explanatory. Mol refers to the molecule ID of an atom, and is
self-explanatory. {Mol} refers to the molecule ID of an atom, and is
only defined if an "atom_style"_atom_style.html is being used that
defines molecule IDs.
@ -903,30 +919,51 @@ the ID of a compute defined elsewhere in the input script. As
discussed in the doc page for the "compute"_compute.html command,
computes can produce global, per-atom, or local values. Only global
and per-atom values can be used in a variable. Computes can also
produce a scalar, vector, or array. An equal-style variable can only
use scalar values, which means a global scalar, or an element of a
global or per-atom vector or array. Atom-style variables can use the
same scalar values. They can also use per-atom vector values. A
vector value can be a per-atom vector itself, or a column of an
per-atom array. See the doc pages for individual computes to see what
kind of values they produce.
produce a scalar, vector, or array.
An equal-style variable can only use scalar values, which means a
global scalar, or an element of a global or per-atom vector or array.
A vector-style variable can use scalar values or a global vector of
values, or a column of a global array of values, Atom-style variables
can use global scalar values. They can also use per-atom vector
values. A vector value can be a per-atom vector itself, or a column
of a per-atom array. See the doc pages for individual computes to see
what kind of values they produce.
Examples of different kinds of compute references are as follows.
There is no ambiguity as to what a reference means, since computes
only produce global or per-atom quantities, never both.
There is typically no ambiguity (see exception below) as to what a
reference means, since computes only produce either global or per-atom
quantities, never both.
c_ID: global scalar, or per-atom vector
c_ID\[I\]: Ith element of global vector, or atom I's value in per-atom vector, or Ith column from per-atom array
c_ID\[I\]\[J\]: I,J element of global array, or atom I's Jth value in per-atom array :tb(s=:)
For I and J, integers can be specified or a variable name, specified
as v_name, where name is the name of the variable. The rules for this
syntax are the same as for the "Atom Values and Vectors" discussion
above.
For I and J indices, integers can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the "Atom Values and
Vectors" discussion above.
If a variable containing a compute is evaluated directly in an input
script (not during a run), then the values accessed by the compute
must be current. See the discussion below about "Variable Accuracy".
One source of ambiguity for compute references is when a vector-style
variable refers to a compute that produces both a global scalar and a
global vector. Consider a compute with ID "foo" that does this,
referenced as follows by variable "a", where "myVec" is another
vector-style variable:
variable a vector c_foo*v_myVec :pre
The reference "c_foo" could refer to either the global scalar or
global vector produced by compute "foo". In this case, "c_foo" will
always refer to the global scalar, and "C_foo" can be used to
reference the global vector. Similarly if the compute produces both a
global vector and global array, then "c_foo\[I\]" will always refer to
an element of the global vector, and "C_foo\[I\]" can be used to
reference the Ith column of the global array.
Note that if a variable containing a compute is evaluated directly in
an input script (not during a run), then the values accessed by the
compute must be current. See the discussion below about "Variable
Accuracy".
:line
@ -947,21 +984,32 @@ to see what kind of values they produce.
The different kinds of fix references are exactly the same as the
compute references listed in the above table, where "c_" is replaced
by "f_". Again, there is no ambiguity as to what a reference means,
since fixes only produce global or per-atom quantities, never both.
by "f_". Again, there is typically no ambiguity (see exception below)
as to what a reference means, since fixes only produce either global
or per-atom quantities, never both.
f_ID: global scalar, or per-atom vector
f_ID\[I\]: Ith element of global vector, or atom I's value in per-atom vector, or Ith column from per-atom array
f_ID\[I\]\[J\]: I,J element of global array, or atom I's Jth value in per-atom array :tb(s=:)
For I and J, integers can be specified or a variable name, specified
as v_name, where name is the name of the variable. The rules for this
syntax are the same as for the "Atom Values and Vectors" discussion
above.
For I and J indices, integers can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the "Atom Values and
Vectors" discussion above.
If a variable containing a fix is evaluated directly in an input
script (not during a run), then the values accessed by the fix should
be current. See the discussion below about "Variable Accuracy".
One source of ambiguity for fix references is the same ambiguity
discussed for compute references above. Namely when a vector-style
variable refers to a fix that produces both a global scalar and a
global vector. The solution is the same as for compute references.
For a fix with ID "foo", "f_foo" will always refer to the global
scalar, and "F_foo" can be used to reference the global vector. And
similarly for distinguishing between a fix's global vector versus
global array with "f_foo\[I\]" versus "F_foo\[I\]".
Note that if a variable containing a fix is evaluated directly in an
input script (not during a run), then the values accessed by the fix
should be current. See the discussion below about "Variable
Accuracy".
Note that some fixes only generate quantities on certain timesteps.
If a variable attempts to access the fix on non-allowed timesteps, an
@ -978,29 +1026,41 @@ variables, which will cause those variables to be evaluated. The name
in the reference should be replaced by the name of a variable defined
elsewhere in the input script.
As discussed on this doc page, equal-style variables generate a global
scalar numeric value; atom-style and atomfile-style variables generate
a per-atom vector of numeric values; all other variables store a
string. The formula for an equal-style variable can use any style of
variable except an atom-style or atomfile-style (unless only a single
value from the variable is accessed via a subscript). If a
string-storing variable is used, the string is converted to a numeric
value. Note that this will typically produce a 0.0 if the string is
not a numeric string, which is likely not what you want. The formula
for an atom-style variable can use any style of variable, including
other atom-style or atomfile-style variables.
As discussed on this doc page, equal-style variables generate a single
global numeric value, vector-style variables gerarate a vector of
global numeric values, and atom-style and atomfile-style variables
generate a per-atom vector of numeric values. All other variables
store one or more strings. A vector-style variable can be referenced
wtih a
The formula for an equal-style variable can use any style of variable
including a vector_style or atom-style or atomfile-style. In these
latter cases, a subscript must be used to access a single value from
the vector-, atom-, or atomfile-style variable. If a string-storing
variable is used, the string is converted to a numeric value. Note
that this will typically produce a 0.0 if the string is not a numeric
string, which is likely not what you want.
The formula for an atom-style variable can use any style of variable,
including other atom-style or atomfile-style variables.
The formula for an atom-style variable can use any style of variable,
including other atom-style or atomfile-style variables.
Examples of different kinds of variable references are as follows.
There is no ambiguity as to what a reference means, since variables
produce only a global scalar or a per-atom vector, never both.
produce only a global scalar or global vector or per-atom vector.
v_name: scalar, or per-atom vector
v_name\[I\]: atom I's value in per-atom vector :tb(s=:)
v_name: global scalar from equal-style variable
v_name: global vector from vector-style variable
v_name: per-atom vector from atom-style or atomfile-style variable
v_name\[I\]: Ith element of a global vector from vector-style variable
v_name\[I\]: value of atom with ID = I from atom-style or atomfile-style variable :tb(s=:)
For I, an integer can be specified or a variable name, specified as
v_name, where name is the name of the variable. The rules for this
syntax are the same as for the "Atom Values and Vectors" discussion
above.
For the I index, an integer can be specified or a variable name,
specified as v_name, where name is the name of the variable. The
rules for this syntax are the same as for the "Atom Values and
Vectors" discussion above.
:line
@ -1204,10 +1264,11 @@ print "Final potential energy = $e" :pre
[Restrictions:]
Indexing any formula element by global atom ID, such as an atom value,
requires the atom style to use a global mapping in order to look up
the vector indices. By default, only atom styles with molecular
information create global maps. The "atom_modify
map"_atom_modify.html command can override the default.
requires the "atom style"_atom_style.html to use a global mapping in
order to look up the vector indices. By default, only atom styles
with molecular information create global maps. The "atom_modify
map"_atom_modify.html command can override the default, e.g. for
atomic-style atom styles.
All {universe}- and {uloop}-style variables defined in an input script
must have the same number of values.