distances : Utility functions to calculate structural similarity

idpflex.distances.distance_submatrix(dist_mat, indexes)[source]

Extract matrix of distances for a subset of indexes

If matrix is in condensed format, then the submatrix is returned in condensed format too.

Parameters:
  • dist_mat (ndarray) – NxN distance matrix
  • indexes (sequence of int) – sequence of indexes from which a submatrix is extracted.
Returns:

Return type:

ndarray

idpflex.distances.extract_coordinates(a_universe, group, indexes=None)[source]

Obtain XYZ coordinates for an atom group and for a subset of frames

Parameters:
  • a_universe (Universe) – Topology and trajectory.
  • group (AtomGroup) – Atom selection.
  • indexes (list) – sequence of frame indexes
Returns:

XYZ coordinates shape=(M, N, 3) with M number of indexes and N number of atoms in group.

Return type:

ndarray

idpflex.distances.rmsd_matrix(xyz, condensed=False)[source]

RMSD matrix between coordinate frames.

Parameters:
  • xyz (ndarray) – Bare coordinates shape=(N, M, 3) with N: number of frames, M: number of atoms
  • condensed (bool) – Flag return matrix as square or condensed
Returns:

Square NxN matrix, or condensed N*(N+1)/2 matrix

Return type:

ndarray