cmp_contact_count_matrices

contact_hist.cmp_contact_count_matrices(cm, natms_per_refcmp=1, natms_per_selcmp=1, dtype=int)[source]

Take a contact matrix and return all possible compound contact count matrices.

A compound is usually a chemically meaningfull subgroup of an AtomGroup. This can e.g. be a Segment, Residue, fragment or a single Atom. Refer to the MDAnalysis’ user guide for an explanation of these terms. Note that in any case, only Atoms belonging to the original AtomGroup are taken into account, even if the compound might comprise additional Atoms that are not contained in the original AtomGroup.

Parameters:
  • cm (array_like) – (Boolean) contact matrix of shape (m, n) as e.g. generated by mdtools.structure.contact_matrix(), where m is the number of reference Atoms and n is the number of selection Atoms.

  • natms_per_refcmp (int or array_like, optional) – Number of Atoms per reference compound. Can be a single integer or an array of integers. If natms_per_refcmp is a single integer, all reference compounds are assumed to contain the same number of Atoms. In this case, natms_per_refcmp must be an integer divisor of cm.shape[0]. If natms_per_refcmp is an array of integers, it must contain the number of reference Atoms for each single reference compound. In this case, numpy.sum(natms_per_refcmp) must be equal to cm.shape[0].

  • natms_per_selcmp (int or array_like, optional) – Same for selection compounds (natms_per_selcmp is checked against cm.shape[1]).

  • dtype (dtype, optional) – Data type of the output arrays.

Returns:

  • ccm_refatm_selcmp (numpy.ndarray) – Contact count matrix indicating how many contacts exsit between a reference Atom and a selection compound.

  • ccm_refcmp_selatm (numpy.ndarray) – Same for reference compounds and selection Atoms.

  • ccm_refcmp_selcmp (numpy.ndarray) – Same for reference and selection compounds.

See also

mdtools.structure.cmp_contact_count_matrix()

Take an Atom contact matrix and sum the contacts of all Atoms belonging to the same compound.