molsysmt.structure.get_minimum_distances#

molsysmt.structure.get_minimum_distances(molecular_system, selection='all', center_of_atoms=False, weights=None, as_entity=True, structure_indices='all', molecular_system_2=None, selection_2=None, center_of_atoms_2=False, weights_2=None, as_entity_2=True, structure_indices_2=None, pairs=False, pbc=False, engine='MolSysMT', syntax='MolSysMT', skip_digestion=False)[source]#

Find the minimum pairwise distances between two sets of atoms (or atom-group centers).

Internally calls get_distances and then reduces the full distance matrix by selecting the minimum entry according to the as_entity / as_entity_2 flags.

Parameters:
  • molecular_system (molecular system) – Molecular system in any supported MolSysMT format.

  • selection (str, list, tuple, or numpy.ndarray, default='all') – 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.

  • as_entity (bool, default=True) – Whether each nested selection is treated as a single distance entity.

  • structure_indices (int, list, tuple, or numpy.ndarray, default='all') – Structure indices (0-based) to include or process.

  • molecular_system_2 (molecular system or None, default=None) – Second molecular system to compare with the first one.

  • 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.

  • as_entity_2 (bool, default=True) – Whether each nested selection in the second system is treated as one entity.

  • structure_indices_2 (int, list, tuple, or numpy.ndarray, default=None) – Structure indices (0-based) for the second selection.

  • pairs (bool, default=False) – Whether corresponding selections define explicit pairs instead of a Cartesian product.

  • pbc (bool, default=False) – Whether to take periodic boundary conditions into account.

  • engine (str, default='MolSysMT') – Backend used to perform the calculation.

  • syntax (str, default='MolSysMT') – Selection syntax used to evaluate selection (e.g., ‘MolSysMT’, ‘MDTraj’).

  • skip_digestion (bool, default=False) – Whether to skip MolSysMT’s internal argument digestion mechanism.

Returns:

  • pairs_indices (numpy.ndarray) – Indices of the element pair (within the selection arrays) that achieves the minimum distance. Shape depends on the as_entity flags and whether pairs mode is active.

  • dists (quantity) – PyUnitWizard length quantity of the corresponding minimum distances in the standard length unit (nm).

Raises:

ArgumentConflictError – If both as_entity and as_entity_2 are False (use get_distances directly in that case), or if pairs=True with as_entity=False or as_entity_2=False.

Added in version 1.0.0.