BALL::Bond Class Reference
[Miscellaneous]

#include <BALL/KERNEL/bond.h>

Inheritance diagram for BALL::Bond:
BALL::Composite BALL::PropertyManager BALL::PersistentObject BALL::Selectable BALL::Object BALL::AutoDeletable BALL::SmilesParser::SPBond

List of all members.


Classes

class  NotBound

Public Types

Enumerations
enum  BondOrder {
  ORDER__UNKNOWN = 0, ORDER__SINGLE = 1, ORDER__DOUBLE = 2, ORDER__TRIPLE = 3,
  ORDER__QUADRUPLE = 4, ORDER__AROMATIC = 5, ORDER__ANY = 6, NUMBER_OF_BOND_ORDERS
}
enum  BondType {
  TYPE__UNKNOWN = 0, TYPE__COVALENT = 1, TYPE__HYDROGEN = 2, TYPE__DISULPHIDE_BRIDGE = 3,
  TYPE__SALT_BRIDGE = 4, TYPE__PEPTIDE = 5, NUMBER_OF_BOND_TYPES
}
enum  Property { IS_AROMATIC = 0, NUMBER_OF_PROPERTIES }
Type definitions
typedef short Order
typedef short Type

Public Member Functions

Persistence
void persistentWrite (PersistenceManager &pm, const char *name=0) const throw (Exception::GeneralException)
void persistentRead (PersistenceManager &pm) throw (Exception::GeneralException)
void finalize () throw (Exception::GeneralException)
Predicates
bool operator== (const Bond &bond) const
 

Equality operator. Two bonds are equal, if they are identical instances.


bool operator!= (const Bond &bond) const
 

Inequality operator. Two bonds are not equal, if they are different instances.


Assignment methods
Bondoperator= (const Bond &bond)
void swap (Bond &bond)
Accessors
void setFirstAtom (Atom *atom)
void setSecondAtom (Atom *atom)
const AtomgetFirstAtom () const
 

Return a pointer to the first atom.


const AtomgetSecondAtom () const
 

Return a pointer to the second atom.


AtomgetPartner (const Atom &atom) const
void setName (const String &name)
 

Assign the atom name.


const StringgetName () const
 

Return the atom name.


void setOrder (Order bond_order)
 

Assign the bond order.


Order getOrder () const
 

Return the bond order.


bool isAromatic () const
void setType (Type bond_type)
 

Set the bond type.


Type getType () const
 

Return the bond type.


float getLength () const throw (NotBound)
const AtomgetBoundAtom (const Atom &atom) const
AtomgetBoundAtom (const Atom &atom)
Predicates
bool isBondOf (const Atom &atom) const
bool isBound () const
bool isInterBond () const
bool isInterBondOf (const AtomContainer &atom_container) const
bool isIntraBond () const
bool isIntraBondOf (const AtomContainer &atom_container) const
Debugging and diagnostics
virtual bool isValid () const
virtual void dump (std::ostream &s=std::cout, Size depth=0) const

Protected Attributes

Atributes
Atomfirst_
Atomsecond_
String name_
Order bond_order_
Type bond_type_

Private Member Functions

void arrangeBonds_ ()
void clear_ ()

Friends

class Atom

Constructors and Destructors

 Bond ()
 Bond (const Bond &bond, bool deep=true)
 Bond (const String &name, Atom &first, Atom &second, Order order=BALL_BOND_DEFAULT_ORDER, Type type=BALL_BOND_DEFAULT_TYPE) throw (Exception::TooManyBonds)
virtual ~Bond ()
virtual void clear ()
virtual void destroy ()
static BondcreateBond (Bond &bond, Atom &first, Atom &second) throw (Exception::TooManyBonds)

Detailed Description

Bond class. An instance of Bond represents a bond between two atoms. There can be only one bond between two atoms (double, triple, etc. bonds are represented using just one bond and an appropriate value for the bond order attribute, see setBondOrder ).

The "first" and "second" atom are assigned in a unique way: the first atom is always the atom with the lower Handle than the second atom.
The "state" of a bond is defined by its attributes:

Bond equality is defined as bond identity. A linear ordering of bonds is defined as the linear order of the Object::Handle s.


Member Typedef Documentation

typedef short BALL::Bond::Order

Bond type.

typedef short BALL::Bond::Type

Member Enumeration Documentation

Predefined constants for the bond order

Enumerator:
ORDER__UNKNOWN 

Default value.

ORDER__SINGLE 

Single bond.

ORDER__DOUBLE 

Double bond.

ORDER__TRIPLE 

Triple Bond.

ORDER__QUADRUPLE 

Quadruple bond.

ORDER__AROMATIC 

Aromatic bonds.

ORDER__ANY 

Any bond orders (useful for predicates).

NUMBER_OF_BOND_ORDERS 

The number of bond orders.

Predefined constants for the bond type. Those are just defined for convenience but they are not used right now.

