Geometry Utilities#
- cgbind.geom.calc_com(atoms)#
Calculate the centre of mass for a list of xyzs
- Parameters:
atoms – (list(cgbind.atoms.Atom))
- Returns:
(np.ndarray) shape: 3
- cgbind.geom.calc_normalised_vector(coord1, coord2)#
- cgbind.geom.is_geom_reasonable(molecule)#
For an xyz list check to ensure the geometry is sensible, before an optimisation is carried out. There should be no distances smaller than
0.7 Å
- Parameters:
molecule – (cgbind.molecule.BaseStruct)
- Returns:
(bool)
- cgbind.geom.rotation_matrix(axis, theta)#
Return the rotation matrix associated with counterclockwise rotation about the given axis by theta radians.
- Parameters:
axis – (np.ndarray) Unit vector in 3D to rotate around
theta – (float) Angle in radians
- cgbind.geom.get_rot_mat_kabsch(p_matrix, q_matrix)#
Get the optimal rotation matrix with the Kabsch algorithm. Notation is from https://en.wikipedia.org/wiki/Kabsch_algorithm
- Parameters:
p_matrix – (np.ndarray)
q_matrix – (np.ndarray)
- Returns:
(np.ndarray) rotation matrix
- cgbind.geom.get_centered_matrix(mat)#
For a list of coordinates n.e. a n_atoms x 3 matrix as a np array translate to the center of the coordinates
- Parameters:
mat – (np.ndarray)
- Returns:
(np.ndarray) translated coordinates
- cgbind.geom.spherical_to_cart(r, theta, phi)#