More CP cleanup

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7361 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2010-12-28 20:25:38 +00:00
parent 7d93133797
commit f4c60249fe
8 changed files with 80 additions and 108 deletions

View File

@ -71,6 +71,7 @@ read_pseudo.o \
restart.o \
restart_sub.o \
runcp.o \
smallbox.o \
spline.o \
stop_run.o \
stress.o \

View File

@ -30,7 +30,7 @@
use smallbox_grid_dimensions, only: nr1b, nr2b, nr3b, nr1bx,nr2bx,nr3bx,&
smallbox_grid_init,smallbox_grid_info
use smooth_grid_dimensions, only: nr1s, nr2s, nr3s, nr1sx, nr2sx, nr3sx, nrxxs
USE grid_subroutines, ONLY: realspace_grids_init, realspace_grids_para
USE grid_subroutines, ONLY: realspace_grids_init, realspace_grids_info
USE gvect, ONLY: mill_g, g2_g, eigts1,eigts2,eigts3
USE recvecs_subroutines, ONLY: recvecs_init
use ions_base, only: nat
@ -41,7 +41,7 @@
USE fft_base, ONLY: dfftp, dffts
USE fft_scalar, ONLY: cft_b_omp_init
USE stick_base, ONLY: pstickset
USE control_flags, ONLY: tdipole
USE control_flags, ONLY: tdipole, gamma_only
USE berry_phase, ONLY: berry_setup
USE electrons_module, ONLY: bmeshset
USE problem_size, ONLY: cpsizes
@ -112,20 +112,11 @@
!
! ... set the sticks mesh and distribute g vectors among processors
! ... pstickset lso sets the local real-space grid dimensions
!
if( ionode ) then
! debug
!write(6,*) alat
!write(6,*) a1
!write(6,*) a2
!write(6,*) a3
!write(6,*)gcut, gkcut, gcut
!write(6,*) nr1, nr2, nr3, nr1x, nr2x, nr3x, nr1s, nr2s, nr3s, nr1sx, nr2sx, nr3sx, ngw_ , ngm_ , ngs_
end if
CALL pstickset( dfftp, dffts, alat, a1, a2, a3, gcutm, gkcut, gcutms,&
nr1, nr2, nr3, nr1x, nr2x, nr3x, nr1s, nr2s, nr3s, nr1sx, nr2sx, &
nr3sx, ngw_ , ngm_ , ngs_ )
CALL pstickset( gamma_only, b1, b2, b3, gcutm, gkcut, gcutms, &
dfftp, dffts, ngw_ , ngm_ , ngs_ )
!
!
! ... Initialize reciprocal space local and global dimensions
@ -134,9 +125,9 @@ end if
!
CALL recvecs_init( ngm_ , ngw_ , ngs_ )
!
! ... Initialize (local) real space dimensions
! ... Print real-space grid dimensions
!
CALL realspace_grids_para( dfftp, dffts, nproc_bgrp )
CALL realspace_grids_info ( dfftp, dffts, nproc_bgrp )
CALL smallbox_grid_info ( )
!
! ... generate g-space

View File

