Atom Class Reference

#include <atom.h>

Inheritance diagram for Atom:

Node DataContainer List of all members.

Public Member Functions

Atom construction functions
 Atom ()
 Atom (const Atom &anAtom)
 Atom (string aLabel)
 ~Atom ()
Atomoperator= (const Atom &anAtom)
BondaddBond (Bond *aBond) throw ( CError )
Accessor functions
int getId () const
string getIdString ()
int getIdInMolecule () const
void setIdInMolecule (int anId)
int getType () const
string getName ()
string getSymbol ()
string getElementSymbol ()
void setElementSymbol (string anElement)
int getAN () const
bool isGeneric ()
bool isCSkeleton ()
bool hasCoordinates ()
float getX ()
float getY ()
float getZ ()
void setCoordinates (float aX, float aY, float aZ)
int numBonds ()
int numHiddenBonds ()
int getNumAromaticBonds ()
int degree ()
bool wasVisited ()
void setVisited ()
void unsetVisited ()
int getMorganIndex (int order)
int getUniqueMorganIndex (bool silentError=false) throw ( CError )
void setMorganLabel (string aLabel)
void setMorganLabel (int anOrder)
string getMorganLabel (bool silentError=false) throw ( CError )
void setPerretLabel () throw ( CError )
string getPerretLabel (bool silentError=false) throw ( CError )
void addRing (Ring *aRing)
bool hasRing (Ring *aRing)
bool hasRing ()
int numRings ()
double getKashimaPT (Atom *anAtom)
vector< Atom * > * getBFSVector ()
vector< Bond * > * getBFSBondVector ()
int getBFSVectorSize ()
void resetBFSVector ()
Atom manipulation functions
void eraseCoordinates ()
void hideBond (map< Atom *, Bond * >::iterator aBondI)
void hideBond (Bond *aBond)
BondhideBond (Atom *aTarget)
int hideHydrogenBonds ()
void hideAllToFromBonds ()
BondhideToFromBonds (Atom *aTarget)
BondhideToFromFirstBond ()
int restoreHiddenBonds ()
void restoreHiddenBond (Bond *aBond) throw ( CError )
void restoreHiddenBond (Atom *aTarget) throw ( CError )
void deleteBonds ()
void deleteHiddenBonds ()
bool bondExists (Bond *aBond)
long bondSum ()
void unsetBondFlags ()
void unsetBondFlagsOriginal ()
void setUniqueMorganIndex (int anOrder)
int getSumOfNeighboorMorganIndex (int anOrder)
void resetMorganIndex ()
void setPartialCharge (double aValue)
void setMorganChargeLabel (double threshold)
BondgetBondWithTarget (Atom *otherAtom) throw ( CError )
AtomnextUnvisitedAtom () throw ( CError )
RinggetRingBFS (vector< Atom * > *toVisit, vector< Bond * > *toVisitBond) throw ( CError )
void pushBFSVector (vector< Atom * > *aPath, vector< Bond * > *aBondPath)
Iterators
map< Atom *, Bond * > & getBonds ()
map< Atom *, Bond * >::iterator beginBond ()
map< Atom *, Bond * >::iterator endBond ()
vector< Ring * >::iterator beginRing ()
vector< Ring * >::iterator endRing ()
map< Atom *, Bond * >::iterator getBondIteratorWithTarget (Atom *otherAtom)
Output functions
string toString ()
string toStringShort ()
void describe () throw ( CError )
void describeShort ()
string toStringBFSVector ()

Static Public Member Functions

static void getVectorIntersect (vector< Atom * > *v1, vector< Atom * > *v2, vector< Atom * > *result)

Protected Member Functions

void setAN (int a)
void setType (int aType)

Static Protected Member Functions

static void resetCounter ()

Protected Attributes

map< int, int > morganIndex
string morganLabel
string perretLabel
int uniqueMorganIndex
vector< Atom * > BFSVector
vector< Bond * > BFSBondVector
double partialCharge

Private Attributes

int id
int idInMolecule
int type
int an
float x
float y
float z
bool flagHasCoordinates
map< Atom *, Bond * > bonds
map< Atom *, Bond * > hiddenBonds
vector< Ring * > rings
bool visited
bool genericAtomType

Static Private Attributes

static int counter

Friends

class Elements
class Bond
class Molecule
ostream & operator<< (ostream &os, const Atom &anAtom)

Detailed Description

Atom class
Author:
Dr Jean-Luc Perret ("luc@kuicr.kyoto-u.ac.jp"), Kyoto University, Japan
Version:
0.3
Date:
17 Jan 2004
CLASS NAME: Atom

