Hi, Based on src/conformer.cpp:
OBMol mol; // read a molecule... OBRototList rotorList rotorList.Setup(mol); if (!rotorList.Size()) { // only one conformer return; } // create some random rotor keys RotorKey rotorKey(rotorList.Size() + 1, 0); // indexed from 1 rotorKeys.push_back(rotorKey); OBRandom generator; generator.TimeSeed(); int tries = 0; while (rotorKeys.size() < numConformers && tries < numConformers * 1000) { tries++; // perform random mutation(s) OBRotorIterator ri; OBRotor *rotor = rotorList.BeginRotor(ri); for (int i = 1; i < rotorList.Size() + 1; ++i, rotor = rotorList.NextRotor(ri)) { rotorKey[i] = generator.NextInt() % rotor->GetResolution().size(); } // add the key rotorKeys.push_back(rotorKey); } OBRotamerList rotamers; rotamers.SetBaseCoordinateSets(mol); rotamers.Setup(mol, m_rotorList); // Add all rotor keys for (unsigned int i = 0; i < m_rotorKeys.size(); ++i) rotamers.AddRotamer(m_rotorKeys[i]); // Get conformers for the rotor keys std::vector<double*> conformers; rotamers.ExpandConformerList(mol, conformers); if (conformers.size()) mol.SetConformers(conformers); Most of the code is populating the rotorKeys variable but it outlines how to go from the start to real conformers. Documentation on this is not that clear as you mentioned. Tim On Wed, Jul 25, 2012 at 10:01 PM, Kasper Thofte <kasper.tho...@gmail.com> wrote: > Hello > > I am trying to go from a set of rotorKeys (lists of integers, conforming to > the rotor rules) to a set of conformers attached to the OBMol object, given > a base coordinate set (which I take to mean bond angles and lengths and > dihedrals including non-heavy atoms). > > The example given in the OBRotamerList docs page, > http://openbabel.org/api/current/classOpenBabel_1_1OBRotamerList.shtml#_details, > seems to me to be doing this. However, when I try it and call > mol.NumConformers, I get zero conformers. > > I apologize if this question is answered by looking at the docs, but I'm > kinda stuck here. I just want to go from rotorkeys to multiple conformers in > an OBMol object, given the base coordinates. > > Thanks > > Kasper > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss