build_linked_cell_neighborhood¶
- torch_sim.transforms.build_linked_cell_neighborhood(positions, cell, pbc, cutoff, n_atoms, self_interaction=False)[source]¶
Build the neighbor list of a given set of atomic structures using the linked cell algorithm.
This function constructs a neighbor list for multiple atomic structures by applying the linked cell method. It handles periodic boundary conditions and returns the indices of neighboring atoms along with their corresponding structure information.
- Parameters:
positions (Tensor) – A tensor containing the atomic positions for each structure, where each row corresponds to an atom’s position in 3D space.
cell (Tensor) – A tensor containing the unit cell vectors for each structure, formatted as a 3D array.
pbc (Tensor) – A boolean tensor indicating the periodic boundary conditions to apply for each structure.
cutoff (float) – The distance threshold used to determine which atoms are considered neighbors.
n_atoms (Tensor) – A tensor containing the number of atoms in each structure.
self_interaction (bool) – If set to True, the original atoms will be included as their own neighbors. Default is False.
- Returns:
mapping (torch.Tensor): A tensor containing pairs of indices where mapping[0] represents the central atom indices and mapping[1] represents their corresponding neighbor indices.
batch_mapping (torch.Tensor): A tensor containing the structure indices corresponding to each neighbor atom.
cell_shifts_idx (torch.Tensor): A tensor containing the cell shift indices for each neighbor atom, which are necessary for reconstructing the positions of the neighboring atoms.
- Return type: