Open Babel  3.0
Public Member Functions | List of all members
OBRotorKeys Class Reference

#include <openbabel/rotor.h>

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()

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/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;
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

Member Function Documentation

◆ Clear()

void Clear ( void  )
inline

Clear all rotors.

◆ NumKeys()

unsigned int NumKeys ( )
inline

Number of rotor keys (= number of possible conformers)

◆ AddRotor()

void AddRotor ( unsigned int  size)
inline

Add a rotor

Parameters
sizethe rotor resolution

Referenced by OBForceField::SystematicRotorSearchInitialize(), and OpenBabel::UpdateConformersFromTree().

◆ Next()

bool Next ( )
inline

Select the next rotor key

Returns
true if there are more rotor keys

Referenced by OBForceField::SystematicRotorSearchInitialize().

◆ GetKey()

std::vector<int> GetKey ( )
inline

Get the currently selected rotor key

Returns
current rotor key

Referenced by OBForceField::SystematicRotorSearchInitialize().


The documentation for this class was generated from the following file: