LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b8e0b09) Lines: 690 694 99.4 %
Date: 2024-08-31 06:31:37 Functions: 17 18 94.4 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 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, Avezac2005, Bengtsson1999, Blochl1995, Brelaz1979, &
      19             :         Fattebert2002, Guidon2010, Iannuzzi2005, Iannuzzi2006, Kunert2003, Merlot2014, Perdew1981, &
      20             :         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_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             :         no_excitations, numerical, oe_gllb, oe_lb, oe_none, oe_saop, oe_sic, plus_u_lowdin, &
      45             :         plus_u_mulliken, plus_u_mulliken_charges, real_time_propagation, rel_dkh, rel_none, &
      46             :         rel_pot_erfc, rel_pot_full, rel_sczora_mp, rel_trans_atom, rel_trans_full, &
      47             :         rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, sccs_andreussi, &
      48             :         sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, sccs_derivative_fft, &
      49             :         sccs_fattebert_gygi, sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, &
      50             :         sic_mauri_us, sic_none, slater, tddfpt_davidson, tddfpt_excitations, tddfpt_lanczos, &
      51             :         tddfpt_singlet, tddfpt_triplet, use_mom_ref_coac, use_mom_ref_com, use_mom_ref_user, &
      52             :         use_mom_ref_zero, use_restart_wfn, use_rt_restart, use_scf_wfn, weight_type_mass, &
      53             :         weight_type_unit
      54             :    USE input_cp2k_almo,                 ONLY: create_almo_scf_section
      55             :    USE input_cp2k_as,                   ONLY: create_active_space_section
      56             :    USE input_cp2k_ec,                   ONLY: create_ec_section
      57             :    USE input_cp2k_exstate,              ONLY: create_exstate_section
      58             :    USE input_cp2k_external,             ONLY: create_ext_den_section,&
      59             :                                               create_ext_pot_section,&
      60             :                                               create_ext_vxc_section
      61             :    USE input_cp2k_field,                ONLY: create_efield_section,&
      62             :                                               create_per_efield_section
      63             :    USE input_cp2k_kpoints,              ONLY: create_kpoints_section
      64             :    USE input_cp2k_loc,                  ONLY: create_localize_section
      65             :    USE input_cp2k_ls,                   ONLY: create_ls_scf_section
      66             :    USE input_cp2k_poisson,              ONLY: create_poisson_section
      67             :    USE input_cp2k_print_dft,            ONLY: create_print_dft_section
      68             :    USE input_cp2k_projection_rtp,       ONLY: create_projection_rtp_section
      69             :    USE input_cp2k_qs,                   ONLY: create_lrigpw_section,&
      70             :                                               create_qs_section
      71             :    USE input_cp2k_rsgrid,               ONLY: create_rsgrid_section
      72             :    USE input_cp2k_scf,                  ONLY: create_scf_section
      73             :    USE input_cp2k_transport,            ONLY: create_transport_section
      74             :    USE input_cp2k_xas,                  ONLY: create_xas_section,&
      75             :                                               create_xas_tdp_section
      76             :    USE input_cp2k_xc,                   ONLY: create_xc_section
      77             :    USE input_keyword_types,             ONLY: keyword_create,&
      78             :                                               keyword_release,&
      79             :                                               keyword_type
      80             :    USE input_section_types,             ONLY: section_add_keyword,&
      81             :                                               section_add_subsection,&
      82             :                                               section_create,&
      83             :                                               section_release,&
      84             :                                               section_type
      85             :    USE input_val_types,                 ONLY: char_t,&
      86             :                                               integer_t,&
      87             :                                               lchar_t,&
      88             :                                               real_t
      89             :    USE kinds,                           ONLY: dp
      90             :    USE pw_spline_utils,                 ONLY: no_precond,&
      91             :                                               precond_spl3_1,&
      92             :                                               precond_spl3_2,&
      93             :                                               precond_spl3_3,&
      94             :                                               precond_spl3_aint,&
      95             :                                               precond_spl3_aint2
      96             :    USE string_utilities,                ONLY: s2a
      97             : #include "./base/base_uses.f90"
      98             : 
      99             :    IMPLICIT NONE
     100             :    PRIVATE
     101             : 
     102             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_dft'
     103             : 
     104             :    PUBLIC :: create_dft_section
     105             :    PUBLIC :: create_bsse_section
     106             :    PUBLIC :: create_interp_section
     107             :    PUBLIC :: create_mgrid_section
     108             : 
     109             : CONTAINS
     110             : 
     111             : ! **************************************************************************************************
     112             : !> \brief creates the dft section
     113             : !> \param section the section to be created
     114             : !> \author fawzi
     115             : ! **************************************************************************************************
     116        8444 :    SUBROUTINE create_dft_section(section)
     117             :       TYPE(section_type), POINTER                        :: section
     118             : 
     119             :       TYPE(keyword_type), POINTER                        :: keyword
     120             :       TYPE(section_type), POINTER                        :: subsection
     121             : 
     122        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     123             :       CALL section_create(section, __LOCATION__, name="DFT", &
     124             :                           description="Parameter needed by LCAO DFT programs", &
     125        8444 :                           n_keywords=3, n_subsections=4, repeats=.FALSE.)
     126             : 
     127        8444 :       NULLIFY (keyword)
     128             :       CALL keyword_create(keyword, __LOCATION__, name="BASIS_SET_FILE_NAME", &
     129             :                           description="Name of the basis set file, may include a path", &
     130             :                           usage="BASIS_SET_FILE_NAME <FILENAME>", &
     131             :                           type_of_var=lchar_t, repeats=.TRUE., &
     132        8444 :                           default_lc_val="BASIS_SET", n_var=1)
     133        8444 :       CALL section_add_keyword(section, keyword)
     134        8444 :       CALL keyword_release(keyword)
     135             : 
     136             :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
     137             :                           description="Name of the pseudo potential file, may include a path", &
     138             :                           usage="POTENTIAL_FILE_NAME <FILENAME>", &
     139        8444 :                           default_lc_val="POTENTIAL")
     140        8444 :       CALL section_add_keyword(section, keyword)
     141        8444 :       CALL keyword_release(keyword)
     142             : 
     143             :       CALL keyword_create(keyword, __LOCATION__, name="WFN_RESTART_FILE_NAME", &
     144             :                           variants=(/"RESTART_FILE_NAME"/), &
     145             :                           description="Name of the wavefunction restart file, may include a path."// &
     146             :                           " If no file is specified, the default is to open the file as generated by the wfn restart print key.", &
     147             :                           usage="WFN_RESTART_FILE_NAME <FILENAME>", &
     148       16888 :                           type_of_var=lchar_t)
     149        8444 :       CALL section_add_keyword(section, keyword)
     150        8444 :       CALL keyword_release(keyword)
     151             : 
     152             :       CALL keyword_create(keyword, __LOCATION__, &
     153             :                           name="UKS", &
     154             :                           variants=s2a("UNRESTRICTED_KOHN_SHAM", &
     155             :                                        "LSD", &
     156             :                                        "SPIN_POLARIZED"), &
     157             :                           description="Requests a spin-polarized calculation using alpha "// &
     158             :                           "and beta orbitals, i.e. no spin restriction is applied", &
     159             :                           usage="LSD", &
     160             :                           default_l_val=.FALSE., &
     161        8444 :                           lone_keyword_l_val=.TRUE.)
     162        8444 :       CALL section_add_keyword(section, keyword)
     163        8444 :       CALL keyword_release(keyword)
     164             :       CALL keyword_create(keyword, __LOCATION__, &
     165             :                           name="ROKS", &
     166             :                           variants=(/"RESTRICTED_OPEN_KOHN_SHAM"/), &
     167             :                           description="Requests a restricted open Kohn-Sham calculation", &
     168             :                           usage="ROKS", &
     169             :                           default_l_val=.FALSE., &
     170       16888 :                           lone_keyword_l_val=.TRUE.)
     171        8444 :       CALL section_add_keyword(section, keyword)
     172        8444 :       CALL keyword_release(keyword)
     173             :       CALL keyword_create(keyword, __LOCATION__, &
     174             :                           name="MULTIPLICITY", &
     175             :                           variants=(/"MULTIP"/), &
     176             :                           description="Two times the total spin plus one. "// &
     177             :                           "Specify 3 for a triplet, 4 for a quartet, "// &
     178             :                           "and so on. Default is 1 (singlet) for an "// &
     179             :                           "even number and 2 (doublet) for an odd number "// &
     180             :                           "of electrons.", &
     181             :                           usage="MULTIPLICITY 3", &
     182       16888 :                           default_i_val=0) ! this default value is just a flag to get the above
     183        8444 :       CALL section_add_keyword(section, keyword)
     184        8444 :       CALL keyword_release(keyword)
     185             :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE", &
     186             :                           description="The total charge of the system", &
     187             :                           usage="CHARGE -1", &
     188        8444 :                           default_i_val=0)
     189        8444 :       CALL section_add_keyword(section, keyword)
     190        8444 :       CALL keyword_release(keyword)
     191             :       CALL keyword_create(keyword, __LOCATION__, name="EXCITATIONS", &
     192             :                           description="If excitations should be calculated", &
     193             :                           usage="EXCITATIONS", &
     194             :                           enum_c_vals=s2a("NONE", "TDLR", "TDDFPT"), &
     195             :                           enum_i_vals=(/no_excitations, tddfpt_excitations, &
     196             :                                         tddfpt_excitations/), &
     197        8444 :                           default_i_val=no_excitations)
     198        8444 :       CALL section_add_keyword(section, keyword)
     199        8444 :       CALL keyword_release(keyword)
     200             : 
     201             :       CALL keyword_create(keyword, __LOCATION__, &
     202             :                           name="PLUS_U_METHOD", &
     203             :                           description="Method employed for the calculation of the DFT+U contribution", &
     204             :                           repeats=.FALSE., &
     205             :                           enum_c_vals=s2a("LOWDIN", "MULLIKEN", "MULLIKEN_CHARGES"), &
     206             :                           enum_i_vals=(/plus_u_lowdin, plus_u_mulliken, plus_u_mulliken_charges/), &
     207             :                           enum_desc=s2a("Method based on Lowdin population analysis "// &
     208             :                                         "(computationally expensive, since the diagonalization of the "// &
     209             :                                         "overlap matrix is required, but possibly more robust than Mulliken)", &
     210             :                                         "Method based on Mulliken population analysis using the net AO and "// &
     211             :                                         "overlap populations (computationally cheap method)", &
     212             :                                         "Method based on Mulliken gross orbital populations (GOP)"), &
     213             :                           n_var=1, &
     214             :                           default_i_val=plus_u_mulliken, &
     215        8444 :                           usage="METHOD Lowdin")
     216        8444 :       CALL section_add_keyword(section, keyword)
     217        8444 :       CALL keyword_release(keyword)
     218             : 
     219             :       CALL keyword_create(keyword, __LOCATION__, &
     220             :                           name="RELAX_MULTIPLICITY", &
     221             :                           variants=(/"RELAX_MULTIP"/), &
     222             :                           description="Tolerance in Hartrees. Do not enforce the occupation "// &
     223             :                           "of alpha and beta MOs due to the initially "// &
     224             :                           "defined multiplicity, but rather follow the Aufbau principle. "// &
     225             :                           "A value greater than zero activates this option. "// &
     226             :                           "Larger tolerance values increase the probability for a spin flip. "// &
     227             :                           "This option is only valid for unrestricted (i.e. spin polarised) "// &
     228             :                           "Kohn-Sham (UKS) calculations.", &
     229             :                           usage="RELAX_MULTIPLICITY 0.00001", &
     230             :                           repeats=.FALSE., &
     231       16888 :                           default_r_val=0.0_dp)
     232        8444 :       CALL section_add_keyword(section, keyword)
     233        8444 :       CALL keyword_release(keyword)
     234             : 
     235             :       CALL keyword_create(keyword, __LOCATION__, name="SUBCELLS", &
     236             :                           description="Read the grid size for subcell generation in the construction of "// &
     237             :                           "neighbor lists.", usage="SUBCELLS 1.5", &
     238        8444 :                           n_var=1, default_r_val=2.0_dp)
     239        8444 :       CALL section_add_keyword(section, keyword)
     240        8444 :       CALL keyword_release(keyword)
     241             : 
     242             :       CALL keyword_create(keyword, __LOCATION__, name="AUTO_BASIS", &
     243             :                           description="Specify size of automatically generated auxiliary (RI) basis sets: "// &
     244             :                           "Options={small,medium,large,huge}", &
     245             :                           usage="AUTO_BASIS {basis_type} {basis_size}", &
     246       25332 :                           type_of_var=char_t, repeats=.TRUE., n_var=-1, default_c_vals=(/"X", "X"/))
     247        8444 :       CALL section_add_keyword(section, keyword)
     248        8444 :       CALL keyword_release(keyword)
     249             : 
     250             :       CALL keyword_create(keyword, __LOCATION__, &
     251             :                           name="SURFACE_DIPOLE_CORRECTION", &
     252             :                           variants=s2a("SURFACE_DIPOLE", &
     253             :                                        "SURF_DIP"), &
     254             :                           description="For slab calculations with asymmetric geometries, activate the correction of "// &
     255             :                           "the electrostatic potential with "// &
     256             :                           "by compensating for the surface dipole. Implemented only for slabs with normal "// &
     257             :                           "parallel to one Cartesian axis. The normal direction is given by the keyword SURF_DIP_DIR", &
     258             :                           usage="SURF_DIP", &
     259             :                           default_l_val=.FALSE., &
     260             :                           lone_keyword_l_val=.TRUE., &
     261       16888 :                           citations=(/Bengtsson1999/))
     262        8444 :       CALL section_add_keyword(section, keyword)
     263        8444 :       CALL keyword_release(keyword)
     264             : 
     265             :       CALL keyword_create(keyword, __LOCATION__, &
     266             :                           name="SURF_DIP_DIR", &
     267             :                           description="Cartesian axis parallel to surface normal.", &
     268             :                           enum_c_vals=s2a("X", "Y", "Z"), &
     269             :                           enum_i_vals=(/1, 2, 3/), &
     270             :                           enum_desc=s2a("Along x", "Along y", "Along z"), &
     271             :                           n_var=1, &
     272             :                           default_i_val=3, &
     273        8444 :                           usage="SURF_DIP_DIR Z")
     274        8444 :       CALL section_add_keyword(section, keyword)
     275        8444 :       CALL keyword_release(keyword)
     276             : 
     277             :       CALL keyword_create(keyword, __LOCATION__, &
     278             :                           name="SURF_DIP_POS", &
     279             :                           description="This keyword assigns an user defined position in Angstroms "// &
     280             :                           "in the direction normal to the surface (given by SURF_DIP_DIR). "// &
     281             :                           "The default value is -1.0_dp which appplies the correction at a position "// &
     282             :                           "that has minimum electron density on the grid.", &
     283             :                           usage="SURF_DIP_POS -1.0_dp", &
     284        8444 :                           default_r_val=-1.0_dp)
     285        8444 :       CALL section_add_keyword(section, keyword)
     286        8444 :       CALL keyword_release(keyword)
     287             : 
     288             :       CALL keyword_create(keyword, __LOCATION__, &
     289             :                           name="SURF_DIP_SWITCH", &
     290             :                           description="WARNING: Experimental feature under development that will help the "// &
     291             :                           "user to switch parameters to facilitate  SCF convergence. In its current form the "// &
     292             :                           "surface dipole correction is switched off if the calculation does not converge in "// &
     293             :                           "(0.5*MAX_SCF + 1) outer_scf steps. "// &
     294             :                           "The default value is .FALSE.", &
     295             :                           usage="SURF_DIP_SWITCH .TRUE.", &
     296             :                           default_l_val=.FALSE., &
     297        8444 :                           lone_keyword_l_val=.TRUE.)
     298        8444 :       CALL section_add_keyword(section, keyword)
     299        8444 :       CALL keyword_release(keyword)
     300             : 
     301             :       CALL keyword_create(keyword, __LOCATION__, &
     302             :                           name="CORE_CORR_DIP", &
     303             :                           description="If the total CORE_CORRECTION is non-zero and surface dipole "// &
     304             :                           "correction is switched on, presence of this keyword will adjust electron "// &
     305             :                           "density via MO occupation to reflect the total CORE_CORRECTION. "// &
     306             :                           "The default value is .FALSE.", &
     307             :                           usage="CORE_CORR_DIP .TRUE.", &
     308             :                           default_l_val=.FALSE., &
     309        8444 :                           lone_keyword_l_val=.TRUE.)
     310        8444 :       CALL section_add_keyword(section, keyword)
     311        8444 :       CALL keyword_release(keyword)
     312             : 
     313             :       CALL keyword_create(keyword, __LOCATION__, &
     314             :                           name="SORT_BASIS", &
     315             :                           description="Sort basis sets according to a certain criterion. ", &
     316             :                           enum_c_vals=s2a("DEFAULT", "EXP"), &
     317             :                           enum_i_vals=(/basis_sort_default, basis_sort_zet/), &
     318             :                           enum_desc=s2a("don't sort", "sort w.r.t. exponent"), &
     319             :                           default_i_val=basis_sort_default, &
     320        8444 :                           usage="SORT_BASIS EXP")
     321        8444 :       CALL section_add_keyword(section, keyword)
     322        8444 :       CALL keyword_release(keyword)
     323             : 
     324        8444 :       NULLIFY (subsection)
     325        8444 :       CALL create_scf_section(subsection)
     326        8444 :       CALL section_add_subsection(section, subsection)
     327        8444 :       CALL section_release(subsection)
     328             : 
     329        8444 :       CALL create_ls_scf_section(subsection)
     330        8444 :       CALL section_add_subsection(section, subsection)
     331        8444 :       CALL section_release(subsection)
     332             : 
     333        8444 :       CALL create_almo_scf_section(subsection)
     334        8444 :       CALL section_add_subsection(section, subsection)
     335        8444 :       CALL section_release(subsection)
     336             : 
     337        8444 :       CALL create_kg_section(subsection)
     338        8444 :       CALL section_add_subsection(section, subsection)
     339        8444 :       CALL section_release(subsection)
     340             : 
     341        8444 :       CALL create_ec_section(subsection)
     342        8444 :       CALL section_add_subsection(section, subsection)
     343        8444 :       CALL section_release(subsection)
     344             : 
     345        8444 :       CALL create_exstate_section(subsection)
     346        8444 :       CALL section_add_subsection(section, subsection)
     347        8444 :       CALL section_release(subsection)
     348             : 
     349        8444 :       CALL create_admm_section(subsection)
     350        8444 :       CALL section_add_subsection(section, subsection)
     351        8444 :       CALL section_release(subsection)
     352             : 
     353        8444 :       CALL create_qs_section(subsection)
     354        8444 :       CALL section_add_subsection(section, subsection)
     355        8444 :       CALL section_release(subsection)
     356             : 
     357        8444 :       CALL create_tddfpt_section(subsection)
     358        8444 :       CALL section_add_subsection(section, subsection)
     359        8444 :       CALL section_release(subsection)
     360             : 
     361        8444 :       CALL create_mgrid_section(subsection, create_subsections=.TRUE.)
     362        8444 :       CALL section_add_subsection(section, subsection)
     363        8444 :       CALL section_release(subsection)
     364             : 
     365        8444 :       CALL create_xc_section(subsection)
     366        8444 :       CALL section_add_subsection(section, subsection)
     367        8444 :       CALL section_release(subsection)
     368             : 
     369        8444 :       CALL create_relativistic_section(subsection)
     370        8444 :       CALL section_add_subsection(section, subsection)
     371        8444 :       CALL section_release(subsection)
     372             : 
     373        8444 :       CALL create_sic_section(subsection)
     374        8444 :       CALL section_add_subsection(section, subsection)
     375        8444 :       CALL section_release(subsection)
     376             : 
     377        8444 :       CALL create_low_spin_roks_section(subsection)
     378        8444 :       CALL section_add_subsection(section, subsection)
     379        8444 :       CALL section_release(subsection)
     380             : 
     381        8444 :       CALL create_efield_section(subsection)
     382        8444 :       CALL section_add_subsection(section, subsection)
     383        8444 :       CALL section_release(subsection)
     384             : 
     385        8444 :       CALL create_per_efield_section(subsection)
     386        8444 :       CALL section_add_subsection(section, subsection)
     387        8444 :       CALL section_release(subsection)
     388             : 
     389        8444 :       CALL create_ext_pot_section(subsection)
     390        8444 :       CALL section_add_subsection(section, subsection)
     391        8444 :       CALL section_release(subsection)
     392             : 
     393        8444 :       CALL create_transport_section(subsection)
     394        8444 :       CALL section_add_subsection(section, subsection)
     395        8444 :       CALL section_release(subsection)
     396             : 
     397             :       ! ZMP sections to include the external density or v_xc potential
     398        8444 :       CALL create_ext_den_section(subsection)
     399        8444 :       CALL section_add_subsection(section, subsection)
     400        8444 :       CALL section_release(subsection)
     401             : 
     402        8444 :       CALL create_ext_vxc_section(subsection)
     403        8444 :       CALL section_add_subsection(section, subsection)
     404        8444 :       CALL section_release(subsection)
     405             : 
     406        8444 :       CALL create_poisson_section(subsection)
     407        8444 :       CALL section_add_subsection(section, subsection)
     408        8444 :       CALL section_release(subsection)
     409             : 
     410        8444 :       CALL create_kpoints_section(subsection)
     411        8444 :       CALL section_add_subsection(section, subsection)
     412        8444 :       CALL section_release(subsection)
     413             : 
     414        8444 :       CALL create_implicit_solv_section(subsection)
     415        8444 :       CALL section_add_subsection(section, subsection)
     416        8444 :       CALL section_release(subsection)
     417             : 
     418        8444 :       CALL create_density_fitting_section(subsection)
     419        8444 :       CALL section_add_subsection(section, subsection)
     420        8444 :       CALL section_release(subsection)
     421             : 
     422        8444 :       CALL create_xas_section(subsection)
     423        8444 :       CALL section_add_subsection(section, subsection)
     424        8444 :       CALL section_release(subsection)
     425             : 
     426        8444 :       CALL create_xas_tdp_section(subsection)
     427        8444 :       CALL section_add_subsection(section, subsection)
     428        8444 :       CALL section_release(subsection)
     429             : 
     430        8444 :       CALL create_localize_section(subsection)
     431        8444 :       CALL section_add_subsection(section, subsection)
     432        8444 :       CALL section_release(subsection)
     433             : 
     434        8444 :       CALL create_rtp_section(subsection)
     435        8444 :       CALL section_add_subsection(section, subsection)
     436        8444 :       CALL section_release(subsection)
     437             : 
     438        8444 :       CALL create_print_dft_section(subsection)
     439        8444 :       CALL section_add_subsection(section, subsection)
     440        8444 :       CALL section_release(subsection)
     441             : 
     442        8444 :       CALL create_sccs_section(subsection)
     443        8444 :       CALL section_add_subsection(section, subsection)
     444        8444 :       CALL section_release(subsection)
     445             : 
     446        8444 :       CALL create_active_space_section(subsection)
     447        8444 :       CALL section_add_subsection(section, subsection)
     448        8444 :       CALL section_release(subsection)
     449             : 
     450        8444 :    END SUBROUTINE create_dft_section
     451             : 
     452             : ! **************************************************************************************************
     453             : !> \brief Implicit Solvation Model
     454             : !> \param section ...
     455             : !> \author tlaino
     456             : ! **************************************************************************************************
     457        8444 :    SUBROUTINE create_implicit_solv_section(section)
     458             :       TYPE(section_type), POINTER                        :: section
     459             : 
     460             :       TYPE(keyword_type), POINTER                        :: keyword
     461             :       TYPE(section_type), POINTER                        :: print_key, subsection
     462             : 
     463        8444 :       NULLIFY (keyword, subsection, print_key)
     464        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     465             :       CALL section_create(section, __LOCATION__, name="SCRF", &
     466             :                           description="Adds an implicit solvation model to the DFT calculation."// &
     467             :                           " Know also as Self Consistent Reaction Field.", &
     468        8444 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     469             : 
     470             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_OUT", &
     471             :                           description="Value of the dielectric constant outside the sphere", &
     472             :                           usage="EPS_OUT <REAL>", &
     473        8444 :                           default_r_val=1.0_dp)
     474        8444 :       CALL section_add_keyword(section, keyword)
     475        8444 :       CALL keyword_release(keyword)
     476             : 
     477             :       CALL keyword_create(keyword, __LOCATION__, name="LMAX", &
     478             :                           description="Maximum value of L used in the multipole expansion", &
     479             :                           usage="LMAX <INTEGER>", &
     480        8444 :                           default_i_val=3)
     481        8444 :       CALL section_add_keyword(section, keyword)
     482        8444 :       CALL keyword_release(keyword)
     483             : 
     484        8444 :       CALL create_sphere_section(subsection)
     485        8444 :       CALL section_add_subsection(section, subsection)
     486        8444 :       CALL section_release(subsection)
     487             : 
     488             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     489             :                                        description="Controls the printing basic info about the method", &
     490        8444 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     491        8444 :       CALL section_add_subsection(section, print_key)
     492        8444 :       CALL section_release(print_key)
     493             : 
     494        8444 :    END SUBROUTINE create_implicit_solv_section
     495             : 
     496             : ! **************************************************************************************************
     497             : !> \brief Create Sphere cavity
     498             : !> \param section ...
     499             : !> \author tlaino
     500             : ! **************************************************************************************************
     501        8444 :    SUBROUTINE create_sphere_section(section)
     502             :       TYPE(section_type), POINTER                        :: section
     503             : 
     504             :       TYPE(keyword_type), POINTER                        :: keyword
     505             :       TYPE(section_type), POINTER                        :: subsection
     506             : 
     507        8444 :       NULLIFY (keyword, subsection)
     508        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     509             :       CALL section_create(section, __LOCATION__, name="SPHERE", &
     510             :                           description="Treats the implicit solvent environment like a sphere", &
     511        8444 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     512             : 
     513             :       CALL keyword_create(keyword, __LOCATION__, name="RADIUS", &
     514             :                           description="Value of the spherical cavity in the dielectric medium", &
     515             :                           usage="RADIUS <REAL>", &
     516             :                           unit_str="angstrom", &
     517        8444 :                           type_of_var=real_t)
     518        8444 :       CALL section_add_keyword(section, keyword)
     519        8444 :       CALL keyword_release(keyword)
     520             : 
     521        8444 :       CALL create_center_section(subsection)
     522        8444 :       CALL section_add_subsection(section, subsection)
     523        8444 :       CALL section_release(subsection)
     524             : 
     525        8444 :    END SUBROUTINE create_sphere_section
     526             : 
     527             : ! **************************************************************************************************
     528             : !> \brief ...
     529             : !> \param section ...
     530             : !> \author tlaino
     531             : ! **************************************************************************************************
     532        8444 :    SUBROUTINE create_center_section(section)
     533             :       TYPE(section_type), POINTER                        :: section
     534             : 
     535             :       TYPE(keyword_type), POINTER                        :: keyword
     536             : 
     537        8444 :       NULLIFY (keyword)
     538        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     539             :       CALL section_create(section, __LOCATION__, name="CENTER", &
     540             :                           description="Defines the center of the sphere.", &
     541        8444 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     542             :       CALL keyword_create(keyword, __LOCATION__, name="XYZ", &
     543             :                           description="Coordinates of the center of the sphere", &
     544             :                           usage="XYZ <REAL> <REAL> <REAL>", &
     545             :                           unit_str="angstrom", &
     546        8444 :                           type_of_var=real_t, n_var=3)
     547        8444 :       CALL section_add_keyword(section, keyword)
     548        8444 :       CALL keyword_release(keyword)
     549             : 
     550             :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_LIST", &
     551             :                           description="Defines a list of atoms to define the center of the sphere", &
     552             :                           usage="ATOM_LIST <INTEGER> .. <INTEGER>", &
     553        8444 :                           type_of_var=integer_t, n_var=-1)
     554        8444 :       CALL section_add_keyword(section, keyword)
     555        8444 :       CALL keyword_release(keyword)
     556             : 
     557             :       CALL keyword_create(keyword, __LOCATION__, name="WEIGHT_TYPE", &
     558             :                           description="Defines the weight used to define the center of the sphere"// &
     559             :                           " (if ATOM_LIST is provided)", &
     560             :                           usage="WEIGHT (UNIT|MASS)", &
     561             :                           enum_c_vals=(/"UNIT", "MASS"/), &
     562             :                           enum_i_vals=(/weight_type_unit, weight_type_mass/), &
     563       25332 :                           default_i_val=weight_type_unit)
     564        8444 :       CALL section_add_keyword(section, keyword)
     565        8444 :       CALL keyword_release(keyword)
     566             : 
     567             :       CALL keyword_create(keyword, __LOCATION__, name="FIXED", &
     568             :                           description="Specify if the center of the sphere should be fixed or"// &
     569             :                           " allowed to move", &
     570             :                           usage="FIXED <LOGICAL>", &
     571        8444 :                           default_l_val=.TRUE.)
     572        8444 :       CALL section_add_keyword(section, keyword)
     573        8444 :       CALL keyword_release(keyword)
     574             : 
     575        8444 :    END SUBROUTINE create_center_section
     576             : 
     577             : ! **************************************************************************************************
     578             : !> \brief ...
     579             : !> \param section ...
     580             : ! **************************************************************************************************
     581        8444 :    SUBROUTINE create_admm_section(section)
     582             :       TYPE(section_type), POINTER                        :: section
     583             : 
     584             :       TYPE(keyword_type), POINTER                        :: keyword
     585             : 
     586        8444 :       NULLIFY (keyword)
     587        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     588             :       CALL section_create(section, __LOCATION__, name="AUXILIARY_DENSITY_MATRIX_METHOD", &
     589             :                           description="Parameters needed for the ADMM method.", &
     590             :                           n_keywords=1, n_subsections=1, repeats=.FALSE., &
     591       16888 :                           citations=(/Guidon2010/))
     592             : 
     593             :       CALL keyword_create( &
     594             :          keyword, __LOCATION__, &
     595             :          name="ADMM_TYPE", &
     596             :          description="Type of ADMM (sort name) as refered in literature. "// &
     597             :          "This sets values for METHOD, ADMM_PURIFICATION_METHOD, and EXCH_SCALING_MODEL", &
     598             :          enum_c_vals=s2a("NONE", "ADMM1", "ADMM2", "ADMMS", "ADMMP", "ADMMQ"), &
     599             :          enum_desc=s2a("No short name is used, use specific definitions (default)", &
     600             :                        "ADMM1 method from Guidon2010", &
     601             :                        "ADMM2 method from Guidon2010", &
     602             :                        "ADMMS method from Merlot2014", &
     603             :                        "ADMMP method from Merlot2014", &
     604             :                        "ADMMQ method from Merlot2014"), &
     605             :          enum_i_vals=(/no_admm_type, admm1_type, admm2_type, admms_type, admmp_type, admmq_type/), &
     606             :          default_i_val=no_admm_type, &
     607       25332 :          citations=(/Guidon2010, Merlot2014/))
     608        8444 :       CALL section_add_keyword(section, keyword)
     609        8444 :       CALL keyword_release(keyword)
     610             : 
     611             :       CALL keyword_create( &
     612             :          keyword, __LOCATION__, &
     613             :          name="ADMM_PURIFICATION_METHOD", &
     614             :          description="Method that shall be used for wavefunction fitting. Use MO_DIAG for MD.", &
     615             :          enum_c_vals=s2a("NONE", "CAUCHY", "CAUCHY_SUBSPACE", "MO_DIAG", "MO_NO_DIAG", "MCWEENY", "NONE_DM"), &
     616             :          enum_i_vals=(/do_admm_purify_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace, &
     617             :                        do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
     618             :                        do_admm_purify_mcweeny, do_admm_purify_none_dm/), &
     619             :          enum_desc=s2a("Do not apply any purification", &
     620             :                        "Perform purification via general Cauchy representation", &
     621             :                        "Perform purification via Cauchy representation in occupied subspace", &
     622             :                        "Calculate MO derivatives via Cauchy representation by diagonalization", &
     623             :                        "Calculate MO derivatives via Cauchy representation by inversion", &
     624             :                        "Perform original McWeeny purification via matrix multiplications", &
     625             :                        "Do not apply any purification, works directly with density matrix"), &
     626        8444 :          default_i_val=do_admm_purify_mo_diag)
     627        8444 :       CALL section_add_keyword(section, keyword)
     628        8444 :       CALL keyword_release(keyword)
     629             : 
     630             :       CALL keyword_create( &
     631             :          keyword, __LOCATION__, &
     632             :          name="METHOD", &
     633             :          description="Method that shall be used for wavefunction fitting. Use BASIS_PROJECTION for MD.", &
     634             :          enum_c_vals=s2a("BASIS_PROJECTION", "BLOCKED_PROJECTION_PURIFY_FULL", "BLOCKED_PROJECTION", &
     635             :                          "CHARGE_CONSTRAINED_PROJECTION"), &
     636             :          enum_i_vals=(/do_admm_basis_projection, do_admm_blocking_purify_full, do_admm_blocked_projection, &
     637             :                        do_admm_charge_constrained_projection/), &
     638             :          enum_desc=s2a("Construct auxiliary density matrix from auxiliary basis.", &
     639             :                        "Construct auxiliary density from a blocked Fock matrix,"// &
     640             :                        " but use the original matrix for purification.", &
     641             :                        "Construct auxiliary density from a blocked Fock matrix.", &
     642             :                        "Construct auxiliary density from auxiliary basis enforcing charge constrain."), &
     643        8444 :          default_i_val=do_admm_basis_projection)
     644        8444 :       CALL section_add_keyword(section, keyword)
     645        8444 :       CALL keyword_release(keyword)
     646             : 
     647             :       CALL keyword_create( &
     648             :          keyword, __LOCATION__, &
     649             :          name="EXCH_SCALING_MODEL", &
     650             :          description="Scaling of the exchange correction calculated by the auxiliary density matrix.", &
     651             :          enum_c_vals=s2a("NONE", "MERLOT"), &
     652             :          enum_i_vals=(/do_admm_exch_scaling_none, do_admm_exch_scaling_merlot/), &
     653             :          enum_desc=s2a("No scaling is enabled, refers to methods ADMM1, ADMM2 or ADMMQ.", &
     654             :                        "Exchange scaling according to Merlot (2014)"), &
     655        8444 :          default_i_val=do_admm_exch_scaling_none)
     656        8444 :       CALL section_add_keyword(section, keyword)
     657        8444 :       CALL keyword_release(keyword)
     658             : 
     659             :       CALL keyword_create( &
     660             :          keyword, __LOCATION__, &
     661             :          name="EXCH_CORRECTION_FUNC", &
     662             :          description="Exchange functional which is used for the ADMM correction. "// &
     663             :          "LibXC implementations require linking with LibXC", &
     664             :          enum_c_vals=s2a("DEFAULT", "PBEX", "NONE", "OPTX", "BECKE88X", &
     665             :                          "PBEX_LIBXC", "BECKE88X_LIBXC", "OPTX_LIBXC", "DEFAULT_LIBXC", "LDA_X_LIBXC"), &
     666             :          enum_i_vals=(/do_admm_aux_exch_func_default, do_admm_aux_exch_func_pbex, &
     667             :                        do_admm_aux_exch_func_none, do_admm_aux_exch_func_opt, do_admm_aux_exch_func_bee, &
     668             :                        do_admm_aux_exch_func_pbex_libxc, do_admm_aux_exch_func_bee_libxc, &
     669             :                        do_admm_aux_exch_func_opt_libxc, do_admm_aux_exch_func_default_libxc, &
     670             :                        do_admm_aux_exch_func_sx_libxc/), &
     671             :          enum_desc=s2a("Use PBE-based corrections according to the chosen interaction operator.", &
     672             :                        "Use PBEX functional for exchange correction.", &
     673             :                        "No correction: X(D)-x(d)-> 0.", &
     674             :                        "Use OPTX functional for exchange correction.", &
     675             :                        "Use Becke88X functional for exchange correction.", &
     676             :                        "Use PBEX functional (LibXC implementation) for exchange correction.", &
     677             :                        "Use Becke88X functional (LibXC implementation) for exchange correction.", &
     678             :                        "Use OPTX functional (LibXC implementation) for exchange correction.", &
     679             :                        "Use PBE-based corrections (LibXC where possible) to the chosen interaction operator.", &
     680             :                        "Use Slater X functional (LibXC where possible) for exchange correction."), &
     681        8444 :          default_i_val=do_admm_aux_exch_func_default)
     682        8444 :       CALL section_add_keyword(section, keyword)
     683        8444 :       CALL keyword_release(keyword)
     684             : 
     685             :       CALL keyword_create(keyword, __LOCATION__, name="optx_a1", &
     686             :                           description="OPTX a1 coefficient", &
     687        8444 :                           default_r_val=1.05151_dp)
     688        8444 :       CALL section_add_keyword(section, keyword)
     689        8444 :       CALL keyword_release(keyword)
     690             :       CALL keyword_create(keyword, __LOCATION__, name="optx_a2", &
     691             :                           description="OPTX a2 coefficient", &
     692        8444 :                           default_r_val=1.43169_dp)
     693        8444 :       CALL section_add_keyword(section, keyword)
     694        8444 :       CALL keyword_release(keyword)
     695             :       CALL keyword_create(keyword, __LOCATION__, name="optx_gamma", &
     696             :                           description="OPTX gamma coefficient", &
     697        8444 :                           default_r_val=0.006_dp)
     698        8444 :       CALL section_add_keyword(section, keyword)
     699        8444 :       CALL keyword_release(keyword)
     700             : 
     701             :       CALL keyword_create(keyword, __LOCATION__, name="BLOCK_LIST", &
     702             :                           description="Specifies a list of atoms.", &
     703             :                           usage="LIST {integer} {integer} .. {integer}", &
     704        8444 :                           n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
     705        8444 :       CALL section_add_keyword(section, keyword)
     706        8444 :       CALL keyword_release(keyword)
     707             : 
     708             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER", &
     709             :                           description="Define accuracy of DBCSR operations", &
     710        8444 :                           usage="EPS_FILTER", default_r_val=0.0_dp)
     711        8444 :       CALL section_add_keyword(section, keyword)
     712        8444 :       CALL keyword_release(keyword)
     713             : 
     714        8444 :    END SUBROUTINE create_admm_section
     715             : 
     716             : ! **************************************************************************************************
     717             : !> \brief ...
     718             : !> \param section ...
     719             : ! **************************************************************************************************
     720        8444 :    SUBROUTINE create_density_fitting_section(section)
     721             :       TYPE(section_type), POINTER                        :: section
     722             : 
     723             :       TYPE(keyword_type), POINTER                        :: keyword
     724             :       TYPE(section_type), POINTER                        :: print_key
     725             : 
     726        8444 :       NULLIFY (keyword, print_key)
     727        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     728             :       CALL section_create(section, __LOCATION__, name="DENSITY_FITTING", &
     729             :                           description="Setup parameters for density fitting (Bloechl charges or density derived "// &
     730             :                           "atomic point charges (DDAPC) charges)", &
     731             :                           n_keywords=7, n_subsections=0, repeats=.FALSE., &
     732       16888 :                           citations=(/Blochl1995/))
     733             : 
     734             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_GAUSS", &
     735             :                           description="Specifies the numbers of gaussian used to fit the QM density for each atomic site.", &
     736             :                           usage="NUM_GAUSS {integer}", &
     737        8444 :                           n_var=1, type_of_var=integer_t, default_i_val=3)
     738        8444 :       CALL section_add_keyword(section, keyword)
     739        8444 :       CALL keyword_release(keyword)
     740             : 
     741             :       CALL keyword_create(keyword, __LOCATION__, name="PFACTOR", &
     742             :                           description="Specifies the progression factor for the gaussian exponent for each atomic site.", &
     743             :                           usage="PFACTOR {real}", &
     744        8444 :                           n_var=1, type_of_var=real_t, default_r_val=1.5_dp)
     745        8444 :       CALL section_add_keyword(section, keyword)
     746        8444 :       CALL keyword_release(keyword)
     747             : 
     748             :       CALL keyword_create(keyword, __LOCATION__, name="MIN_RADIUS", &
     749             :                           description="Specifies the smallest radius of the gaussian used in the fit. All other radius are"// &
     750             :                           " obtained with the progression factor.", &
     751             :                           usage="MIN_RADIUS {real}", &
     752        8444 :                           unit_str="angstrom", n_var=1, type_of_var=real_t, default_r_val=0.5_dp)
     753        8444 :       CALL section_add_keyword(section, keyword)
     754        8444 :       CALL keyword_release(keyword)
     755             : 
     756             :       CALL keyword_create(keyword, __LOCATION__, name="RADII", &
     757             :                           description="Specifies all the radius of the gaussian used in the fit for each atomic site. The use"// &
     758             :                           " of this keyword disables all other keywords of this section.", &
     759             :                           usage="RADII {real} {real} .. {real}", &
     760        8444 :                           unit_str="angstrom", n_var=-1, type_of_var=real_t)
     761        8444 :       CALL section_add_keyword(section, keyword)
     762        8444 :       CALL keyword_release(keyword)
     763             : 
     764             :       CALL keyword_create(keyword, __LOCATION__, name="GCUT", &
     765             :                           description="Cutoff for charge fit in G-space.", &
     766             :                           usage="GCUT {real}", &
     767        8444 :                           n_var=1, type_of_var=real_t, default_r_val=SQRT(6.0_dp))
     768        8444 :       CALL section_add_keyword(section, keyword)
     769        8444 :       CALL keyword_release(keyword)
     770             : 
     771             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     772             :                                        description="Controls the printing of basic information during the run", &
     773        8444 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     774             : 
     775             :       CALL keyword_create(keyword, __LOCATION__, name="CONDITION_NUMBER", &
     776             :                           description="Prints information regarding the condition numbers of the A matrix (to be inverted)", &
     777             :                           usage="ANALYTICAL_GTERM <LOGICAL>", &
     778        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     779        8444 :       CALL section_add_keyword(print_key, keyword)
     780        8444 :       CALL keyword_release(keyword)
     781             : 
     782        8444 :       CALL section_add_subsection(section, print_key)
     783        8444 :       CALL section_release(print_key)
     784             : 
     785        8444 :    END SUBROUTINE create_density_fitting_section
     786             : 
     787             : ! **************************************************************************************************
     788             : !> \brief creates the input section for the tddfpt part
     789             : !> \param section the section to create
     790             : !> \author teo
     791             : ! **************************************************************************************************
     792        8444 :    SUBROUTINE create_tddfpt_section(section)
     793             :       TYPE(section_type), POINTER                        :: section
     794             : 
     795             :       TYPE(keyword_type), POINTER                        :: keyword
     796             :       TYPE(section_type), POINTER                        :: subsection
     797             : 
     798        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     799             :       CALL section_create(section, __LOCATION__, name="tddfpt", &
     800             :                           description="Old TDDFPT code. Use new version in CP2K_INPUT / FORCE_EVAL / PROPERTIES / TDDFPT", &
     801             :                           n_keywords=5, n_subsections=1, repeats=.FALSE., &
     802       16888 :                           citations=(/Iannuzzi2005/))
     803             : 
     804        8444 :       NULLIFY (subsection, keyword)
     805             : 
     806             :       ! Integer
     807             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_KV", &
     808             :                           variants=s2a("MAX_VECTORS"), &
     809             :                           description=" maximal number of Krylov space vectors", &
     810             :                           usage="MAX_KV someInteger>0", &
     811             :                           n_var=1, type_of_var=integer_t, &
     812        8444 :                           default_i_val=60)
     813        8444 :       CALL section_add_keyword(section, keyword)
     814        8444 :       CALL keyword_release(keyword)
     815             : 
     816             :       CALL keyword_create(keyword, __LOCATION__, name="RESTARTS", &
     817             :                           variants=s2a("N_RESTARTS"), &
     818             :                           description=" maximal number subspace search restarts", &
     819             :                           usage="RESTARTS someInteger>0", &
     820             :                           n_var=1, type_of_var=integer_t, &
     821        8444 :                           default_i_val=5)
     822        8444 :       CALL section_add_keyword(section, keyword)
     823        8444 :       CALL keyword_release(keyword)
     824             : 
     825             :       CALL keyword_create(keyword, __LOCATION__, name="NEV", &
     826             :                           variants=s2a("N_EV", "EV"), &
     827             :                           description=" number of excitations to calculate", &
     828             :                           usage="NEV someInteger>0", &
     829             :                           n_var=1, type_of_var=integer_t, &
     830        8444 :                           default_i_val=1)
     831        8444 :       CALL section_add_keyword(section, keyword)
     832        8444 :       CALL keyword_release(keyword)
     833             : 
     834             :       CALL keyword_create(keyword, __LOCATION__, name="NLUMO", &
     835             :                           description=" number of additional unoccupied orbitals ", &
     836             :                           usage="NLUMO 10", &
     837             :                           n_var=1, type_of_var=integer_t, &
     838        8444 :                           default_i_val=5)
     839        8444 :       CALL section_add_keyword(section, keyword)
     840        8444 :       CALL keyword_release(keyword)
     841             : 
     842             :       CALL keyword_create(keyword, __LOCATION__, name="NREORTHO", &
     843             :                           variants=s2a("N_REORTHO", "REORTHO", "REORTHOGONALITAZIONS"), &
     844             :                           description=" number of reorthogonalization steps", &
     845             :                           usage="NREORTHO someInteger>0", &
     846             :                           n_var=1, type_of_var=integer_t, &
     847        8444 :                           default_i_val=2)
     848        8444 :       CALL section_add_keyword(section, keyword)
     849        8444 :       CALL keyword_release(keyword)
     850             : 
     851             :       ! Logical
     852             :       CALL keyword_create(keyword, __LOCATION__, name="KERNEL", &
     853             :                           variants=s2a("DO_KERNEL"), &
     854             :                           description="compute the kernel (debug purpose only)", &
     855             :                           usage="KERNEL logical_value", &
     856        8444 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     857        8444 :       CALL section_add_keyword(section, keyword)
     858        8444 :       CALL keyword_release(keyword)
     859             : 
     860             :       CALL keyword_create(keyword, __LOCATION__, name="LSD_SINGLETS", &
     861             :                           description="compute singlets using lsd vxc kernel", &
     862             :                           usage="LSD_SINGLETS logical_value", &
     863        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     864        8444 :       CALL section_add_keyword(section, keyword)
     865        8444 :       CALL keyword_release(keyword)
     866             : 
     867             :       CALL keyword_create(keyword, __LOCATION__, name="INVERT_S", &
     868             :                           variants=s2a("INVERT_OVERLAP"), &
     869             :                           description="use the inverse of the overlap matrix", &
     870             :                           usage="INVERT_S logical_value", &
     871        8444 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     872        8444 :       CALL section_add_keyword(section, keyword)
     873        8444 :       CALL keyword_release(keyword)
     874             : 
     875             :       CALL keyword_create(keyword, __LOCATION__, name="PRECONDITIONER", &
     876             :                           variants=s2a("PRECOND"), &
     877             :                           description="use the preconditioner (only for Davidson)", &
     878             :                           usage="PRECONDITIONER logical_value", &
     879        8444 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     880        8444 :       CALL section_add_keyword(section, keyword)
     881        8444 :       CALL keyword_release(keyword)
     882             : 
     883             :       ! Character
     884             :       CALL keyword_create(keyword, __LOCATION__, name="RES_ETYPE", &
     885             :                           variants=s2a("RESTRICTED_EXCITATIONS_TYPE", "RES_E_TYPE"), &
     886             :                           description="(singlets/triplets) for restricted calculation", &
     887             :                           usage="RES_ETYPE T", &
     888             :                           enum_c_vals=s2a("S", "SINGLET", "SINGLETS", "T", "TRIPLET", "TRIPLETS"), &
     889             :                           enum_i_vals=(/tddfpt_singlet, tddfpt_singlet, tddfpt_singlet, &
     890             :                                         tddfpt_triplet, tddfpt_triplet, tddfpt_triplet/), &
     891        8444 :                           default_i_val=tddfpt_singlet)
     892        8444 :       CALL section_add_keyword(section, keyword)
     893        8444 :       CALL keyword_release(keyword)
     894             : 
     895             :       CALL keyword_create(keyword, __LOCATION__, name="DIAG_METHOD", &
     896             :                           variants=s2a("DIAGONALIZATION_METHOD", "METHOD"), &
     897             :                           description="Diagonalization method used in tddfpt", &
     898             :                           usage="DIAG_METHOD DAVIDSON", &
     899             :                           enum_c_vals=s2a("DAVIDSON", "LANCZOS"), &
     900             :                           enum_i_vals=(/tddfpt_davidson, tddfpt_lanczos/), &
     901        8444 :                           default_i_val=tddfpt_davidson)
     902        8444 :       CALL section_add_keyword(section, keyword)
     903        8444 :       CALL keyword_release(keyword)
     904             : 
     905             :       CALL keyword_create(keyword, __LOCATION__, name="OE_CORR", &
     906             :                           variants=s2a("ORBITAL_EIGENVALUES_CORRECTION"), &
     907             :                           description="Which type of orbital eigenvalue correction to use "// &
     908             :                           "(to yield better HOMO-LUMO energies)", &
     909             :                           usage="OE_CORR SAOP", &
     910             :                           enum_c_vals=s2a("NONE", "LB", "LB_ALPHA", "LB94", "GLLB", "GLB", "SAOP", "SIC"), &
     911             :                           enum_i_vals=(/oe_none, oe_lb, oe_lb, oe_lb, oe_gllb, oe_gllb, oe_saop, oe_sic/), &
     912        8444 :                           default_i_val=oe_none)
     913        8444 :       CALL section_add_keyword(section, keyword)
     914        8444 :       CALL keyword_release(keyword)
     915             : 
     916             :       ! Real
     917             :       CALL keyword_create(keyword, __LOCATION__, name="CONVERGENCE", &
     918             :                           variants=s2a("CONV"), &
     919             :                           description="The convergence of the eigenvalues", &
     920             :                           usage="CONVERGENCE 1.0E-6 ", &
     921             :                           n_var=1, type_of_var=real_t, &
     922        8444 :                           default_r_val=1.0e-5_dp)
     923        8444 :       CALL section_add_keyword(section, keyword)
     924        8444 :       CALL keyword_release(keyword)
     925             : 
     926        8444 :       CALL create_xc_section(subsection)
     927        8444 :       CALL section_add_subsection(section, subsection)
     928        8444 :       CALL section_release(subsection)
     929             : 
     930        8444 :       CALL create_sic_section(subsection)
     931        8444 :       CALL section_add_subsection(section, subsection)
     932        8444 :       CALL section_release(subsection)
     933             : 
     934        8444 :    END SUBROUTINE create_tddfpt_section
     935             : 
     936             : ! **************************************************************************************************
     937             : !> \brief creates the input section for the relativistic part
     938             : !> \param section the section to create
     939             : !> \author jens
     940             : ! **************************************************************************************************
     941        8444 :    SUBROUTINE create_relativistic_section(section)
     942             :       TYPE(section_type), POINTER                        :: section
     943             : 
     944             :       TYPE(keyword_type), POINTER                        :: keyword
     945             : 
     946        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
     947             :       CALL section_create(section, __LOCATION__, name="relativistic", &
     948             :                           description="parameters needed and setup for relativistic calculations", &
     949        8444 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     950             : 
     951        8444 :       NULLIFY (keyword)
     952             : 
     953             :       CALL keyword_create(keyword, __LOCATION__, name="method", &
     954             :                           description="type of relativistic correction used", &
     955             :                           usage="method (NONE|DKH|ZORA)", default_i_val=rel_none, &
     956             :                           enum_c_vals=s2a("NONE", "DKH", "ZORA"), &
     957             :                           enum_i_vals=(/rel_none, rel_dkh, rel_zora/), &
     958             :                           enum_desc=s2a("Use no relativistic correction", &
     959             :                                         "Use Douglas-Kroll-Hess method", &
     960        8444 :                                         "Use ZORA method"))
     961        8444 :       CALL section_add_keyword(section, keyword)
     962        8444 :       CALL keyword_release(keyword)
     963             : 
     964             :       CALL keyword_create(keyword, __LOCATION__, name="DKH_order", &
     965             :                           description="The order of the DKH transformation ", &
     966        8444 :                           usage="DKH_order 2", default_i_val=2)
     967        8444 :       CALL section_add_keyword(section, keyword)
     968        8444 :       CALL keyword_release(keyword)
     969             : 
     970             :       CALL keyword_create(keyword, __LOCATION__, name="ZORA_type", &
     971             :                           description="Type of ZORA method to be used", &
     972             :                           usage="ZORA_type scMP", default_i_val=rel_zora_full, &
     973             :                           enum_c_vals=s2a("FULL", "MP", "scMP"), &
     974             :                           enum_desc=s2a("Full ZORA method (not implemented)", &
     975             :                                         "ZORA with atomic model potential", &
     976             :                                         "Scaled ZORA with atomic model potential"), &
     977        8444 :                           enum_i_vals=(/rel_zora_full, rel_zora_mp, rel_sczora_mp/))
     978        8444 :       CALL section_add_keyword(section, keyword)
     979        8444 :       CALL keyword_release(keyword)
     980             : 
     981             :       CALL keyword_create(keyword, __LOCATION__, name="transformation", &
     982             :                           description="Type of DKH transformation", &
     983             :                           usage="transformation (FULL|MOLECULE|ATOM)", default_i_val=rel_trans_atom, &
     984             :                           enum_c_vals=s2a("FULL", "MOLECULE", "ATOM"), &
     985             :                           enum_i_vals=(/rel_trans_full, rel_trans_molecule, rel_trans_atom/), &
     986             :                           enum_desc=s2a("Use full matrix transformation", &
     987             :                                         "Use transformation blocked by molecule", &
     988        8444 :                                         "Use atomic blocks"))
     989        8444 :       CALL section_add_keyword(section, keyword)
     990        8444 :       CALL keyword_release(keyword)
     991             : 
     992             :       CALL keyword_create(keyword, __LOCATION__, name="z_cutoff", &
     993             :                           description="The minimal atomic number considered for atom transformation", &
     994        8444 :                           usage="z_cutoff 50", default_i_val=1)
     995        8444 :       CALL section_add_keyword(section, keyword)
     996        8444 :       CALL keyword_release(keyword)
     997             : 
     998             :       CALL keyword_create(keyword, __LOCATION__, name="potential", &
     999             :                           description="External potential used in DKH transformation, full 1/r or erfc(r)/r", &
    1000             :                           usage="POTENTIAL {FULL,ERFC}", default_i_val=rel_pot_erfc, &
    1001             :                           enum_c_vals=s2a("FULL", "ERFC"), &
    1002        8444 :                           enum_i_vals=(/rel_pot_full, rel_pot_erfc/))
    1003        8444 :       CALL section_add_keyword(section, keyword)
    1004        8444 :       CALL keyword_release(keyword)
    1005             : 
    1006        8444 :    END SUBROUTINE create_relativistic_section
    1007             : 
    1008             : ! **************************************************************************************************
    1009             : !> \brief creates the KG section
    1010             : !> \param section ...
    1011             : !> \author Martin Haeufel [2012.07]
    1012             : ! **************************************************************************************************
    1013        8444 :    SUBROUTINE create_kg_section(section)
    1014             :       TYPE(section_type), POINTER                        :: section
    1015             : 
    1016             :       TYPE(keyword_type), POINTER                        :: keyword
    1017             :       TYPE(section_type), POINTER                        :: print_key, subsection
    1018             : 
    1019        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
    1020             :       CALL section_create(section, __LOCATION__, name="KG_METHOD", &
    1021             :                           description="Specifies the parameters for a Kim-Gordon-like partitioning"// &
    1022             :                           " into molecular subunits", &
    1023             :                           n_keywords=0, n_subsections=1, repeats=.FALSE., &
    1024       33776 :                           citations=(/Iannuzzi2006, Brelaz1979, Andermatt2016/))
    1025             : 
    1026        8444 :       NULLIFY (keyword, subsection, print_key)
    1027             : 
    1028             :       ! add a XC section
    1029        8444 :       CALL create_xc_section(subsection)
    1030        8444 :       CALL section_add_subsection(section, subsection)
    1031        8444 :       CALL section_release(subsection)
    1032             : 
    1033             :       ! add LRI section
    1034        8444 :       CALL create_lrigpw_section(subsection)
    1035        8444 :       CALL section_add_subsection(section, subsection)
    1036        8444 :       CALL section_release(subsection)
    1037             : 
    1038             :       CALL keyword_create(keyword, __LOCATION__, name="COLORING_METHOD", &
    1039             :                           description="Which algorithm to use for coloring.", &
    1040             :                           usage="COLORING_METHOD GREEDY", &
    1041             :                           default_i_val=kg_color_dsatur, &
    1042             :                           enum_c_vals=s2a("DSATUR", "GREEDY"), &
    1043             :                           enum_desc=s2a("Maximum degree of saturation, relatively accurate", &
    1044             :                                         "Greedy, fast coloring, less accurate"), &
    1045        8444 :                           enum_i_vals=(/kg_color_dsatur, kg_color_greedy/))
    1046        8444 :       CALL section_add_keyword(section, keyword)
    1047        8444 :       CALL keyword_release(keyword)
    1048             : 
    1049             :       CALL keyword_create(keyword, __LOCATION__, name="TNADD_METHOD", &
    1050             :                           description="Algorithm to use for the calculation of the nonadditive kinetic energy.", &
    1051             :                           usage="TNADD_METHOD ATOMIC", &
    1052             :                           default_i_val=kg_tnadd_embed, &
    1053             :                           enum_c_vals=s2a("EMBEDDING", "RI_EMBEDDING", "ATOMIC", "NONE"), &
    1054             :                           enum_desc=s2a("Use full embedding potential (see Iannuzzi et al)", &
    1055             :                                         "Use full embedding potential with RI density fitting", &
    1056             :                                         "Use sum of atomic model potentials", &
    1057             :                                         "Do not use kinetic energy embedding"), &
    1058        8444 :                           enum_i_vals=(/kg_tnadd_embed, kg_tnadd_embed_ri, kg_tnadd_atomic, kg_tnadd_none/))
    1059        8444 :       CALL section_add_keyword(section, keyword)
    1060        8444 :       CALL keyword_release(keyword)
    1061             : 
    1062             :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_GRID", &
    1063             :                           description="Grid [small,medium,large,huge]to be used for the TNADD integration.", &
    1064             :                           usage="INTEGRATION_GRID MEDIUM", &
    1065        8444 :                           default_c_val="MEDIUM")
    1066        8444 :       CALL section_add_keyword(section, keyword)
    1067        8444 :       CALL keyword_release(keyword)
    1068             : 
    1069             :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1070             :                           description="Print section", &
    1071        8444 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1072             : 
    1073             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "NEIGHBOR_LISTS", &
    1074             :                                        description="Controls the printing of the neighbor lists.", &
    1075        8444 :                                        print_level=low_print_level, filename="__STD_OUT__", unit_str="angstrom")
    1076             : 
    1077             :       CALL keyword_create(keyword, __LOCATION__, &
    1078             :                           name="SAB_ORB_FULL", &
    1079             :                           description="Activates the printing of the full orbital "// &
    1080             :                           "orbital neighbor lists.", &
    1081             :                           default_l_val=.FALSE., &
    1082        8444 :                           lone_keyword_l_val=.TRUE.)
    1083        8444 :       CALL section_add_keyword(print_key, keyword)
    1084        8444 :       CALL keyword_release(keyword)
    1085             : 
    1086             :       CALL keyword_create(keyword, __LOCATION__, &
    1087             :                           name="SAB_ORB_MOLECULAR", &
    1088             :                           description="Activates the printing of the orbital "// &
    1089             :                           "orbital neighbor lists for molecular subsets.", &
    1090             :                           default_l_val=.FALSE., &
    1091        8444 :                           lone_keyword_l_val=.TRUE.)
    1092        8444 :       CALL section_add_keyword(print_key, keyword)
    1093        8444 :       CALL keyword_release(keyword)
    1094             : 
    1095             :       CALL keyword_create(keyword, __LOCATION__, &
    1096             :                           name="SAC_KIN", &
    1097             :                           description="Activates the printing of the orbital "// &
    1098             :                           "atomic potential neighbor list.", &
    1099             :                           default_l_val=.FALSE., &
    1100        8444 :                           lone_keyword_l_val=.TRUE.)
    1101        8444 :       CALL section_add_keyword(print_key, keyword)
    1102        8444 :       CALL keyword_release(keyword)
    1103             : 
    1104        8444 :       CALL section_add_subsection(subsection, print_key)
    1105        8444 :       CALL section_release(print_key)
    1106             : 
    1107        8444 :       CALL section_add_subsection(section, subsection)
    1108        8444 :       CALL section_release(subsection)
    1109             : 
    1110        8444 :    END SUBROUTINE create_kg_section
    1111             : 
    1112             : ! **************************************************************************************************
    1113             : !> \brief Create the BSSE section for counterpoise correction
    1114             : !> \param section the section to create
    1115             : !> \author teo
    1116             : ! **************************************************************************************************
    1117        8428 :    SUBROUTINE create_bsse_section(section)
    1118             :       TYPE(section_type), POINTER                        :: section
    1119             : 
    1120             :       TYPE(keyword_type), POINTER                        :: keyword
    1121             :       TYPE(section_type), POINTER                        :: subsection
    1122             : 
    1123        8428 :       CPASSERT(.NOT. ASSOCIATED(section))
    1124             :       CALL section_create(section, __LOCATION__, name="BSSE", &
    1125             :                           description="This section is used to set up the BSSE calculation. "// &
    1126             :                           "It also requires that for each atomic kind X a kind X_ghost is present, "// &
    1127             :                           "with the GHOST keyword specified, in addition to the other required fields.", &
    1128        8428 :                           n_keywords=3, n_subsections=1, repeats=.FALSE.)
    1129             : 
    1130        8428 :       NULLIFY (keyword, subsection)
    1131             :       ! FRAGMENT SECTION
    1132             :       CALL section_create(subsection, __LOCATION__, name="FRAGMENT", &
    1133             :                           description="Specify the atom number belonging to this fragment.", &
    1134        8428 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    1135             : 
    1136             :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    1137             :                           description="Specifies a list of atoms.", &
    1138             :                           usage="LIST {integer} {integer} .. {integer}", &
    1139        8428 :                           repeats=.TRUE., n_var=-1, type_of_var=integer_t)
    1140        8428 :       CALL section_add_keyword(subsection, keyword)
    1141        8428 :       CALL keyword_release(keyword)
    1142             : 
    1143        8428 :       CALL section_add_subsection(section, subsection)
    1144        8428 :       CALL section_release(subsection)
    1145             : 
    1146             :       ! CONFIGURATION SECTION
    1147             :       CALL section_create(subsection, __LOCATION__, name="CONFIGURATION", &
    1148             :                           description="Specify additional parameters for the combinatorial configurations. "// &
    1149             :                           "Use this section to manually specify charge and multiplicity of the fragments "// &
    1150             :                           "and their combinations.", &
    1151        8428 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    1152             : 
    1153             :       CALL keyword_create(keyword, __LOCATION__, name="GLB_CONF", &
    1154             :                           description="Specifies the global configuration using 1 or 0 for each fragment. "// &
    1155             :                           "1 specifies the respective fragment as used, 0 as unused.", &
    1156             :                           usage="GLB_CONF {integer} {integer} .. {integer}", &
    1157        8428 :                           n_var=-1, type_of_var=integer_t)
    1158        8428 :       CALL section_add_keyword(subsection, keyword)
    1159        8428 :       CALL keyword_release(keyword)
    1160             : 
    1161             :       CALL keyword_create(keyword, __LOCATION__, name="SUB_CONF", &
    1162             :                           description="Specifies the subconfiguration using 1 or 0 belonging to the global configuration. "// &
    1163             :                           "1 specifies the respective fragment as real, 0 as ghost.", &
    1164             :                           usage="SUB_CONF {integer} {integer} .. {integer}", &
    1165        8428 :                           n_var=-1, type_of_var=integer_t)
    1166        8428 :       CALL section_add_keyword(subsection, keyword)
    1167        8428 :       CALL keyword_release(keyword)
    1168             : 
    1169             :       CALL keyword_create(keyword, __LOCATION__, &
    1170             :                           name="MULTIPLICITY", &
    1171             :                           variants=(/"MULTIP"/), &
    1172             :                           description="Specify for each fragment the multiplicity. Two times the total spin plus one. "// &
    1173             :                           "Specify 3 for a triplet, 4 for a quartet,and so on. Default is 1 (singlet) for an "// &
    1174             :                           "even number and 2 (doublet) for an odd number of electrons.", &
    1175             :                           usage="MULTIPLICITY 3", &
    1176       16856 :                           default_i_val=0) ! this default value is just a flag to get the above
    1177        8428 :       CALL section_add_keyword(subsection, keyword)
    1178        8428 :       CALL keyword_release(keyword)
    1179             : 
    1180             :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE", &
    1181             :                           description="The total charge for each fragment.", &
    1182             :                           usage="CHARGE -1", &
    1183        8428 :                           default_i_val=0)
    1184        8428 :       CALL section_add_keyword(subsection, keyword)
    1185        8428 :       CALL keyword_release(keyword)
    1186        8428 :       CALL section_add_subsection(section, subsection)
    1187        8428 :       CALL section_release(subsection)
    1188             : 
    1189             :       CALL section_create(subsection, __LOCATION__, name="FRAGMENT_ENERGIES", &
    1190             :                           description="This section contains the energies of the fragments already"// &
    1191             :                           " computed. It is useful as a summary and specifically for restarting BSSE runs.", &
    1192        8428 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    1193             :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1194             :                           description="The energy computed for each fragment", repeats=.TRUE., &
    1195        8428 :                           usage="{REAL}", type_of_var=real_t)
    1196        8428 :       CALL section_add_keyword(subsection, keyword)
    1197        8428 :       CALL keyword_release(keyword)
    1198        8428 :       CALL section_add_subsection(section, subsection)
    1199        8428 :       CALL section_release(subsection)
    1200             : 
    1201        8428 :       CALL create_print_bsse_section(subsection)
    1202        8428 :       CALL section_add_subsection(section, subsection)
    1203        8428 :       CALL section_release(subsection)
    1204             : 
    1205        8428 :    END SUBROUTINE create_bsse_section
    1206             : 
    1207             : ! **************************************************************************************************
    1208             : !> \brief Create the print bsse section
    1209             : !> \param section the section to create
    1210             : !> \author teo
    1211             : ! **************************************************************************************************
    1212        8428 :    SUBROUTINE create_print_bsse_section(section)
    1213             :       TYPE(section_type), POINTER                        :: section
    1214             : 
    1215             :       TYPE(section_type), POINTER                        :: print_key
    1216             : 
    1217        8428 :       CPASSERT(.NOT. ASSOCIATED(section))
    1218             :       CALL section_create(section, __LOCATION__, name="print", &
    1219             :                           description="Section of possible print options in BSSE code.", &
    1220        8428 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1221             : 
    1222        8428 :       NULLIFY (print_key)
    1223             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1224             :                                        description="Controls the printing of information regarding the run.", &
    1225        8428 :                                        print_level=low_print_level, filename="__STD_OUT__")
    1226        8428 :       CALL section_add_subsection(section, print_key)
    1227        8428 :       CALL section_release(print_key)
    1228             : 
    1229             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1230             :                                        description="Controls the dumping of the restart file during BSSE runs. "// &
    1231             :                                        "By default the restart is updated after each configuration calculation is "// &
    1232             :                                        "completed.", &
    1233             :                                        print_level=silent_print_level, common_iter_levels=0, &
    1234        8428 :                                        add_last=add_last_numeric, filename="")
    1235        8428 :       CALL section_add_subsection(section, print_key)
    1236        8428 :       CALL section_release(print_key)
    1237             : 
    1238        8428 :    END SUBROUTINE create_print_bsse_section
    1239             : 
    1240             : ! **************************************************************************************************
    1241             : !> \brief input section for optional parameters for RIGPW
    1242             : !> \param section the section to create
    1243             : !> \author JGH [06.2017]
    1244             : ! **************************************************************************************************
    1245           0 :    SUBROUTINE create_rigpw_section(section)
    1246             :       TYPE(section_type), POINTER                        :: section
    1247             : 
    1248           0 :       CPASSERT(.NOT. ASSOCIATED(section))
    1249             :       CALL section_create(section, __LOCATION__, name="RIGPW", &
    1250             :                           description="This section specifies optional parameters for RIGPW.", &
    1251           0 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    1252             : 
    1253             : !     CALL keyword_create(keyword, __LOCATION__, name="RI_OVERLAP_MATRIX", &
    1254             : !                         description="Specifies whether to calculate the inverse or the "// &
    1255             : !                         "pseudoinverse of the overlap matrix of the auxiliary "// &
    1256             : !                         "basis set. Calculating the pseudoinverse is necessary "// &
    1257             : !                         "for very large auxiliary basis sets, but more expensive. "// &
    1258             : !                         "Using the pseudoinverse, consistent forces are not "// &
    1259             : !                         "guaranteed yet.", &
    1260             : !                         usage="RI_OVERLAP_MATRIX INVERSE", &
    1261             : !                         enum_c_vals=s2a("INVERSE", "PSEUDO_INVERSE_SVD", "PSEUDO_INVERSE_DIAG", &
    1262             : !                                         "AUTOSELECT"), &
    1263             : !                         enum_desc=s2a("Calculate inverse of the overlap matrix.", &
    1264             : !                                       "Calculate the pseuodinverse of the overlap matrix "// &
    1265             : !                                       "using singular value decomposition.", &
    1266             : !                                       "Calculate the pseudoinverse of the overlap matrix "// &
    1267             : !                                       "by prior diagonalization.", &
    1268             : !                                       "Choose automatically for each pair whether to "// &
    1269             : !                                       "calculate the inverse or pseudoinverse based on the "// &
    1270             : !                                       "condition number of the overlap matrix for each pair. "// &
    1271             : !                                       "Calculating the pseudoinverse is much more expensive."), &
    1272             : !                         enum_i_vals=(/do_lri_inv, do_lri_pseudoinv_svd, &
    1273             : !                                       do_lri_pseudoinv_diag, do_lri_inv_auto/), &
    1274             : !                         default_i_val=do_lri_inv)
    1275             : !     CALL section_add_keyword(section, keyword)
    1276             : !     CALL keyword_release(keyword)
    1277             : 
    1278           0 :    END SUBROUTINE create_rigpw_section
    1279             : 
    1280             : ! **************************************************************************************************
    1281             : !> \brief creates the multigrid
    1282             : !> \param section             input section to create
    1283             : !> \param create_subsections  indicates whether or not subsections INTERPOLATOR and RS_GRID
    1284             : !>                            should be created
    1285             : !> \author fawzi
    1286             : ! **************************************************************************************************
    1287       16872 :    SUBROUTINE create_mgrid_section(section, create_subsections)
    1288             :       TYPE(section_type), POINTER                        :: section
    1289             :       LOGICAL, INTENT(in)                                :: create_subsections
    1290             : 
    1291             :       TYPE(keyword_type), POINTER                        :: keyword
    1292             :       TYPE(section_type), POINTER                        :: subsection
    1293             : 
    1294       16872 :       CPASSERT(.NOT. ASSOCIATED(section))
    1295             :       CALL section_create(section, __LOCATION__, name="mgrid", &
    1296             :                           description="multigrid information", &
    1297       16872 :                           n_keywords=5, n_subsections=1, repeats=.FALSE.)
    1298       16872 :       NULLIFY (keyword)
    1299             :       CALL keyword_create(keyword, __LOCATION__, name="NGRIDS", &
    1300             :                           description="The number of multigrids to use", &
    1301       16872 :                           usage="ngrids 1", default_i_val=4)
    1302       16872 :       CALL section_add_keyword(section, keyword)
    1303       16872 :       CALL keyword_release(keyword)
    1304             : 
    1305             :       CALL keyword_create(keyword, __LOCATION__, name="cutoff", &
    1306             :                           description="The cutoff of the finest grid level. Default value for "// &
    1307             :                           "SE or DFTB calculation is 1.0 [Ry].", &
    1308             :                           usage="cutoff 300", default_r_val=cp_unit_to_cp2k(value=280.0_dp, &
    1309       16872 :                                                                             unit_str="Ry"), n_var=1, unit_str="Ry")
    1310       16872 :       CALL section_add_keyword(section, keyword)
    1311       16872 :       CALL keyword_release(keyword)
    1312             : 
    1313             :       CALL keyword_create(keyword, __LOCATION__, name="progression_factor", &
    1314             :                           description="Factor used to find the cutoff of the multigrids that"// &
    1315             :                           " where not given explicitly", &
    1316       16872 :                           usage="progression_factor <integer>", default_r_val=3._dp)
    1317       16872 :       CALL section_add_keyword(section, keyword)
    1318       16872 :       CALL keyword_release(keyword)
    1319             : 
    1320             :       CALL keyword_create(keyword, __LOCATION__, name="commensurate", &
    1321             :                           description="If the grids should be commensurate. If true overrides "// &
    1322             :                           "the progression factor and the cutoffs of the sub grids", &
    1323             :                           usage="commensurate", default_l_val=.FALSE., &
    1324       16872 :                           lone_keyword_l_val=.TRUE.)
    1325       16872 :       CALL section_add_keyword(section, keyword)
    1326       16872 :       CALL keyword_release(keyword)
    1327             : 
    1328             :       CALL keyword_create(keyword, __LOCATION__, name="realspace", &
    1329             :                           description="If both rho and rho_gspace are needed ", &
    1330             :                           usage="realspace", default_l_val=.FALSE., &
    1331       16872 :                           lone_keyword_l_val=.TRUE.)
    1332       16872 :       CALL section_add_keyword(section, keyword)
    1333       16872 :       CALL keyword_release(keyword)
    1334             : 
    1335             :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
    1336             :                           variants=(/"RELATIVE_CUTOFF"/), &
    1337             :                           description="Determines the grid at which a Gaussian is mapped,"// &
    1338             :                           " giving the cutoff used for a gaussian with alpha=1."// &
    1339             :                           " A value 50+-10Ry might be required for highly accurate results,"// &
    1340             :                           " Or for simulations with a variable cell."// &
    1341             :                           " Versions prior to 2.3 used a default of 30Ry.", &
    1342             :                           usage="RELATIVE_CUTOFF real", default_r_val=20.0_dp, &
    1343       33744 :                           unit_str="Ry")
    1344       16872 :       CALL section_add_keyword(section, keyword)
    1345       16872 :       CALL keyword_release(keyword)
    1346             : 
    1347             :       CALL keyword_create(keyword, __LOCATION__, name="MULTIGRID_SET", &
    1348             :                           description="Activate a manual setting of the multigrids", &
    1349       16872 :                           usage="MULTIGRID_SET", default_l_val=.FALSE.)
    1350       16872 :       CALL section_add_keyword(section, keyword)
    1351       16872 :       CALL keyword_release(keyword)
    1352             : 
    1353             :       CALL keyword_create(keyword, __LOCATION__, &
    1354             :                           name="SKIP_LOAD_BALANCE_DISTRIBUTED", &
    1355             :                           description="Skips load balancing on distributed multigrids.  "// &
    1356             :                           "Memory usage is O(p) so may be used "// &
    1357             :                           "for all but the very largest runs.", &
    1358             :                           usage="SKIP_LOAD_BALANCE_DISTRIBUTED", &
    1359             :                           default_l_val=.FALSE., &
    1360       16872 :                           lone_keyword_l_val=.TRUE.)
    1361             : !    CALL keyword_create(keyword, __LOCATION__, name="SKIP_LOAD_BALANCE_DISTRIBUTED",&
    1362             : !         description="Skip load balancing on distributed multigrids, which might be memory intensive."//&
    1363             : !                     "If not explicitly specified, runs using more than 1024 MPI tasks will default to .TRUE.",&
    1364             : !         usage="SKIP_LOAD_BALANCE_DISTRIBUTED", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1365             : 
    1366       16872 :       CALL section_add_keyword(section, keyword)
    1367       16872 :       CALL keyword_release(keyword)
    1368             : 
    1369             :       CALL keyword_create(keyword, __LOCATION__, name="MULTIGRID_CUTOFF", &
    1370             :                           variants=(/"CUTOFF_LIST"/), &
    1371             :                           description="List of cutoff values to set up multigrids manually", &
    1372             :                           usage="MULTIGRID_CUTOFF 200.0 100.0 ", &
    1373             :                           n_var=-1, &
    1374             :                           type_of_var=real_t, &
    1375       33744 :                           unit_str="Ry")
    1376       16872 :       CALL section_add_keyword(section, keyword)
    1377       16872 :       CALL keyword_release(keyword)
    1378             : 
    1379       16872 :       IF (create_subsections) THEN
    1380        8444 :          NULLIFY (subsection)
    1381        8444 :          CALL create_rsgrid_section(subsection)
    1382        8444 :          CALL section_add_subsection(section, subsection)
    1383        8444 :          CALL section_release(subsection)
    1384             : 
    1385        8444 :          NULLIFY (subsection)
    1386        8444 :          CALL create_interp_section(subsection)
    1387        8444 :          CALL section_add_subsection(section, subsection)
    1388        8444 :          CALL section_release(subsection)
    1389             :       END IF
    1390       16872 :    END SUBROUTINE create_mgrid_section
    1391             : 
    1392             : ! **************************************************************************************************
    1393             : !> \brief creates the interpolation section
    1394             : !> \param section ...
    1395             : !> \author tlaino
    1396             : ! **************************************************************************************************
    1397       67440 :    SUBROUTINE create_interp_section(section)
    1398             :       TYPE(section_type), POINTER                        :: section
    1399             : 
    1400             :       TYPE(keyword_type), POINTER                        :: keyword
    1401             :       TYPE(section_type), POINTER                        :: print_key
    1402             : 
    1403       67440 :       CPASSERT(.NOT. ASSOCIATED(section))
    1404             :       CALL section_create(section, __LOCATION__, name="interpolator", &
    1405             :                           description="kind of interpolation used between the multigrids", &
    1406       67440 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    1407             : 
    1408       67440 :       NULLIFY (keyword, print_key)
    1409             : 
    1410             :       CALL keyword_create(keyword, __LOCATION__, name="kind", &
    1411             :                           description="the interpolator to use", &
    1412             :                           usage="kind spline3", &
    1413             :                           default_i_val=pw_interp, &
    1414             :                           enum_c_vals=s2a("pw", "spline3_nopbc", "spline3"), &
    1415             :                           enum_i_vals=(/pw_interp, &
    1416       67440 :                                         spline3_nopbc_interp, spline3_pbc_interp/))
    1417       67440 :       CALL section_add_keyword(section, keyword)
    1418       67440 :       CALL keyword_release(keyword)
    1419             : 
    1420             :       CALL keyword_create(keyword, __LOCATION__, name="safe_computation", &
    1421             :                           description="if a non unrolled calculation is to be performed in parallel", &
    1422             :                           usage="safe_computation OFF", &
    1423             :                           default_l_val=.FALSE., &
    1424       67440 :                           lone_keyword_l_val=.TRUE.)
    1425       67440 :       CALL section_add_keyword(section, keyword)
    1426       67440 :       CALL keyword_release(keyword)
    1427             : 
    1428             :       CALL keyword_create(keyword, __LOCATION__, name="aint_precond", &
    1429             :                           description="the approximate inverse to use to get the starting point"// &
    1430             :                           " for the linear solver of the spline3 methods", &
    1431             :                           usage="aint_precond copy", &
    1432             :                           default_i_val=precond_spl3_aint, &
    1433             :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_aint2", &
    1434             :                                           "spl3_nopbc_precond1", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    1435             :                           enum_i_vals=(/no_precond, precond_spl3_aint, precond_spl3_aint2, &
    1436       67440 :                                         precond_spl3_1, precond_spl3_2, precond_spl3_3/))
    1437       67440 :       CALL section_add_keyword(section, keyword)
    1438       67440 :       CALL keyword_release(keyword)
    1439             : 
    1440             :       CALL keyword_create(keyword, __LOCATION__, name="precond", &
    1441             :                           description="The preconditioner used"// &
    1442             :                           " for the linear solver of the spline3 methods", &
    1443             :                           usage="PRECOND copy", &
    1444             :                           default_i_val=precond_spl3_3, &
    1445             :                           enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_aint2", &
    1446             :                                           "spl3_nopbc_precond1", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
    1447             :                           enum_i_vals=(/no_precond, precond_spl3_aint, precond_spl3_aint2, &
    1448       67440 :                                         precond_spl3_1, precond_spl3_2, precond_spl3_3/))
    1449       67440 :       CALL section_add_keyword(section, keyword)
    1450       67440 :       CALL keyword_release(keyword)
    1451             : 
    1452             :       CALL keyword_create(keyword, __LOCATION__, name="eps_x", &
    1453             :                           description="accuracy on the solution for spline3 the interpolators", &
    1454       67440 :                           usage="eps_x 1.e-15", default_r_val=1.e-10_dp)
    1455       67440 :       CALL section_add_keyword(section, keyword)
    1456       67440 :       CALL keyword_release(keyword)
    1457             : 
    1458             :       CALL keyword_create(keyword, __LOCATION__, name="eps_r", &
    1459             :                           description="accuracy on the residual for spline3 the interpolators", &
    1460       67440 :                           usage="eps_r 1.e-15", default_r_val=1.e-10_dp)
    1461       67440 :       CALL section_add_keyword(section, keyword)
    1462       67440 :       CALL keyword_release(keyword)
    1463             : 
    1464             :       CALL keyword_create(keyword, __LOCATION__, name="max_iter", &
    1465             :                           variants=(/'maxiter'/), &
    1466             :                           description="the maximum number of iterations", &
    1467      134880 :                           usage="max_iter 200", default_i_val=100)
    1468       67440 :       CALL section_add_keyword(section, keyword)
    1469       67440 :       CALL keyword_release(keyword)
    1470             : 
    1471       67440 :       NULLIFY (print_key)
    1472             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "conv_info", &
    1473             :                                        description="if convergence information about the linear solver"// &
    1474             :                                        " of the spline methods should be printed", &
    1475             :                                        print_level=medium_print_level, each_iter_names=s2a("SPLINE_FIND_COEFFS"), &
    1476             :                                        each_iter_values=(/10/), filename="__STD_OUT__", &
    1477       67440 :                                        add_last=add_last_numeric)
    1478       67440 :       CALL section_add_subsection(section, print_key)
    1479       67440 :       CALL section_release(print_key)
    1480             : 
    1481       67440 :    END SUBROUTINE create_interp_section
    1482             : 
    1483             : ! **************************************************************************************************
    1484             : !> \brief creates the sic (self interaction correction) section
    1485             : !> \param section ...
    1486             : !> \author fawzi
    1487             : ! **************************************************************************************************
    1488       16888 :    SUBROUTINE create_sic_section(section)
    1489             :       TYPE(section_type), POINTER                        :: section
    1490             : 
    1491             :       TYPE(keyword_type), POINTER                        :: keyword
    1492             : 
    1493       16888 :       CPASSERT(.NOT. ASSOCIATED(section))
    1494             :       CALL section_create(section, __LOCATION__, name="sic", &
    1495             :                           description="parameters for the self interaction correction", &
    1496             :                           n_keywords=6, n_subsections=0, repeats=.FALSE., &
    1497       67552 :                           citations=(/VandeVondele2005b, Perdew1981, Avezac2005/))
    1498             : 
    1499       16888 :       NULLIFY (keyword)
    1500             : 
    1501             :       CALL keyword_create(keyword, __LOCATION__, name="SIC_SCALING_A", &
    1502             :                           description="Scaling of the coulomb term in sic [experimental]", &
    1503             :                           usage="SIC_SCALING_A 0.5", &
    1504             :                           citations=(/VandeVondele2005b/), &
    1505       33776 :                           default_r_val=1.0_dp)
    1506       16888 :       CALL section_add_keyword(section, keyword)
    1507       16888 :       CALL keyword_release(keyword)
    1508             : 
    1509             :       CALL keyword_create(keyword, __LOCATION__, name="SIC_SCALING_B", &
    1510             :                           description="Scaling of the xc term in sic [experimental]", &
    1511             :                           usage="SIC_SCALING_B 0.5", &
    1512             :                           citations=(/VandeVondele2005b/), &
    1513       33776 :                           default_r_val=1.0_dp)
    1514       16888 :       CALL section_add_keyword(section, keyword)
    1515       16888 :       CALL keyword_release(keyword)
    1516             : 
    1517             :       CALL keyword_create(keyword, __LOCATION__, name="SIC_METHOD", &
    1518             :                           description="Method used to remove the self interaction", &
    1519             :                           usage="SIC_METHOD MAURI_US", &
    1520             :                           default_i_val=sic_none, &
    1521             :                           enum_c_vals=s2a("NONE", "MAURI_US", "MAURI_SPZ", "AD", "EXPLICIT_ORBITALS"), &
    1522             :                           enum_i_vals=(/sic_none, sic_mauri_us, sic_mauri_spz, sic_ad, sic_eo/), &
    1523             :                           enum_desc=s2a("Do not apply a sic correction", &
    1524             :                                         "Employ a (scaled) correction proposed by Mauri and co-workers"// &
    1525             :                                         " on the spin density / doublet unpaired orbital", &
    1526             :                                         "Employ a (scaled) Perdew-Zunger expression"// &
    1527             :                                         " on the spin density / doublet unpaired orbital", &
    1528             :                                         "The average density correction", &
    1529             :                                         "(scaled) Perdew-Zunger correction explicitly on a set of orbitals."), &
    1530       67552 :                           citations=(/VandeVondele2005b, Perdew1981, Avezac2005/))
    1531       16888 :       CALL section_add_keyword(section, keyword)
    1532       16888 :       CALL keyword_release(keyword)
    1533             : 
    1534             :       CALL keyword_create(keyword, __LOCATION__, name="ORBITAL_SET", &
    1535             :                           description="Type of orbitals treated with the SIC", &
    1536             :                           usage="ORBITAL_SET ALL", &
    1537             :                           default_i_val=sic_list_unpaired, &
    1538             :                           enum_c_vals=s2a("UNPAIRED", "ALL"), &
    1539             :                           enum_desc=s2a("correction for the unpaired orbitals only, requires a restricted open shell calculation", &
    1540             :                                         "correction for all orbitals, requires a LSD or ROKS calculation"), &
    1541       16888 :                           enum_i_vals=(/sic_list_unpaired, sic_list_all/))
    1542       16888 :       CALL section_add_keyword(section, keyword)
    1543       16888 :       CALL keyword_release(keyword)
    1544             : 
    1545       16888 :    END SUBROUTINE create_sic_section
    1546             : 
    1547             : ! **************************************************************************************************
    1548             : !> \brief creates the low spin roks section
    1549             : !> \param section ...
    1550             : !> \author Joost VandeVondele
    1551             : ! **************************************************************************************************
    1552        8444 :    SUBROUTINE create_low_spin_roks_section(section)
    1553             :       TYPE(section_type), POINTER                        :: section
    1554             : 
    1555             :       TYPE(keyword_type), POINTER                        :: keyword
    1556             : 
    1557        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
    1558             :       CALL section_create(section, __LOCATION__, name="LOW_SPIN_ROKS", &
    1559             :                           description="Specify the details of the low spin ROKS method. "// &
    1560             :                           "In particular, one can specify various terms added to the energy of the high spin roks configuration"// &
    1561             :                           " with a energy scaling factor, and a prescription of the spin state.", &
    1562        8444 :                           n_keywords=6, n_subsections=0, repeats=.FALSE.)
    1563             : 
    1564        8444 :       NULLIFY (keyword)
    1565             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_SCALING", &
    1566             :                           description="The scaling factors for each term added to the total energy. "// &
    1567             :                           "This list should contain one number for each term added to the total energy.", &
    1568             :                           usage="ENERGY_SCALING 1.0 -1.0 ", &
    1569        8444 :                           n_var=-1, type_of_var=real_t, repeats=.FALSE.)
    1570        8444 :       CALL section_add_keyword(section, keyword)
    1571        8444 :       CALL keyword_release(keyword)
    1572             :       CALL keyword_create( &
    1573             :          keyword, __LOCATION__, name="SPIN_CONFIGURATION", &
    1574             :          description="For each singly occupied orbital, specify if this should be an alpha (=1) or a beta (=2) orbital. "// &
    1575             :          "This keyword should be repeated, each repetition corresponding to an additional term.", &
    1576             :          usage="SPIN_CONFIGURATION 1 2", &
    1577        8444 :          n_var=-1, type_of_var=integer_t, repeats=.TRUE.)
    1578        8444 :       CALL section_add_keyword(section, keyword)
    1579        8444 :       CALL keyword_release(keyword)
    1580             : 
    1581        8444 :    END SUBROUTINE create_low_spin_roks_section
    1582             : 
    1583             : ! **************************************************************************************************
    1584             : !> \brief ...
    1585             : !> \param section ...
    1586             : ! **************************************************************************************************
    1587        8444 :    SUBROUTINE create_rtp_section(section)
    1588             :       TYPE(section_type), POINTER                        :: section
    1589             : 
    1590             :       TYPE(keyword_type), POINTER                        :: keyword
    1591             :       TYPE(section_type), POINTER                        :: print_key, print_section
    1592             : 
    1593        8444 :       NULLIFY (keyword)
    1594        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
    1595             :       CALL section_create(section, __LOCATION__, name="REAL_TIME_PROPAGATION", &
    1596             :                           description="Parameters needed to set up the real time propagation"// &
    1597             :                           " for the electron dynamics. This currently works only in the NVE ensemble.", &
    1598             :                           n_keywords=4, n_subsections=4, repeats=.FALSE., &
    1599       25332 :                           citations=(/Kunert2003, Andermatt2016/))
    1600             : 
    1601             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    1602             :                           description="Maximal number of iterations for the self consistent propagator loop.", &
    1603             :                           usage="MAX_ITER 10", &
    1604        8444 :                           default_i_val=10)
    1605        8444 :       CALL section_add_keyword(section, keyword)
    1606        8444 :       CALL keyword_release(keyword)
    1607             : 
    1608             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
    1609             :                           description="Convergence criterion for the self consistent propagator loop.", &
    1610             :                           usage="EPS_ITER 1.0E-5", &
    1611        8444 :                           default_r_val=1.0E-7_dp)
    1612        8444 :       CALL section_add_keyword(section, keyword)
    1613        8444 :       CALL keyword_release(keyword)
    1614             : 
    1615             :       CALL keyword_create(keyword, __LOCATION__, name="ASPC_ORDER", &
    1616             :                           description="Speciefies how many steps will be used for extrapolation. "// &
    1617             :                           "One will be always used which is means X(t+dt)=X(t)", &
    1618             :                           usage="ASPC_ORDER 3", &
    1619        8444 :                           default_i_val=3)
    1620        8444 :       CALL section_add_keyword(section, keyword)
    1621        8444 :       CALL keyword_release(keyword)
    1622             : 
    1623             :       CALL keyword_create(keyword, __LOCATION__, name="MAT_EXP", &
    1624             :                           description="Which method should be used to calculate the exponential"// &
    1625             :                           " in the propagator. It is recommended to use BCH when employing density_propagation "// &
    1626             :                           "and ARNOLDI otherwise.", &
    1627             :                           usage="MAT_EXP TAYLOR", default_i_val=do_arnoldi, &
    1628             :                           enum_c_vals=s2a("TAYLOR", "PADE", "ARNOLDI", "BCH"), &
    1629             :                           enum_i_vals=(/do_taylor, do_pade, do_arnoldi, do_bch/), &
    1630             :                           enum_desc=s2a("exponential is evaluated using scaling and squaring in combination"// &
    1631             :                                         " with a taylor expansion of the exponential.", &
    1632             :                                         "uses scaling and squaring together with the pade approximation", &
    1633             :                                         "uses arnoldi subspace algorithm to compute exp(H)*MO directly, can't be used in "// &
    1634             :                                         "combination with Crank Nicholson or density propagation", &
    1635             :                                         "Uses a Baker-Campbell-Hausdorff expansion to propagate the density matrix,"// &
    1636        8444 :                                         " only works for density propagation"))
    1637        8444 :       CALL section_add_keyword(section, keyword)
    1638        8444 :       CALL keyword_release(keyword)
    1639             : 
    1640             :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY_PROPAGATION", &
    1641             :                           description="The density matrix is propagated instead of the molecular orbitals. "// &
    1642             :                           "This can allow a linear scaling simulation. The density matrix is filtered with "// &
    1643             :                           "the threshold based on the EPS_FILTER keyword from the LS_SCF section", &
    1644             :                           usage="DENSITY_PROPAGATION .TRUE.", &
    1645        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1646        8444 :       CALL section_add_keyword(section, keyword)
    1647        8444 :       CALL keyword_release(keyword)
    1648             : 
    1649             :       CALL keyword_create(keyword, __LOCATION__, name="SC_CHECK_START", &
    1650             :                           description="Speciefies how many iteration steps will be done without "// &
    1651             :                           "a check for self consistency. Can save some time in big calculations.", &
    1652             :                           usage="SC_CHECK_START 3", &
    1653        8444 :                           default_i_val=0)
    1654        8444 :       CALL section_add_keyword(section, keyword)
    1655        8444 :       CALL keyword_release(keyword)
    1656             : 
    1657             :       CALL keyword_create(keyword, __LOCATION__, name="EXP_ACCURACY", &
    1658             :                           description="Accuracy for the taylor and pade approximation. "// &
    1659             :                           "This is only an upper bound bound since the norm used for the guess "// &
    1660             :                           "is an upper bound for the needed one.", &
    1661             :                           usage="EXP_ACCURACY 1.0E-6", &
    1662        8444 :                           default_r_val=1.0E-9_dp)
    1663        8444 :       CALL section_add_keyword(section, keyword)
    1664        8444 :       CALL keyword_release(keyword)
    1665             : 
    1666             :       CALL keyword_create(keyword, __LOCATION__, name="PROPAGATOR", &
    1667             :                           description="Which propagator should be used for the orbitals", &
    1668             :                           usage="PROPAGATOR ETRS", default_i_val=do_etrs, &
    1669             :                           enum_c_vals=s2a("ETRS", "CN", "EM"), &
    1670             :                           enum_i_vals=(/do_etrs, do_cn, do_em/), &
    1671             :                           enum_desc=s2a("enforced time reversible symmetry", &
    1672             :                                         "Crank Nicholson propagator", &
    1673        8444 :                                         "Exponential midpoint propagator"))
    1674        8444 :       CALL section_add_keyword(section, keyword)
    1675        8444 :       CALL keyword_release(keyword)
    1676             : 
    1677             :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_WFN", &
    1678             :                           description="Controls the initial WFN used for propagation. "// &
    1679             :                           "Note that some energy contributions may not be "// &
    1680             :                           "initialized in the restart cases, for instance "// &
    1681             :                           "electronic entropy energy in the case of smearing.", &
    1682             :                           usage="INITIAL_WFN SCF_WFN", default_i_val=use_scf_wfn, &
    1683             :                           enum_c_vals=s2a("SCF_WFN", "RESTART_WFN", "RT_RESTART"), &
    1684             :                           enum_i_vals=(/use_scf_wfn, use_restart_wfn, use_rt_restart/), &
    1685             :                           enum_desc=s2a("An SCF run is performed to get the initial state.", &
    1686             :                                         "A wavefunction from a previous SCF is propagated. Especially useful,"// &
    1687             :                                         " if electronic constraints or restraints are used in the previous calculation, "// &
    1688             :                                         "since these do not work in the rtp scheme.", &
    1689        8444 :                                         "use the wavefunction of a real time propagation/ehrenfest run"))
    1690        8444 :       CALL section_add_keyword(section, keyword)
    1691        8444 :       CALL keyword_release(keyword)
    1692             : 
    1693             :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_WFN_MIX_INIT_RESTART", &
    1694             :                           description="If set to True and in the case of INITIAL_WFN=RESTART_WFN, call the "// &
    1695             :                           "DFT%PRINT%WFN_MIX section to mix the read initial wfn. The starting wave-function of the "// &
    1696             :                           "RTP will be the mixed one. Setting this to True without a defined WFN_MIX section will "// &
    1697             :                           "not do anything as defining a WFN_MIX section without this keyword for RTP run with "// &
    1698             :                           "INITIAL_WFN=RESTART_WFN. Note that if INITIAL_WFN=SCF_WFN, this keyword is not needed to "// &
    1699             :                           "apply the mixing defined in the WFN_MIX section. Default is False.", &
    1700             :                           usage="APPLY_WFN_MIX_INIT_RESTART", &
    1701        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1702        8444 :       CALL section_add_keyword(section, keyword)
    1703        8444 :       CALL keyword_release(keyword)
    1704             : 
    1705             :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_DELTA_PULSE", &
    1706             :                           description="Applies a delta kick to the initial wfn (only RTP for now - the EMD"// &
    1707             :                           " case is not yet implemented). Only work for INITIAL_WFN=SCF_WFN", &
    1708             :                           usage="APPLY_DELTA_PULSE", &
    1709        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1710        8444 :       CALL section_add_keyword(section, keyword)
    1711        8444 :       CALL keyword_release(keyword)
    1712             : 
    1713             :       CALL keyword_create(keyword, __LOCATION__, name="APPLY_DELTA_PULSE_MAG", &
    1714             :                           description="Applies a magnetic delta kick to the initial wfn (only RTP for now - the EMD"// &
    1715             :                           " case is not yet implemented). Only work for INITIAL_WFN=SCF_WFN", &
    1716             :                           usage="APPLY_DELTA_PULSE_MAG", &
    1717        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1718        8444 :       CALL section_add_keyword(section, keyword)
    1719        8444 :       CALL keyword_release(keyword)
    1720             : 
    1721             :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_GAUGE", &
    1722             :                           description="Perform propagation in the velocity gauge using the explicit vector potential"// &
    1723             :                           " only a constant vector potential as of now (corresonding to a delta-pulse)."// &
    1724             :                           " uses DELTA_PULSE_SCALE and DELTA_PULSE_DIRECTION to define the vector potential", &
    1725             :                           usage="VELOCITY_GAUGE T", &
    1726        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1727        8444 :       CALL section_add_keyword(section, keyword)
    1728        8444 :       CALL keyword_release(keyword)
    1729             : 
    1730             :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ORIG", &
    1731             :                           description="Define gauge origin for magnetic perturbation", &
    1732             :                           usage="GAUGE_ORIG COM", &
    1733             :                           enum_c_vals=s2a("COM", "COAC", "USER_DEFINED", "ZERO"), &
    1734             :                           enum_desc=s2a("Use Center of Mass", &
    1735             :                                         "Use Center of Atomic Charges", &
    1736             :                                         "Use User Defined Point (Keyword:REF_POINT)", &
    1737             :                                         "Use Origin of Coordinate System"), &
    1738             :                           enum_i_vals=(/use_mom_ref_com, &
    1739             :                                         use_mom_ref_coac, &
    1740             :                                         use_mom_ref_user, &
    1741             :                                         use_mom_ref_zero/), &
    1742        8444 :                           default_i_val=use_mom_ref_com)
    1743        8444 :       CALL section_add_keyword(section, keyword)
    1744        8444 :       CALL keyword_release(keyword)
    1745             : 
    1746             :       CALL keyword_create(keyword, __LOCATION__, name="GAUGE_ORIG_MANUAL", &
    1747             :                           description="Manually defined gauge origin for magnetic perturbation [in Bohr!]", &
    1748             :                           usage="GAUGE_ORIG_MANUAL x y z", &
    1749             :                           repeats=.FALSE., &
    1750             :                           n_var=3, default_r_vals=(/0._dp, 0._dp, 0._dp/), &
    1751             :                           type_of_var=real_t, &
    1752        8444 :                           unit_str='bohr')
    1753        8444 :       CALL section_add_keyword(section, keyword)
    1754        8444 :       CALL keyword_release(keyword)
    1755             : 
    1756             :       CALL keyword_create(keyword, __LOCATION__, name="VG_COM_NL", &
    1757             :                           description="apply gauge transformed non-local potential term"// &
    1758             :                           " only affects VELOCITY_GAUGE=.TRUE.", &
    1759             :                           usage="VG_COM_NL T", &
    1760        8444 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1761        8444 :       CALL section_add_keyword(section, keyword)
    1762        8444 :       CALL keyword_release(keyword)
    1763             : 
    1764             :       CALL keyword_create(keyword, __LOCATION__, name="COM_NL", &
    1765             :                           description="Include non-local commutator for periodic delta pulse."// &
    1766             :                           " only affects PERIODIC=.TRUE.", &
    1767             :                           usage="COM_NL", &
    1768        8444 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1769        8444 :       CALL section_add_keyword(section, keyword)
    1770        8444 :       CALL keyword_release(keyword)
    1771             : 
    1772             :       CALL keyword_create(keyword, __LOCATION__, name="LEN_REP", &
    1773             :                           description="Use length representation delta pulse (in conjunction with PERIODIC T)."// &
    1774             :                           " This corresponds to a 1st order perturbation in the length gauge."// &
    1775             :                           " Note that this is NOT compatible with a periodic calculation!"// &
    1776             :                           " Uses the reference point defined in DFT%PRINT%MOMENTS ", &
    1777             :                           usage="LEN_REP T", &
    1778        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1779        8444 :       CALL section_add_keyword(section, keyword)
    1780        8444 :       CALL keyword_release(keyword)
    1781             : 
    1782             :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    1783             :                           description="Apply a delta-kick that is compatible with periodic boundary conditions"// &
    1784             :                           " for any value of DELTA_PULSE_SCALE. Uses perturbation theory for the preparation of"// &
    1785             :                           " the initial wfn with the velocity operator as perturbation."// &
    1786             :                           " If LEN_REP is .FALSE. this corresponds to a first order velocity gauge."// &
    1787             :                           " Note that the pulse is only applied when INITIAL_WFN is set to SCF_WFN,"// &
    1788             :                           " and not for restarts (RT_RESTART).", &
    1789             :                           usage="PERIODIC", &
    1790        8444 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1791        8444 :       CALL section_add_keyword(section, keyword)
    1792        8444 :       CALL keyword_release(keyword)
    1793             : 
    1794             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_PULSE_DIRECTION", &
    1795             :                           description="Direction of the applied electric field. The k vector is given as"// &
    1796             :                           " 2*Pi*[i,j,k]*inv(h_mat), which for PERIODIC .FALSE. yields exp(ikr) periodic with"// &
    1797             :                           " the unit cell, only if DELTA_PULSE_SCALE is set to unity. For an orthorhombic cell"// &
    1798             :                           " [1,0,0] yields [2*Pi/L_x,0,0]. For small cells, this results in a very large kick.", &
    1799             :                           usage="DELTA_PULSE_DIRECTION 1 1 1", n_var=3, default_i_vals=(/1, 0, 0/), &
    1800        8444 :                           type_of_var=integer_t)
    1801        8444 :       CALL section_add_keyword(section, keyword)
    1802        8444 :       CALL keyword_release(keyword)
    1803             : 
    1804             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_PULSE_SCALE", &
    1805             :                           description="Scale the k vector, which for PERIODIC .FALSE. results in exp(ikr) no"// &
    1806             :                           " longer being periodic with the unit cell. The norm of k is the strength of the"// &
    1807             :                           " applied electric field in atomic units.", &
    1808        8444 :                           usage="DELTA_PULSE_SCALE 0.01 ", n_var=1, default_r_val=0.001_dp)
    1809        8444 :       CALL section_add_keyword(section, keyword)
    1810        8444 :       CALL keyword_release(keyword)
    1811             : 
    1812             :       CALL keyword_create(keyword, __LOCATION__, name="HFX_BALANCE_IN_CORE", &
    1813             :                           description="If HFX is used, this keyword forces a redistribution/recalculation"// &
    1814             :                           " of the integrals, balanced with respect to the in core steps.", &
    1815             :                           usage="HFX_BALANCE_IN_CORE", &
    1816        8444 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1817        8444 :       CALL section_add_keyword(section, keyword)
    1818        8444 :       CALL keyword_release(keyword)
    1819             : 
    1820             :       CALL keyword_create(keyword, __LOCATION__, name="MCWEENY_MAX_ITER", &
    1821             :                           description="Determines the maximum amount of McWeeny steps used after each converged"// &
    1822             :                           " step in density propagation", &
    1823        8444 :                           usage="MCWEENY_MAX_ITER 2", default_i_val=1)
    1824        8444 :       CALL section_add_keyword(section, keyword)
    1825        8444 :       CALL keyword_release(keyword)
    1826             : 
    1827             :       CALL keyword_create( &
    1828             :          keyword, __LOCATION__, name="ACCURACY_REFINEMENT", &
    1829             :          description="If using density propagation some parts should be calculated with a higher accuracy than the rest"// &
    1830             :          " to reduce numerical noise. This factor determines by how much the filtering threshold is"// &
    1831             :          " reduced for these calculations.", &
    1832        8444 :          usage="ACCURACY_REFINEMENT", default_i_val=100)
    1833        8444 :       CALL section_add_keyword(section, keyword)
    1834        8444 :       CALL keyword_release(keyword)
    1835             : 
    1836             :       CALL keyword_create(keyword, __LOCATION__, name="MCWEENY_EPS", &
    1837             :                           description="Threshold after which McWeeny is terminated", &
    1838             :                           usage="MCWEENY_EPS 0.00001", &
    1839        8444 :                           default_r_val=0.0_dp)
    1840        8444 :       CALL section_add_keyword(section, keyword)
    1841        8444 :       CALL keyword_release(keyword)
    1842             : 
    1843        8444 :       NULLIFY (print_section)
    1844             :       CALL section_create(print_section, __LOCATION__, name="PRINT", &
    1845             :                           description="Section of possible print options for an RTP runs", &
    1846        8444 :                           repeats=.FALSE.)
    1847             : 
    1848        8444 :       NULLIFY (print_key)
    1849             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1850             :                                        description="Controls the printing within real time propagation and Eherenfest dynamics", &
    1851        8444 :                                        print_level=low_print_level, filename="__STD_OUT__")
    1852        8444 :       CALL section_add_subsection(print_section, print_key)
    1853        8444 :       CALL section_release(print_key)
    1854             : 
    1855             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1856             :                                        description="Controls the dumping of the MO restart file during rtp. "// &
    1857             :                                        "By default keeps a short history of three restarts. "// &
    1858             :                                        "See also RESTART_HISTORY. In density propagation this controls the printing of P.", &
    1859             :                                        print_level=low_print_level, common_iter_levels=3, &
    1860             :                                        each_iter_names=s2a("MD"), each_iter_values=(/20/), &
    1861        8444 :                                        add_last=add_last_numeric, filename="RESTART")
    1862             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    1863             :                           description="Specifies the maximum number of backup copies.", &
    1864             :                           usage="BACKUP_COPIES {int}", &
    1865        8444 :                           default_i_val=1)
    1866        8444 :       CALL section_add_keyword(print_key, keyword)
    1867        8444 :       CALL keyword_release(keyword)
    1868        8444 :       CALL section_add_subsection(print_section, print_key)
    1869        8444 :       CALL section_release(print_key)
    1870             : 
    1871             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART_HISTORY", &
    1872             :                                        description="Dumps unique MO restart files during the run keeping all of them. "// &
    1873             :                                        "In density propagation it dumps the density matrix instead", &
    1874             :                                        print_level=low_print_level, common_iter_levels=0, &
    1875             :                                        each_iter_names=s2a("MD"), &
    1876             :                                        each_iter_values=(/500/), &
    1877        8444 :                                        filename="RESTART")
    1878             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    1879             :                           description="Specifies the maximum number of backup copies.", &
    1880             :                           usage="BACKUP_COPIES {int}", &
    1881        8444 :                           default_i_val=1)
    1882        8444 :       CALL section_add_keyword(print_key, keyword)
    1883        8444 :       CALL keyword_release(keyword)
    1884        8444 :       CALL section_add_subsection(print_section, print_key)
    1885        8444 :       CALL section_release(print_key)
    1886             : 
    1887             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FIELD", &
    1888             :                                        description="Print the time-dependent field applied during an EMD simulation in "// &
    1889             :                                        "atomic unit.", &
    1890             :                                        print_level=high_print_level, common_iter_levels=-1, &
    1891             :                                        each_iter_names=s2a("MD"), &
    1892             :                                        each_iter_values=(/1/), &
    1893        8444 :                                        filename="applied_field")
    1894        8444 :       CALL section_add_subsection(print_section, print_key)
    1895        8444 :       CALL section_release(print_key)
    1896             : 
    1897        8444 :       CALL create_projection_rtp_section(print_key)
    1898        8444 :       CALL section_add_subsection(print_section, print_key)
    1899        8444 :       CALL section_release(print_key)
    1900             : 
    1901             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CURRENT", &
    1902             :                                        description="Print the current during an EMD simulation to cube files.", &
    1903             :                                        print_level=high_print_level, common_iter_levels=0, &
    1904             :                                        each_iter_names=s2a("MD"), &
    1905             :                                        each_iter_values=(/20/), &
    1906        8444 :                                        filename="current")
    1907             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    1908             :                           description="Specifies the maximum number of backup copies.", &
    1909             :                           usage="BACKUP_COPIES {int}", &
    1910        8444 :                           default_i_val=1)
    1911        8444 :       CALL section_add_keyword(print_key, keyword)
    1912        8444 :       CALL keyword_release(keyword)
    1913             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    1914             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1915             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1916             :                           " 1 number valid for all components.", &
    1917        8444 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1918        8444 :       CALL section_add_keyword(print_key, keyword)
    1919        8444 :       CALL keyword_release(keyword)
    1920             : 
    1921        8444 :       CALL section_add_subsection(print_section, print_key)
    1922        8444 :       CALL section_release(print_key)
    1923             : 
    1924             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "E_CONSTITUENTS", &
    1925             :                                        description="Print the energy constituents (relevant to RTP) which make up "// &
    1926             :                                        "the Total Energy", &
    1927             :                                        print_level=high_print_level, common_iter_levels=1, &
    1928             :                                        each_iter_names=s2a("MD"), &
    1929             :                                        each_iter_values=(/1/), &
    1930        8444 :                                        filename="rtp")
    1931        8444 :       CALL section_add_subsection(print_section, print_key)
    1932        8444 :       CALL section_release(print_key)
    1933             : 
    1934        8444 :       CALL section_add_subsection(section, print_section)
    1935        8444 :       CALL section_release(print_section)
    1936             : 
    1937        8444 :    END SUBROUTINE create_rtp_section
    1938             : 
    1939             : ! **************************************************************************************************
    1940             : !> \brief      Create CP2K input section for the SCCS model
    1941             : !> \param section ...
    1942             : !> \par History:
    1943             : !>      - Creation (10.10.2013,MK)
    1944             : !> \author     Matthias Krack (MK)
    1945             : !> \version    1.0
    1946             : ! **************************************************************************************************
    1947        8444 :    SUBROUTINE create_sccs_section(section)
    1948             : 
    1949             :       TYPE(section_type), POINTER                        :: section
    1950             : 
    1951             :       TYPE(keyword_type), POINTER                        :: keyword
    1952             :       TYPE(section_type), POINTER                        :: subsection
    1953             : 
    1954        8444 :       CPASSERT(.NOT. ASSOCIATED(section))
    1955             : 
    1956             :       CALL section_create(section, __LOCATION__, &
    1957             :                           name="SCCS", &
    1958             :                           description="Define the parameters for self-consistent continuum solvation (SCCS) model", &
    1959             :                           citations=(/Fattebert2002, Andreussi2012, Yin2017/), &
    1960             :                           n_keywords=8, &
    1961             :                           n_subsections=2, &
    1962       33776 :                           repeats=.FALSE.)
    1963             : 
    1964        8444 :       NULLIFY (keyword)
    1965             : 
    1966             :       CALL keyword_create(keyword, __LOCATION__, &
    1967             :                           name="_SECTION_PARAMETERS_", &
    1968             :                           description="Controls the activation of the SCCS section", &
    1969             :                           usage="&SCCS ON", &
    1970             :                           default_l_val=.FALSE., &
    1971        8444 :                           lone_keyword_l_val=.TRUE.)
    1972        8444 :       CALL section_add_keyword(section, keyword)
    1973        8444 :       CALL keyword_release(keyword)
    1974             : 
    1975             :       CALL keyword_create(keyword, __LOCATION__, &
    1976             :                           name="ALPHA", &
    1977             :                           description="Solvent specific tunable parameter for the calculation of "// &
    1978             :                           "the repulsion term $G^\text{rep} = \alpha S$ "// &
    1979             :                           "where $S$ is the (quantum) surface of the cavity", &
    1980             :                           repeats=.FALSE., &
    1981             :                           n_var=1, &
    1982             :                           type_of_var=real_t, &
    1983             :                           default_r_val=0.0_dp, &
    1984        8444 :                           unit_str="mN/m")
    1985        8444 :       CALL section_add_keyword(section, keyword)
    1986        8444 :       CALL keyword_release(keyword)
    1987             : 
    1988             :       CALL keyword_create(keyword, __LOCATION__, &
    1989             :                           name="BETA", &
    1990             :                           description="Solvent specific tunable parameter for the calculation of "// &
    1991             :                           "the dispersion term $G^\text{dis} = \beta V$ "// &
    1992             :                           "where $V$ is the (quantum) volume of the cavity", &
    1993             :                           repeats=.FALSE., &
    1994             :                           n_var=1, &
    1995             :                           type_of_var=real_t, &
    1996             :                           default_r_val=0.0_dp, &
    1997        8444 :                           unit_str="GPa")
    1998        8444 :       CALL section_add_keyword(section, keyword)
    1999        8444 :       CALL keyword_release(keyword)
    2000             : 
    2001             :       CALL keyword_create(keyword, __LOCATION__, &
    2002             :                           name="DELTA_RHO", &
    2003             :                           description="Numerical increment for the calculation of the (quantum) "// &
    2004             :                           "surface of the solute cavity", &
    2005             :                           repeats=.FALSE., &
    2006             :                           n_var=1, &
    2007             :                           type_of_var=real_t, &
    2008        8444 :                           default_r_val=2.0E-5_dp)
    2009        8444 :       CALL section_add_keyword(section, keyword)
    2010        8444 :       CALL keyword_release(keyword)
    2011             : 
    2012             :       CALL keyword_create(keyword, __LOCATION__, &
    2013             :                           name="DERIVATIVE_METHOD", &
    2014             :                           description="Method for the calculation of the numerical derivatives on the real-space grids", &
    2015             :                           usage="DERIVATIVE_METHOD cd5", &
    2016             :                           repeats=.FALSE., &
    2017             :                           n_var=1, &
    2018             :                           default_i_val=sccs_derivative_fft, &
    2019             :                           enum_c_vals=s2a("FFT", "CD3", "CD5", "CD7"), &
    2020             :                           enum_i_vals=(/sccs_derivative_fft, &
    2021             :                                         sccs_derivative_cd3, &
    2022             :                                         sccs_derivative_cd5, &
    2023             :                                         sccs_derivative_cd7/), &
    2024             :                           enum_desc=s2a("Fast Fourier transformation", &
    2025             :                                         "3-point stencil central differences", &
    2026             :                                         "5-point stencil central differences", &
    2027        8444 :                                         "7-point stencil central differences"))
    2028        8444 :       CALL section_add_keyword(section, keyword)
    2029        8444 :       CALL keyword_release(keyword)
    2030             : 
    2031             :       CALL keyword_create(keyword, __LOCATION__, &
    2032             :                           name="RELATIVE_PERMITTIVITY", &
    2033             :                           variants=s2a("DIELECTRIC_CONSTANT", "EPSILON_RELATIVE", "EPSILON_SOLVENT"), &
    2034             :                           description="Relative permittivity (dielectric constant) of the solvent (medium)", &
    2035             :                           repeats=.FALSE., &
    2036             :                           n_var=1, &
    2037             :                           type_of_var=real_t, &
    2038             :                           default_r_val=80.0_dp, &
    2039        8444 :                           usage="RELATIVE_PERMITTIVITY 78.36")
    2040        8444 :       CALL section_add_keyword(section, keyword)
    2041        8444 :       CALL keyword_release(keyword)
    2042             : 
    2043             :       CALL keyword_create(keyword, __LOCATION__, &
    2044             :                           name="EPS_SCCS", &
    2045             :                           variants=s2a("EPS_ITER", "TAU_POL"), &
    2046             :                           description="Tolerance for the convergence of the polarisation density, "// &
    2047             :                           "i.e. requested accuracy for the SCCS iteration cycle", &
    2048             :                           repeats=.FALSE., &
    2049             :                           n_var=1, &
    2050             :                           type_of_var=real_t, &
    2051             :                           default_r_val=1.0E-6_dp, &
    2052        8444 :                           usage="EPS_ITER 1.0E-7")
    2053        8444 :       CALL section_add_keyword(section, keyword)
    2054        8444 :       CALL keyword_release(keyword)
    2055             : 
    2056             :       CALL keyword_create(keyword, __LOCATION__, &
    2057             :                           name="EPS_SCF", &
    2058             :                           description="The SCCS iteration cycle is activated only if the SCF iteration cycle "// &
    2059             :                           "is converged to this threshold value", &
    2060             :                           repeats=.FALSE., &
    2061             :                           n_var=1, &
    2062             :                           type_of_var=real_t, &
    2063             :                           default_r_val=0.5_dp, &
    2064        8444 :                           usage="EPS_SCF 1.0E-2")
    2065        8444 :       CALL section_add_keyword(section, keyword)
    2066        8444 :       CALL keyword_release(keyword)
    2067             : 
    2068             :       CALL keyword_create(keyword, __LOCATION__, &
    2069             :                           name="GAMMA", &
    2070             :                           variants=s2a("SURFACE_TENSION"), &
    2071             :                           description="Surface tension of the solvent used for the calculation of "// &
    2072             :                           "the cavitation term $G^\text{cav} = \gamma S$ "// &
    2073             :                           "where $S$ is the (quantum) surface of the cavity", &
    2074             :                           repeats=.FALSE., &
    2075             :                           n_var=1, &
    2076             :                           type_of_var=real_t, &
    2077             :                           default_r_val=0.0_dp, &
    2078        8444 :                           unit_str="mN/m")
    2079        8444 :       CALL section_add_keyword(section, keyword)
    2080        8444 :       CALL keyword_release(keyword)
    2081             : 
    2082             :       CALL keyword_create(keyword, __LOCATION__, &
    2083             :                           name="MAX_ITER", &
    2084             :                           description="Maximum number of SCCS iteration steps performed to converge "// &
    2085             :                           "within the given tolerance", &
    2086             :                           repeats=.FALSE., &
    2087             :                           n_var=1, &
    2088             :                           type_of_var=integer_t, &
    2089             :                           default_i_val=100, &
    2090        8444 :                           usage="MAX_ITER 50")
    2091        8444 :       CALL section_add_keyword(section, keyword)
    2092        8444 :       CALL keyword_release(keyword)
    2093             : 
    2094             :       CALL keyword_create(keyword, __LOCATION__, &
    2095             :                           name="METHOD", &
    2096             :                           description="Method used for the smoothing of the dielectric function", &
    2097             :                           usage="METHOD Fattebert-Gygi", &
    2098             :                           default_i_val=sccs_andreussi, &
    2099             :                           enum_c_vals=s2a("ANDREUSSI", "FATTEBERT-GYGI"), &
    2100             :                           enum_i_vals=(/sccs_andreussi, sccs_fattebert_gygi/), &
    2101             :                           enum_desc=s2a("Smoothing function proposed by Andreussi et al.", &
    2102        8444 :                                         "Smoothing function proposed by Fattebert and Gygi"))
    2103        8444 :       CALL section_add_keyword(section, keyword)
    2104        8444 :       CALL keyword_release(keyword)
    2105             : 
    2106             :       CALL keyword_create(keyword, __LOCATION__, &
    2107             :                           name="MIXING", &
    2108             :                           variants=(/"ETA"/), &
    2109             :                           description="Mixing parameter (Hartree damping) employed during the iteration procedure", &
    2110             :                           repeats=.FALSE., &
    2111             :                           n_var=1, &
    2112             :                           type_of_var=real_t, &
    2113             :                           default_r_val=0.6_dp, &
    2114       16888 :                           usage="MIXING 0.2")
    2115        8444 :       CALL section_add_keyword(section, keyword)
    2116        8444 :       CALL keyword_release(keyword)
    2117             : 
    2118        8444 :       NULLIFY (subsection)
    2119             : 
    2120             :       CALL section_create(subsection, __LOCATION__, &
    2121             :                           name="ANDREUSSI", &
    2122             :                           description="Define the parameters of the dielectric smoothing function proposed by "// &
    2123             :                           "Andreussi et al.", &
    2124             :                           citations=(/Andreussi2012/), &
    2125             :                           n_keywords=2, &
    2126             :                           n_subsections=0, &
    2127       16888 :                           repeats=.FALSE.)
    2128             : 
    2129             :       CALL keyword_create(keyword, __LOCATION__, &
    2130             :                           name="RHO_MAX", &
    2131             :                           description="Maximum density value used for the smoothing of the dielectric function", &
    2132             :                           repeats=.FALSE., &
    2133             :                           n_var=1, &
    2134             :                           type_of_var=real_t, &
    2135             :                           default_r_val=0.0035_dp, &
    2136        8444 :                           usage="RHO_MAX 0.01")
    2137        8444 :       CALL section_add_keyword(subsection, keyword)
    2138        8444 :       CALL keyword_release(keyword)
    2139             : 
    2140             :       CALL keyword_create(keyword, __LOCATION__, &
    2141             :                           name="RHO_MIN", &
    2142             :                           description="Minimum density value used for the smoothing of the dielectric function", &
    2143             :                           repeats=.FALSE., &
    2144             :                           n_var=1, &
    2145             :                           type_of_var=real_t, &
    2146             :                           default_r_val=0.0001_dp, &
    2147        8444 :                           usage="RHO_MIN 0.0003")
    2148        8444 :       CALL section_add_keyword(subsection, keyword)
    2149        8444 :       CALL keyword_release(keyword)
    2150             : 
    2151        8444 :       CALL section_add_subsection(section, subsection)
    2152        8444 :       CALL section_release(subsection)
    2153             : 
    2154             :       CALL section_create(subsection, __LOCATION__, &
    2155             :                           name="FATTEBERT-GYGI", &
    2156             :                           description="Define the parameters of the dielectric smoothing function proposed by "// &
    2157             :                           "Fattebert and Gygi", &
    2158             :                           citations=(/Fattebert2002/), &
    2159             :                           n_keywords=2, &
    2160             :                           n_subsections=0, &
    2161       16888 :                           repeats=.FALSE.)
    2162             : 
    2163             :       CALL keyword_create(keyword, __LOCATION__, &
    2164             :                           name="BETA", &
    2165             :                           description="Parameter &beta; changes the width of the interface solute-solvent", &
    2166             :                           repeats=.FALSE., &
    2167             :                           n_var=1, &
    2168             :                           type_of_var=real_t, &
    2169             :                           default_r_val=1.7_dp, &
    2170        8444 :                           usage="BETA 1.3")
    2171        8444 :       CALL section_add_keyword(subsection, keyword)
    2172        8444 :       CALL keyword_release(keyword)
    2173             : 
    2174             :       CALL keyword_create(keyword, __LOCATION__, &
    2175             :                           name="RHO_ZERO", &
    2176             :                           variants=(/"RHO0"/), &
    2177             :                           description="Parameter $\rho_0$ defines the critical density in the middle "// &
    2178             :                           "of the interface solute-solvent", &
    2179             :                           repeats=.FALSE., &
    2180             :                           n_var=1, &
    2181             :                           type_of_var=real_t, &
    2182             :                           default_r_val=0.0006_dp, &
    2183       16888 :                           usage="RHO_ZERO 0.0004")
    2184        8444 :       CALL section_add_keyword(subsection, keyword)
    2185        8444 :       CALL keyword_release(keyword)
    2186             : 
    2187        8444 :       CALL section_add_subsection(section, subsection)
    2188        8444 :       CALL section_release(subsection)
    2189             : 
    2190        8444 :    END SUBROUTINE create_sccs_section
    2191             : 
    2192             : END MODULE input_cp2k_dft

Generated by: LCOV version 1.15