FOR: SNSF SPONSORED PROJECT

PURPOSE:

This class implements the notion of atom. Atoms have

These descriptors are implemented using the DataContainer class which takes care of memory allocation for these descriptors. Therefore descriptors can be added and removed at runtime using the DataContainer functions.

Some atom descriptors need fast access and are thus directly implemented in the atom class using native data types (int or float). These is the case for id and should be done for ps and pq.

Atoms should always be created using the copy operator using the atoms stored in the global elements vector as template (#include <elements.h>).

for example instanciating a new hydrogen atom should be done in this way:

Atom* myatom = new Atom( elements["H"] );

Examples:

atom_example.cpp, and bond_example.cpp.


Constructor & Destructor Documentation

Atom::Atom  ) 
 

class constructor.

Atom::Atom const Atom anAtom  ) 
 

class constructor.

Atom::Atom string  aLabel  ) 
 

class constructor.

Atom::~Atom  ) 
 

class destructor.


Member Function Documentation

Bond* Atom::addBond Bond aBond  )  throw ( CError )
 

adds a bond to the bond hash.

void Atom::addRing Ring aRing  )  [inline]
 

adds a ring to the set of rings the atom is member of.

map<Atom*, Bond*>::iterator Atom::beginBond  )  [inline]
 

returns an iterator to the first Bond.

vector<Ring*>::iterator Atom::beginRing  )  [inline]
 

returns an iterator to the first ring the atom is member of.

bool Atom::bondExists Bond aBond  ) 
 

returns true if a bond (of any type) exists with the target atom.

long Atom::bondSum  ) 
 

returns the sum of the bond types.

int Atom::degree  )  [inline]
 

returns the number of Bonds (synonymous to numBonds).

void Atom::deleteBonds  ) 
 

deletes all bonds of that atom (called from the destructor of molecule).

void Atom::deleteHiddenBonds  ) 
 

deletes all hidden bonds of that atom (called from the destructor of molecule).

void Atom::describe  )  throw ( CError )
 

prints a description of the atom to cout (describeShort + descriptors, but not the kind descriptors).

Reimplemented from DataContainer.

Examples:
atom_example.cpp.

void Atom::describeShort  ) 
 

prints a short description of the atom to cout (atomic symbol + unique Id).

Reimplemented from DataContainer.

map<Atom*, Bond*>::iterator Atom::endBond  )  [inline]
 

returns a pointer to the last Bond.

vector<Ring*>::iterator Atom::endRing  )  [inline]
 

returns an iterator to the last ring the atom is member of.

void Atom::eraseCoordinates  ) 
 

erases the atoms coordinates (set flagHasCoordinates to false).

int Atom::getAN  )  const [inline]
 

returns the atomic number of the atom (ex: hydrogens should return 1).

vector<Bond*>* Atom::getBFSBondVector  )  [inline]
 

returns the BFS Bond vector.

vector<Atom*>* Atom::getBFSVector  )  [inline]
 

returns the BFS vector.

int Atom::getBFSVectorSize  )  [inline]
 

returns the BFSVector size.

map<Atom*, Bond*>::iterator Atom::getBondIteratorWithTarget Atom otherAtom  ) 
 

NOT DOCUMENTED

map<Atom*, Bond*>& Atom::getBonds  )  [inline]
 

returns a pointer to the bonds map.

Bond* Atom::getBondWithTarget Atom otherAtom  )  throw ( CError )
 

returns the label of the bond connecting this atom with otherAtom. returns NOBOND if there are no bonds connecting both atoms.

string Atom::getElementSymbol  )  [inline]
 

returns the element symbol. In case of mol files it is the same as getSymbol() but in case of KCF files, getSymbol() returns the Kegg atom type while getElementSymbol() returns the element atom type.

int Atom::getId  )  const [inline]
 

returns the atom unique Id.

int Atom::getIdInMolecule  )  const [inline]
 

returns the atom Id in the molecule.

string Atom::getIdString  ) 
 

returns the atom unique Id as a string.

double Atom::getKashimaPT Atom anAtom  ) 
 

returns the transition probability to anAtom. returns 0 if no atoms exist with anAtom.

int Atom::getMorganIndex int  order  ) 
 

returns the Morgan index of order anOrder. Emits an error if it was not calculated before.

string Atom::getMorganLabel bool  silentError = false  )  throw ( CError )
 

returns the value of the Morgan label (set by setMorganLabel()).

