Commit 5aab54b1 authored by dalcorso's avatar dalcorso

Completed the substitution nrxx -> dfftp%nnr , nrxxs -> dffts%nnr in the

phonon code.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7372 c92efa57-630b-4861-b058-cf58834340f0
parent 792f15fb
......@@ -207,22 +207,19 @@ read_xml_fields.o : input_parameters.o
read_xml_fields.o : io_global.o
read_xml_fields.o : kind.o
recvec.o : kind.o
recvec.o : mp.o
recvec.o : mp_global.o
set_signal.o : io_global.o
set_signal.o : mp_global.o
sic.o : io_global.o
sic.o : kind.o
splinelib.o : kind.o
stick_base.o : control_flags.o
stick_base.o : fft_types.o
stick_base.o : griddim.o
stick_base.o : io_global.o
stick_base.o : kind.o
stick_base.o : mp.o
stick_base.o : mp_global.o
stick_set.o : control_flags.o
stick_set.o : fft_types.o
stick_set.o : io_global.o
stick_set.o : kind.o
stick_set.o : mp_global.o
task_groups.o : fft_types.o
task_groups.o : io_global.o
task_groups.o : kind.o
......
......@@ -17,7 +17,8 @@ subroutine addnlcc (imode0, drhoscf, npe)
USE cell_base, ONLY : omega, alat
use scf, only : rho, rho_core
USE gvect, ONLY : g, ngm, nl
USE grid_dimensions, ONLY : nrxx, nr1, nr2, nr3
USE fft_base, ONLY : dfftp
USE grid_dimensions, ONLY : nr1, nr2, nr3
USE noncollin_module, ONLY : nspin_lsda, nspin_gga, nspin_mag
USE dynmat, ONLY : dyn, dyn_rec
USE modes, ONLY : nirr, npert
......@@ -36,7 +37,7 @@ subroutine addnlcc (imode0, drhoscf, npe)
! input: the number of perturbations
! input: the change of density due to perturbation
complex(DP) :: drhoscf (nrxx, nspin_mag, npe)
complex(DP) :: drhoscf (dfftp%nnr, nspin_mag, npe)
integer :: nrtot, ipert, jpert, is, is1, irr, ir, mode, mode1
! the total number of points
......@@ -60,8 +61,8 @@ subroutine addnlcc (imode0, drhoscf, npe)
if (.not.nlcc_any) return
allocate (drhoc( nrxx))
allocate (dvaux( nrxx , nspin_mag))
allocate (drhoc( dfftp%nnr))
allocate (dvaux( dfftp%nnr, nspin_mag))
dyn1 (:,:) = (0.d0, 0.d0)
!
......@@ -83,11 +84,11 @@ subroutine addnlcc (imode0, drhoscf, npe)
dvaux (:,:) = (0.d0, 0.d0)
call addcore (mode, drhoc)
do is = 1, nspin_lsda
call daxpy (2 * nrxx, fac, drhoc, 1, drhoscf (1, is, ipert), 1)
call daxpy (2 * dfftp%nnr, fac, drhoc, 1, drhoscf (1, is, ipert), 1)
enddo
do is = 1, nspin_lsda
do is1 = 1, nspin_mag
do ir = 1, nrxx
do ir = 1, dfftp%nnr
dvaux (ir, is) = dvaux (ir, is) + dmuxc (ir, is, is1) * &
drhoscf ( ir, is1, ipert)
enddo
......@@ -99,10 +100,10 @@ subroutine addnlcc (imode0, drhoscf, npe)
!
if ( dft_is_gradient() ) &
call dgradcorr (rho%of_r, grho, dvxc_rr, dvxc_sr, dvxc_ss, dvxc_s, xq, &
drhoscf (1, 1, ipert), nrxx, nspin_mag, nspin_gga, nl, ngm, g, alat,&
drhoscf (1, 1, ipert), dfftp%nnr, nspin_mag, nspin_gga, nl, ngm, g, alat,&
dvaux)
do is = 1, nspin_lsda
call daxpy (2 * nrxx, - fac, drhoc, 1, drhoscf (1, is, ipert), 1)
call daxpy (2 * dfftp%nnr, - fac, drhoc, 1, drhoscf (1, is, ipert), 1)
enddo
mode1 = 0
do irr = 1, nirr
......@@ -111,7 +112,7 @@ subroutine addnlcc (imode0, drhoscf, npe)
call addcore (mode1, drhoc)
do is = 1, nspin_lsda
dyn1 (mode, mode1) = dyn1 (mode, mode1) + &
zdotc (nrxx, dvaux (1, is), 1, drhoc, 1) * &
zdotc (dfftp%nnr, dvaux (1, is), 1, drhoc, 1) * &
omega * fac / DBLE (nrtot)
enddo
enddo
......
......@@ -16,7 +16,8 @@ SUBROUTINE addnlcc_zstar_eu_us( drhoscf )
USE cell_base, ONLY : omega, alat
USE lsda_mod, ONLY : nspin
USE gvect, ONLY : ngm, nl, g
USE grid_dimensions, ONLY : nrxx, nr1, nr2, nr3
USE fft_base, ONLY : dfftp
USE grid_dimensions, ONLY : nr1, nr2, nr3
USE noncollin_module, ONLY : nspin_lsda, nspin_gga
USE efield_mod, ONLY : zstareu0
USE qpoint, ONLY : xq
......@@ -30,7 +31,7 @@ SUBROUTINE addnlcc_zstar_eu_us( drhoscf )
IMPLICIT NONE
COMPLEX(DP) :: drhoscf (nrxx,nspin,3)
COMPLEX(DP) :: drhoscf (dfftp%nnr,nspin,3)
INTEGER :: nrtot, ipert, jpert, is, is1, irr, ir, mode, mode1
......@@ -38,8 +39,8 @@ SUBROUTINE addnlcc_zstar_eu_us( drhoscf )
REAL(DP) :: fac
COMPLEX(DP), DIMENSION(nrxx) :: drhoc
COMPLEX(DP), DIMENSION(nrxx,nspin) :: dvaux
COMPLEX(DP), DIMENSION(dfftp%nnr) :: drhoc
COMPLEX(DP), DIMENSION(dfftp%nnr,nspin) :: dvaux
IF (.NOT.nlcc_any) RETURN
......@@ -66,7 +67,7 @@ SUBROUTINE addnlcc_zstar_eu_us( drhoscf )
DO is = 1, nspin
DO is1 = 1, nspin
DO ir = 1, nrxx
DO ir = 1, dfftp%nnr
dvaux (ir, is) = dvaux (ir, is) + &
dmuxc (ir, is, is1) * &
drhoscf (ir, is1, ipol)
......@@ -81,7 +82,7 @@ SUBROUTINE addnlcc_zstar_eu_us( drhoscf )
IF ( dft_is_gradient() ) &
CALL dgradcorr (rho%of_r, grho, &
dvxc_rr, dvxc_sr, dvxc_ss, dvxc_s, xq, drhoscf (1,1,ipert),&
nrxx, nspin, nspin_gga, nl, ngm, g, alat, dvaux)
dfftp%nnr, nspin, nspin_gga, nl, ngm, g, alat, dvaux)
DO is = 1, nspin_lsda
rho%of_r(:,is) = rho%of_r(:,is) - fac * rho_core
......@@ -90,7 +91,7 @@ SUBROUTINE addnlcc_zstar_eu_us( drhoscf )
DO is = 1, nspin_lsda
zstareu0(ipol,mode) = zstareu0(ipol,mode) - &
omega * fac / REAL(nrtot, DP) * &
DOT_PRODUCT(dvaux(1:nrxx,is),drhoc(1:nrxx))
DOT_PRODUCT(dvaux(1:dfftp%nnr,is),drhoc(1:dfftp%nnr))
END DO
END DO
imode0 = imode0 + npe
......
......@@ -18,10 +18,10 @@ subroutine allocate_phq
USE ions_base, ONLY : nat, ntyp => nsp
USE klist, only : nks
USE wvfct, ONLY : nbnd, igk, npwx
USE grid_dimensions, ONLY : nrxx
USE gvect, ONLY : ngm
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE fft_base, ONLY : dfftp
USE wavefunctions_module, ONLY: evc
USE spin_orb, ONLY : lspinorb
USE becmod, ONLY: bec_type, becp, allocate_bec_type
......@@ -67,7 +67,7 @@ subroutine allocate_phq
allocate ( dpsi ( npwx*npol , nbnd))
!
allocate (vlocq ( ngm , ntyp))
allocate (dmuxc ( nrxx , nspin_mag , nspin_mag))
allocate (dmuxc ( dfftp%nnr , nspin_mag , nspin_mag))
allocate (eprec ( nbnd, nksq) )
!
allocate (eigqts ( nat))
......
......@@ -16,7 +16,7 @@ subroutine chi_test (dvscfs, chif, ik, depsi, auxr, auxg)
USE kinds, ONLY : DP
USE wvfct, ONLY : npwx, nbnd
USE smooth_grid_dimensions, ONLY : nrxxs
USE fft_base, ONLY : dffts
use ramanm, ONLY : lrd2w, iud2w, jab
USE units_ph, ONLY : iuwfc, lrdwf, iudwf
USE qpoint, ONLY : npwq, nksq
......@@ -26,8 +26,8 @@ subroutine chi_test (dvscfs, chif, ik, depsi, auxr, auxg)
implicit none
integer :: ik
complex(DP) :: dvscfs(nrxxs,3), chif(npwx,nbnd,6), depsi(npwx,nbnd,3), &
auxr(nrxxs), auxg(npwx)
complex(DP) :: dvscfs(dffts%nnr,3), chif(npwx,nbnd,6), depsi(npwx,nbnd,3), &
auxr(dffts%nnr), auxg(npwx)
complex(DP) :: tmp
complex(DP), EXTERNAL :: zdotc
......@@ -39,7 +39,7 @@ subroutine chi_test (dvscfs, chif, ik, depsi, auxr, auxg)
allocate (ps2 (nbnd,3,6) )
allocate (ps3 (nbnd,3,nbnd,3) )
allocate (ps4 (nbnd,3,nbnd) )
allocate (au2r (nrxxs) )
allocate (au2r (dffts%nnr) )
!
!----------------------------------------------------------
......@@ -75,7 +75,7 @@ subroutine chi_test (dvscfs, chif, ik, depsi, auxr, auxg)
do ib = 1, nbnd_occ (ik)
call cft_wave ( evc (1, ib), au2r, +1 )
do ip = 1, 3
do ir = 1, nrxxs
do ir = 1, dffts%nnr
auxr (ir) = au2r (ir) * dvscfs (ir, ip)
end do
auxg (:) = (0.d0, 0.d0)
......@@ -108,7 +108,7 @@ subroutine chi_test (dvscfs, chif, ik, depsi, auxr, auxg)
do ib = 1, nbnd_occ (ik)
call cft_wave (depsi (1, ib, ip), au2r, +1 )
do ipa = 1, 3
do ir = 1, nrxxs
do ir = 1, dffts%nnr
auxr (ir) = au2r (ir) * dvscfs (ir, ipa)
enddo
auxg (:) = (0.d0, 0.d0)
......@@ -134,7 +134,7 @@ subroutine chi_test (dvscfs, chif, ik, depsi, auxr, auxg)
call daxpy (2 * npwq, -1.d0, dvpsi (1,ib), 1, auxg, 1)
call cft_wave (evc (1, ib), auxr, +1 )
do ir = 1, nrxxs
do ir = 1, dffts%nnr
auxr (ir) = auxr (ir) * dvscfs (ir, ip)
enddo
call cft_wave (auxg, auxr, -1 )
......
......@@ -22,9 +22,8 @@ subroutine compute_drhous (drhous, dbecsum, wgg, becq, alpq)
USE uspp_param, ONLY : nhm
USE lsda_mod, ONLY : lsda, nspin, current_spin, isk
USE klist, ONLY : xk, wk
USE fft_base, ONLY: dffts
USE fft_base, ONLY: dffts, dfftp
USE fft_interfaces, ONLY: invfft
USE grid_dimensions,ONLY : nrxx
USE gvecs, ONLY : nls
USE wvfct, ONLY : npw, nbnd, igk
......@@ -40,7 +39,7 @@ subroutine compute_drhous (drhous, dbecsum, wgg, becq, alpq)
!
complex(DP) :: dbecsum (nhm * (nhm + 1) / 2, nat, nspin, 3 * nat) &
, drhous (nrxx, nspin, 3 * nat)
, drhous (dfftp%nnr, nspin, 3 * nat)
!output:the derivative of becsum
! output: add the orthogonality term
type (bec_type) :: becq(nksq), & ! (nkb, nbnd)
......
......@@ -19,9 +19,8 @@ subroutine compute_drhous_nc (drhous, dbecsum, wgg, becq, alpq)
USE ions_base, ONLY : nat
USE lsda_mod, ONLY : lsda, nspin, current_spin, isk
USE klist, ONLY : xk, wk
USE fft_base, ONLY : dffts
USE fft_base, ONLY : dffts, dfftp
USE fft_interfaces, ONLY : invfft
USE grid_dimensions,ONLY : nrxx
USE gvecs, ONLY : nls
USE wvfct, ONLY : npw, npwx, nbnd, igk
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
......@@ -42,7 +41,7 @@ subroutine compute_drhous_nc (drhous, dbecsum, wgg, becq, alpq)
!
complex(DP) :: dbecsum (nhm, nhm, nat, nspin, 3 * nat), &
drhous (nrxx, nspin_mag, 3 * nat)
drhous (dfftp%nnr, nspin_mag, 3 * nat)
!output:the derivative of becsum
! output: add the orthogonality term
type (bec_type) :: becq(nksq), & ! (nkb, nbnd)
......
......@@ -13,18 +13,18 @@ SUBROUTINE compute_vsgga( rhoout, grho, vsgga )
USE constants, ONLY : e2
USE kinds, ONLY : DP
USE gvect, ONLY : nl, ngm, g
USE grid_dimensions, ONLY : nrxx
USE cell_base, ONLY : alat
USE noncollin_module, ONLY : noncolin, nspin_gga
USE funct, ONLY : gcxc, gcx_spin, gcc_spin, &
gcc_spin_more, dft_is_gradient, get_igcc
USE spin_orb, ONLY : domag
USE fft_base, ONLY : dfftp
!
IMPLICIT NONE
!
REAL(DP), INTENT(IN) :: rhoout(nrxx,nspin_gga)
REAL(DP), INTENT(IN) :: grho(3,nrxx,nspin_gga)
REAL(DP), INTENT(OUT) :: vsgga(nrxx)
REAL(DP), INTENT(IN) :: rhoout(dfftp%nnr,nspin_gga)
REAL(DP), INTENT(IN) :: grho(3,dfftp%nnr,nspin_gga)
REAL(DP), INTENT(OUT) :: vsgga(dfftp%nnr)
!
INTEGER :: k, ipol, is
!
......@@ -49,10 +49,10 @@ SUBROUTINE compute_vsgga( rhoout, grho, vsgga )
igcc_is_lyp = (get_igcc() == 3)
!
ALLOCATE( h( 3, nrxx, nspin_gga) )
ALLOCATE( vaux( nrxx, nspin_gga ) )
ALLOCATE( h( 3, dfftp%nnr, nspin_gga) )
ALLOCATE( vaux( dfftp%nnr, nspin_gga ) )
DO k = 1, nrxx
DO k = 1, dfftp%nnr
!
rh = rhoout(k,1) + rhoout(k,2)
!
......@@ -146,14 +146,14 @@ SUBROUTINE compute_vsgga( rhoout, grho, vsgga )
!
END DO
!
ALLOCATE( dh( nrxx ) )
ALLOCATE( dh( dfftp%nnr ) )
!
! ... second term of the gradient correction :
! ... \sum_alpha (D / D r_alpha) ( D(rho*Exc)/D(grad_alpha rho) )
!
DO is = 1, nspin_gga
!
CALL grad_dot( nrxx, h(1,1,is), ngm, g, nl, alat, dh )
CALL grad_dot( dfftp%nnr, h(1,1,is), ngm, g, nl, alat, dh )
!
vaux(:,is) = vaux(:,is) - dh(:)
!
......
......@@ -41,7 +41,7 @@ subroutine dhdrhopsi
USE io_files, ONLY : iunigk
USE cell_base, ONLY : tpiba, at
USE klist, ONLY : xk, nkstot
USE smooth_grid_dimensions, ONLY : nrxxs
USE fft_base, ONLY : dffts
USE wvfct, ONLY : npw, npwx, nbnd, et, igk
USE uspp, ONLY : nkb, vkb
USE wavefunctions_module, ONLY: evc
......@@ -106,9 +106,9 @@ subroutine dhdrhopsi
allocate (chif (npwx,nbnd,6) )
allocate (depsi (npwx,nbnd,3) )
allocate (auxg (npwx) )
allocate (dvscfs (nrxxs,3) )
allocate (auxr (nrxxs) )
allocate (au2r (nrxxs) )
allocate (dvscfs (dffts%nnr,3) )
allocate (auxr (dffts%nnr) )
allocate (au2r (dffts%nnr) )
allocate (ps0 (nbnd) )
allocate (ps1 (nbnd,nbnd) )
allocate (ps2 (nbnd,nbnd,3) )
......@@ -235,7 +235,7 @@ subroutine dhdrhopsi
dvpsi (:,:) = (0.d0, 0.d0)
do ibnd = 1, nbnd_occ (ik)
call cft_wave (evc (1, ibnd), auxr, +1 )
do ir = 1, nrxxs
do ir = 1, dffts%nnr
auxr (ir) = auxr (ir) * dvscfs (ir, ipa)
enddo
call cft_wave (dvpsi (1, ibnd), auxr, -1 )
......@@ -255,7 +255,7 @@ subroutine dhdrhopsi
call cft_wave (dpsi (1, ibnd), auxr, +1)
do ipb = 1, 3
auxg (:) = (0.d0, 0.d0)
do ir = 1, nrxxs
do ir = 1, dffts%nnr
au2r (ir) = auxr (ir) * dvscfs (ir, ipb)
enddo
call cft_wave (auxg, au2r, -1)
......
......@@ -18,9 +18,9 @@ subroutine drho
!
!
USE kinds, ONLY : DP
USE grid_dimensions, ONLY : nrxx
USE gvecs, ONLY : doublegrid
USE smooth_grid_dimensions, ONLY : nr1s,nr2s,nr3s, nrxxs
USE smooth_grid_dimensions, ONLY : nr1s,nr2s,nr3s
USE fft_base, ONLY : dfftp, dffts
USE lsda_mod, ONLY : nspin
USE cell_base, ONLY : omega
USE ions_base, ONLY : nat, ntyp => nsp, ityp
......@@ -116,7 +116,7 @@ subroutine drho
! now we compute the change of the charge density due to the change of
! the orthogonality constraint
!
allocate (drhous ( nrxx , nspin_mag , 3 * nat))
allocate (drhous ( dfftp%nnr, nspin_mag , 3 * nat))
allocate (dbecsum( nhm * (nhm + 1) /2, nat, nspin_mag, 3 * nat))
dbecsum=(0.d0,0.d0)
IF (noncolin) THEN
......@@ -142,7 +142,7 @@ subroutine drho
! The part of C^3 (Eq. 37) which contain the local potential can be
! evaluated with an integral of this change of potential and drhous
!
allocate (dvlocin( nrxxs))
allocate (dvlocin(dffts%nnr))
wdyn (:,:) = (0.d0, 0.d0)
nrstot = nr1s * nr2s * nr3s
......@@ -151,7 +151,7 @@ subroutine drho
do nu_j = 1, 3 * nat
do is = 1, nspin_lsda
wdyn (nu_j, nu_i) = wdyn (nu_j, nu_i) + &
zdotc (nrxxs, drhous(1,is,nu_j), 1, dvlocin, 1) * &
zdotc (dffts%nnr, drhous(1,is,nu_j), 1, dvlocin, 1) * &
omega / DBLE (nrstot)
enddo
enddo
......@@ -182,7 +182,7 @@ subroutine drho
!
! add the augmentation term to the charge density and save it
!
allocate (drhoust( nrxx , nspin_mag , npertx))
allocate (drhoust(dfftp%nnr, nspin_mag , npertx))
drhoust=(0.d0,0.d0)
#ifdef __PARA
!
......@@ -209,10 +209,10 @@ subroutine drho
enddo
enddo
else
call zcopy (nrxx*nspin_mag*npe, drhous(1,1,mode+1), 1, drhoust, 1)
call zcopy (dfftp%nnr*nspin_mag*npe, drhous(1,1,mode+1), 1, drhoust, 1)
endif
call dscal (2*nrxx*nspin_mag*npe, 0.5d0, drhoust, 1)
call dscal (2*dfftp%nnr*nspin_mag*npe, 0.5d0, drhoust, 1)
call addusddens (drhoust, dbecsum(1,1,1,mode+1), mode, npe, 1)
do iper = 1, npe
......
......@@ -22,13 +22,13 @@ subroutine drhodv (nu_i0, nper, drhoscf)
USE ions_base, ONLY : nat
USE klist, ONLY : xk
USE gvect, ONLY : g
USE grid_dimensions, ONLY : nrxx
USE cell_base, ONLY : tpiba
USE lsda_mod, ONLY : current_spin, lsda, isk, nspin
USE wvfct, ONLY : npw, npwx, nbnd, igk
USE uspp, ONLY : nkb, vkb
USE becmod, ONLY : calbec, bec_type, becscal, allocate_bec_type, &
deallocate_bec_type
USE fft_base, ONLY : dfftp
USE io_global, ONLY : stdout
USE noncollin_module, ONLY : noncolin, npol, nspin_mag
USE io_files, ONLY: iunigk
......@@ -49,7 +49,7 @@ subroutine drhodv (nu_i0, nper, drhoscf)
! input: number of perturbations of this represent
! input: the initial position of the mode
complex(DP) :: drhoscf (nrxx, nspin_mag, nper)
complex(DP) :: drhoscf (dfftp%nnr, nspin_mag, nper)
! the change of density due to perturbations
integer :: mu, ik, ikq, ig, nu_i, nu_j, na_jcart, ibnd, nrec, &
......
......@@ -15,8 +15,8 @@ subroutine drhodvloc (nu_i0, npe, drhoscf, wdyn)
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat
USE grid_dimensions, ONLY : nrxx
USE smooth_grid_dimensions, ONLY : nrxxs, nr1s, nr2s, nr3s
USE smooth_grid_dimensions, ONLY : nr1s, nr2s, nr3s
USE fft_base, ONLY : dfftp, dffts
USE cell_base, ONLY : omega
USE lsda_mod, ONLY : nspin
USE noncollin_module, ONLY : nspin_lsda, nspin_mag
......@@ -29,7 +29,7 @@ subroutine drhodvloc (nu_i0, npe, drhoscf, wdyn)
integer :: npe, nu_i0
! input: the number of perturbation of this representations
! input: the initial position of the mode
complex(DP) :: drhoscf (nrxx, nspin_mag, npe), wdyn (3 * nat, 3 * nat)
complex(DP) :: drhoscf (dfftp%nnr, nspin_mag, npe), wdyn (3 * nat, 3 * nat)
! the change of density due to perturbations
! auxiliary matrix where drhodv is stored
......@@ -43,7 +43,7 @@ subroutine drhodvloc (nu_i0, npe, drhoscf, wdyn)
complex(DP), allocatable :: dvloc (:)
! d Vloc / dtau
allocate (dvloc( nrxxs))
allocate (dvloc( dffts%nnr))
dynwrk (:,:) = (0.d0, 0.d0)
!
! We need a sum over all perturbations
......@@ -54,7 +54,7 @@ subroutine drhodvloc (nu_i0, npe, drhoscf, wdyn)
nu_i = nu_i0 + ipert
do is = 1, nspin_lsda
dynwrk (nu_i, nu_j) = dynwrk (nu_i, nu_j) + &
zdotc (nrxxs, drhoscf (1, is, ipert), 1, dvloc, 1) * &
zdotc (dffts%nnr, drhoscf (1, is, ipert), 1, dvloc, 1) * &
omega / (nr1s * nr2s * nr3s)
enddo
enddo
......
......@@ -21,9 +21,10 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
!
USE kinds, ONLY : DP
USE ions_base, ONLY : nat, ntyp=>nsp, ityp
USE grid_dimensions, ONLY : nrxx, nr1, nr2, nr3
USE grid_dimensions, ONLY : nr1, nr2, nr3
USE cell_base, ONLY : omega
USE ions_base, ONLY : nat
USE fft_base, ONLY : dfftp
USE uspp, ONLY : okvan
USE io_global, ONLY : stdout
USE uspp_param, ONLY : upf, nh
......@@ -44,7 +45,7 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
! input: starting position of this represe
! input: the number of perturbations
complex(DP) :: dvscfin (nrxx, nspin_mag, npe)
complex(DP) :: dvscfin (dfftp%nnr, nspin_mag, npe)
! input: the change of V_Hxc
integer :: ipert, irr1, mode0, mu, is, nu_i, nu_j, nrtot, &
......@@ -64,7 +65,7 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
return
endif
call start_clock ('drhodvus')
allocate (drhous ( nrxx , nspin_mag))
allocate (drhous ( dfftp%nnr, nspin_mag))
dyn1 (:,:) = (0.d0, 0.d0)
nrtot = nr1 * nr2 * nr3
mode0 = 0
......@@ -75,7 +76,7 @@ subroutine drhodvus (irr, imode0, dvscfin, npe)
do mu = 1, npert (irr)
nu_i = imode0 + mu
dyn1 (nu_i, nu_j) = dyn1 (nu_i, nu_j) + &
zdotc (nrxx*nspin_mag,dvscfin(1,1,mu),1,drhous, 1) &
zdotc (dfftp%nnr*nspin_mag,dvscfin(1,1,mu),1,drhous, 1) &
* omega / DBLE (nrtot)
enddo
enddo
......
......@@ -19,10 +19,9 @@ subroutine dvpsi_e2
USE cell_base, ONLY : omega
USE klist, ONLY : wk
USE gvecs, ONLY : doublegrid
USE grid_dimensions, ONLY : nrxx
USE smooth_grid_dimensions, ONLY : nrxxs
USE wvfct, ONLY : npw, npwx, nbnd, igk
USE wavefunctions_module, ONLY: evc
USE fft_base, ONLY : dfftp, dffts
USE scf, ONLY : rho
USE io_files, ONLY : iunigk
USE qpoint, ONLY : npwq, nksq
......@@ -67,9 +66,9 @@ subroutine dvpsi_e2
! First, calculates the second derivative of the charge-density
! -only the part that does not depend on the self-consistent cycle-
!
allocate (raux6 (nrxxs,6))
allocate (raux6 (dffts%nnr,6))
allocate (depsi (npwx,nbnd,3))
allocate (aux3s (nrxxs,3))
allocate (aux3s (dffts%nnr,3))
allocate (ps (nbnd,nbnd,3,3))
raux6 (:,:) = 0.d0
......@@ -92,7 +91,7 @@ subroutine dvpsi_e2
call cft_wave (depsi (1, ibnd, ipa), aux3s (1, ipa), +1)
enddo
do ipa = 1, 6
do ir = 1, nrxxs
do ir = 1, dffts%nnr
tmp = CONJG(aux3s (ir, a1j (ipa))) * &
aux3s (ir, a2j (ipa))
raux6 (ir, ipa) = raux6 (ir, ipa) + weight * DBLE (tmp)
......@@ -116,7 +115,7 @@ subroutine dvpsi_e2
do jbnd = 1, nbnd_occ (ik)
call cft_wave (evc (1, jbnd), aux3s (1,2), +1)
do ipa = 1, 6
do ir = 1, nrxxs
do ir = 1, dffts%nnr
tmp = aux3s (ir,1) * &
ps(ibnd, jbnd, a1j (ipa), a2j (ipa)) * &
CONJG(aux3s (ir,2))
......@@ -136,21 +135,21 @@ subroutine dvpsi_e2
! Multiplies the charge with the potential
!
if (doublegrid) then
allocate (auxs1 (nrxxs))
allocate (aux6 (nrxx,6))
allocate (auxs1 (dffts%nnr))
allocate (aux6 (dfftp%nnr,6))
else
allocate (aux6s (nrxxs,6))
allocate (aux6s (dffts%nnr,6))
aux6 => aux6s
endif
do ipa = 1, 6
if (doublegrid) then
do ir = 1, nrxxs
do ir = 1, dffts%nnr
auxs1 (ir) = CMPLX(raux6 (ir, ipa), 0.d0,kind=DP)
enddo
call cinterpolate (aux6 (1, ipa), auxs1, +1)
else
do ir = 1, nrxxs
do ir = 1, dffts%nnr
aux6 (ir, ipa) = CMPLX(raux6 (ir, ipa), 0.d0,kind=DP)
enddo
endif
......@@ -164,8 +163,8 @@ subroutine dvpsi_e2
! Calculates the term depending on the third derivative of the
! Exchange-correlation energy
!
allocate (d2muxc (nrxx))
allocate (aux3 (nrxx,3))
allocate (d2muxc (dfftp%nnr))
allocate (aux3 (dfftp%nnr,3))
do ipa = 1, 3
call davcio_drho (aux3 (1, ipa), lrdrho, iudrho, ipa, -1)
enddo
......@@ -174,7 +173,7 @@ subroutine dvpsi_e2
if (my_pool_id .ne. 0) goto 100
#endif
d2muxc (:) = 0.d0
do ir = 1, nrxx
do ir = 1, dfftp%nnr
! rhotot = rho%of_r(ir,1) + rho_core(ir)
rhotot = rho%of_r(ir,1)
if ( rhotot.gt. 1.d-30 ) d2muxc(ir)= d2mxc( rhotot)
......@@ -182,7 +181,7 @@ subroutine dvpsi_e2
enddo
do ipa = 1, 6
do ir = 1, nrxx
do ir = 1, dfftp%nnr
aux6 (ir, ipa) = aux6 (ir, ipa) + d2muxc (ir) * &
aux3 (ir, a1j (ipa)) * aux3 (ir, a2j (ipa))
enddo
......@@ -199,7 +198,7 @@ subroutine dvpsi_e2
if (doublegrid) then
allocate (aux6s (nrxxs,6))
allocate (aux6s (dffts%nnr,6))
do ipa = 1, 6
call cinterpolate (aux6 (1, ipa), aux6s (1, ipa), -1)
enddo
......@@ -212,8 +211,8 @@ subroutine dvpsi_e2
! solve_e2
!
allocate (auxg (npwx,nbnd))
allocate (auxs1 (nrxxs))
allocate (auxs2 (nrxxs))
allocate (auxs1 (dffts%nnr))
allocate (auxs2 (dffts%nnr))
if (nksq.gt.1) rewind (iunigk)
do ik = 1, nksq
......@@ -227,7 +226,7 @@ subroutine dvpsi_e2
call davcio (auxg, lrchf, iuchf, nrec, -1)
do ibnd = 1, nbnd_occ (ik)
call cft_wave (evc (1, ibnd), auxs1, +1)
do ir = 1, nrxxs
do ir = 1, dffts%nnr
auxs2 (ir) = auxs1 (ir) * aux6s (ir, ipa)
enddo
call cft_wave (auxg (1, ibnd), auxs2, -1)
......
......@@ -15,10 +15,9 @@ subroutine ef_shift (drhoscf, ldos, ldoss, dos_ef, irr, npe, flag)
USE io_global, ONLY : stdout
USE wavefunctions_module, ONLY : evc
USE cell_base, ONLY : omega
USE fft_base, ONLY : dfftp
USE fft_base, ONLY : dfftp, dffts
USE fft_interfaces, ONLY : fwfft, invfft
USE gvect, ONLY : gg, nl
USE smooth_grid_dimensions,ONLY: nrxxs
USE lsda_mod, ONLY : nspin
USE wvfct, ONLY : npw, npwx, et
USE klist, ONLY : degauss, ngauss, ngk
......@@ -42,7 +41,7 @@ subroutine ef_shift (drhoscf, ldos, ldoss, dos_ef, irr, npe, flag)
! input: the number of perturbation
complex(DP) :: drhoscf(dfftp%nnr,nspin_mag,npe), &
ldos(dfftp%nnr,nspin_mag), ldoss(nrxxs,nspin_mag)
ldos(dfftp%nnr,nspin_mag), ldoss(dffts%nnr,nspin_mag)
! inp/out:the change of the charge
! inp: local DOS at Ef
! inp: local DOS at Ef without augme
......@@ -140,7 +139,7 @@ subroutine ef_shift (drhoscf, ldos, ldoss, dos_ef, irr, npe, flag)
enddo
do ipert = 1, npert (irr)
do is = 1, nspin_mag