Page MenuHomec4science

fix_vector.html
No OneTemporary

File Metadata

Created
Sat, Nov 30, 12:41

fix_vector.html

<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A>
</CENTER>
<HR>
<H3>fix vector command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>fix ID group-ID vector Nevery value1 value2 ...
</PRE>
<UL><LI>ID, group-ID are documented in <A HREF = "fix.html">fix</A> command
<LI>vector = style name of this fix command
<LI>Nevery = use input values every this many timesteps
<LI>one or more input values can be listed
<LI>value = c_ID, c_ID[N], f_ID, f_ID[N], v_name
<PRE> c_ID = global scalar calculated by a compute with ID
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>
</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 1 all vector 100 c_myTemp
fix 1 all vector 5 c_myTemp v_integral
</PRE>
<P><B>Description:</B>
</P>
<P>Use one or more global values as inputs every few timesteps, and
simply store them. For a single specified value, the values are
stored as a global vector of growing length. For multiple specified
values, they are stored as rows in a global array, whose number of
rows is growing. The resulting vector or array can be used by other
<A HREF = "Section_howto.html#howto_15">output commands</A>.
</P>
<P>One way to to use this command is to accumulate a vector that is
time-integrated using the <A HREF = "variable.html">variable trap()</A> function.
For example the velocity auto-correlation function (VACF) can be
time-integrated, to yield a diffusion coefficient, as follows:
</P>
<PRE>compute 2 all vacf
fix 5 all vector 1 c_2[4]
variable diff equal dt*trap(f_5)
thermo_style custom step v_diff
</PRE>
<P>The group specified with this command is ignored. However, note that
specified values may represent calculations performed by computes and
fixes which store their own "group" definitions.
</P>
<P>Each listed value can be the result of a <A HREF = "compute.html">compute</A> or
<A HREF = "fix.html">fix</A> or the evaluation of an equal-style
<A HREF = "variable.html">variable</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>
<P><A HREF = "compute.html">Computes</A> that produce global quantities are those which
do not have the word <I>atom</I> in their style name. Only a few
<A HREF = "fix.html">fixes</A> produce global quantities. See the doc pages for
individual fixes for info on which ones produce such values.
<A HREF = "variable.html">Variables</A> of style <I>equal</I> are the only ones that can
be used with this fix. Variables of style <I>atom</I> cannot be used,
since they produce per-atom values.
</P>
<P>The <I>Nevery</I> argument specifies on what timesteps the input values
will be used in order to be stored. Only timesteps that are a
multiple of <I>Nevery</I>, including timestep 0, will contribute values.
</P>
<P>Note that if you perform multiple runs, using the "pre no" option of
the <A HREF = "run.html">run</A> command to avoid initialization on subsequent runs,
then you need to use the <I>stop</I> keyword with the first <A HREF = "run.html">run</A>
command with a timestep value that encompasses all the runs. This is
so that the vector or array stored by this fix can be allocated to a
sufficient size.
</P>
<HR>
<P>If a value begins with "c_", a compute ID must follow which has been
previously defined in the input script. If no bracketed term is
appended, the global scalar calculated by the compute is used. If a
bracketed term is appended, the Ith element of the global vector
calculated by the compute is used.
</P>
<P>Note that there is a <A HREF = "compute_reduce.html">compute reduce</A> command
which can sum per-atom quantities into a global scalar or vector which
can thus be accessed by fix vector. Or it can be a compute defined
not in your input script, but by <A HREF = "thermo_style.html">thermodynamic
output</A> or other fixes such as <A HREF = "fix_nh.html">fix nvt</A>
or <A HREF = "fix_temp_rescale.html">fix temp/rescale</A>. See the doc pages for
these commands which give the IDs of these computes. Users can also
write code for their own compute styles and <A HREF = "Section_modify.html">add them to
LAMMPS</A>.
</P>
<P>If a value begins with "f_", a fix ID must follow which has been
previously defined in the input script. If no bracketed term is
appended, the global scalar calculated by the fix is used. If a
bracketed term is appended, the Ith element of the global vector
calculated by the fix is used.
</P>
<P>Note that some fixes only produce their values on certain timesteps,
which must be compatible with <I>Nevery</I>, else an error will result.
Users can also write code for their own fix styles and <A HREF = "Section_modify.html">add them to
LAMMPS</A>.
</P>
<P>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 <A HREF = "variable.html">variable</A> command
for details. Note that variables of style <I>equal</I> 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>
<HR>
<P><B>Restart, fix_modify, output, run start/stop, minimize info:</B>
</P>
<P>No information about this fix is written to <A HREF = "restart.html">binary restart
files</A>. None of the <A HREF = "fix_modify.html">fix_modify</A> options
are relevant to this fix.
</P>
<P>This fix produces a global vector or global array which can be
accessed by various <A HREF = "Section_howto.html#howto_15">output commands</A>.
The values can only be accessed on timesteps that are multiples of
<I>Nevery</I>.
</P>
<P>A vector is produced if only a single input value is specified.
An array is produced if multiple input values are specified.
The length of the vector or the number of rows in the array grows
by 1 every <I>Nevery</I> timesteps.
</P>
<P>If the fix prouduces a vector, then the entire vector will be either
"intensive" or "extensive", depending on whether the values stored in
the vector are "intensive" or "extensive". If the fix produces an
array, then all elements in the array must be the same, either
"intensive" or "extensive". If a compute or fix provides the value
stored, then the compute or fix determines whether the value is
intensive or extensive; see the doc page for that compute or fix for
further info. Values produced by a variable are treated as intensive.
</P>
<P>This fix can allocate storage for stored values accumulated over
multiple runs, using the <I>start</I> and <I>stop</I> keywords of the
<A HREF = "run.html">run</A> command. See the <A HREF = "run.html">run</A> command for details of
how to do this. If using the <A HREF = "run.html">run pre no</A> command option,
this is required to allow the fix to allocate sufficient storage for
stored values.
</P>
<P>This fix is not invoked during <A HREF = "minimize.html">energy minimization</A>.
</P>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "compute.html">compute</A>, <A HREF = "variable.html">variable</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>

Event Timeline