vgen_finalize.F90 2.86 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,sphhar,vTot,vCoul,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
    USE m_types
20
    USE m_rotate_mt_den_tofrom_local
21
22
23
24
25
26
    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 
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
32
33
34
35
36
37
38
39
40
41
    !     ..
    !     .. 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
    
42
    ! Rescale vTot%pw_w with number of stars
43
    IF (.NOT.noco%l_noco) THEN
44
45
       DO js=1,SIZE(vtot%pw_w,2)
          DO i=1,stars%ng3
46
47
48
             vTot%pw_w(i,js)=vtot%pw_w(i,js) / stars%nstr(i)
          END DO
       END DO
49
    ELSEIF(noco%l_noco) THEN
50
       CALL vmatgen(stars,atoms,vacuum,sym,input,denRot,vTot)
51
       IF (noco%l_mtnocoPot) CALL rotate_mt_den_from_local(atoms,sphhar,sym,denRot,vtot)
52
53
    ENDIF

Matthias Redies's avatar
shift    
Matthias Redies committed
54
    write (*,*) "Set vTot to zero"
Matthias Redies's avatar
Matthias Redies committed
55
56
57
    vTot%pw_w = 0.0
    vTot%pw   = 0.0

58
59
60
61
62
63
64
    ! Rescale vCoul%pw_w with number of stars
    DO js = 1, SIZE(vCoul%pw_w,2)
       DO i = 1, stars%ng3
          vcoul%pw_w(i,js) = vcoul%pw_w(i,js) / stars%nstr(i)  !this normalization is needed for gw
       END DO
    END DO

65
66
67
68
69
70
71
72
73
74
75
76
    !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