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 .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine g_psi (lda, n, m, psi, e)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine computes an estimate of the inverse Hamiltonian
|
|
|
|
! and applies it to m wavefunctions
|
|
|
|
!
|
|
|
|
! first the input variables
|
|
|
|
!
|
|
|
|
use parameters
|
|
|
|
use g_psi_mod
|
|
|
|
implicit none
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: lda, n, m
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: the leading dimension of psi
|
|
|
|
! input: the real dimension of psi
|
|
|
|
! input: the number of bands
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: e (m)
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: the eigenvectors
|
2003-02-08 00:04:36 +08:00
|
|
|
complex(kind=DP) :: psi (lda, m)
|
2003-01-20 05:58:50 +08:00
|
|
|
! inp/out: the psi vector
|
|
|
|
!
|
|
|
|
! One parameter
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: eps
|
2003-01-20 05:58:50 +08:00
|
|
|
! a small number
|
2003-02-08 00:04:36 +08:00
|
|
|
parameter (eps = 1.0d-4)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! The local variables
|
|
|
|
!
|
|
|
|
real(kind=DP) :: denm ! the denominator
|
2003-02-08 00:04:36 +08:00
|
|
|
|
|
|
|
integer :: k, i
|
2003-01-20 05:58:50 +08:00
|
|
|
! counter on psi functions
|
|
|
|
! counter on G vectors
|
2003-02-08 00:04:36 +08:00
|
|
|
call start_clock ('g_psi')
|
|
|
|
do k = 1, m
|
|
|
|
do i = 1, n
|
|
|
|
denm = h_diag (i) - e (k) * s_diag (i)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! denm = g2+v(g=0) - e(k)
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
if (abs (denm) .lt.eps) denm = sign (eps, denm)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! denm = sign( max( abs(denm),eps ), denm )
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
psi (i, k) = psi (i, k) / denm
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
call stop_clock ('g_psi')
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine g_psi
|
|
|
|
|