File: axangsu2.f90

package info (click to toggle)
elkcode 10.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 10,672 kB
  • sloc: f90: 52,747; perl: 964; makefile: 352; sh: 296; python: 105; ansic: 67
file content (50 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

! Copyright (C) 2007-2008 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

!BOP
! !ROUTINE: axangsu2
! !INTERFACE:
pure subroutine axangsu2(v,th,su2)
! !INPUT/OUTPUT PARAMETERS:
!   v   : rotation axis vector (in,real(3))
!   th  : rotation angle (in,real)
!   su2 : SU(2) representation of rotation (out,complex(2,2))
! !DESCRIPTION:
!   Finds the complex ${\rm SU}(2)$ representation of a rotation defined by an
!   axis vector $\hat{\bf v}$ and angle $\theta$. The spinor rotation matrix is
!   given explicitly by
!   $$ R^{1/2}(\hat{\bf v},\theta)=I\cos\frac{\theta}{2}
!    -i(\hat{\bf v}\cdot\vec{\sigma})\sin\frac{\theta}{2}. $$
!
! !REVISION HISTORY:
!   Created August 2007 (JKD)
!EOP
!BOC
implicit none
! arguments
real(8), intent(in) :: v(3),th
complex(8), intent(out) :: su2(2,2)
! local variables
real(8) x,y,z,cs,sn,t1
x=v(1); y=v(2); z=v(3)
t1=sqrt(x**2+y**2+z**2)
! return the identity matrix for a zero-length axis
if (t1 < 1.d-8) then
  su2(1,1)=1.d0; su2(2,1)=0.d0
  su2(1,2)=0.d0; su2(2,2)=1.d0
  return
end if
! normalise the vector
t1=1.d0/t1
x=x*t1; y=y*t1; z=z*t1
cs=cos(0.5d0*th)
sn=sin(0.5d0*th)
su2(1,1)=cmplx(cs,-z*sn,8)
su2(2,1)=cmplx(y*sn,-x*sn,8)
su2(1,2)=cmplx(-y*sn,-x*sn,8)
su2(2,2)=cmplx(cs,z*sn,8)
end subroutine
!EOC