vgen_finalize.F90 2.37 KB
Newer Older
1 2 3 4 5 6 7 8
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_vgen_finalize
  USE m_juDFT
CONTAINS
9
  SUBROUTINE vgen_finalize(atoms,stars,vacuum,sym,noco,input,vTot,denRot)
10 11 12 13 14
    !     ***********************************************************
    !     FLAPW potential generator                           *
    !     ***********************************************************
    !     some rescaling is done here
    !     ***********************************************************
15 16
    !     in noco case vmatgen is called to generate 2x2 int-potential
    !     **********************************************************
17
    USE m_constants
18
    USE m_vmatgen
19 20 21 22 23 24 25
    USE m_types
    IMPLICIT NONE
    TYPE(t_vacuum),INTENT(IN)       :: vacuum
    TYPE(t_noco),INTENT(IN)         :: noco
    TYPE(t_sym),INTENT(IN)          :: sym
    TYPE(t_stars),INTENT(IN)        :: stars
    TYPE(t_atoms),INTENT(IN)        :: atoms 
26 27
    TYPE(t_input),INTENT(IN)        :: input
    TYPE(t_potden),INTENT(INOUT)    :: vTot,denRot
28 29 30 31 32 33 34 35 36 37 38 39
    !     ..
    !     .. Local Scalars ..
    INTEGER i,js,n

    !           ---> store v(l=0) component as r*v(l=0)/sqrt(4pi)
    
    DO js = 1,SIZE(vtot%mt,4)
       DO n = 1,atoms%ntype
          vTot%mt(:atoms%jri(n),0,n,js)  = atoms%rmsh(:atoms%jri(n),n)*vTot%mt(:atoms%jri(n),0,n,js)/sfp_const
       ENDDO
    ENDDO     ! js =1,input%jspins
    
40 41
    ! Rescale pw_w with number of stars
    IF (.NOT.noco%l_noco) THEN
42 43
       DO js=1,SIZE(vtot%pw_w,2)
          DO i=1,stars%ng3
44 45 46
             vTot%pw_w(i,js)=vtot%pw_w(i,js) / stars%nstr(i)
          END DO
       END DO
47
    ELSEIF(noco%l_noco) THEN
48
       CALL vmatgen(stars,atoms,vacuum,sym,input,denRot,vTot)
49 50 51 52 53 54 55 56 57 58 59 60 61 62
    ENDIF

    !Copy first vacuum into second vacuum if this was not calculated before 
    IF (vacuum%nvac==1) THEN
       vTot%vacz(:,2,:)  = vTot%vacz(:,1,:)
       IF (sym%invs) THEN
          vTot%vacxy(:,:,2,:)  = CMPLX(vTot%vacxy(:,:,1,:))
       ELSE
          vTot%vacxy(:,:,2,:)  = vTot%vacxy(:,:,1,:)
       ENDIF
    ENDIF
 
  END SUBROUTINE vgen_finalize
END MODULE m_vgen_finalize