Enumerator:
TYPE__UNKNOWN 
TYPE__COVALENT 
TYPE__HYDROGEN 
TYPE__DISULPHIDE_BRIDGE 
TYPE__SALT_BRIDGE 
TYPE__PEPTIDE 
NUMBER_OF_BOND_TYPES 

Predefined properties. Enumeration of all properties that are used by Bond.

Enumerator:
IS_AROMATIC 

This property can be used to store aromaticity information without overwriting bond orders.

NUMBER_OF_PROPERTIES 

Constructor & Destructor Documentation

BALL::Bond::Bond (  ) 

Default constructor. The state of this bond is:

BALL::Bond::Bond ( const Bond bond,
bool  deep = true 
)

Copy constructor. Calls Bond::createBond . The state of this bond is initialized to the state of bond.

Note: Deep copying of bonds makes no sense, the parameter deep is therefore ignored. The use of this method is not recommended because it may result in inconcistencies of the whole the kernel data structure. This if for internal use only!
Parameters:
bond the bond to be copied
deep ignored
See also:
createBond
BALL::Bond::Bond ( const String name,
Atom first,
Atom second,
Order  order = BALL_BOND_DEFAULT_ORDER,
Type  type = BALL_BOND_DEFAULT_TYPE 
) throw (Exception::TooManyBonds)

Detailed constructor. Calls createBond to create a new bond between the two atoms

Parameters:
name name of the constructed bond
first first atom of the constructed bond
second second atom of the constructed bond
order order of the constructed bond
type type of the constructed bond
Exceptions:
TooManyBonds if one of the atom already possesses Atom::MAX_NUMBER_OF_BONDS bonds.
virtual BALL::Bond::~Bond (  )  [virtual]

Destructor. If the bond is connecting two atoms, they are disconnected.


Member Function Documentation

void BALL::Bond::arrangeBonds_ (  )  [private]
virtual void BALL::Bond::clear (  )  [virtual]

Disconnect and reset to default state. Reset the bond attributes to their default values. The state of this bond is:

  • bond has no connectivity with first atom (=0)
  • bond has no connectivity with second atom (=0)
  • bond name is the empty string (="")
  • bond order is unknown (= Bond::ORDER__UNKNOWN )
  • bond type is unknown (= Bond::TYPE__UNKNOWN )

Reimplemented from BALL::Composite.

void BALL::Bond::clear_ (  )  [private]
static Bond* BALL::Bond::createBond ( Bond bond,
Atom first,
Atom second 
) throw (Exception::TooManyBonds) [static]

Create a bond. Connect the two atoms first and second via a bond.

Parameters:
bond the instantiated bond that connects the first atom first to the second atom second
first the first atom of the bond
second the second atom of the bond
Returns:
Bond* this
Exceptions:
TooManyBonds if one of the atom already possesses Atom::MAX_NUMBER_OF_BONDS bonds.

Referenced by BALL::cloneBonds().

virtual void BALL::Bond::destroy (  )  [virtual]

Explicit destructor. Destroy this bond explicitly without releasing its heap memory thus this bond may exist further. Calls Bond::clear . Set the state of this bond to the default values. Note: Destroy is equivalent to Bond::clear .

See also:
Bond::clear

Reimplemented from BALL::Composite.

virtual void BALL::Bond::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const [virtual]

Internal state dump. Dump the current internal state of this bond to the output ostream s with dumping depth depth .

Parameters:
s output stream where to output the internal state of this bond
depth the dumping depth

Reimplemented from BALL::Composite.

void BALL::Bond::finalize (  )  throw (Exception::GeneralException) [virtual]

Finalize the deserialization. Bond might have to swap first_ and second_ to ensure the correct order (see Bond ).

Reimplemented from BALL::PersistentObject.

Referenced by BALL::cloneBonds().

Atom* BALL::Bond::getBoundAtom ( const Atom atom  ) 

Return the partner of the atom in this bond.

Parameters:
atom an atom
Returns:
Atom a pointer to the atom, 0 if the atom is not part of the bond
const Atom* BALL::Bond::getBoundAtom ( const Atom atom  )  const

Return the partner of the atom in this bond.

Parameters:
atom an atom
Returns:
Atom a constant pointer to the atom, 0 if the atom is not part of the bond
const Atom* BALL::Bond::getFirstAtom (  )  const

Return a pointer to the first atom.

Referenced by BALL::TMolecularGraph< Node, Edge >::newEdge().

float BALL::Bond::getLength (  )  const throw (NotBound)

Return the bond length

Exceptions:
NotBound if the bond has not two atoms
Returns:
float - the distance between the two atoms
const String& BALL::Bond::getName (  )  const

Return the atom name.

Order BALL::Bond::getOrder (  )  const

Return the bond order.

Atom* BALL::Bond::getPartner ( const Atom atom  )  const

Return the partner atom of an atom. If the given atom is part of this bond, the other atom of the bond is returned. 0 is returned if atom is not one of the bond's atoms.

