Nevery, Nrepeat & Nfreq

Submitted by jrpb on Tue, 07/17/2012 - 23:22

I want to dump a velocity profile, averaged over pre-defined layers. To my surprise, there's a LIGGGHTS fix that does exactly this (ave/spatial).

I'm a little confused regarding the options: Nevery, Nrepeat & Nfreq. I've been experimenting with it but I'm still not 100% confident of what I'm doing.

What I think each option does:

Nevery: fetches new values every N steps
Nrepeat: not really sure.
Nfreq: compute average every N steps.

If Nevery equals Nfreq, Nrepeat must equal 1 and the output is straightforward: a single calculation. For instance, if I'm running 50K steps, the following command:

fix vprof all ave/spatial 50000 1 50000 y lower ${large_sigma} vx units box file post/vel.profile

will dump one value per layer. In particular, the vx average over the number of particles in that layer @ step 50000.

However, what if Nevery < Nfreq. Suppose:

fix vprof all ave/spatial 10000 1 50000 y lower ${large_sigma} vx units box file post/vel.profile

Will this fetch new values every 10K steps and calculate an ave @50K using the last fetch? How about 10000 5 50000?

Thanks in advance for any light on this.

knoe_ph | Wed, 07/18/2012 - 09:38

Hallo jrpb,

it is described quite well in the documentation:

The Nevery, Nrepeat, and Nfreq arguments specify on what timesteps the input values will be used to bin them into layers and contribute to the average. The final averaged quantities are generated every Nfreq timesteps. The average is over Nrepeat quantities, computed in the preceding portion of the simulation every Nevery timesteps. Nfreq must be a multiple of Nevery and Nevery must be non-zero even if Nrepeat is 1. Also, the timesteps contributing to the average value cannot overlap, i.e. Nfreq > (Nrepeat-1)*Nevery is required.

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.

so Nrepeat gives you the number of values which are used for generating your (single) average value.

kind regards,
Philipp

jrpb | Fri, 07/20/2012 - 07:57

I don't know how I missed that one *blushes*.

Thank you very much Philipp.