Chemical Data Processing Library Python API - Version 1.1.1
Public Member Functions | Properties | 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...

+ Inheritance diagram for CDPL.Chem.ElectronSystem:

Public Member Functions

None __init__ ()
 Constructs an empty ElectronSystem instance.
 
None __init__ (ElectronSystem elec_sys)
 Initializes a copy of the ElectronSystem instance elec_sys. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
ElectronSystem assign (ElectronSystem elec_sys)
 Replaces the current state of self with a copy of the state of the ElectronSystem instance elec_sys. More...
 
bool addAtom (Atom atom, int elec_contrib)
 Extends the electron system by the specified atom and its electron contributions. More...
 
bool addAtoms (ElectronSystem elec_sys)
 Adds the atoms and associated electron contributions in the electron system elec_sys to this system. More...
 
None removeAtom (int idx)
 Removes the atom at the specified index. More...
 
bool removeAtom (Atom atom)
 Removes the specified atom. More...
 
None clear ()
 Removes all atoms.
 
None swap (ElectronSystem elec_sys)
 Exchanges the state of this electron system with the state of the system elec_sys. More...
 
int getNumElectrons ()
 Returns the total number of electrons contributed by the involved atoms. More...
 
int getElectronContrib (Atom atom)
 Returns the number of electrons contributed by the specified atom. More...
 
int getElectronContrib (int atom)
 Returns the number of electrons contributed by the specified atom. More...
 
None setElectronContrib (Atom atom, int elec_contrib)
 Changes the number of electrons that are contributed by the specified atom. More...
 
None setElectronContrib (int atom, int elec_contrib)
 Changes the number of electrons that are contributed by the specified atom. More...
 
None merge (ElectronSystem elec_sys)
 Merges the atoms and associated electron contributions in the electron system elec_sys with this system. More...
 
bool overlaps (ElectronSystem elec_sys)
 Checks if the electron system shares at least one atom with the system elec_sys. More...
 
bool contains (ElectronSystem elec_sys)
 Checks if all atoms in the electron system elec_sys are also part of this electron system. More...
 
bool connected (ElectronSystem elec_sys, BondContainer bonds)
 Checks if the atom sets of the electron systems do not intersect but are linked by at least one bond. 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.AtomContainer
Atom getAtom (int idx)
 Returns a reference to the atom at index idx. More...
 
bool containsAtom (Atom atom)
 Tells whether the specified Chem.Atom instance is stored in this container. More...
 
int getAtomIndex (Atom atom)
 Returns the index of the specified Chem.Atom instance in this container. More...
 
int getNumAtoms ()
 Returns the number of stored Chem.Atom objects. More...
 
None orderAtoms (ForceField.InteractionFilterFunction2 func)
 Orders the stored 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...
 

Properties

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.ElectronSystem.__init__ ( ElectronSystem  elec_sys)

Initializes a copy of the ElectronSystem instance elec_sys.

Parameters
elec_sysThe ElectronSystem instance to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.ElectronSystem.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python ElectronSystem instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two ElectronSystem instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

Reimplemented from CDPL.Chem.Entity3DContainer.

◆ assign()

ElectronSystem CDPL.Chem.ElectronSystem.assign ( ElectronSystem  elec_sys)

Replaces the current state of self with a copy of the state of the ElectronSystem instance elec_sys.

Parameters
elec_sysThe ElectronSystem instance to copy.
Returns
self

◆ addAtom()

bool CDPL.Chem.ElectronSystem.addAtom ( Atom  atom,
int  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 ( 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/2]

None CDPL.Chem.ElectronSystem.removeAtom ( int  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/2]

bool CDPL.Chem.ElectronSystem.removeAtom ( 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.

◆ swap()

None 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.

◆ getNumElectrons()

int CDPL.Chem.ElectronSystem.getNumElectrons ( )

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

Returns
The total electron count of this system.

◆ getElectronContrib() [1/2]

int CDPL.Chem.ElectronSystem.getElectronContrib ( Atom  atom)

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]

int CDPL.Chem.ElectronSystem.getElectronContrib ( int  atom)

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.

◆ setElectronContrib() [1/2]

None CDPL.Chem.ElectronSystem.setElectronContrib ( Atom  atom,
int  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]

None CDPL.Chem.ElectronSystem.setElectronContrib ( int  atom,
int  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.

◆ merge()

None CDPL.Chem.ElectronSystem.merge ( 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 ( ElectronSystem  elec_sys)

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 ( ElectronSystem  elec_sys)

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 ( ElectronSystem  elec_sys,
BondContainer  bonds 
)

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.

◆ __contains__()

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

◆ __getitem__()

Atom CDPL.Chem.ElectronSystem.__getitem__ ( int  idx)
Parameters
idx
Returns

Reimplemented from CDPL.Chem.AtomContainer.

◆ __len__()

int CDPL.Chem.ElectronSystem.__len__ ( )
Returns

Reimplemented from CDPL.Chem.AtomContainer.