pychemcurv.geometry

This module implements utility functions to compute several geometric properties.

pychemcurv.geometry.center_of_mass(coords, masses=None)[source]

Compute the center of mass of the points at coordinates coords with masses masses.

Parameters:
  • coords (np.ndarray) – (N, 3) matrix of the points in \(\mathbb{R}^3\)
  • masses (np.ndarray) – vector of length N with the masses
Returns:

The center of mass as a vector in \(\mathbb{R}^3\)

pychemcurv.geometry.circum_center(coords)[source]

Compute the coordinates of the center of the circumscribed circle from three points A, B and C in \(\mathbb{R}^3\).

Parameters:coords (ndarray) – (3x3) cartesian coordinates of points A, B and C.
Returns
The coordinates of the center of the cicumscribed circle
pychemcurv.geometry.get_plane(coords, masses=None)[source]

Given a set of N points in \(\mathbb{R}^3\), compute an orthonormal basis of vectors, the first two belonging to the plane and the third one being normal to the plane. In the particular case where N equal 3, there is an exact definition of the plane as the three points define an unique plan.

If N = 3, use a gram-schmidt orthonormalization to compute the vectors. If N > 3, the orthonormal basis is obtained from SVD.

Parameters:
  • coords (np.ndarray) – (N, 3) matrix of the points in \(\mathbb{R}^3\)
  • masses (np.ndarray) – vector of length N with the masses
Returns:

Returns the orthonormal basis (vecx, vecy, n_a), vector n_a being normal to the plane.

pychemcurv.geometry.get_dihedral(coords)[source]

Compute the improper angle in randians between planes defined by points (0, 1, 2) and (1, 2, 3). The returned angle is a dihedral angle if the points 0, 1, 2 and 3 form a chain of bonded atoms in this order.

0        3
 \      /
  1 -- 2

The returned angle is an improper angle if point 0 is at the center and linked to other points.

   3
   |
   0
  /  \
1     2
Parameters:coords (ndarray) – numpy array of the cartesian coordinates with shape (4, 3)
Returns
The dihedral angle value in radians.