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 cg_psi (lda, n, m, psi, h_diag)
|
2004-05-12 05:08:21 +08:00
|
|
|
!-----------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine gives a preconditioning to the linear system solver.
|
|
|
|
! The preconditioning is diagonal in reciprocal space
|
|
|
|
!
|
|
|
|
!
|
|
|
|
USE kinds, only : DP
|
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2004-05-12 05:08:21 +08:00
|
|
|
integer :: lda, n, m
|
2004-06-01 00:19:23 +08:00
|
|
|
! input: the leading dimension of the psi vector
|
2004-05-12 05:08:21 +08:00
|
|
|
! input: the real dimension of the vector
|
|
|
|
! input: the number of vectors
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: psi (lda, m)
|
2004-05-12 05:08:21 +08:00
|
|
|
! inp/out: the vector to be preconditioned
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: h_diag (lda, m)
|
2004-05-12 05:08:21 +08:00
|
|
|
! input: the preconditioning vector
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2004-05-12 05:08:21 +08:00
|
|
|
integer :: k, i
|
|
|
|
! counter on bands
|
|
|
|
! counter on the elements of the vector
|
|
|
|
!
|
|
|
|
do k = 1, m
|
|
|
|
do i = 1, n
|
|
|
|
psi (i, k) = psi (i, k) * h_diag (i, k)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine cg_psi
|