spyrmsd.rmsd module

spyrmsd.rmsd.hrmsd(coords1: ndarray, coords2: ndarray, atomicn1: ndarray, atomicn2: ndarray, center=False)[source]

Compute minimum RMSD using the Hungarian method.

Parameters
  • coords1 (np.ndarray) – Coordinate of molecule 1

  • coords2 (np.ndarray) – Coordinates of molecule 2

  • atomicn1 (np.ndarray) – Atomic numbers for molecule 1

  • atomicn2 (np.ndarray) – Atomic numbers for molecule 2

Returns

Minimum RMSD (after assignment)

Return type

float

Notes

The Hungarian algorithm is used to solve the linear assignment problem, which is a minimum weight matching of the molecular graphs (bipartite). 2

The linear assignment problem is solved for every element separately.

2

W. J. Allen and R. C. Rizzo, Implementation of the Hungarian Algorithm to Account for Ligand Symmetry and Similarity in Structure-Based Design, J. Chem. Inf. Model. 54, 518-529 (2014)

spyrmsd.rmsd.rmsd(coords1: ndarray, coords2: ndarray, atomicn1: ndarray, atomicn2: ndarray, center: bool = False, minimize: bool = False, atol: float = 1e-09) float[source]

Compute RMSD

Parameters
  • coords1 (np.ndarray) – Coordinate of molecule 1

  • coords2 (np.ndarray) – Coordinates of molecule 2

  • atomicn1 (np.ndarray) – Atomic numbers for molecule 1

  • atomicn2 (np.ndarray) – Atomic numbers for molecule 2

  • center (bool) – Center molecules at origin

  • minimize (bool) – Compute minimum RMSD (with QCP method)

  • atol (float) – Absolute tolerance parameter for QCP method (see qcp_rmsd())

Returns

RMSD

Return type

float

Notes

When minimize=True, the QCP method is used. 1 The molecules are centred at the origin according to the center of geometry and superimposed in order to minimize the RMSD.

1

D. L. Theobald, Rapid calculation of RMSDs using a quaternion-based characteristic polynomial, Acta Crys. A 61, 478-480 (2005).

spyrmsd.rmsd.rmsdwrapper(molref: Molecule, mols: Union[Molecule, List[Molecule]], symmetry: bool = True, center: bool = False, minimize: bool = False, strip: bool = True, cache: bool = True) Any[source]

Compute RMSD between two molecule.

Parameters
  • molref (molecule.Molecule) – Reference molecule

  • mols (Union[molecule.Molecule, List[molecule.Molecule]]) – Molecules to compare to reference molecule

  • symmetry (bool, optional) – Symmetry-corrected RMSD (using graph isomorphism)

  • center (bool, optional) – Center molecules at origin

  • minimize (bool, optional) – Minimised RMSD (using the quaternion polynomial method)

  • strip (bool, optional) – Strip hydrogen atoms

Returns

RMSDs

Return type

List[float]

spyrmsd.rmsd.symmrmsd(coordsref: ndarray, coords: Union[ndarray, List[ndarray]], apropsref: ndarray, aprops: ndarray, amref: ndarray, am: ndarray, center: bool = False, minimize: bool = False, cache: bool = True, atol: float = 1e-09) Any[source]

Compute RMSD using graph isomorphism for multiple coordinates.

Parameters
  • coordsref (np.ndarray) – Coordinate of reference molecule

  • coords (List[np.ndarray]) – Coordinates of other molecule

  • apropsref (np.ndarray) – Atomic properties for reference

  • aprops (np.ndarray) – Atomic properties for other molecule

  • amref (np.ndarray) – Adjacency matrix for reference molecule

  • am (np.ndarray) – Adjacency matrix for other molecule

  • center (bool) – Centering flag

  • minimize (bool) – Minimum RMSD

  • cache (bool) – Cache graph isomorphisms

  • atol (float) – Absolute tolerance parameter for QCP (see qcp_rmsd())

Returns

float – Symmetry-corrected RMSD(s) and graph isomorphisms

Return type

Union[float, List[float]]

Notes

Graph isomorphism is introduced for symmetry corrections. However, it is also useful when two molecules do not have the atoms in the same order since atom matching according to atomic numbers and the molecular connectivity is performed. If atoms are in the same order and there is no symmetry, use the rmsd function.