[gmx-developers] Re: g_dist and vsite

Berk Hess hess at cbr.su.se
Thu Mar 11 14:36:44 CET 2010


Ilya Chorny wrote:
> I have been having problems calculating the distance between CA and CB
> atoms in ALA using g_dist. The trajectory was run using vsite so the
> mass of CB in ALA is set to 0. Since g_dist calculates distances
> between the center of mass of the groups if one of the groups has a
> mass of zero there will be an error.
>
> I am going to edit gmx_dist as follows. Does anyone see any glaring
> issues with doing this?
Yes.
com[g] will always be zero when you add m*x with m=0.

I pasted a fix for groups of one vsite only below.
I'll commit that .

Berk

For
/* calculate center of masses */
    for(g=0;(g<ngrps);g++) {
      if (isize[g] == 1) {
    copy_rvec(x[index[g][0]],com[g]);
      } else {
    for(d=0;(d<DIM);d++) {
      com[g][d]=0;
      for(i=0;(i<isize[g]);i++) {
        com[g][d] += x[index[g][i]][d] * top->atoms.atom[index[g][i]].m;
      }
      com[g][d] /= mass[g];
    }
      }
    }

>
> Thanks,
>
> Ilya
>
> previous:
>
> com[g][d] /= mass[g];
>
> new:
>
> if mass[g] > 0.0
>         com[g][d] /= mass[g];
>
>
> -- 
> Ilya Chorny Ph.D.
>




More information about the gromacs.org_gmx-developers mailing list