Chemical Data Processing Library C++ API - Version 1.1.1
Public Types | Public Member Functions | List of all members
CDPL::Chem::ElectronSystem Class Reference

Describes an electron system of a molecule in terms of involved atoms and their electron contributions. More...

#include <ElectronSystem.hpp>

+ Inheritance diagram for CDPL::Chem::ElectronSystem:

Public Types

typedef std::shared_ptr< ElectronSystemSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated ElectronSystem instances. More...
 
typedef boost::indirect_iterator< AtomList::const_iterator, const AtomConstAtomIterator
 A constant random access iterator used to iterate over the stored const Chem::Atom objects. More...
 
typedef boost::indirect_iterator< AtomList::iterator, AtomAtomIterator
 A mutable random access iterator used to iterate over the stored const Chem::Atom objects. More...
 
- Public Types inherited from CDPL::Chem::AtomContainer
typedef Util::IndexedElementIterator< const Atom, ConstAtomAccessor > ConstAtomIterator
 A constant random access iterator used to iterate over the stored const Chem::Atom objects. More...
 
typedef Util::IndexedElementIterator< Atom, AtomAccessor > AtomIterator
 A mutable random access iterator used to iterate over the stored Chem::Atom objects. More...
 
- Public Types inherited from CDPL::Chem::Entity3DContainer
typedef Util::IndexedElementIterator< const Entity3D, ConstEntityAccessor > ConstEntityIterator
 A constant random access iterator used to iterate over the stored const Chem::Entity3D objects. More...
 
typedef Util::IndexedElementIterator< Entity3D, EntityAccessor > EntityIterator
 A mutable random access iterator used to iterate over the stored Chem::Entity3D objects. More...
 

Public Member Functions

 ElectronSystem ()
 Constructs an empty ElectronSystem instance. More...
 
std::size_t getNumAtoms () const
 Returns the number of atoms contributing to the electron system. More...
 
bool containsAtom (const Atom &atom) const
 Tells whether the specified atom is part of the electron system. More...
 
std::size_t getAtomIndex (const Atom &atom) const
 Returns the index of the specified atom. More...
 
const AtomgetAtom (std::size_t idx) const
 Returns a const reference to the atom at index idx. More...
 
AtomgetAtom (std::size_t idx)
 Returns a non-const reference to the atom at index idx. More...
 
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing to the end of the stored const Chem::Atom objects. More...
 
void clear ()
 Removes all atoms. More...
 
void orderAtoms (const AtomCompareFunction &func)
 Orders the stored atoms according to criteria implemented by the provided atom comparison function. More...
 
bool addAtom (const Chem::Atom &atom, std::size_t elec_contrib)
 Extends the electron system by the specified atom and its electron contributions. More...
 
bool addAtoms (const ElectronSystem &elec_sys)
 Adds the atoms and associated electron contributions in the electron system elec_sys to this system. More...
 
void removeAtom (std::size_t idx)
 Removes the atom at the specified index. More...
 
AtomIterator removeAtom (const AtomIterator &it)
 Removes the atom specified by the iterator it. More...
 
bool removeAtom (const Atom &atom)
 Removes the specified atom. More...
 
std::size_t getNumElectrons () const
 Returns the total number of electrons contributed by the involved atoms. More...
 
std::size_t getElectronContrib (const Atom &atom) const
 Returns the number of electrons contributed by the specified atom. More...
 
std::size_t getElectronContrib (std::size_t idx) const
 Returns the number of electrons contributed by the atom at the specified index. More...
 
void setElectronContrib (const Atom &atom, std::size_t elec_contrib)
 Changes the number of electrons that are contributed by the specified atom. More...
 
void setElectronContrib (std::size_t idx, std::size_t elec_contrib)
 Changes the number of electrons that are contributed by the atom at the specified index. More...
 
void merge (const ElectronSystem &elec_sys)
 Merges the atoms and associated electron contributions in the electron system elec_sys with this system. More...
 
bool overlaps (const ElectronSystem &elec_sys) const
 Checks if the electron system shares at least one atom with the system elec_sys. More...
 
bool contains (const ElectronSystem &elec_sys) const
 Checks if all atoms in the electron system elec_sys are also part of this electron system. More...
 
bool connected (const ElectronSystem &elec_sys, const BondContainer &bonds) const
 Checks if the atom sets of the electron systems do not intersect but are linked by at least one bond. More...
 
void swap (ElectronSystem &elec_sys)
 Exchanges the state of this electron system with the state of the system elec_sys. More...
 
- Public Member Functions inherited from CDPL::Chem::AtomContainer
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
ConstAtomIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
AtomIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
virtual std::size_t getNumEntities () const
 Returns the number of stored Chem::Entity3D objects. More...
 
virtual const Entity3DgetEntity (std::size_t idx) const
 Returns a const reference to the Chem::Entity3D instance at index idx. More...
 
virtual Entity3DgetEntity (std::size_t idx)
 Returns a non-const reference to the entity at index idx. More...
 
const AtomContainergetAtoms () const
 Returns a const reference to itself. More...
 
