OBRotorKeys Class Reference

A class to generate all possible rotorKeys. More...

#include <openbabel/rotor.h>

List of all members.

Public Member Functions

 OBRotorKeys ()
void Clear ()
unsigned int NumKeys ()
void AddRotor (unsigned int size)
bool Next ()
std::vector< int > GetKey ()

Detailed Description

A class to generate all possible rotorKeys.

Constructor & Destructor Documentation

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;

      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

      while (rotorKeys.Next()) {
        std::vector<int> rotorKey = rotorKeys.GetKey();
        cout << "rotorKey = " << rotorKey[1] << " " << rotorKey[2] << endl;

      rotamers.ExpandConformerList(_mol, _mol.GetConformers());


Member Function Documentation

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

true if there are more rotor keys

Referenced by OBForceField::SystematicRotorSearchInitialize().

std::vector<int> GetKey (  )  [inline]

Get the currently selected rotor key

current rotor key

Referenced by OBForceField::SystematicRotorSearchInitialize().

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines