LCOV - code coverage report
Current view: top level - cdn - n_mat21.f90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 0 31 0.0 %
Date: 2024-04-27 04:44:07 Functions: 0 1 0.0 %

          Line data    Source code
       1             : MODULE m_nmat21
       2             :    !------------------------------------------------------------
       3             :    !This subroutine calculates the density matrix n^{s}_{m,m'}
       4             :    !for a given atom 'n' and l-quantum number 'l'. The l's for
       5             :    !all atoms are stored in lda_u(), if lda_u()<0, no +U is used.
       6             :    !For details see Eq.(12) of Shick et al. PRB 60, 10765 (1999)
       7             :    !Part of the LDA+U package                   G.B., Oct. 2000
       8             :    !------------------------------------------------------------
       9             : 
      10             :    USE m_types
      11             :    USE m_constants
      12             :    USE m_symMMPmat
      13             : 
      14             :    IMPLICIT NONE
      15             : 
      16             :    CONTAINS
      17             : 
      18           0 :    SUBROUTINE n_mat21(atoms,sym,ne,we,denCoeffsOffdiag,eigVecCoeffs,n_mmp)
      19             : 
      20             :       TYPE(t_sym),               INTENT(IN)     :: sym
      21             :       TYPE(t_atoms),             INTENT(IN)     :: atoms
      22             :       TYPE(t_eigVecCoeffs),      INTENT(IN)     :: eigVecCoeffs
      23             :       TYPE(t_denCoeffsOffDiag),  INTENT(IN)     :: denCoeffsOffdiag
      24             :       INTEGER,                   INTENT(IN)     :: ne
      25             :       REAL,                      INTENT(IN)     :: we(:)!(input%neig)
      26             :       COMPLEX,                   INTENT(INOUT)  :: n_mmp(-lmaxU_const:,-lmaxU_const:,:)
      27             : 
      28             :       INTEGER i,l,m,lp,mp,n,natom
      29             :       INTEGER ilo,ilop,ll1,lmp,lm,i_u
      30             :       COMPLEX c_0
      31             : 
      32             :       COMPLEX n_tmp(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const)
      33             : 
      34             :       !
      35             :       ! calculate n_mat:
      36             :       !
      37           0 :       DO i_u = 1,atoms%n_u
      38           0 :          l = atoms%lda_u(i_u)%l
      39           0 :          n = atoms%lda_u(i_u)%atomType
      40           0 :          ll1 = (l+1)*l
      41           0 :          DO natom = atoms%firstAtom(n), atoms%firstAtom(n) + atoms%neq(n) - 1
      42           0 :             n_tmp = cmplx_0
      43             :             !
      44             :             !  prepare n_mat in local frame (in noco-calculations this depends
      45             :             !                                also on alpha(n) and beta(n) )
      46             :             !
      47           0 :             DO m = -l,l
      48           0 :                lm = ll1+m
      49           0 :                DO mp = -l,l
      50           0 :                   lmp = ll1+mp
      51           0 :                   c_0 = cmplx_0
      52           0 :                   DO i = 1,ne
      53             :                      c_0 = c_0 +  we(i) * ( &
      54             :                                  conjg(eigVecCoeffs%abcof(i,lmp,0,natom,2))*eigVecCoeffs%abcof(i,lm,0,natom,1) * denCoeffsOffdiag%uu21n(l,n) &
      55             :                                + conjg(eigVecCoeffs%abcof(i,lmp,0,natom,2))*eigVecCoeffs%abcof(i,lm,1,natom,1) * denCoeffsOffdiag%ud21n(l,n) &
      56             :                                + conjg(eigVecCoeffs%abcof(i,lmp,1,natom,2))*eigVecCoeffs%abcof(i,lm,0,natom,1) * denCoeffsOffdiag%du21n(l,n) &
      57           0 :                                + conjg(eigVecCoeffs%abcof(i,lmp,1,natom,2))*eigVecCoeffs%abcof(i,lm,1,natom,1) * denCoeffsOffdiag%dd21n(l,n))
      58             :                   ENDDO
      59           0 :                   n_tmp(m,mp) = c_0
      60             :                ENDDO
      61             :             ENDDO
      62             :             !
      63             :             !  add local orbital contribution (if there is one) (untested so far)
      64             :             !
      65           0 :             DO ilo = 1, atoms%nlo(n)
      66           0 :                IF (atoms%llo(ilo,n).EQ.l) THEN
      67           0 :                   DO m = -l,l
      68           0 :                      lm = ll1+m
      69           0 :                      DO mp = -l,l
      70           0 :                         lmp = ll1+mp
      71           0 :                         c_0 = cmplx_0
      72           0 :                         DO i = 1,ne
      73             :                            c_0 = c_0 +  we(i) * ( &
      74             :                                        conjg(eigVecCoeffs%abcof(i,lmp,0,natom,2))*eigVecCoeffs%ccof(m,i,ilo,natom,1) * denCoeffsOffdiag%uulo21n(l,n) &
      75             :                                      + conjg(eigVecCoeffs%ccof(mp,i,ilo,natom,2))*eigVecCoeffs%abcof(i,lm,0,natom,1) * denCoeffsOffdiag%ulou21n(l,n) &
      76             :                                      + conjg(eigVecCoeffs%abcof(i,lmp,1,natom,2))*eigVecCoeffs%ccof(m,i,ilo,natom,1) * denCoeffsOffdiag%dulo21n(l,n) &
      77           0 :                                      + conjg(eigVecCoeffs%ccof(mp,i,ilo,natom,2))*eigVecCoeffs%abcof(i,lm,1,natom,1) * denCoeffsOffdiag%ulod21n(l,n))
      78             :                         ENDDO
      79           0 :                         DO ilop = 1, atoms%nlo(n)
      80           0 :                            IF (atoms%llo(ilop,n).EQ.l) THEN
      81           0 :                               DO i = 1,ne
      82             :                                  c_0 = c_0 +  we(i) * denCoeffsOffdiag%uloulop21n(ilo,ilop,n) &
      83           0 :                                             *conjg(eigVecCoeffs%ccof(mp,i,ilop,natom,2)) *eigVecCoeffs%ccof(m ,i,ilo ,natom,1)
      84             :                               ENDDO
      85             :                            ENDIF
      86             :                         ENDDO
      87           0 :                         n_tmp(m,mp) = n_tmp(m,mp) + c_0
      88             :                      ENDDO
      89             :                   ENDDO
      90             :                ENDIF
      91             :             ENDDO
      92             :             !
      93             :             !  n_mmp should be rotated by D_mm' ; compare force_a21
      94             :             !
      95             :             !Note: This can be done only if the correct magnetic symmetries are
      96             :             !present. This is not the case at the moment (Jan 2020).
      97           0 :             n_mmp(:,:,i_u) = n_mmp(:,:,i_u) + conjg(symMMPmat(n_tmp,sym,natom,l,phase=.TRUE.)) * 1.0/atoms%neq(n)
      98             :          ENDDO ! sum  over equivalent
      99             :       ENDDO     ! loop over u parameters
     100             : 
     101           0 :    END SUBROUTINE n_mat21
     102             : END MODULE m_nmat21

Generated by: LCOV version 1.14