pisces.extensions.simulation.core.initial_conditions.InitialConditions.shift_to_COM_frame#

InitialConditions.shift_to_COM_frame(models: str | list[str] = 'all', masses: dict[str, unyt_quantity] | None = None) None[source]#

Shift the positions and velocities of models into the center-of-mass (COM) frame.

This method:
  1. Computes the COM position and velocity for the specified models.

  2. Subtracts these values from each model’s position and velocity.

  3. Updates the configuration in-place so the changes are persistent.

Parameters:
  • models (str or list of str, optional) – Models to include in the COM calculation and shifting. If "all" (default), all models are included. If a single model name is given, it will be treated as a list of one.

  • masses (dict of str, unyt_quantity, optional) – Optional mapping from model name to its total mass. Overrides total_mass in metadata if provided.

Raises:
  • KeyError – If any specified model name is not found in the initial conditions.

  • ValueError – If mass data is missing for a model and COM computation is required.