qrunch.chemistry.molecule.molecule

Module with definition of a molecule.

Classes

Molecule

Molecule object which stores information on constituent atoms, coordinates, and units.

class Molecule

Bases: HasMetadataHashMethod

Molecule object which stores information on constituent atoms, coordinates, and units.

__init__(atoms: list[tuple[~qrunch.chemistry.molecule.atom.Atom, ~qrunch.chemistry.molecule.coordinates.Coordinates]], *, unit: ~qrunch.common.units._base.Unit[~qrunch.common.units.length.Length] = <class 'qrunch.common.units.length.Angstrom'>) None

Initialize instance of molecule class.

Parameters:
  • atoms (list[tuple[Atom, Coordinates]]) – List of tuple of atoms and their coordinates.

  • unit (Unit[Length]) – The unit of the coordinates. Defaults to Ångström.

Raises:

ValueError – If one or more coordinates of the atoms overlap.

Return type:

None

property atom_positions: list[Coordinates]

Get the position of each atom in the molecule.

atom_subset_string(atom_subset: Iterable[int]) str

Provide a human-readable string representation for the embedded atoms.

Parameters:

atom_subset (Iterable[int]) – Iterable of atom indexes.

Return type:

str

property chemical_elements: list[Atom]

Get the elements of each atom in the molecule.

classmethod from_builtins(atom_data: ~collections.abc.Sequence[tuple[str | int, float, float, float]], unit: ~qrunch.common.units._base.Unit[~qrunch.common.units.length.Length] = <class 'qrunch.common.units.length.Angstrom'>) Molecule

Create a Molecule instance from a sequence of atom data written using simple Python builtins.

Parameters:
  • atom_data (Sequence[tuple[str | int, float, float, float]]) – List of tuples containing atom symbol (or atomic number) and its coordinates (x, y, z).

  • unit (Unit[Length]) – The unit of the coordinates. Defaults to Ångström.

Return type:

Molecule

property number_of_atoms: int

The number of atoms.

to_unit(new_unit: Unit[Length]) Molecule

Convert the coordinate units to the specified unit.

Parameters:

new_unit (Unit[Length]) – Unit to convert the coordinates to.

Return type:

Molecule