Colvars: implement a CV which requires computing minimal RMSDs with respect to multiple different reference frames

From: yjcoshc (yjcoshc_at_gmail.com)
Date: Fri Mar 08 2019 - 19:41:00 CST

Dear NAMD and Colvars developers,

I am trying to implement a collective variable (CV) through the C++
interface of Colvars. This CV should accept multiple reference frames
and compute the minimal RMSDs of the current atomic coordinates with
respect of them. In the class of new CV I have tried to add a vector
like "std::vector<cvm::atom_group*> comp_atoms" and then parsed the
selected atoms in the constructor like this loop:

     for (size_t i_frame = 0; i_frame < reference_frames.size();
++i_frame) {
         cvm::atom_group* tmp_atoms = parse_group(conf, "atoms");
         // Swipe from the rmsd class
         tmp_atoms->b_center = true;
         tmp_atoms->b_rotate = true;
         tmp_atoms->ref_pos = reference_frames[i_frame];
         tmp_atoms->center_ref_pos();
         tmp_atoms->disable(f_ag_fit_gradients);
tmp_atoms->rot.request_group1_gradients(tmp_atoms->size());
tmp_atoms->rot.request_group2_gradients(tmp_atoms->size());
         comp_atoms.push_back(tmp_atoms);
     }

However this doesn't work, and the colvars ends up with throwing an
exception of "std::out_of_range" in "basic_string::erase" after the
constructor finishes.

Is there a standard way to compute multiple minimal RMSDs in the C++
interface?

Thanks,

Haochuan Chen

This archive was generated by hypermail 2.1.6 : Tue Dec 31 2019 - 23:20:35 CST