Rerun, fix ave/atom only output the result for the last timestep

Dear Lammps user,

I ran a simulation to test the rerun output for fix ave/atom. I compared per atom force by outputting from fix ave/atom and directly dump. The results between run and rerun in the dump file are difference. Here is my input:

fix 1 all ave/atom 1 1 1 fx fy fz
dump 1 all custom 1 dump.test id type x y z f_1[1] f_2[2] f_3[3] fx fy fz
dump_modify 1 sort id

run 5

unfix 1
fix 1 all ave/atom 1 1 1 fx fy fz
rerun dump.test dump x y z

Here are the dump for the run and rerun respectively (only pick two atoms as representatives):

The dump result from run:

ITEM: TIMESTEP
765000
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.217 -4.42573 16.5556 -0.338444 -0.0338628 -0.494495 -0.338444 -0.0338628 -0.494495
2 2 -54.4396 -2.5463 16.5178 0.520896 -1.33248 -0.321579 0.520896 -1.33248 -0.321579

ITEM: TIMESTEP
765001
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2191 -4.42448 16.5492 -0.290837 -0.0548452 -0.336676 -0.290837 -0.0548452 -0.336676
2 2 -54.4409 -2.54797 16.5143 0.548 -1.33351 -0.232806 0.548 -1.33351 -0.232806
ITEM: TIMESTEP
765002
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2213 -4.42324 16.5426 -0.24171 -0.0760658 -0.182134 -0.24171 -0.0760658 -0.182134
2 2 -54.442 -2.5501 16.5107 0.572144 -1.32926 -0.144882 0.572144 -1.32926 -0.144882

The output from fix ave/atom and fx fy fz in the dump file are the same in run.

The dump result from rerun:

ITEM: TIMESTEP
765000
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.217 -4.42573 16.5556 0 0 0 -0.338467 -0.0340717 -0.493734
2 2 -54.4396 -2.5463 16.5178 0 0 0 0.520938 -1.33287 -0.320757

ITEM: TIMESTEP
765001
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2191 -4.42448 16.5492 0 0 0 -0.2909 -0.0548794 -0.336745
2 2 -54.4409 -2.54797 16.5143 0 0 0 0.54833 -1.3337 -0.233108

ITEM: TIMESTEP
765002
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2213 -4.42324 16.5426 0 0 0 -0.241795 -0.0761449 -0.181805
2 2 -54.442 -2.5501 16.5107 0 0 0 0.5726 -1.32918 -0.145172

ITEM: TIMESTEP
765003
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2236 -4.42203 16.536 0 0 0 -0.191415 -0.0973218 -0.032688
2 2 -54.4429 -2.55268 16.507 0 0 0 0.593827 -1.31968 -0.0589363

ITEM: TIMESTEP
765004
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2259 -4.42086 16.5293 0 0 0 -0.14097 -0.118181 0.111637
2 2 -54.4435 -2.55572 16.5033 0 0 0 0.610664 -1.30368 0.024525

ITEM: TIMESTEP
765005
ITEM: NUMBER OF ATOMS
281559
ITEM: BOX BOUNDS pp pp pp
-300 300
-300 300
-300 300
ITEM: ATOMS id type x y z f_1[1] f_1[2] f_1[3] fx fy fz
1 2 -56.2283 -4.41972 16.5227 -0.0895541 -0.138876 0.249939 -0.0895541 -0.138876 0.249939
2 2 -54.444 -2.5592 16.4996 0.625361 -1.28246 0.104772 0.625361 -1.28246 0.104772

The output from fix ave/atom are Zero at all timestep except for the last one. It is different from the direct output of fx fy fz.

I test with different timesteps of run ( 5, 10, 100), the output of fix ave/atom is only effective in the last timestep and all others output Zero.

I would be great appreciative if anyone could shed some light for this problem.

Thanks a lot,
Rimei

Dear Lammps user,

I ran a simulation to test the rerun output for fix ave/atom. I compared per
atom force by outputting from fix ave/atom and directly dump. The results
between run and rerun in the dump file are difference. Here is my input:

you must be using an older version of LAMMPS.
apart from an obvious mistake in copying the dump command, which is
easily fixed, this kind of input cannot run with a current version of
LAMMPS.

axel.

Dear Lammps user,

I ran a simulation to test the rerun output for fix ave/atom. I compared per
atom force by outputting from fix ave/atom and directly dump. The results
between run and rerun in the dump file are difference. Here is my input:

fix 1 all ave/atom 1 1 1 fx fy fz
dump 1 all custom 1 dump.test id type x y z f_1[1] f_2[2] f_3[3] fx fy fz
dump_modify 1 sort id

run 5

unfix 1

please insert here:

reset_timestep 0

Dear Dr. Kohlmeyer,

Thanks! The problem solved by inserting the reset_timestep 0. Before
posting this problem, I have tried to insert reset_timestep 0 before the
dump command and the output of fix ave/atom were Zero for both run and
rerun. So, if we want to use fix ave/* to output by rerun, every time we
should reset the timestep to be zero before rerun, right?
Again, thanks a lot. I Really appreciated your prompt reply and help!

Best.
Rimei

Dr. Kohlmeyer,

Thanks. I have another question regarding of dump in rerun.

If I want to dump in different frequency in rerun, for example:

fix 1 all ave/atom 1 1 1 fx fy fz
dump 1 all custom 1 dump.test id type x y z f_1[1] f_2[2] f_3[3] fx fy fz
dump_modify 1 sort id
run 10

I dump every 1 timestep in run. And then when I rerun, I want to take
average using the fix ave/atom, like
Unfix 1
fix 1 all ave/atom 1 2 2 fx fy fz.

This require me to dump every 2 timestep and isn¹t compatible with the
current dump frequency. I could find a command to change the dump
frequency in rerun. Could current lammps version do that? Thanks a lot!

Best,
Rimei

Dr. Kohlmeyer,

Thanks. I have another question regarding of dump in rerun.

If I want to dump in different frequency in rerun, for example:

fix 1 all ave/atom 1 1 1 fx fy fz
dump 1 all custom 1 dump.test id type x y z f_1[1] f_2[2] f_3[3] fx fy fz
dump_modify 1 sort id
run 10

I dump every 1 timestep in run. And then when I rerun, I want to take
average using the fix ave/atom, like
Unfix 1
fix 1 all ave/atom 1 2 2 fx fy fz.

This require me to dump every 2 timestep and isn¹t compatible with the
current dump frequency. I could find a command to change the dump
frequency in rerun. Could current lammps version do that? Thanks a lot!

i didn't want to comment on it, because it was not relevant to the
issue you were describing, but what you are doing is a less than smart
thing: reading a dump while still writing to it. that is a very bad
idea.

so just close the dump after the run command with undump and open a
new, compatible dump for the rerun.

axel.