gfcalc.f90 5.38 KB
Newer Older
1
MODULE m_gfcalc
Henning Janssen's avatar
Henning Janssen committed
2 3 4 5

   !Contains the main routines called from cdnval and cdngen
   USE m_juDFT
   USE m_constants
6
   !These dependencies are here so that all these subroutines can be called by simply adding USE m_gfcalc to the file
7 8 9 10 11
   USE m_j0
   USE m_gfDOS
   USE m_occmtx
   USE m_hybridization
   USE m_crystalfield
Henning Janssen's avatar
Henning Janssen committed
12 13 14

   CONTAINS

15
   SUBROUTINE bzIntegrationGF(atoms,sym,input,angle,ispin,nbands,dosWeights,resWeights,indBound,wtkpt,eig,denCoeffsOffdiag,&
Henning Janssen's avatar
Henning Janssen committed
16 17 18 19
                              usdus,eigVecCoeffs,greensf,greensfCoeffs,l21)

      USE m_greensfImag
      USE m_greensfImag21
Henning Janssen's avatar
Fixes  
Henning Janssen committed
20 21
      !USE m_greensfRes
      !USE m_greensfRes21
Henning Janssen's avatar
Henning Janssen committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

      IMPLICIT NONE

      !-Type Arguments
      TYPE(t_atoms),             INTENT(IN)    :: atoms
      TYPE(t_sym),               INTENT(IN)    :: sym
      TYPE(t_input),             INTENT(IN)    :: input 
      TYPE(t_eigVecCoeffs),      INTENT(IN)    :: eigVecCoeffs
      TYPE(t_usdus),             INTENT(IN)    :: usdus
      TYPE(t_denCoeffsOffDiag),  INTENT(IN)    :: denCoeffsOffdiag
      TYPE(t_greensfCoeffs),     INTENT(INOUT) :: greensfCoeffs
      TYPE(t_greensf),           INTENT(INOUT) :: greensf


      !-Scalar Arguments 
      INTEGER,                   INTENT(IN)    :: ispin  !Current spin index
      INTEGER,                   INTENT(IN)    :: nbands !Number of bands to be considered
      REAL,                      INTENT(IN)    :: wtkpt  !Weight of the current k-point
      LOGICAL,                   INTENT(IN)    :: l21    !Calculate spin off-diagonal part ?

      !-Array Arguments
43
      REAL,                      INTENT(IN)    :: resWeights(greensfCoeffs%ne,nbands)
44 45
      REAL,                      INTENT(IN)    :: dosWeights(greensfCoeffs%ne,nbands) !Precalculated tetrahedron weights for the current k-point
      INTEGER,                   INTENT(IN)    :: indBound(nbands,2)                  !Gives the range where the tetrahedron weights are non-zero
Henning Janssen's avatar
Henning Janssen committed
46 47 48
      REAL,                      INTENT(IN)    :: eig(nbands)                         !Eigenvalues for the current k-point
      REAL,                      INTENT(IN)    :: angle(sym%nop)                      !Phases for spin-offdiagonal part
      
49
      !IF(input%l_resolvent) THEN
50
         !Calculate greens function directly
51 52 53 54 55 56 57 58 59 60 61
      !   CALL timestart("Greens Function: Resolvent")
      !   CALL greensfRes(atoms,sym,input,ispin,nbands,resWeights,indBound,wtkpt,eig,usdus,eigVecCoeffs,greensf)
      !   IF(input%l_gfmperp.AND.l21) THEN
      !      CALL greensfRes21(atoms,sym,angle,input,nbands,resWeights,indBound,wtkpt,eig,denCoeffsOffdiag,eigVecCoeffs,greensf)
      !   ENDIF
      !   CALL timestop("Greens Function: Resolvent")
      !ENDIF
      CALL timestart("Greens Function: Imaginary Part")
      CALL greensfImag(atoms,sym,input,ispin,nbands,dosWeights,resWeights,indBound,wtkpt,eig,usdus,eigVecCoeffs,greensfCoeffs)
      IF(input%l_gfmperp.AND.l21) THEN
         CALL greensfImag21(atoms,sym,angle,input,nbands,dosWeights,resWeights,indBound,wtkpt,eig,denCoeffsOffdiag,eigVecCoeffs,greensfCoeffs)
