LCOV - code coverage report
Current view: top level - src - input_cp2k_global.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:51fc4cd) Lines: 100.0 % 225 225
Test Date: 2026-02-04 06:28:27 Functions: 100.0 % 4 4

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

Generated by: LCOV version 2.0-1