string Atom::getName  )  [inline]
 

returns the value of the name descriptor in case atoms where names (used for reading the Mutag dataset).

int Atom::getNumAromaticBonds  ) 
 

returns the number of aromatic Bonds for this atom.

string Atom::getPerretLabel bool  silentError = false  )  throw ( CError )
 

returns the value of the perret label (set by setPerretLabel(), called everytime a molecule is modified).

Ring* Atom::getRingBFS vector< Atom * > *  toVisit,
vector< Bond * > *  toVisitBond
throw ( CError )
 

BFS procedure for smallest ring detection. returns a pointer to the smallest ring containing the atom or NULL if the atom is not member of any ring. note you should check ring membership with hasRing().

int Atom::getSumOfNeighboorMorganIndex int  anOrder  ) 
 

returns the sum of the Morgan indices of order anOrder of all neighboors.

string Atom::getSymbol  )  [inline]
 

returns the value of the symbol descriptor in case atoms where names (used for reading the Mutag dataset).

int Atom::getType  )  const [inline]
 

returns the element type.

int Atom::getUniqueMorganIndex bool  silentError = false  )  throw ( CError )
 

returns the value of the Morgan index for which the diversity of Morgan indices is maximum in the current molecule. set by setUniqueMorganIndex(int).

static void Atom::getVectorIntersect vector< Atom * > *  v1,
vector< Atom * > *  v2,
vector< Atom * > *  result
[static]
 

NO DOCUMENTATION.

float Atom::getX  )  [inline]
 

returns the x coordinate of the atom.

float Atom::getY  )  [inline]
 

returns the y coordinate of the atom.

float Atom::getZ  )  [inline]
 

returns the z coordinate of the atom.

bool Atom::hasCoordinates  ) 
 

returns true if the atom has valid coordinates.

bool Atom::hasRing  )  [inline]
 

returns true if the atom is member of any ring.

bool Atom::hasRing Ring aRing  ) 
 

returns true if the atom is member of the given ring.

void Atom::hideAllToFromBonds  ) 
 

hides all bonds to and from this Atom.

Bond* Atom::hideBond Atom aTarget  ) 
 

hides a bond (but not reverse bond).

void Atom::hideBond Bond aBond  ) 
 

hides a bond (but not reverse bond).

void Atom::hideBond map< Atom *, Bond * >::iterator  aBondI  ) 
 

hides a bond (but not reverse bond).

int Atom::hideHydrogenBonds  ) 
 

hides all bonds whose target is an hydrogen.

Bond* Atom::hideToFromBonds Atom aTarget  ) 
 

hides all bonds to and from to aTarget Atom and returns a poiter to the 'to Bond' of aTarget atom.

Bond* Atom::hideToFromFirstBond  ) 
 

hides the first bond in bonds (both to and from bonds) and returns a pointer to the 'to Bond'.

bool Atom::isCSkeleton  ) 
 

returns true if the atom is a non terminal Carbon (a terminal carbon is a carbon atom attached to only one non hydrogen atom).

bool Atom::isGeneric  )  [inline]
 

returns true if the atom is 'generic'.

Atom* Atom::nextUnvisitedAtom  )  throw ( CError )
 

returns a pointer to the next unvisited Node. returns NULL pointer if all atoms were visited.

int Atom::numBonds  )  [inline]
 

returns the number of Bonds.

int Atom::numHiddenBonds  )  [inline]
 

returns the number of hidden Bonds.

int Atom::numRings  )  [inline]
 

returns the number of rings the atom is member of.

Atom& Atom::operator= const Atom anAtom  ) 
 

assignment operator.

void Atom::pushBFSVector vector< Atom * > *  aPath,
vector< Bond * > *  aBondPath
 

NO DOCUMENTATION

void Atom::resetBFSVector  )  [inline]
 

resets the BFSVector.

static void Atom::resetCounter  )  [inline, static, protected]
 

resets the atom counter. Only the elements should call this function.

void Atom::resetMorganIndex  ) 
 

resets the Morgan index map. call this function whenever the molecule is modified!

void Atom::restoreHiddenBond Atom aTarget  )  throw ( CError )
 

restores hidden bond to atom aTarget. Throws a CError if no hidden bond to aTarget is found.

void Atom::restoreHiddenBond Bond aBond  )  throw ( CError )
 

restores hidden bond aBond.

int Atom::restoreHiddenBonds  ) 
 

restores all hidden bonds (for example, bonds to hydrogens).

void Atom::setAN int  a  )  [inline, protected]
 

