wann_socmat.F 5.76 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9
      module m_wann_socmat
      contains
      subroutine wann_socmat(
Daniel Wortmann's avatar
Daniel Wortmann committed
10
     >               mpi,enpara,input,noco,atoms,
11
     >               lmaxd,ntypd,nlod,natd,neigd,
12
     >               llod,jmtd,jspd,nlhd,neq,
13 14 15 16 17 18 19 20 21 22 23 24 25
     >               ntype,theta_in,phi_in,jspins,irank,
     >               jri,lmax,dx,rmsh,el,ello,nlo,llo,
     >               l_dulo,ulo_der,vr,
     >               acof,bcof,chelp,
     <               hsomtx)
c***********************************************************************
c     Calculate matrix elements of the spin-orbit interaction for those
c     Bloch functions out of which the Wannier functions are 
c     constructed. From these matrix elements the spin-orbit Hamiltonian
c     in the basis set of Wannier functions may be constructed.
c     
c     Frank Freimuth
c***********************************************************************
26
      USE m_types
27 28 29
      USE m_spnorb 
      USE m_hsoham
      implicit none
Daniel Wortmann's avatar
Daniel Wortmann committed
30 31 32 33 34 35 36 37

      TYPE(t_mpi),INTENT(IN)      :: mpi

      TYPE(t_enpara),INTENT(IN)   :: enpara
      TYPE(t_input),INTENT(IN)    :: input
      TYPE(t_noco),INTENT(IN)     :: noco
      TYPE(t_atoms),INTENT(IN)    :: atoms

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
      integer, intent(in) :: lmaxd
      integer, intent(in) :: ntypd
      integer, intent(in) :: nlod
      integer, intent(in) :: natd
      integer, intent(in) :: neigd

      integer, intent(in) :: llod
      integer, intent(in) :: jmtd
      integer, intent(in) :: jspd
      integer, intent(in) :: nlhd
      integer, intent(in) :: neq(:) !ntype

      integer, intent(in) :: ntype
      real,    intent(in) :: theta_in
      real,    intent(in) :: phi_in
      integer, intent(in) :: jspins
      integer, intent(in) :: irank

      integer, intent(in) :: jri(:)  ! ntypd
      integer, intent(in) :: lmax(:) ! ntypd
      real,    intent(in) :: dx(:)   ! ntypd
      real,    intent(in) :: rmsh(:,:)  ! jmtd,ntypd
      real,    intent(in) :: el(0:,:,:) ! 0:lmaxd,ntypd,max(2,jspd)
      real,    intent(in) :: ello(:,:,:)! nlod,ntypd,max(2,jspd)
      integer, intent(in) :: nlo(:)     ! ntypd
      integer, intent(in) :: llo(:,:)   ! nlod,ntypd

      logical, intent(in) :: l_dulo(:,:)  ! l_dulo(nlod,ntypd)
      integer, intent(in) :: ulo_der(:,:) ! ulo_der(nlod,ntypd)
      real,    intent(in) :: vr(:,0:,:,:)    ! jmtd,0:nlhd,ntypd,jspd   
  
      complex, intent(in) :: acof(:,0:,:,:) !acof(noccbd,0:lmd,natd,jspd)
      complex, intent(in) :: bcof(:,0:,:,:) !bcof(noccbd,0:lmd,natd,jspd)
      complex, intent(in) :: chelp(-llod:,:,:,:,:) !chelp(-llod:llod,neigd,nlod,natd,jspd)

73
      complex, allocatable, intent(out):: hsomtx(:,:,:,:) !(neigd,neigd,2,2)
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

      integer :: n,l,nwdd,nw,ispin,ie,na,ll1,m,lm,i,nsz(2)
      real    :: s(3),r2
      logical :: l_all
      CHARACTER*3 chntype
      real    :: theta,phi,pi

      real,allocatable :: ddn(:,:,:) ! 0:lmaxd,ntypd,jspd
      real,allocatable :: us(:,:,:)  ! 0:lmaxd,ntypd,jspd
      real,allocatable :: dus(:,:,:) ! 0:lmaxd,ntypd,jspd
      real,allocatable :: uds(:,:,:) ! 0:lmaxd,ntypd,jspd
      real,allocatable :: duds(:,:,:)! 0:lmaxd,ntypd,jspd

      real,allocatable :: ulos(:,:,:)  ! nlod,ntypd,jspd
      real,allocatable :: dulos(:,:,:) ! nlod,ntypd,jspd
      real,allocatable :: uulon(:,:,:) ! nlod,ntypd,jspd
      real,allocatable :: dulon(:,:,:) ! nlod,ntypd,jspd  

