[gmx-users] the neighbour getting

Erik Lindahl lindahl at stanford.edu
Mon Sep 9 19:18:48 CEST 2002


alexander yakovenko wrote:
> Hi All,
> 
> Does you know how to get the neighbour molecules from the trajectory file?
> I need to make the .ndx file with the group of water molecules, which located no more than 5A from residue 1 of my protein.

Just write a small analysis program that calculates it directly from the 
coordinates. In theory you could of course dump the neighborlist from 
Gromacs, but since that extends to 10A it will be much longer (and 
written every 10 steps).


The basic code is trivial (check the template analysis program and all
the stuff in src/tools):

For each frame:
    caculate the center for residue 1.
    for each water:
       calcuate the distance dx,dy,dz between water oxygen and res1.
       foreach x,y,z:
          if dx/dy/dz>=box/2 dx/dy/dz-=box;
          if dx/dy/dz<-box/2 dx/dy/dz+=box;
       dist=sqrt(dx*dx+dy*dy+dz*dz);
       do something with the water if it's in range.



Cheers,

Erik






More information about the gromacs.org_gmx-users mailing list