LCOV - code coverage report
Current view: top level - vgen - vgen_finalize.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 18 19 94.7 %
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             : MODULE m_vgen_finalize
       7             :   USE m_juDFT
       8             : CONTAINS
       9         340 :   SUBROUTINE vgen_finalize(atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot)
      10             :     !     ***********************************************************
      11             :     !     FLAPW potential generator                           *
      12             :     !     ***********************************************************
      13             :     !     some rescaling is done here
      14             :     !     ***********************************************************
      15             :     !     in noco case vmatgen is called to generate 2x2 int-potential
      16             :     !     **********************************************************
      17             :     USE m_constants
      18             :     USE m_vmatgen
      19             :     USE m_types
      20             :     USE m_rotate_mt_den_tofrom_local
      21             :     IMPLICIT NONE
      22             :     TYPE(t_vacuum),INTENT(IN)       :: vacuum
      23             :     TYPE(t_noco),INTENT(IN)         :: noco
      24             :     TYPE(t_sym),INTENT(IN)          :: sym
      25             :     TYPE(t_stars),INTENT(IN)        :: stars
      26             :     TYPE(t_atoms),INTENT(IN)        :: atoms 
      27             :     TYPE(t_input),INTENT(IN)        :: input
      28             :     TYPE(t_sphhar),INTENT(IN)       :: sphhar
      29             :     TYPE(t_potden),INTENT(INOUT)    :: vTot,vCoul,denRot
      30             :     !     ..
      31             :     !     .. Local Scalars ..
      32             :     INTEGER i,js,n
      33             : 
      34             :     !           ---> store v(l=0) component as r*v(l=0)/sqrt(4pi)
      35             :     
      36         948 :     DO js = 1,SIZE(vtot%mt,4)
      37        2112 :        DO n = 1,atoms%ntype
      38        1772 :           vTot%mt(:atoms%jri(n),0,n,js)  = atoms%rmsh(:atoms%jri(n),n)*vTot%mt(:atoms%jri(n),0,n,js)/sfp_const
      39             :        ENDDO
      40             :     ENDDO     ! js =1,input%jspins
      41             :     
      42             :     ! Rescale vTot%pw_w with number of stars
      43         340 :     IF (.NOT.noco%l_noco) THEN
      44         204 :        DO js=1,SIZE(vtot%pw_w,2)
      45      386412 :           DO i=1,stars%ng3
      46      386432 :              vTot%pw_w(i,js)=vtot%pw_w(i,js) / stars%nstr(i)
      47             :           END DO
      48             :        END DO
      49             :     ELSEIF(noco%l_noco) THEN
      50         248 :        CALL vmatgen(stars,atoms,vacuum,sym,input,denRot,vTot)
      51         248 :        IF (noco%l_mtnocoPot) CALL rotate_mt_den_from_local(atoms,sphhar,sym,denRot,vtot)
      52             :     ENDIF
      53             : 
      54             :     ! Rescale vCoul%pw_w with number of stars
      55        1196 :     DO js = 1, SIZE(vCoul%pw_w,2)
      56      715956 :        DO i = 1, stars%ng3
      57      715616 :           vcoul%pw_w(i,js) = vcoul%pw_w(i,js) / stars%nstr(i)  !this normalization is needed for gw
      58             :        END DO
      59             :     END DO
      60             : 
      61             :     !Copy first vacuum into second vacuum if this was not calculated before 
      62         340 :     IF (vacuum%nvac==1) THEN
      63         254 :        vTot%vacz(:,2,:)  = vTot%vacz(:,1,:)
      64         254 :        IF (sym%invs) THEN
      65         254 :           vTot%vacxy(:,:,2,:)  = CMPLX(vTot%vacxy(:,:,1,:))
      66             :        ELSE
      67           0 :           vTot%vacxy(:,:,2,:)  = vTot%vacxy(:,:,1,:)
      68             :        ENDIF
      69             :     ENDIF
      70             :  
      71         340 :   END SUBROUTINE vgen_finalize
      72             : END MODULE m_vgen_finalize

Generated by: LCOV version 1.13