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

David van der Spoel spoel at xray.bmc.uu.se
Wed Apr 27 19:07:49 CEST 2011

On 2011-04-27 17.58, Xiaohu Li wrote:
>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://lists.gromacs.org/pipermail/gmx-users/attachments/20110427/e5919199/attachment-0001.html
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Wed, 27 Apr 2011 08:24:52 +0200
>> From: David van der Spoel <spoel at xray.bmc.uu.se>
>> Subject: Re: [gmx-users] BUG in angular removal part??
>> To: Discussion list for GROMACS users <gmx-users at gromacs.org>
>> Message-ID: <4DB7B6B4.5090503 at xray.bmc.uu.se>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> 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.
> Mine certainly does not say the same thing. I'm using an older version
> of Goldstein by Addison-Wesley, 1950, seventh printing. Chapter 5, the
> third page, Eqn. 5-6 and 5-7. This does not match the code in gromacs.
Yes, I filed a redmine issue so as not to forget it for the next
release. Nevertheless, the you can use the existing code by centering
your molecule on the origin (I think). If you can fix the code yourself
you could send me a patch too.
>
>>
>>> /
>>>
>>> /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