2003-01-20 05:58:50 +08:00
|
|
|
!
|
2009-08-03 17:19:02 +08:00
|
|
|
! Copyright (C) 2001-2008 Quantum ESPRESSO 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-02-08 00:04:36 +08:00
|
|
|
subroutine compute_weight (wgg)
|
2003-03-27 23:47:30 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
2009-02-12 16:56:50 +08:00
|
|
|
! This routine implements Eq.B19 of Ref.[1]. It computes the
|
|
|
|
! weight to give to the v,v' terms in the orthogonality term.
|
|
|
|
! [1] PRB 64, 235118 (2001).
|
2003-03-27 23:47:30 +08:00
|
|
|
!
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2008-09-24 19:50:31 +08:00
|
|
|
USE kinds, ONLY : DP
|
|
|
|
USE klist, ONLY : wk, lgauss, degauss, ngauss
|
|
|
|
USE ener, ONLY : ef
|
|
|
|
USE wvfct, ONLY : nbnd, wg, et
|
2009-11-17 01:04:25 +08:00
|
|
|
USE paw_variables, ONLY : okpaw
|
2009-02-04 18:25:03 +08:00
|
|
|
USE qpoint, ONLY : nksq, ikks, ikqs
|
2009-11-17 01:04:25 +08:00
|
|
|
USE control_ph, ONLY : rec_code_read
|
2003-03-27 23:47:30 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: wgg (nbnd, nbnd, nksq)
|
2003-03-27 23:47:30 +08:00
|
|
|
! output: the weights
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-03-27 23:47:30 +08:00
|
|
|
integer :: ik, ikk, ikq, ibnd, jbnd
|
|
|
|
! counters
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: wg1, wg2, theta
|
2003-03-27 23:47:30 +08:00
|
|
|
! auxiliary variables
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP), external :: wgauss
|
|
|
|
real(DP), parameter :: eps = 1.0d-12
|
2003-03-27 23:47:30 +08:00
|
|
|
!
|
|
|
|
! the weights are computed for each k point ...
|
|
|
|
!
|
2009-11-17 01:04:25 +08:00
|
|
|
if (rec_code_read >= -20.AND..NOT.okpaw) return
|
|
|
|
|
2003-03-27 23:47:30 +08:00
|
|
|
do ik = 1, nksq
|
2009-02-04 18:25:03 +08:00
|
|
|
ikk = ikks(ik)
|
|
|
|
ikq = ikqs(ik)
|
2003-03-27 23:47:30 +08:00
|
|
|
!
|
|
|
|
! each band v ...
|
|
|
|
!
|
|
|
|
do ibnd = 1, nbnd
|
|
|
|
if (wk (ikk) .eq.0.d0) then
|
|
|
|
wg1 = 0.d0
|
|
|
|
else
|
|
|
|
wg1 = wg (ibnd, ikk) / wk (ikk)
|
|
|
|
endif
|
|
|
|
!
|
|
|
|
! and each band v' ...
|
|
|
|
!
|
|
|
|
do jbnd = 1, nbnd
|
2006-12-19 02:28:42 +08:00
|
|
|
if (lgauss) then
|
2003-03-27 23:47:30 +08:00
|
|
|
theta = wgauss ( (et (jbnd,ikq) - et (ibnd,ikk) ) / degauss, 0)
|
|
|
|
wg2 = wgauss ( (ef - et (jbnd, ikq) ) / degauss, ngauss)
|
|
|
|
else
|
2006-11-22 18:54:28 +08:00
|
|
|
IF (et (jbnd,ikq) > et (ibnd,ikk)) THEN
|
|
|
|
theta = 1.0d0
|
|
|
|
ELSE
|
|
|
|
theta = 0.d0
|
|
|
|
ENDIF
|
|
|
|
IF (ABS(et (jbnd,ikq) - et (ibnd,ikk)) < 1.d-8) theta=0.5d0
|
2003-03-27 23:47:30 +08:00
|
|
|
if (wk (ikk) .le.eps) then
|
|
|
|
wg2 = 0.d0
|
|
|
|
else
|
|
|
|
wg2 = wg (jbnd, ikk) / wk (ikk)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
wgg (ibnd, jbnd, ik) = wg1 * (1.d0 - theta) + wg2 * theta
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
! do ibnd=1,nbnd
|
|
|
|
! do jbnd=1,nbnd
|
2003-11-06 03:01:20 +08:00
|
|
|
! WRITE( stdout,'(3i5,f20.10)') ibnd, jbnd, ik,wgg(ibnd,jbnd,ik)
|
2003-03-27 23:47:30 +08:00
|
|
|
! enddo
|
|
|
|
! enddo
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-03-27 23:47:30 +08:00
|
|
|
enddo
|
|
|
|
! call stop_ph(.true.)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
end subroutine compute_weight
|