[gmx-developers] Re: printing to edr in source code

Berk Hess hess at cbr.su.se
Wed Sep 9 10:10:32 CEST 2009


You have not told system details nor how you calculate the energies from
the output,
so I have no clue what could be the problem.
In any MD integrator the energies and forces are simply calculated
directly from
the coordinates. In Gromacs these coordinates are written to trr.
If you do mdrun -rerun with a trr file with x(t) and v(t-dt/2) (which is
what mdrun writes)
you get the exact energies back, including kinetic, virial and pressure,
up to numerical rounding errors.

Note that the total energy does not say anything about the forces.

Berk

Inon Sharony wrote:
>
> Thanks for the reply, Berk.
> So, it is as I suspected. But whatabout the potential energy? using
> the positions from the .trr file(extracted using g_traj) the potential
> energy I get is not exactly thesame as that given by the .edr file
> (via g_energy).
>
> Inon.
>
>
> Quoting "Inon Sharony" <InonShar at TAU.ac.IL>:
>
> >
> >
> > Hi GMX developers!
> >
> > (note: if this seems too rudimentary -- I posted first on the users'
> > list but no one picked up the glove...)
> >
> > I'm trying to check that the energies I can calculate using the
> > trajectory output are the same as those given by g_energy. I'm
> > running a diatomic for only a couple of steps and already there are
> > inconsistencies. I'm using g_traj to print out the x's and v's from
> > the .trr file (indouble precision). The steps I'm looking at are at
> > the beginningof the trajectory, but since my initial conditions are
> > zero velocitiesand configuration very close to the energy-minimized
> > one, I don't thinkthere should be any excessively large forces (the
> > total energy is about21 kJ/mole).
> >
> > I suspect that one possible factor could be that the leap-frog
> > algorithm uses trajectory data (i.e. positions and velocities)
> > different from those printed to the trajectory file. For example, it
> > appears that the velocity printed out in the .trr file is notstrictly
> > the velocity at that time-step, but the velocity given by anaverage
> > of the kinetic energies half a time-step forwards and back(since GMX
> > uses the leap-frog algorithm). This has managed to explainthe
> > discrepancy in the kinetic energies (the one given by g_energy andthe
> > one calculated from v's given by g_traj). As for the potentialenergy,
> > I'm still trying to figure that out...
> >
> > Could you please direct me to the file and line in the source code
> > where the kinetic and potential energies are calculated, just before
> > they are printed to the edr file?
> >
> > Thanks very much in advance,
> >
> > --
> > Inon   Sharony
> > ינון     שרוני
> > +972(3)6407634
> > atto.TAU.ac.IL/~inonshar
> > Please consider your environmental responsibility before printing
> > this e-mail.
>
> --
> Inon   Sharony
> ינון     שרוני
> +972(3)6407634
> atto.TAU.ac.IL/~inonshar
> Please consider your environmental responsibility before printing this
> e-mail.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-developers-request at gromacs.org.




More information about the gromacs.org_gmx-developers mailing list