Possible bug using ave/time + run 0

Hi,

I'm using the command 'run 0' to get the initial potential energy (pe0) of my system, then I define a 'pe' variable that is the potential energy with an offset equal to the initial potential energy (pe0).

I've used this trick before, it works fine. But now I tried to dump my thermodynamical information using the 'fix ave/time' to output some variables to a file (no time averaging is done). The possible bug happens on the first line of the output file (energy.dat on the scripts that I'm attaching), for some reason that I could not figure out by myself the first line of data has all the signs inverted. The other lines are ok, the first lines of my energy.dat file are:

# Time-averaged data for fix f2
# TimeStep v_etotal v_ke v_pe
0 4.20262 -0.0773766 8.56
1 -4.20262 0.0772262 0.000149827
2 -4.20262 0.0767731 0.000602584
3 -4.20262 0.0760144 0.00136117

(Notice that the kinetic energy v_ke is negative!)

If I remove the 'run 0' line everything is ok (but then I don't have the energy offset that I need):

# Time-averaged data for fix f2
# TimeStep v_etotal v_ke v_pe
2 -4.20262 0.0767731 -4.2794
3 -4.20262 0.0760144 -4.27864

My guess is that it is a conflict between ave/time and the fact that I have 2 steps number 0 (on the 'run 0' and on the 'run 100'.

Cheers,

Rodrigo Freitas

Fe.meam (121 Bytes)

in.lmp (1.86 KB)

my_library.meam (184 Bytes)

Try the 3Dec patch - I think it will fix it. I wasn't seeing
the error you did, but the uninit variable might be the reason.

Steve