[gmx-developers] Re: [gmx-users] positions and velocities of COM of whole water molecules instead of those of individual atoms?

bohumir bohumir at gmail.com
Mon May 18 17:46:50 CEST 2009

>>> Dear GROMACS Masters,
>>> is there a trick to obtain coordinates and velocities of center of
>>> mass of each water molecule?
>> Have a look at g_traj, although to analyze each molecule separately could
>> take many iterations with specific index groups.
> g_traj can really do it (for coordinates), thanks!
> g_traj with -mol option was what I needed. It is documented in the
> third sentence
> of the DESCRIPTION section of g_traj manual...
>   "When  -mol is set, the numbers in the index file are interpreted as molecule
>    numbers and the same procedure as with -com is used for each molecule."
> -Bohumir

Dear GROMACS developers,

for g_traj to output .trr format with -mol option:

  g_traj -mol -f traj.trr -s md.tpr  -n index_res.ndx -oxt traj2.trr

I needed to change fr_av.natoms (in gmx_traj.c) from 2 to ngrps:

cvs diff gmx_traj.c
Index: gmx_traj.c
RCS file: /home/gmx/cvs/gmx/src/tools/gmx_traj.c,v
retrieving revision 1.16
diff -r1.16 gmx_traj.c
<     fr_av.natoms = 2;
>     fr_av.natoms = ngrps;

Otherwise I had only 2 atoms in the output .trr file.

Interestingly, output in .gro format:
  g_traj -mol -f traj.trr -s md.tpr  -n index_res.ndx -oxt traj2.gro
worked fine even without the above modification.

Can you please take a look at it?

Thanks for making GROMACS work for everybody,

PS: I will try to get molecular COM velocity too (in addition to coordinates).

More information about the gromacs.org_gmx-developers mailing list