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

Abstract base class representing a chemical atom and its bonded neighborhood. More...

+ Inheritance diagram for CDPL.Chem.Atom:

Classes

class  AtomSequence
 
class  BondSequence
 

Public Member Functions

None __init__ ()
 Initializes the Atom instance.
 
Molecule getMolecule ()
 Returns a reference to the parent molecule. More...
 
Bond getBondToAtom (Atom atom)
 Returns a reference to the bond that connects this atom to the argument atom. More...
 
Bond findBondToAtom (Atom atom)
 Returns a reference to the bond that connects this atom to the argument atom. More...
 
int getIndex ()
 Returns the index of the atom in its parent molecule. More...
 
Atom assign (Atom atom)
 Assignment operator that replaces the current set of properties with the properties of atom. More...
 
AtomSequence getAtoms ()
 
BondSequence getBonds ()
 
Atom getAtom (int idx)
 Returns a reference to the connected atom at index idx. More...
 
bool containsAtom (Atom atom)
 Tells whether this atom and the specified atom are connected by a bond. More...
 
int getAtomIndex (Atom atom)
 Returns the index of the specified connected atom. More...
 
int getNumAtoms ()
 Returns the number of connected atoms. More...
 
None orderAtoms (BoolAtom2Functor func)
 Orders the atoms according to criteria implemented by the provided atom comparison function. More...
 
Entity3D getEntity (int idx)
 Returns a reference to the entity at index idx. More...
 
int getNumEntities ()
 Returns the number of stored Chem.Entity3D objects. More...
 
Bond getBond (int idx)
 Returns a reference to the incident bond at index idx. More...
 
bool containsBond (Bond bond)
 Tells whether the specified bond is incident to this atom. More...
 
None orderBonds (BoolBond2Functor func)
 Orders the bonds according to criteria implemented by the provided bond comparison function. More...
 
int getBondIndex (Bond bond)
 Returns the index of the specified incident bond. More...
 
int getNumBonds ()
 Returns the number of incident bonds. 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__ (Bond bond)
 Returns the result of the membership test operation bond 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 value)
 
bool __delitem__ (Base.LookupKey key)
 
int __len__ ()
 
- 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.Chem.BondContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
Bond __getitem__ (int idx)
 
- 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_value)
 
list getPropertyKeys ()
 
list getPropertyValues ()
 
list getProperties ()
 Returns a reference to itself. More...
 
None setProperty (LookupKey key, Any value)
 
bool removeProperty (LookupKey key)
 Clears the value of 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 ()
 Clears all property values.
 
None addProperties (PropertyContainer cntnr)
 Adds the property value entries in the PropertyContainer instance cntnr. More...
 
None copyProperties (PropertyContainer cntnr)
 Replaces the current set of properties by a copy of the entries in cntnr. More...
 
None swap (PropertyContainer cntnr)
 Exchanges the properties of this container with the properties of the container cntnr. More...
 
Any __getitem__ (LookupKey key)
 Returns the value of the property specified by key. More...
 