AtomContainergetAtoms ()
 Returns a reference to itself. More...
 
- Public Member Functions inherited from CDPL::Chem::Entity3DContainer
ConstEntityIterator getEntitiesBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Entity3D objects. More...
 
ConstEntityIterator getEntitiesEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Entity3D objects. More...
 
EntityIterator getEntitiesBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Entity3D objects. More...
 
EntityIterator getEntitiesEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Entity3D objects. More...
 
ConstEntityIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Entity3D objects. More...
 
ConstEntityIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Entity3D objects. More...
 
EntityIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Entity3D objects. More...
 
EntityIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Entity3D objects. More...
 
const Entity3DContainergetEntities () const
 Returns a const reference to itself. More...
 
Entity3DContainergetEntities ()
 Returns a reference to itself. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Chem::AtomContainer
virtual ~AtomContainer ()
 Virtual destructor. More...
 
AtomContaineroperator= (const AtomContainer &cntnr)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Chem::Entity3DContainer
virtual ~Entity3DContainer ()
 Virtual destructor. More...
 
Entity3DContaineroperator= (const Entity3DContainer &cntnr)
 Assignment operator. More...
 

Detailed Description

Describes an electron system of a molecule in terms of involved atoms and their electron contributions.

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated ElectronSystem instances.

◆ ConstAtomIterator

typedef boost::indirect_iterator<AtomList::const_iterator, const Atom> CDPL::Chem::ElectronSystem::ConstAtomIterator

A constant random access iterator used to iterate over the stored const Chem::Atom objects.

◆ AtomIterator

typedef boost::indirect_iterator<AtomList::iterator, Atom> CDPL::Chem::ElectronSystem::AtomIterator

A mutable random access iterator used to iterate over the stored const Chem::Atom objects.

Constructor & Destructor Documentation

◆ ElectronSystem()

CDPL::Chem::ElectronSystem::ElectronSystem ( )

Constructs an empty ElectronSystem instance.

Member Function Documentation

◆ getNumAtoms()

std::size_t CDPL::Chem::ElectronSystem::getNumAtoms ( ) const
virtual

Returns the number of atoms contributing to the electron system.

Returns
The number of atoms.

Implements CDPL::Chem::AtomContainer.

◆ containsAtom()

bool CDPL::Chem::ElectronSystem::containsAtom ( const Atom atom) const
virtual

Tells whether the specified atom is part of the electron system.

Parameters
atomThe atom to look for.
Returns
true if atom is part of the electron system and false, otherwise.

Implements CDPL::Chem::AtomContainer.

◆ getAtomIndex()

std::size_t CDPL::Chem::ElectronSystem::getAtomIndex ( const Atom atom) const
virtual

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 is not part of this electron system.

Implements CDPL::Chem::AtomContainer.

◆ getAtom() [1/2]

const Atom& CDPL::Chem::ElectronSystem::getAtom ( std::size_t  idx) const
virtual

Returns a const reference to the atom at index idx.

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

Implements CDPL::Chem::AtomContainer.

◆ getAtom() [2/2]

Atom& CDPL::Chem::ElectronSystem::getAtom ( std::size_t  idx)
virtual

Returns a non-const reference to the atom at index idx.

Parameters
idxThe zero-based index of the atom to return.
Returns
A non-const reference to the atom at the specified index.
Exceptions
Base::IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

Implements CDPL::Chem::AtomContainer.

◆ getAtomsBegin() [1/2]

ConstAtomIterator CDPL::Chem::ElectronSystem::getAtomsBegin ( ) const

Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects.

Returns
A constant iterator pointing to the beginning of the stored const Chem::Atom objects.

◆ getAtomsBegin() [2/2]

AtomIterator CDPL::Chem::ElectronSystem::getAtomsBegin ( )

Returns a mutable iterator pointing to the beginning of the stored const Chem::Atom objects.

Returns
A mutable iterator pointing to the beginning of the stored const Chem::Atom objects.

◆ getAtomsEnd() [1/2]

ConstAtomIterator CDPL::Chem::ElectronSystem::getAtomsEnd ( ) const

Returns a constant iterator pointing to the end of the stored const Chem::Atom objects.

Returns
A constant iterator pointing to the end of the stored const Chem::Atom objects.

◆ getAtomsEnd() [2/2]

AtomIterator CDPL::Chem::ElectronSystem::getAtomsEnd ( )

Returns a mutable iterator pointing to the end of the stored const Chem::Atom objects.

Returns
A mutable iterator pointing to the end of the stored const Chem::Atom objects.

◆ clear()

void CDPL::Chem::ElectronSystem::clear ( )

Removes all atoms.

◆ orderAtoms()

void CDPL::Chem::ElectronSystem::orderAtoms ( const AtomCompareFunction func)
virtual

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

Parameters
funcThe atom comparison function implementing the applied ordering criteria.

Implements CDPL::Chem::AtomContainer.

◆ addAtom()

bool CDPL::Chem::ElectronSystem::addAtom ( const Chem::Atom atom,
std::size_t  elec_contrib 
)

