<HTML>
<CENTER><A HREF = "https://sparta.github.io">SPARTA WWW Site</A> - <A HREF = "Manual.html">SPARTA Documentation</A> - <A HREF = "Section_commands.html#comm">SPARTA Commands</A> 
</CENTER>






<HR>

<H3>stats_modify command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>stats_modify keyword value ... 
</PRE>
<UL><LI>one or more keyword/value pairs may be listed 

<LI>keyword = <I>flush</I> or <I>format</I> or <I>every</I> 

<PRE>  <I>flush</I> value = <I>yes</I> or <I>no</I>
  <I>format</I> values = <I>line</I> string, <I>int</I> string, <I>float</I> string, M string, or <I>none</I>
    string = C-style format string
    M = integer from 1 to N, where N = # of quantities being output
  <I>every</I> value = v_name
    v_name = an equal-style variable name 
</PRE>

</UL>
<P><B>Examples:</B>
</P>
<PRE>stats_modify flush yes
stats_modify format 3 %15.8g
stas_modify format line "%ld %g %g %15.8g" 
</PRE>
<P><B>Description:</B>
</P>
<P>Set options for how statistical information is computed and printed by
SPARTA.
</P>
<P>The <I>flush</I> keyword invokes a flush operation after statistical info
is written to the log file.  This insures the output in that file is
current (no buffering by the OS), even if SPARTA halts before the
simulation completes.
</P>
<P>The <I>format</I> keyword can be used to change the default numeric format
of any of quantities the <A HREF = "stats_style.html">stats_style</A> command
outputs.  All the specified format strings are C-style formats,
e.g. as used by the C/C++ printf() command.  The <I>line</I> keyword takes
a single argument which is the format string for the entire line of
stats output, with N fields, which you must enclose in quotes if it is
more than one field.  The <I>int</I> and <I>float</I> keywords take a single
format argument and are applied to all integer or floating-point
quantities output.  The setting for <I>M string</I> also takes a single
format argument which is used for the Mth value output in each line,
e.g. the 5th column is output in high precision for "format 5
%20.15g".
</P>
<P>The <I>format</I> keyword can be used multiple times.  The precedence is
that for each value in a line of output, the <I>M</I> format (if specified)
is used, else the <I>int</I> or <I>float</I> setting (if specified) is used,
else the <I>line</I> setting (if specified) for that value is used, else
the default setting is used.  A setting of <I>none</I> clears all previous
settings, reverting all values to their default format.
</P>
<P>NOTE: The stats output values <I>step</I> and <I>atoms</I> are stored internally
as 8-byte signed integers, rather than the usual 4-byte signed
integers.  When specifying the <I>format int</I> option you can use a
"%d"-style format identifier in the format string and SPARTA will
convert this to the corresponding 8-byte form when it is applied to
those keywords.  However, when specifying the <I>line</I> option or <I>format
M string</I> option for <I>step</I> and <I>natoms</I>, you should specify a format
string appropriate for an 8-byte signed integer, e.g. one with "%ld".
</P>
<P>The <I>every</I> keyword allows a variable to be specified which will
determine the timesteps on which statistical output is generated.  It
must be an <A HREF = "variable.html">equal-style variable</A>, and is specified as
v_name, where name is the variable name.  The variable is evaluated at
the beginning of a run to determine the next timestep at which a dump
snapshot will be written out.  On that timestep, the variable will be
evaluated again to determine the next timestep, etc.  Thus the
variable should return timestep values.  See the stagger() and
logfreq() math functions for <A HREF = "variable.html">equal-style variables</A>, as
examples of useful functions to use in this context.  Other similar
math functions could easily be added as options for <A HREF = "variable.html">equal-style
variables</A>.  In addition, statistical output will always
occur on the first and last timestep of each run.
</P>
<P>For example, the following commands will output statistical info at
timesteps 0,10,20,30,100,200,300,1000,2000,etc:
</P>
<PRE>variable	s equal logfreq(10,3,10)
stats_modify	1 every v_s 
</PRE>
<P>Note that the <I>every</I> keyword overrides the output frequency setting
made by the <A HREF = "stats.html">stats</A> command, by setting it to 0.  If the
<A HREF = "stats.html">stats</A> command is later used to set the output frequency
to a non-zero value, then the variable setting of the stats_modify
every command will be overridden.
</P>
<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "stats.html">stats</A>, <A HREF = "stats_style.html">stats_style</A>
</P>
<P><B>Default:</B>
</P>
<P>The option defaults are flush = no, format int = "%8d", format float =
"%12.8g", and every = non-variable setting provided by the
<A HREF = "stats.html">stats</A> command.
</P>
</HTML>
