Open Babel  3.0
Public Member Functions | Protected Attributes | List of all members
OBRotamerList Class Reference

#include <openbabel/rotamer.h>

Inheritance diagram for OBRotamerList:
OBGenericData

Public Member Functions

 OBRotamerList ()
 
virtual OBGenericDataClone (OBBase *parent) const
 
 ~OBRotamerList ()
 
void Setup (OBMol &, OBRotorList &)
 
void Setup (OBMol &mol, unsigned char *ref, int nrotors)
 
unsigned int NumRotors () const
 
unsigned int NumRotamers () const
 
void AddRotamer (double *)
 
void AddRotamer (int *key)
 
void AddRotamer (std::vector< int > key)
 
void AddRotamer (unsigned char *key)
 
void AddRotamers (unsigned char *arr, int nconf)
 
void GetReferenceArray (unsigned char *) const
 
std::vector< double * > CreateConformerList (OBMol &mol)
 
void ExpandConformerList (OBMol &mol, std::vector< double *> &confs)
 
bool SetCurrentCoordinates (OBMol &mol, std::vector< int > arr)
 
void SetBaseCoordinateSets (OBMol &mol)
 
void SetBaseCoordinateSets (std::vector< double *> bc, unsigned int N)
 
unsigned int NumBaseCoordinateSets () const
 
double * GetBaseCoordinateSet (unsigned int i) const
 
unsigned int NumAtoms () const
 
void SetAttribute (const std::string &v)
 
void SetOrigin (const DataOrigin s)
 
virtual const std::string & GetAttribute () const
 
unsigned int GetDataType () const
 
virtual const std::string & GetValue () const
 
virtual DataOrigin GetOrigin () const
 
Iterator methods
std::vector< unsigned char * >::iterator BeginRotamer ()
 
std::vector< unsigned char * >::iterator EndRotamer ()
 

Protected Attributes

std::string _attr
 
unsigned int _type
 
DataOrigin _source
 

Detailed Description

Supports a set of rotamer coordinate sets for some number of potentially rotatable bonds.

A high-level class for rotamer / conformer generation, intended mainly for use with the related class OBRotorList and the OBRotorRules database

Rotamers represent conformational isomers formed simply by rotation of dihedral angles. On the other hand, conformers may include geometric relaxation (i.e., slight modification of bond lengths, bond angles, etc.)

The following shows an example of generating 2 conformers using different rotor states. Similar code could be used for systematic or Monte Carlo conformer sampling when combined with energy evaluation (molecular mechanics or otherwise).

OBRotorList rl; // used to sample all rotatable bonds via the OBRotorRules data
// If you want to "fix" any particular atoms (i.e., freeze them in space)
// then set up an OBBitVec of the fixed atoms and call
// rl.SetFixAtoms(bitvec);
rl.Setup(mol);
// How many rotatable bonds are there?
cerr << " Number of rotors: " << rl.Size() << endl;
// indexed from 1, rotorKey[0] = 0
std::vector<int> rotorKey(rl.Size() + 1, 0);
// each entry represents the configuration of a rotor
// e.g. indexes into OBRotor::GetResolution() -- the different angles
// to sample for a rotamer search
for (unsigned int i = 0; i < rl.Size() + 1; ++i)
rotorKey[i] = 0; // could be anything from 0 .. OBRotor->GetResolution().size()
// -1 is for no rotation
// The OBRotamerList can generate conformations (i.e., coordinate sets)
OBRotamerList rotamers;
rotamers.SetBaseCoordinateSets(mol);
rotamers.Setup(mol, rl);
rotamers.AddRotamer(rotorKey);
rotorKey[1] = 2; // switch one rotor
rotamers.AddRotamer(rotorKey);
rotamers.ExpandConformerList(mol, mol.GetConformers());
// change the molecule conformation
mol.SetConformer(0); // rotorKey 0, 0, ...
conv.Write(&mol);
mol.SetConformer(1); // rotorKey 0, 2, ...

Constructor & Destructor Documentation

◆ OBRotamerList()

OBRotamerList ( )
inline

◆ ~OBRotamerList()

Member Function Documentation

◆ Clone()

OBGenericData * Clone ( OBBase parent) const
virtual

Reimplemented from OBGenericData.

◆ Setup() [1/2]

void Setup ( OBMol mol,
OBRotorList rl 
)

◆ Setup() [2/2]

void Setup ( OBMol mol,
unsigned char *  ref,
int  nrotors 
)

Set up a rotamer list based on the supplied reference atoms and the number of rotors

Parameters
molThe molecule to evaluate
refAn array of the 4 dihedral atoms for each rotor
nrotorsThe number of rotors (i.e., the size of ref / 4)

◆ NumRotors()

unsigned int NumRotors ( ) const
inline
Returns
the number of rotatable bonds considered

◆ NumRotamers()

