Chemical Data Processing Library Python API - Version 1.4.0
Classes | Public Member Functions | Properties | List of all members
CDPL.Chem.Bond Class Reference

Abstract base class representing a chemical bond between two atoms (represented by Chem.Atom instances). More...

+ Inheritance diagram for CDPL.Chem.Bond:

Classes

class  AtomSequence
 

Public Member Functions

None __init__ ()
 Contructs the Bond instance.
 
Atom getNeighbor (Atom atom)
 Returns the connected neighbor of the argument atom. More...
 
Atom getBegin ()
 Returns the start atom of the bond. More...
 
Atom getEnd ()
 Returns the end atom of the bond. More...
 
Molecule getMolecule ()
 Returns the parent molecule. More...
 
int getIndex ()
 Returns the index of the bond in its parent molecule. More...
 
Bond assign (Bond bond)
 Assignment operator that replaces the current set of properties with the properties of bond. More...
 
AtomSequence getAtoms ()
 
Atom getAtom (int idx)
 Returns the atom at index idx. More...
 
bool containsAtom (Atom atom)
 Tells whether the bond is incident to the specified atom. More...
 
int getAtomIndex (Atom atom)
 Returns the index of the specified atom. More...
 
int getNumAtoms ()
 Returns the number of atoms connected by the bond. More...
 
None orderAtoms (BoolAtom2Functor func)
 Orders the atoms according to criteria implemented by the provided atom comparison function. More...
 
Entity3D getEntity (int idx)
 Returns the entity at index idx. More...
 
int getNumEntities ()
 Returns the number of stored Chem.Entity3D instances. More...
 
Base.Any __getitem__ (Base.LookupKey key)
 
