molsysmt.pbc.wrap_to_pbc#

molsysmt.pbc.wrap_to_pbc(molecular_system, selection='all', structure_indices='all', box_origin='[0,0,0] nanometers', box_center=None, center_of_selection=None, weights=None, center_coordinates='[0,0,0] nanometers', compact='component', syntax='MolSysMT', engine='MolSysMT', in_place=False, skip_digestion=False)[source]#

Wrap coordinates into the primary periodic box.

Parameters:
  • molecular_system (molecular system) – Molecular system in any supported MolSysMT format.

  • selection (str, list, tuple, or numpy.ndarray, default='all') – Selection string or boolean/integer array specifying elements.

  • structure_indices (int, list, tuple, or numpy.ndarray, default='all') – Structure indices (0-based) to include or process.

  • box_origin (PyUnitWizard quantity, default='[0,0,0] nanometers') – Periodic box origin in units of length.

  • box_center (PyUnitWizard quantity or None, default=None) – Periodic box center in units of length; None derives it from the box.

  • center_of_selection (str, list, tuple, or numpy.ndarray, or None, default=None) – Atoms whose center defines the translation reference.

  • weights (numpy.ndarray, list, or tuple, default=None) – Atomic mass weights array for center calculation.

  • center_coordinates (PyUnitWizard quantity or None, default='[0,0,0] nanometers') – Coordinates to which the selected center is translated, in units of length.

  • compact (False or str, default='component') – Element kept whole when wrapping. 'component' translates each covalent component as one piece, so no bond is stretched across the cell. False wraps every atom independently, which is what a simulation engine does and what leaves a molecule split across opposite faces.

  • syntax (str, default='MolSysMT') – Selection syntax used to evaluate selection (e.g., ‘MolSysMT’, ‘MDTraj’).

  • engine (str, default='MolSysMT') – Backend used to perform the calculation.

  • in_place (bool, default=False) – Whether to modify the input molecular system in place.

  • skip_digestion (bool, default=False) – Whether to skip MolSysMT’s internal argument digestion mechanism.

Returns:

Wrapped system when in_place=False, otherwise None.

Return type:

molecular system or None

Raises:
  • NotImplementedMethodError – If an unsupported engine is requested.

  • StructuralInconsistencyError – If box vectors are invalid, or if compact names an element and bonds are unavailable.

Notes

With compact=False, atoms are wrapped independently. With compact='component', bonded blocks are reconstructed with minimum-image bond displacements and each block center is wrapped into the requested cell.

Added in version 1.0.0.