lammps/doc/fix_ave_time.html

223 lines
10 KiB
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 ave/time command
</H3>
<P><B>Syntax:</B>
</P>
<PRE>fix ID group-ID ave/time Nevery Nrepeat Nfreq value1 value2 ... keyword args ...
</PRE>
<UL><LI>ID, group-ID are documented in <A HREF = "fix.html">fix</A> command
<LI>ave/time = style name of this fix command
<LI>Nevery = calculate properties every this many timesteps
<LI>Nrepeat = # of times to repeat the Nevery calculation before averaging
<LI>Nfreq = timestep frequency at which averages are computed
<LI>one or more values can be listed
<LI>value = c_ID, c_ID[N], f_ID, f_ID[N], v_name
<PRE> c_ID = global scalar value calculated by a compute with ID
c_ID[N] = Nth component of global vector calculated by a compute with ID
f_ID = global scalar value calculated by a fix with ID
f_ID[N] = Nth component of global vector calculated by a fix with ID
v_name = global value calculated by an equal-style variable with name
</PRE>
<LI>zero or more keyword/arg pairs may be appended
<LI>keyword = <I>file</I> or <I>ave</I> or <I>start</I>
<PRE> <I>file</I> arg = filename
filename = name of file to output time averages to
<I>ave</I> args = <I>one</I> or <I>running</I> or <I>window M</I>
one = output a new average value every Nfreq steps
running = output cumulative average of all previous Nfreq steps
window M = output average of M most recent Nfreq steps
<I>start</I> args = Nstart
Nstart = start averaging on this timestep
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 1 all ave/time 100 5 1000 c_myTemp c_thermo_temp file temp.profile
fix 1 all ave/time 100 5 1000 c_thermo_press[2] ave window 20
fix 1 all ave/time 1 100 1000 f_indent f_indent[1] file temp.indent
</PRE>
<P><B>Description:</B>
</P>
<P>Calculate one or more instantaneous global quantities every few
timesteps, and average them over longer timescales. The resulting
averages can be used by other <A HREF = "Section_howto.html#4_15">output
commands</A> such as <A HREF = "thermo_style.html">thermo_style
custom</A>, and can also be written to a file. If no
averaging is done, this command is a convenient way to simply write
one or more desired quantities to a separate file.
</P>
<P>Each listed value is averaged independently. If written to a file,
then over time, one column of numbers is produced for each value. The
group specified with the command is ignored, since calculations are
performed by computes and fixes which store their own "group"
definition,
</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 quantity. If you wish
to spatial- or time-average per-atom quantities from a compute, fix,
or variable, then see the <A HREF = "fix_ave_spatial.html">fix ave/spatial</A> or
<A HREF = "fix_ave_atom.html">fix ave/atom</A> commands. If you wish to sum a
per-atom quantity into a single global quantity, see the <A HREF = "compute_reduce.html">compute
reduce</A> command.
</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>
<HR>
<P>The <I>Nevery</I>, <I>Nrepeat</I>, and <I>Nfreq</I> arguments specify on what
timesteps the values will be generated in order to contribute to the
average. The final averaged quantities are generated every <I>Nfreq</I>
timesteps. The average is over <I>Nrepeat</I> quantities, computed in the
preceding portion of the simulation every <I>Nevery</I> timesteps. <I>Nfreq</I>
must be a multiple of <I>Nevery</I> and <I>Nevery</I> must be non-zero even if
<I>Nrepeat</I> is 1. Also, the timesteps contributing to the average value
cannot overlap, i.e. Nfreq > (Nrepeat-1)*Nevery is required.
</P>
<P>For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on
timesteps 90,92,94,96,98,100 will be used to compute the final average
on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on
timestep 200, etc. If Nrepeat=1 and Nfreq = 100, then no time
averaging is done; values are simply generated on timesteps
100,200,etc.
</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 Nth vector value calculated by the
compute is used. 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
ave/time. 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_nvt.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 Nth vector value calculated by the fix
is used. 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. 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 generating quantities to
time average.
</P>
<HR>
<P>Additional optional keywords also affect the operation of this fix.
</P>
<P>The <I>file</I> keyword allows a filename to be specified. Each timestamp,
one quantity is written to the file for each value specified in the
fix ave/time command. The file is in a self-explanatory text format.
</P>
<P>The <I>ave</I> keyword determines how the scalar and/or vector values
produced every <I>Nfreq</I> steps are averaged with values produced on
previous steps that were multiples of <I>Nfreq</I>, before they are
accessed by another output command or written to a file.
</P>
<P>If the <I>ave</I> setting is <I>one</I>, then the values produced on timesteps
that are multiples of <I>Nfreq</I> are independent of each other; they are
output as-is without further averaging.
</P>
<P>If the <I>ave</I> setting is <I>running</I>, then the values produced on
timesteps that are multiples of <I>Nfreq</I> are summed and averaged in a
cumulative sense before being output. Each output value is thus the
average of the value produced on that timestep with all preceding
values. This running average begins when the fix is defined; it can
only be restarted by deleting the fix via the <A HREF = "unfix.html">unfix</A>
command, or by re-defining the fix by re-specifying it.
</P>
<P>If the <I>ave</I> setting is <I>window</I>, then the values produced on
timesteps that are multiples of <I>Nfreq</I> are summed and averaged within
a moving "window" of time, so that the last M values are used to
produce the output. E.g. if M = 3 and Nfreq = 1000, then the output
on step 10000 will be the average of the individual values on steps
8000,9000,10000. Outputs on early steps will average over less than M
values if they are not available.
</P>
<P>The <I>start</I> keyword specifies what timestep averaging will begin on.
The default is step 0. Often this value is 0.0, so setting <I>start</I> to
a larger value can avoid including a 0.0 in a running or windowed
average.
</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 scalar or vector which can be accessed by
various <A HREF = "Section_howto.html#4_15">output commands</A>. A scalar is
produced if only a single quantity is averaged by this fix. If two or
more quantities are averaged, then a vector of values is produced.
The global values can only be accessed on timesteps that are multiples
of <I>Nfreq</I> since that is when averaging is performed. Each value
(scalar or vector component) calculated by this fix may be either
"intensive" or "extensive". Intensive means the value is independent
of the number of atoms in the simulation. Extensive means the value
scales with the number of atoms in the simulation. If a compute or
fix provides the value being time averaged, 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 whatever the variable calculates.
</P>
<P>No parameter of this fix can be used with the <I>start/stop</I> keywords of
the <A HREF = "run.html">run</A> command. 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 = "fix_ave_atom.html">fix ave/atom</A>,
<A HREF = "variable.html">variable</A>, <A HREF = "fix_ave_spatial.html">fix ave/spatial</A>, <A HREF = "fix_ave_atom.html">fix
ave/atom</A>
</P>
<P><B>Default:</B> none
</P>
<P>The option defaults no file output, ave = one, and start = 0.
</P>
</HTML>