unsigned int NumRotamers ( ) const
inline
Returns
the number of rotamer (conformation) coordinate sets

◆ AddRotamer() [1/4]

void AddRotamer ( double *  c)

Add a rotamer to the list based on the supplied coordinate set as a double*.

Referenced by OBConformerSearch::GetConformers(), OBForceField::RandomRotorSearchInitialize(), OBConformerSearch::Setup(), and OBForceField::SystematicRotorSearchInitialize().

◆ AddRotamer() [2/4]

void AddRotamer ( int *  key)

Add a rotamer to the list based on key as a configuration of the individual rotor bonds.

◆ AddRotamer() [3/4]

void AddRotamer ( std::vector< int >  key)

Add a rotamer to the list based on key as a configuration of the individual rotor bonds.

◆ AddRotamer() [4/4]

void AddRotamer ( unsigned char *  key)

Add a rotamer to the list based on key as a configuration of the individual rotor bonds.

◆ AddRotamers()

void AddRotamers ( unsigned char *  arr,
int  nconf 
)

Add nconf rotamers based on as an array of configurations much like AddRotamer()

Referenced by OBRotamerList::Clone().

◆ GetReferenceArray()

void GetReferenceArray ( unsigned char *  ref) const
Returns
A reference array (as used by AddRotamer() as a configuration of the individual rotor bonds

◆ BeginRotamer()

std::vector<unsigned char*>::iterator BeginRotamer ( )
inline

◆ EndRotamer()

std::vector<unsigned char*>::iterator EndRotamer ( )
inline

◆ CreateConformerList()

vector< double * > CreateConformerList ( OBMol mol)

Create a conformer list using the internal base set of coordinates.

Returns
The set of coordinates by rotating the bonds in each rotamer

◆ ExpandConformerList()

void ExpandConformerList ( OBMol mol,
std::vector< double *> &  confs 
)

Create a conformer list using the internal base set of coordinates.

Returns
The set of coordinates as a reference in confs

Referenced by OBConformerSearch::GetConformers(), OBForceField::RandomRotorSearchInitialize(), OBConformerSearch::Setup(), and OBForceField::SystematicRotorSearchInitialize().

◆ SetCurrentCoordinates()

bool SetCurrentCoordinates ( OBMol mol,
std::vector< int >  arr 
)

Change the current coordinate set

Since
version 2.2

Referenced by OBForceField::FastRotorSearch(), OpenBabel::UpdateConformersFromTree(), and OBForceField::WeightedRotorSearch().

◆ SetBaseCoordinateSets() [1/2]

void SetBaseCoordinateSets ( OBMol mol)

◆ SetBaseCoordinateSets() [2/2]

void SetBaseCoordinateSets ( std::vector< double *>  bc,
unsigned int  N 
)

Copies the coordinates in bc, NOT the pointers, into this object.

Parameters
bcThe conformer set for the molecule
NThe number of atoms in the molecule

◆ NumBaseCoordinateSets()

unsigned int NumBaseCoordinateSets ( ) const
inline
Returns
The number of "base" coordinate sets (i.e., the number of conformers in the base OBMol)

◆ GetBaseCoordinateSet()

double* GetBaseCoordinateSet ( unsigned int  i) const
inline

Get a pointer to a specific base pointer (i.e., specific conformer)

◆ NumAtoms()

unsigned int NumAtoms ( ) const
inline
Returns
The number of atoms in the base OBMol

◆ SetAttribute()

void SetAttribute ( const std::string &  v)
inlineinherited

◆ SetOrigin()

void SetOrigin ( const DataOrigin  s)
inlineinherited

◆ GetAttribute()

virtual const std::string& GetAttribute ( ) const
inlinevirtualinherited
Returns
The attribute (key), which can be used to retrieve this data

Referenced by OpenBabel::extract_thermochemistry(), and OBMoleculeFormat::MakeCombinedMolecule().

◆ GetDataType()

unsigned int GetDataType ( ) const
inlineinherited
Returns
the data type for this object as defined in OBGenericDataType

◆ GetValue()

virtual const std::string& GetValue ( ) const
inlinevirtualinherited

Base class returns a default value (the attribute type) but should never be called.

Reimplemented in OBPairData, and OBCommentData.

Referenced by OBDepict::AddAtomLabels(), OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), and OBDescriptor::GetValues().

◆ GetOrigin()

virtual DataOrigin GetOrigin ( ) const
inlinevirtualinherited

Member Data Documentation

◆ _attr

std::string _attr
protectedinherited

attribute tag (e.g., "UnitCell", "Comment" or "Author")

Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().

◆ _type

unsigned int _type
protectedinherited

attribute type – declared for each subclass

Referenced by OBRotamerList::Clone(), and OBNasaThermoData::OBNasaThermoData().

◆ _source

DataOrigin _source
protectedinherited

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