Coordinate transformations¶
The following utility functions provide mechanisms for spatial transformations for mbuild compounds:
-
mbuild.coordinate_transform.
force_overlap
(move_this, from_positions, to_positions, add_bond=True)[source]¶ Computes an affine transformation that maps the from_positions to the respective to_positions, and applies this transformation to the compound.
Parameters: - move_this : mb.Compound
The Compound to be moved.
- from_positions : np.ndarray, shape=(n, 3), dtype=float
Original positions.
- to_positions : np.ndarray, shape=(n, 3), dtype=float
New positions.
- add_bond : bool, optional, default=True
If from_positions and to_positions are Ports, create a bond between the two anchor atoms.
-
mbuild.coordinate_transform.
translate
(*args, **kwargs)¶
-
mbuild.coordinate_transform.
translate_to
(*args, **kwargs)¶
-
mbuild.coordinate_transform.
rotate
(*args, **kwargs)¶
-
mbuild.coordinate_transform.
spin
(*args, **kwargs)¶
-
mbuild.coordinate_transform.
x_axis_transform
(compound, new_origin=None, point_on_x_axis=None, point_on_xy_plane=None)[source]¶ Move a compound such that the x-axis lies on specified points.
Parameters: - compound : mb.Compound
The compound to move.
- new_origin : mb.Compound or list-like of size 3, optional, default=[0.0, 0.0, 0.0]
Where to place the new origin of the coordinate system.
- point_on_x_axis : mb.Compound or list-like of size 3, optional, default=[1.0, 0.0, 0.0]
A point on the new x-axis.
- point_on_xy_plane : mb.Compound, or list-like of size 3, optional, default=[1.0, 0.0, 0.0]
A point on the new xy-plane.
-
mbuild.coordinate_transform.
y_axis_transform
(compound, new_origin=None, point_on_y_axis=None, point_on_xy_plane=None)[source]¶ Move a compound such that the y-axis lies on specified points.
Parameters: - compound : mb.Compound
The compound to move.
- new_origin : mb.Compound or like-like of size 3, optional, default=[0.0, 0.0, 0.0]
Where to place the new origin of the coordinate system.
- point_on_y_axis : mb.Compound or list-like of size 3, optional, default=[0.0, 1.0, 0.0]
A point on the new y-axis.
- point_on_xy_plane : mb.Compound or list-like of size 3, optional, default=[0.0, 1.0, 0.0]
A point on the new xy-plane.
-
mbuild.coordinate_transform.
z_axis_transform
(compound, new_origin=None, point_on_z_axis=None, point_on_zx_plane=None)[source]¶ Move a compound such that the z-axis lies on specified points.
Parameters: - compound : mb.Compound
The compound to move.
- new_origin : mb.Compound or list-like of size 3, optional, default=[0.0, 0.0, 0.0]
Where to place the new origin of the coordinate system.
- point_on_z_axis : mb.Compound or list-like of size 3, optional, default=[0.0, 0.0, 1.0]
A point on the new z-axis.
- point_on_zx_plane : mb.Compound or list-like of size 3, optional, default=[0.0, 0.0, 1.0]
A point on the new xz-plane.