get_linear_bin_idx

torch_sim.transforms.get_linear_bin_idx(cell, pos, n_bins_s)[source]

Calculate the linear bin index for each position within a defined box.

This function computes the linear bin index for each position based on the provided cell vectors and the number of bins in each direction. The positions are first scaled according to the cell dimensions, and then the corresponding bin indices are determined.

Parameters:
  • cell (Tensor) – A tensor of shape [3, 3] representing the cell vectors defining the box.

  • pos (Tensor) – A tensor of shape [-1, 3] representing the set of positions to be binned.

  • n_bins_s (Tensor) – A tensor of shape [3] representing the number of bins in each direction.

Returns:

A tensor containing the linear bin indices for each position.

Return type:

Tensor