get_centers_of_mass

torch_sim.transforms.get_centers_of_mass(positions, masses, system_idx, n_systems)[source]

Compute the centers of mass for each structure in the simulation state.s.

Parameters:
  • positions (torch.Tensor) – Atomic positions of shape (N, 3).

  • masses (torch.Tensor) – Atomic masses of shape (N,).

  • system_idx (torch.Tensor) – System indices for each atom of shape (N,).

  • n_systems (int) – Total number of systems.

Returns:

A tensor of shape (n_structures, 3) containing

the center of mass coordinates for each structure.

Return type:

Tensor