The Elk Code
eulerrot.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2014 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: eulerrot
8 ! !INTERFACE:
9 pure subroutine eulerrot(ang,rot)
10 ! !INPUT/OUTPUT PARAMETERS:
11 ! ang : Euler angles (alpha, beta, gamma) (in,real(3))
12 ! rot : rotation matrix (out,real(3,3))
13 ! !DESCRIPTION:
14 ! Given a set of Euler angles, $(\alpha,\beta,\gamma)$, this routine
15 ! determines the corresponding $3\times 3$ rotation matrix. The so-called
16 ! `y-convention' is taken for the Euler angles. See the routine {\tt roteuler}
17 ! for details.
18 !
19 ! !REVISION HISTORY:
20 ! Created January 2014 (JKD)
21 !EOP
22 !BOC
23 implicit none
24 ! arguments
25 real(8), intent(in) :: ang(3)
26 real(8), intent(out) :: rot(3,3)
27 ! local variables
28 real(8) sa,sb,sg,ca,cb,cg
29 sa=sin(ang(1)); ca=cos(ang(1))
30 sb=sin(ang(2)); cb=cos(ang(2))
31 sg=sin(ang(3)); cg=cos(ang(3))
32 rot(1,1)=cg*cb*ca-sg*sa
33 rot(2,1)=-sg*cb*ca-cg*sa
34 rot(3,1)=sb*ca
35 rot(1,2)=cg*cb*sa+sg*ca
36 rot(2,2)=-sg*cb*sa+cg*ca
37 rot(3,2)=sb*sa
38 rot(1,3)=-cg*sb
39 rot(2,3)=sg*sb
40 rot(3,3)=cb
41 end subroutine
42 !EOC
43 
pure subroutine eulerrot(ang, rot)
Definition: eulerrot.f90:10