bool __contains__ (Base.LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
bool __contains__ (Atom atom)
 Returns the result of the membership test operation atom in self. More...
 
None __setitem__ (Base.LookupKey key, Base.Any val)
 
bool __delitem__ (Base.LookupKey key)
 
int __len__ ()
 Returns the number of property entries. More...
 
- Public Member Functions inherited from CDPL.Chem.AtomContainer
Atom __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Chem.Entity3DContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
- Public Member Functions inherited from CDPL.Base.PropertyContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
int getNumProperties ()
 Returns the number of property entries. More...
 
Any getPropertyOrDefault (LookupKey key, Any def_val)
 Returns the value of the property specified by key , or the default value def_val if an entry does not exist. More...
 
list getPropertyKeys ()
 Returns a list containing the keys of the current property entries. More...
 
list getPropertyValues ()
 Returns a list containing the values of the current property entries. More...
 
list getProperties ()
 Returns a reference to itself. More...
 
None setProperty (LookupKey key, Any val)
 Sets the value of the property specified by key to val. More...
 
bool removeProperty (LookupKey key)
 Removes the entry for the property specified by key. More...
 
Any getProperty (LookupKey key, bool throw_=False)
 Returns the value of the property specified by key. More...
 
bool isPropertySet (LookupKey key)
 Tells whether or not a value has been assigned to the property specified by key. More...
 
None clearProperties ()
 Erases all container entries.
 
None addProperties (PropertyContainer cntnr)
 Adds the property entries of the PropertyContainer instance cntnr. More...
 
None copyProperties (PropertyContainer cntnr)
 Replaces the current property entries by a copy of the entries in cntnr. More...
 
None swap (PropertyContainer cntnr)
 Exchanges the property entries of this container with the ones of cntnr. More...
 
Any __getitem__ (LookupKey key)
 Returns the value of the property specified by key. More...
 
bool __contains__ (LookupKey key)
 Tells whether or not a value has been assigned to the property specified by key. More...
 
None __setitem__ (LookupKey key, Any val)
 Sets the value of the property specified by key to val. More...
 
bool __delitem__ (LookupKey key)
 Removes the entry for the property specified by key. More...
 

Properties

 begin = property(getBegin)
 
 end = property(getEnd)
 
 molecule = property(getMolecule)
 
 index = property(getIndex)
 
 atoms = property(getAtoms)
 
- Properties inherited from CDPL.Chem.AtomContainer
 numAtoms = property(getNumAtoms)
 
- Properties inherited from CDPL.Chem.Entity3DContainer
 objectID = property(getObjectID)
 
 numEntities = property(getNumEntities)
 
- Properties inherited from CDPL.Base.PropertyContainer
 objectID = property(getObjectID)
 
 propertyKeys = property(getPropertyKeys)
 
 propertyValues = property(getPropertyValues)
 
 properties = property(getProperties)
 
 numProperties = property(getNumProperties)
 

Detailed Description

Abstract base class representing a chemical bond between two atoms (represented by Chem.Atom instances).

Bond combines the per-bond property storage inherited from Base.PropertyContainer with a fixed-size (always two atoms) Chem.AtomContainer interface that yields the bond's begin and end atoms. Concrete implementation (Chem.BasicBond) instances are created, owned and managed by a parent Chem.Molecule instance.

Member Function Documentation

◆ getNeighbor()

Atom CDPL.Chem.Bond.getNeighbor ( Atom  atom)

Returns the connected neighbor of the argument atom.

Parameters
atomThe atom for which to return the connected neighbor atom.
Returns
The connected neighbor of the argument atom.
Exceptions
Base.ItemNotFoundif the bond is not incident to the specified atom.

◆ getBegin()

Atom CDPL.Chem.Bond.getBegin ( )

Returns the start atom of the bond.

Equivalent to calling getAtom(0).

Returns
The start atom of the bond.

◆ getEnd()

Atom CDPL.Chem.Bond.getEnd ( )

Returns the end atom of the bond.

Equivalent to calling getAtom(1).

Returns
The end atom of the bond.

◆ getMolecule()

Molecule CDPL.Chem.Bond.getMolecule ( )

Returns the parent molecule.

Returns
The parent molecule.

◆ getIndex()

int CDPL.Chem.Bond.getIndex ( )

Returns the index of the bond in its parent molecule.

Returns
The zero-based index of the bond.

◆ assign()

Bond CDPL.Chem.Bond.assign ( Bond  bond)

Assignment operator that replaces the current set of properties with the properties of bond.

Parameters
bondThe bond whose properties get copied.
Returns
self.

Reimplemented in CDPL.Chem.BasicBond.

◆ getAtom()

Atom CDPL.Chem.Bond.getAtom ( int  idx)

Returns the atom at index idx.

The index 0 specifies the start atom (see getBegin() const) and 1 the end atom of the bond (see getEnd() const).

Parameters
idxThe index of the atom to return.
Returns
The atom at index idx.
Exceptions
Base.IndexErrorif idx is not in the range [0, 1].

Reimplemented from CDPL.Chem.AtomContainer.

◆ containsAtom()

bool CDPL.Chem.Bond.containsAtom ( Atom  atom)

Tells whether the bond is incident to the specified atom.

Parameters
atomThe atom to check.
Returns
True if the bond is incident to the specified atom, and False otherwise.

Reimplemented from CDPL.Chem.AtomContainer.

◆ getAtomIndex()

int CDPL.Chem.Bond.getAtomIndex ( Atom  atom)

Returns the index of the specified atom.

If the specified atom is the start atom of the bond, the index 0 is returned. For the end atom of the bond, the value 1 will be returned.

Parameters
atomThe atom for which to return the index.
Returns
The zero-based index of the specified atom.
Exceptions
Base.ItemNotFoundif the bond is not incident to the specified atom.

Reimplemented from CDPL.Chem.AtomContainer.

◆ getNumAtoms()

int CDPL.Chem.Bond.getNumAtoms ( )

Returns the number of atoms connected by the bond.

Since a bond connects exactly two atoms, the return value is always 2.

Returns
The number of atoms connected by the bond (always 2).

Reimplemented from CDPL.Chem.AtomContainer.

◆ orderAtoms()

None CDPL.Chem.Bond.orderAtoms ( BoolAtom2Functor  func)

Orders the atoms according to criteria implemented by the provided atom comparison function.

Parameters
funcThe atom comparison function implementing the applied ordering criteria.

Reimplemented from CDPL.Chem.AtomContainer.

◆ getEntity()

Entity3D CDPL.Chem.Bond.getEntity ( int  idx)

Returns the entity at index idx.

Forwards to getAtom() and exists to satisfy the Chem.Entity3DContainer interface.

Parameters
idxThe zero-based entity index.
Returns
The entity at the specified index.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumAtoms()).

Reimplemented from CDPL.Chem.AtomContainer.

◆ getNumEntities()

int CDPL.Chem.Bond.getNumEntities ( )

Returns the number of stored Chem.Entity3D instances.

Forwards to getNumAtoms() and exists to satisfy the Chem.Entity3DContainer interface.

Returns
The number of contained atoms.

Reimplemented from CDPL.Chem.AtomContainer.

◆ __contains__() [1/2]

bool CDPL.Chem.Bond.__contains__ ( Base.LookupKey  key)

Returns the result of the membership test operation key in self.

Parameters
keyThe value to test for membership.
Returns
The result of the membership test operation.

◆ __contains__() [2/2]

bool CDPL.Chem.Bond.__contains__ ( Atom  atom)

Returns the result of the membership test operation atom in self.

Parameters
atomThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented from CDPL.Chem.AtomContainer.

◆ __len__()

int CDPL.Chem.Bond.__len__ ( )

Returns the number of property entries.

Returns
The number of property entries.

Reimplemented from CDPL.Base.PropertyContainer.