Interpolation table in G space

Currently the interpolation table for USPP Q functions computes q_i=Q(|G_i|) on
a grid of equally spaced |G_i| ***in units of 2\pi/a0***. As a consequence, the
number of points of the grid for a given cutoff depends upon the size of the
cell (noticed by Anton Kozhevnikov). This does not make sense: the Q functions
are atomic-like quantities and the maximum |G| depends upon the cutoff.
I moved the interpolation table from 2\pi/a0 units to atomic units, as it is
done everywhere else in QE. I am less and less convinced that storing k-points
and G-vectors in 2\pi/a0 units is a good idea, by the way.

BEWARE: this patch changes the behavior of routines init_us_1 and qvan2,
has the potential to break external codes that use QE routines.
This commit is contained in:
Paolo Giannozzi 2020-03-12 22:05:47 +01:00
parent 48cfa16bad
commit 21fe34060c
24 changed files with 69 additions and 59 deletions

View File

@ -725,7 +725,7 @@
CALL ylmr2(lmaxq * lmaxq, ngm, g, gg, ylmk0)
!
DO ig = 1, ngm
qmodg(ig) = DSQRT(gg(ig))
qmodg(ig) = DSQRT(gg(ig))*tpiba
ENDDO
!
ALLOCATE(qpg(3, ngm), STAT = ierr)
@ -738,7 +738,7 @@
DEALLOCATE(qpg, STAT = ierr)
IF (ierr /= 0) CALL errore('dvanqq2', 'Error deallocating qpg', 1)
DO ig = 1, ngm
qmod(ig) = DSQRT(qmod(ig))
qmod(ig) = DSQRT(qmod(ig))*tpiba
ENDDO
!
! we start by computing the FT of the effective potential
@ -942,7 +942,7 @@
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ityp, ntyp => nsp
USE noncollin_module, ONLY : noncolin, nspin_mag
USE cell_base, ONLY : omega
USE cell_base, ONLY : omega, tpiba
USE fft_base, ONLY : dfftp
USE fft_interfaces, ONLY : fwfft
USE gvect, ONLY : g, ngm, mill, eigts1, eigts2, eigts3
@ -1032,7 +1032,7 @@
CALL ylmr2(lmaxq * lmaxq, ngm, qg, qmod, ylmk0)
!
DO ig = 1, ngm
qmod(ig) = DSQRT(qmod(ig))
qmod(ig) = DSQRT(qmod(ig))*tpiba
ENDDO
!
! and for each perturbation of this irreducible representation

View File

