molsysmt.structure.get_distances#

molsysmt.structure.get_distances(molecular_system, selection='all', structure_indices='all', center_of_atoms=False, weights=None, molecular_system_2=None, selection_2=None, structure_indices_2=None, center_of_atoms_2=False, weights_2=None, pairs=False, pbc=True, output_type='numpy.ndarray', output_indices=None, output_structure_indices=None, engine='MolSysMT', syntax='MolSysMT', skip_digestion=False)[source]#

Computing distances between atoms or centers of selections.

Parameters:
  • molecular_system (molecular system) – First system (or the only one if molecular_system_2 is None).

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Atom selections for each system; if pairs=True, a list/array of index pairs is also accepted.

  • selection_2 (str, list, tuple or numpy.ndarray, default 'all') – Atom selections for each system; if pairs=True, a list/array of index pairs is also accepted.

  • structure_indices ('all' or array-like, default 'all') – Structures/frames to analyze (0-based) for each system.

  • structure_indices_2 ('all' or array-like, default 'all') – Structures/frames to analyze (0-based) for each system.

  • center_of_atoms (bool, default False) – If True, use centers of the selected atoms (weighted if weights provided).

  • center_of_atoms_2 (bool, default False) – If True, use centers of the selected atoms (weighted if weights provided).

  • weights (array-like, optional) – Weights for centers when center_of_atoms is True.

  • weights_2 (array-like, optional) – Weights for centers when center_of_atoms is True.

  • molecular_system_2 (molecular system, optional) – Second system; if None, distances are computed within molecular_system.

  • pairs (bool, default False) – If True, interpret selection (or selection/selection_2) as explicit pairs.

  • pbc (bool, default True) – Whether to consider periodic boundary conditions.

  • output_type ({'numpy.ndarray', 'dictionary'}, default 'numpy.ndarray') – Format of the returned distances.

  • output_indices ({'selection', 'atom', 'group'}, optional) – When output_type=’dictionary’, controls labeling of indices.

  • output_structure_indices ({'structure'}, optional) – When output_type=’dictionary’, controls labeling of structure indices.

  • engine ({'MolSysMT'}, default 'MolSysMT') – Backend for the calculation.

  • syntax (str, default 'MolSysMT') – Selection syntax when using strings.

  • skip_digestion (bool, default False) – Whether to skip argument digestion.

Returns:

Distances with shape (n_structures, n_selection[, n_selection_2]) or structured dictionaries, depending on output_type.

Return type:

numpy.ndarray or dict

Raises:

NotImplementedMethodError – If a requested path/output is not supported.

Notes

  • Uses minimum image convention when pbc=True and box is available.

  • When pairs=True, expects explicit pairs; otherwise Cartesian products of selections are used.

Added in version 1.0.0.