CP2K 2.4 (Revision 12889)

pw_grid_types.f90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------------!
00002 !   CP2K: A general program to perform molecular dynamics simulations         !
00003 !   Copyright (C) 2000 - 2013  CP2K developers group                          !
00004 !-----------------------------------------------------------------------------!
00005 
00006 ! *****************************************************************************
00011 MODULE pw_grid_types
00012   USE f77_blas
00013   USE input_constants,                 ONLY: do_pw_grid_blocked_false,&
00014                                              do_pw_grid_blocked_free,&
00015                                              do_pw_grid_blocked_true
00016   USE kinds,                           ONLY: dp,&
00017                                              int_8
00018 #include "cp_common_uses.h"
00019 
00020   IMPLICIT NONE
00021 
00022   PRIVATE
00023   PUBLIC :: pw_grid_type, map_pn, pw_para_type
00024   PUBLIC :: do_pw_grid_blocked_false,do_pw_grid_blocked_true,do_pw_grid_blocked_free
00025 
00026   ! (only for reciprocal grid:) fill in half or full space
00027   INTEGER, PARAMETER, PUBLIC :: HALFSPACE = 211, FULLSPACE = 212
00028   INTEGER, PARAMETER, PUBLIC :: PW_MODE_LOCAL = 0, PW_MODE_DISTRIBUTED=1
00029 
00030 
00031   ! maps to positive and negative g-vectors
00032 ! *****************************************************************************
00033   TYPE map_pn
00034      INTEGER, DIMENSION ( : ), POINTER :: pos, neg
00035   END TYPE map_pn
00036 
00037 ! info on parallelisation
00038   ! contains only significant information if mode == PW_MODE_DISTRIBUTED
00039 ! *****************************************************************************
00040   TYPE pw_para_type
00041      INTEGER :: mode                 ! 0 = local = PW_MODE_LOCAL ; 1 = distributed = PW_MODE_DISTRIBUTED
00042      LOGICAL :: ray_distribution     ! block or pencil distribution
00043      LOGICAL :: blocked              ! block or pencil distribution
00044      INTEGER :: group                ! MPI group id
00045      INTEGER :: my_pos               ! Position within group
00046      INTEGER :: group_size           ! # of Processors in group
00047      LOGICAL :: group_head           ! Master process within group
00048      INTEGER :: group_head_id        ! Id of group_head
00049      INTEGER, DIMENSION (:,:,:), POINTER :: yzp  ! g-space rays (xy,k,pe)
00050      INTEGER, DIMENSION (:,:), POINTER :: yzq    ! local inverse pointer of yzp
00051      INTEGER, DIMENSION (:), POINTER :: nyzray   ! number of g-space rays (pe)
00052      INTEGER :: rs_group             ! real space group (2-dim cart)
00053      INTEGER :: rs_mpo               ! real space group position
00054      INTEGER, DIMENSION (2) :: rs_dims    ! real space group dimensions
00055      INTEGER, DIMENSION (2) :: rs_pos     ! real space group positions in grid
00056      INTEGER, DIMENSION (:,:,:,:), POINTER :: bo ! list of axis distribution
00057      INTEGER, DIMENSION(:), POINTER :: pos_of_x ! what my_pos holds a given x plane....should go since this hard-codes to plane distributed
00058   END TYPE pw_para_type
00059 
00060   ! all you always wanted to know about grids, but were...
00061 ! *****************************************************************************
00062   TYPE pw_grid_type
00063      INTEGER(int_8) :: ngpts                             ! # grid points
00064      INTEGER(int_8) :: ngpts_cut                         ! # grid points within cutoff
00065      INTEGER, DIMENSION ( 2, 3 ) :: bounds        ! lower and upper bounds
00066      INTEGER, DIMENSION ( 3 ) :: npts             ! # point in all directions
00067      INTEGER :: ngpts_local                       ! # grid points
00068      INTEGER :: ngpts_cut_local                   ! # grid points within cutoff
00069      INTEGER, DIMENSION ( 2, 3 ) :: bounds_local  ! bounds on local process
00070      INTEGER, DIMENSION ( 3 ) :: npts_local       ! local version of npts
00071      REAL (KIND=dp), DIMENSION ( 3 ) :: dr        ! grid spacing
00072      REAL (KIND=dp), DIMENSION ( 3, 3 ) :: dh     ! incremental cell matrix
00073      REAL (KIND=dp), DIMENSION ( 3, 3 ) :: dh_inv ! inverse incremental cell matrix
00074      LOGICAL :: orthorhombic                      ! cell symmetry
00075      REAL (KIND=dp) :: dvol, vol                  ! volume element, volume
00076      REAL (KIND=dp) :: cutoff                     ! cutoff in a.u.
00077      TYPE ( map_pn ) :: mapl, mapm, mapn          ! mapping 1D => 3D
00078      TYPE ( pw_para_type ) :: para                ! information on parallelisation
00079      REAL (KIND=dp), DIMENSION ( :, : ), POINTER :: g   ! grid point vectors
00080      REAL (KIND=dp), DIMENSION ( : ), POINTER :: gsq    ! squared vector lengths
00081      INTEGER, DIMENSION ( :, : ), POINTER :: g_hat    ! grid point indices (Miller)
00082      INTEGER :: grid_span                         ! type HALFSPACE/FULLSPACE
00083      LOGICAL :: have_g0                           ! whether I have G = [0,0,0]
00084      INTEGER :: first_gne0                        ! first g index /= 0 [1/2]
00085      INTEGER :: id_nr                             ! tag of this grid
00086      INTEGER :: reference                         ! reference grid identifier
00087      INTEGER, DIMENSION ( : ), POINTER :: gidx    ! ref grid index
00088      INTEGER :: ref_count                         ! reference count
00089      LOGICAL :: spherical                         ! spherical cutoff?
00090      COMPLEX (KIND=dp), DIMENSION ( :, : ), POINTER :: grays ! used by parallel 3D FFT routine
00091   END TYPE pw_grid_type
00092 
00093 END MODULE pw_grid_types
00094