Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 :
7 : module m_eulerrot
8 : use m_judft
9 : c************************************
10 : c Perform Euler rotations.
11 : c Y. Mokrousov
12 : c
13 : c tidied up version
14 : c Frank Freimuth
15 : c************************************
16 : contains
17 8 : subroutine eulerrot(
18 8 : > nwfs,alpha,beta,gamma,
19 8 : < amx)
20 : c************************************************************************
21 : c..Perform "nwfs" Euler rotations.
22 : c..Input: Set of "nwfs" Euler angles: alpha(i),beta(i),gamma(i); i=1,nwfs
23 : c..Output: "nwfs" rotation matrices: amx(:,:,i); i=1,nwfs
24 : c************************************************************************
25 :
26 : implicit none
27 :
28 : integer, intent (in) :: nwfs
29 : real, intent (in) :: alpha(nwfs),beta(nwfs),gamma(nwfs)
30 : real, intent (out) :: amx(3,3,nwfs)
31 :
32 : integer :: nwf
33 :
34 8 : call timestart("eulerrot")
35 :
36 72 : do nwf = 1,nwfs
37 : call eulerrot1(
38 : > alpha(nwf),beta(nwf),gamma(nwf),
39 72 : < amx(1,1,nwf) )
40 : enddo
41 :
42 8 : call timestop("eulerrot")
43 8 : end subroutine eulerrot
44 :
45 64 : subroutine eulerrot1(
46 : > alpha,beta,gamma,
47 : < amx)
48 : c***********************************************************************
49 : c..Perform one Euler rotation.
50 : c..Input: Euler angles: alpha, beta, gamma
51 : c..Output: Rotation matrix: amx(:,:)
52 : c
53 : c..Given the Euler angles, the following procedure is
54 : c..performed:
55 : c..1. Rotation around the z-axis by alpha (matrix D)
56 : c..2. Rotation around the x-axis by beta (matrix C)
57 : c..3. Rotation around the z-axis by gamma again. (matrix B)
58 : c..The overall rotation is given by the matrix A = B*C*D
59 : c***********************************************************************
60 :
61 : implicit none
62 :
63 : real, intent (in) :: alpha,beta,gamma
64 : real, intent (out) :: amx(3,3)
65 :
66 : real :: bmx(3,3),cmx(3,3),dmx(3,3),hmx(3,3)
67 :
68 64 : call timestart("eulerrot1")
69 64 : dmx(1,1) = cos(alpha) ; dmx(1,2) = sin(alpha) ; dmx(1,3) = 0.
70 64 : dmx(2,1) =-sin(alpha) ; dmx(2,2) = cos(alpha) ; dmx(2,3) = 0.
71 64 : dmx(3,1) = 0. ; dmx(3,2) = 0. ; dmx(3,3) = 1.
72 :
73 64 : cmx(1,1) = 1. ; cmx(1,2) = 0. ; cmx(1,3) = 0.
74 64 : cmx(2,1) = 0. ; cmx(2,2) = cos(beta) ; cmx(2,3) = sin(beta)
75 64 : cmx(3,1) = 0. ; cmx(3,2) =-sin(beta) ; cmx(3,3) = cos(beta)
76 :
77 64 : bmx(1,1) = cos(gamma) ; bmx(1,2) = sin(gamma) ; bmx(1,3) = 0.
78 64 : bmx(2,1) =-sin(gamma) ; bmx(2,2) = cos(gamma) ; bmx(2,3) = 0.
79 64 : bmx(3,1) = 0. ; bmx(3,2) = 0. ; bmx(3,3) = 1.
80 :
81 2560 : hmx = matmul(cmx,dmx)
82 2560 : amx = matmul(bmx,hmx)
83 :
84 64 : call timestop("eulerrot1")
85 64 : end subroutine eulerrot1
86 :
87 :
88 : end module m_eulerrot
|