The Elk Code
sqasu2.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2025 J. K. Dewhurst and S. Sharma.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 subroutine sqasu2(sqaxis,tsqaz,su2)
7 implicit none
8 ! arguments
9 real(8), intent(in) :: sqaxis(3)
10 logical, intent(out) :: tsqaz
11 complex(8), intent(out) :: su2(2,2)
12 ! local variables
13 real(8) v1(3),v2(3),v3(3),th,t1
14 v1(:)=sqaxis(:)
15 t1=sqrt(v1(1)**2+v1(2)**2+v1(3)**2)
16 if (t1 <= 1.d-8) then
17  write(*,*)
18  write(*,'("Error(sqasu2): spin-quantisation axis (sqaxis) has zero length")')
19  write(*,*)
20  stop
21 end if
22 v1(:)=v1(:)/t1
23 if (abs(v1(3)-1.d0) < 1.d-8) then
24 ! spin-quantisation axis in +z direction
25  tsqaz=.true.
26  su2(1,1)=1.d0; su2(1,2)=0.d0
27  su2(2,1)=0.d0; su2(2,2)=1.d0
28 else
29 ! determine the SU(2) matrix corresponding to the rotation from +z to sqaxis
30  tsqaz=.false.
31  v2(1:2)=0.d0
32  v2(3)=1.d0
33  call r3cross(v1,v2,v3)
34 ! note that the spin-quantisation axis is rotated, so the density matrix should
35 ! be rotated in the opposite direction
36  th=-acos(v1(3))
37  call axangsu2(v3,th,su2)
38 end if
39 end subroutine
40 
subroutine sqasu2(sqaxis, tsqaz, su2)
Definition: sqasu2.f90:7
pure subroutine axangsu2(v, th, su2)
Definition: axangsu2.f90:10
pure subroutine r3cross(x, y, z)
Definition: r3cross.f90:10