Re: center of mass of dummyAtom in colvar

From: Giacomo Fiorin (giacomo.fiorin_at_temple.edu)
Date: Wed Oct 14 2009 - 18:57:43 CDT

Hi Bin, dummy_atom_pos is initialized earlier on, after the argument
of "dummyAtom". Did you experience that this position is still zero
(the origin) even when you give it some other point in space?

Giacomo

---- ----
 Giacomo Fiorin
   ICMS - Institute for Computational Molecular Science
     Temple University
     1900 N 12 th Street, Philadelphia, PA 19122
 work phone: (+1)-215-204-4216
 mobile: (+1)-267-324-7676
 mail: giacomo.fiorin_at_temple.edu
---- ----

On Wed, Oct 14, 2009 at 5:57 PM, BIN ZHANG <zhngbn_at_gmail.com> wrote:
> Hi, all:
> While experiencing with the newly available and great colvar module, I found
> a strange behavior for the *dummyAtom* option. It seems to me that the
> center of mass for the dummy atom would always be zero with the current code
> in the CVS. Actually, looking at the function atom_group::center_of_mass()
> in the colvaratoms.C file, it looks like a bug to me. The blue code I added
> myself, should be necessary to get the correct center of mass, I think.
> Does this make sense to you ?
> Thanks,
> Bin
> ===============================================
> cvm::atom_pos cvm::atom_group::center_of_mass() const
> {
>   if (b_dummy) {
>     return dummy_atom_pos;
>   }
>   cvm::atom_pos com (0.0, 0.0, 0.0);
>   for (cvm::atom_const_iter ai = this->begin();
>        ai != this->end(); ai++) {
>     com += ai->mass * ai->pos;
>   }
>   com /= this->total_mass;
>   return com;
> }
>

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:22:27 CST