ggen no longer uses variables from module gvect: all g-vector related variables

are passed as arguments. Note that ngm is likely redundant since it is inside
the fft descriptor. Nothing should change apart from the call to ggen
This commit is contained in:
Paolo Giannozzi 2018-01-05 19:06:07 +01:00
parent 87890fb1c4
commit 4ea5c0bda1
7 changed files with 35 additions and 21 deletions

View File

@ -30,7 +30,8 @@
use ions_base, only: nat
USE recvec_subs, ONLY: ggen, ggens
USE gvect, ONLY: mill_g, eigts1,eigts2,eigts3, g, gg, &
ecutrho, gcutm, gvect_init, mill
ecutrho, gcutm, gvect_init, mill, &
ig_l2g, gstart, ngm, ngm_g
use gvecs, only: gcutms, gvecs_init, ngms
use gvecw, only: gkcut, gvecw_init, g2kin_init
USE smallbox_subs, ONLY: ggenb
@ -170,18 +171,22 @@
WRITE( stdout,'(3X,"Reference Cell alat =",F14.8,1X,"A.U.")' ) ref_alat
!
IF( smallmem ) THEN
CALL ggen( dfftp, gamma_only, ref_at, ref_bg, no_global_sort = .TRUE. )
CALL ggen( dfftp, gamma_only, ref_at, ref_bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart, no_global_sort = .TRUE. )
ELSE
CALL ggen( dfftp, gamma_only, ref_at, ref_bg )
CALL ggen( dfftp, gamma_only, ref_at, ref_bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
END IF
CALL ggens( dffts, gamma_only, ref_at, g, gg, mill, gcutms, ngms )
!
ELSE
!
IF( smallmem ) THEN
CALL ggen( dfftp, gamma_only, at, bg, no_global_sort = .TRUE. )
CALL ggen( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart, no_global_sort = .TRUE. )
ELSE
CALL ggen( dfftp, gamma_only, at, bg )
CALL ggen( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
END IF
CALL ggens( dffts, gamma_only, at, g, gg, mill, gcutms, ngms )
!

View File

@ -12,9 +12,6 @@ MODULE recvec_subs
! ... subroutines generating G-vectors and variables nl* needed to map
! ... G-vector components onto the FFT grid(s) in reciprocal space
! ... Most important dependencies in next module (FIXME: to be removed)
USE gvect, ONLY : ig_l2g, g, gg, ngm, ngm_g, gcutm, mill, gstart
!
USE kinds, ONLY : dp
USE fft_types, ONLY: fft_stick_index, fft_type_descriptor
@ -30,7 +27,8 @@ CONTAINS
!=----------------------------------------------------------------------=
!
!-----------------------------------------------------------------------
SUBROUTINE ggen ( dfftp, gamma_only, at, bg, no_global_sort )
SUBROUTINE ggen ( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart, no_global_sort )
!----------------------------------------------------------------------
!
! This routine generates all the reciprocal lattice vectors
@ -45,12 +43,17 @@ CONTAINS
!
TYPE(fft_type_descriptor),INTENT(INOUT) :: dfftp
LOGICAL, INTENT(IN) :: gamma_only
REAL(DP), INTENT(IN) :: at(3,3), bg(3,3)
LOGICAL, OPTIONAL, INTENT(IN) :: no_global_sort
REAL(DP), INTENT(IN) :: at(3,3), bg(3,3), gcutm
INTEGER, INTENT(IN) :: ngm_g
INTEGER, INTENT(INOUT) :: ngm
REAL(DP), INTENT(OUT) :: g(:,:), gg(:)
INTEGER, INTENT(OUT) :: mill(:,:), ig_l2g(:), gstart
! if no_global_sort is present (and it is true) G vectors are sorted only
! locally and not globally. In this case no global array needs to be
! allocated and sorted: saves memory and a lot of time for large systems.
!
LOGICAL, OPTIONAL, INTENT(IN) :: no_global_sort
!
! here a few local variables
!
REAL(DP) :: t (3), tt

View File

@ -40,7 +40,7 @@ SUBROUTINE chdens (plot_files,plot_num)
USE scatter_mod, ONLY : scatter_grid
USE fft_interfaces, ONLY : fwfft
USE fft_types, ONLY : fft_type_allocate
USE gvect, ONLY : ngm, g, gcutm, gg, mill
USE gvect, ONLY : ngm, g, gcutm, gg, mill, ig_l2g, ngm_g, gstart
USE gvecs, ONLY : gcutms, doublegrid, dual, ecuts, ngms
USE recvec_subs,ONLY: ggen, ggens
USE gvecw, ONLY: ecutwfc
@ -462,7 +462,8 @@ SUBROUTINE chdens (plot_files,plot_num)
!
! and rebuild G-vectors in reciprocal space
!
CALL ggen ( dfftp, gamma_only, at, bg )
CALL ggen ( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
CALL ggens( dffts, gamma_only, at, g, gg, mill, gcutms, ngms )
!
! here we compute the fourier components of the quantity to plot

View File

@ -4756,7 +4756,8 @@ END SUBROUTINE compute_becpsi
END IF
!
IF (first_data_structure_change) THEN
CALL ggen ( dfftp, gamma_only, at, bg )
CALL ggen ( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
CALL ggens( dffts, gamma_only, at, g, gg, mill, gcutms, ngms )
allocate( ig_l2g_exx(ngm), g_exx(3,ngm), gg_exx(ngm) )
allocate( mill_exx(3,ngm), nl_exx(ngm) )

View File

@ -13,7 +13,7 @@ SUBROUTINE init_run()
USE symme, ONLY : sym_rho_init
USE wvfct, ONLY : nbnd, et, wg, btype
USE control_flags, ONLY : lmd, gamma_only, smallmem, ts_vdw
USE gvect, ONLY : g, gg, mill, &
USE gvect, ONLY : g, gg, mill, gcutm, ig_l2g, ngm, ngm_g, &
gstart ! to be comunicated to the Solvers if gamma_only
USE gvecs, ONLY : gcutms, ngms
USE cell_base, ONLY : at, bg, set_h_ainv
@ -65,9 +65,11 @@ SUBROUTINE init_run()
! ... generate reciprocal-lattice vectors and fft indices
!
IF( smallmem ) THEN
CALL ggen( dfftp, gamma_only, at, bg, no_global_sort = .TRUE. )
CALL ggen( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart, no_global_sort = .TRUE. )
ELSE
CALL ggen( dfftp, gamma_only, at, bg )
CALL ggen( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
END IF
CALL ggens( dffts, gamma_only, at, g, gg, mill, gcutms, ngms )
if (gamma_only) THEN

View File

@ -129,7 +129,7 @@ SUBROUTINE read_xml_file_internal(withbs)
USE fft_interfaces, ONLY : fwfft
USE fft_types, ONLY : fft_type_allocate
USE recvec_subs, ONLY : ggen, ggens
USE gvect, ONLY : gg, ngm, g, gcutm, mill, &
USE gvect, ONLY : gg, ngm, g, gcutm, mill, ngm_g, ig_l2g, &
eigts1, eigts2, eigts3, nl, gstart
USE Coul_cut_2D, ONLY : do_cutoff_2D, cutoff_fact
USE fft_base, ONLY : dfftp, dffts
@ -296,7 +296,8 @@ SUBROUTINE read_xml_file_internal(withbs)
CALL pre_init()
CALL data_structure ( gamma_only )
CALL allocate_fft()
CALL ggen ( dfftp, gamma_only, at, bg )
CALL ggen ( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
CALL ggens( dffts, gamma_only, at, g, gg, mill, gcutms, ngms )
IF (do_comp_esm) THEN
CALL pw_readfile( 'esm', ierr )

View File

@ -120,7 +120,7 @@ SUBROUTINE read_xml_file ( )
USE fft_interfaces, ONLY : fwfft
USE fft_types, ONLY : fft_type_allocate
USE recvec_subs, ONLY : ggen, ggens
USE gvect, ONLY : gg, ngm, g, gcutm, mill, &
USE gvect, ONLY : gg, ngm, g, gcutm, mill, ngm_g, ig_l2g, &
eigts1, eigts2, eigts3, gstart
USE fft_base, ONLY : dfftp, dffts
USE gvecs, ONLY : ngms, gcutms
@ -276,7 +276,8 @@ SUBROUTINE read_xml_file ( )
CALL pre_init()
CALL data_structure ( gamma_only )
CALL allocate_fft()
CALL ggen ( dfftp, gamma_only, at, bg )
CALL ggen ( dfftp, gamma_only, at, bg, gcutm, ngm_g, ngm, &
g, gg, mill, ig_l2g, gstart )
CALL ggens( dffts, gamma_only, at, g, gg, mill, gcutms, ngms )
IF (do_comp_esm) THEN
CALL init_vars_from_schema ( 'esm', ierr, output_obj, parinfo_obj, geninfo_obj )