A class to generate all possible rotorKeys. More...
#include <openbabel/rotor.h>
Public Member Functions | |
OBRotorKeys () | |
void | Clear () |
unsigned int | NumKeys () |
void | AddRotor (unsigned int size) |
bool | Next () |
std::vector< int > | GetKey () |
A class to generate all possible rotorKeys.
OBRotorKeys | ( | ) | [inline] |
A class to generate all possible rotorKeys.
This class can generate all possible rotor keys for a set of OBRotors which can all have their own resolution. Thanks to Yongjin Xu for this patch.
the code blow is taken from OBForceField::SystematicRotorSearch():
#include <openbabel/rotor.h> #include <openbabel/mol.h> // See OBConversion class to fill the mol object. OBMol mol; OBRotorList rl; OBRotamerList rotamers; rl.Setup(_mol); rotamers.SetBaseCoordinateSets(_mol); rotamers.Setup(_mol, rl); cout << "number of rotatable bonds: " << rl.Size() << endl; if (!rl.Size()) { // only one conformer cout << "generated only one conformer" << endl; // exit here } OBRotorKeys rotorKeys; OBRotorIterator ri; OBRotor *rotor = rl.BeginRotor(ri); for (int i = 1; i < rl.Size() + 1; ++i, rotor = rl.NextRotor(ri)) { // foreach rotor rotorKeys.AddRotor(rotor->GetResolution().size()); } while (rotorKeys.Next()) { std::vector<int> rotorKey = rotorKeys.GetKey(); cout << "rotorKey = " << rotorKey[1] << " " << rotorKey[2] << endl; rotamers.AddRotamer(rotorKey); } rotamers.ExpandConformerList(_mol, _mol.GetConformers());
Constructor
void Clear | ( | void | ) | [inline] |
Clear all rotors.
unsigned int NumKeys | ( | ) | [inline] |
Number of rotor keys (= number of possible conformers)
void AddRotor | ( | unsigned int | size ) | [inline] |
Add a rotor
size | the rotor resolution |
Referenced by OBForceField::SystematicRotorSearchInitialize().
bool Next | ( | ) | [inline] |
Select the next rotor key
Referenced by OBForceField::SystematicRotorSearchInitialize().
std::vector<int> GetKey | ( | ) | [inline] |
Get the currently selected rotor key
Referenced by OBForceField::SystematicRotorSearchInitialize().