# [gmx-users] BUG in angular removal part??

David van der Spoel spoel at xray.bmc.uu.se
Wed Apr 27 08:24:52 CEST 2011

On 2011-04-26 19.38, Xiaohu Li wrote:
> Hi, gromacs developers,
> It seems that there is a bug regarding the angular moment removal. This
> may not be very important for many users since most of them are doing
> PBC where it is irrelevant, but if you are doing cluster or if you
> really care the angular momentum like I
> do(I want the angular momentum to be exactly zero since this corresponds
> to some quantum resolved state), then it is important.
> The angular momentum removal part in mdlib/vcm.c where it evaluate
> moment of inertia is wrong, subroutine *update_tensor.
> *Specifically, the diagonal part is not calculated right. According to
> either */Classical Mechancs, by Goldstein or Theoretical Mechanics of
> Particles and Continua, by A.L.Fetter and J.D.Walecka.
> I_{xx}=\sum_{i} m_{i}*(r_{i}^2-x_{i}^2), where x can be x,y,z.
> But the /**update_tensor gives
> **/I_{xx}=\sum_{i} m_{i}*(x_{i}^2).
> /*/I initially thought there could be some other routine to correct
> update_tensor, but apparently, it is calculated according to that, and I
> manually calculated them and turns out my theory is right, the
> update_tensor is wrong as it stands.
> /Again, this would not affect, say, 99.999% of the user, but it will
> always be good to have a clean code.
> Thanks
I found the eqn. in Goldstein p 195. I guess this takes care of the
center of mass contribution. So if you center your system in the origin
at time zero the present code should still work. However, we really
should subtract the center of mass.

> /
>
> /Xiaohu/
> /

--
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
spoel at xray.bmc.uu.se    http://folding.bmc.uu.se