Henning Janssen's avatar
Henning Janssen committed
62
      ENDIF
63
      CALL timestop("Greens Function: Imaginary Part")
Henning Janssen's avatar
Henning Janssen committed
64 65 66 67 68 69


   END SUBROUTINE bzIntegrationGF



70
   SUBROUTINE postProcessGF(greensf,greensfCoeffs,atoms,input,sym,noco,vTot,hub1,results,angle)
Henning Janssen's avatar
Henning Janssen committed
71 72 73 74 75 76 77 78 79 80 81 82 83
      
      !contains all the modules for calculating properties from the greens function
      USE m_onsite

      TYPE(t_atoms),             INTENT(IN)     :: atoms
      TYPE(t_input),             INTENT(IN)     :: input
      TYPE(t_sym),               INTENT(IN)     :: sym
      TYPE(t_noco),              INTENT(IN)     :: noco
      TYPE(t_greensfCoeffs),     INTENT(INOUT)  :: greensfCoeffs
      TYPE(t_greensf),           INTENT(INOUT)  :: greensf
      TYPE(t_hub1ham),           INTENT(INOUT)  :: hub1
      TYPE(t_results),           INTENT(IN)     :: results
      TYPE(t_potden),            INTENT(IN)     :: vTot
84
      REAL,                   INTENT(IN)     :: angle(sym%nop)
Henning Janssen's avatar
Henning Janssen committed
85 86 87 88 89 90 91

      INTEGER  i_gf,l,nType
      COMPLEX  mmpmat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,atoms%n_gf,3)


      CALL timestart("Green's Function: Postprocess")
      !Perform the Kramer-Kronigs-Integration if we only have he imaginary part at this point
92
      CALL calc_onsite(atoms,input,sym,noco,angle,greensfCoeffs,greensf)
Henning Janssen's avatar
Henning Janssen committed
93 94 95 96
      !-------------------------------------------------------------
      ! Calculate various properties from the greens function 
      !-------------------------------------------------------------
      !calculate the crystal field contribution to the local hamiltonian in LDA+Hubbard 1
97
      IF(atoms%n_hia.GT.0.AND.ANY(hub1%ccf(:).NE.0.0)) THEN
Henning Janssen's avatar
Henning Janssen committed
98 99
        CALL crystal_field(atoms,input,greensfCoeffs,hub1,vTot)
      ENDIF
100
      IF(input%jspins.EQ.2) THEN
101
         CALL eff_excinteraction(greensf,atoms,input,results%ef,greensfCoeffs)
Henning Janssen's avatar
Henning Janssen committed
102 103 104 105 106 107 108
      ENDIF
      DO i_gf = 1, atoms%n_gf
         l = atoms%gfelem(i_gf)%l
         nType = atoms%gfelem(i_gf)%atomType
         IF(l.NE.atoms%gfelem(i_gf)%lp) CYCLE
         IF(nType.NE.atoms%gfelem(i_gf)%atomTypep) CYCLE
         !Occupation matrix
109
         CALL occmtx(greensf,l,nType,atoms,sym,input,mmpmat(:,:,i_gf,:),l_write=.TRUE.,check=.TRUE.)
Henning Janssen's avatar
Henning Janssen committed
110 111 112
         !Hybridization function
         CALL hybridization(greensf,l,nType,atoms,input,results%ef)
         !Density of states from Greens function
Henning Janssen's avatar
Henning Janssen committed
113
         CALL gfDOS(greensf,l,nType,i_gf,atoms,input,results%ef)
Henning Janssen's avatar
Henning Janssen committed
114 115 116 117 118
      ENDDO
      CALL timestop("Green's Function: Postprocess")

   END SUBROUTINE postProcessGF

119
END MODULE m_gfcalc