# gcu::Chain Class Reference

`#include <gcu/chain.h>`

Inheritance diagram for gcu::Chain:

List of all members.

## Public Member Functions

| Chain (Bond *pBond, Atom *pAtom=NULL, TypeId Type=ChainType)
| Chain (Molecule *molecule, Bond *pBond, TypeId Type=ChainType)
| Chain (Molecule *molecule, Atom *pAtom, TypeId Type=ChainType)
virtual | ~Chain ()
void | FindCycles (Atom *pAtom)
bool | FindCycle (Atom *pAtom, Bond *pBond)
virtual void | Erase (Atom *pAtom1, Atom *pAtom2)
virtual void | Insert (Atom *pAtom1, Atom *pAtom2, Chain &chain)
void | Extract (Atom *pAtom1, Atom *pAtom2, Chain &chain)
void | Reverse ()
void | AddBond (Atom *start, Atom *end)
unsigned | GetUnsaturations ()
unsigned | GetHeteroatoms ()
bool | Contains (Atom *pAtom)
bool | Contains (Bond *pBond)
unsigned | GetLength ()
double | GetMeanBondLength ()
Atom * | GetNextAtom (Atom *pAtom)

## Protected Attributes

std::map< Atom *, ChainElt > | m_Bonds
Molecule * | m_Molecule

## Detailed Description

This class is used to represent chains of atoms.

Definition at line 59 of file chain.h.

## Constructor & Destructor Documentation

gcu::Chain::Chain | ( | Bond * | pBond,
|  | Atom * | pAtom = `NULL`,
|  | TypeId | Type = `ChainType` |
| ) |  |  |

Parameters:

  | pBond | a bond.
  | pAtom | an atom.
  | Type | an optional type id used when constructing a derived type (i. e. a cycle).

Constructs a Chain starting from a bond and an optional atom. Choosing the atom forces the direction of the chain, otherwise, the first atom will be the first atom of the bond.

gcu::Chain::Chain | ( | Molecule * | molecule,
|  | Bond * | pBond,
|  | TypeId | Type = `ChainType` |
| ) |  |  |

Parameters:

  | molecule | a molecule.
  | pBond | a bond in the molecule or NULL.
  | Type | an optional type id used when constructing a derived type

Explores a molecule and find all cycles, starting from pBond or an empty chain if pBond is NULL.

gcu::Chain::Chain | ( | Molecule * | molecule,
|  | Atom * | pAtom,
|  | TypeId | Type = `ChainType` |
| ) |  |  |

Parameters:

  | molecule | a molecule.
  | pAtom | an atom in the molecule.
  | Type | an optional type id used when constructing a derived type

Explores a molecule and find all cycles, starting from pAtom or an empty chain if pAtom is NULL.

virtual gcu::Chain::~Chain | ( |  | ) | `[virtual]`

The destructor.

## Member Function Documentation

void gcu::Chain::FindCycles | ( | Atom * | pAtom | ) |

Parameters:

  | pAtom | an atom.

Searches all cycles in a molecule starting from Atom pAtom. Found cycles are added to the molecule cycles list.

bool gcu::Chain::FindCycle | ( | Atom * | pAtom,
|  | Bond * | pBond |
| ) |  |  |

Parameters:

  | pAtom | an atom.
  | pBond | a bond.

Searches for a cycle containing the atom pAtom and the bond pBond. pAtom must be one of the ends of pBond. If a cycle is found, it is added to the molecule cycles list.

Returns:
  true on success, false otherwise.

virtual void gcu::Chain::Erase | ( | Atom * | pAtom1,
|  | Atom * | pAtom2 |
| ) |  |  | `[virtual]`

Parameters:

  | pAtom1 | an atom in the source chain.
  | pAtom2 | an atom in the source chain.

Erases a sub-chain. One of the atoms must already be one of the chain ends.

Reimplemented in gcu::Cycle.

virtual void gcu::Chain::Insert | ( | Atom * | pAtom1,
|  | Atom * | pAtom2,
|  | Chain & | chain |
| ) |  |  | `[virtual]`

Parameters:

  | pAtom1 | an atom in the source chain.
  | pAtom2 | an atom in the source chain.
  | chain | the source chain.

Inserts a chain. One of the atoms must already be in the target chain.

Reimplemented in gcu::Cycle.

void gcu::Chain::Extract | ( | Atom * | pAtom1,
|  | Atom * | pAtom2,
|  | Chain & | chain |
| ) |  |  |

Parameters:

  | pAtom1 | an atom in the chain.
  | pAtom2 | an atom in the chain.
  | chain | the target chain.

Extracts a sub-chain to the chain variable which should be empty before the call.

void gcu::Chain::Reverse | ( |  | ) |

Reverses the chain order.

void gcu::Chain::AddBond | ( | Atom * | start,
|  | Atom * | end |
| ) |  |  |

Parameters:

  | start | an atom.
  | end | an atom.

Adds the two atoms and the bond between them to the chain. The two atoms must be bonded.

unsigned gcu::Chain::GetUnsaturations | ( |  | ) |

Returns:
  the number of multiple bonds in the chain so not really the unsaturations number.

unsigned gcu::Chain::GetHeteroatoms | ( |  | ) |

Returns:
  the number of heteroatoms in the chain.

bool gcu::Chain::Contains | ( | Atom * | pAtom | ) |

Parameters:

  | pAtom | an atom.

Returns:
  true if pAtom is in the chain.

bool gcu::Chain::Contains | ( | Bond * | pBond | ) |

Parameters:

  | pBond | a bond.

Returns:
  true if pBond is in the chain.

unsigned gcu::Chain::GetLength | ( |  | ) |

Returns:
  the number of bonds in the chain

double gcu::Chain::GetMeanBondLength | ( |  | ) |

Returns:
  the mean bond length in the chain.

Atom* gcu::Chain::GetNextAtom | ( | Atom * | pAtom | ) |

Parameters:

  | pAtom | an atom in the chain.

Returns:
  the next atom in the chain or NULL if pAtom is the last one.

## Member Data Documentation

std::map<Atom*, ChainElt> gcu::Chain::m_Bonds `[protected]`

The gcu::ChainElt elements in the chain indexed by their common atom.

Definition at line 185 of file chain.h.

Molecule* gcu::Chain::m_Molecule `[protected]`

The molecule which owns the chain.

Definition at line 189 of file chain.h.

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

- chain.h