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

Common interface for data structures that support a random access to stored Chem.Atom instances. More...

+ Inheritance diagram for CDPL.Chem.AtomContainer:

Public Member Functions

None __init__ ()
 Initializes the AtomContainer instance.
 
Atom getAtom (int idx)
 Returns a reference to the atom at index idx. More...
 
bool containsAtom (Atom atom)
 Tells whether the specified atom is part of the atom sequence. More...
 
int getAtomIndex (Atom atom)
 Returns the index of the specified atom. More...
 
int getNumAtoms ()
 Returns the number of 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...
 
bool __contains__ (Atom atom)
 Returns the result of the membership test operation atom in self. More...
 
Atom __getitem__ (int idx)
 
int __len__ ()
 
- Public Member Functions inherited from CDPL.Chem.Entity3DContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 

Properties

 numAtoms = property(getNumAtoms)
 
- Properties inherited from CDPL.Chem.Entity3DContainer
 objectID = property(getObjectID)
 
 numEntities = property(getNumEntities)
 

Detailed Description

Common interface for data structures that support a random access to stored Chem.Atom instances.

Implementations have to guarantee that a given Chem.Atom object is stored only once and its index is unique amongst all contained Chem.Atom instances. Otherwise algorithms that rely on this behaviour may not work correctly!

Member Function Documentation

◆ getAtom()

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

Returns a reference to the atom at index idx.

Parameters
idxThe zero-based index of the atom to return.
Returns
A reference to the atom at the specified index.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumAtoms()).

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ containsAtom()

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

Tells whether the specified atom is part of the atom sequence.

Parameters
atomThe atom to look for.
Returns
True if atom is part of the sequence, and False otherwise.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ getAtomIndex()

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

Returns the index of the specified atom.

Parameters
atomThe atom for which to return the index.
Returns
The zero-based index of the specified atom.
Exceptions
Base.ItemNotFoundif the specified atom could not be found.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ getNumAtoms()

int CDPL.Chem.AtomContainer.getNumAtoms ( )

Returns the number of atoms.

Returns
The number of atoms.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ orderAtoms()

None CDPL.Chem.AtomContainer.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 in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ getEntity()

Entity3D CDPL.Chem.AtomContainer.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.Entity3DContainer.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ getNumEntities()

int CDPL.Chem.AtomContainer.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.Entity3DContainer.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Bond, and CDPL.Chem.Atom.

◆ __contains__()

bool CDPL.Chem.AtomContainer.__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 in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Fragment, CDPL.Chem.ElectronSystem, CDPL.Chem.Bond, and CDPL.Chem.Atom.