Parameters:
atom one of the bond's atoms
Returns:
the atom's bond partner
const Atom* BALL::Bond::getSecondAtom (  )  const

Return a pointer to the second atom.

Referenced by BALL::TMolecularGraph< Node, Edge >::newEdge().

Type BALL::Bond::getType (  )  const

Return the bond type.

bool BALL::Bond::isAromatic (  )  const

Returns true if this bond is aromatic.

A bond is defined as aromatic, if it has the property Bond::IS_AROMATIC or if it has the order Bond::ORDER__AROMATIC

bool BALL::Bond::isBondOf ( const Atom atom  )  const

Determine whether the bond belongs to an atom. Calls Atom::hasBond .

Parameters:
atom the atom that is queried to connect this bond to another atom
Returns:
bool - true if bond connects the atom atom with another atom, false otherwise
See also:
Atom::hasBond
bool BALL::Bond::isBound (  )  const

Determine whether this bond contains any atom.

Returns:
bool - true if bond connects the atom atom with another atom, false otherwise
See also:
Atom::hasBond
bool BALL::Bond::isInterBond (  )  const

Determine whether the bond connects two fragments. If both atoms have no roots, the result is false. Calls Composite::getRoot .

Returns:
bool - true if this bond is intermolecular, false otherwise
See also:
Composite::getRoot
bool BALL::Bond::isInterBondOf ( const AtomContainer atom_container  )  const

Request for the intermolecular bonding of this bond within {atom_container}. Query, if this bond connects a atom within {atom_container} instance with an atom outside. Calls Composite::isDescendantOf .

Parameters:
atom_container the queried parent fragment.
Returns:
bool - true if this bond is intermolecular, false otherwise
See also:
Composite::isDescendantOf
bool BALL::Bond::isIntraBond (  )  const

Request for the intramolecular bonding of this bond. Query, if this bond connects its two atoms within a common parent Composite instance. If both atoms have no roots, the result is true. Calls Composite::getRoot .

Returns:
bool - true if this bond is intramolecular, false otherwise
See also:
Composite::getRoot
bool BALL::Bond::isIntraBondOf ( const AtomContainer atom_container  )  const

Request for the intramolecular bonding of this bond within {atom_container}. Query, if this bond connects its two atoms within the common parent {atom_container} instance. Calls Composite::isDescendantOf .

Parameters:
atom_container the queried parent fragment.
Returns:
bool - true if this bond is intramolecular, false otherwise
See also:
Composite::isDescendantOf
virtual bool BALL::Bond::isValid (  )  const [virtual]

Internal state and consistency self-validation.

Returns:
bool - true if the internal state of this bond is correct (self-validated) and consistent, false otherwise

Reimplemented from BALL::Composite.

bool BALL::Bond::operator!= ( const Bond bond  )  const

Inequality operator. Two bonds are not equal, if they are different instances.

Bond& BALL::Bond::operator= ( const Bond bond  ) 

Assignment operator. Assign a deep copy (on the level of Composite ).

Note: The use of this method is not recommended because it may result in inconcistencies of the whole system. This is for internal use only.

Parameters:
bond the bond to be copied
Returns:
Bond - this bond
See also:
Bond::set
bool BALL::Bond::operator== ( const Bond bond  )  const

Equality operator. Two bonds are equal, if they are identical instances.

void BALL::Bond::persistentRead ( PersistenceManager pm  )  throw (Exception::GeneralException) [virtual]

Read a bond from a persistent stream.

Parameters:
pm the persistence manager

Reimplemented from BALL::Composite.

void BALL::Bond::persistentWrite ( PersistenceManager pm,
const char *  name = 0 
) const throw (Exception::GeneralException) [virtual]

Write a bond to a persistent stream.

Parameters:
pm the persistence manager

Reimplemented from BALL::Composite.

void BALL::Bond::setFirstAtom ( Atom atom  ) 

Set the first atom. This method does not ensure the correct order of atoms (see Bond ), so its use is recommended for internal purposes only.

Referenced by BALL::cloneBonds().

void BALL::Bond::setName ( const String name  ) 

Assign the atom name.

void BALL::Bond::setOrder ( Order  bond_order  ) 

Assign the bond order.

void BALL::Bond::setSecondAtom ( Atom atom  ) 

Set the second atom. This method does not ensure the correct order of atoms (see Bond ), so its use is recommended for internal purposes only.

Referenced by BALL::cloneBonds().

void BALL::Bond::setType ( Type  bond_type  ) 

Set the bond type.

void BALL::Bond::swap ( Bond bond  ) 

Swap the contents of two bonds

Parameters:
bond the bond this is being swapped with
See also:
Bond::Bond

Friends And Related Function Documentation

friend class Atom [friend]

Member Data Documentation

Atom* BALL::Bond::first_ [protected]
Atom* BALL::Bond::second_ [protected]