1!--------------------------------------------------------------------------------------------------! 2! CP2K: A general program to perform molecular dynamics simulations ! 3! Copyright (C) 2000 - 2019 CP2K developers group ! 4!--------------------------------------------------------------------------------------------------! 5 6! ************************************************************************************************** 7!> \brief builds the global input section for cp2k 8!> \par History 9!> 06.2004 created [fawzi] 10!> 03.2014 moved to separate file [Ole Schuett] 11!> 10.2016 update seed input [Matthias Krack] 12!> \author fawzi 13! ************************************************************************************************** 14MODULE input_cp2k_global 15 USE bibliography, ONLY: Ceriotti2014,& 16 Frigo2005,& 17 Marek2014,& 18 Schonherr2014 19 USE cp_blacs_env, ONLY: BLACS_GRID_COL,& 20 BLACS_GRID_ROW,& 21 BLACS_GRID_SQUARE 22 USE cp_dbcsr_cp2k_link, ONLY: create_dbcsr_section 23 USE cp_fm_elpa, ONLY: elpa_kernel_descriptions,& 24 elpa_kernel_names,& 25 get_elpa_kernel_index,& 26 get_elpa_number_kernels 27 USE cp_output_handling, ONLY: add_last_numeric,& 28 cp_print_key_section_create,& 29 debug_print_level,& 30 high_print_level,& 31 low_print_level,& 32 medium_print_level,& 33 silent_print_level 34 USE input_constants, ONLY: & 35 bsse_run, callgraph_all, callgraph_master, callgraph_none, cell_opt_run, debug_run, & 36 do_atom, do_band, do_cp2k, do_dbcsr, do_diag_elpa, do_diag_sl, do_farming, do_fft_fftw3, & 37 do_fft_sg, do_opt_basis, do_optimize_input, do_pdgemm, do_swarm, do_tamc, do_test, & 38 do_tree_mc, do_tree_mc_ana, driver_run, ehrenfest, electronic_spectra_run, & 39 energy_force_run, energy_run, fftw_plan_estimate, fftw_plan_exhaustive, fftw_plan_measure, & 40 fftw_plan_patient, gaussian, geo_opt_run, linear_response_run, mol_dyn_run, mon_car_run, & 41 negf_run, none_run, pint_run, real_time_propagation, tree_mc_run, vib_anal 42 USE input_keyword_types, ONLY: keyword_create,& 43 keyword_release,& 44 keyword_type 45 USE input_section_types, ONLY: section_add_keyword,& 46 section_add_subsection,& 47 section_create,& 48 section_release,& 49 section_type 50 USE input_val_types, ONLY: char_t,& 51 integer_t,& 52 logical_t 53 USE kinds, ONLY: dp 54 USE machine, ONLY: m_cpuid 55 USE string_utilities, ONLY: s2a 56 USE timings, ONLY: default_timings_level 57#include "./base/base_uses.f90" 58 59 IMPLICIT NONE 60 PRIVATE 61 62 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE. 63 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_global' 64 65 PUBLIC :: create_global_section 66 67CONTAINS 68 69! ************************************************************************************************** 70!> \brief section to hold global settings for the whole program 71!> \param section the section to be created 72!> \author fawzi 73! ************************************************************************************************** 74 SUBROUTINE create_global_section(section) 75 TYPE(section_type), POINTER :: section 76 77 CHARACTER(len=*), PARAMETER :: routineN = 'create_global_section', & 78 routineP = moduleN//':'//routineN 79 80 INTEGER :: default_i_val, i 81 TYPE(keyword_type), POINTER :: keyword 82 TYPE(section_type), POINTER :: print_key, sub_section 83 84 NULLIFY (print_key) 85 CPASSERT(.NOT. ASSOCIATED(section)) 86 CALL section_create(section, __LOCATION__, name="GLOBAL", & 87 description="Section with general information regarding which kind "// & 88 "of simulation to perform an parameters for the whole PROGRAM", & 89 n_keywords=7, n_subsections=0, repeats=.FALSE.) 90 91 NULLIFY (keyword) 92 CALL keyword_create(keyword, __LOCATION__, name="BLACS_GRID", & 93 description="how to distribute the processors on the 2d grid needed "// & 94 "by BLACS (and thus SCALAPACK)", usage="BLACS_GRID SQUARE", & 95 default_i_val=BLACS_GRID_SQUARE, enum_c_vals=s2a("SQUARE", "ROW", "COLUMN"), & 96 enum_desc=s2a("Distribution by matrix blocks", "Distribution by matrix rows", & 97 "Distribution by matrix columns"), & 98 enum_i_vals=(/BLACS_GRID_SQUARE, BLACS_GRID_ROW, BLACS_GRID_COL/)) 99 CALL section_add_keyword(section, keyword) 100 CALL keyword_release(keyword) 101 102 CALL keyword_create(keyword, __LOCATION__, name="BLACS_REPEATABLE", & 103 description="Use a topology for BLACS collectives that is guaranteed to be repeatable "// & 104 "on homogeneous architectures", & 105 usage="BLACS_REPEATABLE", & 106 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 107 CALL section_add_keyword(section, keyword) 108 CALL keyword_release(keyword) 109 110#if defined(__ELPA) 111 default_i_val = do_diag_elpa 112#else 113 default_i_val = do_diag_sl 114#endif 115 CALL keyword_create( & 116 keyword, __LOCATION__, name="PREFERRED_DIAG_LIBRARY", & 117 description="Specifies the DIAGONALIZATION library to be used. If not available, the standard scalapack is used", & 118 usage="PREFERRED_DIAG_LIBRARY ELPA", & 119 default_i_val=default_i_val, & 120 enum_i_vals=(/do_diag_sl, do_diag_elpa/), & 121 enum_c_vals=s2a("SL", "ELPA"), & 122 enum_desc=s2a("Standard (Sca)LAPACK: syevd", "ELPA"), & 123 citations=(/Marek2014/)) 124 CALL section_add_keyword(section, keyword) 125 CALL keyword_release(keyword) 126 127 default_i_val = get_elpa_kernel_index(m_cpuid()) 128 CPASSERT(default_i_val .LE. get_elpa_number_kernels()) 129 CALL keyword_create( & 130 keyword, __LOCATION__, name="ELPA_KERNEL", & 131 description="Specifies the kernel to be used when ELPA is in use", & 132 default_i_val=default_i_val, & 133 enum_i_vals=[(i, i=1, get_elpa_number_kernels())], & 134 enum_c_vals=elpa_kernel_names, & 135 enum_desc=elpa_kernel_descriptions) 136 CALL section_add_keyword(section, keyword) 137 CALL keyword_release(keyword) 138 139 CALL keyword_create(keyword, __LOCATION__, name="ELPA_QR", & 140 description="For ELPA, enable a blocked QR step when reducing the input matrix "// & 141 "to banded form in preparation for the actual diagonalization step. "// & 142 "See implementation paper for more details. Requires ELPA version 201505 or newer, "// & 143 "automatically deactivated otherwise. If true, QR is activated only when the "// & 144 "the size of the diagonalized matrix is suitable. Print key PRINT_ELPA is "// & 145 "useful in determining which matrices are suitable for QR. Might accelerate the "// & 146 "diagonalization of suitable matrices.", & 147 usage="ELPA_QR", & 148 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 149 CALL section_add_keyword(section, keyword) 150 CALL keyword_release(keyword) 151 152 CALL keyword_create(keyword, __LOCATION__, name="ELPA_QR_UNSAFE", & 153 description="For ELPA, disable block size limitations when used together with ELPA_QR. "// & 154 "Keyword relevant only with ELPA versions 201605 or newer. Use keyword with caution, "// & 155 "as it might result in wrong eigenvalues with some matrix orders/block sizes "// & 156 "when the number of MPI processes is varied. If the print key PRINT_ELPA is "// & 157 "active the validity of the eigenvalues is checked against values calculated without "// & 158 "ELPA QR.", & 159 usage="ELPA_QR", & 160 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 161 CALL section_add_keyword(section, keyword) 162 CALL keyword_release(keyword) 163 164 CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT_ELPA", & 165 description="Controls the printing of ELPA diagonalization information."// & 166 "Useful for testing purposes, especially together with keyword ELPA_QR.", & 167 filename="__STD_OUT__") 168 CALL section_add_subsection(section, print_key) 169 CALL section_release(print_key) 170 171 CALL keyword_create( & 172 keyword, __LOCATION__, name="PREFERRED_FFT_LIBRARY", & 173 description="Specifies the FFT library which should be preferred. "// & 174 "If it is not available, use FFTW3 if this is linked in, if FFTW3 is not available use FFTSG. "// & 175 "Improved performance with FFTW3 can be obtained specifying a proper value for FFTW_PLAN_TYPE. "// & 176 "Contrary to earlier CP2K versions, all libraries will result in the same grids, "// & 177 "i.e. the subset of grids which all FFT libraries can transform. "// & 178 "See EXTENDED_FFT_LENGTHS if larger FFTs or grids that more precisely match a given cutoff are needed, "// & 179 "or older results need to be reproduced. "// & 180 "FFTW3 is often (close to) optimal, and well tested with CP2K.", & 181 usage="PREFERRED_FFT_LIBRARY FFTW3", & 182 citations=(/Frigo2005/), & 183 default_i_val=do_fft_fftw3, & 184 enum_i_vals=(/do_fft_sg, do_fft_fftw3, do_fft_fftw3/), & 185 enum_c_vals=s2a("FFTSG", "FFTW3", "FFTW"), & 186 enum_desc=s2a("Stefan Goedecker's FFT (FFTSG), always available, "// & 187 "will be used in case a FFT library is specified and not available.", & 188 "a fast portable FFT library. Recommended."// & 189 "See also the FFTW_PLAN_TYPE, and FFTW_WISDOM_FILE_NAME keywords.", & 190 "Same as FFTW3 (for compatibility with CP2K 2.3)")) 191 CALL section_add_keyword(section, keyword) 192 CALL keyword_release(keyword) 193 194 CALL keyword_create(keyword, __LOCATION__, name="FFTW_WISDOM_FILE_NAME", & 195 description="The name of the file that contains wisdom (pre-planned FFTs) for use with FFTW3. "// & 196 "Using wisdom can significantly speed up the FFTs (see the FFTW homepage for details). "// & 197 "Note that wisdom is not transferable between different computer (architectures). "// & 198 "Wisdom can be generated using the fftw-wisdom tool that is part of the fftw installation. "// & 199 "cp2k/tools/cp2k-wisdom is a script that contains some additional info, and can help "// & 200 "to generate a useful default for /etc/fftw/wisdom or particular values for a given simulation.", & 201 usage="FFTW_WISDOM_FILE_NAME wisdom.dat", default_lc_val="/etc/fftw/wisdom") 202 CALL section_add_keyword(section, keyword) 203 CALL keyword_release(keyword) 204 205 CALL keyword_create(keyword, __LOCATION__, name="FFTW_PLAN_TYPE", & 206 description="FFTW can have improved performance if it is allowed to plan with "// & 207 "explicit measurements which strategy is best for a given FFT. "// & 208 "While a plan based on measurements is generally faster, "// & 209 "differences in machine load will lead to different plans for the same input file, "// & 210 "and thus numerics for the FFTs will be slightly different from run to run."// & 211 "PATIENT planning is recommended for long ab initio MD runs.", & 212 usage="FFTW_PLAN_TYPE PATIENT", & 213 citations=(/Frigo2005/), & 214 default_i_val=fftw_plan_estimate, & 215 enum_i_vals=(/fftw_plan_estimate, fftw_plan_measure, fftw_plan_patient, fftw_plan_exhaustive/), & 216 enum_c_vals=s2a("ESTIMATE", & 217 "MEASURE", & 218 "PATIENT", & 219 "EXHAUSTIVE"), & 220 enum_desc=s2a("Quick estimate, no runtime measurements.", & 221 "Quick measurement, somewhat faster FFTs.", & 222 "Measurements trying a wider range of possibilities.", & 223 "Measurements trying all possibilities - use with caution.")) 224 CALL section_add_keyword(section, keyword) 225 CALL keyword_release(keyword) 226 227 CALL keyword_create(keyword, __LOCATION__, name="EXTENDED_FFT_LENGTHS", & 228 description="Use fft library specific values for the allows number of points in FFTs. "// & 229 "The default is to use the internal FFT lengths. For external fft libraries this may "// & 230 "create an error at the external library level, because the length provided by cp2k is "// & 231 "not supported by the external library. In this case switch on this keyword "// & 232 "to obtain, with certain fft libraries, lengths matching the external fft library lengths, or "// & 233 "larger allowed grids, or grids that more precisely match a given cutoff. "// & 234 "IMPORTANT NOTE: in this case, the actual grids used in CP2K depends on the FFT library. "// & 235 "A change of FFT library must therefore be considered equivalent to a change of basis, "// & 236 "which implies a change of total energy. ", & 237 usage="EXTENDED_FFT_LENGTHS", & 238 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 239 CALL section_add_keyword(section, keyword) 240 CALL keyword_release(keyword) 241 242 CALL keyword_create(keyword, __LOCATION__, name="FFT_POOL_SCRATCH_LIMIT", & 243 description="Limits the memory usage of the FFT scratch pool, potentially reducing efficiency a bit", & 244 usage="FFT_POOL_SCRATCH_LIMIT {INTEGER}", default_i_val=15) 245 CALL section_add_keyword(section, keyword) 246 CALL keyword_release(keyword) 247 248 CALL keyword_create(keyword, __LOCATION__, name="ALLTOALL_SGL", & 249 description="All-to-all communication (FFT) should use single precision", & 250 usage="ALLTOALL_SGL YES", & 251 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 252 CALL section_add_keyword(section, keyword) 253 CALL keyword_release(keyword) 254 255 CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", & 256 variants=(/"IOLEVEL"/), & 257 description="How much output is written out.", & 258 usage="PRINT_LEVEL HIGH", & 259 default_i_val=medium_print_level, enum_c_vals= & 260 s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), & 261 enum_desc=s2a("Almost no output", & 262 "Little output", "Quite some output", "Lots of output", & 263 "Everything is written out, useful for debugging purposes only"), & 264 enum_i_vals=(/silent_print_level, low_print_level, medium_print_level, & 265 high_print_level, debug_print_level/)) 266 CALL section_add_keyword(section, keyword) 267 CALL keyword_release(keyword) 268 269 CALL keyword_create( & 270 keyword, __LOCATION__, name="PROGRAM_NAME", & 271 variants=(/"PROGRAM"/), & 272 description="Which program should be run", & 273 usage="PROGRAM_NAME {STRING}", & 274 enum_c_vals=s2a("ATOM", "FARMING", "TEST", "CP2K", "OPTIMIZE_INPUT", "OPTIMIZE_BASIS", "TMC", "MC_ANALYSIS", "SWARM"), & 275 enum_desc=s2a("Runs single atom calculations", & 276 "Runs N independent jobs in a single run", & 277 "Do some benchmarking and testing", & 278 "Runs one of the CP2K package", & 279 "A tool to optimize parameters in a CP2K input", & 280 "A tool to create a MOLOPT or ADMM basis for a given set"// & 281 " of training structures", & 282 "Runs Tree Monte Carlo algorithm using additional input file(s)", & 283 "Runs (Tree) Monte Carlo trajectory file analysis", & 284 "Runs swarm based calculation"), & 285 enum_i_vals=(/do_atom, do_farming, do_test, do_cp2k, do_optimize_input, & 286 do_opt_basis, do_tree_mc, do_tree_mc_ana, do_swarm/), & 287 default_i_val=do_cp2k) 288 CALL section_add_keyword(section, keyword) 289 CALL keyword_release(keyword) 290 291 CALL keyword_create(keyword, __LOCATION__, name="PROJECT_NAME", & 292 variants=(/"PROJECT"/), & 293 description="Name of the project (used to build the name of the "// & 294 "trajectory, and other files generated by the program)", & 295 usage="PROJECT_NAME {STRING}", & 296 default_c_val="PROJECT") 297 CALL section_add_keyword(section, keyword) 298 CALL keyword_release(keyword) 299 300 CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_FILE_NAME", & 301 description="Name of the output file. "// & 302 "Relevant only if automatically started (through farming for example). "// & 303 "If empty uses the project name as basis for it.", & 304 usage="OUTPUT_FILE_NAME {filename}", default_lc_val="") 305 CALL section_add_keyword(section, keyword) 306 CALL keyword_release(keyword) 307 308 CALL keyword_create( & 309 keyword, __LOCATION__, name="RUN_TYPE", & 310 description="Type of run that you want to perform Geometry "// & 311 "optimization, md, montecarlo,...", & 312 usage="RUN_TYPE MD", & 313 default_i_val=energy_force_run, & 314 citations=(/Ceriotti2014, Schonherr2014/), & 315 enum_c_vals=s2a("NONE", "ENERGY", "ENERGY_FORCE", "MD", "GEO_OPT", & 316 "MC", "SPECTRA", "DEBUG", "BSSE", "LR", "PINT", "VIBRATIONAL_ANALYSIS", & 317 "BAND", "CELL_OPT", "WFN_OPT", "WAVEFUNCTION_OPTIMIZATION", & 318 "MOLECULAR_DYNAMICS", "GEOMETRY_OPTIMIZATION", "MONTECARLO", & 319 "ELECTRONIC_SPECTRA", "LINEAR_RESPONSE", "NORMAL_MODES", "RT_PROPAGATION", & 320 "EHRENFEST_DYN", "TAMC", "TMC", "DRIVER", "NEGF"), & 321 enum_i_vals=(/none_run, energy_run, energy_force_run, mol_dyn_run, & 322 geo_opt_run, mon_car_run, electronic_spectra_run, debug_run, & 323 bsse_run, linear_response_run, pint_run, vib_anal, do_band, & 324 cell_opt_run, energy_run, energy_run, mol_dyn_run, geo_opt_run, & 325 mon_car_run, electronic_spectra_run, linear_response_run, & 326 vib_anal, real_time_propagation, ehrenfest, do_tamc, tree_mc_run, driver_run, negf_run/), & 327 enum_desc=s2a("Perform no tasks", "Computes energy", "Computes energy and forces", & 328 "Molecular Dynamics", "Geometry Optimization", "Monte Carlo", "Computes absorption Spectra", & 329 "Performs a Debug analysis", "Basis set superposition error", "Linear Response", & 330 "Path integral", "Vibrational analysis", "Band methods", & 331 "Cell optimization. Both cell vectors and atomic positions are optimised.", & 332 "Alias for ENERGY", "Alias for ENERGY", "Alias for MD", "Alias for GEO_OPT", & 333 "Alias for MC", "Alias for SPECTRA", "Alias for LR", "Alias for VIBRATIONAL_ANALYSIS", & 334 "Real Time propagation run (fixed ionic positions)", & 335 "Ehrenfest dynamics (using real time propagation of the wavefunction)", & 336 "Temperature Accelerated Monte Carlo (TAMC)", & 337 "Tree Monte Carlo (TMC), a pre-sampling MC algorithm", & 338 "i-PI driver mode", & 339 "Non-equilibrium Green's function method")) 340 CALL section_add_keyword(section, keyword) 341 CALL keyword_release(keyword) 342 343 CALL keyword_create(keyword, __LOCATION__, name="WALLTIME", & 344 variants=(/"WALLTI"/), & 345 description="Maximum execution time for this run. Time in seconds or in HH:MM:SS.", & 346 usage="WALLTIME {real} or {HH:MM:SS}", default_lc_val="") 347 CALL section_add_keyword(section, keyword) 348 CALL keyword_release(keyword) 349 350 CALL keyword_create(keyword, __LOCATION__, name="ECHO_INPUT", & 351 description="If the input should be echoed to the output with all the "// & 352 "defaults made explicit", & 353 usage="ECHO_INPUT NO", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 354 CALL section_add_keyword(section, keyword) 355 CALL keyword_release(keyword) 356 357 CALL keyword_create(keyword, __LOCATION__, name="ECHO_ALL_HOSTS", & 358 description="Echo a list of hostname and pid for all MPI processes.", & 359 usage="ECHO_ALL_HOSTS NO", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 360 CALL section_add_keyword(section, keyword) 361 CALL keyword_release(keyword) 362 363 CALL keyword_create(keyword, __LOCATION__, name="ENABLE_MPI_IO", & 364 description="Enable MPI parallelization for all supported I/O routines "// & 365 "Currently, only cube file writer/reader routines use MPI I/O. Disabling "// & 366 "this flag might speed up calculations dominated by I/O.", & 367 usage="ENABLE_MPI_IO FALSE", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) 368 CALL section_add_keyword(section, keyword) 369 CALL keyword_release(keyword) 370 371 CALL keyword_create(keyword, __LOCATION__, name="TRACE", & 372 description="If a debug trace of the execution of the program should be written ", & 373 usage="TRACE", & 374 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 375 CALL section_add_keyword(section, keyword) 376 CALL keyword_release(keyword) 377 378 CALL keyword_create(keyword, __LOCATION__, name="TRACE_MASTER", & 379 description="For parallel TRACEd runs: only the master node writes output.", & 380 usage="TRACE_MASTER", & 381 default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) 382 CALL section_add_keyword(section, keyword) 383 CALL keyword_release(keyword) 384 385 CALL keyword_create( & 386 keyword, __LOCATION__, name="TRACE_MAX", & 387 description="Limit the total number a given subroutine is printed in the trace. Accounting is not influenced.", & 388 usage="TRACE_MAX 100", default_i_val=HUGE(0)) 389 CALL section_add_keyword(section, keyword) 390 CALL keyword_release(keyword) 391 392 CALL keyword_create( & 393 keyword, __LOCATION__, name="TRACE_ROUTINES", & 394 description="A list of routines to trace. If left empty all routines are traced. Accounting is not influenced.", & 395 usage="TRACE_ROUTINES {routine_name1} {routine_name2} ...", type_of_var=char_t, & 396 n_var=-1) 397 CALL section_add_keyword(section, keyword) 398 CALL keyword_release(keyword) 399 400 CALL keyword_create( & 401 keyword, __LOCATION__, name="FLUSH_SHOULD_FLUSH", & 402 description="Flush output regularly, enabling this option might degrade performance significantly on certain machines.", & 403 usage="FLUSH_SHOULD_FLUSH", & 404 default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) 405 CALL section_add_keyword(section, keyword) 406 CALL keyword_release(keyword) 407 408 CALL keyword_create(keyword, __LOCATION__, name="CALLGRAPH", & 409 description="At the end of the run write a callgraph to file, "// & 410 "which contains detailed timing informations. "// & 411 "This callgraph can be viewed e.g. with the open-source program kcachegrind.", & 412 usage="CALLGRAPH {NONE|MASTER|ALL}", & 413 default_i_val=CALLGRAPH_NONE, lone_keyword_i_val=CALLGRAPH_MASTER, & 414 enum_c_vals=s2a("NONE", "MASTER", "ALL"), & 415 enum_desc=s2a("No callgraph gets written", & 416 "Only the master process writes his callgraph", & 417 "All processes write their callgraph (into a separate files)."), & 418 enum_i_vals=(/CALLGRAPH_NONE, CALLGRAPH_MASTER, CALLGRAPH_ALL/)) 419 CALL section_add_keyword(section, keyword) 420 CALL keyword_release(keyword) 421 422 CALL keyword_create(keyword, __LOCATION__, name="CALLGRAPH_FILE_NAME", & 423 description="Name of the callgraph file, which is written at the end of the run. "// & 424 "If not specified the project name will be used as filename.", & 425 usage="CALLGRAPH_FILE_NAME {filename}", default_lc_val="") 426 CALL section_add_keyword(section, keyword) 427 CALL keyword_release(keyword) 428 429 CALL keyword_create(keyword, __LOCATION__, name="SEED", & 430 description="Initial seed for the global (pseudo)random number generator "// & 431 "to create a stream of normally Gaussian distributed random numbers. "// & 432 "Exactly 1 or 6 positive integer values are expected. A single value is "// & 433 "replicated to fill up the full seed array with 6 numbers.", & 434 n_var=-1, & 435 type_of_var=integer_t, & 436 usage="SEED {INTEGER} .. {INTEGER}", & 437 default_i_vals=(/2000/)) 438 CALL section_add_keyword(section, keyword) 439 CALL keyword_release(keyword) 440 441 CALL keyword_create(keyword, __LOCATION__, name="SAVE_MEM", & 442 description="Some sections of the input structure are deallocated when not needed,"// & 443 " and reallocated only when used. This reduces the required maximum memory ", & 444 usage="SAVE_MEM", & 445 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 446 CALL section_add_keyword(section, keyword) 447 CALL keyword_release(keyword) 448 449 CALL cp_print_key_section_create(print_key, __LOCATION__, "TIMINGS", description= & 450 "Controls the printing of the timing report at the end of CP2K execution", & 451 print_level=silent_print_level, filename="__STD_OUT__") 452 453 CALL keyword_create(keyword, __LOCATION__, name="THRESHOLD", & 454 description="Specify % of CPUTIME above which the contribution will be inserted in the"// & 455 " final timing report (e.g. 0.02 = 2%)", & 456 usage="THRESHOLD {REAL}", & 457 default_r_val=0.02_dp) 458 CALL section_add_keyword(print_key, keyword) 459 CALL keyword_release(keyword) 460 461 CALL keyword_create(keyword, __LOCATION__, name="SORT_BY_SELF_TIME", & 462 description="Sort the final timing report by the average self (exclusive) time instead of the "// & 463 "total (inclusive) time of a routine", & 464 usage="SORT_BY_SELF_TIME on", & 465 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 466 CALL section_add_keyword(print_key, keyword) 467 CALL keyword_release(keyword) 468 469 CALL keyword_create(keyword, __LOCATION__, name="REPORT_MAXLOC", & 470 description="Report the rank with the slowest maximum self timing."// & 471 " Can be used to debug hard- or software."// & 472 " Also enables ECHO_ALL_HOSTS to link rank to hostname.", & 473 usage="REPORT_MAXLOC on", & 474 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 475 CALL section_add_keyword(print_key, keyword) 476 CALL keyword_release(keyword) 477 478 CALL keyword_create(keyword, __LOCATION__, name="TIME_MPI", & 479 description="Include message_passing calls in the timing report (useful with CALLGRAPH).", & 480 usage="TIME_MPI .FALSE.", & 481 default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) 482 CALL section_add_keyword(print_key, keyword) 483 CALL keyword_release(keyword) 484 485 CALL keyword_create(keyword, __LOCATION__, name="TIMINGS_LEVEL", & 486 description="Specify the level of timings report. "// & 487 "Possible values are: 0 (report only CP2K root timer), 1 (all timers).", & 488 usage="TIMINGS_LEVEL 1", & 489 default_i_val=default_timings_level, lone_keyword_i_val=default_timings_level) 490 CALL section_add_keyword(print_key, keyword) 491 CALL keyword_release(keyword) 492 493 CALL section_add_subsection(section, print_key) 494 CALL section_release(print_key) 495 496 CALL cp_print_key_section_create(print_key, __LOCATION__, "REFERENCES", description= & 497 "Controls the printing of the references relevant to the calculations performed", & 498 print_level=silent_print_level, filename="__STD_OUT__") 499 CALL section_add_subsection(section, print_key) 500 CALL section_release(print_key) 501 502 CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", & 503 description="controls the printing of initialization controlled by the global section", & 504 print_level=silent_print_level, add_last=add_last_numeric, filename="__STD_OUT__") 505 CALL section_add_subsection(section, print_key) 506 CALL section_release(print_key) 507 508 CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT", description= & 509 "controls the printing of physical and mathematical constants", & 510 print_level=medium_print_level, filename="__STD_OUT__") 511 512 CALL keyword_create(keyword, __LOCATION__, name="BASIC_DATA_TYPES", & 513 description="Controls the printing of the basic data types.", & 514 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 515 CALL section_add_keyword(print_key, keyword) 516 CALL keyword_release(keyword) 517 CALL keyword_create(keyword, __LOCATION__, name="physcon", & 518 description="if the printkey is active prints the physical constants", & 519 default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) 520 CALL section_add_keyword(print_key, keyword) 521 CALL keyword_release(keyword) 522 CALL keyword_create(keyword, __LOCATION__, name="SPHERICAL_HARMONICS", & 523 description="if the printkey is active prints the spherical harmonics", & 524 default_i_val=-1, type_of_var=integer_t) 525 CALL section_add_keyword(print_key, keyword) 526 CALL keyword_release(keyword) 527 CALL keyword_create(keyword, __LOCATION__, name="RNG_MATRICES", & 528 description="Prints the transformation matrices used by the "// & 529 " random number generator", & 530 default_l_val=.FALSE., & 531 lone_keyword_l_val=.TRUE.) 532 CALL section_add_keyword(print_key, keyword) 533 CALL keyword_release(keyword) 534 CALL keyword_create(keyword, __LOCATION__, name="RNG_CHECK", & 535 description="Performs a check of the global (pseudo)random "// & 536 "number generator (RNG) and prints the result", & 537 default_l_val=.FALSE., & 538 lone_keyword_l_val=.TRUE.) 539 CALL section_add_keyword(print_key, keyword) 540 CALL keyword_release(keyword) 541 CALL keyword_create(keyword, __LOCATION__, name="GLOBAL_GAUSSIAN_RNG", & 542 description="Prints the initial status of the global Gaussian "// & 543 "(pseudo)random number stream which is mostly used for "// & 544 "the velocity initialization", & 545 default_l_val=.FALSE., & 546 lone_keyword_l_val=.TRUE.) 547 CALL section_add_keyword(print_key, keyword) 548 CALL keyword_release(keyword) 549 550 CALL section_add_subsection(section, print_key) 551 CALL section_release(print_key) 552 NULLIFY (sub_section) 553 ! FM section 554 CALL create_fm_section(sub_section) 555 CALL section_add_subsection(section, sub_section) 556 CALL section_release(sub_section) 557 ! DBCSR options 558 CALL create_dbcsr_section(sub_section) 559 CALL section_add_subsection(section, sub_section) 560 CALL section_release(sub_section) 561 ! FM diagonalization redistribution rules 562 CALL create_fm_diag_rules_section(sub_section) 563 CALL section_add_subsection(section, sub_section) 564 CALL section_release(sub_section) 565 566 END SUBROUTINE create_global_section 567 568! ************************************************************************************************** 569!> \brief Creates the dbcsr section for configuring FM 570!> \param section ... 571!> \date 2011-04-05 572!> \author Florian Schiffmann 573! ************************************************************************************************** 574 SUBROUTINE create_fm_section(section) 575 TYPE(section_type), POINTER :: section 576 577 CHARACTER(len=*), PARAMETER :: routineN = 'create_fm_section', & 578 routineP = moduleN//':'//routineN 579 580 TYPE(keyword_type), POINTER :: keyword 581 582 CPASSERT(.NOT. ASSOCIATED(section)) 583 CALL section_create(section, __LOCATION__, name="FM", & 584 description="Configuration options for the full matrices.", & 585 n_keywords=1, n_subsections=0, repeats=.FALSE.) 586 587 NULLIFY (keyword) 588 589 CALL keyword_create(keyword, __LOCATION__, name="NROW_BLOCKS", & 590 description="Defines the number of rows per scalapack block in "// & 591 "the creation of block cyclic dense matrices ", & 592 default_i_val=32) 593 CALL section_add_keyword(section, keyword) 594 CALL keyword_release(keyword) 595 596 CALL keyword_create(keyword, __LOCATION__, name="NCOL_BLOCKS", & 597 description="Defines the number of columns per scalapack block in "// & 598 "the creation of vlock cyclic dense matrices ", & 599 default_i_val=32) 600 CALL section_add_keyword(section, keyword) 601 CALL keyword_release(keyword) 602 603 CALL keyword_create(keyword, __LOCATION__, name="FORCE_BLOCK_SIZE", & 604 description="Ensure for small matrices that the layout is compatible "// & 605 "with bigger ones, i.e. no subdivision is performed (can break LAPACK!!!).", & 606 usage="FORCE_BLOCK_SIZE", & 607 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 608 CALL section_add_keyword(section, keyword) 609 CALL keyword_release(keyword) 610 611 CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_MATRIX_MULTIPLICATION", & 612 description="Allows to switch between scalapack pdgemm and dbcsr_multiply. "// & 613 "On normal systems pdgemm is recommended on system with GPU "// & 614 "is optimized and can give better performance. NOTE: if DBCSR is employed "// & 615 "FORCE_BLOCK_SIZE should be set. The performance on GPU's depends "// & 616 "crucially on the BLOCK_SIZES. Make sure optimized kernels are available.", & 617 usage="TYPE_OF_MATRIX_MULTIPLICATION ELPA", & 618 default_i_val=do_pdgemm, & 619 enum_i_vals=(/do_pdgemm, do_dbcsr/), & 620 enum_c_vals=s2a("PDGEMM", "DBCSR_MM"), & 621 enum_desc=s2a("Standard scalapack: pdgemm", & 622 "DBCSR_MM is employed. This needs local transformation of the matrices")) 623 CALL section_add_keyword(section, keyword) 624 CALL keyword_release(keyword) 625 626 ! 627 END SUBROUTINE create_fm_section 628! ************************************************************************************************** 629!> \brief Creates the input section used to define the heuristic rules which determine if 630!> a FM matrix should be redistributed before diagonalizing it. 631!> \param section the input section to create 632!> \author Nico Holmberg [01.2018] 633! ************************************************************************************************** 634 SUBROUTINE create_fm_diag_rules_section(section) 635 TYPE(section_type), POINTER :: section 636 637 CHARACTER(len=*), PARAMETER :: routineN = 'create_fm_diag_rules_section', & 638 routineP = moduleN//':'//routineN 639 640 TYPE(keyword_type), POINTER :: keyword 641 642 CPASSERT(.NOT. ASSOCIATED(section)) 643 CALL section_create(section, __LOCATION__, name="FM_DIAG_SETTINGS", & 644 description="This section defines a set of heuristic rules which are "// & 645 "used to calculate the optimal number of CPUs, M, needed to diagonalize a "// & 646 "full matrix distributed on N processors (FM type). If M < N, the matrix "// & 647 "is redistributed onto M processors before it is diagonalized. "// & 648 "The optimal value is calculate according to M = ((K+a*x-1)/(a*x))*a, "// & 649 "where K is the size of the matrix, and {a, x} are integers defined below. "// & 650 "The default values have been selected based on timings on a Cray XE6. "// & 651 "Supports diagonalization libraries SL and ELPA (see keyword ELPA_FORCE_REDISTRIBUTE).", & 652 n_keywords=3, n_subsections=0, repeats=.FALSE.) 653 654 NULLIFY (keyword) 655 656 CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_A", & 657 description="Parameter used for defining the rule which determines the optimal "// & 658 "number of CPUs needed to diagonalize a full distributed matrix. The optimal "// & 659 "number of CPUs will be an integer multiple of this variable.", & 660 usage="PARAMETER_A 4", type_of_var=integer_t, & 661 default_i_val=4) 662 CALL section_add_keyword(section, keyword) 663 CALL keyword_release(keyword) 664 665 CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_X", & 666 description="Parameter used for defining the rule which determines the optimal "// & 667 "number of CPUs needed to diagonalize a full distributed matrix. The optimal "// & 668 "number of CPUs will be roughly proportional to this value.", & 669 usage="PARAMETER_X 60", type_of_var=integer_t, & 670 default_i_val=60) 671 CALL section_add_keyword(section, keyword) 672 CALL keyword_release(keyword) 673 674 CALL keyword_create(keyword, __LOCATION__, name="PRINT_FM_REDISTRIBUTE", & 675 description="Controls printing of information related to this section. For each "// & 676 "diagonalized matrix, prints the size of the matrix, the optimal number of CPUs, "// & 677 "as well as notifies if the matrix was redistributed. Useful for testing.", & 678 usage="PRINT_FM_REDISTRIBUTE", type_of_var=logical_t, & 679 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 680 CALL section_add_keyword(section, keyword) 681 CALL keyword_release(keyword) 682 683 CALL keyword_create(keyword, __LOCATION__, name="ELPA_FORCE_REDISTRIBUTE", & 684 description="Controls how to perform redistribution when ELPA is used for diagonalization. "// & 685 "By default, matrices are redistributed only to prevent crashes in the ELPA library "// & 686 "which happen when the original matrix is distributed on too many processors. "// & 687 "By turning on this keyword, redistribution is always performed using the defined rules. ", & 688 usage="ELPA_FORCE_REDISTRIBUTE", type_of_var=logical_t, & 689 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 690 CALL section_add_keyword(section, keyword) 691 CALL keyword_release(keyword) 692 693 END SUBROUTINE create_fm_diag_rules_section 694 695END MODULE input_cp2k_global 696