LCOV - code coverage report
Current view: top level - greensf - greensfPostProcess.F90 (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 27 30 90.0 %
Date: 2024-05-15 04:28:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : MODULE m_greensfPostProcess
       2             : 
       3             :    USE m_juDFT
       4             :    USE m_constants
       5             :    USE m_types
       6             :    USE m_greensfCalcRealPart
       7             :    USE m_greensfCalcScalarProducts
       8             :    USE m_greensf_io
       9             :    USE m_greensfTorque
      10             :    USE m_excSplitting
      11             :    USE m_crystalfield
      12             :    USE m_genMTBasis
      13             :    USE m_sointg
      14             : 
      15             :    IMPLICIT NONE
      16             : 
      17             :    CONTAINS
      18             : 
      19          42 :    SUBROUTINE greensfPostProcess(greensFunction,greensfImagPart,atoms,kpts,cell,gfinp,input,sym,noco,mpi,&
      20             :                                  nococonv,vTot,enpara,hub1inp,sphhar,hub1data,results)
      21             : 
      22             :       !contains all the modules for calculating properties from the greens function
      23             : 
      24             :       TYPE(t_atoms),             INTENT(IN)     :: atoms
      25             :       TYPE(t_kpts),              INTENT(IN)     :: kpts
      26             :       TYPE(t_cell),              INTENT(IN)     :: cell
      27             :       TYPE(t_gfinp),             INTENT(IN)     :: gfinp
      28             :       TYPE(t_input),             INTENT(IN)     :: input
      29             :       TYPE(t_sym),               INTENT(IN)     :: sym
      30             :       TYPE(t_noco),              INTENT(IN)     :: noco
      31             :       TYPE(t_mpi),               INTENT(IN)     :: mpi
      32             :       TYPE(t_nococonv),          INTENT(IN)     :: nococonv
      33             :       TYPE(t_hub1inp),           INTENT(IN)     :: hub1inp
      34             :       TYPE(t_sphhar),            INTENT(IN)     :: sphhar
      35             :       TYPE(t_results),           INTENT(IN)     :: results
      36             :       TYPE(t_potden),            INTENT(IN)     :: vTot
      37             :       TYPE(t_enpara),            INTENT(IN)     :: enpara
      38             :       TYPE(t_hub1data),          INTENT(INOUT)  :: hub1data
      39             :       TYPE(t_greensfImagPart),   INTENT(INOUT)  :: greensfImagPart
      40             :       TYPE(t_greensf),           INTENT(INOUT)  :: greensFunction(:)
      41             : 
      42             :       INTEGER  i_gf,l,lp,atomType,atomTypep,i_elem,jspin,ierr,i,indUnique
      43          42 :       COMPLEX  mmpmat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,gfinp%n,3)
      44             :       LOGICAL  l_sphavg,l_check
      45          42 :       REAL, ALLOCATABLE :: f(:,:,:,:,:),g(:,:,:,:,:), flo(:,:,:,:,:)
      46          42 :       TYPE(t_scalarGF), ALLOCATABLE :: scalarGF(:)
      47             : 
      48             : #ifdef CPP_HDF
      49             :       INTEGER(HID_T) :: greensf_fileID
      50             : #endif
      51             : 
      52             :       CALL greensfCalcScalarProducts(gfinp,atoms,input,enpara,noco,sphhar,vTot,mpi,hub1data,&
      53             :                                      greensFunctions=greensFunction,scalarProducts=scalarGF,&
      54          42 :                                      fout=f,gout=g,floout=flo)
      55             :       !--------------------------------------------------------------------------------
      56             :       ! Obtain the real part of the Green's Function via the Kramers Kronig Integration
      57             :       !--------------------------------------------------------------------------------
      58          42 :       CALL timestart("Green's Function: Real Part")
      59             :       CALL greensfCalcRealPart(atoms,gfinp,sym,input,enpara,noco,kpts,mpi,results%ef,&
      60          42 :                                greensfImagPart,greensFunction)
      61          42 :       CALL timestop("Green's Function: Real Part")
      62             : 
      63             :       !----------------------------------------------
      64             :       ! Torque Calculations
      65             :       !----------------------------------------------
      66          94 :       IF(ANY(gfinp%numTorqueElems>0)) THEN
      67           0 :          CALL timestart("Green's Function: Torque")
      68             :          CALL greensfTorque(greensFunction,gfinp,mpi,sphhar,atoms,sym,noco,nococonv,input,&
      69           0 :                             f,g,flo,vTot)
      70           0 :          CALL timestop("Green's Function: Torque")
      71             :       ENDIF
      72             : 
      73          42 :       IF(mpi%irank==0) THEN
      74          21 :          CALL timestart("Green's Function: Postprocess")
      75             :          !-------------------------------------------------------------
      76             :          ! Calculate various properties from the greens function
      77             :          !-------------------------------------------------------------
      78             :          !calculate the crystal field contribution to the local hamiltonian in LDA+Hubbard 1
      79             :          IF(atoms%n_hia.GT.0 .AND. ANY(ABS(hub1inp%ccf(:)).GT.1e-12)) THEN
      80             :            !CALL crystal_field(atoms,gfinp,input,noco,nococonv,greensfImagPart,vTot,results%ef,hub1data)
      81             :          ENDIF
      82             : 
      83             :          !Onsite exchange Splitting from difference of center of mass of the bands
      84             :          !and the integral over Bxc
      85          21 :          CALL excSplitting(gfinp,atoms,input,scalarGF,greensfImagPart,results%ef, vTot)
      86             : 
      87             :          !-------------------------------------------------------
      88             :          ! Occupation matrix (only for diagonal onsite elements)
      89             :          !-------------------------------------------------------
      90          21 :          CALL timestart("Green's Function: Occupation")
      91       87123 :          mmpmat = cmplx_0
      92         530 :          DO i_gf = 1, gfinp%n
      93         509 :             IF(gfinp%elem(i_gf)%l_kresolved) CYCLE
      94             :             !If there are SCLOs present the occupations can get bigger than 1
      95         509 :             l_check = gfinp%elem(i_gf)%countLOs(atoms)==0 .AND..NOT.gfinp%elem(i_gf)%isOffDiag()
      96             :             mmpmat(:,:,i_gf,:) = greensFunction(i_gf)%occupationMatrix(gfinp,input,atoms,noco,nococonv,&
      97       87569 :                                                                        l_write=.TRUE.,check=l_check)
      98             :          ENDDO
      99          21 :          CALL timestop("Green's Function: Occupation")
     100             : 
     101             : #ifdef CPP_HDF
     102          21 :          CALL timestart("Green's Function: IO/Write")
     103          21 :          CALL openGreensFFile(greensf_fileID, input, gfinp, atoms, sym, cell, kpts,sphhar, vtot=vTot)
     104             :          CALL writeGreensFData(greensf_fileID, input, gfinp, atoms, nococonv, noco, cell,&
     105             :                                GREENSF_GENERAL_CONST, greensFunction, mmpmat,&
     106          21 :                                u=f,udot=g,ulo=flo)
     107          21 :          CALL closeGreensFFile(greensf_fileID)
     108          21 :          CALL timestop("Green's Function: IO/Write")
     109             : #endif
     110          21 :          CALL timestop("Green's Function: Postprocess")
     111             :       ENDIF
     112             : 
     113             : #ifdef CPP_MPI
     114          42 :       CALL MPI_BARRIER(mpi%mpi_comm,ierr)
     115             : #endif
     116             : 
     117        1060 :    END SUBROUTINE greensfPostProcess
     118             : 
     119             : END MODULE m_greensfPostProcess

Generated by: LCOV version 1.14