@ -81,7 +81,6 @@ chargedensity.o : ../Modules/mp.o
chargedensity.o : ../Modules/mp_global.o
chargedensity.o : ../Modules/parallel_include.o
chargedensity.o : ../Modules/recvec.o
chargedensity.o : ../Modules/smallbox.o
chargedensity.o : ../Modules/uspp.o
chargedensity.o : ../Modules/xml_io_base.o
chargedensity.o : boxgrid.o
@ -91,6 +90,7 @@ chargedensity.o : gvecb.o
chargedensity.o : gvecw.o
chargedensity.o : mainvar.o
chargedensity.o : modules.o
chargedensity.o : smallbox.o
chargedensity.o : wannier_base.o
cp_autopilot.o : ../Modules/autopilot.o
cp_autopilot.o : ../Modules/control_flags.o
@ -121,13 +121,13 @@ cp_fpmd.o : ../Modules/kind.o
cp_fpmd.o : ../Modules/mp.o
cp_fpmd.o : ../Modules/mp_global.o
cp_fpmd.o : ../Modules/recvec.o
cp_fpmd.o : ../Modules/smallbox.o
cp_fpmd.o : ../Modules/uspp.o
cp_fpmd.o : boxgrid.o
cp_fpmd.o : cpr_mod.o
cp_fpmd.o : gvecb.o
cp_fpmd.o : gvecw.o
cp_fpmd.o : pseudopot.o
cp_fpmd.o : smallbox.o
cp_interfaces.o : ../Modules/cell_base.o
cp_interfaces.o : ../Modules/descriptors.o
cp_interfaces.o : ../Modules/griddim.o
@ -182,7 +182,6 @@ cplib.o : ../Modules/mp.o
cplib.o : ../Modules/mp_global.o
cplib.o : ../Modules/recvec.o
cplib.o : ../Modules/sic.o
cplib.o : ../Modules/smallbox.o
cplib.o : ../Modules/uspp.o
cplib.o : boxgrid.o
cplib.o : cp_interfaces.o
@ -191,6 +190,7 @@ cplib.o : gvecw.o
cplib.o : mainvar.o
cplib.o : modules.o
cplib.o : pres_ai_mod.o
cplib.o : smallbox.o
cplib_meta.o : ../Modules/cell_base.o
cplib_meta.o : ../Modules/constants.o
cplib_meta.o : ../Modules/control_flags.o
@ -226,7 +226,6 @@ cpr.o : ../Modules/mp.o
cpr.o : ../Modules/mp_global.o
cpr.o : ../Modules/printout_base.o
cpr.o : ../Modules/recvec.o
cpr.o : ../Modules/smallbox.o
cpr.o : ../Modules/timestep.o
cpr.o : ../Modules/uspp.o
cpr.o : ../Modules/wave_base.o
@ -245,6 +244,7 @@ cpr.o : mainvar.o
cpr.o : modules.o
cpr.o : ortho_base.o
cpr.o : pres_ai_mod.o
cpr.o : smallbox.o
cpr.o : wannier.o
cpr_mod.o : ../Modules/kind.o
cprstart.o : ../Modules/check_stop.o
@ -403,7 +403,6 @@ fromscra.o : ../Modules/kind.o
fromscra.o : ../Modules/mp_global.o
fromscra.o : ../Modules/printout_base.o
fromscra.o : ../Modules/recvec.o
fromscra.o : ../Modules/smallbox.o
fromscra.o : ../Modules/timestep.o
fromscra.o : ../Modules/uspp.o
fromscra.o : ../Modules/wave_base.o
@ -420,6 +419,7 @@ fromscra.o : ions_positions.o
fromscra.o : mainvar.o
fromscra.o : modules.o
fromscra.o : ortho_base.o
fromscra.o : smallbox.o
gradrho.o : ../Modules/cell_base.o
gradrho.o : ../Modules/fft_base.o
gradrho.o : ../Modules/fft_interfaces.o
@ -451,7 +451,6 @@ init.o : ../Modules/ions_base.o
init.o : ../Modules/kind.o
init.o : ../Modules/mp_global.o
init.o : ../Modules/recvec.o
init.o : ../Modules/smallbox.o
init.o : ../Modules/stick_base.o
init.o : ../Modules/task_groups.o
init.o : ../Modules/uspp.o
@ -465,6 +464,7 @@ init.o : ions_positions.o
init.o : mainvar.o
init.o : modules.o
init.o : problem_size.o
init.o : smallbox.o
init_run.o : ../Modules/cell_base.o
init_run.o : ../Modules/control_flags.o
init_run.o : ../Modules/electrons_base.o
@ -477,6 +477,7 @@ init_run.o : ../Modules/io_global.o
init_run.o : ../Modules/ions_base.o
init_run.o : ../Modules/ions_nose.o
init_run.o : ../Modules/kind.o
init_run.o : ../Modules/mp.o
init_run.o : ../Modules/printout_base.o
init_run.o : ../Modules/recvec.o
init_run.o : ../Modules/timestep.o
@ -606,7 +607,6 @@ move_electrons.o : ../Modules/energies.o
move_electrons.o : ../Modules/griddim.o
move_electrons.o : ../Modules/ions_base.o
move_electrons.o : ../Modules/kind.o
move_electrons.o : ../Modules/mp_global.o
move_electrons.o : ../Modules/recvec.o
move_electrons.o : ../Modules/uspp.o
move_electrons.o : ../Modules/wavefunctions.o
@ -648,7 +648,6 @@ nlcc.o : ../Modules/kind.o
nlcc.o : ../Modules/mp.o
nlcc.o : ../Modules/mp_global.o
nlcc.o : ../Modules/recvec.o
nlcc.o : ../Modules/smallbox.o
nlcc.o : ../Modules/uspp.o
nlcc.o : boxgrid.o
nlcc.o : cp_interfaces.o
@ -656,6 +655,7 @@ nlcc.o : gvecb.o
nlcc.o : modules.o
nlcc.o : pseudo_base.o
nlcc.o : pseudopot.o
nlcc.o : smallbox.o
nlcc.o : spline.o
ortho.o : ../Modules/control_flags.o
ortho.o : ../Modules/descriptors.o
@ -701,7 +701,6 @@ plugin_forces.o : ../Modules/io_files.o
plugin_forces.o : ../Modules/io_global.o
plugin_forces.o : ../Modules/kind.o
plugin_forces.o : ../Modules/mp.o
plugin_forces.o : ../Modules/mp_global.o
plugin_forces.o : ../Modules/plugin_flags.o
plugin_initialization.o : ../Modules/io_files.o
plugin_initialization.o : ../Modules/io_global.o
@ -782,7 +781,6 @@ pseudopot_sub.o : ../Modules/mp.o
pseudopot_sub.o : ../Modules/mp_global.o
pseudopot_sub.o : ../Modules/parameters.o
pseudopot_sub.o : ../Modules/recvec.o
pseudopot_sub.o : ../Modules/smallbox.o
pseudopot_sub.o : ../Modules/uspp.o
pseudopot_sub.o : cp_interfaces.o
pseudopot_sub.o : cpr_mod.o
@ -791,6 +789,7 @@ pseudopot_sub.o : gvecw.o
pseudopot_sub.o : modules.o
pseudopot_sub.o : pseudo_base.o
pseudopot_sub.o : pseudopot.o
pseudopot_sub.o : smallbox.o
pseudopot_sub.o : spline.o
qmatrixd.o : ../Modules/cell_base.o
qmatrixd.o : ../Modules/electrons_base.o
@ -838,7 +837,6 @@ restart.o : ../Modules/io_files.o
restart.o : ../Modules/ions_base.o
restart.o : ../Modules/kind.o
restart.o : ../Modules/mp.o
restart.o : ../Modules/mp_global.o
restart.o : ../Modules/xml_io_base.o
restart.o : cp_autopilot.o
restart.o : cp_interfaces.o
@ -856,10 +854,8 @@ restart_sub.o : ../Modules/io_global.o
restart_sub.o : ../Modules/ions_base.o
restart_sub.o : ../Modules/ions_nose.o
restart_sub.o : ../Modules/kind.o
restart_sub.o : ../Modules/mp_global.o
restart_sub.o : ../Modules/printout_base.o
restart_sub.o : ../Modules/recvec.o
restart_sub.o : ../Modules/smallbox.o
restart_sub.o : ../Modules/timestep.o
restart_sub.o : ../Modules/uspp.o
restart_sub.o : ../Modules/wave_base.o
@ -872,6 +868,7 @@ restart_sub.o : gvecw.o
restart_sub.o : ions_positions.o
restart_sub.o : mainvar.o
restart_sub.o : modules.o
restart_sub.o : smallbox.o
runcp.o : ../Modules/control_flags.o
runcp.o : ../Modules/electrons_base.o
runcp.o : ../Modules/fft_base.o
@ -888,6 +885,9 @@ runcp.o : efield.o
runcp.o : gvecw.o
runcp.o : modules.o
runcp.o : wannier.o
smallbox.o : ../Modules/constants.o
smallbox.o : ../Modules/io_global.o
smallbox.o : ../Modules/kind.o
spline.o : ../Modules/kind.o
stop_run.o : ../Modules/constraints_module.o
stop_run.o : ../Modules/control_flags.o

