50real(8),
intent(in) :: rot(3,3)
51real(8),
intent(out) :: ang(3)
53real(8),
parameter :: eps=1.d-8
54real(8),
parameter :: pi=3.1415926535897932385d0
57det=rot(1,1)*(rot(2,2)*rot(3,3)-rot(3,2)*rot(2,3)) &
58 +rot(2,1)*(rot(3,2)*rot(1,3)-rot(1,2)*rot(3,3)) &
59 +rot(3,1)*(rot(1,2)*rot(2,3)-rot(2,2)*rot(1,3))
60if (abs(det-1.d0) > eps)
then
62 write(*,
'("Error(roteuler): matrix improper or not unitary")')
63 write(*,
'(" Determinant : ",G18.10)') det
67if ((abs(rot(3,1)) > eps).or.(abs(rot(3,2)) > eps))
then
68 ang(1)=atan2(rot(3,2),rot(3,1))
69 if (abs(rot(3,1)) > abs(rot(3,2)))
then
70 ang(2)=atan2(rot(3,1)/cos(ang(1)),rot(3,3))
72 ang(2)=atan2(rot(3,2)/sin(ang(1)),rot(3,3))
74 ang(3)=atan2(rot(2,3),-rot(1,3))
76 ang(1)=atan2(rot(1,2),rot(1,1))
77 if (rot(3,3) > 0.d0)
then