LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:21ef868) Lines: 99.5 % 848 844
Test Date: 2026-08-14 07:04:57 Functions: 95.5 % 22 21

            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 function that build the dft section of the input
      10              : !> \par History
      11              : !>      10.2005 moved out of input_cp2k [fawzi]
      12              : !> \author fawzi
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_dft
      15              :    USE basis_set_types,                 ONLY: basis_sort_default,&
      16              :                                               basis_sort_zet
      17              :    USE bibliography,                    ONLY: &
      18              :         Andermatt2016, Andreussi2012, Andreussi2019, Avezac2005, Bengtsson1999, Blochl1995, &
      19              :         Brelaz1979, Chai2024a, Chai2025a, Fattebert2002, Guidon2010, Iannuzzi2006, Kunert2003, &
      20              :         Marek2025, Merlot2014, Perdew1981, VandeVondele2005b, Yin2017
      21              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      22              :                                               cp_print_key_section_create,&
      23              :                                               high_print_level,&
      24              :                                               low_print_level,&
      25              :                                               medium_print_level,&
      26              :                                               silent_print_level
      27              :    USE cp_spline_utils,                 ONLY: pw_interp,&
      28              :                                               spline3_pbc_interp
      29              :    USE cp_units,                        ONLY: cp_unit_to_cp2k
      30              :    USE input_constants,                 ONLY: &
      31              :         admm1_type, admm2_type, admmp_type, admmq_type, admms_type, do_admm_aux_exch_func_bee, &
      32              :         do_admm_aux_exch_func_bee_libxc, do_admm_aux_exch_func_default, &
      33              :         do_admm_aux_exch_func_default_libxc, do_admm_aux_exch_func_none, &
      34              :         do_admm_aux_exch_func_opt, do_admm_aux_exch_func_opt_libxc, do_admm_aux_exch_func_pbex, &
      35              :         do_admm_aux_exch_func_pbex_libxc, do_admm_aux_exch_func_sx_libxc, &
      36              :         do_admm_basis_projection, do_admm_blocked_projection, do_admm_blocking_purify_full, &
      37              :         do_admm_charge_constrained_projection, do_admm_exch_scaling_merlot, &
      38              :         do_admm_exch_scaling_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace, &
      39              :         do_admm_purify_mcweeny, do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
      40              :         do_admm_purify_none, do_admm_purify_none_dm, do_arnoldi, do_bch, do_cn, do_em, do_etrs, &
      41              :         do_exact, do_pade, do_taylor, ehrenfest, gaussian, kg_color_dsatur, kg_color_greedy, &
      42              :         kg_tnadd_atomic, kg_tnadd_embed, kg_tnadd_embed_ri, kg_tnadd_none, no_admm_type, &
      43              :         numerical, plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges, plus_u_tensorial, &
      44              :         real_time_propagation, rel_dkh, rel_none, rel_pot_erfc, rel_pot_full, rel_sczora_mp, &
      45              :         rel_trans_atom, rel_trans_full, rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, &
      46              :         rtp_bse_ham_g0w0, rtp_bse_ham_ks, rtp_bse_kernel_ri_ao, rtp_bse_kernel_ri_default, &
      47              :         rtp_bse_kernel_ri_rs, rtp_method_bse, rtp_method_tddft, sccs_andreussi, &
      48              :         sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, sccs_derivative_fft, &
      49              :         sccs_fattebert_gygi, sccs_saa_andreussi, sic_ad, sic_eo, sic_list_all, sic_list_unpaired, &
      50              :         sic_mauri_spz, sic_mauri_us, sic_none, slater, use_mom_ref_coac, use_mom_ref_com, &
      51              :         use_mom_ref_user, use_mom_ref_zero, use_restart_wfn, use_rt_restart, use_scf_wfn, &
      52              :         weight_type_mass, weight_type_unit
      53              :    USE input_cp2k_almo,                 ONLY: create_almo_scf_section
      54              :    USE input_cp2k_as,                   ONLY: create_active_space_section
      55              :    USE input_cp2k_ec,                   ONLY: create_ec_section
      56              :    USE input_cp2k_exstate,              ONLY: create_exstate_section
      57              :    USE input_cp2k_external,             ONLY: create_ext_den_section,&
      58              :                                               create_ext_pot_section,&
      59              :                                               create_ext_vxc_section
      60              :    USE input_cp2k_field,                ONLY: create_efield_section,&
      61              :                                               create_per_efield_section
      62              :    USE input_cp2k_harris,               ONLY: create_harris_section
      63              :    USE input_cp2k_kpoints,              ONLY: create_kpoint_set_section,&
      64              :                                               create_kpoints_section
      65              :    USE input_cp2k_loc,                  ONLY: create_localize_section
      66              :    USE input_cp2k_ls,                   ONLY: create_ls_scf_section
      67              :    USE input_cp2k_poisson,              ONLY: create_poisson_section
      68              :    USE input_cp2k_print_dft,            ONLY: create_print_dft_section
      69              :    USE input_cp2k_projection_rtp,       ONLY: create_projection_rtp_section
      70              :    USE input_cp2k_qs,                   ONLY: create_lrigpw_section,&
      71              :                                               create_qs_section
      72              :    USE input_cp2k_rsgrid,               ONLY: create_rsgrid_section
      73              :    USE input_cp2k_scf,                  ONLY: create_scf_section
      74              :    USE input_cp2k_smeagol,              ONLY: create_dft_smeagol_section
      75              :    USE input_cp2k_transport,            ONLY: create_transport_section
      76              :    USE input_cp2k_xas,                  ONLY: create_xas_section,&
      77              :                                               create_xas_tdp_section
      78              :    USE input_cp2k_xc,                   ONLY: create_xc_section
      79              :    USE input_keyword_types,             ONLY: keyword_create,&
      80              :                                               keyword_release,&
      81              :                                               keyword_type
      82              :    USE input_section_types,             ONLY: section_add_keyword,&
      83              :                                               section_add_subsection,&
      84              :                                               section_create,&
      85              :                                               section_release,&
      86              :                                               section_type
      87              :    USE input_val_types,                 ONLY: char_t,&
      88              :                                               integer_t,&
      89              :                                               lchar_t,&
      90              :                                               logical_t,&
      91              :                                               real_t
      92              :    USE kinds,                           ONLY: dp
      93              :    USE physcon,                         ONLY: evolt,&
      94              :                                               femtoseconds
      95              :    USE pw_spline_utils,                 ONLY: no_precond,&
      96              :                                               precond_spl3_1,&
      97              :                                               precond_spl3_2,&
      98              :                                               precond_spl3_3,&
      99              :                                               precond_spl3_aint,&
     100              :                                               precond_spl3_aint2
     101              :    USE string_utilities,                ONLY: s2a
     102              : #include "./base/base_uses.f90"
     103              : 
     104              :    IMPLICIT NONE
     105              :    PRIVATE
     106              : 
     107              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_dft'
     108              : 
     109              :    PUBLIC :: create_dft_section
     110              :    PUBLIC :: create_bsse_section
     111              :    PUBLIC :: create_interp_section
     112              :    PUBLIC :: create_mgrid_section
     113              : 
     114              : CONTAINS
     115              : 
     116              : ! **************************************************************************************************
     117              : !> \brief creates the dft section
     118              : !> \param section the section to be created
     119              : !> \author fawzi
     120              : ! **************************************************************************************************
     121        10643 :    SUBROUTINE create_dft_section(section)
     122              :       TYPE(section_type), POINTER                        :: section
     123              : 
     124              :       TYPE(keyword_type), POINTER                        :: keyword
     125              :       TYPE(section_type), POINTER                        :: subsection
     126              : 
     127        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     128              :       CALL section_create(section, __LOCATION__, name="DFT", &
     129              :                           description="Controls electronic-structure settings for Quickstep and related "// &
     130              :                           "Gaussian-basis DFT methods.", &
     131        10643 :                           n_keywords=3, n_subsections=4, repeats=.FALSE.)
     132              : 
     133        10643 :       NULLIFY (keyword)
     134              :       CALL keyword_create(keyword, __LOCATION__, name="BASIS_SET_FILE_NAME", &
     135              :                           description="Name of a basis-set library file, optionally including a path. "// &
     136              :                           "This keyword can be repeated to search several basis-set files.", &
     137              :                           usage="BASIS_SET_FILE_NAME <FILENAME>", &
     138              :                           type_of_var=lchar_t, repeats=.TRUE., &
     139        10643 :                           default_lc_val="BASIS_SET", n_var=1)
     140        10643 :       CALL section_add_keyword(section, keyword)
     141        10643 :       CALL keyword_release(keyword)
     142              : 
     143              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
     144              :                           description="Name of the pseudopotential library file, optionally including a path. "// &
     145              :                           "This keyword can be repeated to search several pseudopotential files. "// &
     146              :                           "Files are searched in input order and the first matching potential is used. "// &
     147              :                           "The potential selected for each kind is set with KIND%POTENTIAL.", &
     148              :                           usage="POTENTIAL_FILE_NAME <FILENAME>", &
     149              :                           type_of_var=lchar_t, repeats=.TRUE., &
     150        10643 :                           default_lc_val="POTENTIAL", n_var=1)
     151        10643 :       CALL section_add_keyword(section, keyword)
     152        10643 :       CALL keyword_release(keyword)
     153              : 
     154              :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
     155              :                           variants=["RESTART_FILE_NAME"], &
     156              :                           description="Name of the wavefunction restart file, may include a path."// &
     157              :                           " If no file is specified, the default is to open the file as generated by the wfn restart print key.", &
     158              :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
     159        21286 :                           type_of_var=lchar_t)
     160        10643 :       CALL section_add_keyword(section, keyword)
     161        10643 :       CALL keyword_release(keyword)
     162              : 
     163              :       CALL keyword_create(keyword, __LOCATION__, &
     164              :                           name="UKS", &
     165              :                           variants=s2a("UNRESTRICTED_KOHN_SHAM", &
     166              :                                        "LSD", &
     167              :                                        "SPIN_POLARIZED"), &
     168              :                           description="Requests a spin-polarized calculation using alpha "// &
     169              :                           "and beta orbitals, i.e. no spin restriction is applied", &
     170              :                           usage="LSD", &
     171              :                           default_l_val=.FALSE., &
     172        10643 :                           lone_keyword_l_val=.TRUE.)
     173        10643 :       CALL section_add_keyword(section, keyword)
     174        10643 :       CALL keyword_release(keyword)
     175              :       CALL keyword_create(keyword, __LOCATION__, &
     176              :                           name="ROKS", &
     177              :                           variants=["RESTRICTED_OPEN_KOHN_SHAM"], &
     178              :                           description="Requests a restricted open Kohn-Sham calculation", &
     179              :                           usage="ROKS", &
     180              :                           default_l_val=.FALSE., &
     181        21286 :                           lone_keyword_l_val=.TRUE.)
     182        10643 :       CALL section_add_keyword(section, keyword)
     183        10643 :       CALL keyword_release(keyword)
     184              :       CALL keyword_create(keyword, __LOCATION__, &
     185              :                           name="MULTIPLICITY", &
     186              :                           variants=["MULTIP"], &
     187              :                           description="Two times the total spin plus one. "// &
     188              :                           "Specify 3 for a triplet, 4 for a quartet, "// &
     189              :                           "and so on. Default is 1 (singlet) for an "// &
     190              :                           "even number and 2 (doublet) for an odd number "// &
     191              :                           "of electrons.", &
     192              :                           usage="MULTIPLICITY 3", &
     193        21286 :                           default_i_val=0) ! this default value is just a flag to get the above
     194        10643 :       CALL section_add_keyword(section, keyword)
     195        10643 :       CALL keyword_release(keyword)
     196              :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE", &
     197              :                           description="The total charge of the system", &
     198              :                           usage="CHARGE -1", &
     199        10643 :                           default_i_val=0)
     200        10643 :       CALL section_add_keyword(section, keyword)
     201        10643 :       CALL keyword_release(keyword)
     202              : 
     203              :       CALL keyword_create(keyword, __LOCATION__, &
     204              :                           name="PLUS_U_METHOD", &
     205              :                           description="Method employed for the calculation of the DFT+U contribution", &
     206              :                           repeats=.FALSE., &
     207              :                           enum_c_vals=s2a("LOWDIN", "MULLIKEN", "MULLIKEN_CHARGES", "TENSORIAL"), &
     208              :                           enum_i_vals=[plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges, &
     209              :                                        plus_u_tensorial], &
     210              :                           enum_desc=s2a("Method based on Lowdin population analysis "// &
     211              :                                         "(computationally expensive, since the diagonalization of the "// &
     212              :                                         "overlap matrix is required, but possibly more robust than Mulliken)", &
     213              :                                         "Method based on Mulliken population analysis using the net AO and "// &
     214              :                                         "overlap populations (computationally cheap method)", &
     215              :                                         "Method based on Mulliken gross orbital populations (GOP)", &
     216              :                                         "Method based on Tensorial population analysis approach"), &
     217              :                           n_var=1, &
     218              :                           default_i_val=plus_u_mulliken, &
     219        10643 :                           usage="PLUS_U_METHOD Lowdin")
     220        10643 :       CALL section_add_keyword(section, keyword)
     221        10643 :       CALL keyword_release(keyword)
     222              : 
     223              :       CALL keyword_create(keyword, __LOCATION__, &
     224              :                           name="EPS_U_J_LOOP", &
     225              :                           description="Convergence threshold for the self-consistent update of U and J parameters "// &
     226              :                           "in the minimum tracking linear response calculation.", &
     227              :                           repeats=.FALSE., &
     228              :                           n_var=1, &
     229              :                           unit_str="hartree", &
     230              :                           default_r_val=1.0E-2_dp, &
     231        10643 :                           usage="EPS_U_J_LOOP [eV] 0.01")
     232        10643 :       CALL section_add_keyword(section, keyword)
     233        10643 :       CALL keyword_release(keyword)
     234              : 
     235              :       CALL keyword_create(keyword, __LOCATION__, &
     236              :                           name="MAX_MTLR_LOOP", &
     237              :                           description="Max number of iterations for calculated self-consistent linear response U and J.", &
     238              :                           repeats=.FALSE., &
     239              :                           default_i_val=10, &
     240        10643 :                           usage="MAX_MTLR_LOOP 10")
     241        10643 :       CALL section_add_keyword(section, keyword)
     242        10643 :       CALL keyword_release(keyword)
     243              : 
     244              :       CALL keyword_create(keyword, __LOCATION__, &
     245              :                           name="RELAX_MULTIPLICITY", &
     246              :                           variants=["RELAX_MULTIP"], &
     247              :                           description="Tolerance in Hartrees. Do not enforce the occupation "// &
     248              :                           "of alpha and beta MOs due to the initially "// &
     249              :                           "defined multiplicity, but rather follow the Aufbau principle. "// &
     250              :                           "A value greater than zero activates this option. "// &
     251              :                           "If alpha/beta MOs differ in energy less than this tolerance, "// &
     252              :                           "then alpha-MO occupation is preferred even if it is higher "// &
     253              :                           "in energy (within the tolerance). "// &
     254              :                           "Such spin-symmetry broken (spin-polarized) occupation is used "// &
     255              :                           "as SCF input, which (is assumed to) bias the SCF "// &
     256              :                           "towards a spin-polarized solution. "// &
     257              :                           "Thus, larger tolerance increases chances of ending up "// &
     258              :                           "with spin-polarization. "// &
     259              :                           "This option is only valid for unrestricted (i.e. spin polarised) "// &
     260              :                           "Kohn-Sham (UKS) calculations. It also needs non-zero "// &
     261              :                           "[ADDED_MOS](#CP2K_INPUT.FORCE_EVAL.DFT.SCF.ADDED_MOS) to actually affect the calculations, "// &
     262              :                           "which is why it is not expected to work with [OT](#CP2K_INPUT.FORCE_EVAL.DFT.SCF.OT) "// &
     263              :                           "and may raise errors when used with OT. "// &
     264              :                           "For more details see [this discussion](https://github.com/cp2k/cp2k/issues/4389).", &
     265              :                           usage="RELAX_MULTIPLICITY 0.00001", &
     266              :                           repeats=.FALSE., &
     267        21286 :                           default_r_val=0.0_dp)
     268        10643 :       CALL section_add_keyword(section, keyword)
     269        10643 :       CALL keyword_release(keyword)
     270              : 
     271              :       CALL keyword_create(keyword, __LOCATION__, name="SUBCELLS", &
     272              :                           description="Read the grid size for subcell generation in the construction of "// &
     273              :                           "neighbor lists.", usage="SUBCELLS 1.5", &
     274        10643 :                           n_var=1, default_r_val=2.0_dp)
     275        10643 :       CALL section_add_keyword(section, keyword)
     276        10643 :       CALL keyword_release(keyword)
     277              : 
     278              :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_BASIS", &
     279              :                           description="Specify type and size of automatically generated auxiliary "// &
     280              :                           "(RI) basis sets. Exactly two arguments are required for this option. "// &
     281              :                           "The first argument of basis type should be one of the following: "// &
     282              :                           "`RI_AUX`, `AUX_FIT`, `LRI_AUX`, `P_LRI_AUX`, `RI_HXC`, `RI_XAS`, or "// &
     283              :                           "`RI_HFX`. The second argument of basis size should be one of the "// &
     284              :                           "following: `SMALL`, `MEDIUM`, `LARGE`, or `HUGE`. The default is not "// &
     285              :                           "using any of these basis sets, requested by `AUTO_BASIS X X` (exactly "// &
     286              :                           "as written here).", &
     287              :                           usage="AUTO_BASIS {basis_type} {basis_size}", &
     288        31929 :                           type_of_var=char_t, repeats=.TRUE., n_var=-1, default_c_vals=["X", "X"])
     289        10643 :       CALL section_add_keyword(section, keyword)
     290        10643 :       CALL keyword_release(keyword)
     291              : 
     292              :       CALL keyword_create(keyword, __LOCATION__, &
     293              :                           name="SURFACE_DIPOLE_CORRECTION", &
     294              :                           variants=s2a("SURFACE_DIPOLE", &
     295              :                                        "SURF_DIP"), &
     296              :                           description="For slab calculations with asymmetric geometries, activate the correction of "// &
     297              :                           "the electrostatic potential with "// &
     298              :                           "by compensating for the surface dipole. Implemented only for slabs with normal "// &
     299              :                           "parallel to one Cartesian axis. The normal direction is given by the keyword SURF_DIP_DIR", &
     300              :                           usage="SURF_DIP", &
     301              :                           default_l_val=.FALSE., &
     302              :                           lone_keyword_l_val=.TRUE., &
     303        21286 :                           citations=[Bengtsson1999])
     304        10643 :       CALL section_add_keyword(section, keyword)
     305        10643 :       CALL keyword_release(keyword)
     306              : 
     307              :       CALL keyword_create(keyword, __LOCATION__, &
     308              :                           name="SURF_DIP_DIR", &
     309              :                           description="Cartesian axis parallel to surface normal.", &
     310              :                           enum_c_vals=s2a("X", "Y", "Z"), &
     311              :                           enum_i_vals=[1, 2, 3], &
     312              :                           enum_desc=s2a("Along x", "Along y", "Along z"), &
     313              :                           n_var=1, &
     314              :                           default_i_val=3, &
     315        10643 :                           usage="SURF_DIP_DIR Z")
     316        10643 :       CALL section_add_keyword(section, keyword)
     317        10643 :       CALL keyword_release(keyword)
     318              : 
     319              :       CALL keyword_create(keyword, __LOCATION__, &
     320              :                           name="SURF_DIP_POS", &
     321              :                           description="This keyword assigns an user defined position in Angstroms "// &
     322              :                           "in the direction normal to the surface (given by SURF_DIP_DIR). "// &
     323              :                           "The default value is -1.0_dp which appplies the correction at a position "// &
     324              :                           "that has minimum electron density on the grid.", &
     325              :                           usage="SURF_DIP_POS -1.0_dp", &
     326        10643 :                           default_r_val=-1.0_dp)
     327        10643 :       CALL section_add_keyword(section, keyword)
     328        10643 :       CALL keyword_release(keyword)
     329              : 
     330              :       CALL keyword_create(keyword, __LOCATION__, &
     331              :                           name="SURF_DIP_SWITCH", &
     332              :                           description="WARNING: Experimental feature under development that will help the "// &
     333              :                           "user to switch parameters to facilitate  SCF convergence. In its current form the "// &
     334              :                           "surface dipole correction is switched off if the calculation does not converge in "// &
     335              :                           "(0.5*MAX_SCF + 1) outer_scf steps. "// &
     336              :                           "The default value is .FALSE.", &
     337              :                           usage="SURF_DIP_SWITCH .TRUE.", &
     338              :                           default_l_val=.FALSE., &
     339        10643 :                           lone_keyword_l_val=.TRUE.)
     340        10643 :       CALL section_add_keyword(section, keyword)
     341        10643 :       CALL keyword_release(keyword)
     342              : 
     343              :       CALL keyword_create(keyword, __LOCATION__, &
     344              :                           name="CORE_CORR_DIP", &
     345              :                           description="If the total CORE_CORRECTION is non-zero and surface dipole "// &
     346              :                           "correction is switched on, presence of this keyword will adjust electron "// &
     347              :                           "density via MO occupation to reflect the total CORE_CORRECTION. "// &
     348              :                           "The default value is .FALSE.", &
     349              :                           usage="CORE_CORR_DIP .TRUE.", &
     350              :                           default_l_val=.FALSE., &
     351        10643 :                           lone_keyword_l_val=.TRUE.)
     352        10643 :       CALL section_add_keyword(section, keyword)
     353        10643 :       CALL keyword_release(keyword)
     354              : 
     355              :       CALL keyword_create(keyword, __LOCATION__, &
     356              :                           name="SORT_BASIS", &
     357              :                           description="Sorts basis functions according to a selected criterion. "// &
     358              :                           "Sorting by exponent can improve data locality for selected exact-exchange and RI workflows.", &
     359              :                           enum_c_vals=s2a("DEFAULT", "EXP"), &
     360              :                           enum_i_vals=[basis_sort_default, basis_sort_zet], &
     361              :                           enum_desc=s2a("don't sort", "sort w.r.t. exponent"), &
     362              :                           default_i_val=basis_sort_default, &
     363        10643 :                           usage="SORT_BASIS EXP")
     364        10643 :       CALL section_add_keyword(section, keyword)
     365        10643 :       CALL keyword_release(keyword)
     366              : 
     367        10643 :       NULLIFY (subsection)
     368        10643 :       CALL create_scf_section(subsection)
     369        10643 :       CALL section_add_subsection(section, subsection)
     370        10643 :       CALL section_release(subsection)
     371              : 
     372        10643 :       CALL create_ls_scf_section(subsection)
     373        10643 :       CALL section_add_subsection(section, subsection)
     374        10643 :       CALL section_release(subsection)
     375              : 
     376        10643 :       CALL create_almo_scf_section(subsection)
     377        10643 :       CALL section_add_subsection(section, subsection)
     378        10643 :       CALL section_release(subsection)
     379              : 
     380        10643 :       CALL create_kg_section(subsection)
     381        10643 :       CALL section_add_subsection(section, subsection)
     382        10643 :       CALL section_release(subsection)
     383              : 
     384        10643 :       CALL create_harris_section(subsection)
     385        10643 :       CALL section_add_subsection(section, subsection)
     386        10643 :       CALL section_release(subsection)
     387              : 
     388        10643 :       CALL create_ec_section(subsection)
     389        10643 :       CALL section_add_subsection(section, subsection)
     390        10643 :       CALL section_release(subsection)
     391              : 
     392        10643 :       CALL create_exstate_section(subsection)
     393        10643 :       CALL section_add_subsection(section, subsection)
     394        10643 :       CALL section_release(subsection)
     395              : 
     396        10643 :       CALL create_admm_section(subsection)
     397        10643 :       CALL section_add_subsection(section, subsection)
     398        10643 :       CALL section_release(subsection)
     399              : 
     400        10643 :       CALL create_qs_section(subsection)
     401        10643 :       CALL section_add_subsection(section, subsection)
     402        10643 :       CALL section_release(subsection)
     403              : 
     404        10643 :       CALL create_mgrid_section(subsection, create_subsections=.TRUE.)
     405        10643 :       CALL section_add_subsection(section, subsection)
     406        10643 :       CALL section_release(subsection)
     407              : 
     408        10643 :       CALL create_xc_section(subsection)
     409        10643 :       CALL section_add_subsection(section, subsection)
     410        10643 :       CALL section_release(subsection)
     411              : 
     412        10643 :       CALL create_relativistic_section(subsection)
     413        10643 :       CALL section_add_subsection(section, subsection)
     414        10643 :       CALL section_release(subsection)
     415              : 
     416        10643 :       CALL create_sic_section(subsection)
     417        10643 :       CALL section_add_subsection(section, subsection)
     418        10643 :       CALL section_release(subsection)
     419              : 
     420        10643 :       CALL create_low_spin_roks_section(subsection)
     421        10643 :       CALL section_add_subsection(section, subsection)
     422        10643 :       CALL section_release(subsection)
     423              : 
     424        10643 :       CALL create_efield_section(subsection)
     425        10643 :       CALL section_add_subsection(section, subsection)
     426        10643 :       CALL section_release(subsection)
     427              : 
     428        10643 :       CALL create_per_efield_section(subsection)
     429        10643 :       CALL section_add_subsection(section, subsection)
     430        10643 :       CALL section_release(subsection)
     431              : 
     432        10643 :       CALL create_ext_pot_section(subsection)
     433        10643 :       CALL section_add_subsection(section, subsection)
     434        10643 :       CALL section_release(subsection)
     435              : 
     436        10643 :       CALL create_transport_section(subsection)
     437        10643 :       CALL section_add_subsection(section, subsection)
     438        10643 :       CALL section_release(subsection)
     439              : 
     440              :       ! ZMP sections to include the external density or v_xc potential
     441        10643 :       CALL create_ext_den_section(subsection)
     442        10643 :       CALL section_add_subsection(section, subsection)
     443        10643 :       CALL section_release(subsection)
     444              : 
     445        10643 :       CALL create_ext_vxc_section(subsection)
     446        10643 :       CALL section_add_subsection(section, subsection)
     447        10643 :       CALL section_release(subsection)
     448              : 
     449        10643 :       CALL create_poisson_section(subsection)
     450        10643 :       CALL section_add_subsection(section, subsection)
     451        10643 :       CALL section_release(subsection)
     452              : 
     453        10643 :       CALL create_kpoints_section(subsection)
     454        10643 :       CALL section_add_subsection(section, subsection)
     455        10643 :       CALL section_release(subsection)
     456              : 
     457        10643 :       CALL create_kpoint_set_section(subsection)
     458        10643 :       CALL section_add_subsection(section, subsection)
     459        10643 :       CALL section_release(subsection)
     460              : 
     461        10643 :       CALL create_implicit_solv_section(subsection)
     462        10643 :       CALL section_add_subsection(section, subsection)
     463        10643 :       CALL section_release(subsection)
     464              : 
     465        10643 :       CALL create_density_fitting_section(subsection)
     466        10643 :       CALL section_add_subsection(section, subsection)
     467        10643 :       CALL section_release(subsection)
     468              : 
     469        10643 :       CALL create_xas_section(subsection)
     470        10643 :       CALL section_add_subsection(section, subsection)
     471        10643 :       CALL section_release(subsection)
     472              : 
     473        10643 :       CALL create_xas_tdp_section(subsection)
     474        10643 :       CALL section_add_subsection(section, subsection)
     475        10643 :       CALL section_release(subsection)
     476              : 
     477        10643 :       CALL create_localize_section(subsection)
     478        10643 :       CALL section_add_subsection(section, subsection)
     479        10643 :       CALL section_release(subsection)
     480              : 
     481        10643 :       CALL create_rtp_section(subsection)
     482        10643 :       CALL section_add_subsection(section, subsection)
     483        10643 :       CALL section_release(subsection)
     484              : 
     485        10643 :       CALL create_print_dft_section(subsection)
     486        10643 :       CALL section_add_subsection(section, subsection)
     487        10643 :       CALL section_release(subsection)
     488              : 
     489        10643 :       CALL create_sccs_section(subsection)
     490        10643 :       CALL section_add_subsection(section, subsection)
     491        10643 :       CALL section_release(subsection)
     492              : 
     493        10643 :       CALL create_active_space_section(subsection)
     494        10643 :       CALL section_add_subsection(section, subsection)
     495        10643 :       CALL section_release(subsection)
     496              : 
     497        10643 :       CALL create_dft_smeagol_section(subsection)
     498        10643 :       CALL section_add_subsection(section, subsection)
     499        10643 :       CALL section_release(subsection)
     500              : 
     501        10643 :       CALL create_hairy_probes_section(subsection)
     502        10643 :       CALL section_add_subsection(section, subsection)
     503        10643 :       CALL section_release(subsection)
     504              : 
     505        10643 :       CALL create_pcc_section(subsection)
     506        10643 :       CALL section_add_subsection(section, subsection)
     507        10643 :       CALL section_release(subsection)
     508              : 
     509        10643 :       CALL create_paep_section(subsection)
     510        10643 :       CALL section_add_subsection(section, subsection)
     511        10643 :       CALL section_release(subsection)
     512              : 
     513        10643 :    END SUBROUTINE create_dft_section
     514              : 
     515              : ! **************************************************************************************************
     516              : !> \brief Hairy Probe DFT Model
     517              : !> \param section ...
     518              : !> \author Margherita Buraschi
     519              : ! **************************************************************************************************
     520              : 
     521        10643 :    SUBROUTINE create_hairy_probes_section(section)
     522              :       TYPE(section_type), POINTER                        :: section
     523              : 
     524              :       TYPE(keyword_type), POINTER                        :: keyword
     525              : 
     526        10643 :       NULLIFY (keyword)
     527        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     528              :       CALL section_create(section, __LOCATION__, &
     529              :                           name="HAIRY_PROBES", &
     530              :                           description="Sets up a Hairy Probe calculation. ", &
     531        10643 :                           n_keywords=0, n_subsections=0, repeats=.TRUE.)
     532              : 
     533              :       CALL keyword_create(keyword, __LOCATION__, &
     534              :                           name="_SECTION_PARAMETERS_", &
     535              :                           description="Controls the activation of hairy probe", &
     536              :                           usage="&HAIRY_PROBES ON", &
     537              :                           default_l_val=.FALSE., &
     538        10643 :                           lone_keyword_l_val=.TRUE.)
     539        10643 :       CALL section_add_keyword(section, keyword)
     540        10643 :       CALL keyword_release(keyword)
     541              : 
     542              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_IDS", &
     543              :                           description="Indexes of the atoms to which the probes are attached.", &
     544              :                           usage="ATOM_IDS <INTEGER> .. <INTEGER>", &
     545        10643 :                           type_of_var=integer_t, n_var=-1)
     546        10643 :       CALL section_add_keyword(section, keyword)
     547        10643 :       CALL keyword_release(keyword)
     548              : 
     549              :       CALL keyword_create(keyword, __LOCATION__, name="T", &
     550              :                           description="Electronic temperature [K]", &
     551              :                           usage="T <REAL>", &
     552              :                           default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K"), &
     553        10643 :                           unit_str="K")
     554        10643 :       CALL section_add_keyword(section, keyword)
     555        10643 :       CALL keyword_release(keyword)
     556              : 
     557              :       CALL keyword_create(keyword, __LOCATION__, name="MU", &
     558              :                           description="Chemical potential of the electrons in the probes [eV] ", &
     559              :                           usage="MU <REAL>", &
     560              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
     561        10643 :                           unit_str="eV")
     562        10643 :       CALL section_add_keyword(section, keyword)
     563        10643 :       CALL keyword_release(keyword)
     564              : 
     565              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     566              :                           description="Parameter for solution probes ", &
     567              :                           usage="ALPHA <REAL>", &
     568        10643 :                           default_r_val=1.0_dp)
     569        10643 :       CALL section_add_keyword(section, keyword)
     570        10643 :       CALL keyword_release(keyword)
     571              : 
     572              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_HP", &
     573              :                           description=" Tolerance for accuracy checks on occupation numbers "// &
     574              :                           "calculated using hair-probes. ", &
     575              :                           usage="EPS_HP <REAL>", &
     576        10643 :                           default_r_val=1.0E-5_dp)
     577        10643 :       CALL section_add_keyword(section, keyword)
     578        10643 :       CALL keyword_release(keyword)
     579        10643 :    END SUBROUTINE create_hairy_probes_section
     580              : !####################################################################################
     581              : 
     582              : ! **************************************************************************************************
     583              : !> \brief Implicit Solvation Model
     584              : !> \param section ...
     585              : !> \author tlaino
     586              : ! **************************************************************************************************
     587        10643 :    SUBROUTINE create_implicit_solv_section(section)
     588              :       TYPE(section_type), POINTER                        :: section
     589              : 
     590              :       TYPE(keyword_type), POINTER                        :: keyword
     591              :       TYPE(section_type), POINTER                        :: print_key, subsection
     592              : 
     593        10643 :       NULLIFY (keyword, subsection, print_key)
     594        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     595              :       CALL section_create(section, __LOCATION__, name="SCRF", &
     596              :                           description="Adds an implicit solvation model to the DFT calculation."// &
     597              :                           " Know also as Self Consistent Reaction Field.", &
     598        10643 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     599              : 
     600              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_OUT", &
     601              :                           description="Value of the dielectric constant outside the sphere", &
     602              :                           usage="EPS_OUT <REAL>", &
     603        10643 :                           default_r_val=1.0_dp)
     604        10643 :       CALL section_add_keyword(section, keyword)
     605        10643 :       CALL keyword_release(keyword)
     606              : 
     607              :       CALL keyword_create(keyword, __LOCATION__, name="LMAX", &
     608              :                           description="Maximum value of L used in the multipole expansion", &
     609              :                           usage="LMAX <INTEGER>", &
     610        10643 :                           default_i_val=3)
     611        10643 :       CALL section_add_keyword(section, keyword)
     612        10643 :       CALL keyword_release(keyword)
     613              : 
     614        10643 :       CALL create_sphere_section(subsection)
     615        10643 :       CALL section_add_subsection(section, subsection)
     616        10643 :       CALL section_release(subsection)
     617              : 
     618              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     619              :                                        description="Controls the printing basic info about the method", &
     620        10643 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     621        10643 :       CALL section_add_subsection(section, print_key)
     622        10643 :       CALL section_release(print_key)
     623              : 
     624        10643 :    END SUBROUTINE create_implicit_solv_section
     625              : 
     626              : ! **************************************************************************************************
     627              : !> \brief Create Sphere cavity
     628              : !> \param section ...
     629              : !> \author tlaino
     630              : ! **************************************************************************************************
     631        10643 :    SUBROUTINE create_sphere_section(section)
     632              :       TYPE(section_type), POINTER                        :: section
     633              : 
     634              :       TYPE(keyword_type), POINTER                        :: keyword
     635              :       TYPE(section_type), POINTER                        :: subsection
     636              : 
     637        10643 :       NULLIFY (keyword, subsection)
     638        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     639              :       CALL section_create(section, __LOCATION__, name="SPHERE", &
     640              :                           description="Treats the implicit solvent environment like a sphere", &
     641        10643 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     642              : 
     643              :       CALL keyword_create(keyword, __LOCATION__, name="RADIUS", &
     644              :                           description="Value of the spherical cavity in the dielectric medium", &
     645              :                           usage="RADIUS <REAL>", &
     646              :                           unit_str="angstrom", &
     647        10643 :                           type_of_var=real_t)
     648        10643 :       CALL section_add_keyword(section, keyword)
     649        10643 :       CALL keyword_release(keyword)
     650              : 
     651        10643 :       CALL create_center_section(subsection)
     652        10643 :       CALL section_add_subsection(section, subsection)
     653        10643 :       CALL section_release(subsection)
     654              : 
     655        10643 :    END SUBROUTINE create_sphere_section
     656              : 
     657              : ! **************************************************************************************************
     658              : !> \brief ...
     659              : !> \param section ...
     660              : !> \author tlaino
     661              : ! **************************************************************************************************
     662        10643 :    SUBROUTINE create_center_section(section)
     663              :       TYPE(section_type), POINTER                        :: section
     664              : 
     665              :       TYPE(keyword_type), POINTER                        :: keyword
     666              : 
     667        10643 :       NULLIFY (keyword)
     668        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     669              :       CALL section_create(section, __LOCATION__, name="CENTER", &
     670              :                           description="Defines the center of the sphere.", &
     671        10643 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     672              :       CALL keyword_create(keyword, __LOCATION__, name="XYZ", &
     673              :                           description="Coordinates of the center of the sphere", &
     674              :                           usage="XYZ <REAL> <REAL> <REAL>", &
     675              :                           unit_str="angstrom", &
     676        10643 :                           type_of_var=real_t, n_var=3)
     677        10643 :       CALL section_add_keyword(section, keyword)
     678        10643 :       CALL keyword_release(keyword)
     679              : 
     680              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     681              :                           description="Defines a list of atoms to define the center of the sphere", &
     682              :                           usage="ATOM_LIST <INTEGER> .. <INTEGER>", &
     683        10643 :                           type_of_var=integer_t, n_var=-1)
     684        10643 :       CALL section_add_keyword(section, keyword)
     685        10643 :       CALL keyword_release(keyword)
     686              : 
     687              :       CALL keyword_create(keyword, __LOCATION__, name="WEIGHT_TYPE", &
     688              :                           description="Defines the weight used to define the center of the sphere"// &
     689              :                           " (if ATOM_LIST is provided)", &
     690              :                           usage="WEIGHT_TYPE (UNIT|MASS)", &
     691              :                           enum_c_vals=["UNIT", "MASS"], &
     692              :                           enum_i_vals=[weight_type_unit, weight_type_mass], &
     693        31929 :                           default_i_val=weight_type_unit)
     694        10643 :       CALL section_add_keyword(section, keyword)
     695        10643 :       CALL keyword_release(keyword)
     696              : 
     697              :       CALL keyword_create(keyword, __LOCATION__, name="FIXED", &
     698              :                           description="Specify if the center of the sphere should be fixed or"// &
     699              :                           " allowed to move", &
     700              :                           usage="FIXED <LOGICAL>", &
     701        10643 :                           default_l_val=.TRUE.)
     702        10643 :       CALL section_add_keyword(section, keyword)
     703        10643 :       CALL keyword_release(keyword)
     704              : 
     705        10643 :    END SUBROUTINE create_center_section
     706              : 
     707              : ! **************************************************************************************************
     708              : !> \brief ...
     709              : !> \param section ...
     710              : ! **************************************************************************************************
     711        10643 :    SUBROUTINE create_admm_section(section)
     712              :       TYPE(section_type), POINTER                        :: section
     713              : 
     714              :       TYPE(keyword_type), POINTER                        :: keyword
     715              : 
     716        10643 :       NULLIFY (keyword)
     717        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     718              :       CALL section_create(section, __LOCATION__, name="AUXILIARY_DENSITY_MATRIX_METHOD", &
     719              :                           description="Controls the auxiliary density matrix method (ADMM), which evaluates "// &
     720              :                           "Hartree-Fock exchange on a smaller auxiliary basis and adds an exchange correction.", &
     721              :                           n_keywords=1, n_subsections=1, repeats=.FALSE., &
     722        21286 :                           citations=[Guidon2010])
     723              : 
     724              :       CALL keyword_create( &
     725              :          keyword, __LOCATION__, &
     726              :          name="ADMM_TYPE", &
     727              :          description="Named ADMM variant from the literature. This shortcut sets METHOD, "// &
     728              :          "ADMM_PURIFICATION_METHOD, and EXCH_SCALING_MODEL consistently for the selected variant.", &
     729              :          enum_c_vals=s2a("NONE", "ADMM1", "ADMM2", "ADMMS", "ADMMP", "ADMMQ"), &
     730              :          enum_desc=s2a("No short name is used, use specific definitions (default)", &
     731              :                        "ADMM1 method from Guidon2010", &
     732              :                        "ADMM2 method from Guidon2010", &
     733              :                        "ADMMS method from Merlot2014", &
     734              :                        "ADMMP method from Merlot2014", &
     735              :                        "ADMMQ method from Merlot2014"), &
     736              :          enum_i_vals=[no_admm_type, admm1_type, admm2_type, admms_type, admmp_type, admmq_type], &
     737              :          default_i_val=no_admm_type, &
     738        31929 :          citations=[Guidon2010, Merlot2014])
     739        10643 :       CALL section_add_keyword(section, keyword)
     740        10643 :       CALL keyword_release(keyword)
     741              : 
     742              :       CALL keyword_create( &
     743              :          keyword, __LOCATION__, &
     744              :          name="ADMM_PURIFICATION_METHOD", &
     745              :          description="Method that shall be used for wavefunction fitting. Use MO_DIAG for MD.", &
     746              :          enum_c_vals=s2a("NONE", "CAUCHY", "CAUCHY_SUBSPACE", "MO_DIAG", "MO_NO_DIAG", "MCWEENY", "NONE_DM"), &
     747              :          enum_i_vals=[do_admm_purify_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace, &
     748              :                       do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
     749              :                       do_admm_purify_mcweeny, do_admm_purify_none_dm], &
     750              :          enum_desc=s2a("Do not apply any purification", &
     751              :                        "Perform purification via general Cauchy representation", &
     752              :                        "Perform purification via Cauchy representation in occupied subspace", &
     753              :                        "Calculate MO derivatives via Cauchy representation by diagonalization", &
     754              :                        "Calculate MO derivatives via Cauchy representation by inversion", &
     755              :                        "Perform original McWeeny purification via matrix multiplications", &
     756              :                        "Do not apply any purification, works directly with density matrix"), &
     757        10643 :          default_i_val=do_admm_purify_mo_diag)
     758        10643 :       CALL section_add_keyword(section, keyword)
     759        10643 :       CALL keyword_release(keyword)
     760              : 
     761              :       CALL keyword_create( &
     762              :          keyword, __LOCATION__, &
     763              :          name="METHOD", &
     764              :          description="Method that shall be used for wavefunction fitting. Use BASIS_PROJECTION for MD.", &
     765              :          enum_c_vals=s2a("BASIS_PROJECTION", "BLOCKED_PROJECTION_PURIFY_FULL", "BLOCKED_PROJECTION", &
     766              :                          "CHARGE_CONSTRAINED_PROJECTION"), &
     767              :          enum_i_vals=[do_admm_basis_projection, do_admm_blocking_purify_full, do_admm_blocked_projection, &
     768              :                       do_admm_charge_constrained_projection], &
     769              :          enum_desc=s2a("Construct auxiliary density matrix from auxiliary basis.", &
     770              :                        "Construct auxiliary density from a blocked Fock matrix,"// &
     771              :                        " but use the original matrix for purification.", &
     772              :                        "Construct auxiliary density from a blocked Fock matrix.", &
     773              :                        "Construct auxiliary density from auxiliary basis enforcing charge constrain."), &
     774        10643 :          default_i_val=do_admm_basis_projection)
     775        10643 :       CALL section_add_keyword(section, keyword)
     776        10643 :       CALL keyword_release(keyword)
     777              : 
     778              :       CALL keyword_create( &
     779              :          keyword, __LOCATION__, &
     780              :          name="EXCH_SCALING_MODEL", &
     781              :          description="Scaling of the exchange correction calculated by the auxiliary density matrix.", &
     782              :          enum_c_vals=s2a("NONE", "MERLOT"), &
     783              :          enum_i_vals=[do_admm_exch_scaling_none, do_admm_exch_scaling_merlot], &
     784              :          enum_desc=s2a("No scaling is enabled, refers to methods ADMM1, ADMM2 or ADMMQ.", &
     785              :                        "Exchange scaling according to Merlot (2014)"), &
     786        10643 :          default_i_val=do_admm_exch_scaling_none)
     787        10643 :       CALL section_add_keyword(section, keyword)
     788        10643 :       CALL keyword_release(keyword)
     789              : 
     790              :       CALL keyword_create( &
     791              :          keyword, __LOCATION__, &
     792              :          name="EXCH_CORRECTION_FUNC", &
     793              :          description="Exchange functional used for the ADMM correction. It should be chosen consistently "// &
     794              :          "with the exchange functional in the main XC setup. LibXC implementations require linking with LibXC.", &
     795              :          enum_c_vals=s2a("DEFAULT", "PBEX", "NONE", "OPTX", "BECKE88X", &
     796              :                          "PBEX_LIBXC", "BECKE88X_LIBXC", "OPTX_LIBXC", "DEFAULT_LIBXC", "LDA_X_LIBXC"), &
     797              :          enum_i_vals=[do_admm_aux_exch_func_default, do_admm_aux_exch_func_pbex, &
     798              :                       do_admm_aux_exch_func_none, do_admm_aux_exch_func_opt, do_admm_aux_exch_func_bee, &
     799              :                       do_admm_aux_exch_func_pbex_libxc, do_admm_aux_exch_func_bee_libxc, &
     800              :                       do_admm_aux_exch_func_opt_libxc, do_admm_aux_exch_func_default_libxc, &
     801              :                       do_admm_aux_exch_func_sx_libxc], &
     802              :          enum_desc=s2a("Use PBE-based corrections according to the chosen interaction operator.", &
     803              :                        "Use PBEX functional for exchange correction.", &
     804              :                        "No correction: X(D)-x(d)-> 0.", &
     805              :                        "Use OPTX functional for exchange correction.", &
     806              :                        "Use Becke88X functional for exchange correction.", &
     807              :                        "Use PBEX functional (LibXC implementation) for exchange correction.", &
     808              :                        "Use Becke88X functional (LibXC implementation) for exchange correction.", &
     809              :                        "Use OPTX functional (LibXC implementation) for exchange correction.", &
     810              :                        "Use PBE-based corrections (LibXC where possible) to the chosen interaction operator.", &
     811              :                        "Use Slater X functional (LibXC where possible) for exchange correction."), &
     812        10643 :          default_i_val=do_admm_aux_exch_func_default)
     813        10643 :       CALL section_add_keyword(section, keyword)
     814        10643 :       CALL keyword_release(keyword)
     815              : 
     816              :       CALL keyword_create(keyword, __LOCATION__, name="optx_a1", &
     817              :                           description="OPTX a1 coefficient", &
     818        10643 :                           default_r_val=1.05151_dp)
     819        10643 :       CALL section_add_keyword(section, keyword)
     820        10643 :       CALL keyword_release(keyword)
     821              :       CALL keyword_create(keyword, __LOCATION__, name="optx_a2", &
     822              :                           description="OPTX a2 coefficient", &
     823        10643 :                           default_r_val=1.43169_dp)
     824        10643 :       CALL section_add_keyword(section, keyword)
     825        10643 :       CALL keyword_release(keyword)
     826              :       CALL keyword_create(keyword, __LOCATION__, name="optx_gamma", &
     827              :                           description="OPTX gamma coefficient", &
     828        10643 :                           default_r_val=0.006_dp)
     829        10643 :       CALL section_add_keyword(section, keyword)
     830        10643 :       CALL keyword_release(keyword)
     831              : 
     832              :       CALL keyword_create(keyword, __LOCATION__, name="BLOCK_LIST", &
     833              :                           description="Specifies a list of atoms.", &
     834              :                           usage="BLOCK_LIST {integer} {integer} .. {integer}", &
     835        10643 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     836        10643 :       CALL section_add_keyword(section, keyword)
     837        10643 :       CALL keyword_release(keyword)
     838              : 
     839              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
     840              :                           description="Define accuracy of DBCSR operations", &
     841        10643 :                           usage="EPS_FILTER", default_r_val=0.0_dp)
     842        10643 :       CALL section_add_keyword(section, keyword)
     843        10643 :       CALL keyword_release(keyword)
     844              : 
     845        10643 :    END SUBROUTINE create_admm_section
     846              : 
     847              : ! **************************************************************************************************
     848              : !> \brief ...
     849              : !> \param section ...
     850              : ! **************************************************************************************************
     851        10643 :    SUBROUTINE create_density_fitting_section(section)
     852              :       TYPE(section_type), POINTER                        :: section
     853              : 
     854              :       TYPE(keyword_type), POINTER                        :: keyword
     855              :       TYPE(section_type), POINTER                        :: print_key
     856              : 
     857        10643 :       NULLIFY (keyword, print_key)
     858        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     859              :       CALL section_create(section, __LOCATION__, name="DENSITY_FITTING", &
     860              :                           description="Setup parameters for density fitting (Bloechl charges or density derived "// &
     861              :                           "atomic point charges (DDAPC) charges)", &
     862              :                           n_keywords=7, n_subsections=0, repeats=.FALSE., &
     863        21286 :                           citations=[Blochl1995])
     864              : 
     865              :       CALL keyword_create(keyword, __LOCATION__, name="NUM_GAUSS", &
     866              :                           description="Specifies the numbers of gaussian used to fit the QM density for each atomic site.", &
     867              :                           usage="NUM_GAUSS {integer}", &
     868        10643 :                           n_var=1, type_of_var=integer_t, default_i_val=3)
     869        10643 :       CALL section_add_keyword(section, keyword)
     870        10643 :       CALL keyword_release(keyword)
     871              : 
     872              :       CALL keyword_create(keyword, __LOCATION__, name="PFACTOR", &
     873              :                           description="Specifies the progression factor for the gaussian exponent for each atomic site.", &
     874              :                           usage="PFACTOR {real}", &
     875        10643 :                           n_var=1, type_of_var=real_t, default_r_val=1.5_dp)
     876        10643 :       CALL section_add_keyword(section, keyword)
     877        10643 :       CALL keyword_release(keyword)
     878              : 
     879              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_RADIUS", &
     880              :                           description="Specifies the smallest radius of the gaussian used in the fit. All other radius are"// &
     881              :                           " obtained with the progression factor.", &
     882              :                           usage="MIN_RADIUS {real}", &
     883        10643 :                           unit_str="angstrom", n_var=1, type_of_var=real_t, default_r_val=0.5_dp)
     884        10643 :       CALL section_add_keyword(section, keyword)
     885        10643 :       CALL keyword_release(keyword)
     886              : 
     887              :       CALL keyword_create(keyword, __LOCATION__, name="RADII", &
     888              :                           description="Specifies all the radius of the gaussian used in the fit for each atomic site. The use"// &
     889              :                           " of this keyword disables all other keywords of this section.", &
     890              :                           usage="RADII {real} {real} .. {real}", &
     891        10643 :                           unit_str="angstrom", n_var=-1, type_of_var=real_t)
     892        10643 :       CALL section_add_keyword(section, keyword)
     893        10643 :       CALL keyword_release(keyword)
     894              : 
     895              :       CALL keyword_create(keyword, __LOCATION__, name="GCUT", &
     896              :                           description="Cutoff for charge fit in G-space.", &
     897              :                           usage="GCUT {real}", &
     898        10643 :                           n_var=1, type_of_var=real_t, default_r_val=SQRT(6.0_dp))
     899        10643 :       CALL section_add_keyword(section, keyword)
     900        10643 :       CALL keyword_release(keyword)
     901              : 
     902              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     903              :                                        description="Controls the printing of basic information during the run", &
     904        10643 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     905              : 
     906              :       CALL keyword_create(keyword, __LOCATION__, name="CONDITION_NUMBER", &
     907              :                           description="Prints information regarding the condition numbers of the A matrix (to be inverted)", &
     908              :                           usage="CONDITION_NUMBER <LOGICAL>", &
     909        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     910        10643 :       CALL section_add_keyword(print_key, keyword)
     911        10643 :       CALL keyword_release(keyword)
     912              : 
     913        10643 :       CALL section_add_subsection(section, print_key)
     914        10643 :       CALL section_release(print_key)
     915              : 
     916        10643 :    END SUBROUTINE create_density_fitting_section
     917              : 
     918              : ! **************************************************************************************************
     919              : !> \brief creates the input section for the relativistic part
     920              : !> \param section the section to create
     921              : !> \author jens
     922              : ! **************************************************************************************************
     923        10643 :    SUBROUTINE create_relativistic_section(section)
     924              :       TYPE(section_type), POINTER                        :: section
     925              : 
     926              :       TYPE(keyword_type), POINTER                        :: keyword
     927              : 
     928        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
     929              :       CALL section_create(section, __LOCATION__, name="relativistic", &
     930              :                           description="parameters needed and setup for relativistic calculations", &
     931        10643 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     932              : 
     933        10643 :       NULLIFY (keyword)
     934              : 
     935              :       CALL keyword_create(keyword, __LOCATION__, name="method", &
     936              :                           description="type of relativistic correction used", &
     937              :                           usage="method (NONE|DKH|ZORA)", default_i_val=rel_none, &
     938              :                           enum_c_vals=s2a("NONE", "DKH", "ZORA"), &
     939              :                           enum_i_vals=[rel_none, rel_dkh, rel_zora], &
     940              :                           enum_desc=s2a("Use no relativistic correction", &
     941              :                                         "Use Douglas-Kroll-Hess method", &
     942        10643 :                                         "Use ZORA method"))
     943        10643 :       CALL section_add_keyword(section, keyword)
     944        10643 :       CALL keyword_release(keyword)
     945              : 
     946              :       CALL keyword_create(keyword, __LOCATION__, name="DKH_order", &
     947              :                           description="The order of the DKH transformation ", &
     948        10643 :                           usage="DKH_order 2", default_i_val=2)
     949        10643 :       CALL section_add_keyword(section, keyword)
     950        10643 :       CALL keyword_release(keyword)
     951              : 
     952              :       CALL keyword_create(keyword, __LOCATION__, name="ZORA_type", &
     953              :                           description="Type of ZORA method to be used", &
     954              :                           usage="ZORA_type scMP", default_i_val=rel_zora_full, &
     955              :                           enum_c_vals=s2a("FULL", "MP", "scMP"), &
     956              :                           enum_desc=s2a("Full ZORA method (not implemented)", &
     957              :                                         "ZORA with atomic model potential", &
     958              :                                         "Scaled ZORA with atomic model potential"), &
     959        10643 :                           enum_i_vals=[rel_zora_full, rel_zora_mp, rel_sczora_mp])
     960        10643 :       CALL section_add_keyword(section, keyword)
     961        10643 :       CALL keyword_release(keyword)
     962              : 
     963              :       CALL keyword_create(keyword, __LOCATION__, name="transformation", &
     964              :                           description="Type of DKH transformation", &
     965              :                           usage="transformation (FULL|MOLECULE|ATOM)", default_i_val=rel_trans_atom, &
     966              :                           enum_c_vals=s2a("FULL", "MOLECULE", "ATOM"), &
     967              :                           enum_i_vals=[rel_trans_full, rel_trans_molecule, rel_trans_atom], &
     968              :                           enum_desc=s2a("Use full matrix transformation", &
     969              :                                         "Use transformation blocked by molecule", &
     970        10643 :                                         "Use atomic blocks"))
     971        10643 :       CALL section_add_keyword(section, keyword)
     972        10643 :       CALL keyword_release(keyword)
     973              : 
     974              :       CALL keyword_create(keyword, __LOCATION__, name="z_cutoff", &
     975              :                           description="The minimal atomic number considered for atom transformation", &
     976        10643 :                           usage="z_cutoff 50", default_i_val=1)
     977        10643 :       CALL section_add_keyword(section, keyword)
     978        10643 :       CALL keyword_release(keyword)
     979              : 
     980              :       CALL keyword_create(keyword, __LOCATION__, name="potential", &
     981              :                           description="External potential used in DKH transformation, full 1/r or erfc(r)/r", &
     982              :                           usage="POTENTIAL {FULL,ERFC}", default_i_val=rel_pot_erfc, &
     983              :                           enum_c_vals=s2a("FULL", "ERFC"), &
     984        10643 :                           enum_i_vals=[rel_pot_full, rel_pot_erfc])
     985        10643 :       CALL section_add_keyword(section, keyword)
     986        10643 :       CALL keyword_release(keyword)
     987              : 
     988        10643 :    END SUBROUTINE create_relativistic_section
     989              : 
     990              : ! **************************************************************************************************
     991              : !> \brief creates the KG section
     992              : !> \param section ...
     993              : !> \author Martin Haeufel [2012.07]
     994              : ! **************************************************************************************************
     995        10643 :    SUBROUTINE create_kg_section(section)
     996              :       TYPE(section_type), POINTER                        :: section
     997              : 
     998              :       TYPE(keyword_type), POINTER                        :: keyword
     999              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1000              : 
    1001        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    1002              :       CALL section_create(section, __LOCATION__, name="KG_METHOD", &
    1003              :                           description="Specifies the parameters for a Kim-Gordon-like partitioning"// &
    1004              :                           " into molecular subunits", &
    1005              :                           n_keywords=0, n_subsections=1, repeats=.FALSE., &
    1006        42572 :                           citations=[Iannuzzi2006, Brelaz1979, Andermatt2016])
    1007              : 
    1008        10643 :       NULLIFY (keyword, subsection, print_key)
    1009              : 
    1010              :       ! add a XC section
    1011        10643 :       CALL create_xc_section(subsection)
    1012        10643 :       CALL section_add_subsection(section, subsection)
    1013        10643 :       CALL section_release(subsection)
    1014              : 
    1015              :       ! add LRI section
    1016        10643 :       CALL create_lrigpw_section(subsection)
    1017        10643 :       CALL section_add_subsection(section, subsection)
    1018        10643 :       CALL section_release(subsection)
    1019              : 
    1020              :       CALL keyword_create(keyword, __LOCATION__, name="COLORING_METHOD", &
    1021              :                           description="Which algorithm to use for coloring.", &
    1022              :                           usage="COLORING_METHOD GREEDY", &
    1023              :                           default_i_val=kg_color_dsatur, &
    1024              :                           enum_c_vals=s2a("DSATUR", "GREEDY"), &
    1025              :                           enum_desc=s2a("Maximum degree of saturation, relatively accurate", &
    1026              :                                         "Greedy, fast coloring, less accurate"), &
    1027        10643 :                           enum_i_vals=[kg_color_dsatur, kg_color_greedy])
    1028        10643 :       CALL section_add_keyword(section, keyword)
    1029        10643 :       CALL keyword_release(keyword)
    1030              : 
    1031              :       CALL keyword_create(keyword, __LOCATION__, name="TNADD_METHOD", &
    1032              :                           description="Algorithm to use for the calculation of the nonadditive kinetic energy.", &
    1033              :                           usage="TNADD_METHOD ATOMIC", &
    1034              :                           default_i_val=kg_tnadd_embed, &
    1035              :                           enum_c_vals=s2a("EMBEDDING", "RI_EMBEDDING", "ATOMIC", "NONE"), &
    1036              :                           enum_desc=s2a("Use full embedding potential (see Iannuzzi et al)", &
    1037              :                                         "Use full embedding potential with RI density fitting", &
    1038              :                                         "Use sum of atomic model potentials", &
    1039              :                                         "Do not use kinetic energy embedding"), &
    1040        10643 :                           enum_i_vals=[kg_tnadd_embed, kg_tnadd_embed_ri, kg_tnadd_atomic, kg_tnadd_none])
    1041        10643 :       CALL section_add_keyword(section, keyword)
    1042        10643 :       CALL keyword_release(keyword)
    1043              : 
    1044              :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_GRID", &
    1045              :                           description="Grid [small,medium,large,huge]to be used for the TNADD integration.", &
    1046              :                           usage="INTEGRATION_GRID MEDIUM", &
    1047        10643 :                           default_c_val="MEDIUM")
    1048        10643 :       CALL section_add_keyword(section, keyword)
    1049        10643 :       CALL keyword_release(keyword)
    1050              : 
    1051              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1052              :                           description="Print section", &
    1053        10643 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1054              : 
    1055              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "NEIGHBOR_LISTS", &
    1056              :                                        description="Controls the printing of the neighbor lists.", &
    1057        10643 :                                        print_level=low_print_level, filename="__STD_OUT__", unit_str="angstrom")
    1058              : 
    1059              :       CALL keyword_create(keyword, __LOCATION__, &
    1060              :                           name="SAB_ORB_FULL", &
    1061              :                           description="Activates the printing of the full orbital "// &
    1062              :                           "orbital neighbor lists.", &
    1063              :                           default_l_val=.FALSE., &
    1064        10643 :                           lone_keyword_l_val=.TRUE.)
    1065        10643 :       CALL section_add_keyword(print_key, keyword)
    1066        10643 :       CALL keyword_release(keyword)
    1067              : 
    1068              :       CALL keyword_create(keyword, __LOCATION__, &
    1069              :                           name="SAB_ORB_MOLECULAR", &
    1070              :                           description="Activates the printing of the orbital "// &
    1071              :                           "orbital neighbor lists for molecular subsets.", &
    1072              :                           default_l_val=.FALSE., &
    1073        10643 :                           lone_keyword_l_val=.TRUE.)
    1074        10643 :       CALL section_add_keyword(print_key, keyword)
    1075        10643 :       CALL keyword_release(keyword)
    1076              : 
    1077              :       CALL keyword_create(keyword, __LOCATION__, &
    1078              :                           name="SAC_KIN", &
    1079              :                           description="Activates the printing of the orbital "// &
    1080              :                           "atomic potential neighbor list.", &
    1081              :                           default_l_val=.FALSE., &
    1082        10643 :                           lone_keyword_l_val=.TRUE.)
    1083        10643 :       CALL section_add_keyword(print_key, keyword)
    1084        10643 :       CALL keyword_release(keyword)
    1085              : 
    1086        10643 :       CALL section_add_subsection(subsection, print_key)
    1087        10643 :       CALL section_release(print_key)
    1088              : 
    1089        10643 :       CALL section_add_subsection(section, subsection)
    1090        10643 :       CALL section_release(subsection)
    1091              : 
    1092        10643 :    END SUBROUTINE create_kg_section
    1093              : 
    1094              : ! **************************************************************************************************
    1095              : !> \brief Create the BSSE section for counterpoise correction
    1096              : !> \param section the section to create
    1097              : !> \author teo
    1098              : ! **************************************************************************************************
    1099        10624 :    SUBROUTINE create_bsse_section(section)
    1100              :       TYPE(section_type), POINTER                        :: section
    1101              : 
    1102              :       TYPE(keyword_type), POINTER                        :: keyword
    1103              :       TYPE(section_type), POINTER                        :: subsection
    1104              : 
    1105        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
    1106              :       CALL section_create(section, __LOCATION__, name="BSSE", &
    1107              :                           description="This section is used to set up the BSSE calculation. "// &
    1108              :                           "It also requires that for each atomic kind X a kind X_ghost is present, "// &
    1109              :                           "with the GHOST keyword specified, in addition to the other required fields.", &
    1110        10624 :                           n_keywords=3, n_subsections=1, repeats=.FALSE.)
    1111              : 
    1112        10624 :       NULLIFY (keyword, subsection)
    1113              :       ! FRAGMENT SECTION
    1114              :       CALL section_create(subsection, __LOCATION__, name="FRAGMENT", &
    1115              :                           description="Specify the atom number belonging to this fragment.", &
    1116        10624 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    1117              : 
    1118              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    1119              :                           description="Specifies a list of atoms.", &
    1120              :                           usage="LIST {integer} {integer} .. {integer}", &
    1121        10624 :                           repeats=.TRUE., n_var=-1, type_of_var=integer_t)
    1122        10624 :       CALL section_add_keyword(subsection, keyword)
    1123        10624 :       CALL keyword_release(keyword)
    1124              : 
    1125        10624 :       CALL section_add_subsection(section, subsection)
    1126        10624 :       CALL section_release(subsection)
    1127              : 
    1128              :       ! CONFIGURATION SECTION
    1129              :       CALL section_create(subsection, __LOCATION__, name="CONFIGURATION", &
    1130              :                           description="Specify additional parameters for the combinatorial configurations. "// &
    1131              :                           "Use this section to manually specify charge and multiplicity of the fragments "// &
    1132              :                           "and their combinations.", &
    1133        10624 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    1134              : 
    1135              :       CALL keyword_create(keyword, __LOCATION__, name="GLB_CONF", &
    1136              :                           description="Specifies the global configuration using 1 or 0 for each fragment. "// &
    1137              :                           "1 specifies the respective fragment as used, 0 as unused.", &
    1138              :                           usage="GLB_CONF {integer} {integer} .. {integer}", &
    1139        10624 :                           n_var=-1, type_of_var=integer_t)
    1140        10624 :       CALL section_add_keyword(subsection, keyword)
    1141        10624 :       CALL keyword_release(keyword)
    1142              : 
    1143              :       CALL keyword_create(keyword, __LOCATION__, name="SUB_CONF", &
    1144              :                           description="Specifies the subconfiguration using 1 or 0 belonging to the global configuration. "// &
    1145              :                           "1 specifies the respective fragment as real, 0 as ghost.", &
    1146              :                           usage="SUB_CONF {integer} {integer} .. {integer}", &
    1147        10624 :                           n_var=-1, type_of_var=integer_t)
    1148        10624 :       CALL section_add_keyword(subsection, keyword)
    1149        10624 :       CALL keyword_release(keyword)
    1150              : 
    1151              :       CALL keyword_create(keyword, __LOCATION__, &
    1152              :                           name="MULTIPLICITY", &
    1153              :                           variants=["MULTIP"], &
    1154              :                           description="Specify for each fragment the multiplicity. Two times the total spin plus one. "// &
    1155              :                           "Specify 3 for a triplet, 4 for a quartet,and so on. Default is 1 (singlet) for an "// &
    1156              :                           "even number and 2 (doublet) for an odd number of electrons.", &
    1157              :                           usage="MULTIPLICITY 3", &
    1158        21248 :                           default_i_val=0) ! this default value is just a flag to get the above
    1159        10624 :       CALL section_add_keyword(subsection, keyword)
    1160        10624 :       CALL keyword_release(keyword)
    1161              : 
    1162              :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE", &
    1163              :                           description="The total charge for each fragment.", &
    1164              :                           usage="CHARGE -1", &
    1165        10624 :                           default_i_val=0)
    1166        10624 :       CALL section_add_keyword(subsection, keyword)
    1167        10624 :       CALL keyword_release(keyword)
    1168        10624 :       CALL section_add_subsection(section, subsection)
    1169        10624 :       CALL section_release(subsection)
    1170              : 
    1171              :       CALL section_create(subsection, __LOCATION__, name="FRAGMENT_ENERGIES", &
    1172              :                           description="This section contains the energies of the fragments already"// &
    1173              :                           " computed. It is useful as a summary and specifically for restarting BSSE runs.", &
    1174        10624 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    1175              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1176              :                           description="The energy computed for each fragment", repeats=.TRUE., &
    1177        10624 :                           usage="{REAL}", type_of_var=real_t)
    1178        10624 :       CALL section_add_keyword(subsection, keyword)
    1179        10624 :       CALL keyword_release(keyword)
    1180        10624 :       CALL section_add_subsection(section, subsection)
    1181        10624 :       CALL section_release(subsection)
    1182              : 
    1183        10624 :       CALL create_print_bsse_section(subsection)
    1184        10624 :       CALL section_add_subsection(section, subsection)
    1185        10624 :       CALL section_release(subsection)
    1186              : 
    1187        10624 :    END SUBROUTINE create_bsse_section
    1188              : 
    1189              : ! **************************************************************************************************
    1190              : !> \brief Create the print bsse section
    1191              : !> \param section the section to create
    1192              : !> \author teo
    1193              : ! **************************************************************************************************
    1194        10624 :    SUBROUTINE create_print_bsse_section(section)
    1195              :       TYPE(section_type), POINTER                        :: section
    1196              : 
    1197              :       TYPE(section_type), POINTER                        :: print_key
    1198              : 
    1199        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
    1200              :       CALL section_create(section, __LOCATION__, name="print", &
    1201              :                           description="Section of possible print options in BSSE code.", &
    1202        10624 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1203              : 
    1204        10624 :       NULLIFY (print_key)
    1205              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1206              :                                        description="Controls the printing of information regarding the run.", &
    1207        10624 :                                        print_level=low_print_level, filename="__STD_OUT__")
    1208        10624 :       CALL section_add_subsection(section, print_key)
    1209        10624 :       CALL section_release(print_key)
    1210              : 
    1211              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1212              :                                        description="Controls the dumping of the restart file during BSSE runs. "// &
    1213              :                                        "By default the restart is updated after each configuration calculation is "// &
    1214              :                                        "completed.", &
    1215              :                                        print_level=silent_print_level, common_iter_levels=0, &
    1216        10624 :                                        add_last=add_last_numeric, filename="")
    1217        10624 :       CALL section_add_subsection(section, print_key)
    1218        10624 :       CALL section_release(print_key)
    1219              : 
    1220        10624 :    END SUBROUTINE create_print_bsse_section
    1221              : 
    1222              : ! **************************************************************************************************
    1223              : !> \brief input section for optional parameters for RIGPW
    1224              : !> \param section the section to create
    1225              : !> \author JGH [06.2017]
    1226              : ! **************************************************************************************************
    1227            0 :    SUBROUTINE create_rigpw_section(section)
    1228              :       TYPE(section_type), POINTER                        :: section
    1229              : 
    1230            0 :       CPASSERT(.NOT. ASSOCIATED(section))
    1231              :       CALL section_create(section, __LOCATION__, name="RIGPW", &
    1232              :                           description="This section specifies optional parameters for RIGPW.", &
    1233            0 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    1234              : 
    1235              : !     CALL keyword_create(keyword, __LOCATION__, name="RI_OVERLAP_MATRIX", &
    1236              : !                         description="Specifies whether to calculate the inverse or the "// &
    1237              : !                         "pseudoinverse of the overlap matrix of the auxiliary "// &
    1238              : !                         "basis set. Calculating the pseudoinverse is necessary "// &
    1239              : !                         "for very large auxiliary basis sets, but more expensive. "// &
    1240              : !                         "Using the pseudoinverse, consistent forces are not "// &
    1241              : !                         "guaranteed yet.", &
    1242              : !                         usage="RI_OVERLAP_MATRIX INVERSE", &
    1243              : !                         enum_c_vals=s2a("INVERSE", "PSEUDO_INVERSE_SVD", "PSEUDO_INVERSE_DIAG", &
    1244              : !                                         "AUTOSELECT"), &
    1245              : !                         enum_desc=s2a("Calculate inverse of the overlap matrix.", &
    1246              : !                                       "Calculate the pseuodinverse of the overlap matrix "// &
    1247              : !                                       "using singular value decomposition.", &
    1248              : !                                       "Calculate the pseudoinverse of the overlap matrix "// &
    1249              : !                                       "by prior diagonalization.", &
    1250              : !                                       "Choose automatically for each pair whether to "// &
    1251              : !                                       "calculate the inverse or pseudoinverse based on the "// &
    1252              : !                                       "condition number of the overlap matrix for each pair. "// &
    1253              : !                                       "Calculating the pseudoinverse is much more expensive."), &
    1254              : !                         enum_i_vals=(/do_lri_inv, do_lri_pseudoinv_svd, &
    1255              : !                                       do_lri_pseudoinv_diag, do_lri_inv_auto/), &
    1256              : !                         default_i_val=do_lri_inv)
    1257              : !     CALL section_add_keyword(section, keyword)
    1258              : !     CALL keyword_release(keyword)
    1259              : 
    1260            0 :    END SUBROUTINE create_rigpw_section
    1261              : 
    1262              : ! **************************************************************************************************
    1263              : !> \brief creates the multigrid
    1264              : !> \param section             input section to create
    1265              : !> \param create_subsections  indicates whether or not subsections INTERPOLATOR and RS_GRID
    1266              : !>                            should be created
    1267              : !> \author fawzi
    1268              : ! **************************************************************************************************
    1269        31891 :    SUBROUTINE create_mgrid_section(section, create_subsections)
    1270              :       TYPE(section_type), POINTER                        :: section
    1271              :       LOGICAL, INTENT(in)                                :: create_subsections
    1272              : 
    1273              :       TYPE(keyword_type), POINTER                        :: keyword
    1274              :       TYPE(section_type), POINTER                        :: subsection
    1275              : 
    1276        31891 :       CPASSERT(.NOT. ASSOCIATED(section))
    1277              :       CALL section_create(section, __LOCATION__, name="mgrid", &
    1278              :                           description="Controls the multigrid used by GPW/GAPW to represent densities, "// &
    1279              :                           "potentials, and Gaussian products on real-space grids.", &
    1280        31891 :                           n_keywords=5, n_subsections=1, repeats=.FALSE.)
    1281        31891 :       NULLIFY (keyword)
    1282              :       CALL keyword_create(keyword, __LOCATION__, name="NGRIDS", &
    1283              :                           description="Number of multigrid levels. Smooth Gaussian products can be mapped to "// &
    1284              :                           "coarser levels, while sharper products require finer levels.", &
    1285        31891 :                           usage="ngrids 1", default_i_val=4)
    1286        31891 :       CALL section_add_keyword(section, keyword)
    1287        31891 :       CALL keyword_release(keyword)
    1288              : 
    1289              :       CALL keyword_create(keyword, __LOCATION__, name="cutoff", &
    1290              :                           description= &
    1291              :                           "Plane-wave cutoff of the finest real-space grid level. "// &
    1292              :                           "Increasing this value improves the grid representation, but it is "// &
    1293              :                           "not a substitute for converging the Gaussian basis set. "// &
    1294              :                           "Default value for SE or DFTB calculation is 1.0 [Ry].", &
    1295              :                           usage="cutoff 300", &
    1296              :                           default_r_val=cp_unit_to_cp2k(value=280.0_dp, unit_str="Ry"), &
    1297        31891 :                           n_var=1, unit_str="Ry")
    1298        31891 :       CALL section_add_keyword(section, keyword)
    1299        31891 :       CALL keyword_release(keyword)
    1300              : 
    1301              :       CALL keyword_create(keyword, __LOCATION__, name="progression_factor", &
    1302              :                           description="Factor used to derive the cutoff of coarser multigrid levels when "// &
    1303              :                           "they are not given explicitly.", &
    1304        31891 :                           usage="progression_factor <integer>", default_r_val=3._dp)
    1305        31891 :       CALL section_add_keyword(section, keyword)
    1306        31891 :       CALL keyword_release(keyword)
    1307              : 
    1308              :       CALL keyword_create(keyword, __LOCATION__, name="commensurate", &
    1309              :                           description="If the grids should be commensurate. If true overrides "// &
    1310              :                           "the progression factor and the cutoffs of the sub grids", &
    1311              :                           usage="commensurate", default_l_val=.FALSE., &
    1312        31891 :                           lone_keyword_l_val=.TRUE.)
    1313        31891 :       CALL section_add_keyword(section, keyword)
    1314        31891 :       CALL keyword_release(keyword)
    1315              : 
    1316              :       CALL keyword_create(keyword, __LOCATION__, name="realspace", &
    1317              :                           description="If both rho and rho_gspace are needed ", &
    1318              :                           usage="realspace", default_l_val=.FALSE., &
    1319        31891 :                           lone_keyword_l_val=.TRUE.)
    1320        31891 :       CALL section_add_keyword(section, keyword)
    1321        31891 :       CALL keyword_release(keyword)
    1322              : 
    1323              :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
    1324              :                           variants=["RELATIVE_CUTOFF"], &
    1325              :                           description="Controls to which multigrid level a Gaussian product is mapped. "// &
    1326              :                           "It is the reference cutoff for a Gaussian with exponent alpha=1. Larger values "// &
    1327              :                           "keep more Gaussian products on finer grids and can be important for accurate "// &
    1328              :                           "energies, forces, stress tensors, and variable-cell simulations.", &
    1329              :                           usage="RELATIVE_CUTOFF real", default_r_val=20.0_dp, &
    1330        63782 :                           unit_str="Ry")
    1331        31891 :       CALL section_add_keyword(section, keyword)
    1332        31891 :       CALL keyword_release(keyword)
    1333              : 
    1334              :       CALL keyword_create(keyword, __LOCATION__, name="MULTIGRID_SET", &
    1335              :                           description="Activate a manual setting of the multigrids", &
    1336        31891 :                           usage="MULTIGRID_SET", default_l_val=.FALSE.)
    1337        31891 :       CALL section_add_keyword(section, keyword)
    1338        31891 :       CALL keyword_release(keyword)
    1339              : 
    1340              :       CALL keyword_create(keyword, __LOCATION__, &
    1341              :                           name="SKIP_LOAD_BALANCE_DISTRIBUTED", &
    1342              :                           description="Skips load balancing on distributed multigrids.  "// &
    1343              :                           "Memory usage is O(p) so may be used "// &
    1344              :                           "for all but the very largest runs.", &
    1345              :                           usage="SKIP_LOAD_BALANCE_DISTRIBUTED", &
    1346              :                           default_l_val=.FALSE., &
    1347        31891 :                           lone_keyword_l_val=.TRUE.)
    1348              : !    CALL keyword_create(keyword, __LOCATION__, name="SKIP_LOAD_BALANCE_DISTRIBUTED",&
    1349              : !         description="Skip load balancing on distributed multigrids, which might be memory intensive."//&
    1350              : !                     "If not explicitly specified, runs using more than 1024 MPI tasks will default to .TRUE.",&
    1351              : !         usage="SKIP_LOAD_BALANCE_DISTRIBUTED", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1352              : 
    1353        31891 :       CALL section_add_keyword(section, keyword)
    1354        31891 :       CALL keyword_release(keyword)
    1355              : 
    1356              :       CALL keyword_create(keyword, __LOCATION__, name="MULTIGRID_CUTOFF", &
    1357              :                           variants=["CUTOFF_LIST"], &
    1358              :                           description="List of cutoff values to set up multigrids manually", &
    1359              :                           usage="MULTIGRID_CUTOFF 200.0 100.0 ", &
    1360              :                           n_var=-1, &
    1361              :                           type_of_var=real_t, &
    1362        63782 :                           unit_str="Ry")
    1363        31891 :       CALL section_add_keyword(section, keyword)
    1364        31891 :       CALL keyword_release(keyword)
    1365              : 
    1366        31891 :       IF (create_subsections) THEN
    1367        10643 :          NULLIFY (subsection)
    1368        10643 :          CALL create_rsgrid_section(subsection)
    1369        10643 :          CALL section_add_subsection(section, subsection)
    1370        10643 :          CALL section_release(subsection)
    1371              : 
    1372        10643 :          NULLIFY (subsection)
    1373        10643 :          CALL create_interp_section(subsection)
    1374        10643 :          CALL section_add_subsection(section, subsection)
    1375        10643 :          CALL section_release(subsection)
    1376              :       END IF
    1377        31891 :    END SUBROUTINE create_mgrid_section
    1378              : 
    1379              : ! **************************************************************************************************
    1380              : !> \brief creates the interpolation section
    1381              : !> \param section ...
    1382              : !> \author tlaino
    1383              : ! **************************************************************************************************
    1384        85011 :    SUBROUTINE create_interp_section(section)
    1385              :       TYPE(section_type), POINTER                        :: section
    1386              : 
    1387              :       TYPE(keyword_type), POINTER                        :: keyword
    1388              :       TYPE(section_type), POINTER                        :: print_key
    1389              : 
    1390        85011 :       CPASSERT(.NOT. ASSOCIATED(section))
    1391              :       CALL section_create(section, __LOCATION__, name="interpolator", &
    1392              :                           description="kind of interpolation used between the multigrids", &
    1393        85011 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    1394              : 
    1395        85011 :       NULLIFY (keyword, print_key)
    1396              : 
    1397              :       CALL keyword_create(keyword, __LOCATION__, name="kind", &
    1398              :                           description="The interpolator to use. SPLINE3 automatically enables commensurate grids.", &
    1399              :                           usage="kind spline3", &
    1400              :                           default_i_val=pw_interp, &
    1401              :                           enum_c_vals=s2a("pw", "spline3"), &
    1402        85011 :                           enum_i_vals=[pw_interp, spline3_pbc_interp])
    1403        85011 :       CALL section_add_keyword(section, keyword)
    1404        85011 :       CALL keyword_release(keyword)
    1405              : 
    1406              :       CALL keyword_create(keyword, __LOCATION__, name="safe_computation", &
    1407              :                           description="if a non unrolled calculation is to be performed in parallel", &
    1408              :                           usage="safe_computation OFF", &
    1409              :                           default_l_val=.FALSE., &
    1410        85011 :                           lone_keyword_l_val=.TRUE.)
    1411        85011 :       CALL section_add_keyword(section, keyword)
    1412        85011 :       CALL keyword_release(keyword)
    1413              : 
    1414              :       CALL keyword_create(keyword, __LOCATION__, name="aint_precond", &
    1415              :                           description="the approximate inverse to use to get the starting point"// &
    1416              :                           " for the linear solver of the spline3 methods", &
    1417              :                           usage="aint_precond copy", &
    1418              :                           default_i_val=precond_spl3_aint, &
    1419              :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_aint2", &
    1420              :                                           "spl3_nopbc_precond1", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    1421              :                           enum_i_vals=[no_precond, precond_spl3_aint, precond_spl3_aint2, &
    1422        85011 :                                        precond_spl3_1, precond_spl3_2, precond_spl3_3])
    1423        85011 :       CALL section_add_keyword(section, keyword)
    1424        85011 :       CALL keyword_release(keyword)
    1425              : 
    1426              :       CALL keyword_create(keyword, __LOCATION__, name="precond", &
    1427              :                           description="The preconditioner used"// &
    1428              :                           " for the linear solver of the spline3 methods", &
    1429              :                           usage="PRECOND copy", &
    1430              :                           default_i_val=precond_spl3_3, &
    1431              :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_aint2", &
    1432              :                                           "spl3_nopbc_precond1", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    1433              :                           enum_i_vals=[no_precond, precond_spl3_aint, precond_spl3_aint2, &
    1434        85011 :                                        precond_spl3_1, precond_spl3_2, precond_spl3_3])
    1435        85011 :       CALL section_add_keyword(section, keyword)
    1436        85011 :       CALL keyword_release(keyword)
    1437              : 
    1438              :       CALL keyword_create(keyword, __LOCATION__, name="eps_x", &
    1439              :                           description="accuracy on the solution for spline3 the interpolators", &
    1440        85011 :                           usage="eps_x 1.e-15", default_r_val=1.e-10_dp)
    1441        85011 :       CALL section_add_keyword(section, keyword)
    1442        85011 :       CALL keyword_release(keyword)
    1443              : 
    1444              :       CALL keyword_create(keyword, __LOCATION__, name="eps_r", &
    1445              :                           description="accuracy on the residual for spline3 the interpolators", &
    1446        85011 :                           usage="eps_r 1.e-15", default_r_val=1.e-10_dp)
    1447        85011 :       CALL section_add_keyword(section, keyword)
    1448        85011 :       CALL keyword_release(keyword)
    1449              : 
    1450              :       CALL keyword_create(keyword, __LOCATION__, name="max_iter", &
    1451              :                           variants=['maxiter'], &
    1452              :                           description="the maximum number of iterations", &
    1453       170022 :                           usage="max_iter 200", default_i_val=100)
    1454        85011 :       CALL section_add_keyword(section, keyword)
    1455        85011 :       CALL keyword_release(keyword)
    1456              : 
    1457        85011 :       NULLIFY (print_key)
    1458              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "conv_info", &
    1459              :                                        description="if convergence information about the linear solver"// &
    1460              :                                        " of the spline methods should be printed", &
    1461              :                                        print_level=medium_print_level, each_iter_names=s2a("SPLINE_FIND_COEFFS"), &
    1462              :                                        each_iter_values=[10], filename="__STD_OUT__", &
    1463        85011 :                                        add_last=add_last_numeric)
    1464        85011 :       CALL section_add_subsection(section, print_key)
    1465        85011 :       CALL section_release(print_key)
    1466              : 
    1467        85011 :    END SUBROUTINE create_interp_section
    1468              : 
    1469              : ! **************************************************************************************************
    1470              : !> \brief creates the sic (self interaction correction) section
    1471              : !> \param section ...
    1472              : !> \author fawzi
    1473              : ! **************************************************************************************************
    1474        10643 :    SUBROUTINE create_sic_section(section)
    1475              :       TYPE(section_type), POINTER                        :: section
    1476              : 
    1477              :       TYPE(keyword_type), POINTER                        :: keyword
    1478              : 
    1479        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    1480              :       CALL section_create(section, __LOCATION__, name="sic", &
    1481              :                           description="parameters for the self interaction correction", &
    1482              :                           n_keywords=6, n_subsections=0, repeats=.FALSE., &
    1483        42572 :                           citations=[VandeVondele2005b, Perdew1981, Avezac2005])
    1484              : 
    1485        10643 :       NULLIFY (keyword)
    1486              : 
    1487              :       CALL keyword_create(keyword, __LOCATION__, name="SIC_SCALING_A", &
    1488              :                           description="Scaling of the coulomb term in sic [experimental]", &
    1489              :                           usage="SIC_SCALING_A 0.5", &
    1490              :                           citations=[VandeVondele2005b], &
    1491        21286 :                           default_r_val=1.0_dp)
    1492        10643 :       CALL section_add_keyword(section, keyword)
    1493        10643 :       CALL keyword_release(keyword)
    1494              : 
    1495              :       CALL keyword_create(keyword, __LOCATION__, name="SIC_SCALING_B", &
    1496              :                           description="Scaling of the xc term in sic [experimental]", &
    1497              :                           usage="SIC_SCALING_B 0.5", &
    1498              :                           citations=[VandeVondele2005b], &
    1499        21286 :                           default_r_val=1.0_dp)
    1500        10643 :       CALL section_add_keyword(section, keyword)
    1501        10643 :       CALL keyword_release(keyword)
    1502              : 
    1503              :       CALL keyword_create(keyword, __LOCATION__, name="SIC_METHOD", &
    1504              :                           description="Method used to remove the self interaction", &
    1505              :                           usage="SIC_METHOD MAURI_US", &
    1506              :                           default_i_val=sic_none, &
    1507              :                           enum_c_vals=s2a("NONE", "MAURI_US", "MAURI_SPZ", "AD", "EXPLICIT_ORBITALS"), &
    1508              :                           enum_i_vals=[sic_none, sic_mauri_us, sic_mauri_spz, sic_ad, sic_eo], &
    1509              :                           enum_desc=s2a("Do not apply a sic correction", &
    1510              :                                         "Employ a (scaled) correction proposed by Mauri and co-workers"// &
    1511              :                                         " on the spin density / doublet unpaired orbital", &
    1512              :                                         "Employ a (scaled) Perdew-Zunger expression"// &
    1513              :                                         " on the spin density / doublet unpaired orbital", &
    1514              :                                         "The average density correction", &
    1515              :                                         "(scaled) Perdew-Zunger correction explicitly on a set of orbitals."), &
    1516        42572 :                           citations=[VandeVondele2005b, Perdew1981, Avezac2005])
    1517        10643 :       CALL section_add_keyword(section, keyword)
    1518        10643 :       CALL keyword_release(keyword)
    1519              : 
    1520              :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_SET", &
    1521              :                           description="Type of orbitals treated with the SIC", &
    1522              :                           usage="ORBITAL_SET ALL", &
    1523              :                           default_i_val=sic_list_unpaired, &
    1524              :                           enum_c_vals=s2a("UNPAIRED", "ALL"), &
    1525              :                           enum_desc=s2a("correction for the unpaired orbitals only, requires a restricted open shell calculation", &
    1526              :                                         "correction for all orbitals, requires a LSD or ROKS calculation"), &
    1527        10643 :                           enum_i_vals=[sic_list_unpaired, sic_list_all])
    1528        10643 :       CALL section_add_keyword(section, keyword)
    1529        10643 :       CALL keyword_release(keyword)
    1530              : 
    1531        10643 :    END SUBROUTINE create_sic_section
    1532              : 
    1533              : ! **************************************************************************************************
    1534              : !> \brief creates the low spin roks section
    1535              : !> \param section ...
    1536              : !> \author Joost VandeVondele
    1537              : ! **************************************************************************************************
    1538        10643 :    SUBROUTINE create_low_spin_roks_section(section)
    1539              :       TYPE(section_type), POINTER                        :: section
    1540              : 
    1541              :       TYPE(keyword_type), POINTER                        :: keyword
    1542              : 
    1543        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    1544              :       CALL section_create(section, __LOCATION__, name="LOW_SPIN_ROKS", &
    1545              :                           description="Specify the details of the low spin ROKS method. "// &
    1546              :                           "In particular, one can specify various terms added to the energy of the high spin roks configuration"// &
    1547              :                           " with a energy scaling factor, and a prescription of the spin state.", &
    1548        10643 :                           n_keywords=6, n_subsections=0, repeats=.FALSE.)
    1549              : 
    1550        10643 :       NULLIFY (keyword)
    1551              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_SCALING", &
    1552              :                           description="The scaling factors for each term added to the total energy. "// &
    1553              :                           "This list should contain one number for each term added to the total energy.", &
    1554              :                           usage="ENERGY_SCALING 1.0 -1.0 ", &
    1555        10643 :                           n_var=-1, type_of_var=real_t, repeats=.FALSE.)
    1556        10643 :       CALL section_add_keyword(section, keyword)
    1557        10643 :       CALL keyword_release(keyword)
    1558              :       CALL keyword_create( &
    1559              :          keyword, __LOCATION__, name="SPIN_CONFIGURATION", &
    1560              :          description="For each singly occupied orbital, specify if this should be an alpha (=1) or a beta (=2) orbital. "// &
    1561              :          "This keyword should be repeated, each repetition corresponding to an additional term.", &
    1562              :          usage="SPIN_CONFIGURATION 1 2", &
    1563        10643 :          n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1564        10643 :       CALL section_add_keyword(section, keyword)
    1565        10643 :       CALL keyword_release(keyword)
    1566              : 
    1567        10643 :    END SUBROUTINE create_low_spin_roks_section
    1568              : 
    1569              : ! **************************************************************************************************
    1570              : !> \brief ...
    1571              : !> \param section ...
    1572              : ! **************************************************************************************************
    1573        10643 :    SUBROUTINE create_rtp_section(section)
    1574              :       TYPE(section_type), POINTER                        :: section
    1575              : 
    1576              :       TYPE(keyword_type), POINTER                        :: keyword
    1577              :       TYPE(section_type), POINTER                        :: print_key, print_section, subsection
    1578              : 
    1579        10643 :       NULLIFY (keyword)
    1580        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    1581              :       CALL section_create(section, __LOCATION__, name="REAL_TIME_PROPAGATION", &
    1582              :                           description="Parameters needed to set up the real time propagation"// &
    1583              :                           " for the electron dynamics. This currently works only in the NVE ensemble.", &
    1584              :                           n_keywords=4, n_subsections=4, repeats=.FALSE., &
    1585        31929 :                           citations=[Kunert2003, Andermatt2016])
    1586              : 
    1587              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    1588              :                           description="Maximal number of iterations for the self consistent propagator loop.", &
    1589              :                           usage="MAX_ITER 10", &
    1590        10643 :                           default_i_val=10)
    1591        10643 :       CALL section_add_keyword(section, keyword)
    1592        10643 :       CALL keyword_release(keyword)
    1593              : 
    1594              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    1595              :                           description="Convergence criterion for the self consistent propagator loop.", &
    1596              :                           usage="EPS_ITER 1.0E-5", &
    1597        10643 :                           default_r_val=1.0E-7_dp)
    1598        10643 :       CALL section_add_keyword(section, keyword)
    1599        10643 :       CALL keyword_release(keyword)
    1600              : 
    1601              :       CALL keyword_create(keyword, __LOCATION__, name="ASPC_ORDER", &
    1602              :                           description="Speciefies how many steps will be used for extrapolation. "// &
    1603              :                           "One will be always used which is means X(t+dt)=X(t)", &
    1604              :                           usage="ASPC_ORDER 3", &
    1605        10643 :                           default_i_val=3)
    1606        10643 :       CALL section_add_keyword(section, keyword)
    1607        10643 :       CALL keyword_release(keyword)
    1608              : 
    1609              :       CALL keyword_create(keyword, __LOCATION__, name="MAT_EXP", &
    1610              :                           description="Which method should be used to calculate the exponential"// &
    1611              :                           " in the propagator. It is recommended to use BCH when employing density_propagation "// &
    1612              :                           "and ARNOLDI otherwise.", &
    1613              :                           usage="MAT_EXP TAYLOR", default_i_val=do_arnoldi, &
    1614              :                           enum_c_vals=s2a("TAYLOR", "PADE", "ARNOLDI", "BCH", "EXACT"), &
    1615              :                           enum_i_vals=[do_taylor, do_pade, do_arnoldi, do_bch, do_exact], &
    1616              :                           enum_desc=s2a("exponential is evaluated using scaling and squaring in combination"// &
    1617              :                                         " with a taylor expansion of the exponential.", &
    1618              :                                         "uses scaling and squaring together with the pade approximation", &
    1619              :                                         "uses arnoldi subspace algorithm to compute exp(H)*MO directly, can't be used in "// &
    1620              :                                         "combination with Crank Nicholson or density propagation", &
    1621              :                                         "Uses a Baker-Campbell-Hausdorff expansion to propagate the density matrix,"// &
    1622              :                                         " only works for density propagation", &
    1623              :                                         "Uses diagonalisation of the exponent matrices to determine the "// &
    1624        10643 :                                         "matrix exponential exactly. Only implemented for GWBSE."))
    1625        10643 :       CALL section_add_keyword(section, keyword)
    1626        10643 :       CALL keyword_release(keyword)
    1627              : 
    1628              :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY_PROPAGATION", &
    1629              :                           description="The density matrix is propagated instead of the molecular orbitals. "// &
    1630              :                           "This can allow a linear scaling simulation. The density matrix is filtered with "// &
    1631              :                           "the threshold based on the EPS_FILTER keyword from the LS_SCF section", &
    1632              :                           usage="DENSITY_PROPAGATION .TRUE.", &
    1633        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1634        10643 :       CALL section_add_keyword(section, keyword)
    1635        10643 :       CALL keyword_release(keyword)
    1636              : 
    1637              :       CALL keyword_create(keyword, __LOCATION__, name="SC_CHECK_START", &
    1638              :                           description="Speciefies how many iteration steps will be done without "// &
    1639              :                           "a check for self consistency. Can save some time in big calculations.", &
    1640              :                           usage="SC_CHECK_START 3", &
    1641        10643 :                           default_i_val=0)
    1642        10643 :       CALL section_add_keyword(section, keyword)
    1643        10643 :       CALL keyword_release(keyword)
    1644              : 
    1645              :       CALL keyword_create(keyword, __LOCATION__, name="EXP_ACCURACY", &
    1646              :                           description="Accuracy for the taylor and pade approximation. "// &
    1647              :                           "This is only an upper bound bound since the norm used for the guess "// &
    1648              :                           "is an upper bound for the needed one.", &
    1649              :                           usage="EXP_ACCURACY 1.0E-6", &
    1650        10643 :                           default_r_val=1.0E-9_dp)
    1651        10643 :       CALL section_add_keyword(section, keyword)
    1652        10643 :       CALL keyword_release(keyword)
    1653              : 
    1654              :       CALL keyword_create(keyword, __LOCATION__, name="PROPAGATOR", &
    1655              :                           description="Which propagator should be used for the orbitals", &
    1656              :                           usage="PROPAGATOR ETRS", default_i_val=do_etrs, &
    1657              :                           enum_c_vals=s2a("ETRS", "CN", "EM"), &
    1658              :                           enum_i_vals=[do_etrs, do_cn, do_em], &
    1659              :                           enum_desc=s2a("enforced time reversible symmetry", &
    1660              :                                         "Crank Nicholson propagator", &
    1661        10643 :                                         "Exponential midpoint propagator"))
    1662        10643 :       CALL section_add_keyword(section, keyword)
    1663        10643 :       CALL keyword_release(keyword)
    1664              : 
    1665              :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_WFN", &
    1666              :                           description="Controls the initial WFN used for propagation. "// &
    1667              :                           "Note that some energy contributions may not be "// &
    1668              :                           "initialized in the restart cases, for instance "// &
    1669              :                           "electronic entropy energy in the case of smearing.", &
    1670              :                           usage="INITIAL_WFN SCF_WFN", default_i_val=use_scf_wfn, &
    1671              :                           enum_c_vals=s2a("SCF_WFN", "RESTART_WFN", "RT_RESTART"), &
    1672              :                           enum_i_vals=[use_scf_wfn, use_restart_wfn, use_rt_restart], &
    1673              :                           enum_desc=s2a("An SCF run is performed to get the initial state.", &
    1674              :                                         "A wavefunction from a previous SCF is propagated. Especially useful,"// &
    1675              :                                         " if electronic constraints or restraints are used in the previous calculation, "// &
    1676              :                                         "since these do not work in the rtp scheme.", &
    1677        10643 :                                         "use the wavefunction of a real time propagation/ehrenfest run"))
    1678        10643 :       CALL section_add_keyword(section, keyword)
    1679        10643 :       CALL keyword_release(keyword)
    1680              : 
    1681              :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_WFN_MIX_INIT_RESTART", &
    1682              :                           description="If set to True and in the case of INITIAL_WFN=RESTART_WFN, call the "// &
    1683              :                           "DFT%PRINT%WFN_MIX section to mix the read initial wfn. The starting wave-function of the "// &
    1684              :                           "RTP will be the mixed one. Setting this to True without a defined WFN_MIX section will "// &
    1685              :                           "not do anything as defining a WFN_MIX section without this keyword for RTP run with "// &
    1686              :                           "INITIAL_WFN=RESTART_WFN. Note that if INITIAL_WFN=SCF_WFN, this keyword is not needed to "// &
    1687              :                           "apply the mixing defined in the WFN_MIX section. Default is False.", &
    1688              :                           usage="APPLY_WFN_MIX_INIT_RESTART", &
    1689        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1690        10643 :       CALL section_add_keyword(section, keyword)
    1691        10643 :       CALL keyword_release(keyword)
    1692              : 
    1693              :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_DELTA_PULSE", &
    1694              :                           description="Applies a delta kick to the initial wfn (only RTP for now - the EMD"// &
    1695              :                           " case is not yet implemented). Only work for INITIAL_WFN=SCF_WFN", &
    1696              :                           usage="APPLY_DELTA_PULSE", &
    1697        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1698        10643 :       CALL section_add_keyword(section, keyword)
    1699        10643 :       CALL keyword_release(keyword)
    1700              : 
    1701              :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_DELTA_PULSE_MAG", &
    1702              :                           description="Applies a magnetic delta kick to the initial wfn (only RTP for now - the EMD"// &
    1703              :                           " case is not yet implemented). Only work for INITIAL_WFN=SCF_WFN", &
    1704              :                           usage="APPLY_DELTA_PULSE_MAG", &
    1705        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1706        10643 :       CALL section_add_keyword(section, keyword)
    1707        10643 :       CALL keyword_release(keyword)
    1708              : 
    1709              :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_GAUGE", &
    1710              :                           description="Perform propagation in the velocity gauge using the explicit vector potential"// &
    1711              :                           " only a constant vector potential as of now (corresonding to a delta-pulse)."// &
    1712              :                           " uses DELTA_PULSE_SCALE and DELTA_PULSE_DIRECTION to define the vector potential", &
    1713              :                           usage="VELOCITY_GAUGE T", &
    1714        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1715        10643 :       CALL section_add_keyword(section, keyword)
    1716        10643 :       CALL keyword_release(keyword)
    1717              : 
    1718              :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ORIG", &
    1719              :                           description="Define gauge origin for magnetic perturbation", &
    1720              :                           usage="GAUGE_ORIG COM", &
    1721              :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
    1722              :                           enum_desc=s2a("Use Center of Mass", &
    1723              :                                         "Use Center of Atomic Charges", &
    1724              :                                         "Use User Defined Point (Keyword:REF_POINT)", &
    1725              :                                         "Use Origin of Coordinate System"), &
    1726              :                           enum_i_vals=[use_mom_ref_com, &
    1727              :                                        use_mom_ref_coac, &
    1728              :                                        use_mom_ref_user, &
    1729              :                                        use_mom_ref_zero], &
    1730        10643 :                           default_i_val=use_mom_ref_com)
    1731        10643 :       CALL section_add_keyword(section, keyword)
    1732        10643 :       CALL keyword_release(keyword)
    1733              : 
    1734              :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ORIG_MANUAL", &
    1735              :                           description="Manually defined gauge origin for magnetic perturbation [in Bohr!]", &
    1736              :                           usage="GAUGE_ORIG_MANUAL x y z", &
    1737              :                           repeats=.FALSE., &
    1738              :                           n_var=3, default_r_vals=[0._dp, 0._dp, 0._dp], &
    1739              :                           type_of_var=real_t, &
    1740        10643 :                           unit_str='bohr')
    1741        10643 :       CALL section_add_keyword(section, keyword)
    1742        10643 :       CALL keyword_release(keyword)
    1743              : 
    1744              :       CALL keyword_create(keyword, __LOCATION__, name="VG_COM_NL", &
    1745              :                           description="apply gauge transformed non-local potential term"// &
    1746              :                           " only affects VELOCITY_GAUGE=.TRUE.", &
    1747              :                           usage="VG_COM_NL T", &
    1748        10643 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1749        10643 :       CALL section_add_keyword(section, keyword)
    1750        10643 :       CALL keyword_release(keyword)
    1751              : 
    1752              :       CALL keyword_create(keyword, __LOCATION__, name="COM_NL", &
    1753              :                           description="Include non-local commutator for periodic delta pulse."// &
    1754              :                           " only affects PERIODIC=.TRUE.", &
    1755              :                           usage="COM_NL", &
    1756        10643 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1757        10643 :       CALL section_add_keyword(section, keyword)
    1758        10643 :       CALL keyword_release(keyword)
    1759              : 
    1760              :       CALL keyword_create(keyword, __LOCATION__, name="LEN_REP", &
    1761              :                           description="Use length representation delta pulse (in conjunction with PERIODIC T)."// &
    1762              :                           " This corresponds to a 1st order perturbation in the length gauge."// &
    1763              :                           " Note that this is NOT compatible with a periodic calculation!"// &
    1764              :                           " Uses the reference point defined in DFT%PRINT%MOMENTS ", &
    1765              :                           usage="LEN_REP T", &
    1766        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1767        10643 :       CALL section_add_keyword(section, keyword)
    1768        10643 :       CALL keyword_release(keyword)
    1769              : 
    1770              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    1771              :                           description="Apply a delta-kick that is compatible with periodic boundary conditions"// &
    1772              :                           " for any value of DELTA_PULSE_SCALE. Uses perturbation theory for the preparation of"// &
    1773              :                           " the initial wfn with the velocity operator as perturbation."// &
    1774              :                           " If LEN_REP is .FALSE. this corresponds to a first order velocity gauge."// &
    1775              :                           " Note that the pulse is only applied when INITIAL_WFN is set to SCF_WFN,"// &
    1776              :                           " and not for restarts (RT_RESTART).", &
    1777              :                           usage="PERIODIC", &
    1778        10643 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1779        10643 :       CALL section_add_keyword(section, keyword)
    1780        10643 :       CALL keyword_release(keyword)
    1781              : 
    1782              :       CALL keyword_create(keyword, __LOCATION__, name="LOCALIZE", &
    1783              :                           description="Localise the Molecular orbitals each n steps "// &
    1784              :                           "real-time propagated TDDFT, 0 means never localise", &
    1785        10643 :                           usage="LOCALIZE", default_i_val=0)
    1786        10643 :       CALL section_add_keyword(section, keyword)
    1787        10643 :       CALL keyword_release(keyword)
    1788              : 
    1789              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_PULSE_DIRECTION", &
    1790              :                           description="Direction of the applied electric field. The k vector is given as"// &
    1791              :                           " 2*Pi*[i,j,k]*inv(h_mat), which for PERIODIC .FALSE. yields exp(ikr) periodic with"// &
    1792              :                           " the unit cell, only if DELTA_PULSE_SCALE is set to unity. For an orthorhombic cell"// &
    1793              :                           " [1,0,0] yields [2*Pi/L_x,0,0]. For small cells, this results in a very large kick.", &
    1794              :                           usage="DELTA_PULSE_DIRECTION 1 1 1", n_var=3, default_i_vals=[1, 0, 0], &
    1795        10643 :                           type_of_var=integer_t)
    1796        10643 :       CALL section_add_keyword(section, keyword)
    1797        10643 :       CALL keyword_release(keyword)
    1798              : 
    1799              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_PULSE_SCALE", &
    1800              :                           description="Scale the k vector, which for PERIODIC .FALSE. results in exp(ikr) no"// &
    1801              :                           " longer being periodic with the unit cell. The norm of k is the strength of the"// &
    1802              :                           " applied electric field in atomic units.", &
    1803        10643 :                           usage="DELTA_PULSE_SCALE 0.01 ", n_var=1, default_r_val=0.001_dp)
    1804        10643 :       CALL section_add_keyword(section, keyword)
    1805        10643 :       CALL keyword_release(keyword)
    1806              : 
    1807              :       CALL keyword_create(keyword, __LOCATION__, name="HFX_BALANCE_IN_CORE", &
    1808              :                           description="If HFX is used, this keyword forces a redistribution/recalculation"// &
    1809              :                           " of the integrals, balanced with respect to the in core steps.", &
    1810              :                           usage="HFX_BALANCE_IN_CORE", &
    1811        10643 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1812        10643 :       CALL section_add_keyword(section, keyword)
    1813        10643 :       CALL keyword_release(keyword)
    1814              : 
    1815              :       CALL keyword_create(keyword, __LOCATION__, name="MCWEENY_MAX_ITER", &
    1816              :                           description="Determines the maximum amount of McWeeny steps used after each converged"// &
    1817              :                           " step in density propagation", &
    1818        10643 :                           usage="MCWEENY_MAX_ITER 2", default_i_val=1)
    1819        10643 :       CALL section_add_keyword(section, keyword)
    1820        10643 :       CALL keyword_release(keyword)
    1821              : 
    1822              :       CALL keyword_create( &
    1823              :          keyword, __LOCATION__, name="ACCURACY_REFINEMENT", &
    1824              :          description="If using density propagation some parts should be calculated with a higher accuracy than the rest"// &
    1825              :          " to reduce numerical noise. This factor determines by how much the filtering threshold is"// &
    1826              :          " reduced for these calculations.", &
    1827        10643 :          usage="ACCURACY_REFINEMENT", default_i_val=100)
    1828        10643 :       CALL section_add_keyword(section, keyword)
    1829        10643 :       CALL keyword_release(keyword)
    1830              : 
    1831              :       CALL keyword_create(keyword, __LOCATION__, name="MCWEENY_EPS", &
    1832              :                           description="Threshold after which McWeeny is terminated", &
    1833              :                           usage="MCWEENY_EPS 0.00001", &
    1834        10643 :                           default_r_val=0.0_dp)
    1835        10643 :       CALL section_add_keyword(section, keyword)
    1836        10643 :       CALL keyword_release(keyword)
    1837              : 
    1838        10643 :       NULLIFY (print_section)
    1839              :       CALL section_create(print_section, __LOCATION__, name="PRINT", &
    1840              :                           description="Section of possible print options for an RTP runs", &
    1841        10643 :                           repeats=.FALSE.)
    1842              : 
    1843        10643 :       NULLIFY (print_key)
    1844              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1845              :                                        description="Controls the printing within real time propagation and Eherenfest dynamics", &
    1846        10643 :                                        print_level=low_print_level, filename="__STD_OUT__")
    1847        10643 :       CALL section_add_subsection(print_section, print_key)
    1848        10643 :       CALL section_release(print_key)
    1849              : 
    1850              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1851              :                                        description="Controls the dumping of the MO restart file during rtp. "// &
    1852              :                                        "By default keeps a short history of three restarts. "// &
    1853              :                                        "See also RESTART_HISTORY. In density propagation this controls the printing of "// &
    1854              :                                        "density matrix.", &
    1855              :                                        print_level=low_print_level, common_iter_levels=3, &
    1856              :                                        each_iter_names=s2a("MD"), each_iter_values=[20], &
    1857        10643 :                                        add_last=add_last_numeric, filename="RESTART")
    1858              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    1859              :                           description="Specifies the maximum number of backup copies.", &
    1860              :                           usage="BACKUP_COPIES {int}", &
    1861        10643 :                           default_i_val=1)
    1862        10643 :       CALL section_add_keyword(print_key, keyword)
    1863        10643 :       CALL keyword_release(keyword)
    1864        10643 :       CALL section_add_subsection(print_section, print_key)
    1865        10643 :       CALL section_release(print_key)
    1866              : 
    1867              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART_HISTORY", &
    1868              :                                        description="Dumps unique MO restart files during the run keeping all of them. "// &
    1869              :                                        "In density propagation it dumps the density matrix instead", &
    1870              :                                        print_level=low_print_level, common_iter_levels=0, &
    1871              :                                        each_iter_names=s2a("MD"), &
    1872              :                                        each_iter_values=[500], &
    1873        10643 :                                        filename="RESTART")
    1874              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    1875              :                           description="Specifies the maximum number of backup copies.", &
    1876              :                           usage="BACKUP_COPIES {int}", &
    1877        10643 :                           default_i_val=1)
    1878        10643 :       CALL section_add_keyword(print_key, keyword)
    1879        10643 :       CALL keyword_release(keyword)
    1880        10643 :       CALL section_add_subsection(print_section, print_key)
    1881        10643 :       CALL section_release(print_key)
    1882              : 
    1883              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FIELD", &
    1884              :                                        description="Print the time-dependent field applied during an EMD simulation in "// &
    1885              :                                        "atomic unit.", &
    1886              :                                        print_level=high_print_level, common_iter_levels=1, &
    1887              :                                        each_iter_names=s2a("MD"), &
    1888              :                                        each_iter_values=[1], &
    1889        10643 :                                        filename="FIELD")
    1890        10643 :       CALL section_add_subsection(print_section, print_key)
    1891        10643 :       CALL section_release(print_key)
    1892              : 
    1893        10643 :       CALL create_projection_rtp_section(print_key)
    1894        10643 :       CALL section_add_subsection(print_section, print_key)
    1895        10643 :       CALL section_release(print_key)
    1896              : 
    1897              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CURRENT_INT", &
    1898              :                                        description="Print the integral of the current density (only if the"// &
    1899              :                                        " imaginary part of the density is NOT zero.", &
    1900              :                                        print_level=high_print_level, common_iter_levels=1, &
    1901              :                                        each_iter_names=s2a("MD"), &
    1902              :                                        each_iter_values=[1], &
    1903        10643 :                                        filename="rtp_j_int")
    1904        10643 :       CALL section_add_subsection(print_section, print_key)
    1905        10643 :       CALL section_release(print_key)
    1906              : 
    1907              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CURRENT", &
    1908              :                                        description="Print the current during an EMD simulation to cube files.", &
    1909              :                                        print_level=high_print_level, common_iter_levels=0, &
    1910              :                                        each_iter_names=s2a("MD"), &
    1911              :                                        each_iter_values=[20], &
    1912        10643 :                                        filename="current")
    1913              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    1914              :                           description="Specifies the maximum number of backup copies.", &
    1915              :                           usage="BACKUP_COPIES {int}", &
    1916        10643 :                           default_i_val=1)
    1917        10643 :       CALL section_add_keyword(print_key, keyword)
    1918        10643 :       CALL keyword_release(keyword)
    1919              :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    1920              :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1921              :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1922              :                           " 1 number valid for all components.", &
    1923        10643 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
    1924        10643 :       CALL section_add_keyword(print_key, keyword)
    1925        10643 :       CALL keyword_release(keyword)
    1926              : 
    1927        10643 :       CALL section_add_subsection(print_section, print_key)
    1928        10643 :       CALL section_release(print_key)
    1929              : 
    1930              :       ! Marek : Add print option for ASCII density files - DEVELPMENT ONLY?
    1931              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "DENSITY_MATRIX", &
    1932              :                                        description="Prints the density matrix at iterations in clear text to a file", &
    1933              :                                        print_level=high_print_level, common_iter_levels=0, &
    1934              :                                        each_iter_names=s2a("MD"), &
    1935              :                                        each_iter_values=[1], &
    1936        10643 :                                        filename="rho")
    1937        10643 :       CALL section_add_subsection(print_section, print_key)
    1938        10643 :       CALL section_release(print_key)
    1939              :       ! Marek : Moments ASCII print
    1940              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOMENTS", &
    1941              :                                        description="Prints the time-dependent electronic moments at "// &
    1942              :                                        "iterations in clear text to a file.", &
    1943              :                                        print_level=high_print_level, common_iter_levels=1, &
    1944              :                                        each_iter_names=s2a("MD"), &
    1945              :                                        each_iter_values=[1], &
    1946        10643 :                                        filename="__STD_OUT__")
    1947              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE", &
    1948              :                           variants=s2a("REF"), &
    1949              :                           description="Define the reference point for the calculation of the electrostatic moment.", &
    1950              :                           usage="REFERENCE COM", &
    1951              :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
    1952              :                           enum_desc=s2a("Use Center of Mass", &
    1953              :                                         "Use Center of Atomic Charges", &
    1954              :                                         "Use User Defined Point (Keyword:REFERENCE_POINT)", &
    1955              :                                         "Use Origin of Coordinate System"), &
    1956              :                           enum_i_vals=[use_mom_ref_com, &
    1957              :                                        use_mom_ref_coac, &
    1958              :                                        use_mom_ref_user, &
    1959              :                                        use_mom_ref_zero], &
    1960        10643 :                           default_i_val=use_mom_ref_coac)
    1961        10643 :       CALL section_add_keyword(print_key, keyword)
    1962        10643 :       CALL keyword_release(keyword)
    1963              : 
    1964              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_POINT", &
    1965              :                           variants=s2a("REF_POINT"), &
    1966              :                           description="Fixed reference point for the calculations of the electrostatic moment.", &
    1967              :                           usage="REFERENCE_POINT x y z", &
    1968              :                           repeats=.FALSE., &
    1969              :                           n_var=3, default_r_vals=[0._dp, 0._dp, 0._dp], &
    1970              :                           type_of_var=real_t, &
    1971        10643 :                           unit_str='angstrom')
    1972        10643 :       CALL section_add_keyword(print_key, keyword)
    1973        10643 :       CALL keyword_release(keyword)
    1974        10643 :       CALL section_add_subsection(print_section, print_key)
    1975        10643 :       CALL section_release(print_key)
    1976              :       ! Marek : Fourier transform of MOMENTS ASCII print
    1977              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOMENTS_FT", &
    1978              :                                        description="Prints the calculated Fourier transform of "// &
    1979              :                                        "time-dependent moments. For calculations with real time pulse (not delta kick) "// &
    1980              :                                        "can be supplied with starting time.", &
    1981              :                                        print_level=medium_print_level, common_iter_levels=0, &
    1982              :                                        each_iter_names=s2a("MD"), &
    1983              :                                        each_iter_values=[1], &
    1984        10643 :                                        filename="MOMENTS_FT")
    1985        10643 :       CALL section_add_subsection(print_section, print_key)
    1986        10643 :       CALL section_release(print_key)
    1987              :       ! Marek : Chosen element of (Fourier transformed) polarizability tensor (energy dependent) - text format
    1988              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "POLARIZABILITY", &
    1989              :                                        description="Prints the chosen element of the energy dependent polarizability tensor "// &
    1990              :                                        "to a specified file. The tensor is calculated as ratio of "// &
    1991              :                                        "Fourier transform of the dipole "// &
    1992              :                                        "moment trace and Fourier transform of the applied field "// &
    1993              :                                        "(for delta kick, constant real field is applied.", &
    1994              :                                        print_level=medium_print_level, common_iter_levels=0, &
    1995              :                                        each_iter_names=s2a("MD"), &
    1996              :                                        each_iter_values=[1], &
    1997        10643 :                                        filename="POLARIZABILITY")
    1998              :       CALL keyword_create(keyword, __LOCATION__, "ELEMENT", &
    1999              :                           description="Specifies the element of polarizability which is to be printed out "// &
    2000              :                           "(indexing starts at 1). If not explicitly provided, RTBSE code tries to guess "// &
    2001              :                           "the optimal values - for applied electric field (both delta pulse and RT field) "// &
    2002              :                           "with only a single non-zero cartesian component, prints the 3 trivially available elements.", &
    2003        10643 :                           type_of_var=integer_t, default_i_vals=[1, 1], n_var=2, usage="ELEMENT 1 1", repeats=.TRUE.)
    2004        10643 :       CALL section_add_keyword(print_key, keyword)
    2005        10643 :       CALL keyword_release(keyword)
    2006        10643 :       CALL section_add_subsection(print_section, print_key)
    2007        10643 :       CALL section_release(print_key)
    2008              :       ! Liouvillian eigenvalue diagnostic (linearized RT-BSE, TDA only)
    2009              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LIOUVILLIAN_EIG", &
    2010              :                                        description="Prints the eigenvalues of the linearized RT-BSE "// &
    2011              :                                        "Liouvillian on the OV subspace, computed once at job init from a "// &
    2012              :                                        "matrix-free probe of the kernel (no time propagation). In TDA this "// &
    2013              :                                        "equals the Casida-A eigenvalue problem and gives a broadening-free, "// &
    2014              :                                        "finite-time-free correctness check against bse_full.F. "// &
    2015              :                                        "Activated by RTBSE%DIAGNOSE_LIOUVILLIAN_EIG. Output lists "// &
    2016              :                                        "eigenvalues in atomic units and eV.", &
    2017              :                                        print_level=medium_print_level, common_iter_levels=0, &
    2018              :                                        each_iter_names=s2a("MD"), &
    2019              :                                        each_iter_values=[1], &
    2020        10643 :                                        filename="LIOUVILLIAN_EIG")
    2021        10643 :       CALL section_add_subsection(print_section, print_key)
    2022        10643 :       CALL section_release(print_key)
    2023              : 
    2024              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "E_CONSTITUENTS", &
    2025              :                                        description="Print the energy constituents (relevant to RTP) which make up "// &
    2026              :                                        "the Total Energy", &
    2027              :                                        print_level=high_print_level, common_iter_levels=1, &
    2028              :                                        each_iter_names=s2a("MD"), &
    2029              :                                        each_iter_values=[1], &
    2030        10643 :                                        filename="rtp")
    2031        10643 :       CALL section_add_subsection(print_section, print_key)
    2032        10643 :       CALL section_release(print_key)
    2033              : 
    2034        10643 :       CALL section_add_subsection(section, print_section)
    2035        10643 :       CALL section_release(print_section)
    2036              : 
    2037              :       ! RTBSE subsection
    2038        10643 :       NULLIFY (subsection)
    2039        10643 :       CALL create_rtbse_section(subsection)
    2040        10643 :       CALL section_add_subsection(section, subsection)
    2041        10643 :       CALL section_release(subsection)
    2042              :       ! FT subsection
    2043        10643 :       CALL create_ft_section(subsection)
    2044        10643 :       CALL section_add_subsection(section, subsection)
    2045        10643 :       CALL section_release(subsection)
    2046              : 
    2047        10643 :    END SUBROUTINE create_rtp_section
    2048              : ! **************************************************************************************************
    2049              : !> \brief Creates the subsection for specialized options of RTBSE code
    2050              : !> \param section The created RTBSE section
    2051              : !> \author Stepan Marek
    2052              : ! **************************************************************************************************
    2053        10643 :    SUBROUTINE create_rtbse_section(section)
    2054              :       TYPE(section_type), POINTER                        :: section
    2055              : 
    2056              :       TYPE(keyword_type), POINTER                        :: keyword
    2057              : 
    2058        10643 :       NULLIFY (keyword)
    2059        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    2060              : 
    2061              :       CALL section_create(section, __LOCATION__, name="RTBSE", &
    2062              :                           description="Controls options for the real-time Bethe-Salpeter (RTBSE) propagation. "// &
    2063              :                           "Note that running RTBSE requires previous low-scaling "// &
    2064              :                           "[GW](#CP2K_INPUT.FORCE_EVAL.PROPERTIES.BANDSTRUCTURE.GW) calculation. Also note that "// &
    2065              :                           "designating this section as RTBSE run but choosing run type ENERGY leads to potential "// &
    2066              :                           "deallocation errors. More details (including description of output files) is available in "// &
    2067              :                           "the [methods](../../../../methods/properties/optical/rtbse) section of the documentation.", &
    2068        21286 :                           repeats=.FALSE., citations=[Marek2025])
    2069              : 
    2070              :       ! Marek : Controlling flow to RTBSE
    2071              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2072              :                           description="Which method is used for the time propagation of electronic structure. "// &
    2073              :                           "By default, use the TDDFT method. Can also choose RT-BSE method, which propagates the lesser "// &
    2074              :                           "Green's function instead of density matrix/molecular orbitals.", &
    2075              :                           usage="&RTBSE TDDFT", &
    2076              :                           default_i_val=rtp_method_tddft, &
    2077              :                           lone_keyword_i_val=rtp_method_bse, &
    2078              :                           enum_c_vals=s2a("TDDFT", "RTBSE"), &
    2079              :                           enum_i_vals=[rtp_method_tddft, rtp_method_bse], &
    2080              :                           enum_desc=s2a("Use TDDFT for density matrix/MO propagation.", &
    2081        10643 :                                         "Use RT-BSE for Green's function propagation"))
    2082        10643 :       CALL section_add_keyword(section, keyword)
    2083        10643 :       CALL keyword_release(keyword)
    2084              : 
    2085              :       ! Marek : Development option - run GWBSE starting from the KS Hamiltonian
    2086              :       CALL keyword_create(keyword, __LOCATION__, name="RTBSE_HAMILTONIAN", &
    2087              :                           description="Which Hamiltonian to use as the single-particle Hamiltonian"// &
    2088              :                           " in the Green's propagator.", &
    2089              :                           usage="RTBSE_HAMILTONIAN G0W0", &
    2090              :                           default_i_val=rtp_bse_ham_g0w0, &
    2091              :                           enum_c_vals=s2a("KS", "G0W0"), &
    2092              :                           enum_i_vals=[rtp_bse_ham_ks, rtp_bse_ham_g0w0], &
    2093              :                           enum_desc=s2a("Use Kohn-Sham Hamiltonian for Green's propagation.", &
    2094        10643 :                                         "Use G0W0 Hamiltonian for Green's function propagation"))
    2095        10643 :       CALL section_add_keyword(section, keyword)
    2096        10643 :       CALL keyword_release(keyword)
    2097              : 
    2098              :       ! Switch for linearized rtbse propagation
    2099              :       CALL keyword_create(keyword, __LOCATION__, name="LINEARIZED_BSE_PROPAGATION", &
    2100              :                           variants=s2a("LRRTBSE"), &
    2101              :                           description="Linearizes the BSE propagation", &
    2102              :                           usage="LINEARIZED_BSE_PROPAGATION .T.", &
    2103              :                           default_l_val=.FALSE., &
    2104        10643 :                           lone_keyword_l_val=.TRUE.)
    2105        10643 :       CALL section_add_keyword(section, keyword)
    2106        10643 :       CALL keyword_release(keyword)
    2107              : 
    2108              :       ! Energy cutoff (occupied) for active MO window in linearized RT-BSE
    2109              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_CUTOFF_OCC", &
    2110              :                           description="Energy cutoff (relative to HOMO) defining the lowest "// &
    2111              :                           "occupied molecular orbital included in the active MO window of the "// &
    2112              :                           "linearized RT-BSE propagation. Only used when "// &
    2113              :                           "LINEARIZED_BSE_PROPAGATION=.TRUE.. A non-positive value disables the "// &
    2114              :                           "occupied truncation.", &
    2115              :                           usage="ENERGY_CUTOFF_OCC 5.0", &
    2116              :                           unit_str="eV", &
    2117        10643 :                           default_r_val=-1.0_dp/evolt)
    2118        10643 :       CALL section_add_keyword(section, keyword)
    2119        10643 :       CALL keyword_release(keyword)
    2120              : 
    2121              :       ! Energy cutoff (empty) for active MO window in linearized RT-BSE
    2122              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_CUTOFF_EMPTY", &
    2123              :                           description="Energy cutoff (relative to LUMO) defining the highest "// &
    2124              :                           "virtual molecular orbital included in the active MO window of the "// &
    2125              :                           "linearized RT-BSE propagation. Only used when "// &
    2126              :                           "LINEARIZED_BSE_PROPAGATION=.TRUE.. A non-positive value disables the "// &
    2127              :                           "virtual truncation.", &
    2128              :                           usage="ENERGY_CUTOFF_EMPTY 5.0", &
    2129              :                           unit_str="eV", &
    2130        10643 :                           default_r_val=-1.0_dp/evolt)
    2131        10643 :       CALL section_add_keyword(section, keyword)
    2132        10643 :       CALL keyword_release(keyword)
    2133              : 
    2134              :       CALL keyword_create(keyword, __LOCATION__, name="ENFORCE_MAX_DT", &
    2135              :                           description="For linearized RT-BSE, recompute TIMESTEP and STEPS so the same total "// &
    2136              :                           "propagation time is covered with the largest timestep that does not exceed the "// &
    2137              :                           "estimated RK4 stability limit.", &
    2138              :                           usage="ENFORCE_MAX_DT", &
    2139              :                           default_l_val=.FALSE., &
    2140        10643 :                           lone_keyword_l_val=.TRUE.)
    2141        10643 :       CALL section_add_keyword(section, keyword)
    2142        10643 :       CALL keyword_release(keyword)
    2143              : 
    2144              :       ! Tamm-Dancoff approximation for the linearized RT-BSE kernel
    2145              :       CALL keyword_create(keyword, __LOCATION__, name="TDA", &
    2146              :                           description="Apply the Tamm-Dancoff approximation to the linearized RT-BSE kernel: "// &
    2147              :                           "the Hartree and screened-exchange contributions are restricted so that the OV and VO "// &
    2148              :                           "blocks of the density response remain decoupled (i.e. only A-block coupling is kept, "// &
    2149              :                           "B-block coupling is dropped). Only effective when "// &
    2150              :                           "LINEARIZED_BSE_PROPAGATION=.TRUE..", &
    2151              :                           usage="TDA", &
    2152              :                           default_l_val=.FALSE., &
    2153        10643 :                           lone_keyword_l_val=.TRUE.)
    2154        10643 :       CALL section_add_keyword(section, keyword)
    2155        10643 :       CALL keyword_release(keyword)
    2156              : 
    2157              :       ! First-peak shift for the TDA path
    2158              :       CALL keyword_create(keyword, __LOCATION__, name="TDA_SHIFT_TO_FIRST_PEAK", &
    2159              :                           description="For the linearized RT-BSE TDA path, shift the active-MO single-particle "// &
    2160              :                           "diagonals by +Omega_0/2 (occupied) and -Omega_0/2 (virtual) with "// &
    2161              :                           "Omega_0 = eps_min_ai, so the lowest active OV mode oscillates at zero frequency "// &
    2162              :                           "in the rotating frame (RK4-exact for peak 1). omega_max becomes the full active "// &
    2163              :                           "OV width Delta = eps_max_ai - eps_min_ai. The rotation is undone at I/O so "// &
    2164              :                           "observables remain in the lab frame. Only effective when TDA=.TRUE.. "// &
    2165              :                           "Use with caution, additional convergence checks w.r.t. dt needed.", &
    2166              :                           usage="TDA_SHIFT_TO_FIRST_PEAK", &
    2167              :                           default_l_val=.FALSE., &
    2168        10643 :                           lone_keyword_l_val=.TRUE.)
    2169        10643 :       CALL section_add_keyword(section, keyword)
    2170        10643 :       CALL keyword_release(keyword)
    2171              : 
    2172              :       CALL keyword_create(keyword, __LOCATION__, name="DEBUG_DISABLE_HARTREE", &
    2173              :                           description="Debug option for linearized RT-BSE: disables the Hartree kernel in both "// &
    2174              :                           "the static reference initialization and the propagation. The Coulomb RI setup is "// &
    2175              :                           "still built so the run stays internally consistent.", &
    2176              :                           usage="DEBUG_DISABLE_HARTREE", &
    2177              :                           default_l_val=.FALSE., &
    2178        10643 :                           lone_keyword_l_val=.TRUE.)
    2179        10643 :       CALL section_add_keyword(section, keyword)
    2180        10643 :       CALL keyword_release(keyword)
    2181              : 
    2182              :       CALL keyword_create(keyword, __LOCATION__, name="KERNEL_RI", &
    2183              :                           description="Select the RI framework used to evaluate the linearized RT-BSE "// &
    2184              :                           "Hartree and screened-exchange kernels (propagation and reference). "// &
    2185              :                           "DEFAULT infers from the GW flavor: RI-RS if the GW_RI_RS section was active, "// &
    2186              :                           "AO-RI otherwise. RS/AO force that framework regardless of how GW was run. The "// &
    2187              :                           "RI-RS grid (mat_phi_mu_l, mat_Z_lP) and the V_grid/W0_grid kernels are built on "// &
    2188              :                           "demand. RI-RS is implemented for linearized RT-BSE only; for full RT-BSE an "// &
    2189              :                           "explicit RS is overridden to AO with a warning.", &
    2190              :                           usage="KERNEL_RI RS", &
    2191              :                           enum_c_vals=s2a("DEFAULT", "RS", "AO"), &
    2192              :                           enum_i_vals=[rtp_bse_kernel_ri_default, rtp_bse_kernel_ri_rs, rtp_bse_kernel_ri_ao], &
    2193              :                           enum_desc=s2a("Infer from the GW flavor (GW_RI_RS active -> RS, else AO).", &
    2194              :                                         "Real-space RI grid kernels (linearized RT-BSE only).", &
    2195              :                                         "AO-RI kernels."), &
    2196        10643 :                           default_i_val=rtp_bse_kernel_ri_default, n_var=1)
    2197        10643 :       CALL section_add_keyword(section, keyword)
    2198        10643 :       CALL keyword_release(keyword)
    2199              : 
    2200              :       CALL keyword_create(keyword, __LOCATION__, name="DEBUG_DISABLE_SEX", &
    2201              :                           description="Debug option for linearized RT-BSE: disables the screened-exchange kernel "// &
    2202              :                           "in both the static reference initialization and the propagation.", &
    2203              :                           usage="DEBUG_DISABLE_SEX", &
    2204              :                           default_l_val=.FALSE., &
    2205        10643 :                           lone_keyword_l_val=.TRUE.)
    2206        10643 :       CALL section_add_keyword(section, keyword)
    2207        10643 :       CALL keyword_release(keyword)
    2208              : 
    2209              :       ! Liouvillian eigenvalue diagnostic (matrix-free probe at init; TDA + ABBA)
    2210              :       CALL keyword_create(keyword, __LOCATION__, name="DIAGNOSE_LIOUVILLIAN_EIG", &
    2211              :                           description="Diagnostic for linearized RT-BSE: at job initialization, build the "// &
    2212              :                           "Liouvillian on the OV subspace by probing the kernel routine with canonical OV basis "// &
    2213              :                           "vectors, then diagonalize. In TDA this equals the Casida-A eigenvalue problem, giving a "// &
    2214              :                           "broadening-free, finite-time-free correctness check against bse_full.F. "// &
    2215              :                           "In ABBA it builds and diagonalizes the full coupled (A, B) Liouvillian via the "// &
    2216              :                           "Furche reduction. "// &
    2217              :                           "Output is controlled by the LIOUVILLIAN_EIG print key in the parent "// &
    2218              :                           "&REAL_TIME_PROPAGATION%&PRINT section.", &
    2219              :                           usage="DIAGNOSE_LIOUVILLIAN_EIG", &
    2220              :                           default_l_val=.FALSE., &
    2221        10643 :                           lone_keyword_l_val=.TRUE.)
    2222        10643 :       CALL section_add_keyword(section, keyword)
    2223        10643 :       CALL keyword_release(keyword)
    2224              : 
    2225        10643 :    END SUBROUTINE create_rtbse_section
    2226              : ! **************************************************************************************************
    2227              : !> \brief Creates the subsection for Fourier transform options applicable to RTP output
    2228              : !> \param ft_section The created FT section
    2229              : !> \date 11.2025
    2230              : !> \author Stepan Marek
    2231              : ! **************************************************************************************************
    2232        10643 :    SUBROUTINE create_ft_section(ft_section)
    2233              :       TYPE(section_type), POINTER                        :: ft_section
    2234              : 
    2235              :       TYPE(keyword_type), POINTER                        :: keyword
    2236              :       TYPE(section_type), POINTER                        :: subsection
    2237              : 
    2238        10643 :       CPASSERT(.NOT. ASSOCIATED(ft_section))
    2239              : 
    2240              :       ! Create the section itself
    2241              :       CALL section_create(ft_section, __LOCATION__, &
    2242              :                           name="FT", &
    2243              :                           description="Define parameters for Fourier transforms used in RTP outputs.", &
    2244        10643 :                           repeats=.FALSE.)
    2245              : 
    2246              :       ! Start time keyword
    2247        10643 :       NULLIFY (keyword)
    2248              :       CALL keyword_create(keyword, __LOCATION__, "START_TIME", &
    2249              :                           description="The starting time from which damping is applied and from which on the trace is "// &
    2250              :                           "considered for the Fourier transform (Fourier transform is used for the calculation of "// &
    2251              :                           "MOMENTS_FT and POLARIZABILITY). Useful for real-time pulse - "// &
    2252              :                           "one can specify the center of the pulse as the starting point.", &
    2253              :                           type_of_var=real_t, &
    2254              :                           unit_str="fs", &
    2255        10643 :                           default_r_val=0.0_dp)
    2256        10643 :       CALL section_add_keyword(ft_section, keyword)
    2257        10643 :       CALL keyword_release(keyword)
    2258              : 
    2259              :       ! Damping keyword
    2260              :       CALL keyword_create(keyword, __LOCATION__, "DAMPING", &
    2261              :                           description="Numerical Fourier transform (required for calculation of "// &
    2262              :                           "MOMENTS_FT and POLARIZABILITY) can oscillate "// &
    2263              :                           "when the final time trace values are far away from zero. "// &
    2264              :                           "This keyword controls the exponential damping added to the Fourier transform "// &
    2265              :                           "(Fourier transform is used for calculation of MOMENTS_FT and POLARIZABILITY). "// &
    2266              :                           "For negative values (the default), calculates the damping at the run time so that the last point "// &
    2267              :                           "in the time trace is reduced by factor e^(-4). When set manually, determines the time in which "// &
    2268              :                           "the moments trace is reduced by factor of e^(-1), except when set to zero, in which case "// &
    2269              :                           "the damping is not applied.", &
    2270              :                           type_of_var=real_t, &
    2271              :                           unit_str="fs", &
    2272        10643 :                           default_r_val=-1.0_dp/femtoseconds)
    2273        10643 :       CALL section_add_keyword(ft_section, keyword)
    2274        10643 :       CALL keyword_release(keyword)
    2275              : 
    2276              :       ! Create the Padé subsection
    2277        10643 :       NULLIFY (subsection)
    2278              :       CALL section_create(subsection, __LOCATION__, name="PADE", &
    2279              :                           description="Defines the parameters for the Padé interpolation of the "// &
    2280              :                           "Fourier transforms used in the output of RTP. Only available with the GreenX library linked to CP2K.", &
    2281        10643 :                           repeats=.FALSE.)
    2282              : 
    2283              :       ! Explicit presence of the section turns on the Padé interpolation
    2284              :       CALL keyword_create(keyword, __LOCATION__, "_SECTION_PARAMETERS_", &
    2285              :                           description="Turns on the Padé interpolation", &
    2286              :                           type_of_var=logical_t, &
    2287              :                           default_l_val=.FALSE., &
    2288        10643 :                           lone_keyword_l_val=.TRUE.)
    2289        10643 :       CALL section_add_keyword(subsection, keyword)
    2290        10643 :       CALL keyword_release(keyword)
    2291              : 
    2292              :       ! Minimum interpolated energy
    2293              :       CALL keyword_create(keyword, __LOCATION__, "E_MIN", &
    2294              :                           description="The minimum energy of the Padé interpolation output.", &
    2295              :                           type_of_var=real_t, &
    2296              :                           unit_str="eV", &
    2297        10643 :                           default_r_val=0.0_dp)
    2298        10643 :       CALL section_add_keyword(subsection, keyword)
    2299        10643 :       CALL keyword_release(keyword)
    2300              : 
    2301              :       ! Maximum interpolated energy
    2302              :       CALL keyword_create(keyword, __LOCATION__, "E_MAX", &
    2303              :                           description="The maximum energy of the Padé interpolation output.", &
    2304              :                           type_of_var=real_t, &
    2305              :                           unit_str="eV", &
    2306        10643 :                           default_r_val=100.0_dp)
    2307        10643 :       CALL section_add_keyword(subsection, keyword)
    2308        10643 :       CALL keyword_release(keyword)
    2309              : 
    2310              :       ! Energy resolution
    2311              :       CALL keyword_create(keyword, __LOCATION__, "E_STEP", &
    2312              :                           description="The energy resolution of the Padé interpolation output.", &
    2313              :                           type_of_var=real_t, &
    2314              :                           unit_str="eV", &
    2315        10643 :                           default_r_val=0.02_dp/evolt)
    2316        10643 :       CALL section_add_keyword(subsection, keyword)
    2317        10643 :       CALL keyword_release(keyword)
    2318              : 
    2319              :       ! Minimum fitting energy
    2320              :       CALL keyword_create(keyword, __LOCATION__, "FIT_E_MIN", &
    2321              :                           description="The lower boundary in energy for the points "// &
    2322              :                           "used in the fitting of Padé parameters. If negative, uses "// &
    2323              :                           "value of E_MIN (default).", &
    2324              :                           type_of_var=real_t, &
    2325              :                           unit_str="eV", &
    2326        10643 :                           default_r_val=-1.0_dp)
    2327        10643 :       CALL section_add_keyword(subsection, keyword)
    2328        10643 :       CALL keyword_release(keyword)
    2329              : 
    2330              :       ! Maximum fitting energy
    2331              :       CALL keyword_create(keyword, __LOCATION__, "FIT_E_MAX", &
    2332              :                           description="The upper boundary in energy for the points "// &
    2333              :                           "used in the fitting of Padé parameters. If negative, uses "// &
    2334              :                           "the value of E_MAX (default).", &
    2335              :                           type_of_var=real_t, &
    2336              :                           unit_str="eV", &
    2337        10643 :                           default_r_val=-1.0_dp)
    2338        10643 :       CALL section_add_keyword(subsection, keyword)
    2339        10643 :       CALL keyword_release(keyword)
    2340              : 
    2341              :       ! Add the Padé subsection
    2342        10643 :       CALL section_add_subsection(ft_section, subsection)
    2343        10643 :       CALL section_release(subsection)
    2344        10643 :    END SUBROUTINE create_ft_section
    2345              : 
    2346              : ! **************************************************************************************************
    2347              : !> \brief      Create CP2K input section for the SCCS model
    2348              : !> \param section ...
    2349              : !> \par History:
    2350              : !>      - Creation (10.10.2013,MK)
    2351              : !> \author     Matthias Krack (MK)
    2352              : !> \version    1.0
    2353              : ! **************************************************************************************************
    2354        10643 :    SUBROUTINE create_sccs_section(section)
    2355              : 
    2356              :       TYPE(section_type), POINTER                        :: section
    2357              : 
    2358              :       TYPE(keyword_type), POINTER                        :: keyword
    2359              :       TYPE(section_type), POINTER                        :: subsection
    2360              : 
    2361        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    2362              : 
    2363              :       CALL section_create(section, __LOCATION__, &
    2364              :                           name="SCCS", &
    2365              :                           description="Define the parameters for self-consistent continuum solvation (SCCS) model", &
    2366              :                           citations=[Fattebert2002, Andreussi2012, Yin2017], &
    2367              :                           n_keywords=8, &
    2368              :                           n_subsections=3, &
    2369        42572 :                           repeats=.FALSE.)
    2370              : 
    2371        10643 :       NULLIFY (keyword)
    2372              : 
    2373              :       CALL keyword_create(keyword, __LOCATION__, &
    2374              :                           name="_SECTION_PARAMETERS_", &
    2375              :                           description="Controls the activation of the SCCS section", &
    2376              :                           usage="&SCCS ON", &
    2377              :                           default_l_val=.FALSE., &
    2378        10643 :                           lone_keyword_l_val=.TRUE.)
    2379        10643 :       CALL section_add_keyword(section, keyword)
    2380        10643 :       CALL keyword_release(keyword)
    2381              : 
    2382              :       CALL keyword_create(keyword, __LOCATION__, &
    2383              :                           name="ALPHA", &
    2384              :                           description="Solvent specific tunable parameter for the calculation of "// &
    2385              :                           "the repulsion term $G^\text{rep} = \alpha S$ "// &
    2386              :                           "where $S$ is the (quantum) surface of the cavity", &
    2387              :                           repeats=.FALSE., &
    2388              :                           n_var=1, &
    2389              :                           type_of_var=real_t, &
    2390              :                           default_r_val=0.0_dp, &
    2391        10643 :                           unit_str="mN/m")
    2392        10643 :       CALL section_add_keyword(section, keyword)
    2393        10643 :       CALL keyword_release(keyword)
    2394              : 
    2395              :       CALL keyword_create(keyword, __LOCATION__, &
    2396              :                           name="BETA", &
    2397              :                           description="Solvent specific tunable parameter for the calculation of "// &
    2398              :                           "the dispersion term $G^\text{dis} = \beta V$ "// &
    2399              :                           "where $V$ is the (quantum) volume of the cavity", &
    2400              :                           repeats=.FALSE., &
    2401              :                           n_var=1, &
    2402              :                           type_of_var=real_t, &
    2403              :                           default_r_val=0.0_dp, &
    2404        10643 :                           unit_str="GPa")
    2405        10643 :       CALL section_add_keyword(section, keyword)
    2406        10643 :       CALL keyword_release(keyword)
    2407              : 
    2408              :       CALL keyword_create(keyword, __LOCATION__, &
    2409              :                           name="DELTA_RHO", &
    2410              :                           description="Numerical increment for the calculation of the (quantum) "// &
    2411              :                           "surface of the solute cavity", &
    2412              :                           repeats=.FALSE., &
    2413              :                           n_var=1, &
    2414              :                           type_of_var=real_t, &
    2415        10643 :                           default_r_val=2.0E-5_dp)
    2416        10643 :       CALL section_add_keyword(section, keyword)
    2417        10643 :       CALL keyword_release(keyword)
    2418              : 
    2419              :       CALL keyword_create(keyword, __LOCATION__, &
    2420              :                           name="DERIVATIVE_METHOD", &
    2421              :                           description="Method for the calculation of the numerical derivatives on the real-space grids", &
    2422              :                           usage="DERIVATIVE_METHOD cd5", &
    2423              :                           repeats=.FALSE., &
    2424              :                           n_var=1, &
    2425              :                           default_i_val=sccs_derivative_fft, &
    2426              :                           enum_c_vals=s2a("FFT", "CD3", "CD5", "CD7"), &
    2427              :                           enum_i_vals=[sccs_derivative_fft, &
    2428              :                                        sccs_derivative_cd3, &
    2429              :                                        sccs_derivative_cd5, &
    2430              :                                        sccs_derivative_cd7], &
    2431              :                           enum_desc=s2a("Fast Fourier transformation", &
    2432              :                                         "3-point stencil central differences", &
    2433              :                                         "5-point stencil central differences", &
    2434        10643 :                                         "7-point stencil central differences"))
    2435        10643 :       CALL section_add_keyword(section, keyword)
    2436        10643 :       CALL keyword_release(keyword)
    2437              : 
    2438              :       CALL keyword_create(keyword, __LOCATION__, &
    2439              :                           name="RELATIVE_PERMITTIVITY", &
    2440              :                           variants=s2a("DIELECTRIC_CONSTANT", "EPSILON_RELATIVE", "EPSILON_SOLVENT"), &
    2441              :                           description="Relative permittivity (dielectric constant) of the solvent (medium)", &
    2442              :                           repeats=.FALSE., &
    2443              :                           n_var=1, &
    2444              :                           type_of_var=real_t, &
    2445              :                           default_r_val=80.0_dp, &
    2446        10643 :                           usage="RELATIVE_PERMITTIVITY 78.36")
    2447        10643 :       CALL section_add_keyword(section, keyword)
    2448        10643 :       CALL keyword_release(keyword)
    2449              : 
    2450              :       CALL keyword_create(keyword, __LOCATION__, &
    2451              :                           name="EPS_SCCS", &
    2452              :                           variants=s2a("EPS_ITER", "TAU_POL"), &
    2453              :                           description="Tolerance for the convergence of the polarisation density, "// &
    2454              :                           "i.e. requested accuracy for the SCCS iteration cycle", &
    2455              :                           repeats=.FALSE., &
    2456              :                           n_var=1, &
    2457              :                           type_of_var=real_t, &
    2458              :                           default_r_val=1.0E-6_dp, &
    2459        10643 :                           usage="EPS_ITER 1.0E-7")
    2460        10643 :       CALL section_add_keyword(section, keyword)
    2461        10643 :       CALL keyword_release(keyword)
    2462              : 
    2463              :       CALL keyword_create(keyword, __LOCATION__, &
    2464              :                           name="EPS_SCF", &
    2465              :                           description="The SCCS iteration cycle is activated only if the SCF iteration cycle "// &
    2466              :                           "is converged to this threshold value", &
    2467              :                           repeats=.FALSE., &
    2468              :                           n_var=1, &
    2469              :                           type_of_var=real_t, &
    2470              :                           default_r_val=0.5_dp, &
    2471        10643 :                           usage="EPS_SCF 1.0E-2")
    2472        10643 :       CALL section_add_keyword(section, keyword)
    2473        10643 :       CALL keyword_release(keyword)
    2474              : 
    2475              :       CALL keyword_create(keyword, __LOCATION__, &
    2476              :                           name="GAMMA", &
    2477              :                           variants=s2a("SURFACE_TENSION"), &
    2478              :                           description="Surface tension of the solvent used for the calculation of "// &
    2479              :                           "the cavitation term $G^\text{cav} = \gamma S$ "// &
    2480              :                           "where $S$ is the (quantum) surface of the cavity", &
    2481              :                           repeats=.FALSE., &
    2482              :                           n_var=1, &
    2483              :                           type_of_var=real_t, &
    2484              :                           default_r_val=0.0_dp, &
    2485        10643 :                           unit_str="mN/m")
    2486        10643 :       CALL section_add_keyword(section, keyword)
    2487        10643 :       CALL keyword_release(keyword)
    2488              : 
    2489              :       CALL keyword_create(keyword, __LOCATION__, &
    2490              :                           name="MAX_ITER", &
    2491              :                           description="Maximum number of SCCS iteration steps performed to converge "// &
    2492              :                           "within the given tolerance", &
    2493              :                           repeats=.FALSE., &
    2494              :                           n_var=1, &
    2495              :                           type_of_var=integer_t, &
    2496              :                           default_i_val=100, &
    2497        10643 :                           usage="MAX_ITER 50")
    2498        10643 :       CALL section_add_keyword(section, keyword)
    2499        10643 :       CALL keyword_release(keyword)
    2500              : 
    2501              :       CALL keyword_create(keyword, __LOCATION__, &
    2502              :                           name="METHOD", &
    2503              :                           description="Method used for the smoothing of the dielectric function", &
    2504              :                           usage="METHOD Fattebert-Gygi", &
    2505              :                           default_i_val=sccs_andreussi, &
    2506              :                           enum_c_vals=s2a("ANDREUSSI", "FATTEBERT-GYGI", "SAA_ANDREUSSI"), &
    2507              :                           enum_i_vals=[sccs_andreussi, sccs_fattebert_gygi, sccs_saa_andreussi], &
    2508              :                           enum_desc=s2a("Smoothing function proposed by Andreussi et al.", &
    2509              :                                         "Smoothing function proposed by Fattebert and Gygi", &
    2510        10643 :                                         "Smoothing function of the solvent aware algorithm"))
    2511        10643 :       CALL section_add_keyword(section, keyword)
    2512        10643 :       CALL keyword_release(keyword)
    2513              : 
    2514              :       CALL keyword_create(keyword, __LOCATION__, &
    2515              :                           name="MIXING", &
    2516              :                           variants=["ETA"], &
    2517              :                           description="Mixing parameter (Hartree damping) employed during the iteration procedure", &
    2518              :                           repeats=.FALSE., &
    2519              :                           n_var=1, &
    2520              :                           type_of_var=real_t, &
    2521              :                           default_r_val=0.6_dp, &
    2522        21286 :                           usage="MIXING 0.2")
    2523        10643 :       CALL section_add_keyword(section, keyword)
    2524        10643 :       CALL keyword_release(keyword)
    2525              : 
    2526        10643 :       NULLIFY (subsection)
    2527              : 
    2528              :       CALL section_create(subsection, __LOCATION__, &
    2529              :                           name="ANDREUSSI", &
    2530              :                           description="Define the parameters of the dielectric smoothing function proposed by "// &
    2531              :                           "Andreussi et al.", &
    2532              :                           citations=[Andreussi2012], &
    2533              :                           n_keywords=2, &
    2534              :                           n_subsections=0, &
    2535        21286 :                           repeats=.FALSE.)
    2536              : 
    2537              :       CALL keyword_create(keyword, __LOCATION__, &
    2538              :                           name="RHO_MAX", &
    2539              :                           description="Maximum density value used for the smoothing of the dielectric function", &
    2540              :                           repeats=.FALSE., &
    2541              :                           n_var=1, &
    2542              :                           type_of_var=real_t, &
    2543              :                           default_r_val=0.0035_dp, &
    2544        10643 :                           usage="RHO_MAX 0.01")
    2545        10643 :       CALL section_add_keyword(subsection, keyword)
    2546        10643 :       CALL keyword_release(keyword)
    2547              : 
    2548              :       CALL keyword_create(keyword, __LOCATION__, &
    2549              :                           name="RHO_MIN", &
    2550              :                           description="Minimum density value used for the smoothing of the dielectric function", &
    2551              :                           repeats=.FALSE., &
    2552              :                           n_var=1, &
    2553              :                           type_of_var=real_t, &
    2554              :                           default_r_val=0.0001_dp, &
    2555        10643 :                           usage="RHO_MIN 0.0003")
    2556        10643 :       CALL section_add_keyword(subsection, keyword)
    2557        10643 :       CALL keyword_release(keyword)
    2558              : 
    2559        10643 :       CALL section_add_subsection(section, subsection)
    2560        10643 :       CALL section_release(subsection)
    2561              : 
    2562              :       CALL section_create(subsection, __LOCATION__, &
    2563              :                           name="FATTEBERT-GYGI", &
    2564              :                           description="Define the parameters of the dielectric smoothing function proposed by "// &
    2565              :                           "Fattebert and Gygi", &
    2566              :                           citations=[Fattebert2002], &
    2567              :                           n_keywords=2, &
    2568              :                           n_subsections=0, &
    2569        21286 :                           repeats=.FALSE.)
    2570              : 
    2571              :       CALL keyword_create(keyword, __LOCATION__, &
    2572              :                           name="BETA", &
    2573              :                           description="Parameter &beta; changes the width of the interface solute-solvent", &
    2574              :                           repeats=.FALSE., &
    2575              :                           n_var=1, &
    2576              :                           type_of_var=real_t, &
    2577              :                           default_r_val=1.7_dp, &
    2578        10643 :                           usage="BETA 1.3")
    2579        10643 :       CALL section_add_keyword(subsection, keyword)
    2580        10643 :       CALL keyword_release(keyword)
    2581              : 
    2582              :       CALL keyword_create(keyword, __LOCATION__, &
    2583              :                           name="RHO_ZERO", &
    2584              :                           variants=["RHO0"], &
    2585              :                           description="Parameter $\rho_0$ defines the critical density in the middle "// &
    2586              :                           "of the interface solute-solvent", &
    2587              :                           repeats=.FALSE., &
    2588              :                           n_var=1, &
    2589              :                           type_of_var=real_t, &
    2590              :                           default_r_val=0.0006_dp, &
    2591        21286 :                           usage="RHO_ZERO 0.0004")
    2592        10643 :       CALL section_add_keyword(subsection, keyword)
    2593        10643 :       CALL keyword_release(keyword)
    2594              : 
    2595        10643 :       CALL section_add_subsection(section, subsection)
    2596        10643 :       CALL section_release(subsection)
    2597              : 
    2598              :       CALL section_create(subsection, __LOCATION__, &
    2599              :                           name="SAA_ANDREUSSI", &
    2600              :                           description="Define the parameters of the dielectric smoothing function of "// &
    2601              :                           "the solvent aware algorithm proposed by Andreussi et al.", &
    2602              :                           citations=[Andreussi2019, Chai2025a], &
    2603              :                           n_keywords=7, &
    2604              :                           n_subsections=0, &
    2605        31929 :                           repeats=.FALSE.)
    2606              : 
    2607              :       CALL keyword_create(keyword, __LOCATION__, &
    2608              :                           name="RHO_MAX", &
    2609              :                           description="Maximum density value used for the smoothing of the dielectric function", &
    2610              :                           repeats=.FALSE., &
    2611              :                           n_var=1, &
    2612              :                           type_of_var=real_t, &
    2613              :                           default_r_val=0.0035_dp, &
    2614        10643 :                           usage="RHO_MAX 0.01")
    2615        10643 :       CALL section_add_keyword(subsection, keyword)
    2616        10643 :       CALL keyword_release(keyword)
    2617              : 
    2618              :       CALL keyword_create(keyword, __LOCATION__, &
    2619              :                           name="RHO_MIN", &
    2620              :                           description="Minimum density value used for the smoothing of the dielectric function", &
    2621              :                           repeats=.FALSE., &
    2622              :                           n_var=1, &
    2623              :                           type_of_var=real_t, &
    2624              :                           default_r_val=0.0001_dp, &
    2625        10643 :                           usage="RHO_MIN 0.0003")
    2626        10643 :       CALL section_add_keyword(subsection, keyword)
    2627        10643 :       CALL keyword_release(keyword)
    2628              : 
    2629              :       CALL keyword_create(keyword, __LOCATION__, &
    2630              :                           name="F0", &
    2631              :                           description="The threshold of the filled fraction that controls whether a point in space "// &
    2632              :                           "needs to be removed from the continuum", &
    2633              :                           repeats=.FALSE., &
    2634              :                           n_var=1, &
    2635              :                           type_of_var=real_t, &
    2636              :                           default_r_val=0.65_dp, &
    2637        10643 :                           usage="F0 0.65")
    2638        10643 :       CALL section_add_keyword(subsection, keyword)
    2639        10643 :       CALL keyword_release(keyword)
    2640              : 
    2641              :       CALL keyword_create(keyword, __LOCATION__, &
    2642              :                           name="DELTA_ETA", &
    2643              :                           description="Controls the softness of function t(r)", &
    2644              :                           repeats=.FALSE., &
    2645              :                           n_var=1, &
    2646              :                           type_of_var=real_t, &
    2647              :                           default_r_val=0.02_dp, &
    2648        10643 :                           usage="DELTA_ETA 0.02")
    2649        10643 :       CALL section_add_keyword(subsection, keyword)
    2650        10643 :       CALL keyword_release(keyword)
    2651              : 
    2652              :       CALL keyword_create(keyword, __LOCATION__, &
    2653              :                           name="DELTA_ZETA", &
    2654              :                           description="Controls the softness of function u(r)", &
    2655              :                           repeats=.FALSE., &
    2656              :                           n_var=1, &
    2657              :                           type_of_var=real_t, &
    2658              :                           unit_str='bohr', &
    2659              :                           default_r_val=0.5_dp, &
    2660        10643 :                           usage="DELTA_ZETA 0.5")
    2661        10643 :       CALL section_add_keyword(subsection, keyword)
    2662        10643 :       CALL keyword_release(keyword)
    2663              : 
    2664              :       CALL keyword_create(keyword, __LOCATION__, &
    2665              :                           name="ALPHA_ZETA", &
    2666              :                           description="The scaling factor for R_SOLV", &
    2667              :                           repeats=.FALSE., &
    2668              :                           n_var=1, &
    2669              :                           type_of_var=real_t, &
    2670              :                           default_r_val=2.0_dp, &
    2671        10643 :                           usage="ALPHA_ZETA 2.0")
    2672        10643 :       CALL section_add_keyword(subsection, keyword)
    2673        10643 :       CALL keyword_release(keyword)
    2674              : 
    2675              :       CALL keyword_create(keyword, __LOCATION__, &
    2676              :                           name="R_SOLV", &
    2677              :                           description="The solvent radius", &
    2678              :                           repeats=.FALSE., &
    2679              :                           n_var=1, &
    2680              :                           type_of_var=real_t, &
    2681              :                           unit_str='bohr', &
    2682              :                           default_r_val=2.6_dp, &
    2683        10643 :                           usage="R_SOLV 2.6")
    2684        10643 :       CALL section_add_keyword(subsection, keyword)
    2685        10643 :       CALL keyword_release(keyword)
    2686              : 
    2687        10643 :       CALL section_add_subsection(section, subsection)
    2688        10643 :       CALL section_release(subsection)
    2689              : 
    2690        10643 :    END SUBROUTINE create_sccs_section
    2691              : 
    2692              : ! **************************************************************************************************
    2693              : !> \brief      Create CP2K input section for the planar counter charge density
    2694              : !> \param section ...
    2695              : !> \author     Ziwei Chai
    2696              : !> \version    1.0
    2697              : ! **************************************************************************************************
    2698        10643 :    SUBROUTINE create_pcc_section(section)
    2699              : 
    2700              :       TYPE(section_type), POINTER                        :: section
    2701              : 
    2702              :       TYPE(keyword_type), POINTER                        :: keyword
    2703              : 
    2704        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    2705              : 
    2706              :       CALL section_create(section, __LOCATION__, &
    2707              :                           name="PLANAR_COUNTER_CHARGE", &
    2708              :                           description="Define the parameters for the planar counter charge density", &
    2709              :                           citations=[Chai2024a], &
    2710              :                           n_keywords=4, &
    2711              :                           n_subsections=0, &
    2712        21286 :                           repeats=.FALSE.)
    2713              : 
    2714        10643 :       NULLIFY (keyword)
    2715              : 
    2716              :       CALL keyword_create(keyword, __LOCATION__, &
    2717              :                           name="_SECTION_PARAMETERS_", &
    2718              :                           description="Controls the activation of the planar counter charge section", &
    2719              :                           usage="&PLANAR_COUNTER_CHARGE ON", &
    2720              :                           default_l_val=.FALSE., &
    2721        10643 :                           lone_keyword_l_val=.TRUE.)
    2722        10643 :       CALL section_add_keyword(section, keyword)
    2723        10643 :       CALL keyword_release(keyword)
    2724              : 
    2725              :       CALL keyword_create(keyword, __LOCATION__, name="PARALLEL_PLANE", &
    2726              :                           enum_c_vals=s2a('XY', 'YZ', 'XZ'), &
    2727              :                           enum_i_vals=[3, 1, 2], &
    2728              :                           description="The coordinate plane that the surface is parallel to.", &
    2729              :                           enum_desc=s2a("Parallel to XY", "Parallel to YZ", "Parallel to XZ"), &
    2730              :                           n_var=1, &
    2731              :                           default_i_val=3, &
    2732        10643 :                           usage="PARALLEL_PLANE XY")
    2733        10643 :       CALL section_add_keyword(section, keyword)
    2734        10643 :       CALL keyword_release(keyword)
    2735              : 
    2736              :       CALL keyword_create(keyword, __LOCATION__, &
    2737              :                           name="DIST_EDGE", &
    2738              :                           description="Controls the distance between the center of the Gaussian "// &
    2739              :                           "and the cell boundary", &
    2740              :                           usage="DIST_EDGE 1.0", &
    2741              :                           unit_str="angstrom", &
    2742        10643 :                           type_of_var=real_t)
    2743        10643 :       CALL section_add_keyword(section, keyword)
    2744        10643 :       CALL keyword_release(keyword)
    2745              : 
    2746              :       CALL keyword_create(keyword, __LOCATION__, &
    2747              :                           name="GAU_C", &
    2748              :                           description="Controls the spread of the Gaussian distribution", &
    2749              :                           usage="GAU_C 0.1", &
    2750              :                           unit_str="angstrom", &
    2751        10643 :                           type_of_var=real_t)
    2752        10643 :       CALL section_add_keyword(section, keyword)
    2753        10643 :       CALL keyword_release(keyword)
    2754              : 
    2755        10643 :    END SUBROUTINE create_pcc_section
    2756              : 
    2757              : ! **************************************************************************************************
    2758              : !> \brief      Create CP2K input section for calculating and printing the planar averaged
    2759              : !>             electrostatic potential (Hartree potential) for symmetric slab systems
    2760              : !> \param section ...
    2761              : !> \author     Ziwei Chai
    2762              : !> \version    1.0
    2763              : ! **************************************************************************************************
    2764        10643 :    SUBROUTINE create_paep_section(section)
    2765              : 
    2766              :       TYPE(section_type), POINTER                        :: section
    2767              : 
    2768              :       TYPE(keyword_type), POINTER                        :: keyword
    2769              : 
    2770        10643 :       CPASSERT(.NOT. ASSOCIATED(section))
    2771              : 
    2772              :       CALL section_create(section, __LOCATION__, &
    2773              :                           name="PLANAR_AVERAGED_V_HARTREE", &
    2774              :                           description="Define the parameters for calculating and printing the planar "// &
    2775              :                           "averaged electrostatic potential (Hartree potential) "// &
    2776              :                           "for symmetric slab systems", &
    2777              :                           n_keywords=2, &
    2778              :                           n_subsections=0, &
    2779        10643 :                           repeats=.FALSE.)
    2780              : 
    2781        10643 :       NULLIFY (keyword)
    2782              : 
    2783              :       CALL keyword_create(keyword, __LOCATION__, &
    2784              :                           name="_SECTION_PARAMETERS_", &
    2785              :                           description="Controls the activation of the planar averaged electrostatic "// &
    2786              :                           "potential (Hartree potential) section", &
    2787              :                           usage="&PLANAR_AVERAGED_V_HARTREE ON", &
    2788              :                           default_l_val=.FALSE., &
    2789        10643 :                           lone_keyword_l_val=.TRUE.)
    2790        10643 :       CALL section_add_keyword(section, keyword)
    2791        10643 :       CALL keyword_release(keyword)
    2792              : 
    2793              :       CALL keyword_create(keyword, __LOCATION__, name="PARALLEL_PLANE", &
    2794              :                           enum_c_vals=s2a('XY', 'YZ', 'XZ'), &
    2795              :                           enum_i_vals=[3, 1, 2], &
    2796              :                           description="The coordinate plane that the surface is parallel to.", &
    2797              :                           enum_desc=s2a("Parallel to XY", "Parallel to YZ", "Parallel to XZ"), &
    2798              :                           n_var=1, &
    2799              :                           default_i_val=3, &
    2800        10643 :                           usage="PARALLEL_PLANE XY")
    2801        10643 :       CALL section_add_keyword(section, keyword)
    2802        10643 :       CALL keyword_release(keyword)
    2803              : 
    2804        10643 :    END SUBROUTINE create_paep_section
    2805              : 
    2806              : END MODULE input_cp2k_dft
        

Generated by: LCOV version 2.0-1