mlcolvar.data.graph.get_neighborhood

class mlcolvar.data.graph.get_neighborhood(positions: ndarray, cutoff: float, pbc: Tuple[bool, bool, bool] | None = None, cell: ndarray | None = None, true_self_interaction: bool | None = False, system_indices: List[int] | None = None, environment_indices: List[int] | None = None, buffer: float = 0.0)[source]

Bases:

Get the neighbor list of a given set atoms.

Parameters:
  • positions (numpy.ndarray (shape: [N, 3])) – The positions array.

  • cutoff (float) – The cutoff radius.

  • pbc (Tuple[bool, bool, bool] (shape: [3])) – If to enable PBC in the directions of the three lattice vectors.

  • cell (numpy.ndarray (shape: [3, 3])) – The lattice vectors.

  • true_self_interaction (bool) – If to keep self-edges that don’t cross periodic boundaries.

  • system_indices (List[int]) – Indices of the atoms to be considered as the ‘system’ if restricting the neighborhood to a subsystem (i.e., system + environment), see also Notes section.

  • environment_indices (List[int]) – Indices of the atoms to be considered as the ‘environment’ if restricting the neighborhood to a subsystem (i.e., system + environment), see also Notes section. Only atoms within the cutoff will be included as active enviroment atoms

  • buffer (float) – Buffer size used in finding active environment atoms, if restricting the neighborhood to a subsystem (i.e., system + environment), see also Notes section.

Returns:

  • edge_index (numpy.ndarray (shape: [2, n_edges])) – The edge indices (i.e., source and destination) in the graph.

  • shifts (numpy.ndarray (shape: [n_edges, 3])) – The shift vectors (unit_shifts * cell_lengths).

  • unit_shifts (numpy.ndarray (shape: [n_edges, 3])) – The unit shift vectors (number of PBC crossed by the edges).

Notes

Arguments system_indices and environment_indices must present at the same time. When these arguments are given, only edges in the [subsystem] formed by [the systems atoms] and [the environment atoms within the cutoff radius of the systems atoms] will be kept. These two lists could not contain common atoms.

__init__(**kwargs)