@ -321,6 +321,7 @@ subroutine addus_charge(r_ij,becp_iw,becp_jw)
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ntyp => nsp, ityp
USE cell_base, ONLY : tpiba
USE gvect, ONLY : ngm, gg, g, eigts1, eigts2, &
eigts3, mill
USE lsda_mod, ONLY : nspin
@ -370,7 +371,7 @@ subroutine addus_charge(r_ij,becp_iw,becp_jw)
aux (:,:) = (0.d0, 0.d0)
call ylmr2 (lmaxq * lmaxq, ngm, g, gg, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (gg (ig) )
qmod (ig) = sqrt (gg (ig) ) * tpiba
enddo
!found index correspondence

View File

@ -15,6 +15,7 @@ subroutine addusldos (ldos, becsum1)
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ityp, ntyp => nsp
USE cell_base, ONLY : tpiba
USE fft_base, ONLY : dfftp
USE fft_interfaces, ONLY : invfft
USE gvect, ONLY : eigts1, eigts2, eigts3, mill, gg, g, ngm
@ -54,7 +55,7 @@ subroutine addusldos (ldos, becsum1)
aux (:,:) = (0.d0,0.d0)
call ylmr2 (lmaxq * lmaxq, ngm, g, gg, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (gg (ig) )
qmod (ig) = sqrt (gg (ig) ) * tpiba
enddo
do nt = 1, ntyp
if (upf(nt)%tvanp ) then

View File

@ -19,6 +19,7 @@ SUBROUTINE lr_addusddens (drhoscf, dbecsum)
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ityp, tau, ntyp => nsp
USE cell_base, ONLY : tpiba
USE fft_base, ONLY : dfftp
USE fft_interfaces, ONLY : invfft
USE gvect, ONLY : gg, ngm, g, eigts1, eigts2, eigts3, mill
@ -77,7 +78,7 @@ SUBROUTINE lr_addusddens (drhoscf, dbecsum)
CALL ylmr2 (lmaxq * lmaxq, ngm, qpg, qmod, ylmk0)
!
DO ig = 1, ngm
qmod(ig) = sqrt(qmod(ig))
qmod(ig) = sqrt(qmod(ig)) * tpiba
ENDDO
!
DO nt = 1, ntyp

View File

@ -17,6 +17,7 @@ subroutine newdq (dvscf, npe)
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ityp, ntyp => nsp
USE cell_base, ONLY : tpiba
USE noncollin_module, ONLY : noncolin, nspin_mag
USE cell_base, ONLY : omega
USE fft_base, ONLY : dfftp
@ -77,12 +78,12 @@ subroutine newdq (dvscf, npe)
call setqmod (ngm, xq, g, qmod, qg)
call ylmr2 (lmaxq * lmaxq, ngm, qg, qmod, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (qmod (ig) )
qmod (ig) = sqrt (qmod (ig) ) * tpiba
enddo
else
call ylmr2 (lmaxq * lmaxq, ngm, g, gg, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (gg (ig) )
qmod (ig) = sqrt (gg (ig) ) * tpiba
enddo
endif
!

View File

@ -25,7 +25,7 @@ SUBROUTINE setup_nscf ( newgrid, xq, elph_mat )
USE kinds, ONLY : DP
USE parameters, ONLY : npk
USE constants, ONLY : pi, degspin
USE cell_base, ONLY : at, bg
USE cell_base, ONLY : at, bg, tpiba
USE ions_base, ONLY : nat, tau, ityp, zv
USE force_mod, ONLY : force
USE basis, ONLY : natomwfc
@ -186,7 +186,7 @@ SUBROUTINE setup_nscf ( newgrid, xq, elph_mat )
! ...notice: qnorm is used by allocate_nlpot to determine
! the correct size of the interpolation table "qrad"
!
qnorm = sqrt(xq(1)**2 + xq(2)**2 + xq(3)**2)
qnorm = sqrt(xq(1)**2 + xq(2)**2 + xq(3)**2) * tpiba
!
! ... distribute k-points (and their weights and spin indices)
!

View File

@ -106,12 +106,12 @@ subroutine addusddens (drhoscf, dbecsum, mode0, npe, iflag)
call setqmod (ngm, xq, g, qmod, qpg)
call ylmr2 (lmaxq * lmaxq, ngm, qpg, qmod, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (qmod (ig) )
qmod (ig) = sqrt (qmod (ig) ) * tpiba
enddo
else
call ylmr2 (lmaxq * lmaxq, ngm, g, gg, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (gg (ig) )
qmod (ig) = sqrt (gg (ig) ) * tpiba
enddo
endif
fact = cmplx (0.d0, - tpiba, kind=DP)

View File

@ -21,6 +21,7 @@ subroutine addusddense (drhoscf, dbecsum)
USE kinds, only : DP
USE ions_base, ONLY : nat, ityp, ntyp => nsp
USE cell_base, ONLY : tpiba
use fft_base, only: dfftp
use fft_interfaces, only: invfft
USE gvect, ONLY : g, gg, ngm, eigts1, eigts2, eigts3, mill
@ -73,7 +74,7 @@ subroutine addusddense (drhoscf, dbecsum)
!
call ylmr2 (lmaxq * lmaxq, ngm, g, gg, ylmk0)
do ig = 1, ngm
qmod (ig) = sqrt (gg (ig) )
qmod (ig) = sqrt (gg (ig) ) * tpiba
enddo
aux (:,:,:) = (0.d0, 0.d0)

View File

@ -99,7 +99,7 @@ subroutine dvanqq
!
call ylmr2 (lmaxq * lmaxq, ngm, g, gg, ylmk0)
do ig = 1, ngm
qmodg (ig) = sqrt (gg (ig) )
qmodg (ig) = sqrt (gg (ig) ) * tpiba
enddo
if (.not.lgamma) then
allocate (qpg (3, ngm))
@ -107,7 +107,7 @@ subroutine dvanqq
call ylmr2 (lmaxq * lmaxq, ngm, qpg, qmod, ylmkq)
deallocate (qpg)
do ig = 1, ngm
qmod (ig) = sqrt (qmod (ig) )
qmod (ig) = sqrt (qmod (ig) ) * tpiba
enddo
endif
!

View File

@ -22,7 +22,7 @@ SUBROUTINE run_nscf(do_band, iq)
USE fft_base, ONLY : dffts, dfftp
!!!
USE fft_types, ONLY: fft_type_allocate
USE cell_base, ONLY: at, bg
USE cell_base, ONLY: at, bg, tpiba
USE gvect, ONLY: gcutm
USE gvecs, ONLY: gcutms
!!!
@ -71,7 +71,7 @@ SUBROUTINE run_nscf(do_band, iq)
kunit = 4
IF (lgamma_iq(iq)) kunit=2
ENDIF
qnorm = SQRT(xq(1)**2+xq(2)**2+xq(3)**2)
qnorm = SQRT(xq(1)**2+xq(2)**2+xq(3)**2) * tpiba
!
CALL read_file()
IF (.NOT.lgamma_iq(iq).OR.(qplot.AND.iq>1)) CALL &

View File

@ -16,7 +16,7 @@ SUBROUTINE addusdens1d (plan, prho)
! of the charge density.
!
USE kinds, ONLY: DP
USE cell_base, ONLY: alat, omega, celldm
USE cell_base, ONLY: alat, omega, celldm, tpiba
USE ions_base, ONLY: nat, ntyp => nsp, ityp
USE fft_base, ONLY: dfftp
USE fft_scalar,ONLY: cft_1z
@ -62,7 +62,7 @@ SUBROUTINE addusdens1d (plan, prho)
CALL ggen1d (ngm1d, g1d, gg1d, ig1dto3d, nl1d, igtongl1d)
ALLOCATE (qgm(ngm1d), aux(ngm1d))
DO ig = 1, ngm1d
qmod (ig) = sqrt (gg1d (ig) )
qmod (ig) = sqrt (gg1d (ig) ) * tpiba
ENDDO
aux(:) = (0.d0, 0.d0)

View File

@ -40,6 +40,7 @@ SUBROUTINE addusdens_g( rho )
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ntyp => nsp, ityp
USE cell_base, ONLY : tpiba
USE fft_base, ONLY : dfftp
USE fft_interfaces, ONLY : invfft
USE gvect, ONLY : ngm, gg, g, &
@ -92,7 +93,7 @@ SUBROUTINE addusdens_g( rho )
!
CALL ylmr2( lmaxq*lmaxq, ngm_l, g(1,ngm_s), gg(ngm_s), ylmk0 )
DO ig = 1, ngm_l
qmod(ig) = SQRT(gg(ngm_s+ig-1))
qmod(ig) = SQRT(gg(ngm_s+ig-1))*tpiba
ENDDO
!
DO nt = 1, ntyp

View File

@ -112,7 +112,7 @@ SUBROUTINE addusforce_g( forcenl )
!
ALLOCATE( qmod(ngm_l) )
DO ig = 1, ngm_l
qmod(ig) = SQRT( gg(ngm_s+ig-1) )
qmod(ig) = SQRT( gg(ngm_s+ig-1) )*tpiba
ENDDO
!
DO nt = 1, ntyp

View File

@ -124,7 +124,7 @@ SUBROUTINE addusstress_g( sigmanlc )
CALL ylmr2( lmaxq * lmaxq, ngm_l, g(1,ngm_s), gg(ngm_s), ylmk0 )
!
DO ig = 1, ngm_l
qmod(ig) = SQRT( gg(ngm_s+ig-1) )
qmod(ig) = SQRT( gg(ngm_s+ig-1) ) * tpiba
ENDDO
!
! here we compute the integral Q*V for each atom,
@ -141,8 +141,8 @@ SUBROUTINE addusstress_g( sigmanlc )
DO ih = 1, nh(nt)
DO jh = ih, nh(nt)
ijh = ijh + 1
CALL dqvan2( ih, jh, nt, ipol, ngm_l, g(1,ngm_s), qmod, &
ylmk0, dylmk0, qgm(1,ijh) )
CALL dqvan2( ih, jh, nt, ipol, ngm_l, g(1,ngm_s), tpiba, &
qmod, ylmk0, dylmk0, qgm(1,ijh) )
ENDDO
ENDDO
!
@ -165,7 +165,7 @@ SUBROUTINE addusstress_g( sigmanlc )
DO ig = 1, ngm_l
cfac = CONJG( eigts1(mill (1,ngm_s+ig-1), na) * &
eigts2(mill (2,ngm_s+ig-1), na) * &
eigts3(mill (3,ngm_s+ig-1), na) )
eigts3(mill (3,ngm_s+ig-1), na) ) * tpiba
aux1(ig,1) = cfac * g(1,ngm_s+ig-1)
aux1(ig,2) = cfac * g(2,ngm_s+ig-1)
aux1(ig,3) = cfac * g(3,ngm_s+ig-1)

View File

@ -15,7 +15,7 @@ SUBROUTINE allocate_nlpot
!! Requires in input:
!! * dimensions: nhm, nsp, nat, lmaxkb, nbetam, nspin
!! * pseudopot info: upf%nwfc
!! * parameters: gcutm, qnorm, dq, ecutwfc, cell_factor
!! * parameters: ecutrho, qnorm, dq, ecutwfc, cell_factor
!! * options: tqr, noncolin, lspinorb, spline_ps
!
!! Computes the following global quantities:
@ -28,7 +28,7 @@ SUBROUTINE allocate_nlpot
USE klist, ONLY : qnorm
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : noncolin
USE gvect, ONLY : gcutm
USE gvect, ONLY : ecutrho
USE gvecw, ONLY : ecutwfc
USE us, ONLY : qrad, tab, tab_d2y, tab_at, dq, nqx, &
nqxq, spline_ps
@ -73,7 +73,7 @@ SUBROUTINE allocate_nlpot
! This routine is called also by the phonon code, in which case it should
! allocate an array that includes q+G vectors up to |q+G|_max <= |Gmax|+|q|
!
nqxq = INT( ( (SQRT(gcutm) + qnorm) / dq + 4) * cell_factor )
nqxq = INT( ( (SQRT(ecutrho) + qnorm) / dq + 4) * cell_factor )
lmaxq = 2*lmaxkb+1
!
IF (lmaxq > 0) ALLOCATE (qrad( nqxq, nbetam*(nbetam+1)/2, lmaxq, nsp))

View File

@ -6,7 +6,8 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
!-----------------------------------------------------------------------
SUBROUTINE dqvan2( ih, jh, np, ipol, ngy, g, qmod, ylmk0, dylmk0, dqg )
SUBROUTINE dqvan2( ih, jh, np, ipol, ngy, g, tpiba, qmod, ylmk0, dylmk0,&
dqg )
!-----------------------------------------------------------------------
!! This routine computes the derivatives of the Fourier transform of
!! the Q function needed in stress assuming that the radial fourier
@ -35,6 +36,8 @@ SUBROUTINE dqvan2( ih, jh, np, ipol, ngy, g, qmod, ylmk0, dylmk0, dqg )
!! the polarization of the derivative
REAL(DP), INTENT(IN) :: g(3,ngy)
!! G vectors
REAL(DP), INTENT(IN) :: tpiba
!! 2pi/a factor, multiplies G vectors
REAL(DP), INTENT(IN) :: qmod(ngy)
!! moduli of q+G vectors
REAL(DP), INTENT(IN) :: ylmk0(ngy,lmaxq*lmaxq)
@ -157,9 +160,9 @@ SUBROUTINE dqvan2( ih, jh, np, ipol, ngy, g, qmod, ylmk0, dylmk0, dqg )
ENDIF
#endif
dqg(ig) = dqg(ig) + sig * dylmk0(ig, lp) * work
dqg(ig) = dqg(ig) + sig * dylmk0(ig, lp) * work / tpiba
IF (qmod(ig) > 1.d-9) dqg(ig) = dqg(ig) + &
sig * ylmk0(ig, lp) * work1 * g(ipol, ig) / qmod(ig)
sig * ylmk0(ig, lp) * work1 * tpiba * g(ipol, ig) / qmod(ig)
ENDDO
!$OMP END PARALLEL DO
!

View File

@ -162,7 +162,7 @@ MODULE exx_base
!!
!
USE symm_base, ONLY : nsym, s
USE cell_base, ONLY : bg, at
USE cell_base, ONLY : bg, at, tpiba
USE spin_orb, ONLY : domag
USE noncollin_module, ONLY : nspin_lsda
USE klist, ONLY : xk, wk, nkstot, nks, qnorm
@ -405,6 +405,7 @@ MODULE exx_base
qnorm = MAX(qnorm, SQRT( SUM((xk(:,ik)-xkq_collect(:,iq))**2) ))
ENDDO
ENDDO
qnorm = qnorm * tpiba
!
CALL stop_clock( 'exx_grid' )
!

View File

@ -114,7 +114,7 @@ SUBROUTINE init_us_0
CALL divide( intra_bgrp_comm, nqxq, startq, lastq )
!
qmax = SQRT(ecutrho)
WRITE (stdout, *) ' qmax : sqrt(ecutrho) =', SQRT(ecutrho), dq*nqxq*tpiba, tpiba
WRITE (stdout, *) ' qmax : sqrt(ecutrho) =', SQRT(ecutrho), dq*nqxq
WRITE (stdout,'(a,f6.2,a,i4,4(a,f11.8))') 'FILTER : a=',a,', nn=',nn, &
', filter(1.1d0)=', filter(1.1d0,a,nn), &
', filter(1.0d0)=', filter(1.0d0,a,nn), &
@ -183,7 +183,7 @@ SUBROUTINE init_us_0
!
DO iq = startq, lastq
!
q = (iq - 1) * dq * tpiba
q = (iq - 1) * dq
!
! ... here we compute the spherical bessel function for the given |q|
!
@ -210,7 +210,7 @@ SUBROUTINE init_us_0
!
! ... and update the integrated power spectrum in reciprocal space
!
power_q(ijv,l+1) = power_q(ijv,l+1) + q*q * dq * tpiba * qrad_q(iq,ijv,l+1)**2
power_q(ijv,l+1) = power_q(ijv,l+1) + q*q * dq * qrad_q(iq,ijv,l+1)**2
!
ENDIF
!
@ -224,7 +224,7 @@ SUBROUTINE init_us_0
! ... q_nb_mb_l(r) from the back fourier transform up to qmax of q_nb_mb_l(q)
!
qrad_r(ir,1:nbetam*(nbetam+1)/2,l+1) = qrad_r(ir,1:nbetam*(nbetam+1)/2,l+1) + &
q*q * dq*tpiba * aux(ir) * rgrid(nt)%r(ir)**2 * &
q*q * dq * aux(ir) * rgrid(nt)%r(ir)**2 * &
qrad_q(iq,1:nbetam*(nbetam+1)/2,l+1)
ENDDO
!
@ -314,8 +314,8 @@ SUBROUTINE init_us_0
!
IF ( (l >= ABS(lnb-lmb)) .AND. (l <= lnb+lmb) .AND. (MOD(l+lnb+lmb,2)==0) ) THEN
DO iq = startq, lastq
q = (iq - 1) * dq * tpiba
power_qs(ijv,l+1) = power_qs(ijv,l+1) + q*q * dq * tpiba * &
q = (iq - 1) * dq
power_qs(ijv,l+1) = power_qs(ijv,l+1) + q*q * dq * &
(qrad_q(iq,ijv,l+1)*filter(fac*q/qmax,a,nn))**2
ENDDO
ENDIF
@ -350,7 +350,7 @@ SUBROUTINE init_us_0
!
DO iq = startq, lastq
!
q = (iq - 1) * dq * tpiba
q = (iq - 1) * dq
!
! ... here we compute the spherical bessel function for the given |q| ...
!
@ -365,13 +365,13 @@ SUBROUTINE init_us_0
! ... q_nb_mb_l(r) from the back fourier transform up to qmax of q_nb_mb_l(q)
!
qrad_rs(ir,1:nbetam*(nbetam+1)/2,l+1) = qrad_rs(ir,1:nbetam*(nbetam+1)/2,l+1) &
+ aux(ir) * q*q * dq*tpiba * rgrid(nt)%r(ir)**2 &
+ aux(ir) * q*q * dq * rgrid(nt)%r(ir)**2 &
* qrad_q(iq,1:nbetam*(nbetam+1)/2,l+1) * filter(fac*q/qmax,a,nn)
!
! ... build the filter function in real space from the back fourier transform up
! to qmax
!
IF (l==0) ffrr(ir) = ffrr(ir) + q*q * dq*tpiba * aux(ir) * rgrid(nt)%r(ir)**2 &
IF (l==0) ffrr(ir) = ffrr(ir) + q*q * dq * aux(ir) * rgrid(nt)%r(ir)**2 &
* filter(fac*q/qmax,a,nn)
!
ENDDO
@ -471,7 +471,7 @@ SUBROUTINE init_us_0
WRITE (4, *) '# filter function : a=',a,', nn=',nn,', fac=', fac
WRITE (4, *) '# nqxq :', nqxq,' dq :',dq, ' qmax :',qmax
DO iq = 1, nqxq
q = (iq-1)*dq*tpiba
q = (iq-1)*dq
WRITE (4,'(2f16.10)') q, filter( fac*q/qmax, a, nn )
ENDDO
CLOSE (4)
@ -499,7 +499,7 @@ SUBROUTINE init_us_0
WRITE (4,*) '# the radial fourier transform of q_l in reciprcal space'
WRITE (4,*) '# nb :', nb, lnb,' mb :', mb, lmb,' lmax :', lnb+lmb, ' nqxq :', nqxq
DO iq=1,nqxq
q = (iq-1)*dq*tpiba
q = (iq-1)*dq
WRITE (4,'(12f16.10)') q, (qrad_q(iq,ijv,l+1), l=0,lnb+lmb )
ENDDO
CLOSE (4)
@ -509,7 +509,7 @@ SUBROUTINE init_us_0
WRITE (4,*) '# the smoothed radial fourier transform of q_l in reciprcal space'
WRITE (4,*) '# nb :', nb,lnb,' mb :',mb,lmb,' lmax :',lnb+lmb, ' nqxq :',nqxq
DO iq = 1, nqxq
q = (iq-1)*dq*tpiba
q = (iq-1)*dq
WRITE (4,'(12f16.10)') q,(qrad_q(iq,ijv,l+1)*filter(fac*q/qmax,a,nn), l=0,lnb+lmb )
ENDDO
CLOSE (4)

View File

@ -249,7 +249,7 @@ subroutine init_us_1
!
! here for the US types we compute the Fourier transform of the
! Q functions.
!
!
call divide (intra_bgrp_comm, nqxq, startq, lastq)
!
do nt = 1, ntyp
@ -276,7 +276,7 @@ subroutine init_us_1
! here we compute the spherical bessel function for each |g|
!
do iq = startq, lastq
q = (iq - 1) * dq * tpiba
q = (iq - 1) * dq
call sph_bes ( upf(nt)%kkbeta, rgrid(nt)%r, q, l, aux)
!
! and then we integrate with all the Q functions
@ -307,11 +307,12 @@ subroutine init_us_1
endif
! ntyp
enddo
deallocate (aux)
deallocate (aux1)
deallocate (qtot)
!
! and finally we compute the qq coefficients by integrating the Q.
! q are the g=0 components of Q.
! q are the g=0 components of Q
!
#if defined(__MPI)
if (gg (1) > 1.0d-8) goto 100
@ -373,7 +374,6 @@ subroutine init_us_1
end do
deallocate (ylmk0)
deallocate (aux)
!
! fill the interpolation table tab
!

View File

@ -34,7 +34,7 @@ SUBROUTINE memory_report()
USE exx, ONLY : ecutfock, use_ace
USE exx_base, ONLY : nkqs
USE fft_base, ONLY : dffts, dfftp
USE gvect, ONLY : ngm, ngl, ngm_g, g, gcutm
USE gvect, ONLY : ngm, ngl, ngm_g, g, ecutrho
USE gvecs, ONLY : ngms, doublegrid
USE gvecw, ONLY : ecutwfc, gcutw
USE klist, ONLY : nks, nkstot, xk, qnorm
@ -167,7 +167,7 @@ SUBROUTINE memory_report()
lmaxq = 2*lmaxkb+1
IF (lmaxq > 0) THEN
! not accurate if spline_ps .and. cell_factor <= 1.1d0
nqxq = int( ( (sqrt(gcutm) + qnorm) / dq + 4) * cell_factor )
nqxq = int( ( (sqrt(ecutrho) + qnorm) / dq + 4) * cell_factor )
! allocate_nlpot.f90:87 qrad
add = real_size * nqxq * nbetam*(nbetam+1)/2 * lmaxq * ntyp
IF ( iverbosity > 0 ) WRITE( stdout, 1013 ) 'qrad', add/MB

View File

@ -18,7 +18,7 @@ SUBROUTINE newq( vr, deeq, skip_vltot )
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ntyp => nsp, ityp
USE cell_base, ONLY : omega
USE cell_base, ONLY : omega, tpiba
USE fft_base, ONLY : dfftp
USE fft_interfaces, ONLY : fwfft
USE gvect, ONLY : g, gg, ngm, gstart, mill, &
@ -77,7 +77,7 @@ SUBROUTINE newq( vr, deeq, skip_vltot )
!
CALL ylmr2( lmaxq*lmaxq, ngm_l, g(1,ngm_s), gg(ngm_s), ylmk0 )
DO ig = 1, ngm_l
qmod(ig) = SQRT(gg(ngm_s+ig-1))
qmod(ig) = SQRT(gg(ngm_s+ig-1))*tpiba
ENDDO
ENDIF
!

View File

@ -15,7 +15,7 @@ SUBROUTINE scale_h
!
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE cell_base, ONLY : bg, omega, set_h_ainv
USE cell_base, ONLY : bg, omega, set_h_ainv, tpiba
USE cellmd, ONLY : at_old, omega_old
USE constants, ONLY : eps8
USE gvect, ONLY : g, gg, ngm
@ -71,7 +71,7 @@ SUBROUTINE scale_h
!
CALL mp_max( gg_max, intra_bgrp_comm )
!
IF (nqxq < INT(SQRT(gg_max)/dq)+4) THEN
IF (nqxq < INT(SQRT(gg_max)*tpiba/dq)+4) THEN
CALL errore( 'scale_h', 'Not enough space allocated for radial FFT: '//&
'try restarting with a larger cell_factor.', 1 )
ENDIF

View File

@ -89,6 +89,7 @@ MODULE us_exx
!-----------------------------------------------------------------------
!! Allocate and store augmentation charges in G space Q(G) for USPP.
!
USE cell_base, ONLY : tpiba
USE ions_base, ONLY : ntyp => nsp
USE uspp_param, ONLY : upf, nh, lmaxq
USE gvect, ONLY : g
@ -124,7 +125,7 @@ MODULE us_exx
DO ig = 1, ngms
q(:,ig) = xk(:) - xkq(:) + g(:,ig)
qq(ig) = SUM(q(:,ig)**2)
qmod(ig)= SQRT(qq(ig))
qmod(ig)= SQRT(qq(ig))*tpiba
ENDDO
CALL ylmr2( lmaxq*lmaxq, ngms, q, qq, ylmk0 )
DEALLOCATE( qq, q )
@ -178,7 +179,6 @@ MODULE us_exx
USE uspp, ONLY : nkb, vkb, okvan, indv_ijkb0, ijtoh
USE uspp_param, ONLY : upf, nh, nhm, lmaxq
USE gvect, ONLY : g, eigts1, eigts2, eigts3, mill, gstart
USE cell_base, ONLY : tpiba
USE control_flags, ONLY : gamma_only
USE fft_types, ONLY : fft_type_descriptor
!
@ -363,7 +363,7 @@ MODULE us_exx
USE uspp, ONLY : nkb, vkb, okvan, indv_ijkb0, ijtoh
USE uspp_param, ONLY : upf, nh, nhm, lmaxq
USE gvect, ONLY : gg, g, gstart, eigts1, eigts2, eigts3, mill
USE cell_base, ONLY : tpiba, omega
USE cell_base, ONLY : omega
USE control_flags, ONLY : gamma_only
USE fft_types, ONLY : fft_type_descriptor
!

View File

@ -142,7 +142,7 @@ SUBROUTINE lr_setup_nscf ()
! ...notice: qnorm is used by allocate_nlpot to determine
! the correct size of the interpolation table "qrad"
!
qnorm = sqrt(xq(1)**2 + xq(2)**2 + xq(3)**2)
qnorm = sqrt(xq(1)**2 + xq(2)**2 + xq(3)**2) * tpiba
!
! ... set the granularity for k-point distribution
!