parse_rotation

sisl.utils.parse_rotation(rotation, rad, abc=None)

Parses a sequence of rotation arguments.

Parameters:
Return type:

Quaternion

Examples

A rotation of 45 degrees around the \(x\) axis. >>> q = parse_rotation([45, “x”], rad=False)

A rotation of 45 degrees around the \(y\) axis, but specified through the 2nd index of the abc argument >>> q = parse_rotation([45, “b”], rad=False, abc=[[1, 0, 0], [0, 1, 0], [0, 0, 1]])

A rotation of 45 degrees around the \(xy\) plane: >>> q = parse_rotation([45, “xy”], rad=False)

A rotation of 45 degrees around the vector along \(x+y\): >>> q = parse_rotation([45, “x+y”], rad=False)

Explicitly specify the angle and the vector of rotation (around \(xy\) vector) >>> q = parse_rotation([np.pi/4, [0.4, 0.4, 0]])

Explicitly specify the angle of rotation around all three Cartesian coordinates >>> q = parse_rotation([np.pi/4, np.pi/2, np.pi/4])

Specify a list of rotations: >>> q = parse_rotation([ … [np.pi/4, np.pi/2, np.pi/4], … [np.pi/3, “x”], … [np.pi/3, (0.1, 0.2, 0.3)], rad=True)

See also

Quaternion

returned class

Quaternion.rotation_matrix

to retrieve an explicit rotation matrix.