LCOV - code coverage report
Current view: top level - src - input_cp2k_dft.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:c740a4b) Lines: 724 728 99.5 %
Date: 2025-05-29 08:02:39 Functions: 18 19 94.7 %

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

Generated by: LCOV version 1.15