Re: center of mass of dummyAtom in colvar

From: Giacomo Fiorin (giacomo.fiorin_at_temple.edu)
Date: Wed Oct 14 2009 - 19:19:31 CDT

Hi Bin, indeed the blue code you added was missing in the function,
thanks a lot for checking!

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_gmail.com
---- ----

On Wed, Oct 14, 2009 at 8:06 PM, BIN ZHANG <zhngbn_at_gmail.com> wrote:
> Hi, Giacomo:
> Thanks for your reply.
> I had the following lines in my cvConfigFile:
>        group2 {
>            dummyAtom (-10.1433 , -0.251229 , -19.0435) # the initial COM of
> these cyto residues
>        }
> Indeed, the dummy_atom_pos is initialized correctly in the code. However,
> while calculating the distance, where the center_of_mass of a group is
> referenced, it will return zero for the dummy group.
> Thanks,
> Bin
>
> On Oct 14, 2009, at 4:57 PM, Giacomo Fiorin wrote:
>
> 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 - 15:53:22 CST