bool __contains__ (LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
None __setitem__ (LookupKey key, Any value)
 
bool __delitem__ (LookupKey key)
 

Properties

 molecule = property(getMolecule)
 
 index = property(getIndex)
 
 atoms = property(getAtoms)
 
 bonds = property(getBonds)
 
- 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.Chem.BondContainer
 objectID = property(getObjectID)
 
 numBonds = property(getNumBonds)
 
- 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 atom and its bonded neighborhood.

Atom combines the per-atom property storage inherited from Chem.Entity3D (and via it Base.PropertyContainer) with two adjacency views: a Chem.AtomContainer over the connected neighbor atoms and a Chem.BondContainer over the incident bonds, in matching order. Concrete implementation (Chem.BasicAtom) instances are created, owned and managed by a parent Chem.Molecule instance.

Member Function Documentation

◆ getMolecule()

Molecule CDPL.Chem.Atom.getMolecule ( )

Returns a reference to the parent molecule.

Returns
A reference to the parent molecule.

◆ getBondToAtom()

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

Returns a reference to the bond that connects this atom to the argument atom.

Parameters
atomThe adjacent atom for which to return the connecting bond.
Returns
A reference to the bond connecting this atom and the argument atom.
Exceptions
Base.ItemNotFoundif the argument atom is not connected to this atom.

◆ findBondToAtom()

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

Returns a reference to the bond that connects this atom to the argument atom.

Parameters
atomThe adjacent atom for which to return a reference to the connecting bond.
Returns
A reference to the bond that connects this atom to the argument atom, or None if the argument atom is not connected.

◆ getIndex()

int CDPL.Chem.Atom.getIndex ( )

Returns the index of the atom in its parent molecule.

Returns
The zero-based index of the atom.

◆ assign()

Atom CDPL.Chem.Atom.assign ( Atom  atom)

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

Parameters
atomThe atom whose properties get copied.
Returns
self

Reimplemented in CDPL.Chem.BasicAtom.

◆ getAtom()

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

Returns a reference to the connected atom at index idx.

Parameters
idxThe index of the atom to return.
Returns
A reference to the connected atom at index idx.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumAtoms()).
Note
The order of connected atoms corresponds to the order of connecting bonds.

Reimplemented from CDPL.Chem.AtomContainer.

◆ containsAtom()

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

Tells whether this atom and the specified atom are connected by a bond.

Parameters
atomThe atom to test for adjacency.
Returns
True if the argument atom is connected to this atom, and False otherwise.

Reimplemented from CDPL.Chem.AtomContainer.

◆ getAtomIndex()

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

Returns the index of the specified connected atom.

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

Reimplemented from CDPL.Chem.AtomContainer.

◆ getNumAtoms()

int CDPL.Chem.Atom.getNumAtoms ( )

Returns the number of connected atoms.

Equivalent to getNumBonds().

Returns
The number of connected atoms.

Reimplemented from CDPL.Chem.AtomContainer.

◆ orderAtoms()

None CDPL.Chem.Atom.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.Atom.getEntity ( int  idx)

Returns a reference to the entity at index idx.

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

Parameters
idxThe zero-based entity index.
Returns
A reference to 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.Atom.getNumEntities ( )

Returns the number of stored Chem.Entity3D objects.

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

Returns
The number of contained atoms.

Reimplemented from CDPL.Chem.AtomContainer.

◆ getBond()

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

Returns a reference to the incident bond at index idx.

Parameters
idxThe index of the incident bond to return.
Returns
A reference to the incident bond at index idx.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumBonds()).
Note
The order of incident bonds corresponds to the order of connected atoms.

Reimplemented from CDPL.Chem.BondContainer.

◆ containsBond()

bool CDPL.Chem.Atom.containsBond ( Bond  bond)

Tells whether the specified bond is incident to this atom.

Parameters
bondThe bond to test for incidence.
Returns
True if the argument bond is incident to this atom, and False otherwise.

Reimplemented from CDPL.Chem.BondContainer.

◆ orderBonds()

None CDPL.Chem.Atom.orderBonds ( BoolBond2Functor  func)

Orders the bonds according to criteria implemented by the provided bond comparison function.

Parameters
funcThe bond comparison function implementing the applied ordering criteria.

Reimplemented from CDPL.Chem.BondContainer.

◆ getBondIndex()

int CDPL.Chem.Atom.getBondIndex ( Bond  bond)

Returns the index of the specified incident bond.

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

Reimplemented from CDPL.Chem.BondContainer.

◆ getNumBonds()

int CDPL.Chem.Atom.getNumBonds ( )

Returns the number of incident bonds.

Equivalent to getNumAtoms().

Returns
The number of incident bonds.

Reimplemented from CDPL.Chem.BondContainer.

◆ __contains__() [1/3]

bool CDPL.Chem.Atom.__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.

Reimplemented from CDPL.Chem.Entity3D.

◆ __contains__() [2/3]

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

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

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

Reimplemented from CDPL.Chem.BondContainer.

◆ __contains__() [3/3]

bool CDPL.Chem.Atom.__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.