# [gmx-users] Which variable represents the potential energy ?

masakatsu-ito at aist.go.jp masakatsu-ito at aist.go.jp
Sun Dec 7 23:09:01 CET 2003

```Dear David,

> > So I am trying to use my code instead of update() for integrating
> > EOM. That is, my REMD framework would pass the atom positions to
> > do_force() function of GROMACS, and would receive the the potential
> > energy and force vector.  Then my framework integrates equations of
> > motion with the Gaussian thermostatting technique.
;
> > So I have a favor to ask of you and any of GROMACS people.  Would you
> > kindly tell me which part of do_md() is responsible for dealing with
> > the periodic boundary condition? I think I have to shift an atom
> > position when the atom happens to cross the boundary of a box. But I
> > cannot find which function shift atom positions in do_md().
>
> part of it is in force.c
> part of it is in update.c
>
> I doubt whether your code should be doing any PBC. Why do you think
> that?

Because I would like to minimize the modification of GROMACS code.
But if I can find out which variables of GROMACS define a box for
periodic boundary condition, it would be easier that my REMD framework
shift an atom position.

So could you please tell me if box_size[] variables in do_md() defines
the box for PBC? Can I shift i'th atom position (x[3*i], x[3*i+1],
x[3*i+2]) in a way like the following?

x[3*i    ] = x[3*i] -
floor( x[3*i] / box_size[0] ) * box_size[0];    // for x
x[3*i + 1] = x[3*i + 1] -
floor( x[3*i +1] / box_size[1] ) * box_size[1]; // for y
x[3*i + 2] = x[3*i + 2] -
floor( x[3*i +2] / box_size[2] ) * box_size[2]; // for z

> > The other question is about sum_epot(). Would you kindly tell me why
> > sum_epot() is not called immediately after calling do_force() in
> > do_md() function? Should I call another function between do_force()
> > and sum_epot() to get the potential energy?
> >
> because there are corrections which depend on virial (long range
> corrections) which should be summed first, in particular when running in
> parallel

Then, does that long range correction work if I remove
the update() procedure in do_md() function?
And, is update() function unnecessary for calculating the potential
energy and force vector?

(I feel sorry that I ask too many questions.)
Masakatsu

Masakatsu Ito , Ph.D

Grid Technology Research Center
National Institute of Advanced Industrial Science and Technology
Tsukuba Central 2, Tsukuba, Ibaraki 305-8568 Japan
Phone : +81-29-861-5730  Fax : +81-29-861-5301
E-mail masakatsu-ito at aist.go.jp

```