View File

@ -67,7 +67,6 @@ read_xml_fields.o \
recvec.o \
set_signal.o \
sic.o \
smallbox.o \
splinelib.o \
stick_base.o \
task_groups.o \

View File

@ -79,7 +79,7 @@
SAVE
PRIVATE
PUBLIC :: realspace_grids_init, realspace_grids_para
PUBLIC :: realspace_grids_init, realspace_grids_info
CONTAINS
@ -97,15 +97,15 @@
IF( nr1 == 0 .OR. nr2 == 0 .OR. nr3 == 0 ) THEN
!
! ... calculate the size of the real-space dense grid for FFT
! ... first, an estimate of nr1,nr2,nr3, nased on the max values
! ... first, an estimate of nr1,nr2,nr3, based on the max values
! ... of n_i indices in: G = i*b_1 + j*b_2 + k*b_3
! ... We use G*a_i = n_i => n_i .le. |Gmax||a_i|
!
nr1 = int (2 * sqrt (gcutm) * &
nr1 = int ( sqrt (gcutm) * &
sqrt (at(1, 1)**2 + at(2, 1)**2 + at(3, 1)**2) ) + 1
nr2 = int (2 * sqrt (gcutm) * &
nr2 = int ( sqrt (gcutm) * &
sqrt (at(1, 2)**2 + at(2, 2)**2 + at(3, 2)**2) ) + 1
nr3 = int (2 * sqrt (gcutm) * &
nr3 = int ( sqrt (gcutm) * &
sqrt (at(1, 3)**2 + at(2, 3)**2 + at(3, 3)**2) ) + 1
!
CALL grid_set( b1, b2, b3, gcutm, nr1, nr2, nr3 )
@ -125,6 +125,13 @@
! ... As above, for the smooth grid
IF( nr1s == 0 .OR. nr2s == 0 .OR. nr3s == 0 ) THEN
!
IF ( gcuts == gcutm ) THEN
! ... No double grid, the two grids are the same
nr1s = nr1 ; nr2s = nr2 ; nr3s = nr3
nr1sx= nr1x; nr2sx= nr2x; nr3sx= nr3x
RETURN
END IF
!
nr1s= int (2 * sqrt (gcuts) * &
sqrt (at(1, 1)**2 + at(2, 1)**2 + at(3, 1)**2) ) + 1
@ -157,9 +164,9 @@
!=----------------------------------------------------------------------------=!
SUBROUTINE realspace_grids_para( dfftp, dffts, nproc_ )
SUBROUTINE realspace_grids_info ( dfftp, dffts, nproc_ )
! This subroutines sets local dimensions for real space grids
! Print info on local and global dimensions for real space grids
USE io_global, ONLY: ionode, stdout
USE fft_types, ONLY: fft_dlay_descriptor
@ -173,27 +180,6 @@
INTEGER :: i
! ... Subroutine body
! set the actual (local) FFT dimensions
nr1l = dfftp % nr1
nr2l = dfftp % nr2
nr3l = dfftp % npl
nr1sl = dffts % nr1
nr2sl = dffts % nr2
nr3sl = dffts % npl
! set the dimensions of the array allocated for the FFT
! this could in principle be different than the FFT dimensions
nrxx = dfftp % nnr
nrxxs = dffts % nnr
IF ( nr1s > nr1 .or. nr2s > nr2 .or. nr3s > nr3) &
& CALL errore(' pmeshset ', ' smooth grid larger than dense grid? ', 1 )
IF(ionode) THEN
WRITE( stdout,*)
@ -203,7 +189,8 @@
WRITE( stdout,1010) nr1x, nr2x, nr3x
WRITE( stdout,1020) nrxx
WRITE( stdout,*) ' Number of x-y planes for each processors: '
WRITE( stdout, fmt = '( 3X, "nr3l = ", 10I5 )' ) ( dfftp%npp( i ), i = 1, nproc_ )
WRITE( stdout, fmt = '( 3X, "nr3l = ", 10I5 )' ) &
( dfftp%npp( i ), i = 1, nproc_ )
WRITE( stdout,*)
WRITE( stdout,*) ' Smooth Real Mesh'
@ -212,7 +199,8 @@
WRITE( stdout,1010) nr1sx, nr2sx, nr3sx
WRITE( stdout,1020) nrxxs
WRITE( stdout,*) ' Number of x-y planes for each processors: '
WRITE( stdout, fmt = '( 3X, "nr3sl = ", 10I5 )' ) ( dffts%npp( i ), i = 1, nproc_ )
WRITE( stdout, fmt = '( 3X, "nr3sl = ", 10I5 )' ) &
( dffts%npp( i ), i = 1, nproc_ )
END IF
@ -224,16 +212,16 @@
1020 FORMAT(3X, 'Local number of cell to store the grid ( nrxx ) = ', 1X, I9 )
RETURN
END SUBROUTINE realspace_grids_para
END SUBROUTINE realspace_grids_info
SUBROUTINE grid_set( b1, b2, b3, gcut, nr1, nr2, nr3 )
! this routine calculates the storage required for G vectors arrays
! nr1, nr2, nr3 must be set in input to reasonable grid values
! this routine returns in nr1, nr2, nr3 the minimal 3D real-space FFT
! grid required to fit the G-vector sphere with G^2 <= gcut
! On input, nr1,nr2,nr3 must be set to values that match or exceed
! the largest i,j,k (Miller) indices in G(i,j,k) = i*b1 + j*b2 + k*b3
! ----------------------------------------------
! END manual
! ... declare modules
USE kinds, ONLY: DP
@ -254,8 +242,8 @@
nb = 0
! ... calculate moduli of G vectors and the range of indexes where
! ... |G| < gcut (in parallel whenever possible)
! ... calculate moduli of G vectors and the range of indices where
! ... |G|^2 < gcut (in parallel whenever possible)
DO k = -nr3, nr3
!
@ -275,7 +263,7 @@
IF( gsq < gcut ) THEN
! ... calculate minimum and maximum index
! ... calculate maximum index
nb(1) = MAX( nb(1), ABS( i ) )
nb(2) = MAX( nb(2), ABS( j ) )
nb(3) = MAX( nb(3), ABS( k ) )
@ -286,11 +274,13 @@
END IF
END DO
! ... the size of the required (3-dimensional) matrix depends on the
! ... minimum and maximum indices
CALL mp_max( nb, intra_image_comm )
! ... the size of the required (3-dimensional) matrix depends on the
! ... maximum indices. Note that the following choice is slightly
! ... "small": 2*nb+2 would be needed in order to guarantee that the
! ... sphere in G-space never overlaps its periodic image
nr1 = 2 * nb(1) + 1
nr2 = 2 * nb(2) + 1
nr3 = 2 * nb(3) + 1

View File

@ -29,7 +29,6 @@ check_stop.o : mp_global.o
check_stop.o : set_signal.o
clocks.o : io_global.o
clocks.o : kind.o
clocks.o : mp.o
clocks.o : mp_global.o
constants.o : kind.o
constraints_module.o : basic_algebra_routines.o
@ -208,15 +207,10 @@ 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
smallbox.o : constants.o
smallbox.o : io_global.o
smallbox.o : kind.o
splinelib.o : kind.o
stick_base.o : control_flags.o
stick_base.o : fft_types.o
@ -224,6 +218,11 @@ 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

View File

@ -1,5 +1,5 @@
!
! Copyright (C) 2002 FPMD group
! Copyright (C) 2002-2010 Quantum ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
@ -568,32 +568,25 @@
!=----------------------------------------------------------------------=
SUBROUTINE pstickset( dfftp, dffts, alat, a1, a2, a3, gcut, gkcut, gcuts, &
nr1, nr2, nr3, nr1x, nr2x, nr3x, nr1s, nr2s, nr3s, nr1sx, nr2sx, nr3sx, &
ngw, ngm, ngs )
SUBROUTINE pstickset( gamma_only, b1, b2, b3, gcut, gkcut, gcuts, &
dfftp, dffts, ngw, ngm, ngs )
USE kinds, ONLY: DP
USE mp_global, ONLY: me_pool, nproc_pool, intra_pool_comm, nogrp
USE control_flags, ONLY: gamma_only
USE io_global, ONLY: ionode
USE io_global, ONLY: stdout
USE fft_types, ONLY: fft_dlay_descriptor, fft_dlay_allocate, fft_dlay_set, &
fft_dlay_scalar
USE io_global, ONLY: ionode, stdout
USE fft_types, ONLY: fft_dlay_descriptor, fft_dlay_allocate, &
fft_dlay_set, fft_dlay_scalar
USE grid_dimensions
USE smooth_grid_dimensions
TYPE(fft_dlay_descriptor), INTENT(inout) :: dfftp, dffts
REAL(DP), INTENT(in) :: a1(3), a2(3), a3(3), alat
LOGICAL, INTENT(in) :: gamma_only
! ... b1, b2, b3 reciprocal space base vectors.
REAL(DP), INTENT(in) :: b1(3), b2(3), b3(3)
REAL(DP), INTENT(in) :: gcut, gkcut, gcuts
INTEGER, INTENT(in) :: nr1, nr2, nr3, nr1x, nr2x, nr3x
INTEGER, INTENT(in) :: nr1s, nr2s, nr3s, nr1sx, nr2sx, nr3sx
TYPE(fft_dlay_descriptor), INTENT(inout) :: dfftp, dffts
INTEGER, INTENT(out) :: ngw, ngm, ngs
LOGICAL :: tk
! ... tk logical flag, TRUE if the symulation does not have the
! ... GAMMA symmetry
REAL(DP) :: b1(3), b2(3), b3(3)
! ... b1, b2, b3 reciprocal space base vectors.
INTEGER :: ub(3), lb(3)
! ... ub(i), lb(i) upper and lower miller indexes
@ -601,7 +594,6 @@
!
! ... Plane Waves
!
INTEGER, ALLOCATABLE :: stw(:,:)
! ... stick map (wave functions), stw(i,j) = number of G-vector in the
! ... stick whose x and y miller index are i and j
@ -661,10 +653,7 @@
! ... nsts local number of sticks (smooth mesh)
INTEGER, ALLOCATABLE :: ist(:,:) ! sticks indexes ordered
INTEGER, ALLOCATABLE :: ist(:,:) ! sticks indices ordered
INTEGER :: ip, ngm_ , ngs_
INTEGER, ALLOCATABLE :: idx(:)
@ -674,13 +663,6 @@
ub(3) = ( nr3 - 1 ) / 2
lb = - ub
! ... reciprocal lattice generators
CALL recips( a1, a2, a3, b1, b2, b3 )
b1 = b1 * alat
b2 = b2 * alat
b3 = b3 * alat
! ... Allocate maps
ALLOCATE( stw ( lb(1):ub(1), lb(2):ub(2) ) )
@ -780,6 +762,16 @@
CALL fft_dlay_scalar( dffts, ub, lb, nr1s, nr2s, nr3s, nr1sx, nr2sx, nr3sx, stw )
#endif
! set the actual (local) FFT dimensions
nr1l = dfftp % nr1
nr2l = dfftp % nr2
nr3l = dfftp % npl
nr1sl = dffts % nr1
nr2sl = dffts % nr2
nr3sl = dffts % npl
! set the dimensions of the array allocated for the FFT
nrxx = dfftp % nnr
nrxxs = dffts % nnr
! ... Maximum number of sticks (potentials)
nstpx = maxval( nstp )