LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

fix ave/time command

Syntax:

fix ID group-ID ave/time Nevery Nrepeat Nfreq compute-ID flag file 

Examples:

fix 1 all ave/time 100 5 1000 myTemp 0 temp.stats 

Description:

Calculate one or more instantaneous quantities every few timesteps, average them over a longer timescale, and print the results to a file. This can be used to time-average any "compute" entity in LAMMPS which calculates a global quantity such as a temperature or pressure. Per-atom computes cannot be used with this fix.

The compute-ID specifies a compute 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. The compute can be previously defined in the input script. Or it can be a compute defined by thermodynamic output or other fixes such as fix nvt or fix temp/rescale. Users can also write code for their own compute styles and add them to LAMMPS.

In all these cases, the fix ave/time command uses the global scalar or vector calculated by the compute. See the fix ave/spatial command if you wish to average spatially, e.g. via a compute that calculates per-atom quantities.

The Nevery, Nrepeat, and Nfreq arguments specify how the property will be time-averaged. The final averaged value(s) are computed every Nfreq timesteps. The average is over Nrepeat values, computed in the preceeding portion of the simulation every Nevery timesteps. Thus 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 written to the file on timestep 100. Similary for timesteps 190,192,194,196,198,200 on timestep 200, etc.

The flag argument chooses whether the scalar and/or vector calculation of the compute is invoked. The former computes a single global value. The latter computes N global values, where N is defined by the compute, e.g. 6 pressure tensor components. In the vector case, each of the N values is averaged independently and N values are written to the file at each output.

Since the calculation is performed by the compute which stores its own "group" definition, the group specified for this fix is ignored.

If the 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 (fix npt or fix nph), LAMMPS is already calculating virial terms for the pressure every timestep.

Restart, fix_modify, thermo output, run start/stop, minimize info:

No information about this fix is written to binary restart files. None of the fix_modify options are relevant to this fix. No quantities calculated by this fix can be output by the thermo_style custom command. No parameter of this fix can be used with the start/stop keywords of the run command. This fix is not invoked during energy minimization.

Restrictions: none

Related commands:

compute, fix ave/spatial

Default: none