types_regionCharges.f90 2.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
!--------------------------------------------------------------------------------
! Copyright (c) 2018 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_types_regionCharges

IMPLICIT NONE

PRIVATE

   TYPE t_regionCharges

      REAL,    ALLOCATABLE :: sqal(:,:,:)
      REAL,    ALLOCATABLE :: ener(:,:,:)
      REAL,    ALLOCATABLE :: sqlo(:,:,:)
      REAL,    ALLOCATABLE :: enerlo(:,:,:)
      REAL,    ALLOCATABLE :: svac(:,:)
      REAL,    ALLOCATABLE :: pvac(:,:)

      CONTAINS
         PROCEDURE,PASS :: init => regionCharges_init
24
         PROCEDURE      :: sumBandsVac
25 26 27 28 29 30
   END TYPE t_regionCharges

PUBLIC t_regionCharges

CONTAINS

31
SUBROUTINE regionCharges_init(thisRegCharges,input,atoms)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

   USE m_types_setup

   IMPLICIT NONE

   CLASS(t_regionCharges), INTENT(INOUT) :: thisRegCharges
   TYPE(t_input),          INTENT(IN)    :: input
   TYPE(t_atoms),          INTENT(IN)    :: atoms

   ALLOCATE(thisRegCharges%sqal(0:3,atoms%ntype,input%jspins))
   ALLOCATE(thisRegCharges%ener(0:3,atoms%ntype,input%jspins))

   ALLOCATE(thisRegCharges%sqlo(atoms%nlod,atoms%ntype,input%jspins))
   ALLOCATE(thisRegCharges%enerlo(atoms%nlod,atoms%ntype,input%jspins))
   ALLOCATE(thisRegCharges%svac(2,input%jspins))
   ALLOCATE(thisRegCharges%pvac(2,input%jspins))

   thisRegCharges%sqal = 0.0
   thisRegCharges%ener = 0.0
   thisRegCharges%sqlo = 0.0
   thisRegCharges%enerlo = 0.0
   thisRegCharges%svac = 0.0
   thisRegCharges%pvac = 0.0

END SUBROUTINE regionCharges_init

58
SUBROUTINE sumBandsVac(thisRegCharges,vacuum,dos,noccbd,ikpt,jsp_start,jsp_end,eig,we)
59 60

   USE m_types_setup
61
   USE m_types_dos
62 63 64 65 66

   IMPLICIT NONE

   CLASS(t_regionCharges), INTENT(INOUT) :: thisRegCharges
   TYPE(t_vacuum),         INTENT(IN)    :: vacuum
67
   TYPE(t_dos),            INTENT(IN)    :: dos
68 69 70 71 72 73 74 75 76 77 78 79
   INTEGER,                INTENT(IN)    :: noccbd
   INTEGER,                INTENT(IN)    :: ikpt
   INTEGER,                INTENT(IN)    :: jsp_start, jsp_end
   REAL,                   INTENT(IN)    :: eig(noccbd)
   REAL,                   INTENT(IN)    :: we(noccbd)

   INTEGER                               :: ispin, ivac

   ! perform Brillouin zone integration and summation over the bands in order to determine the vacuum energy parameters.
   DO ispin = jsp_start, jsp_end
      DO ivac = 1,vacuum%nvac
         thisRegCharges%pvac(ivac,ispin) = thisRegCharges%pvac(ivac,ispin)+&
80
            dot_product(eig(:noccbd)*dos%qvac(:noccbd,ivac,ikpt,ispin),we(:noccbd))
81
         thisRegCharges%svac(ivac,ispin)=thisRegCharges%svac(ivac,ispin)+&
82
            dot_product(dos%qvac(:noccbd,ivac,ikpt,ispin),we(:noccbd))
83 84 85 86 87
      END DO
   END DO

END SUBROUTINE sumBandsVac

88
END MODULE m_types_regionCharges