LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:591cf04) Lines: 99.5 % 857 853
Test Date: 2026-09-21 02:17:57 Functions: 95.5 % 22 21

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

Generated by: LCOV version 2.0-1