repESP.types module¶
Fundamental types used to describe molecules in space
-
class
Dist[source]¶ Bases:
floatDistance in atomic units i.e. Bohr radii (a0)
Bohr radius is the measure of length in atomic units and angstrom is a unit commonly used in computational chemistry. The string representations are thus implemented as follows:
>>> d = Dist(2.3) >>> d Dist(2.3) >>> print(d) 2.3 a₀ (1.2 Å)
Parameters: value (Any) – Any value convertible to float representing the value in units of Bohr radii, e.g. 1.23 or “2.34”.
-
class
Coords[source]¶ Bases:
tuple,typing.GenericThree-dimensional coordinates of a point in space, in atomic units
Parameters: values (Iterable[Any]) – An iterable yielding three values of any type convertible to float representing the coordinates in units of Bohr radii. The values will be converted to Dist.
-
class
Atom(atomic_number: int)[source]¶ Bases:
objectDataclass representing an atom of a certain element
If more information should be associated with an atom, it’s easy to inherit from this class.
Parameters: atomic_number (int) – The atomic number of the element Raises: ValueError– Raised in case the given atomic number is not recognized-
atomic_number¶ See initialization parameter
-
symbol¶ The chemical symbol of this atom
-
classmethod
from_symbol(symbol: str, *args, **kwargs) → AtomT[source]¶ Alternative initialization from chemical symbol
Despite not being documented, this constructor is inherited by the subclasses of this class. *args and **kwargs will be forwarded to the initializer of the subclass.
Parameters: symbol (str) – The chemical symbol of the element, e.g. “Be”. Raises: ValueError– Raised in case the given chemical symbol is not recognized
-
-
class
AtomWithCoords(atomic_number: int, coords: repESP.types.Coords)[source]¶ Bases:
repESP.types.AtomDataclass representing an atom of a certain element in space
Parameters: Raises: ValueError– Raised in case the given atomic number is not recognized-
atomic_number¶ See initialization parameter
-
coords¶ See initialization parameter
-
-
class
Molecule(atoms: List[GenericAtom_co])[source]¶ Bases:
typing.GenericA basic dataclass representing a molecule
“Basic” because no characteristics of the molecule, like bonding, are stored in this class in addition to the list of constituent atoms.
This class is generic in the type of GenericAtom_co, which must be a subtype of Atom. This allows the molecule to store Atom objects as well as other objects, e.g. AtomWithCoords.
Parameters: atoms (typing.List[Atom]) – The constituent atoms of the molecule. Any Atom subtype is valid. -
atoms¶ See initialization parameter
-