lammps/doc/fix_ave_time.html

186 lines
8.2 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 style ID 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 property every this many timesteps
<LI>Nrepeat = # of times to repeat the Nevery calculation before averaging
<LI>Nfreq = timestep frequency at which the average value is computed
<LI>style = <I>compute</I> or <I>fix</I>
<LI>ID = ID of compute or fix that performs the calculation
<LI>zero or more keyword/arg pairs may be appended
<LI>keyword = <I>type</I> or <I>file</I> or <I>ave</I>
<PRE> <I>type</I> arg = <I>scalar</I> or <I>vector</I> or <I>both</I>
scalar = single scalar value from fix or compute
vector = vector of values from fix or compute
both = both a single value and vector of values from fix or compute
<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 new average value every Nfreq steps
running = output cummulative average of all previous Nfreq steps
window M = output average of M most recent Nfreq steps
</PRE>
</UL>
<P><B>Examples:</B>
</P>
<PRE>fix 1 all ave/time 100 5 1000 compute myTemp
fix 1 all ave/time 100 5 1000 compute myTemp ave window 20
fix 1 all ave/time 1 100 1000 fix indenter value both file temp.indent
</PRE>
<P><B>Description:</B>
</P>
<P>Calculate one or more instantaneous quantities every few timesteps,
and average them over a longer timescale. 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 also written to a file.
</P>
<P>This fix can be used to time-average a <A HREF = "compute.html">compute</A> which
calculates a global quantity such as a temperature or pressure or a
<A HREF = "fix.html">fix</A> which calculates a global quantity. Note that per-atom
quantities cannot be averaged with this fix; their values can be
averaged by the <A HREF = "fix_ave_spatial.html">fix ave/spatial</A> or <A HREF = "fix_ave_atom.html">fix
ave/atom</A> commands.
</P>
<P>Since the calculation is performed by the compute or fix which stores
its own "group" definition, the group specified as part of the fix
ave/time command is ignored.
</P>
<P>For style <I>compute</I> the <I>ID</I> specifies a <A HREF = "compute.html">compute</A> which
calculates the desired property. The compute must be a "global"
compute that calculates one or more global properties rather than a
"per-atom" compute. However, there is a <A HREF = "compute_sum.html">compute
sum</A> command which sums per-atom quantities into a
global scalar or vector which can be accessed by fix ave/time.
</P>
<P>The compute must be previously defined in the input script. Or it can
be a compute defined 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>. Users can write code for their
own compute styles and <A HREF = "Section_modify.html">add them to LAMMPS</A>.
</P>
<P>For style <I>fix</I> the <I>ID</I> specifies a <A HREF = "fix.html">fix</A> which calculates
the desired property. The fix must calculate a global scalar or
vector quantity, which only a few fixes do. See the doc page for
individual fix commands for details. The fix must be previously
defined in the input script. Users can write code for their own fix
styles and <A HREF = "Section_modify.html">add them to LAMMPS</A>.
</P>
<P>The <I>Nevery</I>, <I>Nrepeat</I>, and <I>Nfreq</I> arguments specify on what
timesteps the property will be evaluated in order to contribute to the
average. The final averaged value(s) are computed every <I>Nfreq</I>
timesteps. The average is over <I>Nrepeat</I> values, computed in the
preceeding 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.
</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. Similary for timesteps 190,192,194,196,198,200 on
timestep 200, etc.
</P>
<HR>
<P>Additional optional keywords also affect the operation of this fix.
</P>
<P>The <I>type</I> keyword chooses whether the scalar and/or vector quantities
produced by the compute or fix are used. For a setting of <I>scalar</I> a
single global value is used. For a setting of <I>vector</I> N global
values are used, where N is defined by the compute or fix, e.g. 6
pressure tensor components. For a setting of <I>both</I>, both a scalar
the vector values are used. When vectors are used, each of the N
values is averaged independently.
</P>
<P>The <I>file</I> keyword allows a filename to be specified. The scalar
and/or N vector quantities are written to the file 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
cummulative sense before being output. Each output value is thus the
average of the value produced on that timestep with all preceeding
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 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>
<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>Depending on the setting of the <I>type</I> parameter, this fix computes a
scalar and/or a vector of quantities which can be accessed by various
<A HREF = "Section_howto.html#4_15">output commands</A>. The values should only be
accessed on timesteps that are multiples of <I>Nfreq</I> since that is when
averaging is performed.
</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>
</P>
<P>If the style is <I>compute</I> and the specified compute calculates
pressure, it will cause the force computations performed by LAMMPS
(pair, bond, angle, etc) to calculate virial terms each Nevery
timesteps. If this is more frequent than thermodynamic output, this
adds extra cost to a simulation. However, if a constant pressure
simulation is being run (<A HREF = "fix_npt.html">fix npt</A> or <A HREF = "fix_nph.html">fix
nph</A>), LAMMPS is already calculating virial terms for the
pressure every timestep.
</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 = "fix_ave_spatial.html">fix
ave/spatial</A>
</P>
<P><B>Default:</B> none
</P>
<P>The option defaults are type = scalar, no file output, and ave = one.
</P>
</HTML>