Molecule: Geometry

Molecule: Geometry#

Collection of utility functions for calculations related to the geometry of a molecule. This includes: - Bond angles - Linear molecule detection

tad_mctc.molecule.geometry.bond_angles(numbers, positions)[source]#

Calculate all bond angles. Also works for batched systems.

Parameters:
  • numbers (Tensor) – Atomic numbers for all atoms in the system of shape (..., nat).

  • positions (Tensor) – Cartesian coordinates of all atoms (shape: (..., nat, 3)).

Returns:

Tensor of bond angles of shape (…, nat, nat, nat).

Return type:

Tensor

tad_mctc.molecule.geometry.is_linear(numbers, positions, atol=1e-08, rtol=1e-05)[source]#

Check if a molecule is linear based on bond angles.

Parameters:
  • numbers (Tensor) – Atomic numbers for all atoms in the system of shape (..., nat).

  • positions (Tensor) – Cartesian coordinates of all atoms (shape: (..., nat, 3)).

  • atol (float, optional) – Absolute tolerance for the comparison. Defaults to 1e-8.

  • rtol (float, optional) – Relative tolerance for the comparison. Defaults to 1e-5.

Returns:

Boolean tensor of shape (…, ) indicating if the molecule is linear.

Return type:

Tensor