OBBond Class Reference

Bond class. More...

#include <openbabel/bond.h>

Inheritance diagram for OBBond:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 OBBond ()
virtual ~OBBond ()
virtual bool Clear ()
virtual OBBaseDoTransformations (const std::map< std::string, std::string > *)
template<class T>
T * CastAndClear (bool clear=true)
Bond modification methods
void SetIdx (int idx)
void SetBO (int order)
void SetBondOrder (int order)
void SetBegin (OBAtom *begin)
void SetEnd (OBAtom *end)
void SetParent (OBMol *ptr)
void SetLength (OBAtom *fixed, double length)
void Set (int index, OBAtom *begin, OBAtom *end, int order, int flags)
void SetKSingle ()
void SetKDouble ()
void SetKTriple ()
void SetAromatic ()
void SetHash ()
void SetWedge ()
void SetUp ()
void SetDown ()
void SetInRing ()
void SetClosure ()
void UnsetHash ()
void UnsetWedge ()
void UnsetUp ()
void UnsetDown ()
void UnsetAromatic ()
void UnsetKekule ()
Bond data request methods
unsigned int GetIdx () const
unsigned int GetBO () const
unsigned int GetBondOrder () const
unsigned int GetFlags () const
unsigned int GetBeginAtomIdx () const
unsigned int GetEndAtomIdx () const
OBAtomGetBeginAtom ()
const OBAtomGetBeginAtom () const
OBAtomGetEndAtom ()
const OBAtomGetEndAtom () const
OBAtomGetNbrAtom (OBAtom *ptr)
OBMolGetParent ()
double GetEquibLength ()
double GetLength ()
unsigned int GetNbrAtomIdx (OBAtom *ptr)
property request methods
bool IsAromatic () const
bool IsInRing () const
bool IsRotor ()
bool IsAmide ()
bool IsPrimaryAmide ()
bool IsSecondaryAmide ()
bool IsEster ()
bool IsCarbonyl ()
bool IsSingle ()
bool IsDouble ()
bool IsTriple ()
bool IsKSingle ()
bool IsKDouble ()
bool IsKTriple ()
bool IsClosure ()
bool IsUp ()
bool IsDown ()
bool IsWedge ()
bool IsHash ()
bool IsDoubleBondGeometry ()
Generic data handling methods (via OBGenericData)
bool HasData (const std::string &)
bool HasData (const char *)
bool HasData (const unsigned int type)
void DeleteData (unsigned int type)
void DeleteData (OBGenericData *)
void DeleteData (std::vector< OBGenericData * > &)
void SetData (OBGenericData *d)
unsigned int DataSize () const
OBGenericDataGetData (const unsigned int type)
OBGenericDataGetData (const std::string &)
OBGenericDataGetData (const char *)
std::vector< OBGenericData * > & GetData ()
std::vector< OBGenericData * > GetData (DataOrigin source)
OBDataIterator BeginData ()
OBDataIterator EndData ()

Static Public Member Functions

static const char * ClassDescription ()

Public Attributes

bool Visit

Protected Member Functions

bool HasFlag (int flag)
void SetFlag (int flag)
void UnsetFlag (int flag)

Protected Attributes

unsigned int _idx
OBMol_parent
OBAtom_bgn
OBAtom_end
char _order
unsigned short int _flags
std::vector< OBGenericData * > _vdata

Detailed Description

Bond class.

The OBBond class is straightforward in its data access and modification methods. OBBonds store pointers to the atoms on each end of the bond. In storing pointers to atoms instead of integer indices, the necessity of having to reorder bonds when atoms are shuffled, added, or delete is obviated.

While methods indicate "begin" and "end" atoms in the bond, all methods are designed to be independent of atom ordering, with the exception of stereochemically aware properties such as IsUp(), IsDown(), IsWedge, or IsHash().


Constructor & Destructor Documentation

OBBond (  ) 

Constructor.

~OBBond (  )  [virtual]

Destructor.


Member Function Documentation

bool HasFlag ( int  flag  )  [inline, protected]

void SetFlag ( int  flag  )  [inline, protected]

void UnsetFlag ( int  flag  )  [inline, protected]

void SetIdx ( int  idx  )  [inline]

Set the internal bond index.

Warning:
This will not update the index in the parent OBMol. Intended mainly for internal use. Use with care.

void SetBO ( int  order  ) 

Set the bond order to order (i.e., 1 = single, 2 = double, 5 = aromatic).

Deprecated:
Use SetBondOrder() instead.

void SetBondOrder ( int  order  ) 

Set the bond order to order (i.e., 1 = single, 2 = double, 5 = aromatic).

void SetBegin ( OBAtom begin  )  [inline]

Set the beginning atom of this bond to begin. Does not update begin.

void SetEnd ( OBAtom end  )  [inline]

Set the ending atom of this bond to end. Does not update end.

void SetParent ( OBMol ptr  )  [inline]

Set the parent molecule to ptr. Does not update parent.

void SetLength ( OBAtom fixed,
double  length 
)

