Commit 94a7c9d5 authored by Marco Govoni's avatar Marco Govoni
Browse files

Removed variable igq_l2g from module. Made local to every workspace.

parent 6dd55121
......@@ -18,7 +18,7 @@ SUBROUTINE dfpt (m,dvg,dng,tr2)
USE io_global, ONLY : stdout
USE wvfct, ONLY : nbnd,g2kin,et
USE fft_base, ONLY : dfftp,dffts
USE gvect, ONLY : nl,gstart,ig_l2g,g,ngm
USE gvect, ONLY : nl,gstart,g,ngm
USE wavefunctions_module, ONLY : evc,psic
USE gvecs, ONLY : ngms
USE gvecw, ONLY : gcutw
......@@ -337,7 +337,7 @@ SUBROUTINE dfpt_q (m,dvg,dng,tr2,iq)
USE io_global, ONLY : stdout
USE wvfct, ONLY : nbnd,g2kin,et
USE fft_base, ONLY : dfftp,dffts
USE gvect, ONLY : nl,nl,gstart,ig_l2g,g,ngm
USE gvect, ONLY : nl,nl,gstart,g,ngm
USE wavefunctions_module, ONLY : evc,psic
USE gvecs, ONLY : ngms,nls
USE gvecw, ONLY : gcutw
......
......@@ -17,7 +17,7 @@ MODULE pdep_io
USE kinds, ONLY : DP
USE mp_global, ONLY : me_bgrp,root_bgrp,nproc_bgrp,intra_bgrp_comm,my_pool_id,my_bgrp_id,inter_bgrp_comm,inter_pool_comm,&
& intra_pool_comm
USE westcom, ONLY : npwq, npwq_g, npwqx, ngq, ngq_g, npwqx, igq_l2g, igq_l2g_kdip
USE westcom, ONLY : npwq, npwq_g, npwqx, ngq, ngq_g, npwqx, igq_l2g_kdip
USE gvect, ONLY : ig_l2g
USE json_module, ONLY : json_file
USE base64_module
......
......@@ -38,8 +38,8 @@ MODULE scratch_area
INTEGER, ALLOCATABLE :: ngq(:) ! equivalent of ngk(:) --> ex. ngq(iq) = LOCAL number of PW for (q+G) (global in iq)
INTEGER, ALLOCATABLE :: igq_q(:,:) ! equivalent of igk_k(:,:) --> ex. igq_q(ig,iq) = map for FFT (global in iq )
INTEGER, ALLOCATABLE :: ngq_g(:) ! equivalent of ngk_g(:) --> ex. ngk_g(iq) = TOTAL number of PW for (q+G) (global in iq)
INTEGER, ALLOCATABLE :: igq_l2g(:,:) ! equivalent of igk_l2g(:,:) --> ex. iqq_l2g(ig,iq) => correspondence between the local (q+G) index and the global G index
INTEGER, ALLOCATABLE :: igq_l2g_kdip(:,:) ! equivalent of igk_l2g_kdip(:,:) --> ex. iqq_l2g_kdip(ig,iq) => correspondence between the local (q+G) index and the global (q+G) index
! INTEGER, ALLOCATABLE :: igq_l2g(:,:) ! equivalent of igk_l2g(:,:) --> ex. iqq_l2g(ig,iq) => correspondence between the local (q+G) index and the global G index
INTEGER, ALLOCATABLE :: igq_l2g_kdip(:,:) ! equivalent of igk_l2g_kdip(:,:) --> ex. iqq_l2g_kdip(ig,iq) => correspondence between the global order of (q+G) and the local index for (q+G).
!
! EPSILON
REAL(DP),ALLOCATABLE :: d_epsm1_ifr(:,:,:)
......
......@@ -15,7 +15,7 @@ SUBROUTINE set_npwq()
!-----------------------------------------------------------------------
!
USE kinds, ONLY : DP
USE westcom, ONLY : npwq,npwq_g,npwqx,ngq,ngq_g,igq_q,igq_l2g,igq_l2g_kdip, &
USE westcom, ONLY : npwq,npwq_g,npwqx,ngq,ngq_g,igq_q, &
& l_use_ecutrho,fftdriver
USE mp, ONLY : mp_max, mp_sum
USE mp_global, ONLY : intra_bgrp_comm, inter_bgrp_comm, nbgrp, inter_pool_comm, intra_pool_comm
......@@ -32,8 +32,9 @@ SUBROUTINE set_npwq()
!
INTEGER, EXTERNAL :: n_plane_waves
REAL(DP), ALLOCATABLE :: gq2kin(:)
INTEGER :: iq
INTEGER :: iq, ig
INTEGER :: npwqx_g
INTEGER, ALLOCATABLE :: igq_l2g(:)
!
IF ( gamma_only ) THEN
!
......@@ -62,14 +63,16 @@ SUBROUTINE set_npwq()
ALLOCATE( gq2kin(npwqx) )
ALLOCATE( ngq(q_grid%nps) )
ALLOCATE( igq_q(npwqx,q_grid%nps) )
ALLOCATE( igq_l2g(npwqx,q_grid%nps) )
!ALLOCATE( igq_l2g(npwqx,q_grid%nps) )
igq_q(:,:) = 0
igq_l2g(:,:) = 0
!igq_l2g(:,:) = 0
DO iq = 1, q_grid%nps
CALL gq_sort( q_grid%xp_cart(:,iq), ngm, g, gcutw, ngq(iq), igq_q(:,iq), gq2kin )
CALL gq_l2gmap( ngm, ig_l2g(1), ngq(iq), igq_q(1,iq), igq_l2g(1,iq) )
!CALL gq_l2gmap( ngm, ig_l2g(1), ngq(iq), igq_q(1,iq), igq_l2g(1,iq) )
ENDDO
!
DEALLOCATE(gq2kin)
!
! ... compute the global number of q+G vectors for each q-point
!
ALLOCATE( ngq_g(q_grid%nps) )
......@@ -83,7 +86,13 @@ SUBROUTINE set_npwq()
!
! ... compute the maximum G vector index among all q+G in processors
!
npwq_g = MAXVAL( igq_l2g(:,:) )
npwq_g = 0
DO iq = 1, q_grid%nps
DO ig = 1, ngq(iq)
npwq_g = MAX( npwq_g, ig_l2g(igq_q(ig,iq)) )
ENDDO
ENDDO
!npwq_g = MAXVAL( igq_l2g(:,:) )
!
CALL mp_max( npwq_g, inter_bgrp_comm )
CALL mp_max( npwq_g, intra_bgrp_comm )
......@@ -98,11 +107,14 @@ SUBROUTINE set_npwq()
igq_l2g_kdip(:,:) = 0
!
DO iq = 1, q_grid%nps
CALL gq_l2gmap_kdip( npwq_g, ngq_g(iq), ngq(iq), igq_l2g(1,iq), igq_l2g_kdip(1,iq) )
ALLOCATE( igq_l2g(ngq(iq)) )
DO ig = 1, ngq(iq)
igq_l2g(ig) = ig_l2g( igq_q(ig,iq) )
ENDDO
CALL gq_l2gmap_kdip( npwq_g, ngq_g(iq), ngq(iq), igq_l2g, igq_l2g_kdip(1,iq) )
DEALLOCATE( igq_l2g )
ENDDO
!
DEALLOCATE(gq2kin)
!
ENDIF
!
END SUBROUTINE
......@@ -179,31 +191,31 @@ SUBROUTINE gq_sort( q, ngm, g, ecut, ngq, igq, gq )
END SUBROUTINE
!
!----------------------------------------------------------------------------
SUBROUTINE gq_l2gmap( ngm, ig_l2g, ngk, igk, igk_l2g )
!----------------------------------------------------------------------------
!
! ... This subroutine maps local G+k index to the global G vector index
! ... the mapping is used to collect wavefunctions subsets distributed
! ... across processors.
! ... Written by Carlo Cavazzoni
!
IMPLICIT NONE
!
! ... Here the dummy variables
!
INTEGER, INTENT(IN) :: ngm, ngk, igk(ngk), ig_l2g(ngm)
INTEGER, INTENT(OUT) :: igk_l2g(ngk)
INTEGER :: ig
!
! ... input: mapping between local and global G vector index
!
DO ig = 1, ngk
!
igk_l2g(ig) = ig_l2g(igk(ig))
!
END DO
!
END SUBROUTINE
!SUBROUTINE gq_l2gmap( ngm, ig_l2g, ngk, igk, igk_l2g )
! !----------------------------------------------------------------------------
! !
! ! ... This subroutine maps local G+k index to the global G vector index
! ! ... the mapping is used to collect wavefunctions subsets distributed
! ! ... across processors.
! ! ... Written by Carlo Cavazzoni
! !
! IMPLICIT NONE
! !
! ! ... Here the dummy variables
! !
! INTEGER, INTENT(IN) :: ngm, ngk, igk(ngk), ig_l2g(ngm)
! INTEGER, INTENT(OUT) :: igk_l2g(ngk)
! INTEGER :: ig
! !
! ! ... input: mapping between local and global G vector index
! !
! DO ig = 1, ngk
! !
! igk_l2g(ig) = ig_l2g(igk(ig))
! !
! END DO
! !
!END SUBROUTINE
!
!-----------------------------------------------------------------------
SUBROUTINE gq_l2gmap_kdip( npw_g, ngk_g, ngk, igk_l2g, igk_l2g_kdip )
......
......@@ -33,7 +33,7 @@ SUBROUTINE do_sxx ( )
USE distribution_center, ONLY : pert
USE control_flags, ONLY : gamma_only
USE gvecs, ONLY : ngms
USE gvect, ONLY : g,nl,gstart,ngm_g,ig_l2g,ngm
USE gvect, ONLY : g,nl,gstart,ngm_g,ngm
USE cell_base, ONLY : omega,at,alat
USE noncollin_module, ONLY : noncolin,npol
USE mp_world, ONLY : mpime,root
......
......@@ -21,7 +21,7 @@ SUBROUTINE westpp_setup
USE mp_global, ONLY : intra_bgrp_comm
USE pwcom, ONLY : nbnd
USE kinds, ONLY : DP
USE gvect, ONLY : gstart,g,ig_l2g
USE gvect, ONLY : gstart,g
USE io_files, ONLY : tmp_dir
USE distribution_center, ONLY : pert,macropert,ifr,rfr,aband
USE class_idistribute, ONLY : idistribute
......
......@@ -22,7 +22,7 @@ SUBROUTINE calc_exx2_gamma( sigma_exx, nb1, nb2 )
USE io_global, ONLY : stdout, ionode
USE io_files, ONLY : nwordwfc, iunwfc
USE scf, ONLY : rho, rho_core, rhog_core
USE gvect, ONLY : g,nl,gstart,ngm_g,ig_l2g,ngm
USE gvect, ONLY : g,nl,gstart,ngm_g,ngm
USE gvecs, ONLY : ngms
USE gvecw, ONLY : gcutw
USE cell_base, ONLY : tpiba2,omega,tpiba,at,alat
......@@ -226,7 +226,7 @@ SUBROUTINE calc_exx2_k( sigma_exx, nb1, nb2 )
USE io_global, ONLY : stdout, ionode
USE io_files, ONLY : nwordwfc, iunwfc
USE scf, ONLY : rho, rho_core, rhog_core
USE gvect, ONLY : g,nl,gstart,ngm_g,ig_l2g,ngm
USE gvect, ONLY : g,nl,gstart,ngm_g,ngm
USE gvecs, ONLY : ngms
USE gvecw, ONLY : gcutw
USE cell_base, ONLY : tpiba2,omega,tpiba,at,alat
......
......@@ -22,7 +22,7 @@ SUBROUTINE calc_vxc( sigma_vxcl, sigma_vxcnl )
USE io_global, ONLY : stdout, ionode
USE io_files, ONLY : nwordwfc, iunwfc
USE scf, ONLY : rho, rho_core, rhog_core
USE gvect, ONLY : g,nl,gstart,ngm_g,ig_l2g,ngm
USE gvect, ONLY : g,nl,gstart,ngm_g,ngm
USE gvecw, ONLY : gcutw
USE cell_base, ONLY : tpiba2
USE fft_base, ONLY : dfftp,dffts
......
......@@ -21,7 +21,7 @@ SUBROUTINE get_brak_hyper_parallel(dvpsi,NRHS,NLSTEPS,x,brak,idistr)
USE random_numbers, ONLY : randy
USE mp, ONLY : mp_sum,mp_circular_shift_left
USE io_global, ONLY : stdout, ionode
USE gvect, ONLY : g,nl,gstart,ngm_g,ig_l2g
USE gvect, ONLY : g,nl,gstart,ngm_g
USE cell_base, ONLY : tpiba2
USE fft_base, ONLY : dfftp,dffts
USE fft_interfaces, ONLY : fwfft, invfft
......@@ -143,7 +143,7 @@ SUBROUTINE get_brak_hyper_parallel_complex(dvpsi,NRHS,NLSTEPS,x,brak,idistr)
USE random_numbers, ONLY : randy
USE mp, ONLY : mp_sum,mp_circular_shift_left
USE io_global, ONLY : stdout, ionode
USE gvect, ONLY : g,nl,gstart,ngm_g,ig_l2g
USE gvect, ONLY : g,nl,gstart,ngm_g
USE cell_base, ONLY : tpiba2
USE fft_base, ONLY : dfftp,dffts
USE fft_interfaces, ONLY : fwfft, invfft
......
......@@ -42,7 +42,7 @@ SUBROUTINE solve_wfreq_gamma(l_read_restart,l_generate_plot)
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast,mp_barrier,mp_sum
USE io_global, ONLY : stdout,ionode
USE gvect, ONLY : g,ngm,gstart,ig_l2g
USE gvect, ONLY : g,ngm,gstart
USE gvecw, ONLY : gcutw
USE cell_base, ONLY : tpiba2,bg,omega
USE fft_base, ONLY : dffts
......@@ -616,7 +616,7 @@ SUBROUTINE solve_wfreq_k(l_read_restart,l_generate_plot)
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_bcast,mp_barrier,mp_sum
USE io_global, ONLY : stdout,ionode
USE gvect, ONLY : g,ngm,gstart,ig_l2g
USE gvect, ONLY : g,ngm,gstart
USE gvecw, ONLY : gcutw
USE cell_base, ONLY : tpiba2,bg,omega
USE fft_base, ONLY : dffts
......
......@@ -23,7 +23,7 @@ SUBROUTINE wfreq_setup
USE mp_global, ONLY : intra_bgrp_comm
USE pwcom, ONLY : nbnd,nks
USE kinds, ONLY : DP
USE gvect, ONLY : gstart,g,ig_l2g
USE gvect, ONLY : gstart,g
USE io_files, ONLY : tmp_dir
USE distribution_center, ONLY : pert,macropert,ifr,rfr,aband
USE class_idistribute, ONLY : idistribute
......
......@@ -1168,7 +1168,7 @@ SUBROUTINE do_randomize_q (amat, mglobalstart, mglobalend, iq)
USE kinds, ONLY : DP
USE random_numbers, ONLY : randy
USE gvect, ONLY : g,gstart,ngm_g,ig_l2g
USE westcom, ONLY : dvg,npwqx,npwq,igq_q,igq_l2g
USE westcom, ONLY : dvg,npwqx,npwq,igq_q
USE constants, ONLY : tpi
USE cell_base, ONLY : tpiba2
USE mp, ONLY : mp_barrier
......@@ -1221,8 +1221,8 @@ SUBROUTINE do_randomize_q (amat, mglobalstart, mglobalend, iq)
qq(:) = q(:) + g(:,ig)
gnorm2 = (qq(1)**2 + qq(2)**2 + qq(3)**2) * tpiba2
IF ( gnorm2 < 1.d-8 ) CYCLE
rr = random_num_debug(1,igq_l2g(ig,iq))
arg = tpi * random_num_debug(2,igq_l2g(ig,iq))
rr = random_num_debug(1,ig_l2g(igq_q(ig,iq)))
arg = tpi * random_num_debug(2,ig_l2g(igq_q(ig,iq)))
amat(ig,il1) = CMPLX( rr*COS( arg ), rr*SIN( arg ), KIND=DP) / &
( ( q(1)+g(1,igq_q(ig,iq)) )*( q(1)+g(1,igq_q(ig,iq)) ) + &
( q(2)+g(2,igq_q(ig,iq)) )*( q(2)+g(2,igq_q(ig,iq)) ) + &
......
......@@ -20,7 +20,7 @@ SUBROUTINE wstat_setup
USE mp, ONLY : mp_max
USE mp_global, ONLY : intra_bgrp_comm
USE kinds, ONLY : DP
USE gvect, ONLY : gstart,g,ig_l2g,ngm,ngmx
USE gvect, ONLY : gstart,g,ngm,ngmx
USE constants, ONLY : e2,fpi
USE cell_base, ONLY : tpiba2
USE io_files, ONLY : tmp_dir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment