There was a nasty bug in the real-space approach to Q(r) of USPP:

if the physical and true dimensions of the charge density array
were different, the algorithm was filling non physical locations
of the array as well


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4772 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2008-04-04 13:58:13 +00:00
parent 3fd2de8d61
commit e210f07dd1
1 changed files with 8 additions and 8 deletions

View File

@ -155,14 +155,10 @@ MODULE realus
!
! ... now we find the points
!
idx0 = 0
!
#if defined (__PARA)
!
DO i = 1, me_pool
idx0 = idx0 + nrx1*nrx2*dfftp%npp(i)
END DO
!
idx0 = nrx1*nrx2 * SUM ( dfftp%npp(1:me_pool) )
#else
idx0 = 0
#endif
!
inv_nr1 = 1.D0 / DBLE( nr1 )
@ -183,7 +179,7 @@ MODULE realus
!
DO ir = 1, nrxx
!
! ... three dimensional indexes
! ... three dimensional indices (i,j,k)
!
idx = idx0 + ir - 1
k = idx / (nrx1*nrx2)
@ -192,6 +188,10 @@ MODULE realus
idx = idx - nrx1*j
i = idx
!
! ... do not include points outside the physical range!
!
IF ( i >= nr1 .or. j >= nr2 .or. k >= nr3 ) CYCLE
!
DO ipol = 1, 3
posi(ipol) = DBLE( i )*inv_nr1*at(ipol,1) + &
DBLE( j )*inv_nr2*at(ipol,2) + &