Extends the electron system by the specified atom and its electron contributions.

Parameters
atomThe atom to add.
elec_contribThe number of electrons contributed by the added atom.
Returns
true if the atom was not already involved in this electron system and false, otherwise.
Note
If the atom is already part of the system no changes will be made.

◆ addAtoms()

bool CDPL::Chem::ElectronSystem::addAtoms ( const ElectronSystem elec_sys)

Adds the atoms and associated electron contributions in the electron system elec_sys to this system.

The method is equivalent to repeatedly calling addAtom() for each atom in elec_sys.

Parameters
elec_sysThe electron system to add.
Returns
true if the electron system was extended by atoms from elec_sys and false, otherwise.

◆ removeAtom() [1/3]

void CDPL::Chem::ElectronSystem::removeAtom ( std::size_t  idx)

Removes the atom at the specified index.

Parameters
idxThe zero-based index of the atom to remove.
Exceptions
Base::IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

◆ removeAtom() [2/3]

AtomIterator CDPL::Chem::ElectronSystem::removeAtom ( const AtomIterator it)

Removes the atom specified by the iterator it.

Parameters
itAn iterator that specifies the atom to remove.
Returns
A mutable iterator pointing to the next atom in the list.
Exceptions
Base::RangeErrorif the number of atoms is zero or it is not in the range [getAtomsBegin(), getAtomsEnd() - 1].

◆ removeAtom() [3/3]

bool CDPL::Chem::ElectronSystem::removeAtom ( const Atom atom)

Removes the specified atom.

Parameters
atomThe atom to remove.
Returns
true if the atom was part of the electron system and has been removed, and false otherwise.

◆ getNumElectrons()

std::size_t CDPL::Chem::ElectronSystem::getNumElectrons ( ) const

Returns the total number of electrons contributed by the involved atoms.

Returns
The total electron count of this system.

◆ getElectronContrib() [1/2]

std::size_t CDPL::Chem::ElectronSystem::getElectronContrib ( const Atom atom) const

Returns the number of electrons contributed by the specified atom.

Parameters
atomThe atom for which to return the contributed electron count.
Returns
The number of electrons contributed by the specified atom.
Exceptions
Base::ItemNotFoundif the specified atom is not part of the electron system.

◆ getElectronContrib() [2/2]

std::size_t CDPL::Chem::ElectronSystem::getElectronContrib ( std::size_t  idx) const

Returns the number of electrons contributed by the atom at the specified index.

Parameters
idxThe index of the atom for which to return the contributed electron count.
Returns
The number of electrons contributed by the specified atom.
Exceptions
Base::IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

◆ setElectronContrib() [1/2]

void CDPL::Chem::ElectronSystem::setElectronContrib ( const Atom atom,
std::size_t  elec_contrib 
)

Changes the number of electrons that are contributed by the specified atom.

Parameters
atomThe atom for which to update the electron contribution.
elec_contribThe number of electrons contributed by the specified atom.
Exceptions
Base::ItemNotFoundif the specified atom is not part of the electron system.

◆ setElectronContrib() [2/2]

void CDPL::Chem::ElectronSystem::setElectronContrib ( std::size_t  idx,
std::size_t  elec_contrib 
)

Changes the number of electrons that are contributed by the atom at the specified index.

Parameters
idxThe index of the atom for which to update the electron contribution.
elec_contribThe number of electrons contributed by the specified atom.
Exceptions
Base::IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

◆ merge()

void CDPL::Chem::ElectronSystem::merge ( const ElectronSystem elec_sys)

Merges the atoms and associated electron contributions in the electron system elec_sys with this system.

For atoms that are present in both electron systems, the resulting electron contribution will be the sum of their contributions to the respective systems!

Parameters
elec_sysThe electron system to merge.

◆ overlaps()

bool CDPL::Chem::ElectronSystem::overlaps ( const ElectronSystem elec_sys) const

Checks if the electron system shares at least one atom with the system elec_sys.

Parameters
elec_sysThe electron system to check for atom set intersection.
Returns
true if at least one atom in elec_sys is also part of this electron system and false, otherwise.

◆ contains()

bool CDPL::Chem::ElectronSystem::contains ( const ElectronSystem elec_sys) const

Checks if all atoms in the electron system elec_sys are also part of this electron system.

Parameters
elec_sysThe electron system to check for atom set containment.
Returns
true if all atoms in elec_sys are also part of this electron system and false, otherwise.

◆ connected()

bool CDPL::Chem::ElectronSystem::connected ( const ElectronSystem elec_sys,
const BondContainer bonds 
) const

Checks if the atom sets of the electron systems do not intersect but are linked by at least one bond.

Parameters
elec_sysThe electron system to check.
bondsThe set of available bonds.
Returns
true if the electron systems do not share any atoms but are linked by at least one bond and false, otherwise.

◆ swap()

void CDPL::Chem::ElectronSystem::swap ( ElectronSystem elec_sys)

Exchanges the state of this electron system with the state of the system elec_sys.

Parameters
elec_sysThe other ElectronSystem instance.

The documentation for this class was generated from the following file: