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

Generated by: LCOV version 2.0-1