Commit Graph

23 Commits

Author SHA1 Message Date
Paolo Giannozzi a260109070 See comments in https://gitlab.com/QEF/q-e/merge_requests/721 2019-12-29 20:39:59 +01:00
Paolo Giannozzi 6abb8b46ec Minor cleanup 2018-02-26 15:12:38 +01:00
degironc 3e6b4f8e76 MAJOR restructuring of the FFTXlib library
In real space processors are organized in a 2D pattern.

Each processor owns data from a sub-set of Z-planes and a sub-set of Y-planes.
In reciprocal space each processor owns Z-columns that belong to a sub set of
X-values. This allows to split the processors in two sets for communication
in the YZ and XY planes.
In alternative, if the situation allows for it, a task group paralelization is used
(with ntg=nyfft) where complete XY planes of ntg wavefunctions are collected and Fourier
trasnformed in G space by different task-groups. This is preferable to the Z-proc + Y-proc
paralleization if task group can be used because a smaller number of larger ammounts of 
data are transferred. Hence three types of fft are implemented: 
 
  !
  !! ... isgn = +-1 : parallel 3d fft for rho and for the potential
  !
  !! ... isgn = +-2 : parallel 3d fft for wavefunctions
  !
  !! ... isgn = +-3 : parallel 3d fft for wavefunctions with task group
  !
  !! ... isgn = +   : G-space to R-space, output = \sum_G f(G)exp(+iG*R)
  !! ...              fft along z using pencils        (cft_1z)
  !! ...              transpose across nodes           (fft_scatter_yz)
  !! ...              fft along y using pencils        (cft_1y)
  !! ...              transpose across nodes           (fft_scatter_xy)
  !! ...              fft along x using pencils        (cft_1x)
  !
  !! ... isgn = -   : R-space to G-space, output = \int_R f(R)exp(-iG*R)/Omega
  !! ...              fft along x using pencils        (cft_1x)
  !! ...              transpose across nodes           (fft_scatter_xy)
  !! ...              fft along y using pencils        (cft_1y)
  !! ...              transpose across nodes           (fft_scatter_yz)
  !! ...              fft along z using pencils        (cft_1z)
  !
  ! If task_group_fft_is_active the FFT acts on a number of wfcs equal to 
  ! dfft%nproc2, the number of Y-sections in which a plane is divided. 
  ! Data are reshuffled by the fft_scatter_tg routine so that each of the 
  ! dfft%nproc2 subgroups (made by dfft%nproc3 procs) deals with whole planes 
  ! of a single wavefunciton.
  !

fft_type module heavily modified, a number of variables renamed with more intuitive names 
(at least to me), a number of more variables introduced for the Y-proc parallelization.

Task_group module made void. task_group management is now reduced to the logical component
 fft_desc%have_task_groups of fft_type_descriptor type variable fft_desc.

In term of interfaces, the 'easy' calling sequences are

SUBROUTINE invfft/fwfft( grid_type, f, dfft, howmany )

  !! where:
  !! 
  !! **grid_type = 'Dense'** : 
  !!   inverse/direct fourier transform of potentials and charge density f
  !!   on the dense grid (dfftp). On output, f is overwritten
  !! 
  !! **grid_type = 'Smooth'** :
  !!   inverse/direct fourier transform of  potentials and charge density f
  !!   on the smooth grid (dffts). On output, f is overwritten
  !! 
  !! **grid_type = 'Wave'** :
  !!   inverse/direct fourier transform of  wave functions f
  !!   on the smooth grid (dffts). On output, f is overwritten
  !!
  !! **grid_type = 'tgWave'** :
  !!   inverse/direct fourier transform of  wave functions f with task group
  !!   on the smooth grid (dffts). On output, f is overwritten
  !!
  !! **grid_type = 'Custom'** : 
  !!   inverse/direct fourier transform of potentials and charge density f
  !!   on a custom grid (dfft_exx). On output, f is overwritten
  !! 
  !! **grid_type = 'CustomWave'** :
  !!   inverse/direct fourier transform of  wave functions f
  !!   on a custom grid (dfft_exx). On output, f is overwritten
  !! 
  !! **dfft = FFT descriptor**, IMPORTANT NOTICE: grid is specified only by dfft.
  !!   No check is performed on the correspondence between dfft and grid_type.
  !!   grid_type is now used only to distinguish cases 'Wave' / 'CustomWave' 
  !!   from all other cases
                                                                                                 

Many more files modified.




