2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2001 PWSCF group
|
|
|
|
! 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 .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!--------------------------------------------------------------------
|
2005-03-17 22:47:46 +08:00
|
|
|
subroutine iweights (nks, wk, nbnd, nelec, et, Ef, wg, is, isk)
|
2003-01-20 05:58:50 +08:00
|
|
|
!--------------------------------------------------------------------
|
|
|
|
! calculates weights for semiconductors and insulators
|
|
|
|
! (bands are either empty or filled)
|
2004-01-07 00:53:55 +08:00
|
|
|
! On output, Ef is the highest occupied Kohn-Sham level
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds
|
2004-04-19 16:13:28 +08:00
|
|
|
USE noncollin_module, ONLY: noncolin
|
2008-01-08 17:19:31 +08:00
|
|
|
USE mp, ONLY : mp_max
|
|
|
|
USE mp_global, ONLY : inter_pool_comm
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2005-03-17 22:47:46 +08:00
|
|
|
integer, intent(in) :: nks, nbnd, is, isk(nks)
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP), intent(in) :: wk (nks), et(nbnd, nks), nelec
|
|
|
|
real(DP), intent(out) :: wg (nbnd, nks), Ef
|
|
|
|
real(DP) :: degspin
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: kpoint, ibnd
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2004-04-19 16:13:28 +08:00
|
|
|
degspin=2.d0
|
|
|
|
if (noncolin) degspin=1.d0
|
2005-03-17 22:47:46 +08:00
|
|
|
if (is /= 0) degspin = 1.d0
|
2006-12-14 16:53:47 +08:00
|
|
|
Ef = - 1.0d+20
|
2003-02-08 00:04:36 +08:00
|
|
|
do kpoint = 1, nks
|
2005-03-17 22:47:46 +08:00
|
|
|
if (is /= 0) then
|
|
|
|
if (isk(kpoint) .ne. is ) cycle
|
|
|
|
end if
|
2003-02-08 00:04:36 +08:00
|
|
|
do ibnd = 1, nbnd
|
2004-01-07 00:53:55 +08:00
|
|
|
if (ibnd <= nint (nelec) / degspin) then
|
2003-02-08 00:04:36 +08:00
|
|
|
wg (ibnd, kpoint) = wk (kpoint)
|
2004-01-07 00:53:55 +08:00
|
|
|
Ef = MAX (Ef, et (ibnd, kpoint) )
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
|
|
|
wg (ibnd, kpoint) = 0.d0
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
2004-01-07 00:53:55 +08:00
|
|
|
#ifdef __PARA
|
|
|
|
!
|
|
|
|
! find max across pools
|
|
|
|
!
|
2008-01-08 17:19:31 +08:00
|
|
|
CALL mp_max( ef, inter_pool_comm )
|
2004-01-07 00:53:55 +08:00
|
|
|
#endif
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine iweights
|