Commit 77648909 authored by giannozz's avatar giannozz

Variable nrxxs removed from module gvect. Either the value in module

smooth_grid_dimensions or in dffts%nnr is used instead. Lots of changes
but nothing substantial. Beware unintended side effects


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7164 c92efa57-630b-4861-b058-cf58834340f0
parent 388e78dc
......@@ -18,7 +18,7 @@ subroutine dvdpsi (nu_i, xq_, dvloc, vkb_, vkbq_, psi_, dvpsi_)
USE fft_base, ONLY : dffts
USE fft_interfaces, ONLY : fwfft, invfft
USE gvect, ONLY : nrxx, g
USE gsmooth, ONLY : nrxxs, nls
USE gsmooth, ONLY : nls
USE wvfct, ONLY : nbnd, npwx, npw, igk
use phcom
use d3com
......@@ -66,7 +66,7 @@ subroutine dvdpsi (nu_i, xq_, dvloc, vkb_, vkbq_, psi_, dvpsi_)
aux (nls (igk (ig) ) ) = psi_ (ig, ibnd)
enddo
CALL invfft ('Wave', aux, dffts)
do ir = 1, nrxxs
do ir = 1, dffts%nnr
aux (ir) = aux (ir) * dvloc (ir)
enddo
CALL fwfft ('Wave', aux, dffts)
......
......@@ -31,7 +31,7 @@ subroutine incdrhoscf2 (drhoscf, weight, ik, dbecsum, mode, flag)
real (DP) :: weight
! input: the weight of the k point
complex (DP) :: drhoscf (nrxxs), dbecsum (nhm * (nhm + 1) / 2, nat)
complex (DP) :: drhoscf (dffts%nnr), dbecsum (nhm * (nhm + 1) / 2, nat)
! output: the change of the charge densit
! inp/out: the accumulated dbec
integer :: mode, flag
......@@ -52,8 +52,8 @@ subroutine incdrhoscf2 (drhoscf, weight, ik, dbecsum, mode, flag)
! counters
call start_clock ('incdrhoscf')
allocate (dpsic( nrxxs))
allocate (psi ( nrxxs))
allocate (dpsic( dffts%nnr))
allocate (psi ( dffts%nnr))
wgt = 2.d0 * weight / omega
if (lgamma) then
ikk = ik
......@@ -96,7 +96,7 @@ subroutine incdrhoscf2 (drhoscf, weight, ik, dbecsum, mode, flag)
enddo
CALL invfft ('Wave', dpsic, dffts)
do ir = 1, nrxxs
do ir = 1, dffts%nnr
drhoscf (ir) = drhoscf (ir) + wgt * CONJG(psi (ir) ) * dpsic (ir)
! if (ir.lt.20) WRITE( stdout,*) drhoscf(ir)
enddo
......
......@@ -63,6 +63,7 @@ d3_readin.o : ../Modules/control_flags.o
d3_readin.o : ../Modules/io_files.o
d3_readin.o : ../Modules/io_global.o
d3_readin.o : ../Modules/ions_base.o
d3_readin.o : ../Modules/mp.o
d3_readin.o : ../Modules/printout_base.o
d3_readin.o : ../Modules/uspp.o
d3_readin.o : ../PH/phcom.o
......@@ -90,6 +91,7 @@ d3_setup.o : ../PW/scf_mod.o
d3_setup.o : ../PW/symm_base.o
d3_setup.o : d3com.o
d3_summary.o : ../Modules/control_flags.o
d3_summary.o : ../Modules/griddim.o
d3_summary.o : ../Modules/io_global.o
d3_summary.o : ../Modules/ions_base.o
d3_summary.o : ../Modules/kind.o
......
......@@ -35,13 +35,13 @@ SUBROUTINE biot_savart(jpol)
call start_clock('biot_savart')
! allocate memory
allocate(aux(nrxxs), j_of_g(1:ngm,3))
allocate(aux(dffts%nnr), j_of_g(1:ngm,3))
! transform current to reciprocal space
j_of_g(:,:) = 0.0_dp
do ispin = 1, nspin
do ipol = 1, 3
aux(1:nrxxs) = j_bare(1:nrxxs,ipol,jpol,ispin)
aux(1:dffts%nnr) = j_bare(1:dffts%nnr,ipol,jpol,ispin)
CALL fwfft ('Smooth', aux, dffts)
j_of_g(1:ngm,ipol) = j_of_g(1:ngm,ipol) + aux(nl(1:ngm))
enddo
......@@ -60,7 +60,7 @@ SUBROUTINE biot_savart(jpol)
aux = (0.0_dp,0.0_dp)
aux(nl(1:ngm)) = b_ind(1:ngm,ipol,jpol)
CALL invfft ('Smooth', aux, dffts)
b_ind_r(1:nrxxs,ipol,jpol) = real(aux(1:nrxxs))
b_ind_r(1:dffts%nnr,ipol,jpol) = real(aux(1:dffts%nnr))
enddo
deallocate(aux, j_of_g)
......@@ -75,18 +75,17 @@ SUBROUTINE field_to_reciprocal_space
USE fft_base, ONLY : dffts
USE fft_interfaces, ONLY : fwfft
USE gvect, ONLY : ngm, gstart, nrxx, nl, nlm, g, gg
USE gsmooth, ONLY : nrxxs
USE gipaw_module
IMPLICIT NONE
complex(dp), allocatable :: aux(:)
integer :: ipol, jpol
allocate(aux(nrxxs))
allocate(aux(dffts%nnr))
b_ind(:,:,:) = 0.0_dp
do ipol = 1, 3
do jpol = 1, 3
aux(1:nrxxs) = b_ind_r(1:nrxxs,ipol,jpol)
aux(1:dffts%nnr) = b_ind_r(1:dffts%nnr,ipol,jpol)
CALL fwfft ('Smooth', aux, dffts)
b_ind(1:ngm,ipol,jpol) = aux(nl(1:ngm))
enddo
......
......@@ -12,7 +12,7 @@ SUBROUTINE g_tensor_crystal
! ... Compute the g-tensor: PRL 88, 086403 (2002)
!
USE kinds, ONLY : DP
USE gsmooth, ONLY : nrxxs
USE smooth_grid_dimensions, ONLY : nrxxs
USE parameters, ONLY : lmaxx
USE constants, ONLY : pi
USE uspp, ONLY : vkb, ap
......
......@@ -205,9 +205,11 @@ CONTAINS
!-----------------------------------------------------------------------
SUBROUTINE gipaw_allocate
USE lsda_mod, ONLY : nspin, lsda
USE pwcom
USE gvect, ONLY : ngm
USE wvfct, ONLY : nbnd, npwx
USE ions_base, ONLY : ntyp => nsp
USE paw_gipaw, ONLY : paw_recon
USE smooth_grid_dimensions, ONLY : nrxxs
IMPLICIT NONE
......@@ -1161,7 +1163,7 @@ CONTAINS
!-----------------------------------------------------------------------
SUBROUTINE test_symmetries ( s, nsym )
USE pwcom, ONLY : at, bg
USE cell_base, ONLY : at, bg
IMPLICIT NONE
......
......@@ -18,7 +18,7 @@ subroutine h_psiq (lda, n, m, psi, hpsi, spsi)
!
USE fft_base, ONLY : dffts
USE fft_interfaces, ONLY : fwfft, invfft
USE gsmooth, ONLY : nls, nrxxs
USE gsmooth, ONLY : nls
USE lsda_mod, ONLY : current_spin
USE wvfct, ONLY : igk, g2kin
USE uspp, ONLY : vkb
......@@ -77,10 +77,10 @@ subroutine h_psiq (lda, n, m, psi, hpsi, spsi)
!
! and then the product with the potential vrs = (vltot+vr) on the smoo
!
!do j = 1, nrxxs
!do j = 1, dffts%nnr
! psic (j) = psic (j) * vrs (j, current_spin)
!enddo
psic (1:nrxxs) = psic (1:nrxxs) * vrs (1:nrxxs, current_spin)
psic (1:dffts%nnr) = psic (1:dffts%nnr) * vrs (1:dffts%nnr, current_spin)
!
! back to reciprocal space
!
......
......@@ -15,7 +15,7 @@ SUBROUTINE j_para(fact, psi_n, psi_m, ik, q, j)
USE kinds, ONLY : DP
USE klist, ONLY : xk
USE wvfct, ONLY : nbnd, npwx, npw, igk, wg
USE pwcom, ONLY : nrxxs, g, tpiba, nls
USE pwcom, ONLY : g, tpiba, nls
USE fft_base, ONLY : dffts
USE fft_interfaces, ONLY : invfft
USE gipaw_module, ONLY : nbnd_occ
......@@ -26,7 +26,7 @@ SUBROUTINE j_para(fact, psi_n, psi_m, ik, q, j)
REAL(DP), INTENT(IN) :: fact ! multiplication factor
REAL(DP), INTENT(IN) :: q(3)
COMPLEX(DP), INTENT(IN) :: psi_n(npwx,nbnd), psi_m(npwx,nbnd)
REAL(DP), INTENT(INOUT) :: j(nrxxs,3)
REAL(DP), INTENT(INOUT) :: j(dffts%nnr,3)
!-- local variables ----------------------------------------------------
COMPLEX(DP), allocatable :: p_psic(:), psic(:), aux(:)
......@@ -36,7 +36,7 @@ SUBROUTINE j_para(fact, psi_n, psi_m, ik, q, j)
call start_clock('j_para')
! allocate real space wavefunctions
allocate(p_psic(nrxxs), psic(nrxxs), aux(npwx))
allocate(p_psic(dffts%nnr), psic(dffts%nnr), aux(npwx))
! loop over cartesian components
do ipol = 1, 3
......@@ -60,8 +60,8 @@ SUBROUTINE j_para(fact, psi_n, psi_m, ik, q, j)
CALL invfft ('Wave', psic, dffts)
! add to the current
j(1:nrxxs,ipol) = j(1:nrxxs,ipol) + 0.5d0 * fact * wg(ibnd,ik) * &
aimag(conjg(p_psic(1:nrxxs)) * psic(1:nrxxs))
j(1:dffts%nnr,ipol) = j(1:dffts%nnr,ipol) + 0.5d0 * fact * wg(ibnd,ik) * &
aimag(conjg(p_psic(1:dffts%nnr)) * psic(1:dffts%nnr))
! apply p_{k+q} on the right
do ig = 1, npw
......@@ -79,8 +79,8 @@ SUBROUTINE j_para(fact, psi_n, psi_m, ik, q, j)
CALL invfft ('Wave', psic, dffts)
! add to the current
j(1:nrxxs,ipol) = j(1:nrxxs,ipol) + 0.5d0 * fact * wg(ibnd,ik) * &
aimag(conjg(psic(1:nrxxs)) * p_psic(1:nrxxs))
j(1:dffts%nnr,ipol) = j(1:dffts%nnr,ipol) + 0.5d0 * fact * wg(ibnd,ik) * &
aimag(conjg(psic(1:dffts%nnr)) * p_psic(1:dffts%nnr))
enddo ! ibnd
enddo ! ipol
......
......@@ -72,6 +72,7 @@ g_tensor_crystal.o : ../Modules/cell_base.o
g_tensor_crystal.o : ../Modules/constants.o
g_tensor_crystal.o : ../Modules/fft_base.o
g_tensor_crystal.o : ../Modules/fft_interfaces.o
g_tensor_crystal.o : ../Modules/griddim.o
g_tensor_crystal.o : ../Modules/io_files.o
g_tensor_crystal.o : ../Modules/io_global.o
g_tensor_crystal.o : ../Modules/ions_base.o
......@@ -99,8 +100,10 @@ gipaw_main.o : ../Modules/mp_global.o
gipaw_main.o : ../PW/pwcom.o
gipaw_main.o : gipaw_module.o
gipaw_module.o : ../Modules/atom.o
gipaw_module.o : ../Modules/cell_base.o
gipaw_module.o : ../Modules/constants.o
gipaw_module.o : ../Modules/control_flags.o
gipaw_module.o : ../Modules/griddim.o
gipaw_module.o : ../Modules/io_files.o
gipaw_module.o : ../Modules/io_global.o
gipaw_module.o : ../Modules/ions_base.o
......@@ -184,6 +187,7 @@ stop_code.o : ../Modules/mp_global.o
stop_code.o : ../Modules/parallel_include.o
suscept_crystal.o : ../Modules/cell_base.o
suscept_crystal.o : ../Modules/constants.o
suscept_crystal.o : ../Modules/griddim.o
suscept_crystal.o : ../Modules/io_files.o
suscept_crystal.o : ../Modules/io_global.o
suscept_crystal.o : ../Modules/ions_base.o
......@@ -201,6 +205,7 @@ suscept_crystal.o : gipaw_module.o
suscept_crystal.o : paw_gipaw.o
symmetrize_field.o : ../Modules/cell_base.o
symmetrize_field.o : ../Modules/fft_base.o
symmetrize_field.o : ../Modules/griddim.o
symmetrize_field.o : ../Modules/kind.o
symmetrize_field.o : ../Modules/mp_global.o
symmetrize_field.o : ../PW/pwcom.o
......
......@@ -27,7 +27,7 @@ SUBROUTINE suscept_crystal
USE parameters, ONLY : lmaxx
USE constants, ONLY : pi
USE gvect, ONLY : ngm, g, ecutwfc
USE gsmooth, ONLY : nrxxs
USE smooth_grid_dimensions, ONLY : nrxxs
USE uspp, ONLY : vkb, ap
USE lsda_mod, ONLY : nspin
USE gipaw_module, ONLY : j_bare, b_ind, b_ind_r, tens_fmt, &
......
......@@ -98,7 +98,7 @@ subroutine solve_head
allocate(x(2*n_gauss+1),w(2*n_gauss+1), freqs(n_gauss+1))
allocate(head(n_gauss+1),head_tmp(n_gauss+1))
head(:)=0.d0
allocate(psi_v(nrxxs, nbnd), prod(nrxx))
allocate(psi_v(dffts%nnr, nbnd), prod(nrxx))
allocate (becpd (nkb, nbnd), tmp_g(ngm))
allocate( pola_charge(nrxx,nspin,3))
allocate(dpsi_ipol(npwx,nbnd,3),epsilon_g(3,3,n_gauss+1))
......@@ -129,7 +129,7 @@ subroutine solve_head
call start_clock ('solve_head')
allocate (auxg(npwx))
allocate (aux1(nrxxs))
allocate (aux1(dffts%nnr))
allocate (ps (nbnd,nbnd))
ps (:,:) = (0.d0, 0.d0)
allocate (h_diag(npwx, nbnd))
......@@ -303,7 +303,7 @@ subroutine solve_head
!
CALL invfft ('Wave', prod, dffts)
! product dpsi * psi_v
prod(1:nrxxs)=conjg(prod(1:nrxxs))*psi_v(1:nrxxs,ibnd)
prod(1:dffts%nnr)=conjg(prod(1:dffts%nnr))*psi_v(1:dffts%nnr,ibnd)
if(doublegrid) then
call cinterpolate(prod,prod,1)
endif
......
......@@ -20,7 +20,7 @@
USE wavefunctions_module, ONLY : evc, psic
USE fft_base, ONLY : dffts, dfftp
USE fft_interfaces, ONLY : fwfft, invfft
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
USE uspp, ONLY : nkb, vkb, okvan
USE realus, ONLY : adduspos_gamma_r
USE mp, ONLY : mp_sum
......@@ -72,7 +72,7 @@
mem_used=mem_used+ngm_max*8
mem_used=mem_used+nrxx*8
mem_used=mem_used+numw_prod*nbnd_normal*8
mem_used=mem_used+nrxxs*(cprim_last-cprim_first+1)*8
mem_used=mem_used+dffts%nnr*(cprim_last-cprim_first+1)*8
mem_used=mem_used+nrxx*8
mem_used=mem_used+ngm*16
......@@ -129,7 +129,7 @@
allocate( smat(numw_prod,nbnd_normal))
allocate(tmp_reals(nrxxs, cprim_last-cprim_first+1),tmp_reals_jj(nrxx))
allocate(tmp_reals(dffts%nnr, cprim_last-cprim_first+1),tmp_reals_jj(nrxx))
allocate(tmp_g(ngm))
write(stdout,*) 'ATTENZIONE3'
......@@ -255,7 +255,7 @@
CALL invfft ('Wave', psic, dffts)
tmp_reals_jj(:)= DBLE(psic(:))
tmp_prod(1:nrxxs)=tmp_reals(:,ii-cprim_first+1)*tmp_reals_jj(:)
tmp_prod(1:dffts%nnr)=tmp_reals(:,ii-cprim_first+1)*tmp_reals_jj(:)
if(doublegrid) then
call interpolate(tmp_prod,tmp_prod,1)
endif
......@@ -315,7 +315,7 @@ subroutine create_vcw_overlap(n_set, orthonorm,ecutoff)
USE wavefunctions_module, ONLY : evc, psic
USE fft_base, ONLY : dffts, dfftp
USE fft_interfaces, ONLY : fwfft, invfft
USE gsmooth, ONLY : nls, nlsm,nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
USE uspp, ONLY : nkb, vkb, okvan
USE realus, ONLY : adduspos_gamma_r
USE mp, ONLY : mp_sum
......@@ -362,8 +362,8 @@ subroutine create_vcw_overlap(n_set, orthonorm,ecutoff)
mem_used=0
mem_used=mem_used+nrxx*8
mem_used=mem_used+numw_prod*(nbnd_normal-num_nbndv)*8
mem_used=mem_used+nrxxs*(cprim_last_eff-cprim_first+1)*8
mem_used=mem_used+nrxxs*8
mem_used=mem_used+dffts%nnr*(cprim_last_eff-cprim_first+1)*8
mem_used=mem_used+dffts%nnr*8
mem_used=mem_used+ngm*16
!calculate becs
......@@ -382,7 +382,7 @@ subroutine create_vcw_overlap(n_set, orthonorm,ecutoff)
allocate(tmp_prod(nrxx))
allocate( smat(numw_prod,nbnd_normal-num_nbndv))
allocate(tmp_reals(nrxxs, cprim_last_eff-cprim_first+1),tmp_reals_jj(nrxxs))
allocate(tmp_reals(dffts%nnr, cprim_last_eff-cprim_first+1),tmp_reals_jj(dffts%nnr))
allocate(tmp_g(ngm))
! allocate(sca_vec(n_set_new))
write(stdout,*) 'ATTENZIONE3'
......@@ -490,7 +490,7 @@ subroutine create_vcw_overlap(n_set, orthonorm,ecutoff)
CALL invfft ('Wave', psic, dffts)
tmp_reals_jj(:)= DBLE(psic(:))
tmp_prod(1:nrxxs)=tmp_reals(:,ii-cprim_first+1)*tmp_reals_jj(:)
tmp_prod(1:dffts%nnr)=tmp_reals(:,ii-cprim_first+1)*tmp_reals_jj(:)
if(doublegrid) then
call interpolate(tmp_prod,tmp_prod,1)
endif
......@@ -552,7 +552,7 @@ subroutine create_upper_states(n_set, lzero, orthonorm,ecutoff)
USE wavefunctions_module, ONLY : evc, psic
USE fft_base, ONLY : dffts, dfftp
USE fft_interfaces, ONLY : fwfft, invfft
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
USE uspp, ONLY : nkb, vkb, okvan
USE realus, ONLY : adduspos_gamma_r
USE mp, ONLY : mp_sum, mp_bcast
......@@ -639,7 +639,7 @@ subroutine create_upper_states(n_set, lzero, orthonorm,ecutoff)
fac(:)=fac(:)/omega
if(lzero .and. gstart == 2) fac(1)=0.d0
allocate(tmp_reals(nrxxs, cprim_last-cprim_first+1))
allocate(tmp_reals(dffts%nnr, cprim_last-cprim_first+1))
!put states on reals grid
do ii = cprim_first, cprim_last, 2
......@@ -694,7 +694,7 @@ subroutine create_upper_states(n_set, lzero, orthonorm,ecutoff)
!loop on delta
ndelta=(nbnd-nbnd_normal)/num_nbnd_delta
if(ndelta*num_nbnd_delta < (nbnd-nbnd_normal)) ndelta=ndelta+1
allocate(tmp_reals_up(nrxxs, num_nbnd_delta))
allocate(tmp_reals_up(dffts%nnr, num_nbnd_delta))
allocate( tmp_g(ngm_max, num_nbnd_delta))
allocate(tmp_prod(nrxx))
n_upper_tot=(ndelta-1)*num_nbnd_upper+min(nbnd-nbnd_normal-(ndelta-1)*num_nbnd_delta,num_nbnd_upper)
......@@ -740,7 +740,7 @@ subroutine create_upper_states(n_set, lzero, orthonorm,ecutoff)
!form products
do jj=1,id_states
tmp_prod(1:nrxxs)=tmp_reals(:,ii-cprim_first+1)*tmp_reals_up(:,jj)
tmp_prod(1:dffts%nnr)=tmp_reals(:,ii-cprim_first+1)*tmp_reals_up(:,jj)
if(doublegrid) then
call interpolate(tmp_prod,tmp_prod,1)
endif
......
......@@ -20,7 +20,7 @@ subroutine dft_exchange_k(nbnd_v,nbnd_s, ecutoff)
USE fft_base, ONLY : dffts, dfftp
USE fft_interfaces, ONLY : fwfft, invfft
USE gvect
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
USE uspp
USE wavefunctions_module, ONLY : psic, evc
USE cell_base, ONLY : at, bg, omega
......@@ -60,11 +60,11 @@ subroutine dft_exchange_k(nbnd_v,nbnd_s, ecutoff)
REAL(kind=DP) :: q(3),q1(3)
allocate(wfcs_s(nrxxs,nbnd_s), wfcs_vc(nrxxs,nbnd))
allocate(wfcs_s(dffts%nnr,nbnd_s), wfcs_vc(dffts%nnr,nbnd))
ALLOCATE( bec_vc( nkb, nbnd ) )
ALLOCATE( bec_s( nkb, nbnd ) )
allocate(fac(ngm))
allocate(prods(nrxxs),prod(nrxx))
allocate(prods(dffts%nnr),prod(nrxx))
allocate(ex(nbnd_s,2*n_gauss+2))!the last elements contains t=0 and conduction states
allocate(f_gauss(nks))
......@@ -319,8 +319,8 @@ subroutine dft_exchange_k(nbnd_v,nbnd_s, ecutoff)
call start_clock('k prod')
prods(:)=conjg(wfcs_s(:,ii))*wfcs_vc(:,jj)
!write(stdout,*) 'nrxxs=', nrxxs
!write(stdout,*) 'prods(1)=', prods(1), 'prodsnrxxs)=', prods(nrxxs)
!write(stdout,*) 'nrxxs=', dffts%nnr
!write(stdout,*) 'prods(1)=', prods(1), 'prodsnrxxs)=', prods(dffts%nnr)
!call flush_unit(stdout)
call stop_clock('k prod')
......@@ -524,7 +524,7 @@ subroutine dft_exchange(nbnd_v,nbnd_s,n_set)
USE fft_base, ONLY : dffts, dfftp
USE fft_interfaces, ONLY : fwfft, invfft
USE gvect
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
USE uspp
USE wavefunctions_module, ONLY : psic, evc
USE realus, ONLY : adduspos_gamma_r
......@@ -609,7 +609,7 @@ subroutine dft_exchange(nbnd_v,nbnd_s,n_set)
endif
allocate(tmpreal1(nrxxs))
allocate(tmpreal1(dffts%nnr))
allocate(tmpreal_v(nrxx,n_set))
allocate(tmpreal_s(nrxx,n_set))
allocate(prod_g(ngm))
......@@ -633,14 +633,14 @@ subroutine dft_exchange(nbnd_v,nbnd_s,n_set)
END IF
CALL invfft ('Wave', psic, dffts)
tmpreal1(1:nrxxs)=dble(psic(1:nrxxs))
tmpreal1(1:dffts%nnr)=dble(psic(1:dffts%nnr))
if(doublegrid) then
call interpolate(tmpreal_v(:,hw-(iiv-1)*n_set),tmpreal1,1)
else
tmpreal_v(:,hw-(iiv-1)*n_set)=tmpreal1(:)
endif
if ( hw < min(iiv*n_set,nbnd_v)) then
tmpreal1(1:nrxxs)=aimag(psic(1:nrxxs))
tmpreal1(1:dffts%nnr)=aimag(psic(1:dffts%nnr))
if(doublegrid) then
call interpolate(tmpreal_v(:,hw-(iiv-1)*n_set+1),tmpreal1,1)
else
......@@ -667,14 +667,14 @@ subroutine dft_exchange(nbnd_v,nbnd_s,n_set)
END IF
CALL invfft ('Wave', psic, dffts)
tmpreal1(1:nrxxs)=dble(psic(1:nrxxs))
tmpreal1(1:dffts%nnr)=dble(psic(1:dffts%nnr))
if(doublegrid) then
call interpolate(tmpreal_s(:,hw-(jjs-1)*n_set),tmpreal1,1)
else
tmpreal_s(:,hw-(jjs-1)*n_set)=tmpreal1(:)
endif
if ( hw < min(jjs*n_set,nbnd_s)) then
tmpreal1(1:nrxxs)=aimag(psic(1:nrxxs))
tmpreal1(1:dffts%nnr)=aimag(psic(1:dffts%nnr))
if(doublegrid) then
call interpolate(tmpreal_s(:,hw-(jjs-1)*n_set+1),tmpreal1,1)
else
......
......@@ -30,7 +30,7 @@ SUBROUTINE energies_xc( lda, n, m, e_xc, e_h )
USE wvfct, ONLY : igk, g2kin
USE fft_base, ONLY : dffts
USE fft_interfaces, ONLY : fwfft, invfft
USE gsmooth, ONLY : nls, nrxxs,doublegrid
USE gsmooth, ONLY : nls, doublegrid
USE gvect, ONLY : ngm, gstart, nr1, nr2, nr3, &
nrxx, nl, nlm, g, gg, ecutwfc, gcutm
USE cell_base, ONLY : alat, omega
......@@ -125,7 +125,7 @@ SUBROUTINE energies_xc( lda, n, m, e_xc, e_h )
!
CALL start_clock( 'firstfft' )
!
psic(1:nrxxs) = ( 0.D0, 0.D0 )
psic(1:dffts%nnr) = ( 0.D0, 0.D0 )
!
psic(nls(igk(1:n))) = evc(1:n,ibnd)
!
......@@ -135,7 +135,7 @@ SUBROUTINE energies_xc( lda, n, m, e_xc, e_h )
!
! ... product with the potential vrs = (vltot+vr) on the smooth grid
!
psic(1:nrxxs) = psic(1:nrxxs) * vrs(1:nrxxs,current_spin)
psic(1:dffts%nnr) = psic(1:dffts%nnr) * vrs(1:dffts%nnr,current_spin)
!
! ... back to reciprocal space
!
......@@ -241,10 +241,10 @@ SUBROUTINE energies_xc( lda, n, m, e_xc, e_h )
deallocate(hpsi,psi,becp%r)
endif
!
allocate(psi_r(nrxx),psi_rs(nrxxs))
allocate(psi_r(nrxx),psi_rs(dffts%nnr))
!
iunwfcreal=find_free_unit()
CALL diropn( iunwfcreal, 'real_whole', nrxxs, exst )
CALL diropn( iunwfcreal, 'real_whole', dffts%nnr, exst )
!
!calculate xc potential on fine grid
!
......@@ -268,7 +268,7 @@ SUBROUTINE energies_xc( lda, n, m, e_xc, e_h )
do ibnd=1,m!loop on states
!read from disk wfc on coarse grid
!
CALL davcio( psi_rs, nrxxs, iunwfcreal, ibnd, -1)
CALL davcio( psi_rs, dffts%nnr, iunwfcreal, ibnd, -1)
!
!
if(doublegrid) then
......@@ -326,7 +326,7 @@ SUBROUTINE energies_xc( lda, n, m, e_xc, e_h )
!
do ibnd=1,m!loop on states
!read from disk wfc on coarse grid
CALL davcio( psi_rs,nrxxs,iunwfcreal,ibnd,-1)
CALL davcio( psi_rs,dffts%nnr,iunwfcreal,ibnd,-1)
if(doublegrid) then
call interpolate(psi_r,psi_rs,1)
else
......
......@@ -17,11 +17,9 @@ subroutine matrix_wannier_gamma_big( matsincos, ispin, n_set, itask )
USE uspp, ONLY : okvan, nkb
USE io_files, ONLY : find_free_unit, diropn
USE io_global, ONLY : stdout
USE gsmooth, ONLY : nrxxs, doublegrid
USE smooth_grid_dimensions,ONLY: nr3s
USE smooth_grid_dimensions,ONLY: nrxxs
USE realus, ONLY : qsave, box,maxbox
USE gvect, ONLY : nr1, nr2, nr3, nr1x, nr2x, &
nr3x, nrxx
USE gvect, ONLY : nr1, nr2, nr3, nr1x, nr2x, nr3x, nrxx
USE wannier_gw, ONLY : becp_gw, expgsave, becp_gw_c, maxiter2,num_nbnd_first,num_nbndv,nbnd_normal
USE ions_base, ONLY : nat, ntyp => nsp, ityp
USE uspp_param, ONLY : upf, lmaxq, nh, nhm
......@@ -64,17 +62,6 @@ subroutine matrix_wannier_gamma_big( matsincos, ispin, n_set, itask )
allocate(tmprealis(nrxxs,n_set),tmprealjs(nrxxs,n_set), tmpreal(nrxxs))
allocate(tmpexp2(nrxxs,6))
! set npp for not parallel case
! I don't think this is necessary - PG
#ifndef __PARA
dfftp%npp(1)=nr3
dffts%npp(1)=nr3s
#endif
!set up exponential grid
tmpexp2(:,:)=(0.d0,0.d0)
......
......@@ -22,7 +22,7 @@ SUBROUTINE product_wannier(nbndv)
USE io_files, ONLY : prefix
USE io_files, ONLY : tmp_dir, iunwfc, iunigk, diropn
USE io_global, ONLY : stdout
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
use mp_global, ONLY : nproc_pool, me_pool
USE kinds, ONLY : DP
USE us
......@@ -84,7 +84,7 @@ SUBROUTINE product_wannier(nbndv)
if(okvan .and. lsmallgrid) write(stdout,*) 'ATTENTION: USPP AND SMALLGRID'
allocate(tmpspacei(nrxx),tmpspacej(nrxx),tmpreal(nrxx),tmpreal2(nrxx))
allocate(tmpspacejs(nrxxs),tmpspacec(nrxx))
allocate(tmpspacejs(dffts%nnr),tmpspacec(nrxx))
numw_prod=0
......
......@@ -28,7 +28,7 @@ SUBROUTINE product_wannier_para(nbndv, lcomplete, ene_loc, lambda)
USE io_files, ONLY : prefix
USE io_files, ONLY : tmp_dir, iunwfc, iunigk, diropn
USE io_global, ONLY : stdout, ionode
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
use mp_global, ONLY : nproc_pool, me_pool
USE kinds, ONLY : DP
USE us
......@@ -121,7 +121,7 @@ SUBROUTINE product_wannier_para(nbndv, lcomplete, ene_loc, lambda)
if(okvan .and. lsmallgrid) write(stdout,*) 'ATTENTION: USPP AND SMALLGRID'
allocate(tmpspacei(nrxx,nbndv),tmpspacej(nrxx),tmpreal(nrxx),tmpreal2(nrxx))
allocate(tmpspacejs(nrxxs),tmpspacec(nrxx))
allocate(tmpspacejs(dffts%nnr),tmpspacec(nrxx))
numw_prod=0
......
......@@ -28,7 +28,7 @@
USE io_files, ONLY : prefix
USE io_files, ONLY : tmp_dir, iunwfc, iunigk, diropn
USE io_global, ONLY : stdout, ionode
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
use mp_global, ONLY : nproc_pool, me_pool
USE kinds, ONLY : DP
USE us
......@@ -116,7 +116,7 @@
if(okvan .and. lsmallgrid) write(stdout,*) 'ATTENTION: USPP AND SMALLGRID'
allocate(tmpspacei(nrxx,num_nbndc_set),tmpspacej(nrxx),tmpreal(nrxx),tmpreal2(nrxx))
allocate(tmpspacejs(nrxxs),tmpspacec(nrxx))
allocate(tmpspacejs(dffts%nnr),tmpspacec(nrxx))
numw_prod_c=0
......
......@@ -14,7 +14,7 @@ subroutine ultra_external( nbnd_start, nbnd_end, radius, itask)
USE io_files, ONLY : find_free_unit,nwordwfc, iunwfc, prefix, diropn
USE io_global, ONLY : stdout, ionode_id
USE gsmooth, ONLY : nls, nlsm, nrxxs, doublegrid
USE gsmooth, ONLY : nls, nlsm, doublegrid
USE gvect, ONLY : nr1, nr2, nr3, nr1x, nr2x, &
nr3x, nrxx, gstart
use mp_global, ONLY : nproc_pool, me_pool
......@@ -119,7 +119,7 @@ subroutine ultra_external( nbnd_start, nbnd_end, radius, itask)
endif
allocate(op(nrxxs), op_wfc(npwx))
allocate(op(dffts%nnr), op_wfc(npwx))
!loop on wavefunctions
do ii=nbnd_start,nbnd_end
......@@ -243,7 +243,7 @@ subroutine ultra_external( nbnd_start, nbnd_end, radius, itask)
deallocate(wfc_mlwf,ultra_trans)
!rotate wavefunctions
! ALLOCATE( evc( npwx, nbnd ) )
allocate(tmpreal(nrxx),tmpreals(nrxxs))
allocate(tmpreal(nrxx),tmpreals(dffts%nnr))
! CALL davcio(evc,nwordwfc,iunwfc,1,-1)
allocate(u_trans_old(nbnd_normal,nbnd_normal))
......
......@@ -15,8 +15,9 @@ SUBROUTINE ultralocalization(nbndv,ultra_thr,isubspace,max_array)
USE io_files, ONLY : find_free_unit, diropn
USE io_global, ONLY : stdout
USE smooth_grid_dimensions,ONLY: nr1s, nr2s, nr3s, nr1sx, nr2sx, nr3sx