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:
Computes the COM position and velocity for the specified models.
Subtracts these values from each model’s position and velocity.
Updates the configuration in-place so the changes are persistent.
- Parameters:
models (
str
orlist
ofstr
, 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
ofstr
,unyt_quantity
, optional) – Optional mapping from model name to its total mass. Overridestotal_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.