Previous topic

geomm.box_vectors module

Next topic

geomm.centroid module

This Page

geomm.centering module

geomm.centering.center(coords, center_point)[source]

Center coordinates at the origin based on a center point.

If idxs are given the center of mass is computed only from those coordinates and if weights are given a weighted center of mass is computed.

Parameters
  • coords (arraylike) – The coordinates you wish to center.

  • center_point (arraylike of float of 1 dimension) – The point to center all other coordinates around. Should have one element for each dimension of coords

Returns

centered_coords – Transformed coordinates.

Return type

arraylike

geomm.centering.center_around(coords, idxs, weights=None)[source]

Center coordinates at the origin based on a center point.

If idxs are given the center of mass is computed only from those coordinates and if weights are given a weighted center of mass is computed.

Parameters
  • coords (arraylike) – The coordinates you wish to center.

  • idxs (arraylike of int) – The idxs of the coordinates to actually compute the centroid on, although the translation will act on all the coordinates.

  • weights (arraylike of float, optional) – Give weights to the coordinates for a weighted centroid (‘center of mass’).

Returns

centered_coords – Transformed coordinates.

Return type

arraylike

geomm.centering.apply_rectangular_pbcs(coords, unitcell_side_lengths, center_point=(0.0, 0.0, 0.0))[source]

Apply rectangular Periodic Boundary Conditions (PBCs) given the lengths of the unitcell and a center point positions of the box in the coordinate space. The default for the center point is (0,0,0) which is the case for OpenMM MD frames but not other MD systems.

Parameters
  • coords (arraylike) – The coordinate array of the particles you will be transforming.

  • unitcell_side_lengths (arraylike of shape (3)) – The lengths of the sides of a rectangular unitcell.

Returns

wrapped_coords – Transformed coordinates. All fit within the box.

Return type

arraylike

Warning

This method does not understand molecular topologies and will “break” bonds when moving molecules through boundaries.

geomm.centering.center_complex(coords, complex_idxs)[source]

For a system with periodic boundary conditions move all members of a complex to the same image of the unitcell.

Parameters
  • coords (arraylike) – The coordinate array of the particles you will be transforming.

  • complex_idxs (list of arraylikes of int of rank 1) – A list where each member represents a member of the complex and is a collection of the indices that define that member.

Returns

centered_coords – Transformed coordinates.

Return type

arraylike