# [gmx-users] a question about removing the rotation

Wei Zhang zhangw at sinr.ac.cn
Fri Oct 17 21:41:01 CEST 2003

```Dear David,

I read the code calculating the inertia momentum. I don't understand in a place.
I think the inertia momentum should be calculated like:
Ixx = sum( m(i)*(y(i)^2+z(i)^2 )
Iyy = sum( m(i)*(z(i)^2+x(i)^2 )
Izz = sum( m(i)*(x(i)^2+y(i)^2 )
But in gromacs code, there is
/* Update inertia tensor */
update_tensor(x[i],m0,vcm->group_i[g]);
..
In update_tensor(...)
static void update_tensor(rvec x,real m0,tensor I)
{
real xy,xz,yz;

/* Compute inertia tensor contribution due to this atom */
xy         = x[XX]*x[YY]*m0;
xz         = x[XX]*x[ZZ]*m0;
yz         = x[YY]*x[ZZ]*m0;
I[XX][XX] += x[XX]*x[XX]*m0;
I[YY][YY] += x[YY]*x[YY]*m0;
I[ZZ][ZZ] += x[ZZ]*x[ZZ]*m0;
I[XX][YY] += xy;
I[YY][XX] += xy;
I[XX][ZZ] += xz;
I[ZZ][XX] += xz;
I[YY][ZZ] += yz;
I[ZZ][YY] += yz;
}

Is it right?

Wei Zhang
zhangw at sinr.ac.cn
2003-10-18

```

More information about the gromacs.org_gmx-users mailing list