rotate_about_axis#

biotite.structure.rotate_about_axis(atoms, axis, angle, support=None)[source]#

Rotate the given atoms or coordinates about a given axis by a given angle.

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.

axisarray-like, length=3

A vector representing the direction of the rotation axis. The length of the vector is irrelevant.

anglefloat

The rotation angle in radians.

supportarray-like, length=3, optional

An optional support vector for the rotation axis, i.e. the center of the rotation. By default, the center of the rotation is at (0,0,0).

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 about the given axis.

Examples

Rotation about a custom axis on the y-z-plane by 90 degrees:

>>> position = np.array([2.0, 0.0, 0.0])
>>> axis = [0.0, 1.0, 1.0]
>>> rotated = rotate_about_axis(position, axis, angle=0.5*np.pi)
>>> print(rotated)
[ 1.225e-16  1.414e+00 -1.414e+00]