rotateframe#
- torchspin.rotateframe(ang0, nRot, rho)[source]#
Rotate an Euler frame around a rotation axis.
Port of EasySpin’s
rotateframe.m.- Parameters:
ang0 (array_like, shape (3,)) – Initial Euler angles
[alpha, beta, gamma]in radians defining the starting orientation.nRot (array_like, shape (3,)) – Unit vector (or non-unit — normalized internally) defining the rotation axis in the molecular frame.
rho (float or array_like, shape (M,)) – Rotation angle(s) in radians around nRot.
- Returns:
ang_new (ndarray, shape (3,) or (M, 3)) – New Euler angles after the rotation(s). Shape
(3,)for scalar rho,(M, 3)for array rho.- Return type:
Notes
The rotation is applied as:
R_new = R_nRot(rho) @ R_ang0where all rotations are passive (alias) z-y’-z’’ convention.The resulting matrix is decomposed back to Euler angles via
eulang.Examples
>>> rotateframe([0, 0, 0], [0, 0, 1], np.pi/2) # rotate by 90° around z array([1.5707..., 0., 0.])