mirror of https://gitlab.com/QEF/q-e.git
Fix indentation (N. Nemec)
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@6444 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
e8b49314d3
commit
c63ef96da5
656
PW/ggen.f90
656
PW/ggen.f90
|
@ -8,373 +8,371 @@
|
|||
!
|
||||
!-----------------------------------------------------------------------
|
||||
SUBROUTINE ggen()
|
||||
!----------------------------------------------------------------------
|
||||
!
|
||||
! This routine generates all the reciprocal lattice vectors
|
||||
! contained in the sphere of radius gcutm. Furthermore it
|
||||
! computes the indices nl which give the correspondence
|
||||
! between the fft mesh points and the array of g vectors.
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE cell_base, ONLY : at, bg
|
||||
USE reciprocal_vectors, ONLY : ig_l2g
|
||||
USE gvect, ONLY : g, gg, ngm, ngm_g, ngm_l, nr1, nr2, nr3, &
|
||||
gcutm, nrx1, nrx2, nrx3, ig1, ig2, ig3, &
|
||||
nl, gstart, gl, ngl, igtongl
|
||||
USE gsmooth, ONLY : ngms, gcutms, ngms_g, nr1s, nr2s, nr3s, &
|
||||
nrx1s, nrx3s, nls
|
||||
USE control_flags, ONLY : gamma_only
|
||||
USE cellmd, ONLY : lmovecell
|
||||
USE constants, ONLY : eps8
|
||||
USE fft_base, ONLY : dfftp, dffts
|
||||
!----------------------------------------------------------------------
|
||||
!
|
||||
! This routine generates all the reciprocal lattice vectors
|
||||
! contained in the sphere of radius gcutm. Furthermore it
|
||||
! computes the indices nl which give the correspondence
|
||||
! between the fft mesh points and the array of g vectors.
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE cell_base, ONLY : at, bg
|
||||
USE reciprocal_vectors, ONLY : ig_l2g
|
||||
USE gvect, ONLY : g, gg, ngm, ngm_g, ngm_l, nr1, nr2, nr3, &
|
||||
gcutm, nrx1, nrx2, nrx3, ig1, ig2, ig3, &
|
||||
nl, gstart, gl, ngl, igtongl
|
||||
USE gsmooth, ONLY : ngms, gcutms, ngms_g, nr1s, nr2s, nr3s, &
|
||||
nrx1s, nrx3s, nls
|
||||
USE control_flags, ONLY : gamma_only
|
||||
USE cellmd, ONLY : lmovecell
|
||||
USE constants, ONLY : eps8
|
||||
USE fft_base, ONLY : dfftp, dffts
|
||||
|
||||
IMPLICIT NONE
|
||||
!
|
||||
! here a few local variables
|
||||
!
|
||||
REAL(DP) :: t (3), tt, swap
|
||||
REAL(DP), ALLOCATABLE :: esort (:)
|
||||
!
|
||||
INTEGER :: ngmx, n1, n2, n3, n1s, n2s, n3s
|
||||
!
|
||||
REAL(DP), ALLOCATABLE :: g2sort_g(:)
|
||||
! array containing all g vectors, on all processors: replicated data
|
||||
INTEGER, ALLOCATABLE :: mill_g(:,:)
|
||||
! array containing all g vectors generators, on all processors:
|
||||
! replicated data
|
||||
INTEGER, ALLOCATABLE :: igsrt(:)
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
! here a few local variables
|
||||
!
|
||||
REAL(DP) :: t (3), tt, swap
|
||||
REAL(DP), ALLOCATABLE :: esort (:)
|
||||
!
|
||||
INTEGER :: ngmx, n1, n2, n3, n1s, n2s, n3s
|
||||
!
|
||||
REAL(DP), ALLOCATABLE :: g2sort_g(:)
|
||||
! array containing all g vectors, on all processors: replicated data
|
||||
INTEGER, ALLOCATABLE :: mill_g(:,:)
|
||||
! array containing all g vectors generators, on all processors:
|
||||
! replicated data
|
||||
INTEGER, ALLOCATABLE :: igsrt(:)
|
||||
!
|
||||
#ifdef __PARA
|
||||
INTEGER :: m1, m2, mc
|
||||
!
|
||||
INTEGER :: m1, m2, mc
|
||||
!
|
||||
#endif
|
||||
INTEGER :: i, j, k, ipol, ng, igl, iswap, indsw
|
||||
!
|
||||
! counters
|
||||
!
|
||||
! set the total number of fft mesh points and and initial value of gg
|
||||
! The choice of gcutm is due to the fact that we have to order the
|
||||
! vectors after computing them.
|
||||
!
|
||||
gg(:) = gcutm + 1.d0
|
||||
!
|
||||
! set d vector for unique ordering
|
||||
!
|
||||
! and computes all the g vectors inside a sphere
|
||||
!
|
||||
ALLOCATE( ig_l2g( ngm_l ) )
|
||||
ALLOCATE( mill_g( 3, ngm_g ) )
|
||||
ALLOCATE( igsrt( ngm_g ) )
|
||||
ALLOCATE( g2sort_g( ngm_g ) )
|
||||
g2sort_g(:) = 1.0d20
|
||||
!
|
||||
n1 = nr1 + 1
|
||||
n2 = nr2 + 1
|
||||
n3 = nr3 + 1
|
||||
!
|
||||
! save present value of ngm in ngmx variable
|
||||
!
|
||||
ngmx = ngm
|
||||
!
|
||||
ngm = 0
|
||||
ngms = 0
|
||||
DO i = - n1, n1
|
||||
!
|
||||
! Gamma-only: exclude space with x < 0
|
||||
!
|
||||
IF ( gamma_only .and. i < 0) GOTO 10
|
||||
DO j = - n2, n2
|
||||
!
|
||||
! exclude plane with x = 0, y < 0
|
||||
!
|
||||
IF ( gamma_only .and. i == 0 .and. j < 0) GOTO 11
|
||||
DO k = - n3, n3
|
||||
!
|
||||
! exclude line with x = 0, y = 0, z < 0
|
||||
!
|
||||
IF ( gamma_only .and. i == 0 .and. j == 0 .and. k < 0) GOTO 12
|
||||
tt = 0.d0
|
||||
DO ipol = 1, 3
|
||||
t (ipol) = i * bg (ipol, 1) + j * bg (ipol, 2) + k * bg (ipol, 3)
|
||||
tt = tt + t (ipol) * t (ipol)
|
||||
ENDDO
|
||||
IF (tt <= gcutm) THEN
|
||||
ngm = ngm + 1
|
||||
IF (tt <= gcutms) ngms = ngms + 1
|
||||
IF (ngm > ngm_g) CALL errore ('ggen', 'too many g-vectors', ngm)
|
||||
mill_g( 1, ngm ) = i
|
||||
mill_g( 2, ngm ) = j
|
||||
mill_g( 3, ngm ) = k
|
||||
IF ( tt > eps8 ) THEN
|
||||
g2sort_g(ngm) = tt
|
||||
ELSE
|
||||
g2sort_g(ngm) = 0.d0
|
||||
ENDIF
|
||||
ENDIF
|
||||
12 CONTINUE
|
||||
ENDDO
|
||||
11 CONTINUE
|
||||
ENDDO
|
||||
10 CONTINUE
|
||||
ENDDO
|
||||
|
||||
IF (ngm /= ngm_g ) &
|
||||
CALL errore ('ggen', 'g-vectors missing !', abs(ngm - ngm_g))
|
||||
IF (ngms /= ngms_g) &
|
||||
CALL errore ('ggen', 'smooth g-vectors missing !', abs(ngms - ngms_g))
|
||||
|
||||
igsrt(1) = 0
|
||||
CALL hpsort_eps( ngm_g, g2sort_g, igsrt, eps8 )
|
||||
DEALLOCATE( g2sort_g )
|
||||
DO ng = 1, ngm_g-1
|
||||
indsw = ng
|
||||
7 IF(igsrt(indsw) /= ng) THEN
|
||||
! .. swap indices
|
||||
DO i = 1, 3
|
||||
iswap = mill_g(i,indsw)
|
||||
mill_g(i,indsw) = mill_g(i,igsrt(indsw))
|
||||
mill_g(i,igsrt(indsw)) = iswap
|
||||
INTEGER :: i, j, k, ipol, ng, igl, iswap, indsw
|
||||
!
|
||||
! counters
|
||||
!
|
||||
! set the total number of fft mesh points and and initial value of gg
|
||||
! The choice of gcutm is due to the fact that we have to order the
|
||||
! vectors after computing them.
|
||||
!
|
||||
gg(:) = gcutm + 1.d0
|
||||
!
|
||||
! set d vector for unique ordering
|
||||
!
|
||||
! and computes all the g vectors inside a sphere
|
||||
!
|
||||
ALLOCATE( ig_l2g( ngm_l ) )
|
||||
ALLOCATE( mill_g( 3, ngm_g ) )
|
||||
ALLOCATE( igsrt( ngm_g ) )
|
||||
ALLOCATE( g2sort_g( ngm_g ) )
|
||||
g2sort_g(:) = 1.0d20
|
||||
!
|
||||
n1 = nr1 + 1
|
||||
n2 = nr2 + 1
|
||||
n3 = nr3 + 1
|
||||
!
|
||||
! save present value of ngm in ngmx variable
|
||||
!
|
||||
ngmx = ngm
|
||||
!
|
||||
ngm = 0
|
||||
ngms = 0
|
||||
DO i = - n1, n1
|
||||
!
|
||||
! Gamma-only: exclude space with x < 0
|
||||
!
|
||||
IF ( gamma_only .and. i < 0) GOTO 10
|
||||
DO j = - n2, n2
|
||||
!
|
||||
! exclude plane with x = 0, y < 0
|
||||
!
|
||||
IF ( gamma_only .and. i == 0 .and. j < 0) GOTO 11
|
||||
DO k = - n3, n3
|
||||
!
|
||||
! exclude line with x = 0, y = 0, z < 0
|
||||
!
|
||||
IF ( gamma_only .and. i == 0 .and. j == 0 .and. k < 0) GOTO 12
|
||||
tt = 0.d0
|
||||
DO ipol = 1, 3
|
||||
t (ipol) = i * bg (ipol, 1) + j * bg (ipol, 2) + k * bg (ipol, 3)
|
||||
tt = tt + t (ipol) * t (ipol)
|
||||
ENDDO
|
||||
IF (tt <= gcutm) THEN
|
||||
ngm = ngm + 1
|
||||
IF (tt <= gcutms) ngms = ngms + 1
|
||||
IF (ngm > ngm_g) CALL errore ('ggen', 'too many g-vectors', ngm)
|
||||
mill_g( 1, ngm ) = i
|
||||
mill_g( 2, ngm ) = j
|
||||
mill_g( 3, ngm ) = k
|
||||
IF ( tt > eps8 ) THEN
|
||||
g2sort_g(ngm) = tt
|
||||
ELSE
|
||||
g2sort_g(ngm) = 0.d0
|
||||
ENDIF
|
||||
ENDIF
|
||||
12 CONTINUE
|
||||
ENDDO
|
||||
11 CONTINUE
|
||||
ENDDO
|
||||
10 CONTINUE
|
||||
ENDDO
|
||||
|
||||
IF (ngm /= ngm_g ) &
|
||||
CALL errore ('ggen', 'g-vectors missing !', abs(ngm - ngm_g))
|
||||
IF (ngms /= ngms_g) &
|
||||
CALL errore ('ggen', 'smooth g-vectors missing !', abs(ngms - ngms_g))
|
||||
|
||||
igsrt(1) = 0
|
||||
CALL hpsort_eps( ngm_g, g2sort_g, igsrt, eps8 )
|
||||
DEALLOCATE( g2sort_g )
|
||||
DO ng = 1, ngm_g-1
|
||||
indsw = ng
|
||||
7 IF(igsrt(indsw) /= ng) THEN
|
||||
! .. swap indices
|
||||
iswap = indsw; indsw = igsrt(indsw); igsrt(iswap) = iswap
|
||||
IF(igsrt(indsw) == ng) THEN
|
||||
igsrt(indsw)=indsw
|
||||
ELSE
|
||||
GOTO 7
|
||||
DO i = 1, 3
|
||||
iswap = mill_g(i,indsw)
|
||||
mill_g(i,indsw) = mill_g(i,igsrt(indsw))
|
||||
mill_g(i,igsrt(indsw)) = iswap
|
||||
ENDDO
|
||||
! .. swap indices
|
||||
iswap = indsw; indsw = igsrt(indsw); igsrt(iswap) = iswap
|
||||
IF(igsrt(indsw) == ng) THEN
|
||||
igsrt(indsw)=indsw
|
||||
ELSE
|
||||
GOTO 7
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDDO
|
||||
ENDDO
|
||||
|
||||
DEALLOCATE( igsrt )
|
||||
DEALLOCATE( igsrt )
|
||||
|
||||
! WRITE( stdout, fmt="(//,' --- Executing new GGEN Loop ---',//)" )
|
||||
! WRITE( stdout, fmt="(//,' --- Executing new GGEN Loop ---',//)" )
|
||||
|
||||
ALLOCATE(esort(ngm) )
|
||||
esort(:) = 1.0d20
|
||||
ngm = 0
|
||||
ngms = 0
|
||||
DO ng = 1, ngm_g
|
||||
i = mill_g(1, ng)
|
||||
j = mill_g(2, ng)
|
||||
k = mill_g(3, ng)
|
||||
ALLOCATE(esort(ngm) )
|
||||
esort(:) = 1.0d20
|
||||
ngm = 0
|
||||
ngms = 0
|
||||
DO ng = 1, ngm_g
|
||||
i = mill_g(1, ng)
|
||||
j = mill_g(2, ng)
|
||||
k = mill_g(3, ng)
|
||||
|
||||
#ifdef __PARA
|
||||
m1 = mod (i, nr1) + 1
|
||||
IF (m1.lt.1) m1 = m1 + nr1
|
||||
m2 = mod (j, nr2) + 1
|
||||
IF (m2.lt.1) m2 = m2 + nr2
|
||||
mc = m1 + (m2 - 1) * nrx1
|
||||
IF ( dfftp%isind ( mc ) .eq.0) GOTO 1
|
||||
m1 = mod (i, nr1) + 1
|
||||
IF (m1.lt.1) m1 = m1 + nr1
|
||||
m2 = mod (j, nr2) + 1
|
||||
IF (m2.lt.1) m2 = m2 + nr2
|
||||
mc = m1 + (m2 - 1) * nrx1
|
||||
IF ( dfftp%isind ( mc ) .eq.0) GOTO 1
|
||||
#endif
|
||||
|
||||
tt = 0.d0
|
||||
DO ipol = 1, 3
|
||||
t (ipol) = i * bg (ipol, 1) + j * bg (ipol, 2) + k * bg (ipol, 3)
|
||||
tt = tt + t (ipol) * t (ipol)
|
||||
ENDDO
|
||||
tt = 0.d0
|
||||
DO ipol = 1, 3
|
||||
t (ipol) = i * bg (ipol, 1) + j * bg (ipol, 2) + k * bg (ipol, 3)
|
||||
tt = tt + t (ipol) * t (ipol)
|
||||
ENDDO
|
||||
|
||||
ngm = ngm + 1
|
||||
IF (tt <= gcutms) ngms = ngms + 1
|
||||
IF (ngm > ngmx) CALL errore ('ggen', 'too many g-vectors', ngm)
|
||||
!
|
||||
! Here map local and global g index !!!
|
||||
!
|
||||
ig_l2g( ngm ) = ng
|
||||
!
|
||||
g (1:3, ngm) = t (1:3)
|
||||
gg (ngm) = tt
|
||||
ngm = ngm + 1
|
||||
IF (tt <= gcutms) ngms = ngms + 1
|
||||
IF (ngm > ngmx) CALL errore ('ggen', 'too many g-vectors', ngm)
|
||||
!
|
||||
! Here map local and global g index !!!
|
||||
!
|
||||
ig_l2g( ngm ) = ng
|
||||
!
|
||||
g (1:3, ngm) = t (1:3)
|
||||
gg (ngm) = tt
|
||||
|
||||
IF (tt > eps8) THEN
|
||||
esort (ngm) = tt
|
||||
ELSE
|
||||
esort (ngm) = 0.d0
|
||||
ENDIF
|
||||
IF (tt > eps8) THEN
|
||||
esort (ngm) = tt
|
||||
ELSE
|
||||
esort (ngm) = 0.d0
|
||||
ENDIF
|
||||
|
||||
1 CONTINUE
|
||||
ENDDO
|
||||
1 CONTINUE
|
||||
ENDDO
|
||||
|
||||
IF (ngm.ne.ngmx) &
|
||||
CALL errore ('ggen', 'g-vectors missing !', abs(ngm - ngmx))
|
||||
!
|
||||
! reorder the g's in order of increasing magnitude. On exit
|
||||
! from hpsort esort is ordered, and nl contains the new order.
|
||||
!
|
||||
! initialize the index inside sorting routine
|
||||
IF (ngm.ne.ngmx) &
|
||||
CALL errore ('ggen', 'g-vectors missing !', abs(ngm - ngmx))
|
||||
!
|
||||
! reorder the g's in order of increasing magnitude. On exit
|
||||
! from hpsort esort is ordered, and nl contains the new order.
|
||||
!
|
||||
! initialize the index inside sorting routine
|
||||
|
||||
nl (1) = 0
|
||||
CALL hpsort_eps ( ngm, esort, nl, eps8 )
|
||||
!
|
||||
DEALLOCATE( esort )
|
||||
!
|
||||
! reorder also the g vectors, and nl
|
||||
!
|
||||
DO ng = 1, ngm - 1
|
||||
20 indsw = nl (ng)
|
||||
IF (indsw.ne.ng) THEN
|
||||
DO ipol = 1, 3
|
||||
swap = g (ipol, indsw)
|
||||
g (ipol, indsw) = g (ipol, nl (indsw) )
|
||||
g (ipol, nl (indsw) ) = swap
|
||||
ENDDO
|
||||
swap = gg (indsw)
|
||||
gg (indsw) = gg (nl (indsw) )
|
||||
gg (nl (indsw) ) = swap
|
||||
nl (1) = 0
|
||||
CALL hpsort_eps ( ngm, esort, nl, eps8 )
|
||||
!
|
||||
DEALLOCATE( esort )
|
||||
!
|
||||
! reorder also the g vectors, and nl
|
||||
!
|
||||
DO ng = 1, ngm - 1
|
||||
20 indsw = nl (ng)
|
||||
IF (indsw.ne.ng) THEN
|
||||
DO ipol = 1, 3
|
||||
swap = g (ipol, indsw)
|
||||
g (ipol, indsw) = g (ipol, nl (indsw) )
|
||||
g (ipol, nl (indsw) ) = swap
|
||||
ENDDO
|
||||
swap = gg (indsw)
|
||||
gg (indsw) = gg (nl (indsw) )
|
||||
gg (nl (indsw) ) = swap
|
||||
|
||||
!
|
||||
! Remember: ig_l2g is the index of a given G vectors in the
|
||||
! sorted global array containing all G vectors, it is used to
|
||||
! collect all wave function components
|
||||
!
|
||||
iswap = ig_l2g( indsw )
|
||||
ig_l2g( indsw ) = ig_l2g( nl(indsw) )
|
||||
ig_l2g( nl(indsw) ) = iswap
|
||||
!
|
||||
! Remember: ig_l2g is the index of a given G vectors in the
|
||||
! sorted global array containing all G vectors, it is used to
|
||||
! collect all wave function components
|
||||
!
|
||||
iswap = ig_l2g( indsw )
|
||||
ig_l2g( indsw ) = ig_l2g( nl(indsw) )
|
||||
ig_l2g( nl(indsw) ) = iswap
|
||||
|
||||
iswap = nl (ng)
|
||||
nl (ng) = nl (indsw)
|
||||
nl (indsw) = iswap
|
||||
iswap = nl (ng)
|
||||
nl (ng) = nl (indsw)
|
||||
nl (indsw) = iswap
|
||||
|
||||
GOTO 20
|
||||
ENDIF
|
||||
GOTO 20
|
||||
ENDIF
|
||||
|
||||
ENDDO
|
||||
!
|
||||
! here to initialize berry_phase
|
||||
! CALL berry_setup(ngm, ngm_g, nr1, nr2, nr3, mill_g)
|
||||
!
|
||||
! determine first nonzero g vector
|
||||
!
|
||||
IF (gg(1).le.eps8) THEN
|
||||
gstart=2
|
||||
ELSE
|
||||
gstart=1
|
||||
ENDIF
|
||||
!
|
||||
! Now set nl and nls with the correct fft correspondence
|
||||
!
|
||||
DO ng = 1, ngm
|
||||
n1 = nint (g (1, ng) * at (1, 1) + g (2, ng) * at (2, 1) + g (3, &
|
||||
ng) * at (3, 1) ) + 1
|
||||
ig1 (ng) = n1 - 1
|
||||
n1s = n1
|
||||
IF (n1.lt.1) n1 = n1 + nr1
|
||||
IF (n1s.lt.1) n1s = n1s + nr1s
|
||||
n2 = nint (g (1, ng) * at (1, 2) + g (2, ng) * at (2, 2) + g (3, &
|
||||
ng) * at (3, 2) ) + 1
|
||||
ig2 (ng) = n2 - 1
|
||||
n2s = n2
|
||||
IF (n2.lt.1) n2 = n2 + nr2
|
||||
IF (n2s.lt.1) n2s = n2s + nr2s
|
||||
n3 = nint (g (1, ng) * at (1, 3) + g (2, ng) * at (2, 3) + g (3, &
|
||||
ng) * at (3, 3) ) + 1
|
||||
ig3 (ng) = n3 - 1
|
||||
n3s = n3
|
||||
IF (n3.lt.1) n3 = n3 + nr3
|
||||
IF (n3s.lt.1) n3s = n3s + nr3s
|
||||
IF (n1.le.nr1.and.n2.le.nr2.and.n3.le.nr3) THEN
|
||||
ENDDO
|
||||
!
|
||||
! here to initialize berry_phase
|
||||
! CALL berry_setup(ngm, ngm_g, nr1, nr2, nr3, mill_g)
|
||||
!
|
||||
! determine first nonzero g vector
|
||||
!
|
||||
IF (gg(1).le.eps8) THEN
|
||||
gstart=2
|
||||
ELSE
|
||||
gstart=1
|
||||
ENDIF
|
||||
!
|
||||
! Now set nl and nls with the correct fft correspondence
|
||||
!
|
||||
DO ng = 1, ngm
|
||||
n1 = nint (g (1, ng) * at (1, 1) + g (2, ng) * at (2, 1) + g (3, &
|
||||
ng) * at (3, 1) ) + 1
|
||||
ig1 (ng) = n1 - 1
|
||||
n1s = n1
|
||||
IF (n1.lt.1) n1 = n1 + nr1
|
||||
IF (n1s.lt.1) n1s = n1s + nr1s
|
||||
n2 = nint (g (1, ng) * at (1, 2) + g (2, ng) * at (2, 2) + g (3, &
|
||||
ng) * at (3, 2) ) + 1
|
||||
ig2 (ng) = n2 - 1
|
||||
n2s = n2
|
||||
IF (n2.lt.1) n2 = n2 + nr2
|
||||
IF (n2s.lt.1) n2s = n2s + nr2s
|
||||
n3 = nint (g (1, ng) * at (1, 3) + g (2, ng) * at (2, 3) + g (3, &
|
||||
ng) * at (3, 3) ) + 1
|
||||
ig3 (ng) = n3 - 1
|
||||
n3s = n3
|
||||
IF (n3.lt.1) n3 = n3 + nr3
|
||||
IF (n3s.lt.1) n3s = n3s + nr3s
|
||||
IF (n1.le.nr1.and.n2.le.nr2.and.n3.le.nr3) THEN
|
||||
#if defined (__PARA) && !defined (__USE_3D_FFT)
|
||||
nl (ng) = n3 + ( dfftp%isind (n1 + (n2 - 1) * nrx1) - 1) * nrx3
|
||||
IF (ng.le.ngms) nls (ng) = n3s + ( dffts%isind (n1s + (n2s - 1) &
|
||||
* nrx1s) - 1) * nrx3s
|
||||
nl (ng) = n3 + ( dfftp%isind (n1 + (n2 - 1) * nrx1) - 1) * nrx3
|
||||
IF (ng.le.ngms) nls (ng) = n3s + ( dffts%isind (n1s + (n2s - 1) &
|
||||
* nrx1s) - 1) * nrx3s
|
||||
#else
|
||||
nl (ng) = n1 + (n2 - 1) * nrx1 + (n3 - 1) * nrx1 * nrx2
|
||||
IF (ng.le.ngms) nls (ng) = n1s + (n2s - 1) * nrx1s + (n3s - 1) &
|
||||
* nrx1s * nr2s
|
||||
nl (ng) = n1 + (n2 - 1) * nrx1 + (n3 - 1) * nrx1 * nrx2
|
||||
IF (ng.le.ngms) nls (ng) = n1s + (n2s - 1) * nrx1s + (n3s - 1) &
|
||||
* nrx1s * nr2s
|
||||
#endif
|
||||
ELSE
|
||||
CALL errore('ggen','Mesh too small?',ng)
|
||||
ENDIF
|
||||
ENDDO
|
||||
!
|
||||
ELSE
|
||||
CALL errore('ggen','Mesh too small?',ng)
|
||||
ENDIF
|
||||
ENDDO
|
||||
!
|
||||
DEALLOCATE( mill_g )
|
||||
!
|
||||
! calculate number of G shells: ngl
|
||||
!
|
||||
IF (lmovecell) THEN
|
||||
!
|
||||
! in case of a variable cell run each G vector has its shell
|
||||
!
|
||||
ngl = ngm
|
||||
gl => gg
|
||||
DO ng = 1, ngm
|
||||
igtongl (ng) = ng
|
||||
ENDDO
|
||||
ELSE
|
||||
!
|
||||
! G vectors are grouped in shells with the same norm
|
||||
!
|
||||
ngl = 1
|
||||
igtongl (1) = 1
|
||||
DO ng = 2, ngm
|
||||
IF (gg (ng) > gg (ng - 1) + eps8) THEN
|
||||
ngl = ngl + 1
|
||||
ENDIF
|
||||
igtongl (ng) = ngl
|
||||
ENDDO
|
||||
!
|
||||
! calculate number of G shells: ngl
|
||||
!
|
||||
IF (lmovecell) THEN
|
||||
!
|
||||
! in case of a variable cell run each G vector has its shell
|
||||
!
|
||||
ngl = ngm
|
||||
gl => gg
|
||||
DO ng = 1, ngm
|
||||
igtongl (ng) = ng
|
||||
ENDDO
|
||||
ELSE
|
||||
!
|
||||
! G vectors are grouped in shells with the same norm
|
||||
!
|
||||
ngl = 1
|
||||
igtongl (1) = 1
|
||||
DO ng = 2, ngm
|
||||
IF (gg (ng) > gg (ng - 1) + eps8) THEN
|
||||
ngl = ngl + 1
|
||||
ENDIF
|
||||
igtongl (ng) = ngl
|
||||
ENDDO
|
||||
|
||||
ALLOCATE (gl( ngl))
|
||||
gl (1) = gg (1)
|
||||
igl = 1
|
||||
DO ng = 2, ngm
|
||||
IF (gg (ng) > gg (ng - 1) + eps8) THEN
|
||||
igl = igl + 1
|
||||
gl (igl) = gg (ng)
|
||||
ENDIF
|
||||
ENDDO
|
||||
ALLOCATE (gl( ngl))
|
||||
gl (1) = gg (1)
|
||||
igl = 1
|
||||
DO ng = 2, ngm
|
||||
IF (gg (ng) > gg (ng - 1) + eps8) THEN
|
||||
igl = igl + 1
|
||||
gl (igl) = gg (ng)
|
||||
ENDIF
|
||||
ENDDO
|
||||
|
||||
IF (igl.ne.ngl) CALL errore ('setup', 'igl <> ngl', ngl)
|
||||
IF (igl.ne.ngl) CALL errore ('setup', 'igl <> ngl', ngl)
|
||||
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF ( gamma_only) CALL index_minusg()
|
||||
IF ( gamma_only) CALL index_minusg()
|
||||
|
||||
RETURN
|
||||
END SUBROUTINE ggen
|
||||
END SUBROUTINE ggen
|
||||
|
||||
!
|
||||
!-----------------------------------------------------------------------
|
||||
SUBROUTINE index_minusg()
|
||||
!----------------------------------------------------------------------
|
||||
!
|
||||
! compute indices nlm and nlms giving the correspondence
|
||||
! between the fft mesh points and -G (for gamma-only calculations)
|
||||
!
|
||||
USE gvect, ONLY : ngm, nr1, nr2, nr3, &
|
||||
nrx1, nrx2, nrx3, nlM, ig1, ig2, ig3
|
||||
USE gsmooth, ONLY : nr1s, nr2s, nr3s, nrx1s, nrx3s, nlsm, ngms
|
||||
USE fft_base, ONLY : dfftp, dffts
|
||||
IMPLICIT NONE
|
||||
!
|
||||
INTEGER :: n1, n2, n3, n1s, n2s, n3s, ng
|
||||
!
|
||||
!
|
||||
DO ng = 1, ngm
|
||||
n1 = -ig1 (ng) + 1
|
||||
n1s = n1
|
||||
IF (n1 < 1) n1 = n1 + nr1
|
||||
IF (n1s < 1) n1s = n1s + nr1s
|
||||
n2 = -ig2 (ng) + 1
|
||||
n2s = n2
|
||||
IF (n2 < 1) n2 = n2 + nr2
|
||||
IF (n2s < 1) n2s = n2s + nr2s
|
||||
n3 = -ig3 (ng) + 1
|
||||
n3s = n3
|
||||
IF (n3 < 1) n3 = n3 + nr3
|
||||
IF (n3s < 1) n3s = n3s + nr3s
|
||||
IF (n1.le.nr1 .and. n2.le.nr2 .and. n3.le.nr3) THEN
|
||||
!----------------------------------------------------------------------
|
||||
!
|
||||
! compute indices nlm and nlms giving the correspondence
|
||||
! between the fft mesh points and -G (for gamma-only calculations)
|
||||
!
|
||||
USE gvect, ONLY : ngm, nr1, nr2, nr3, &
|
||||
nrx1, nrx2, nrx3, nlM, ig1, ig2, ig3
|
||||
USE gsmooth, ONLY : nr1s, nr2s, nr3s, nrx1s, nrx3s, nlsm, ngms
|
||||
USE fft_base, ONLY : dfftp, dffts
|
||||
IMPLICIT NONE
|
||||
!
|
||||
INTEGER :: n1, n2, n3, n1s, n2s, n3s, ng
|
||||
!
|
||||
!
|
||||
DO ng = 1, ngm
|
||||
n1 = -ig1 (ng) + 1
|
||||
n1s = n1
|
||||
IF (n1 < 1) n1 = n1 + nr1
|
||||
IF (n1s < 1) n1s = n1s + nr1s
|
||||
n2 = -ig2 (ng) + 1
|
||||
n2s = n2
|
||||
IF (n2 < 1) n2 = n2 + nr2
|
||||
IF (n2s < 1) n2s = n2s + nr2s
|
||||
n3 = -ig3 (ng) + 1
|
||||
n3s = n3
|
||||
IF (n3 < 1) n3 = n3 + nr3
|
||||
IF (n3s < 1) n3s = n3s + nr3s
|
||||
IF (n1.le.nr1 .and. n2.le.nr2 .and. n3.le.nr3) THEN
|
||||
#if defined (__PARA) && !defined (__USE_3D_FFT)
|
||||
nlm(ng) = n3 + (dfftp%isind (n1 + (n2 - 1) * nrx1) - 1) * nrx3
|
||||
IF (ng.le.ngms) nlsm(ng) = n3s + (dffts%isind (n1s + (n2s - 1) &
|
||||
* nrx1s) - 1) * nrx3s
|
||||
nlm(ng) = n3 + (dfftp%isind (n1 + (n2 - 1) * nrx1) - 1) * nrx3
|
||||
IF (ng.le.ngms) nlsm(ng) = n3s + (dffts%isind (n1s + (n2s - 1) &
|
||||
* nrx1s) - 1) * nrx3s
|
||||
#else
|
||||
nlm(ng) = n1 + (n2 - 1) * nrx1 + (n3 - 1) * nrx1 * nrx2
|
||||
IF (ng.le.ngms) nlsm(ng) = n1s + (n2s - 1) * nrx1s + (n3s - 1) &
|
||||
* nrx1s * nr2s
|
||||
nlm(ng) = n1 + (n2 - 1) * nrx1 + (n3 - 1) * nrx1 * nrx2
|
||||
IF (ng.le.ngms) nlsm(ng) = n1s + (n2s - 1) * nrx1s + (n3s - 1) &
|
||||
* nrx1s * nr2s
|
||||
#endif
|
||||
ELSE
|
||||
CALL errore('index_minusg','Mesh too small?',ng)
|
||||
ENDIF
|
||||
ENDDO
|
||||
ELSE
|
||||
CALL errore('index_minusg','Mesh too small?',ng)
|
||||
ENDIF
|
||||
ENDDO
|
||||
|
||||
RETURN
|
||||
END SUBROUTINE index_minusg
|
||||
|
||||
|
|
196
PW/gk_sort.f90
196
PW/gk_sort.f90
|
@ -7,104 +7,102 @@
|
|||
!
|
||||
!----------------------------------------------------------------------------
|
||||
SUBROUTINE gk_sort( k, ngm, g, ecut, ngk, igk, gk )
|
||||
!----------------------------------------------------------------------------
|
||||
!
|
||||
! ... sorts k+g in order of increasing magnitude, up to ecut
|
||||
! ... NB: this version will yield the same ordering for different ecut
|
||||
! ... and the same ordering in all machines
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE constants, ONLY : eps8
|
||||
USE wvfct, ONLY : npwx
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
! ... Here the dummy variables
|
||||
!
|
||||
INTEGER, INTENT(in) :: ngm
|
||||
! input : the number of g vectors
|
||||
INTEGER, INTENT(inout) :: ngk
|
||||
! input/output : the number of k+G vectors inside the "ecut sphere"
|
||||
INTEGER, INTENT(out) :: igk(npwx)
|
||||
! output : the correspondence k+G <-> G
|
||||
!----------------------------------------------------------------------------
|
||||
!
|
||||
! ... sorts k+g in order of increasing magnitude, up to ecut
|
||||
! ... NB: this version will yield the same ordering for different ecut
|
||||
! ... and the same ordering in all machines
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE constants, ONLY : eps8
|
||||
USE wvfct, ONLY : npwx
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
! ... Here the dummy variables
|
||||
!
|
||||
INTEGER, INTENT(in) :: ngm
|
||||
! input : the number of g vectors
|
||||
INTEGER, INTENT(inout) :: ngk
|
||||
! input/output : the number of k+G vectors inside the "ecut sphere"
|
||||
INTEGER, INTENT(out) :: igk(npwx)
|
||||
! output : the correspondence k+G <-> G
|
||||
|
||||
REAL(DP), INTENT(in) :: k(3), g(3,ngm), ecut
|
||||
! input : the k point
|
||||
! input : the coordinates of G vectors
|
||||
! input : the cut-off energy
|
||||
REAL(DP), INTENT(out) :: gk(npwx)
|
||||
! output : the moduli of k+G
|
||||
!
|
||||
INTEGER :: ng, nk
|
||||
! counter on G vectors
|
||||
! counter on k+G vectors
|
||||
REAL(DP) :: q, q2x
|
||||
! |k+G|^2
|
||||
! upper bound for |G|
|
||||
!
|
||||
!
|
||||
! ... first we count the number of k+G vectors inside the cut-off sphere
|
||||
!
|
||||
q2x = ( sqrt( k(1)**2 + k(2)**2 + k(3)**2 ) + sqrt( ecut ) )**2
|
||||
!
|
||||
ngk = 0
|
||||
!
|
||||
DO ng = 1, ngm
|
||||
!
|
||||
q = ( k(1) + g(1,ng) )**2 + ( k(2) + g(2,ng) )**2 + ( k(3) + g(3,ng) )**2
|
||||
!
|
||||
! ... here if |k+G|^2 <= Ecut
|
||||
!
|
||||
IF ( q <= ecut ) THEN
|
||||
!
|
||||
ngk = ngk + 1
|
||||
!
|
||||
! ... gk is a fake quantity giving the same ordering on all machines
|
||||
!
|
||||
IF ( ngk > npwx ) &
|
||||
CALL errore( 'gk_sort', 'array gk out-of-bounds', 1 )
|
||||
!
|
||||
IF ( q > eps8 ) THEN
|
||||
!
|
||||
gk(ngk) = q
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
gk(ngk) = 0.D0
|
||||
!
|
||||
ENDIF
|
||||
!
|
||||
! ... set the initial value of index array
|
||||
!
|
||||
igk(ngk) = ng
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
! ... if |G| > |k| + SQRT( Ecut ) stop search and order vectors
|
||||
!
|
||||
IF ( ( g(1,ng)**2 + g(2,ng)**2 + g(3,ng)**2 ) > ( q2x + eps8 ) ) exit
|
||||
!
|
||||
ENDIF
|
||||
!
|
||||
ENDDO
|
||||
!
|
||||
IF ( ng > ngm ) &
|
||||
CALL infomsg( 'gk_sort', 'unexpected exit from do-loop')
|
||||
!
|
||||
! ... order vector gk keeping initial position in index
|
||||
!
|
||||
CALL hpsort_eps( ngk, gk, igk, eps8 )
|
||||
!
|
||||
! ... now order true |k+G|
|
||||
!
|
||||
DO nk = 1, ngk
|
||||
!
|
||||
gk(nk) = ( k(1) + g(1,igk(nk) ) )**2 + &
|
||||
( k(2) + g(2,igk(nk) ) )**2 + &
|
||||
( k(3) + g(3,igk(nk) ) )**2
|
||||
!
|
||||
ENDDO
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
REAL(DP), INTENT(in) :: k(3), g(3,ngm), ecut
|
||||
! input : the k point
|
||||
! input : the coordinates of G vectors
|
||||
! input : the cut-off energy
|
||||
REAL(DP), INTENT(out) :: gk(npwx)
|
||||
! output : the moduli of k+G
|
||||
!
|
||||
INTEGER :: ng, nk
|
||||
! counter on G vectors
|
||||
! counter on k+G vectors
|
||||
REAL(DP) :: q, q2x
|
||||
! |k+G|^2
|
||||
! upper bound for |G|
|
||||
!
|
||||
!
|
||||
! ... first we count the number of k+G vectors inside the cut-off sphere
|
||||
!
|
||||
q2x = ( sqrt( k(1)**2 + k(2)**2 + k(3)**2 ) + sqrt( ecut ) )**2
|
||||
!
|
||||
ngk = 0
|
||||
!
|
||||
DO ng = 1, ngm
|
||||
!
|
||||
q = ( k(1) + g(1,ng) )**2 + ( k(2) + g(2,ng) )**2 + ( k(3) + g(3,ng) )**2
|
||||
!
|
||||
! ... here if |k+G|^2 <= Ecut
|
||||
!
|
||||
IF ( q <= ecut ) THEN
|
||||
!
|
||||
ngk = ngk + 1
|
||||
!
|
||||
! ... gk is a fake quantity giving the same ordering on all machines
|
||||
!
|
||||
IF ( ngk > npwx ) &
|
||||
CALL errore( 'gk_sort', 'array gk out-of-bounds', 1 )
|
||||
!
|
||||
IF ( q > eps8 ) THEN
|
||||
!
|
||||
gk(ngk) = q
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
gk(ngk) = 0.D0
|
||||
!
|
||||
ENDIF
|
||||
!
|
||||
! ... set the initial value of index array
|
||||
!
|
||||
igk(ngk) = ng
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
! ... if |G| > |k| + SQRT( Ecut ) stop search and order vectors
|
||||
!
|
||||
IF ( ( g(1,ng)**2 + g(2,ng)**2 + g(3,ng)**2 ) > ( q2x + eps8 ) ) exit
|
||||
!
|
||||
ENDIF
|
||||
!
|
||||
ENDDO
|
||||
!
|
||||
IF ( ng > ngm ) &
|
||||
CALL infomsg( 'gk_sort', 'unexpected exit from do-loop')
|
||||
!
|
||||
! ... order vector gk keeping initial position in index
|
||||
!
|
||||
CALL hpsort_eps( ngk, gk, igk, eps8 )
|
||||
!
|
||||
! ... now order true |k+G|
|
||||
!
|
||||
DO nk = 1, ngk
|
||||
!
|
||||
gk(nk) = ( k(1) + g(1,igk(nk) ) )**2 + &
|
||||
( k(2) + g(2,igk(nk) ) )**2 + &
|
||||
( k(3) + g(3,igk(nk) ) )**2
|
||||
!
|
||||
ENDDO
|
||||
!
|
||||
END SUBROUTINE gk_sort
|
||||
|
|
144
PW/realus.f90
144
PW/realus.f90
|
@ -51,13 +51,13 @@ MODULE realus
|
|||
!
|
||||
CONTAINS
|
||||
!
|
||||
!------------------------------------------------------------------------
|
||||
!------------------------------------------------------------------------
|
||||
SUBROUTINE read_rs_status( dirname, ierr )
|
||||
!------------------------------------------------------------------------
|
||||
!
|
||||
! This subroutine reads the real space control flags from a pwscf punch card
|
||||
! OBM 2009
|
||||
!
|
||||
!------------------------------------------------------------------------
|
||||
!
|
||||
! This subroutine reads the real space control flags from a pwscf punch card
|
||||
! OBM 2009
|
||||
!
|
||||
USE iotk_module
|
||||
USE io_global, ONLY : ionode,ionode_id
|
||||
USE io_files, ONLY : iunpun, xmlpun
|
||||
|
@ -106,9 +106,9 @@ MODULE realus
|
|||
END SUBROUTINE read_rs_status
|
||||
!----------------------------------------------------------------------------
|
||||
SUBROUTINE init_realspace_vars()
|
||||
!---------------------------------------------------------------------------
|
||||
!This subroutine should be called to allocate/reset real space related variables.
|
||||
!---------------------------------------------------------------------------
|
||||
!---------------------------------------------------------------------------
|
||||
!This subroutine should be called to allocate/reset real space related variables.
|
||||
!---------------------------------------------------------------------------
|
||||
USE wvfct, ONLY : npwx,npw, igk, g2kin
|
||||
USE klist, ONLY : nks,xk
|
||||
USE gvect, ONLY : ngm, g, ecutwfc
|
||||
|
@ -1712,10 +1712,10 @@ MODULE realus
|
|||
END SUBROUTINE calbec_rs_gamma
|
||||
!
|
||||
SUBROUTINE calbec_rs_k ( ibnd, m )
|
||||
!--------------------------------------------------------------------------
|
||||
! The k_point generalised version of calbec_rs_gamma. Basically same as above, but becp is used instead
|
||||
! of becp_r, skipping the gamma point reduction
|
||||
! derived from above by OBM 051108
|
||||
!--------------------------------------------------------------------------
|
||||
! The k_point generalised version of calbec_rs_gamma. Basically same as above, but becp is used instead
|
||||
! of becp_r, skipping the gamma point reduction
|
||||
! derived from above by OBM 051108
|
||||
USE kinds, ONLY : DP
|
||||
USE cell_base, ONLY : omega
|
||||
USE wavefunctions_module, ONLY : psic
|
||||
|
@ -1793,13 +1793,13 @@ MODULE realus
|
|||
END SUBROUTINE calbec_rs_k
|
||||
!--------------------------------------------------------------------------
|
||||
SUBROUTINE s_psir_gamma ( ibnd, m )
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! ... This routine applies the S matrix to m wavefunctions psi in real space (in psic),
|
||||
! ... and puts the results again in psic for backtransforming.
|
||||
! ... Requires becp%r (calbecr in REAL SPACE) and betasave (from betapointlist in realus)
|
||||
! Subroutine written by Dario Rocca, modified by O. Baris Malcioglu
|
||||
! WARNING ! for the sake of speed, no checks performed in this subroutine
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! ... This routine applies the S matrix to m wavefunctions psi in real space (in psic),
|
||||
! ... and puts the results again in psic for backtransforming.
|
||||
! ... Requires becp%r (calbecr in REAL SPACE) and betasave (from betapointlist in realus)
|
||||
! Subroutine written by Dario Rocca, modified by O. Baris Malcioglu
|
||||
! WARNING ! for the sake of speed, no checks performed in this subroutine
|
||||
|
||||
USE kinds, ONLY : DP
|
||||
USE cell_base, ONLY : omega
|
||||
|
@ -1821,7 +1821,7 @@ MODULE realus
|
|||
REAL(DP) :: fac
|
||||
REAL(DP), ALLOCATABLE, DIMENSION(:) :: w1, w2, bcr, bci
|
||||
!
|
||||
real(DP), EXTERNAL :: ddot
|
||||
REAL(DP), EXTERNAL :: ddot
|
||||
!
|
||||
|
||||
|
||||
|
@ -1923,7 +1923,7 @@ MODULE realus
|
|||
REAL(DP), ALLOCATABLE, DIMENSION(:) :: bcr, bci
|
||||
COMPLEX(DP) , ALLOCATABLE, DIMENSION(:) :: w1
|
||||
!
|
||||
real(DP), EXTERNAL :: ddot
|
||||
REAL(DP), EXTERNAL :: ddot
|
||||
!
|
||||
|
||||
|
||||
|
@ -2025,7 +2025,7 @@ MODULE realus
|
|||
REAL(DP) :: fac
|
||||
REAL(DP), ALLOCATABLE, DIMENSION(:) :: w1, w2, bcr, bci
|
||||
!
|
||||
real(DP), EXTERNAL :: ddot
|
||||
REAL(DP), EXTERNAL :: ddot
|
||||
!
|
||||
CALL start_clock( 'add_vuspsir' )
|
||||
|
||||
|
@ -2131,7 +2131,7 @@ MODULE realus
|
|||
!
|
||||
COMPLEX(DP), ALLOCATABLE, DIMENSION(:) :: w1
|
||||
!
|
||||
real(DP), EXTERNAL :: ddot
|
||||
REAL(DP), EXTERNAL :: ddot
|
||||
!
|
||||
CALL start_clock( 'add_vuspsir' )
|
||||
|
||||
|
@ -2193,22 +2193,22 @@ MODULE realus
|
|||
ENDDO
|
||||
!
|
||||
ENDDO
|
||||
ENDIF
|
||||
CALL stop_clock( 'add_vuspsir' )
|
||||
RETURN
|
||||
ENDIF
|
||||
CALL stop_clock( 'add_vuspsir' )
|
||||
RETURN
|
||||
!
|
||||
END SUBROUTINE add_vuspsir_k
|
||||
|
||||
!--------------------------------------------------------------------------
|
||||
SUBROUTINE fft_orbital_gamma (orbital, ibnd, nbnd, conserved)
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! OBM 241008
|
||||
! This driver subroutine transforms the given orbital using fft and puts the result in psic
|
||||
! Warning! In order to be fast, no checks on the supplied data are performed!
|
||||
! orbital: the orbital to be transformed
|
||||
! ibnd: band index
|
||||
! nbnd: total number of bands
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! OBM 241008
|
||||
! This driver subroutine transforms the given orbital using fft and puts the result in psic
|
||||
! Warning! In order to be fast, no checks on the supplied data are performed!
|
||||
! orbital: the orbital to be transformed
|
||||
! ibnd: band index
|
||||
! nbnd: total number of bands
|
||||
USE wavefunctions_module, ONLY : psic
|
||||
USE gsmooth, ONLY : nr1s,nr2s,nr3s,nrx1s,nrx2s,&
|
||||
nrx3s,nrxxs,nls,nlsm,doublegrid
|
||||
|
@ -2243,12 +2243,12 @@ MODULE realus
|
|||
INTEGER :: v_siz
|
||||
|
||||
|
||||
!The new task group version based on vloc_psi
|
||||
!print *, "->Real space"
|
||||
CALL start_clock( 'fft_orbital' )
|
||||
use_tg = ( use_task_groups ) .and. ( nbnd >= nogrp )
|
||||
!The new task group version based on vloc_psi
|
||||
!print *, "->Real space"
|
||||
CALL start_clock( 'fft_orbital' )
|
||||
use_tg = ( use_task_groups ) .and. ( nbnd >= nogrp )
|
||||
|
||||
IF( use_tg ) THEN
|
||||
IF( use_tg ) THEN
|
||||
!
|
||||
|
||||
tg_psic = (0.d0, 0.d0)
|
||||
|
@ -2283,7 +2283,7 @@ MODULE realus
|
|||
ENDIF
|
||||
ENDIF
|
||||
|
||||
ELSE !Task groups not used
|
||||
ELSE !Task groups not used
|
||||
!
|
||||
psic(:) = (0.d0, 0.d0)
|
||||
|
||||
|
@ -2326,7 +2326,7 @@ MODULE realus
|
|||
ENDIF
|
||||
ENDIF
|
||||
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
!if (.not. allocated(psic)) CALL errore( 'fft_orbital_gamma', 'psic not allocated', 2 )
|
||||
! OLD VERSION ! Based on an algorithm found somewhere in the TDDFT codes, generalised to k points
|
||||
|
@ -2353,21 +2353,21 @@ MODULE realus
|
|||
! call cft3s(psic,nr1s,nr2s,nr3s,nrx1s,nrx2s,nrx3s,2)
|
||||
CALL stop_clock( 'fft_orbital' )
|
||||
|
||||
END SUBROUTINE fft_orbital_gamma
|
||||
!
|
||||
!
|
||||
!--------------------------------------------------------------------------
|
||||
SUBROUTINE bfft_orbital_gamma (orbital, ibnd, nbnd,conserved)
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! OBM 241008
|
||||
! This driver subroutine -back- transforms the given orbital using fft using the already existent data
|
||||
! in psic. Warning! This subroutine does not reset the orbital, use carefully!
|
||||
! Warning 2! In order to be fast, no checks on the supplied data are performed!
|
||||
! Variables:
|
||||
! orbital: the orbital to be transformed
|
||||
! ibnd: band index
|
||||
! nbnd: total number of bands
|
||||
END SUBROUTINE fft_orbital_gamma
|
||||
!
|
||||
!
|
||||
!--------------------------------------------------------------------------
|
||||
SUBROUTINE bfft_orbital_gamma (orbital, ibnd, nbnd,conserved)
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! OBM 241008
|
||||
! This driver subroutine -back- transforms the given orbital using fft using the already existent data
|
||||
! in psic. Warning! This subroutine does not reset the orbital, use carefully!
|
||||
! Warning 2! In order to be fast, no checks on the supplied data are performed!
|
||||
! Variables:
|
||||
! orbital: the orbital to be transformed
|
||||
! ibnd: band index
|
||||
! nbnd: total number of bands
|
||||
USE wavefunctions_module, ONLY : psic
|
||||
USE gsmooth, ONLY : nr1s,nr2s,nr3s,nrx1s,nrx2s,&
|
||||
nrx3s,nrxxs,nls,nlsm,doublegrid
|
||||
|
@ -2402,7 +2402,7 @@ MODULE realus
|
|||
!New task_groups versions
|
||||
use_tg = ( use_task_groups ) .and. ( nbnd >= nogrp )
|
||||
IF( use_tg ) THEN
|
||||
CALL tg_cft3s ( tg_psic, dffts, -2, use_tg )
|
||||
CALL tg_cft3s ( tg_psic, dffts, -2, use_tg )
|
||||
!
|
||||
ioff = 0
|
||||
!
|
||||
|
@ -2432,11 +2432,11 @@ MODULE realus
|
|||
ENDIF
|
||||
|
||||
ELSE !Non task_groups version
|
||||
!larger memory slightly faster
|
||||
CALL cft3s(psic,nr1s,nr2s,nr3s,nrx1s,nrx2s,nrx3s,-2)
|
||||
!larger memory slightly faster
|
||||
CALL cft3s(psic,nr1s,nr2s,nr3s,nrx1s,nrx2s,nrx3s,-2)
|
||||
|
||||
|
||||
IF (ibnd < nbnd) THEN
|
||||
IF (ibnd < nbnd) THEN
|
||||
|
||||
! two ffts at the same time
|
||||
DO j = 1, npw_k(1)
|
||||
|
@ -2491,18 +2491,18 @@ MODULE realus
|
|||
!
|
||||
CALL stop_clock( 'bfft_orbital' )
|
||||
|
||||
END SUBROUTINE bfft_orbital_gamma
|
||||
!
|
||||
END SUBROUTINE bfft_orbital_gamma
|
||||
!
|
||||
!--------------------------------------------------------------------------
|
||||
SUBROUTINE fft_orbital_k (orbital, ibnd, nbnd,conserved)
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! OBM 110908
|
||||
! This subroutine transforms the given orbital using fft and puts the result in psic
|
||||
! Warning! In order to be fast, no checks on the supplied data are performed!
|
||||
! orbital: the orbital to be transformed
|
||||
! ibnd: band index
|
||||
! nbnd: total number of bands
|
||||
!--------------------------------------------------------------------------
|
||||
!
|
||||
! OBM 110908
|
||||
! This subroutine transforms the given orbital using fft and puts the result in psic
|
||||
! Warning! In order to be fast, no checks on the supplied data are performed!
|
||||
! orbital: the orbital to be transformed
|
||||
! ibnd: band index
|
||||
! nbnd: total number of bands
|
||||
USE wavefunctions_module, ONLY : psic
|
||||
USE gsmooth, ONLY : nr1s,nr2s,nr3s,nrx1s,nrx2s,&
|
||||
nrx3s,nrxxs,nls,nlsm,doublegrid
|
||||
|
@ -2753,7 +2753,7 @@ MODULE realus
|
|||
|
||||
IF (.not.okvan) RETURN
|
||||
IF( .not.gamma_only) THEN
|
||||
WRITE(stdout,*) ' adduspos_gamma_r is a gamma only routine'
|
||||
WRITE(stdout,*) ' adduspos_gamma_r is a gamma ONLY routine'
|
||||
STOP
|
||||
ENDIF
|
||||
|
||||
|
|
Loading…
Reference in New Issue