git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13676 c92efa57-630b-4861-b058-cf58834340f0
2017-08-01 20:31:02 +00:00
giannozz 4aa0376b0f Some improvements (?) to documentation and coding of "average.x"
Some minor fixes (misspells etc.)


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13540 c92efa57-630b-4861-b058-cf58834340f0
2017-06-01 08:25:32 +00:00
oliviero 997b61d9e4 fixed a bug in fd_gradient (only called by Environ) and added some checks in other routines with loops on real-space grid.
The bug was for the not-so-common case of machines where nr1x != nr1, loops in real-space should skip unphysical points.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13536 c92efa57-630b-4861-b058-cf58834340f0
2017-05-29 10:29:28 +00:00
oliviero 4a65019f17 Fixed a small bug in two subroutines only called by Environ.
Lenght perpendicular to a 2D system was ill-defined for flipped cells, where the 
perpendicular axis is not directed towards positive values. Also removed trailing whites.



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13451 c92efa57-630b-4861-b058-cf58834340f0
2017-04-03 12:41:52 +00:00
giannozz 54de84d030 Removal of unused variables
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13393 c92efa57-630b-4861-b058-cf58834340f0
2017-03-12 20:08:31 +00:00
giannozz ab2180c5d6 "index" is a fortran function, better to use something else. For uniformity
with the rest of code, index => idx, index0 => idx0


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12832 c92efa57-630b-4861-b058-cf58834340f0
2016-08-23 20:17:08 +00:00
oliviero 4c0c960f39 stupid bug in a subroutine only used by Environ so far
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12189 c92efa57-630b-4861-b058-cf58834340f0
2016-03-04 13:51:31 +00:00
giannozz 452905f76b erf and erfc replaced by qe_erf, qe_erfc, as in the rest of QE
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@11676 c92efa57-630b-4861-b058-cf58834340f0
2015-08-14 19:47:08 +00:00
oliviero ee03f7ceb4 added subroutines to build an erfc(|r-a|/b) function (and its gradient) on the real-space grid
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@11612 c92efa57-630b-4861-b058-cf58834340f0
2015-07-09 10:01:26 +00:00
giannozz 6216666a22 Correct spelling is "length", not "lenght"
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10987 c92efa57-630b-4861-b058-cf58834340f0
2014-05-19 19:43:47 +00:00
oliviero 38a6d5f20d adding a tool to compute the planar average along one axis of a function on the real space grid
(or viceversa, put a function defined on the axis on the real space mesh)
  


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10781 c92efa57-630b-4861-b058-cf58834340f0
2014-02-28 10:36:32 +00:00
oliviero ad224920b4 environ-related modifications, a few more input keywords for a new (under testing) environ feature.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10695 c92efa57-630b-4861-b058-cf58834340f0
2014-01-23 13:52:09 +00:00
giannozz 51ad80da37 mp_global replaced with more apropriate modules in Modules/
Corrections by Axel to last commit


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10534 c92efa57-630b-4861-b058-cf58834340f0
2013-10-13 13:36:46 +00:00
giannozz 79c73ab2ee Moe occurrences of "index" as variable. Please verify if everything is
still working as expected


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10369 c92efa57-630b-4861-b058-cf58834340f0
2013-07-08 17:26:55 +00:00
oliviero dfe7b47fb3 small modification for consistency, again
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9357 c92efa57-630b-4861-b058-cf58834340f0
2012-08-21 18:27:47 +00:00
oliviero de884dd168 small modification for consistency with other pieces of code
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9350 c92efa57-630b-4861-b058-cf58834340f0
2012-08-21 12:34:51 +00:00
oliviero 68b0dedf1f Sorry, forgot one instance of the previous modification.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9041 c92efa57-630b-4861-b058-cf58834340f0
2012-05-28 14:33:13 +00:00
oliviero 9d2fbbbdef Small correction due to real-space parallelization. The loop over real-space grid-points is run only up to the effective number of grid-points in each proc.
Mostly for a sake of clarity of the code, results of Makov-Payne correction should not change. 


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@9040 c92efa57-630b-4861-b058-cf58834340f0
2012-05-28 14:31:03 +00:00
oliviero b404e3239a Small modification of the ENVIRON version of pw. Makov-payne correction in the presence of a dielectric environ.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@8922 c92efa57-630b-4861-b058-cf58834340f0
2012-04-24 13:46:15 +00:00
oliviero 4cd5b32ec2 Modified a bit the Environ structure and added a further contribution (correction of slab boundary conditions).
All modifications within #ifdef __ENVIRON #endif statements, no effects on actual code.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@8702 c92efa57-630b-4861-b058-cf58834340f0
2012-02-21 16:46:48 +00:00
oliviero 4e195472f5 Some utilities developed for the Solvent module are moved into Modules because possibly of general interest.
In particular: 
fd_gradient.f90 contains a module to perform gradients in the real space grid using finite differences. A few
different schemes have been implemented, it is necessary to initialize the finite difference calculation by 
passing the selected scheme and order to an initialization routine. The module is parallel, but not very fancy.
generate_function.f90 contains a few subroutines that generate a specific function on the real space grid. The 
possible functions are gaussian, exponenentials, gradient of gassians and gradient of exponentials. Also in this
case the subroutines are parallel and built following the scheme in the makov_payne.f90 subroutines. 


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@8645 c92efa57-630b-4861-b058-cf58834340f0
2012-02-14 16:13:18 +00:00