1!--------------------------------------------------------------------------------------------------! 2! CP2K: A general program to perform molecular dynamics simulations ! 3! Copyright (C) 2000 - 2020 CP2K developers group ! 4!--------------------------------------------------------------------------------------------------! 5 6! ************************************************************************************************** 7!> \par History 8!> JGH (20-12-2000) : Parallel data layout 9!> \author APSI 10! ************************************************************************************************** 11MODULE pw_grid_types 12 13 USE kinds, ONLY: dp,& 14 int_8 15#include "../base/base_uses.f90" 16 17 IMPLICIT NONE 18 19 PRIVATE 20 PUBLIC :: pw_grid_type, map_pn 21 22 ! (only for reciprocal grid:) fill in half or full space 23 INTEGER, PARAMETER, PUBLIC :: HALFSPACE = 211, FULLSPACE = 212 24 INTEGER, PARAMETER, PUBLIC :: PW_MODE_LOCAL = 0, PW_MODE_DISTRIBUTED = 1 25 26 ! maps to positive and negative g-vectors 27! ************************************************************************************************** 28 TYPE map_pn 29 INTEGER, DIMENSION(:), POINTER :: pos, neg 30 END TYPE map_pn 31 32! info on parallelisation 33 ! contains only significant information if mode == PW_MODE_DISTRIBUTED 34! ************************************************************************************************** 35 TYPE pw_para_type 36 INTEGER :: mode ! 0 = local = PW_MODE_LOCAL ; 1 = distributed = PW_MODE_DISTRIBUTED 37 LOGICAL :: ray_distribution ! block or pencil distribution 38 LOGICAL :: blocked ! block or pencil distribution 39 INTEGER :: group ! MPI group id 40 INTEGER :: my_pos ! Position within group 41 INTEGER :: group_size ! # of Processors in group 42 LOGICAL :: group_head ! Master process within group 43 INTEGER :: group_head_id ! Id of group_head 44 INTEGER, DIMENSION(:, :, :), POINTER :: yzp ! g-space rays (xy,k,pe) 45 INTEGER, DIMENSION(:, :), POINTER :: yzq ! local inverse pointer of yzp 46 INTEGER, DIMENSION(:), POINTER :: nyzray ! number of g-space rays (pe) 47 INTEGER :: rs_group ! real space group (2-dim cart) 48 INTEGER :: rs_mpo ! real space group position 49 INTEGER, DIMENSION(2) :: rs_dims ! real space group dimensions 50 INTEGER, DIMENSION(2) :: rs_pos ! real space group positions in grid 51 INTEGER, DIMENSION(:, :, :, :), POINTER :: bo ! list of axis distribution 52 INTEGER, DIMENSION(:), POINTER :: pos_of_x ! what my_pos holds a given x plane....should go: hard-codes to plane distributed 53 END TYPE pw_para_type 54 55 ! all you always wanted to know about grids, but were... 56! ************************************************************************************************** 57 TYPE pw_grid_type 58 INTEGER(int_8) :: ngpts ! # grid points 59 INTEGER(int_8) :: ngpts_cut ! # grid points within cutoff 60 INTEGER, DIMENSION(2, 3) :: bounds ! lower and upper bounds 61 INTEGER, DIMENSION(3) :: npts ! # point in all directions 62 INTEGER :: ngpts_local ! # grid points 63 INTEGER :: ngpts_cut_local ! # grid points within cutoff 64 INTEGER, DIMENSION(2, 3) :: bounds_local ! bounds on local process 65 INTEGER, DIMENSION(3) :: npts_local ! local version of npts 66 REAL(KIND=dp), DIMENSION(3) :: dr ! grid spacing 67 REAL(KIND=dp), DIMENSION(3, 3) :: dh ! incremental cell matrix 68 REAL(KIND=dp), DIMENSION(3, 3) :: dh_inv ! inverse incremental cell matrix 69 LOGICAL :: orthorhombic ! cell symmetry 70 REAL(KIND=dp) :: dvol, vol ! volume element, volume 71 REAL(KIND=dp) :: cutoff ! cutoff in a.u. 72 TYPE(map_pn) :: mapl, mapm, mapn ! mapping 1D => 3D 73 TYPE(pw_para_type) :: para ! information on parallelisation 74 REAL(KIND=dp), DIMENSION(:, :), POINTER :: g ! grid point vectors 75 REAL(KIND=dp), DIMENSION(:), POINTER :: gsq ! squared vector lengths 76 INTEGER, DIMENSION(:, :), POINTER :: g_hat ! grid point indices (Miller) 77 INTEGER, DIMENSION(:, :), POINTER :: g_hatmap ! mapped grid point indices (Miller) [CUDA] 78 INTEGER :: grid_span ! type HALFSPACE/FULLSPACE 79 LOGICAL :: have_g0 ! whether I have G = [0,0,0] 80 INTEGER :: first_gne0 ! first g index /= 0 [1/2] 81 INTEGER :: id_nr ! tag of this grid 82 INTEGER :: reference ! reference grid identifier 83 INTEGER, DIMENSION(:), POINTER :: gidx ! ref grid index 84 INTEGER :: ref_count ! reference count 85 LOGICAL :: spherical ! spherical cutoff? 86 COMPLEX(KIND=dp), DIMENSION(:, :), POINTER :: grays ! used by parallel 3D FFT routine 87 END TYPE pw_grid_type 88 89END MODULE pw_grid_types 90 91