this function is used when instanciating the atom for setting the atomic number.

void Atom::setCoordinates float  aX,
float  aY,
float  aZ
 

sets the x, y, and z coordinates of the atom.

void Atom::setElementSymbol string  anElement  ) 
 

sets the value of the ElementSymbol descriptor.

void Atom::setIdInMolecule int  anId  ) 
 

sets the Id of this atom in the molecule.

void Atom::setMorganChargeLabel double  threshold  ) 
 

include the sign of the partial charge in the Morgan label of the instance. If partial charge > threshold: sign = + ; otherwise, sign = -

void Atom::setMorganLabel int  anOrder  ) 
 

sets the Morgan label (used in the Molecule::morganKernel function) to the concatenation of the atomSymbol and the Morgan index of iteration anOrder.

void Atom::setMorganLabel string  aLabel  ) 
 

set the Morgan label of the atom.

void Atom::setPartialCharge double  aValue  ) 
 

set the value of the partial charge of the instance to aValue

void Atom::setPerretLabel  )  throw ( CError )
 

sets the Perret label of the atom (if a carbon has more than 2 aromatic bonds it is renamed CJ).

void Atom::setType int  aType  )  [inline, protected]
 

sets the atom type.

void Atom::setUniqueMorganIndex int  anOrder  ) 
 

sets the unique Morgan index of this atom to the value of anOrder iteration of the Morgan index calculation.

void Atom::setVisited  )  [inline]
 

sets the node as visited.

string Atom::toString  ) 
 

returns a string describing the atom (atomic symbol + unique Id + memory location + number of bonds).

string Atom::toStringBFSVector  ) 
 

NO DOCUMENTATION

string Atom::toStringShort  ) 
 

returns a short string describing the atom (atomic symbol + unique Id).

Reimplemented from Node.

void Atom::unsetBondFlags  ) 
 

unsets all bond flags.

void Atom::unsetBondFlagsOriginal  ) 
 

unsets all bond flags original.

void Atom::unsetVisited  )  [inline]
 

sets the node as unvisited.

bool Atom::wasVisited  )  [inline]
 

returns true if the node was already visited.


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const Atom anAtom
[friend]
 

stream operator for Atom.


Member Data Documentation

int Atom::an [private]
 

atomic number. to enhance retrival speed this property is hard coded rather than using the DataContainer mechanism.

vector<Bond*> Atom::BFSBondVector [protected]
 

this vector is used to store paths in a BFS search (stores bonds).

vector<Atom*> Atom::BFSVector [protected]
 

this vector is used to store paths in a BFS search (stores atoms).

map<Atom*, Bond*> Atom::bonds [private]
 

hash of bonds indexed by atom.

int Atom::counter [static, private]
 

counter of the number of atoms which have been instanciated.

bool Atom::flagHasCoordinates [private]
 

flag indicating if the atom has valid coordinates.

bool Atom::genericAtomType [private]
 

indicates if this atom is part of the elements or if it is generic (created with constructor: Atom::Atom(string)).

map<Atom*, Bond*> Atom::hiddenBonds [private]
 

vector of hidden bonds indexed by atom.

int Atom::id [private]
 

atom unique Id.

int Atom::idInMolecule [private]
 

atom unique Id in the molecule it belongs.

map< int, int > Atom::morganIndex [protected]
 

map containing the morgan indices.

string Atom::morganLabel [protected]
 

Morgan label of the atom set by the Atom::setMorganLabel() function.

double Atom::partialCharge [protected]
 

partial charge of the atom.

string Atom::perretLabel [protected]
 

Perret label of the atom.set by the Atom::setPerretLabel() function.

vector<Ring*> Atom::rings [private]
 

smallest rings of which this atom is member (set by Molecule::detectSSSR()).

int Atom::type [private]
 

atom type: start from Hydrogen at 0, incremented at the instanciation of elements. used by MoleculeUtils::atomKernelExternalMatrix().

int Atom::uniqueMorganIndex [protected]
 

Morgan index value for the iteration with the biggest diversity for a molecule (set by Molecule::setUniqueMorganIndices()).

bool Atom::visited [private]
 

flag to indicate if the atom was visited. Used in DFS graph algorithm.

float Atom::x [private]
 

atom x coodinate.

float Atom::y [private]
 

atom y coodinate.

float Atom::z [private]
 

atom z coodinate.


The documentation for this class was generated from the following file:
Generated on Wed Nov 28 12:12:51 2007 for ChemCpp by  doxygen 1.4.6