LCOV - code coverage report
Current view: top level - eigen_soc - anglso.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 39 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.0 %

          Line data    Source code
       1             : MODULE m_anglso
       2             : contains
       3           0 :   COMPLEX FUNCTION anglso(theta,phi,l1,m1,is1,l2,m2,is2)
       4             :     USE m_juDFT
       5             :     !
       6             :     ! calculates spin-orbit matrix for theta,phi =/= 0
       7             :     !
       8             :     IMPLICIT NONE
       9             :     !     ..
      10             :     !     .. Scalar Arguments ..
      11             :     INTEGER, INTENT(IN) :: is1,is2,l1,l2,m1,m2
      12             :     REAL,    INTENT(IN) :: theta,phi             
      13             :     !     ..
      14             :     !     .. Local Scalars ..
      15             :     REAL sgm1,sgm2,xlz,xlpl,xlmn,angl_r,angl_i
      16             :     LOGICAL :: l_standard_euler_angles
      17             :     !     ..
      18             :     !     .. Intrinsic Functions ..
      19             :     INTRINSIC abs,REAL,sqrt,isign
      20             :     !
      21           0 :     anglso = CMPLX(0.0,0.0)
      22           0 :     IF (l1.NE.l2) THEN
      23             :        RETURN
      24             :     ENDIF
      25             :     !
      26             : 
      27           0 :     l_standard_euler_angles=.FALSE.     
      28             : 
      29           0 :     sgm1 = is1
      30           0 :     sgm2 = is2
      31           0 :     IF (l1.LT.0) THEN
      32             :        WRITE (6,FMT=*)&
      33           0 :             &      ' PROGRAM STOPS IN ANGLSO ( L < 0 ) .'
      34           0 :        WRITE (6,FMT=*) ' L1 =',l1,'    L2 =',l2
      35           0 :        CALL juDFT_error("ANGLSO (L <0 )",calledby="anglso")
      36           0 :     ELSE IF ((ABS(m1).GT.l1) .OR. (ABS(m2).GT.l2)) THEN
      37             :        WRITE (6,FMT=*)&
      38           0 :             &      ' PROGRAM STOPS IN ANGLSO ( M < L OR L < M )'
      39           0 :        WRITE (6,FMT=*) ' L1 =',l1,'    L2 =',l2
      40           0 :        WRITE (6,FMT=*) ' M1 =',m1,'    M2 =',m2
      41             :        CALL juDFT_error("ANGLSO ( M < L OR L < M )",calledby="anglso"&
      42           0 :             &         )
      43           0 :     ELSE IF ((is1.NE.-1.AND.is1.NE.1) .OR.&
      44             :          &         (is2.NE.-1.AND.is2.NE.1)) THEN
      45             :        WRITE (6,FMT=*)&
      46           0 :             &      ' PROGRAM STOPS IN ANGLSO ( S >< +-1/2 ) .'
      47           0 :        WRITE (6,FMT=*) ' S1 =',0.5*sgm1,'    S2 =',0.5*sgm2
      48           0 :        CALL juDFT_error("ANGLSO ( S >< +-1/2 )",calledby ="anglso")
      49             :     END IF
      50             :     !
      51             :     ! lz,l+,l-
      52             :     !
      53           0 :     xlz = 0.0
      54           0 :     xlpl= 0.0
      55           0 :     xlmn= 0.0
      56             :     ! is1.eq.is2-2 -> <-| |+> => l+   
      57           0 :     IF (m1.EQ.m2+1) THEN
      58           0 :        xlpl = SQRT(REAL((l2-m2)* (l2+m2+1)))
      59             :        ! is1.eq.is2+2 -> <+| |-> => l-   
      60           0 :     ELSE IF (m1.EQ.m2-1) THEN
      61           0 :        xlmn = SQRT(REAL((l2+m2)* (l2-m2+1)))
      62             :        ! is1.eq.is2 -> <+| |+> => lz   
      63           0 :     ELSE IF (m1.EQ.m2  ) THEN
      64           0 :        xlz  = m2
      65             :     END IF
      66             :     !
      67             :     ! rotated spin-orbit angular matrix
      68             :     ! <1| |1> or <2| |2>          
      69             :     !
      70             : 
      71             :     !     If l_standard_euler_angles is set to .false., the old version
      72             :     !     of this subroutine is used, which works fine if only MAE is
      73             :     !     needed. In the old version, theta and phi specify the direction
      74             :     !     of spin quantization. However, there remains the degree of freedom
      75             :     !     of rotation around the spin quantization direction. The new version
      76             :     !     of this subroutine, which is switched on by setting l_standard_euler_angles
      77             :     !     to true, rotates x, y and z axes first by phi around z counterclockwisely
      78             :     !     and then the resulting axes x', y' and z' by theta around y' 
      79             :     !     counterclockwisely to obtain the final coordinate frame x'', y'' and z''.
      80             :     !     This new version is useful when one is interested also in the spin
      81             :     !     perpendicular to the spin quantization axis. The old version seems to be
      82             :     !     different from the new one as follows when theta and phi differ from zero:
      83             :     !     x''_old = -x''_new
      84             :     !     y''_old = -y''_new
      85             :     !     z''_old = z''
      86             :     !     If theta and phi are zero, there is no difference, leading thus to a
      87             :     !     discontinuous Euler transformation in the old version and a continuous
      88             :     !     transformation in the new version.
      89             :     !     Both versions do not differ for MAE, but if the standard Pauli matrix
      90             :     !     is used to obtain x or y components of spin, the spin is discontinuous
      91             :     !     in the old version as a function of theta and phi.
      92             : 
      93             :     IF(l_standard_euler_angles)THEN     
      94             : 
      95             :        IF (is1.EQ.is2) THEN
      96             :           angl_r = isign(1,is1) * ( COS(theta)*xlz +&
      97             :                &                          0.5*SIN(theta)*COS(phi)*(xlmn + xlpl) )
      98             :           angl_i = isign(1,is1)*0.5*SIN(theta)*SIN(phi)*(xlmn - xlpl)
      99             :           ! <1| |2>
     100             :        ELSEIF (is1.EQ.is2+2) THEN
     101             :           angl_r =  - SIN(theta)*xlz +  COS(phi)*(&
     102             :                &             COS(theta/2.)**2 * xlmn - SIN(theta/2.)**2 * xlpl )
     103             :           angl_i = SIN(phi)*( &
     104             :                &              COS(theta/2.)**2 * xlmn + SIN(theta/2.)**2 * xlpl )
     105             :           ! <2| |1>
     106             :        ELSEIF (is1.EQ.is2-2) THEN
     107             :           angl_r = - SIN(theta)*xlz +  COS(phi)*(&
     108             :                &            + COS(theta/2.)**2 * xlpl - SIN(theta/2.)**2 * xlmn )
     109             :           angl_i =  SIN(phi)*( &
     110             :                &             - COS(theta/2.)**2 * xlpl - SIN(theta/2.)**2 * xlmn )
     111             :        ELSE
     112             :           angl_r = 0.0
     113             :           angl_i = 0.0
     114             :        ENDIF
     115             : 
     116             :     ELSE        
     117           0 :        IF (is1.EQ.is2) THEN
     118             :           angl_r = isign(1,is1) * ( COS(theta)*xlz +&
     119           0 :                &                          0.5*SIN(theta)*COS(phi)*(xlmn + xlpl) )
     120           0 :           angl_i = isign(1,is1)*0.5*SIN(theta)*SIN(phi)*(xlmn - xlpl)
     121             :           ! <1| |2>
     122           0 :        ELSEIF (is1.EQ.is2+2) THEN
     123             :           angl_r =  SIN(theta)*xlz +  COS(phi)*(&
     124           0 :                &            - COS(theta/2.)**2 * xlmn + SIN(theta/2.)**2 * xlpl )
     125             :           angl_i = -SIN(phi)*( &
     126           0 :                &              COS(theta/2.)**2 * xlmn + SIN(theta/2.)**2 * xlpl )
     127             :           ! <2| |1>
     128           0 :        ELSEIF (is1.EQ.is2-2) THEN
     129             :           angl_r =  SIN(theta)*xlz +  COS(phi)*(&
     130           0 :                &            - COS(theta/2.)**2 * xlpl + SIN(theta/2.)**2 * xlmn )
     131             :           angl_i =  SIN(phi)*( &
     132           0 :                &              COS(theta/2.)**2 * xlpl + SIN(theta/2.)**2 * xlmn )
     133             :        ELSE
     134             :           angl_r = 0.0
     135             :           angl_i = 0.0
     136             :        ENDIF
     137             :     ENDIF
     138             :     !
     139           0 :     anglso = CMPLX(angl_r,angl_i)
     140             : 
     141           0 :     RETURN
     142             :   END FUNCTION anglso
     143             : END MODULE m_anglso

Generated by: LCOV version 1.13