Open Babel: OBRotamerList Class Reference

Public Member Functions | Protected Attributes

# OBRotamerList Class Reference

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

`#include <openbabel/rotamer.h>`

Inheritance diagram for OBRotamerList:

List of all members.

## Public Member Functions
| OBRotamerList ()
virtual OBGenericData * | Clone (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)
void | 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 | ( | ) | `[inline]`

~OBRotamerList | ( | ) |

## Member Function Documentation

OBGenericData * Clone | ( | OBBase * | parent ) | const`[virtual]`

Reimplemented from OBGenericData.

void Setup | ( | OBMol & | mol,
|  | OBRotorList & | rl
| ) |  |

Set up a rotamer list based on an already created OBRotorList.

Referenced by OBRotamerList::Clone(), OBConformerSearch::GetConformers(), OBForceField::RandomRotorSearchInitialize(), OBForceField::SystematicRotorSearchInitialize(), and OBForceField::WeightedRotorSearch().

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:

  mol | The molecule to evaluate
  ref | An array of the 4 dihedral atoms for each rotor
  nrotors | The number of rotors (i.e., the size of ref / 4)

unsigned int NumRotors | ( | ) | const`[inline]`

Returns:
  the number of rotatable bonds considered

unsigned int NumRotamers | ( | ) | const`[inline]`

Returns:
  the number of rotamer (conformation) coordinate sets

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(), and OBForceField::SystematicRotorSearchInitialize().

void AddRotamer | ( | int * | key ) |

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

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

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

void AddRotamer | ( | unsigned char * | key ) |

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

void AddRotamers | ( | unsigned char * | arr,
|  | int | nconf
| ) |  |

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

Referenced by OBRotamerList::Clone().

void GetReferenceArray | ( | unsigned char * | ref ) | const

Returns:
  A reference array (as used by AddRotamer() as a configuration of the individual rotor bonds

std::vector<unsigned char*>::iterator BeginRotamer | ( | ) | `[inline]`

std::vector<unsigned char*>::iterator EndRotamer | ( | ) | `[inline]`

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

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(), and OBForceField::SystematicRotorSearchInitialize().

void SetCurrentCoordinates | ( | OBMol & | mol,
|  | std::vector< int > | arr
| ) |  |

Change the current coordinate set

Since:
  version 2.2

Referenced by OBForceField::WeightedRotorSearch().

void SetBaseCoordinateSets | ( | OBMol & | mol ) | `[inline]`

Copies the mol's conformers (the coordinates, NOT the pointers) into the object as base coordinates.

Referenced by OBRotamerList::Clone(), OBConformerSearch::GetConformers(), OBForceField::RandomRotorSearchInitialize(), OBForceField::SystematicRotorSearchInitialize(), and OBForceField::WeightedRotorSearch().

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

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

Parameters:

  bc | The conformer set for the molecule
  N | The number of atoms in the molecule

unsigned int NumBaseCoordinateSets | ( | ) | const`[inline]`

Returns:
  The number of "base" coordinate sets (i.e., the number of conformers in the base OBMol)

double* GetBaseCoordinateSet | ( | unsigned int | i ) | const`[inline]`

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

unsigned int NumAtoms | ( | ) | const`[inline]`

Returns:
  The number of atoms in the base OBMol

void SetAttribute | ( | const std::string & | v ) | `[inline, inherited]`

Set the attribute (key), which can be used to retrieve this data.

Referenced by OBGastChrg::AssignPartialCharges(), OBMol::DoTransformations(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBForceField::GetAtomTypes(), OBMol::GetFormula(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

void SetOrigin | ( | const DataOrigin | s ) | `[inline, inherited]`

Set the origin of this data, which can be used to filter the data.

Referenced by OBGastChrg::AssignPartialCharges(), OpenBabel::CalcSignedVolume(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBDescriptor::PredictAndSave(), and OBMol::SetFormula().

virtual const std::string& GetAttribute | ( | ) | const`[inline, virtual, inherited]`

Returns:
  The attribute (key), which can be used to retrieve this data

Referenced by OBMoleculeFormat::MakeCombinedMolecule().

unsigned int GetDataType | ( | ) | const`[inline, inherited]`

Returns:
  the data type for this object as defined in OBGenericDataType

virtual const std::string& GetValue | ( | ) | const`[inline, virtual, inherited]`

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

Reimplemented in OBCommentData, and OBPairData.

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

virtual DataOrigin GetOrigin | ( | ) | const`[inline, virtual, inherited]`

## Member Data Documentation

std::string _attr`[protected, inherited]`

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

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

unsigned int _type`[protected, inherited]`

attribute type -- declared for each subclass

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

DataOrigin _source`[protected, inherited]`

source of data for accounting

Referenced by OBChiralData::operator=(), OBTorsionData::operator=(), OBAngleData::operator=(), OBConformerData::operator=(), and OBSymmetryData::operator=().

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

- rotamer.h
- rotamer.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines