2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-04-07 20:55:29 +08:00
|
|
|
! Copyright (C) 2001-2003 PWSCF group
|
2003-01-20 05:58:50 +08:00
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!--------------------------------------------------------------------
|
2003-04-07 20:55:29 +08:00
|
|
|
subroutine gweights (nks, wk, nbnd, nelec, degauss, ngauss, &
|
2003-01-20 05:58:50 +08:00
|
|
|
et, ef, demet, wg)
|
|
|
|
!--------------------------------------------------------------------
|
|
|
|
! calculates weights with the gaussian spreading technique
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-04-07 20:55:29 +08:00
|
|
|
integer :: nks, nbnd, ngauss
|
|
|
|
real(kind=DP) :: wk (nks), et (nbnd, nks), nelec, degauss
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: wg (nbnd, nks), ef, demet
|
2003-04-07 20:55:29 +08:00
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: kpoint, ibnd
|
2003-04-07 20:55:29 +08:00
|
|
|
real(kind=DP) , external :: wgauss, w1gauss
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
! Calculate the Fermi energy ef
|
|
|
|
|
2003-04-07 20:55:29 +08:00
|
|
|
call efermig (et, nbnd, nks, nelec, wk, degauss, ngauss, ef)
|
2003-02-08 00:04:36 +08:00
|
|
|
demet = 0.d0
|
|
|
|
do kpoint = 1, nks
|
|
|
|
do ibnd = 1, nbnd
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-04-07 20:55:29 +08:00
|
|
|
! Calculate the gaussian weights
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
wg (ibnd, kpoint) = wk (kpoint) * wgauss ( (ef - et (ibnd, kpoint) &
|
|
|
|
) / degauss, ngauss)
|
|
|
|
! The correct form of the band energy is \int e n(e) de for e<ef
|
|
|
|
! demet is the correction to add to the sum of eigenvalues
|
|
|
|
demet = demet + wk (kpoint) * degauss * w1gauss ( (ef - et (ibnd, &
|
|
|
|
kpoint) ) / degauss, ngauss)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine gweights
|