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

From: Jérôme Hénin (jhenin_at_ifr88.cnrs-mrs.fr)
Date: Sat Apr 16 2011 - 10:55:11 CDT

Hyon,

When calculating the centers of mass of a group, the colvars just use
NAMD's internal representation of the coordinates, without PBC
treatment. Which means that the group is assumed to be "in one piece",
that is, not split across periodic boundaries. Note that without this
assumption, it would be very complicated for the code to guess which
way the atoms fit together.

In your example, the center would be (-1.0, 0.0, 0.0). If it is not
what you want, you should probably disable wrapAll.

Cheers,
Jerome

On 16 April 2011 16:57, 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"
>