scatter_bin_index¶
- torch_sim.transforms.scatter_bin_index(n_bins, max_n_atom_per_bin, n_images, bin_index)[source]¶
Convert a linear table of bin indices into a structured bin ID table.
This function takes a linear table of bin indices and organizes it into a 2D table where each row corresponds to a bin and each column corresponds to an atom index. Empty entries in the resulting table are filled with a placeholder value (n_images) to facilitate later removal.
- Parameters:
n_bins (int) – The total number of bins.
max_n_atom_per_bin (int) – The maximum number of atoms that can be stored in each bin.
n_images (int) – The total number of atoms, including periodic boundary condition replicas.
bin_index (Tensor) – A tensor mapping each atom index to its corresponding bin index.
- Returns:
A tensor of shape [n_bins, max_n_atom_per_bin] relating bin indices (rows) to atom indices (columns).
- Return type: