[gmx-users] RE: Difference between kinetic energy from .xvg file and calculated kinetic energy from velocities

Samantha Sanders sasander at princeton.edu
Sat Mar 27 14:25:07 CET 2010

On 27/03/2010 1:57 PM, Samantha Sanders wrote:
> Hello!
> I have run a simulation and using g_energy on the .edr file, I have been
> looking at the kinetic energies in the resulting .xvg file. It is my
> understanding that these are the instantaneous kinetic energies for
> those times. However, when I try to calculate the kinetic energy on my
> own using the frames from my trajectory file and being sure to compare
> the same timestamps of the trajectory and the .edr file, I am not
> getting the same values for the kinetic energy. My first question is
> should I get the same values between the two sources: the .xvg file and
> the velocities in the frames of my trajectory file? If so, any
> suggestions for why I may not be getting the same values or if there are
> any other adjustments I should make? I have simply been calculating the
> kinetic energy as the sum of .5mv^2 for all particles. I have read the
> manual and the various mailing list responses and I am still unsure
> about this. There may be something simple I am missing. Any help is
> appreciated. Thank you!

See manual 3.4.4. The leap-frog integration algorithm never computes the 
velocities and positions at the same time point. Thus, your 
after-the-fact computation cannot agree with those reported by GROMACS.


Thank you for your reply.  I understand that the velocities and positions
are not at the same time point.  I am just using the velocities reported
from the trajectory to calculate the kinetic energy.  I am not using the
positions at all.  However, I did look at that section in the manual.  I
think I understand what it is saying now, but let me restate it. Since the
kinetic energy is calculated before velocities are updated in the second and
third steps respectively, when the energy and velocities are output in the
fourth step, the velocities are now different from the ones used to
calculate the outputted energy for that step.  Is this correct?  
	Also, if I understand the algorithm correctly when positions and
velocities are output in the same step, the outputted positions are at t +
deltat and the outputted velocities are at t + (deltat/2).  Correct?   
	Thank you for the help.  I appreciate it very much.


More information about the gromacs.org_gmx-users mailing list