Change the bond length to length, while keeping fixed stationary.

void Set ( int  idx,
OBAtom begin,
OBAtom end,
int  order,
int  flags 
)

Set the main bond information (i.e., when creating a bond).

Mark the main information for a bond

Parameters:
idx The unique bond index for this bond (inside an OBMol)
begin The 'beginning' atom for the bond
end The 'end' atom for the bond
order The bond order (i.e., 1 = single, 2 = double... 5 = aromatic)
flags Any initial property flags

void SetKSingle (  ) 

Deprecated:
Use SetBondOrder() instead

void SetKDouble (  ) 

Deprecated:
Use SetBondOrder() instead

void SetKTriple (  ) 

Deprecated:
Use SetBondOrder() instead

void SetAromatic (  )  [inline]

Mark that this bond is aromatic. Does not update atoms or validate.

void SetHash (  )  [inline]

Mark that this bond has 2D "hash" notation (i.e., goes in a negative Z direction from the beginning to end atoms).

void SetWedge (  )  [inline]

Mark that this bond has 2D "wedge" notation (i.e., goes in a positive Z direction from the beginning to end atoms).

void SetUp (  )  [inline]

Mark that this bond has an "up" torsion for double-bond stereochem (i.e., "/" in SMILES notation.

void SetDown (  )  [inline]

Mark that this bond has an "down" torsion for double-bond stereochem (i.e., "\" in SMILES notation.

void SetInRing (  )  [inline]

Mark that this bond is in a ring. Primarily for internal use.

void SetClosure (  )  [inline]

Mark that this bond indicates a ring closure when walking the molecule.

Warning:
This is for internal use only. All closure bonds are marked automatically by lazy evaluation when requesting OBBond::IsClosure()

void UnsetHash (  )  [inline]

Clear any indication of 2D "hash" notation from SetHash().

void UnsetWedge (  )  [inline]

Clear any indication of 2D "wedge" notation from SetWedge().

void UnsetUp (  )  [inline]

Clear any indication of "/" double bond stereochemistry from SetUp().

void UnsetDown (  )  [inline]

Clear any indication of "\" double bond stereochemistry from SetDown().

void UnsetAromatic (  )  [inline]

Clear all aromaticity information for the bond.

void UnsetKekule (  )  [inline]

Clear all Kekule information for the bond.

unsigned int GetIdx (  )  const [inline]

Returns:
The unique bond index in a molecule.

unsigned int GetBO (  )  const [inline]

Returns:
The bond order for the bond

Deprecated:
Use GetBondOrder() as this method may be removed.

unsigned int GetBondOrder (  )  const [inline]

Returns:
The bond order for the bond

unsigned int GetFlags (  )  const [inline]

Returns:
The set of property flags defined for this bond.

unsigned int GetBeginAtomIdx (  )  const [inline]

Returns:
The atom index for the end atom in this bond (from OBAtom::GetIdx()

unsigned int GetEndAtomIdx (  )  const [inline]

Returns:
The atom index for the end atom in this bond (from OBAtom::GetIdx()

OBAtom* GetBeginAtom (  )  [inline]

Returns:
The "beginning" atom for this bond

const OBAtom* GetBeginAtom (  )  const [inline]

OBAtom* GetEndAtom (  )  [inline]

Returns:
The "end" atom for this bond

const OBAtom* GetEndAtom (  )  const [inline]

OBAtom* GetNbrAtom ( OBAtom ptr  )  [inline]

Returns:
The neighboring atom to ptr (i.e., the end if ptr is the start)

Warning:
If ptr is not part of the bond, the beginning atom will always be returned

OBMol* GetParent (  )  [inline]

Returns:
The enclosing OBMol for this bond, or NULL if none is defined.

double GetEquibLength (  ) 

Returns:
The expected "equilibrium" length based on the covalent radii and bond order

Length is given in Angstroms

double GetLength (  ) 

Returns:
The current length of this bond in Angstroms

unsigned int GetNbrAtomIdx ( OBAtom ptr  )  [inline]

Returns:
The index to the neighboring atom of ptr (i.e., the end if ptr is the start)

Warning:
If ptr is not part of the bond, the beginning atom index will always be returned

bool IsAromatic (  )  const

Returns:
Is the bond aromatic? (Note that the two atoms of the bond may be aromatic, but not the bond)

bool IsInRing (  )  const

Returns:
Is the bond part of a ring?

bool IsRotor (  ) 

Returns:
Is the bond a rotatable bond?

Currently, this function classifies any bond with at least one heavy atom, no sp-hybrid atoms (e.g., a triple bond somewhere) not in a ring as a potential rotor. No other bond typing is attempted. For more detailed rotor detection, check the OBRotorList and OBRotorRules classes

bool IsAmide (  ) 

Returns:
Is the bond an amide link (i.e., between a carbonyl C and a N)

bool IsPrimaryAmide (  ) 

Returns:
Is the bond an amide (i.e., between carbonyl C and a NH group)

bool IsSecondaryAmide (  ) 

Returns:
Is the bond an amide between a carbonyl C and a N with no hydrogens

bool IsEster (  ) 

Returns:
Is the bond an ester link (i.e., between a carbonyl C and an O)

bool IsCarbonyl (  ) 

Returns:
Is the bond a carbonyl C=O?

bool IsSingle (  ) 

Returns:
Is the bond a single bond?

bool IsDouble (  ) 

Returns:
Is the bond is a double bond?

bool IsTriple (  ) 

Returns:
Is the bond is a triple bond?

bool IsKSingle (  ) 

Deprecated:
Use IsSingle() instead

bool IsKDouble (  ) 

Deprecated:
Use IsDouble() instead

bool IsKTriple (  ) 

Deprecated:
Use IsTriple() instead

bool IsClosure (  ) 

Returns:
Does this bond "close" a ring when walking the molecular graph?

bool IsUp (  )  [inline]

Returns:
Whether this is the "upper" bond in a double bond cis/trans isomer (i.e., "/" in SMILES)

bool IsDown (  )  [inline]

Returns:
Whether this is the "lower" bond in a double bond cis/trans isomer (i.e., "\" in SMILES)

bool IsWedge (  )  [inline]

Returns:
Whether this bond is a "wedge" in 2D representations (i.e., goes in a positive Z direction from the beginning to end atoms)

bool IsHash (  )  [inline]

Returns:
Whether this bond is a "hash" in 2D representations (i.e., goes in a negative Z direction from the beginning to end atoms)

bool IsDoubleBondGeometry (  ) 

Returns:
whether the geometry around this bond "looks" unsaturated

This method checks if the geometry around this bond looks unsaturated by measuring the torsion angles formed by all connected atoms X-start=end-Y and checking that they are close to 0 or 180 degrees

bool Clear ( void   )  [virtual, inherited]

Clear any and all data associated with this object.

This method can be called by OBConversion::Read() before reading data. Derived classes should be sure to call OBBase::Clear() to remove inherited generic data.

Returns:
Whether the call was successful.
Since:
version 2.1.

Reimplemented in OBAtom, OBMol, and OBResidue.

virtual OBBase* DoTransformations ( const std::map< std::string, std::string > *   )  [inline, virtual, inherited]

Perform a set of transformations specified by the user

Typically these are program options to filter or modify an object For example, see OBMol::DoTransformations() and OBMol::ClassDescription()

Reimplemented in OBMol.

static const char* ClassDescription (  )  [inline, static, inherited]

Returns:
A list of descriptions of command-line options for DoTransformations()

Reimplemented in OBMol.

T* CastAndClear ( bool  clear = true  )  [inline, inherited]

By default clears the object. Called from ReadMolecule of most format classes.

bool HasData ( const std::string &   )  [inherited]

Returns:
whether the generic attribute/value pair exists

bool HasData ( const char *   )  [inherited]

Returns:
whether the generic attribute/value pair exists

bool HasData ( const unsigned int  type  )  [inherited]

Returns:
whether the generic attribute/value pair exists, for a given OBGenericDataType

void DeleteData ( unsigned int  type  )  [inherited]

Delete any data matching the given OBGenericDataType.

void DeleteData ( OBGenericData  )  [inherited]

Delete the given generic data from this object.

void DeleteData ( std::vector< OBGenericData * > &   )  [inherited]

Delete all of the given generic data from this object.

void SetData ( OBGenericData d  )  [inline, inherited]

Adds a data object; does nothing if d==NULL.

unsigned int DataSize (  )  const [inline, inherited]

Returns:
the number of OBGenericData items attached to this molecule.

OBGenericData * GetData ( const unsigned int  type  )  [inherited]

Returns:
the first matching data for a given type from OBGenericDataType or NULL if nothing matches

OBGenericData * GetData ( const std::string &   )  [inherited]

Returns:
the value given an attribute name

OBGenericData * GetData ( const char *   )  [inherited]

Returns:
the value given an attribute name

std::vector<OBGenericData*>& GetData (  )  [inline, inherited]

Returns:
all data, suitable for iterating

std::vector< OBGenericData * > GetData ( DataOrigin  source  )  [inherited]

Returns:
all data with a specific origin, suitable for iterating

OBDataIterator BeginData (  )  [inline, inherited]

Returns:
An iterator pointing to the beginning of the data

OBDataIterator EndData (  )  [inline, inherited]

Returns:
An iterator pointing to the end of the data


Member Data Documentation

unsigned int _idx [protected]

Unique edge index used by GetIdx() and SetIdx().

OBMol* _parent [protected]

The molecule which contains me (if any).

OBAtom* _bgn [protected]

I connect one node.

OBAtom* _end [protected]

to another node

char _order [protected]

Bond order (1, 2, 3, 5=aromatic).

unsigned short int _flags [protected]

Any flags for this bond.

bool Visit

Whether this bond has been visited by a graph algorithm.

Deprecated:
Use OBBitVec objects instead to be fully thread-safe.

std::vector<OBGenericData*> _vdata [protected, inherited]

Custom data.


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