LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:3130539) Lines: 698 702 99.4 %
Date: 2025-05-14 06:57:18 Functions: 17 18 94.4 %

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

Generated by: LCOV version 1.15