92 93
      COMPLEX,ALLOCATABLE :: ahelp(:,:,:,:)
      complex,allocatable :: bhelp(:,:,:,:)
94

95
      TYPE(t_rsoc)::rsoc
Daniel Wortmann's avatar
Daniel Wortmann committed
96 97
      TYPE(t_usdus):: usdus

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
      nwdd=1
      nw=1
      nsz=neigd

      IF (.true.) THEN
        theta= theta_In
        phi= phi_In
      ELSE
        pi= 4.*ATAN(1.)
        theta= -theta_In
        phi=   phi_In+pi
        ! now the definition of rotation matrices
        ! is equivalent to the def in the noco-routines
      ENDIF

113 114
      ALLOCATE ( ahelp(lmaxd*(lmaxd+2),natd,neigd,input%jspins) )
      ALLOCATE ( bhelp(lmaxd*(lmaxd+2),natd,neigd,input%jspins) )
115

116
      do ispin=1,input%jspins
117 118 119 120 121 122
       DO ie = 1, neigd
        DO na = 1, natd
         DO l = 1, lmaxd
          ll1 = l*(l+1)
          DO m = -l,l
             lm = ll1 + m
123 124
             ahelp(lm,na,ie,ispin) = (acof(ie,lm,na,ispin))
             bhelp(lm,na,ie,ispin) = (bcof(ie,lm,na,ispin))
125 126 127 128 129 130
          ENDDO !m
         ENDDO !l
        ENDDO !na
       ENDDO !ie
      enddo !ispin

Daniel Wortmann's avatar
Daniel Wortmann committed
131 132 133 134 135 136 137 138 139 140
      ALLOCATE(usdus%us(0:atoms%lmaxd,atoms%ntype,jspd), 
     +         usdus%dus(0:atoms%lmaxd,atoms%ntype,jspd),
     +         usdus%uds(0:atoms%lmaxd,atoms%ntype,jspd),
     +         usdus%duds(0:atoms%lmaxd,atoms%ntype,jspd),
     +         usdus%ddn(0:atoms%lmaxd,atoms%ntype,jspd),
     +         usdus%ulos(atoms%nlod,atoms%ntype,jspd),
     +         usdus%dulos(atoms%nlod,atoms%ntype,jspd),
     +         usdus%uulon(atoms%nlod,atoms%ntype,jspd),
     +         usdus%dulon(atoms%nlod,atoms%ntype,jspd))

141 142 143 144 145 146 147
      ALLOCATE( us(0:lmaxd,ntypd,jspd), dus(0:lmaxd,ntypd,jspd),
     +          uds(0:lmaxd,ntypd,jspd),duds(0:lmaxd,ntypd,jspd),
     +          ddn(0:lmaxd,ntypd,jspd),
     +          ulos(nlod,ntypd,jspd),dulos(nlod,ntypd,jspd),
     +          uulon(nlod,ntypd,jspd),dulon(nlod,ntypd,jspd))

      CALL spnorb(
Daniel Wortmann's avatar
Daniel Wortmann committed
148
     >         atoms,noco,input,mpi, enpara,
149 150 151 152
     >         vr,usdus,rsoc,.true.)
      
      rsoc%soangl= conjg(rsoc%soangl)

153 154
      CALL hsoham(atoms,noco,input,nsz,neigd,chelp,rsoc,ahelp,
     >            bhelp,1,natd,mpi%n_rank,mpi%n_size,mpi%SUB_COMM,
155
     <            hsomtx)
156 157 158
 
      end subroutine wann_socmat
      end module m_wann_socmat