Syntax:
fix ID group-ID ave/time Nevery Nfreq compute-ID flag file
Examples:
fix 1 all ave/time 100 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 such as a temperature or pressure.
The compute-ID specifies a compute which calculates the desired property. 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 style 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 and Nfreq arguments specify how the property will be averaged. The property is calculated once each Nevery timesteps. It is averaged and output every Nfreq timesteps. Nfreq must be a multiple of Nevery. In the example above, the property is calculated every 100 steps. After 10 calculations, the average result is written to the file, once every 1000 steps.
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 the fix is ignored. LAMMPS prints a warning if the fix group and compute group do not match.
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.
Restrictions: none
Related commands:
Default: none