pbc_wrap_batched_and_get_lattice_shifts¶
- torch_sim.transforms.pbc_wrap_batched_and_get_lattice_shifts(positions, cell, system_idx, pbc)[source]¶
Wrap Cartesian positions into the primary cell and return the applied shifts.
cellrows are lattice vectors (row-vector convention matchingcompute_cell_shiftsand the batched neighbor-list APIs). Fractional coordinates usecell_col = cell[s].Tsor = f @ cell[s]withfin[0, 1)on periodic axes. Atoms in non-periodic systems or systems with singular cells are left unchanged.Returns
(wrapped_positions, lattice_shifts)wherelattice_shifts[i]is the integer vectorfloor(frac_i)on periodic axes (zero elsewhere). The neighbor-list code uses these to correctshifts_idxso they remain valid for the original (unwrapped) input positions.