molsysmt.structure.get_contacts#
- molsysmt.structure.get_contacts(molecular_system, selection=None, center_of_atoms=False, weights=None, structure_indices='all', selection_2=None, center_of_atoms_2=False, weights_2=None, structure_indices_2=None, threshold='12 angstroms', pairs=False, pbc=True, syntax='MolSysMT', output_type='numpy.ndarray', output_indices=None, use_gpu=None, gpu_backend=None, cell_list=None, parallel=None, num_threads=None, skip_digestion=False)[source]#
Compute a boolean contact map between two sets of atoms (or atom-group centers).
Internally calls
get_distancesand applies a distance threshold to produce a contact map. When only one selection is provided the contact map is computed between all pairs within that selection. When bothselectionandselection_2are provided the map is computed between the two sets.- Parameters:
molecular_system (molecular system) – Molecular system in any supported MolSysMT format.
selection (str, list, tuple, or numpy.ndarray, default=None) – Selection string or boolean/integer array specifying elements.
center_of_atoms (bool, default=False) – Whether to compute distances relative to geometric centers.
weights (numpy.ndarray, list, or tuple, default=None) – Atomic mass weights array for center calculation.
structure_indices (int, list, tuple, or numpy.ndarray, default='all') – Structure indices (0-based) to include or process.
selection_2 (str, list, tuple, or numpy.ndarray, default=None) – Second selection string or boolean/integer array.
center_of_atoms_2 (bool, default=False) – Whether to compute distances relative to geometric centers for selection_2.
weights_2 (numpy.ndarray, list, or tuple, default=None) – Atomic mass weights array for selection_2.
structure_indices_2 (int, list, tuple, or numpy.ndarray, default=None) – Structure indices (0-based) for the second selection.
threshold (float or quantity, default='12 angstroms') – Distance cutoff threshold quantity.
pairs (bool, default=False) – Whether corresponding selections define explicit pairs instead of a Cartesian product.
pbc (bool, default=True) – Whether to take periodic boundary conditions into account.
syntax (str, default='MolSysMT') – Selection syntax used to evaluate selection (e.g., ‘MolSysMT’, ‘MDTraj’).
output_type (str, default='numpy.ndarray') – Representation used for the returned result.
output_indices ({'selection', 'atom', 'group'} or None, default=None) – Index convention included with the returned values.
use_gpu (bool, default=None) – Whether to perform computation using GPU acceleration.
gpu_backend (str or None, default=None) – GPU array backend, or None to use the configured backend.
cell_list ({'auto'}, bool, or None, default=None) – Whether to use cell-list acceleration for eligible contact calculations.
parallel (bool or None, default=None) – Whether to use CPU parallelism, or None to use the configured default.
num_threads (int or None, default=None) – Number of CPU worker threads, or None to use the configured default.
skip_digestion (bool, default=False) – Whether to skip MolSysMT’s internal argument digestion mechanism.
- Returns:
Contact map as a boolean
numpy.ndarray(output_type='numpy.ndarray') or as a list of contacting pairs per frame (output_type='pairs'or'sorted pairs').- Return type:
numpy.ndarray or list
Added in version 1.0.0.