LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:71c3ab0) Lines: 99.5 % 809 805
Test Date: 2026-07-25 06:35:44 Functions: 95.5 % 22 21

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

Generated by: LCOV version 2.0-1