Author: bugman Date: Wed Dec 2 16:18:53 2009 New Revision: 10050 URL: http://svn.gna.org/viewcvs/relax?rev=10050&view=rev Log: Bug fix for maths_fns.rotation_matrix.R_to_euler_zyz() for the case where beta = 0. This uses the sub-matrix components of the z rotation to put the full rotation into alpha (gamma is zero). Modified: 1.3/maths_fns/rotation_matrix.py Modified: 1.3/maths_fns/rotation_matrix.py URL: http://svn.gna.org/viewcvs/relax/1.3/maths_fns/rotation_matrix.py?rev=10050&r1=10049&r2=10050&view=diff ============================================================================== --- 1.3/maths_fns/rotation_matrix.py (original) +++ 1.3/maths_fns/rotation_matrix.py Wed Dec 2 16:18:53 2009 @@ -304,11 +304,21 @@ # The beta Euler angle. beta = acos(R[2, 2]) - # The alpha Euler angle. - alpha = atan2(R[2, 1], -R[2, 0]) - - # The gamma Euler angle. - gamma = atan2(R[1, 2], R[0, 2]) + # Problem case - beta is zero so alpha and gamma are indistinguishable. + if R[2, 2] == 1.0: + # Put all the rotation into alpha. + alpha = atan2(R[1, 0], R[0, 0]) + + # Gamma. + gamma = 0.0 + + # Normal case. + else: + # The alpha Euler angle. + alpha = atan2(R[2, 1], -R[2, 0]) + + # The gamma Euler angle. + gamma = atan2(R[1, 2], R[0, 2]) # Return the angles. return alpha, beta, gamma