mdtraj.compute_center_of_mass

mdtraj.compute_center_of_mass(traj, select=None)[source]

Compute the center of mass for each frame.

Parameters:
  • traj (Trajectory) – Trajectory to compute center of mass for

  • select (str, optional, default=all) – a mdtraj.Topology selection string that defines the set of atoms of which to calculate the center of mass, the default is all atoms

Returns:

com – Coordinates of the center of mass for each frame

Return type:

np.ndarray, shape=(n_frames, 3)