Fixed an error in the Gram-Schmidt orthogonalisation.

C.S.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@2778 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
sbraccia 2006-02-07 15:55:53 +00:00
parent 0b6de7a082
commit 8a94a18fcd
1 changed files with 32 additions and 23 deletions

View File

@ -89,21 +89,25 @@ SUBROUTINE cgramg1( lda, nvecx, n, start, finish, psi, spsi, hpsi )
!
DO vec = start, finish
!
CALL DGEMV( 'T', 2*n, vec-1, 2.D0, &
psi, 2*n, spsi(1,vec), 1, 0.D0, ps, 1 )
!
IF ( gstart == 2 ) &
ps(1:vec-1) = ps(1:vec-1) - psi(1,1:vec-1) * spsi(1,vec)
!
CALL reduce( ( vec - 1 ), ps )
!
DO vecp = 1, ( vec - 1 )
IF ( vec > 1 ) THEN
!
CALL DGEMV( 'T', 2*n, vec-1, 2.D0, &
psi, 2*n, spsi(1,vec), 1, 0.D0, ps, 1 )
!
psi(:,vec) = psi(:,vec) - ps(vecp) * psi(:,vecp)
hpsi(:,vec) = hpsi(:,vec) - ps(vecp) * hpsi(:,vecp)
spsi(:,vec) = spsi(:,vec) - ps(vecp) * spsi(:,vecp)
IF ( gstart == 2 ) &
ps(1:vec-1) = ps(1:vec-1) - psi(1,1:vec-1) * spsi(1,vec)
!
END DO
CALL reduce( ( vec - 1 ), ps )
!
DO vecp = 1, ( vec - 1 )
!
psi(:,vec) = psi(:,vec) - ps(vecp) * psi(:,vecp)
hpsi(:,vec) = hpsi(:,vec) - ps(vecp) * hpsi(:,vecp)
spsi(:,vec) = spsi(:,vec) - ps(vecp) * spsi(:,vecp)
!
END DO
!
END IF
!
psi_norm = 2.D0 * DDOT( 2 * n, psi(1,vec), 1, spsi(1,vec), 1 )
!
@ -160,17 +164,22 @@ SUBROUTINE cgramg1( lda, nvecx, n, start, finish, psi, spsi, hpsi )
!
DO vec = start, finish
!
CALL ZGEMV( 'C', n, vec-1, ONE, psi, n, spsi(1,vec), 1, ZERO, ps, 1 )
!
CALL reduce( 2*( vec - 1 ), ps )
!
DO vecp = 1, ( vec - 1 )
IF ( vec > 1 ) THEN
!
CALL ZGEMV( 'C', n, vec-1, ONE, &
psi, n, spsi(1,vec), 1, ZERO, ps, 1 )
!
CALL reduce( 2*( vec - 1 ), ps )
!
psi(:,vec) = psi(:,vec) - ps(vecp) * psi(:,vecp)
hpsi(:,vec) = hpsi(:,vec) - ps(vecp) * hpsi(:,vecp)
spsi(:,vec) = spsi(:,vec) - ps(vecp) * spsi(:,vecp)
!
END DO
DO vecp = 1, ( vec - 1 )
!
psi(:,vec) = psi(:,vec) - ps(vecp) * psi(:,vecp)
hpsi(:,vec) = hpsi(:,vec) - ps(vecp) * hpsi(:,vecp)
spsi(:,vec) = spsi(:,vec) - ps(vecp) * spsi(:,vecp)
!
END DO
!
END IF
!
psi_norm = DDOT( 2*n, psi(1,vec), 1, spsi(1,vec), 1 )
!