LCOV - code coverage report
Current view: top level - src - input_cp2k_global.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:dc8eeee) Lines: 225 225 100.0 %
Date: 2025-05-15 08:34:30 Functions: 4 4 100.0 %

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

Generated by: LCOV version 1.15