molecool_test.molecule

Functions for molecule analysis

Module Contents

Functions

build_bond_list(coordinates, max_bond=1.5, min_bond=0)

Build a list of bonds in a set of coordinates based on a distance criteria.

calculate_molecular_mass(symbols)

Calculate the mass of a molecule.

calculate_center_of_mass(symbols, coordinates)

Calculate the center of mass of a molecule.

molecool_test.molecule.build_bond_list(coordinates, max_bond=1.5, min_bond=0)[source]

Build a list of bonds in a set of coordinates based on a distance criteria.

Parameters
  • coordinates (np.ndarray) – The coordinates of the atoms to analyze in an (natoms, ndim) array.

  • max_bond (float, optional) – The maximum distance for two atoms to be considered bonded.

  • min_bond (float, optional) – The minimum distance for two atoms to be considered bonded.

Returns

bonds – A dictionary containing bonded atoms with atom pairs as keys and the distance between the atoms as the value.

Return type

dict

molecool_test.molecule.calculate_molecular_mass(symbols)[source]

Calculate the mass of a molecule.

Parameters

symbols (list) – A list of elements.

Returns

mass – The mass of the molecule

Return type

float

molecool_test.molecule.calculate_center_of_mass(symbols, coordinates)[source]

Calculate the center of mass of a molecule.

The center of mass is weighted by each atom’s weight.

Parameters
  • symbols (list) – A list of elements for the molecule

  • coordinates (np.ndarray) – The coordinates of the molecule.

Returns

center_of_mass – The center of mass of the molecule.

Return type

np.ndarray

Notes

The center of mass is calculated with the formula

\[\vec{R}=\frac{1}{M} \sum_{i=1}^{n} m_{i}\vec{r_{}i}\]