[lammps-users] problem with fix ave/time


I am seeing confusing results when applying the ‘fix ave/time’ command. It appears that the Nfreq value is somehow related to the current timestep, although this is not obvious from the documentation.

For example, an input file containing these commands produces the expected output file (rdf.nvt):

compute 1 all rdf 300 1 3 1 5 3 5
fix 4 all ave/time 100 20 2000 c_1 file rdf.nvt mode vector
run 2000

However, if previous steps have been run before the compute/fix lines, then the output file only contains header information and no actual data:

run 500
compute 1 all rdf 300 1 3 1 5 3 5
fix 4 all ave/time 100 20 2000 c_1 file rdf.nvt mode vector
run 2000

Even if Nfreq is somehow related to the current timestep, data should have been written to the output file at timestep=2000, and the simulation would have continued for an additional 500 steps. Nfreq should not depend not on the current timestep.

Regards,
Jeff


|

Nfreq should not depend not on the current timestep.

I believe all LAMMPS commands where you specify to do something
every Nfreq timesteps, interpret that to mean do it on timesteps
that are multiples of Nfreq. So if you run 500 steps, then ask for
thermo output or dump files every 1000 steps in the next run,
you will not see output at 500,1500,2500,etc. Rather at
500,1000,2000,3000,etc.

The fix ave/time command is the same. You are asking for output
every 2000 steps and then you start at step 500. The code can’t produce
output on step 2000, b/c that would require averaging from timsteps
100,200,etc up to 2000 (based on the other params you gave it).
But you didn’t invoke the command until
step 500. So the code skips output on step 2000, and will do its
first output on step 4000.

In other words, the code is behaving correctly.

Steve