compute_cell_shifts

torch_sim.transforms.compute_cell_shifts(cell, shifts_idx, batch_mapping)[source]

Compute the cell shifts based on the provided indices and cell matrix.

This function calculates the shifts to apply to positions based on the specified indices and the unit cell matrix. If the cell is None, it returns None.

Parameters:
  • cell (Tensor) – A tensor of shape (n_cells, 3, 3) representing the unit cell matrices.

  • shifts_idx (Tensor) – A tensor of shape (n_shifts, 3) representing the indices for shifts.

  • batch_mapping (Tensor) – A tensor of shape (n_batches,) that maps the shifts to the corresponding cells.

Returns:

A tensor of shape (n_batches, 3) containing

the computed cell shifts.

Return type:

Tensor