rotate#

biotite.structure.rotate(atoms, angles)[source]#

Rotate the given atoms or coordinates about the x, y and z axes by given angles.

The rotations are centered at the origin and are performed sequentially in the order x, y, z.

Parameters:
atomsAtom or AtomArray or AtomArrayStack or ndarray, shape=(3,) or shape=(n,3) or shape=(m,n,3)

The atoms of which the coordinates are transformed. The coordinates can be directly provided as ndarray.

angles: array-like, length=3

The rotation angles in radians around x, y and z.

Returns:
transformedAtom or AtomArray or AtomArrayStack or ndarray, shape=(3,) or shape=(n,3) or shape=(m,n,3)

A copy of the input atoms or coordinates, rotated by the given angles.

Examples

Rotation about the z-axis by 90 degrees:

>>> position = np.array([2.0, 0.0, 0.0])
>>> rotated = rotate(position, angles=(0, 0, 0.5*np.pi))
>>> print(rotated)
[1.225e-16 2.000e+00 0.000e+00]