[lammps-users] fix ave/atom or ave/time

Hi all,

how can we output the time averaged value calculated by command fix ave/atom and ave/time?

I used the following commands;

compute awc all ke
fix 1 all nve
fix ap solid ave/atom 1 100 100 x y z
fix awp all ave/time 1 100 100 c_awc

thermo 100
thermo_style custom step temp press vol etotal ke f_awp cpu
timestep 0.001

dump 2 all atom 100 dump.3ent-nve
dump 3 all custom 100 dump.3ave-nve tag f_ap[1] f_ap[2] f_ap[3]

However, all time averaged values are 0. What is wrong?

Chol-Jun

Are atoms with tags 1,2,3 in the "solid" group? If not,
then the dump custom command will give zeroes. I'd
see if you can dump any of the fix awp to a file if you're
having trouble accessing it from thermo.

Steve

Hello, Steve,

thank you so much for your instruction.

Steve Plimpton wrote:

Are atoms with tags 1,2,3 in the "solid" group? If not,
then the dump custom command will give zeroes.

No, there are so many atoms in the cell. Even if I use all atoms in fix as following,

fix ap all ave/atom 1 100 100 x y z
thermo 100
thermo_style custom step temp press vol etotal
timestep 0.001
dump 3 all custom 100 dump.3ave-nve tag f_ap[1] f_ap[2] f_ap[3]

but the results are still zero. I understood that f_ap[1] means the x coordinate in fix command because (x y z) is a vector and f_ap[i] corresponds to (x y z). If not so, how can I output the averaged coordinates.

I'd see if you can dump any of the fix awp to a file if you're
having trouble accessing it from thermo.

I tested as following,

fix awp all ave/time 1 10 10 c_awc file test.avetime

but in the test.avetime there is no data for averaging value.

Chol-Jun

I'll have to test your examples when I'm
back in my office, next week.

Steve

I added your diagnostic lines to bench/in.lj to yield
the following script. It runs fine in the current
version of LAMMPS. Both the thermo and dump
output of the fix quantities are non-zero and look
good. So I don't see the problem you are having.
Note that on timestep 0 the values are 0.0, but
that is b/c no averaging has been done yet.
On subsequent output steps, the values are non-zero.

Steve

# 3d Lennard-Jones melt

units lj
atom_style atomic

lattice fcc 0.8442
region box block 0 5 0 5 0 5
create_box 1 box
create_atoms 1 box
mass 1 1.0

velocity all create 1.44 87287 loop geom

pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

neighbor 0.3 bin
neigh_modify delay 0 every 20 check no

fix 1 all nve

compute awc all ke
fix ap all ave/atom 1 100 100 x y z
fix awp all ave/time 1 100 100 c_awc

thermo 100
thermo_style custom step temp press vol etotal ke f_awp cpu
timestep 0.001

dump 3 all custom 100 tmp.dump id f_ap[1] f_ap[2] f_ap[3]

run 1000

Thank you so much for your check. I found the mistake in my input script, where I put the command "reset_timestep 0" (because this is in series of MD). When I remove this command, then the time averaging is not zero any more. I was surprised because to my understanding "reset_timestep" is only related to the assigning start time.

Best regards,
Chol-Jun

Steve Plimpton wrote:

The about-to-be-released version of LAMMPS will throw an error
if you use "reset_timestep" when a fix is already in place
that is time dependent, like fix ave.

Steve