Hi all,

I noticed that when a molecule has multiple conformations the assignment
operator in OBMol does not copy properly the active conformation  but rather
sets it to be the first one in the conformation set.
I guess this happens because the molecule object does not "remember" the
index of the currently active one but rather just points to it.

It seems to me this is more of a bug than a feature because when copying a
molecule one expects to copy its full state and not resets it to some
arbitrary configuration.

Below are my suggested small modifications to the code in mol.cpp (line
#~1300)  that solve this issue (given the right commit permissions I will
modify the code directly...).

Thanks,
Izhar
--------------------------
//Copy conformer
information

if (src.NumConformers() > 1) {
        int k,l;
        vector<double*> conf;
        double* currConf = NULL;   // NEW


        double* xyz = NULL;
        for (k=0 ; k<src.NumConformers() ; ++k) {
            xyz = new double [3*src.NumAtoms()];
            //for (l=0 ; l<(int) (3*src.NumAtoms()) ;
++l)

            //  xyz[l] = src.GetConformer(k)[l];
            memcpy( xyz, src.GetConformer(k), sizeof( double
)*3*src.NumAtoms() ); // while we are here, this is more efficient than the
above loop
            conf.push_back(xyz);

            if( src.GetConformer(k) == src._c ) { // NEW


              currConf =
src._c;


}

        }

SetConformers(conf);

        if( currConf ) { // NEW


          _c =
currConf;


}

      }
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to