center of mass of dummyAtom in colvar

Date: Wed Oct 14 2009 - 16:57:13 CDT

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 ?



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