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!> 01.2008 Created 9!> \author Joost 10! ************************************************************************************************** 11MODULE input_cp2k_rsgrid 12 13 USE input_keyword_types, ONLY: keyword_create,& 14 keyword_release,& 15 keyword_type 16 USE input_section_types, ONLY: section_add_keyword,& 17 section_create,& 18 section_type 19 USE kinds, ONLY: dp 20 USE realspace_grid_types, ONLY: rsgrid_automatic,& 21 rsgrid_distributed,& 22 rsgrid_replicated 23 USE string_utilities, ONLY: s2a 24#include "./base/base_uses.f90" 25 26 IMPLICIT NONE 27 PRIVATE 28 29 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_rsgrid' 30 31 PUBLIC :: create_rsgrid_section 32 33!*** 34CONTAINS 35 36! ************************************************************************************************** 37!> \brief ... 38!> \param section ... 39!> \author Joost 40! ************************************************************************************************** 41 SUBROUTINE create_rsgrid_section(section) 42 TYPE(section_type), POINTER :: section 43 44 CHARACTER(len=*), PARAMETER :: routineN = 'create_rsgrid_section', & 45 routineP = moduleN//':'//routineN 46 47 TYPE(keyword_type), POINTER :: keyword 48 49 CPASSERT(.NOT. ASSOCIATED(section)) 50 CALL section_create(section, __LOCATION__, name="RS_GRID", & 51 description="Set options that influence how the realspace grids are being distributed in parallel runs.", & 52 n_keywords=5, n_subsections=0, repeats=.TRUE.) 53 54 NULLIFY (keyword) 55 CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTION_TYPE", & 56 description="Parallelization strategy.", & 57 usage="DISTRIBUTION_TYPE DISTRIBUTED", & 58 enum_c_vals=s2a("AUTOMATIC", "DISTRIBUTED", "REPLICATED"), & 59 enum_i_vals=(/rsgrid_automatic, rsgrid_distributed, rsgrid_replicated/), & 60 enum_desc=s2a("Use heuristic rules to decide between distributed and replicated", & 61 "Force a distributed setup if possible", & 62 "Force a replicated setup"), & 63 default_i_val=rsgrid_automatic) 64 CALL section_add_keyword(section, keyword) 65 CALL keyword_release(keyword) 66 67 CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTION_LAYOUT", & 68 description="Specifies the number of slices in the x, y and z directions."// & 69 "-1 specifies that any number of slices is OK."// & 70 "If a given distribution can not be satisfied, a replicated grid will result."// & 71 "Also see LOCK_DISTRIBUTION.", & 72 usage="DISTRIBUTION_LAYOUT", & 73 repeats=.FALSE., n_var=3, & 74 default_i_vals=(/-1, -1, -1/)) 75 CALL section_add_keyword(section, keyword) 76 CALL keyword_release(keyword) 77 78 CALL keyword_create(keyword, __LOCATION__, name="MAX_DISTRIBUTED_LEVEL", & 79 description="If the multigrid-level of a grid is larger than the parameter,"// & 80 " it will not be distributed in the automatic scheme.", & 81 usage="MAX_DISTRIBUTED_LEVEL 1", & 82 default_i_val=2) 83 CALL section_add_keyword(section, keyword) 84 CALL keyword_release(keyword) 85 86 CALL keyword_create(keyword, __LOCATION__, name="LOCK_DISTRIBUTION", & 87 description="Expert use only, only basic QS deals correctly with a non-default value."// & 88 "If the distribution is locked, a grid will have the same distribution as"// & 89 "the next finer multigrid (provided it is distributed)."// & 90 "If unlocked, all grids can be distributed freely.", & 91 usage="LOCK_DISTRIBUTION TRUE", & 92 default_l_val=.TRUE.) 93 CALL section_add_keyword(section, keyword) 94 CALL keyword_release(keyword) 95 96 CALL keyword_create(keyword, __LOCATION__, name="MEMORY_FACTOR", & 97 description="A grid will only be distributed if the memory usage for that grid (including halo) "// & 98 "is smaller than a replicated grid by this parameter.", & 99 usage="MEMORY_FACTOR 4.0", & 100 default_r_val=2.0_dp) 101 CALL section_add_keyword(section, keyword) 102 CALL keyword_release(keyword) 103 104 CALL keyword_create(keyword, __LOCATION__, name="HALO_REDUCTION_FACTOR", & 105 description="Can be used to reduce the halo of the distributed grid (experimental features).", & 106 usage="HALO_REDUCTION_FACTOR 0.5", & 107 default_r_val=1.0_dp) 108 CALL section_add_keyword(section, keyword) 109 CALL keyword_release(keyword) 110 END SUBROUTINE create_rsgrid_section 111 112END MODULE input_cp2k_rsgrid 113