Loading...
Searching...
No Matches
OBRing Class Reference

`#include <openbabel/ring.h>`

## Public Attributes

int | ring_id
std::vector< int > | _path
OBBitVec | _pathset

## Constructors

| OBRing ()
| OBRing (std::vector< int > &path, int size)
| OBRing (std::vector< int > &path, OBBitVec set)
| OBRing (const OBRing &src)
OBRing & | operator= (const OBRing &src)
size_t | Size () const
size_t | PathSize () const
bool | IsAromatic ()
void | SetType (char *type)
void | SetType (std::string &type)
char * | GetType ()
unsigned int | GetRootAtom ()
bool | IsMember (OBAtom *a)
bool | IsMember (OBBond *b)
bool | IsInRing (int i)
void | SetParent (OBMol *m)
OBMol * | GetParent ()
bool | findCenterAndNormal (vector3 &center, vector3 &norm1, vector3 &norm2)

## Detailed Description

Stores information on rings in a molecule from SSSR perception.

Ring information beyond atom and bond membership is usually not necessary, but more information can be had about the rings in a molecule. The OBRing class is used to store the information from a Smallest Set of Smallest Rings (SSSR) perception of a molecule. The OBMol member function OBMol::GetSSSR() stores the information it perceives in a vector<OBRing*> inside the molecule. Perception is only done once for a molecule unless the connection table is modified. The following code demonstrates how to extract the SSSR information:

OBMol mol;
vector<OBRing*> vr;
vr = mol.GetSSSR();
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::OBMol::GetSSSR
std::vector< OBRing * > & GetSSSR()
Implements blue-obelisk:findSmallestSetOfSmallestRings.
Definition mol.cpp:924

OBRings store the atom numbers of the atoms in each of the smallest set of smallest rings in both a vector<int> and an OBBitVec. An example of how to print out the atom numbers present in all SSSR rings is show below:

vector<OBRing*>::iterator i;
vector<int>::iterator j;
vector<OBRing*> *rlist = (vector<OBRing*>*)mol.GetData("RingList");
for (i = rlist->begin();i != rlist->end();++i)
{
for(j = (*i)->_path.begin(); j != (*i)->_path.end(); ++j)
cout << *j << ' ';
cout << endl;
}
OpenBabel::OBBase::GetData
OBGenericData * GetData(const unsigned int type)
Definition base.cpp:152

will produce something like the following output for benzene:

1 2 3 4 5 6

Ring information is automatically deleted from an OBMol when it goes out of scope or the OBMol::Clear() member function is called.

Implements blue-obelisk:findSmallestSetOfSmallestRings.

## Constructor & Destructor Documentation

## OBRing() [1/4]

OBRing | ( |  | ) |

inline

Referenced by OBRing(), and operator=().

## OBRing() [2/4]

OBRing | ( | std::vector< int > & | path,
|  | int | size )

Initialize a ring from a set of atom indexes `path` and with `size`.

## OBRing() [3/4]

OBRing | ( | std::vector< int > & | path,
|  | OBBitVec | set )

inline

## OBRing() [4/4]

OBRing | ( | const OBRing & | src | ) |

OBRing copy constructor.

Parameters

  src | reference to original OBRing object (rhs)

## Member Function Documentation

## operator=()

OBRing & operator= | ( | const OBRing & | src | ) |

OBRing assignment operator.

Parameters

  src | reference to original OBRing object (rhs)

Returns
  reference to modified OBRing object (lhs)

## Size()

size_t Size | ( |  | ) | const

inline

Returns
  the size of this ring (i.e., how many atoms in the cycle)

Referenced by OpenBabel::CompareRingSize(), GetRootAtom(), and OBBond::IsRotor().

## PathSize()

size_t PathSize | ( |  | ) | const

inline

Returns
  the size of this ring (i.e., how many atoms in the cycle)

Deprecated
  Use Size() instead

## IsAromatic()

bool IsAromatic | ( |  | ) |

Returns
  whether this ring is aromatic If all atoms in this ring are aromatic, the ring will be considered aromatic

Todo
  This method uses implicit bonding – bond info is not stored in OBRing

Referenced by OBDepict::DrawMolecule().

## SetType() [1/2]

void SetType | ( | char * | type | ) |

Set the ring type (see OBRingTyper for more).

## SetType() [2/2]

void SetType | ( | std::string & | type | ) |

Set the ring type (see OBRingTyper for more).

## GetType()

char * GetType | ( |  | ) |

Returns
  the ring type

## GetRootAtom()

unsigned int GetRootAtom | ( |  | ) |

Returns
  the index for the root atom. O for furan, S for thiazole, N for pyrrole. For 6 membered aromatic rings, the first non carbon atom is used for root. For 5 members rings the O, S or N (BOSum=3, valence=3) will be used for root

## IsMember() [1/2]

bool IsMember | ( | OBAtom * | a | ) |

Returns
  Whether atom `a` is a member of this ring

## IsMember() [2/2]

bool IsMember | ( | OBBond * | b | ) |

Returns
  Whether both atoms in bond `b` are in this ring

Todo
  This method uses implicit bonding – bond info is not stored in OBRing

## IsInRing()

bool IsInRing | ( | int | i | ) |

inline

Returns
  Whether `i` as an atom index is in this ring

## SetParent()

void SetParent | ( | OBMol * | m | ) |

inline

Set the parent of this ring to `m`.

Referenced by OBMol::FindLSSR(), and OBMol::FindSSSR().

## GetParent()

OBMol * GetParent | ( |  | ) |

inline

Returns
  the parent of this ring, or NULL if none has been defined

Referenced by GetRootAtom(), and GetType().

## findCenterAndNormal()

bool findCenterAndNormal | ( | vector3 & | center,
|  | vector3 & | norm1,
|  | vector3 & | norm2 )

Set the supplied vectors to the `center` of this ring, along with the `normal` (in both directions).

Parameters

  center | The center of the ring
  norm1 | The normal of the best-fit plane for this ring
  norm2 | -1 * norm1 (i.e., the opposite direction of norm1)

Returns
  True (success)

## Member Data Documentation

## ring_id

int ring_id

a unique id to ensure a stable sort in SSSR determination

Referenced by OpenBabel::CompareRingSize().

## _path

std::vector<int> _path

the path of this ring (i.e., the atom indexes)

Referenced by OBDepict::DrawMolecule(), findCenterAndNormal(), GetRootAtom(), IsAromatic(), OBRing(), OBRing(), OBRing(), operator=(), PathSize(), Size(), and OpenBabel::visitRing().

## _pathset

OBBitVec _pathset

the path of this ring as a redundant bit vector

Referenced by IsInRing(), IsMember(), IsMember(), OBRing(), OBRing(), OBRing(), operator=(), and OpenBabel::visitRing().

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

- ring.h
- ring.cpp