# Re: question on the center of mass calculation in colvar

From: Giacomo Fiorin (giacomo.fiorin_at_gmail.com)
Date: Sat Apr 16 2011 - 10:33:23 CDT

Hello Hyon, if the coordinates are the ones you wrote during the simulation,
the CM computed for your group "main" is (-1, 0, 0).

Obviously, if you're using wrapAll, that will change the coordinate of one
atom or the other (depending on where the origin of the box is). I suggest
that you disable wrapAll and use just wrapWater (unless you're considering
atoms within water molecules).

Giacomo

---- ----
Giacomo Fiorin - Postdoctoral Researcher
ICMS - Institute for Computational Molecular Science - Temple University
1900 N 12 th Street, Philadelphia, PA 19122
giacomo.fiorin_at_temple.edu
---- ----

On Sat, Apr 16, 2011 at 10:57 AM, Hyonseok Hwang <danggi_at_gmail.com> wrote:

> Dear all,
>
> I know that in the NAMD userguide there is some comments about the the
> center of mass calculations between two groups spanning different
> molecules in the colvar , but I don't quite understand about that. So
> I would like to give an example as my question.
>
> I have two atoms and I want to calculate the distance between the
> center of mass of the two atoms (which are bonded to different
> molecules and have the same mass) and a reference dummy atom. Then I
> may use the colvar module shown below:
>
> colvar {
> name test
>
> distance {
> main {
> two atoms
> }
> ref {
> dummyAtom (0.0, 0.0, 0.0)
> }
>
> }
> }
>
> Assume that the coordinates of the two atoms are (12.0, 0.0, 0,0) and
> (-14.0, 0.0, 0.0), respectively, and the the box size in x direction
> in 15 A.
> Then, to get the distance, the colvar module will calculate the center
> of mass of the two atoms in main. There comes my question. What is the
> center of mass of the two atoms in this case? Is the CM (14.0, 0.0,
> 0.0) or (-1.0, 0.0, 0.0)? I use periodic boundary conditions and the
> keyword "wrapall"
>