types_regionCharges.f90 2.92 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
   USE m_types_input
   USE m_types_atoms
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58

   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

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

61 62 63
  USE m_types_vacuum
  USE m_types_dos
  
64
   USE m_types_dos
65 66 67 68 69

   IMPLICIT NONE

   CLASS(t_regionCharges), INTENT(INOUT) :: thisRegCharges
   TYPE(t_vacuum),         INTENT(IN)    :: vacuum
70
   TYPE(t_dos),            INTENT(IN)    :: dos
71 72 73 74 75 76 77 78 79 80 81 82
   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)+&
83
            dot_product(eig(:noccbd)*dos%qvac(:noccbd,ivac,ikpt,ispin),we(:noccbd))
84
         thisRegCharges%svac(ivac,ispin)=thisRegCharges%svac(ivac,ispin)+&
85
            dot_product(dos%qvac(:noccbd,ivac,ikpt,ispin),we(:noccbd))
86 87 88 89 90
      END DO
   END DO

END SUBROUTINE sumBandsVac

91
END MODULE m_types_regionCharges