LCOV - code coverage report
Current view: top level - eigen_soc - hsohelp.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 54 54 100.0 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.0 %

          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_hsohelp
       8             :   !
       9             :   !*********************************************************************
      10             :   ! preparation of spin-orbit matrix elements: ahelp, bhelp
      11             :   ! ahelp(i,n,l,m,jspin) =Sum_(G) (conj(c(G,i,jspin)*a(G,n,l,m,jspin))
      12             :   ! bhelp - same a|->b
      13             :   ! Original version replaced by a call to abcof. Maybe not so efficient
      14             :   ! but includes now LO's and could also be used for noco
      15             :   !                                                        gb`02
      16             :   !*********************************************************************
      17             :   !
      18             : CONTAINS
      19          80 :   SUBROUTINE hsohelp(DIMENSION,atoms,sym,input,lapw,nsz, cell,&
      20          40 :        zmat,usdus, zso,noco,oneD,&
      21          80 :        nat_start,nat_stop,nat_l,ahelp,bhelp,chelp)
      22             :     !
      23             :     USE m_abcof_soc
      24             :     USE m_types
      25             :     IMPLICIT NONE
      26             : #ifdef CPP_MPI
      27             :     INCLUDE 'mpif.h'
      28             :     INTEGER ierr(3)
      29             : #endif
      30             :     TYPE(t_dimension),INTENT(IN)   :: DIMENSION
      31             :     TYPE(t_oneD),INTENT(IN)        :: oneD
      32             :     TYPE(t_input),INTENT(IN)       :: input
      33             :     TYPE(t_noco),INTENT(IN)        :: noco
      34             :     TYPE(t_sym),INTENT(IN)         :: sym
      35             :     TYPE(t_cell),INTENT(IN)        :: cell
      36             :     TYPE(t_atoms),INTENT(IN)       :: atoms
      37             :     TYPE(t_usdus),INTENT(IN)       :: usdus
      38             :     TYPE(t_lapw),INTENT(IN)        :: lapw
      39             :     !     ..
      40             :     !     .. Scalar Arguments ..
      41             :     !     ..
      42             :     INTEGER, INTENT (IN) :: nat_start,nat_stop,nat_l
      43             :     !     .. Array Arguments ..
      44             :     INTEGER, INTENT (IN) :: nsz(input%jspins)  
      45             :     COMPLEX, INTENT (INOUT) :: zso(:,:,:)!DIMENSION%nbasfcn,2*DIMENSION%neigd,input%jspins)
      46             :     COMPLEX, INTENT (OUT):: ahelp(atoms%lmaxd*(atoms%lmaxd+2),nat_l,DIMENSION%neigd,input%jspins)
      47             :     COMPLEX, INTENT (OUT):: bhelp(atoms%lmaxd*(atoms%lmaxd+2),nat_l,DIMENSION%neigd,input%jspins)
      48             :     COMPLEX, INTENT (OUT):: chelp(-atoms%llod :atoms%llod, DIMENSION%neigd,atoms%nlod,nat_l,input%jspins)
      49             :     TYPE(t_mat),INTENT(IN)      :: zmat(:) ! (DIMENSION%nbasfcn,DIMENSION%neigd,input%jspins)
      50             :     !-odim
      51             :     !+odim
      52             :     !     ..
      53             :     !     .. Locals ..
      54          40 :     TYPE(t_mat)     :: zMat_local
      55          80 :     INTEGER ispin ,l,n ,na,ie,lm,ll1,nv1(input%jspins),m,lmd
      56          40 :     INTEGER, ALLOCATABLE :: g1(:,:),g2(:,:),g3(:,:)
      57          40 :     COMPLEX, ALLOCATABLE :: acof(:,:,:),bcof(:,:,:)
      58             :     !
      59             :     ! turn off the non-collinear part of abcof
      60             :     !
      61          40 :     lmd = atoms%lmaxd*(atoms%lmaxd+2)
      62             :     !
      63             :     ! some praparations to match array sizes
      64             :     !
      65          40 :     nv1(1) = lapw%nv(1) ; nv1(input%jspins) = lapw%nv(1)
      66          40 :     ALLOCATE (g1(DIMENSION%nvd,input%jspins))
      67          40 :     ALLOCATE (g2(DIMENSION%nvd,input%jspins))
      68          40 :     ALLOCATE (g3(DIMENSION%nvd,input%jspins))
      69         116 :     g1 = 0 ; g2 = 0 ; g3 = 0
      70          40 :     g1(:SIZE(lapw%k1,1),1) = lapw%k1(:SIZE(lapw%k1,1),1) ; g1(:SIZE(lapw%k1,1),input%jspins) = lapw%k1(:SIZE(lapw%k1,1),1)
      71          40 :     g2(:SIZE(lapw%k1,1),1) = lapw%k2(:SIZE(lapw%k1,1),1) ; g2(:SIZE(lapw%k1,1),input%jspins) = lapw%k2(:SIZE(lapw%k1,1),1)
      72          40 :     g3(:SIZE(lapw%k1,1),1) = lapw%k3(:SIZE(lapw%k1,1),1) ; g3(:SIZE(lapw%k1,1),input%jspins) = lapw%k3(:SIZE(lapw%k1,1),1)
      73             : 
      74          40 :     chelp(:,:,:,:,input%jspins) = CMPLX(0.0,0.0)
      75             : 
      76          40 :     ALLOCATE ( acof(DIMENSION%neigd,0:lmd,nat_l),bcof(DIMENSION%neigd,0:lmd,nat_l) )
      77         116 :     DO ispin = 1, input%jspins
      78         116 :        IF (zmat(1)%l_real.AND.noco%l_soc) THEN
      79         144 :           zso(:,1:DIMENSION%neigd,ispin) = CMPLX(zmat(ispin)%data_r(:,1:DIMENSION%neigd),0.0)
      80           8 :           zMat_local%l_real = .FALSE.
      81           8 :           zMat_local%matsize1 = zmat(1)%matsize1
      82           8 :           zMat_local%matsize2 = DIMENSION%neigd
      83           8 :           ALLOCATE(zMat_local%data_c(zmat(1)%matsize1,DIMENSION%neigd))
      84         136 :           zMat_local%data_c(:,:) = zso(:,1:DIMENSION%neigd,ispin)
      85             :           CALL abcof_soc(input,atoms,sym,cell,lapw,nsz(ispin),&
      86             :                usdus, noco,ispin,oneD,nat_start,nat_stop,nat_l,&
      87           8 :                acof,bcof,chelp(-atoms%llod:,:,:,:,ispin),zMat_local)
      88           8 :           DEALLOCATE(zMat_local%data_c)
      89             :           !
      90             :           !
      91             :           ! transfer (a,b)cofs to (a,b)helps used in hsoham
      92             :           !
      93         136 :           DO ie = 1, DIMENSION%neigd
      94         264 :              DO na = 1, nat_l
      95         256 :                 DO l = 1, atoms%lmaxd
      96        1280 :                    ll1 = l*(l+1)
      97       16640 :                    DO m = -l,l
      98       15360 :                       lm = ll1 + m
      99       15360 :                       ahelp(lm,na,ie,ispin) = (acof(ie,lm,na))
     100       16640 :                       bhelp(lm,na,ie,ispin) = (bcof(ie,lm,na))
     101             :                    ENDDO
     102             :                 ENDDO
     103             :              ENDDO
     104             :           ENDDO
     105             :        ELSE
     106          68 :           zMat_local%l_real = zmat(1)%l_real
     107          68 :           zMat_local%matsize1 = zmat(1)%matsize1
     108          68 :           zMat_local%matsize2 = DIMENSION%neigd
     109         136 :           ALLOCATE(zMat_local%data_c(zmat(1)%matsize1,DIMENSION%neigd))
     110          68 :           zMat_local%data_c(:,:) = zmat(ispin)%data_c(:,:)
     111             :           CALL abcof_soc(input,atoms,sym,cell,lapw,nsz(ispin),&
     112             :                usdus,noco,ispin,oneD,nat_start,nat_stop,nat_l,&
     113          68 :                acof,bcof,chelp(-atoms%llod:,:,:,:,ispin),zMat_local)
     114          68 :           DEALLOCATE(zMat_local%data_c)
     115             :           !
     116             :           ! transfer (a,b)cofs to (a,b)helps used in hsoham
     117             :           !
     118        2628 :           DO ie = 1, DIMENSION%neigd
     119        5506 :              DO na = 1, nat_l
     120        7998 :                 DO l = 1, atoms%lmaxd
     121       47464 :                    ll1 = l*(l+1)
     122      569624 :                    DO m = -l,l
     123      522160 :                       lm = ll1 + m
     124      522160 :                       ahelp(lm,na,ie,ispin) = (acof(ie,lm,na))
     125      569624 :                       bhelp(lm,na,ie,ispin) = (bcof(ie,lm,na))
     126             :                    ENDDO
     127             :                 ENDDO
     128             :              ENDDO
     129             :           ENDDO
     130             :        ENDIF
     131             :        !      write(54,'(6f15.8)')(((chelp(m,ie,1,na,1),m=-1,1),ie=1,5),na=1,2)
     132             :        !      write(54,'(8f15.8)')(((acof(ie,l,na),l=0,3),ie=1,5),na=1,2)
     133             :     ENDDO    ! end of spin loop (ispin)
     134             :     !
     135          40 :     DEALLOCATE ( acof,bcof,g1,g2,g3 )
     136          40 :     RETURN
     137          40 :   END SUBROUTINE hsohelp
     138             : END MODULE m_hsohelp

Generated by: LCOV version 1.13