LCOV - code coverage report
Current view: top level - src - input_cp2k_mp2.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b8e0b09) Lines: 721 721 100.0 %
Date: 2024-08-31 06:31:37 Functions: 23 23 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief input section for MP2
      10             : !> \par History
      11             : !>      05.2011 created
      12             : !> \author MDB
      13             : ! **************************************************************************************************
      14             : MODULE input_cp2k_mp2
      15             :    USE bibliography, ONLY: &
      16             :       Bates2013, DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016, Wilhelm2016a, &
      17             :       Wilhelm2016b, Wilhelm2017, Wilhelm2018, Stein2022, Stein2024, Bussy2023
      18             :    USE cp_eri_mme_interface, ONLY: create_eri_mme_section
      19             :    USE cp_output_handling, ONLY: add_last_numeric, &
      20             :                                  cp_print_key_section_create, &
      21             :                                  debug_print_level, &
      22             :                                  high_print_level, &
      23             :                                  low_print_level, &
      24             :                                  medium_print_level, &
      25             :                                  silent_print_level
      26             :    USE cp_units, ONLY: cp_unit_to_cp2k
      27             :    USE input_constants, ONLY: &
      28             :       bse_fulldiag, bse_iterdiag, bse_tda, bse_abba, bse_both, &
      29             :       bse_iter_both_cond, bse_iter_en_cond, bse_iter_res_cond, bse_singlet, &
      30             :       bse_triplet, do_eri_gpw, do_eri_mme, do_eri_os, do_potential_coulomb, do_potential_id, &
      31             :       do_potential_long, do_potential_mix_cl, do_potential_short, do_potential_truncated, &
      32             :       do_potential_tshpsc, eri_default, gaussian, gw_no_print_exx, gw_pade_approx, gw_print_exx, &
      33             :       gw_read_exx, gw_skip_for_regtest, gw_two_pole_model, kp_weights_W_auto, &
      34             :       kp_weights_W_tailored, kp_weights_W_uniform, mp2_method_direct, mp2_method_gpw, &
      35             :       mp2_method_none, numerical, ot_precond_full_all, ot_precond_full_kinetic, &
      36             :       ot_precond_full_single, ot_precond_full_single_inverse, ot_precond_none, &
      37             :       ot_precond_s_inverse, ri_default, ri_rpa_g0w0_crossing_bisection, &
      38             :       ri_rpa_g0w0_crossing_newton, ri_rpa_g0w0_crossing_z_shot, soc_lda, soc_none, soc_pbe, &
      39             :       wfc_mm_style_gemm, wfc_mm_style_syrk, z_solver_cg, z_solver_pople, z_solver_richardson, &
      40             :       z_solver_sd, rpa_exchange_none, rpa_exchange_axk, rpa_exchange_sosex, G0W0, evGW0, evGW
      41             :    USE input_cp2k_hfx, ONLY: create_hfx_section
      42             :    USE input_cp2k_kpoints, ONLY: create_kpoint_set_section
      43             :    USE input_keyword_types, ONLY: keyword_create, &
      44             :                                   keyword_release, &
      45             :                                   keyword_type
      46             :    USE input_section_types, ONLY: section_add_keyword, &
      47             :                                   section_add_subsection, &
      48             :                                   section_create, &
      49             :                                   section_release, &
      50             :                                   section_type
      51             :    USE input_val_types, ONLY: integer_t, &
      52             :                               real_t
      53             :    USE kinds, ONLY: dp
      54             :    USE string_utilities, ONLY: newline, &
      55             :                                s2a
      56             : #include "./base/base_uses.f90"
      57             : 
      58             :    IMPLICIT NONE
      59             :    PRIVATE
      60             : 
      61             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_mp2'
      62             : 
      63             :    PUBLIC :: create_mp2_section
      64             : 
      65             : CONTAINS
      66             : 
      67             : ! **************************************************************************************************
      68             : !> \brief creates the input section for the mp2 part
      69             : !> \param section the section to create
      70             : !> \author MDB
      71             : ! **************************************************************************************************
      72       59060 :    SUBROUTINE create_mp2_section(section)
      73             :       TYPE(section_type), POINTER                        :: section
      74             : 
      75             :       TYPE(keyword_type), POINTER                        :: keyword
      76             :       TYPE(section_type), POINTER                        :: print_key, subsection
      77             : 
      78       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
      79             :       CALL section_create(section, __LOCATION__, name="WF_CORRELATION", &
      80             :                           description="Sets up the wavefunction-based correlation methods as MP2, "// &
      81             :                           "RI-MP2, RI-SOS-MP2, RI-RPA and GW (inside RI-RPA). ", &
      82             :                           n_keywords=4, n_subsections=7, repeats=.TRUE., &
      83             :                           citations=(/DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016, &
      84             :                                       Wilhelm2016a, Wilhelm2016b, Wilhelm2017, Wilhelm2018, Stein2022, &
      85      767780 :                                       Stein2024, Bussy2023/))
      86             : 
      87       59060 :       NULLIFY (keyword, subsection)
      88             : 
      89             :       CALL keyword_create( &
      90             :          keyword, __LOCATION__, &
      91             :          name="MEMORY", &
      92             :          description="Maximum allowed total memory usage during MP2 methods [MiB].", &
      93             :          usage="MEMORY 1500 ", &
      94       59060 :          default_r_val=1.024E+3_dp)
      95       59060 :       CALL section_add_keyword(section, keyword)
      96       59060 :       CALL keyword_release(keyword)
      97             : 
      98             :       CALL keyword_create( &
      99             :          keyword, __LOCATION__, &
     100             :          name="E_GAP", &
     101             :          description="Gap energy for integration grids in Hartree. Defaults to -1.0 (automatic determination). "// &
     102             :          "Recommended to set if several RPA or SOS-MP2 gradient calculations are requested or to be restarted. "// &
     103             :          "In this way, differences of integration grids across different runs are removed as CP2K "// &
     104             :          "does not include derivatives thereof.", &
     105             :          usage="E_GAP  0.5", &
     106       59060 :          default_r_val=-1.0_dp)
     107       59060 :       CALL section_add_keyword(section, keyword)
     108       59060 :       CALL keyword_release(keyword)
     109             : 
     110             :       CALL keyword_create( &
     111             :          keyword, __LOCATION__, &
     112             :          name="E_RANGE", &
     113             :          description="Energy range (ratio of largest and smallest) energy difference "// &
     114             :          "of unoccupied and occupied orbitals for integration grids. Defaults to 0.0 (automatic determination). "// &
     115             :          "Recommended to set if several RPA or SOS-MP2 gradient calculations are requested or to be restarted. "// &
     116             :          "In this way, differences of integration grids across different runs are removed as CP2K "// &
     117             :          "does not include derivatives thereof.", &
     118             :          usage="E_RANGE  10.0", &
     119       59060 :          default_r_val=-1.0_dp)
     120       59060 :       CALL section_add_keyword(section, keyword)
     121       59060 :       CALL keyword_release(keyword)
     122             : 
     123             :       CALL keyword_create( &
     124             :          keyword, __LOCATION__, &
     125             :          name="SCALE_S", &
     126             :          description="Scaling factor of the singlet energy component (opposite spin, OS) of the "// &
     127             :          "MP2, RI-MP2 and SOS-MP2 correlation energy. ", &
     128             :          usage="SCALE_S  1.0", &
     129       59060 :          default_r_val=1.0_dp)
     130       59060 :       CALL section_add_keyword(section, keyword)
     131       59060 :       CALL keyword_release(keyword)
     132             : 
     133             :       CALL keyword_create( &
     134             :          keyword, __LOCATION__, &
     135             :          name="SCALE_T", &
     136             :          description="Scaling factor of the triplet energy component (same spin, SS) of the MP2 "// &
     137             :          "and RI-MP2 correlation energy.", &
     138             :          usage="SCALE_T  1.0", &
     139       59060 :          default_r_val=1.0_dp)
     140       59060 :       CALL section_add_keyword(section, keyword)
     141       59060 :       CALL keyword_release(keyword)
     142             : 
     143             :       CALL keyword_create( &
     144             :          keyword, __LOCATION__, &
     145             :          name="GROUP_SIZE", &
     146             :          variants=(/"NUMBER_PROC"/), &
     147             :          description="Group size used in the computation of GPW and MME integrals and the MP2 correlation energy. "// &
     148             :          "The group size must be a divisor of the total number of MPI ranks. "// &
     149             :          "A smaller group size (for example the number of MPI ranks per node) "// &
     150             :          "accelerates the computation of integrals but a too large group size increases communication costs. "// &
     151             :          "A too small group size may lead to out of memory.", &
     152             :          usage="GROUP_SIZE 2", &
     153      118120 :          default_i_val=1)
     154       59060 :       CALL section_add_keyword(section, keyword)
     155       59060 :       CALL keyword_release(keyword)
     156             : 
     157       59060 :       NULLIFY (subsection)
     158       59060 :       CALL create_mp2_details_section(subsection)
     159       59060 :       CALL section_add_subsection(section, subsection)
     160       59060 :       CALL section_release(subsection)
     161             : 
     162       59060 :       CALL create_ri_mp2(subsection)
     163       59060 :       CALL section_add_subsection(section, subsection)
     164       59060 :       CALL section_release(subsection)
     165             : 
     166       59060 :       CALL create_ri_rpa(subsection)
     167       59060 :       CALL section_add_subsection(section, subsection)
     168       59060 :       CALL section_release(subsection)
     169             : 
     170       59060 :       CALL create_ri_laplace(subsection)
     171       59060 :       CALL section_add_subsection(section, subsection)
     172       59060 :       CALL section_release(subsection)
     173             : 
     174             :       ! here we generate an imag. time subsection to use with RPA or Laplace-SOS-MP2
     175       59060 :       CALL create_low_scaling(subsection)
     176       59060 :       CALL section_add_subsection(section, subsection)
     177       59060 :       CALL section_release(subsection)
     178             : 
     179       59060 :       CALL create_ri_section(subsection)
     180       59060 :       CALL section_add_subsection(section, subsection)
     181       59060 :       CALL section_release(subsection)
     182             : 
     183       59060 :       CALL create_integrals_section(subsection)
     184       59060 :       CALL section_add_subsection(section, subsection)
     185       59060 :       CALL section_release(subsection)
     186             : 
     187       59060 :       CALL create_canonical_gradients(subsection)
     188       59060 :       CALL section_add_subsection(section, subsection)
     189       59060 :       CALL section_release(subsection)
     190             : 
     191       59060 :       NULLIFY (print_key)
     192             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT", &
     193             :                                        description="Controls the printing basic info about WFC methods", &
     194       59060 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     195       59060 :       CALL section_add_subsection(section, print_key)
     196       59060 :       CALL section_release(print_key)
     197             : 
     198       59060 :    END SUBROUTINE create_mp2_section
     199             : 
     200             : ! **************************************************************************************************
     201             : !> \brief ...
     202             : !> \param section ...
     203             : ! **************************************************************************************************
     204       59060 :    SUBROUTINE create_mp2_details_section(section)
     205             :       TYPE(section_type), POINTER                        :: section
     206             : 
     207             :       TYPE(keyword_type), POINTER                        :: keyword
     208             : 
     209       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     210             :       CALL section_create(section, __LOCATION__, name="MP2", &
     211             :                           description="Parameters influencing MP2 (non-RI).", &
     212       59060 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     213             : 
     214       59060 :       NULLIFY (keyword)
     215             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     216             :                           description="Activates MP2 calculations.", &
     217             :                           usage="&MP2 .TRUE.", &
     218       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     219       59060 :       CALL section_add_keyword(section, keyword)
     220       59060 :       CALL keyword_release(keyword)
     221             : 
     222             :       CALL keyword_create( &
     223             :          keyword, __LOCATION__, &
     224             :          name="METHOD", &
     225             :          citations=(/DelBen2012, DelBen2013/), &
     226             :          description="Method that is used to compute the MP2 energy.", &
     227             :          usage="METHOD MP2_GPW", &
     228             :          enum_c_vals=s2a("NONE", "DIRECT_CANONICAL", "MP2_GPW"), &
     229             :          enum_i_vals=(/mp2_method_none, mp2_method_direct, mp2_method_gpw/), &
     230             :          enum_desc=s2a("Skip MP2 calculation.", &
     231             :                        "Use the direct mp2 canonical approach.", &
     232             :                        "Use the GPW approach to MP2."), &
     233      177180 :          default_i_val=mp2_method_direct)
     234       59060 :       CALL section_add_keyword(section, keyword)
     235       59060 :       CALL keyword_release(keyword)
     236             : 
     237             :       CALL keyword_create( &
     238             :          keyword, __LOCATION__, &
     239             :          name="BIG_SEND", &
     240             :          description="Influencing the direct canonical MP2 method: Send big "// &
     241             :          "messages between processes (useful for >48 processors).", &
     242             :          usage="BIG_SEND", &
     243             :          default_l_val=.TRUE., &
     244       59060 :          lone_keyword_l_val=.TRUE.)
     245       59060 :       CALL section_add_keyword(section, keyword)
     246       59060 :       CALL keyword_release(keyword)
     247             : 
     248       59060 :    END SUBROUTINE create_mp2_details_section
     249             : 
     250             : ! **************************************************************************************************
     251             : !> \brief ...
     252             : !> \param section ...
     253             : ! **************************************************************************************************
     254       59060 :    SUBROUTINE create_ri_mp2(section)
     255             :       TYPE(section_type), POINTER                        :: section
     256             : 
     257             :       TYPE(keyword_type), POINTER                        :: keyword
     258             : 
     259       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     260             :       CALL section_create(section, __LOCATION__, name="RI_MP2", &
     261             :                           description="Parameters influencing the RI-MP2 method. RI-MP2 supports gradients.", &
     262             :                           n_keywords=3, n_subsections=1, repeats=.FALSE., &
     263      118120 :                           citations=(/DelBen2013/))
     264             : 
     265       59060 :       NULLIFY (keyword)
     266             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     267             :                           description="Putting the &RI_MP2 section activates RI-MP2 calculation.", &
     268             :                           usage="&RI_MP2 .TRUE.", &
     269       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     270       59060 :       CALL section_add_keyword(section, keyword)
     271       59060 :       CALL keyword_release(keyword)
     272             : 
     273             :       CALL keyword_create(keyword, __LOCATION__, name="BLOCK_SIZE", &
     274             :                           variants=(/"MESSAGE_SIZE"/), &
     275             :                           description="Determines the blocking used for communication in RI-MP2. Larger BLOCK_SIZE "// &
     276             :                           "reduces communication but requires more memory. The default (-1) is automatic.", &
     277             :                           usage="BLOCK_SIZE 2", &
     278      118120 :                           default_i_val=-1)
     279       59060 :       CALL section_add_keyword(section, keyword)
     280       59060 :       CALL keyword_release(keyword)
     281             : 
     282             :       CALL keyword_create(keyword, __LOCATION__, name="NUMBER_INTEGRATION_GROUPS", &
     283             :                           description="Sets the number of integration groups of the communication scheme in RI-MP2. "// &
     284             :                           "Integrals will be replicated such that each integration group has all integrals available. "// &
     285             :                           "Must be a divisor of the number of subgroups (see GROUP_SIZE keyword in the WF_CORRELATION "// &
     286             :                           "section. Smaller groups reduce the communication costs but increase the memory developments. "// &
     287             :                           "If the provided value is non-positive or not a divisor of the number of subgroups, "// &
     288             :                           "the number of integration groups is determined automatically (default).", &
     289             :                           usage="NUMBER_INTEGRATION_GROUPS 2", &
     290       59060 :                           default_i_val=-1)
     291       59060 :       CALL section_add_keyword(section, keyword)
     292       59060 :       CALL keyword_release(keyword)
     293             : 
     294             :       CALL keyword_create( &
     295             :          keyword, __LOCATION__, &
     296             :          name="PRINT_DGEMM_INFO", &
     297             :          description="Print details about all DGEMM calls.", &
     298             :          lone_keyword_l_val=.TRUE., &
     299       59060 :          default_l_val=.FALSE.)
     300       59060 :       CALL section_add_keyword(section, keyword)
     301       59060 :       CALL keyword_release(keyword)
     302             : 
     303       59060 :    END SUBROUTINE create_ri_mp2
     304             : 
     305             : ! **************************************************************************************************
     306             : !> \brief ...
     307             : !> \param section ...
     308             : ! **************************************************************************************************
     309       59060 :    SUBROUTINE create_opt_ri_basis(section)
     310             :       TYPE(section_type), POINTER                        :: section
     311             : 
     312             :       TYPE(keyword_type), POINTER                        :: keyword
     313             : 
     314       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     315             :       CALL section_create(section, __LOCATION__, name="OPT_RI_BASIS", &
     316             :                           description="Parameters influencing the optimization of the RI MP2 basis. "// &
     317             :                           "Only exponents of non-contracted auxiliary basis can be optimized. "// &
     318             :                           "An initial RI auxiliary basis has to be specified.", &
     319             :                           n_keywords=6, n_subsections=0, repeats=.FALSE., &
     320      118120 :                           citations=(/DelBen2013/))
     321       59060 :       NULLIFY (keyword)
     322             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     323             :                           description="Putting the &OPT_RI_BASIS section activates optimization of RI basis.", &
     324             :                           usage="&OPT_RI_BASIS .TRUE.", &
     325       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     326       59060 :       CALL section_add_keyword(section, keyword)
     327       59060 :       CALL keyword_release(keyword)
     328             : 
     329             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_I_REL", &
     330             :                           variants=(/"DI_REL"/), &
     331             :                           description="Target accuracy in the relative deviation of the amplitudes calculated with "// &
     332             :                           "and without RI approximation, (more details in Chem.Phys.Lett.294(1998)143).", &
     333             :                           usage="DELTA_I_REL  1.0E-6_dp", &
     334      118120 :                           default_r_val=1.0E-6_dp)
     335       59060 :       CALL section_add_keyword(section, keyword)
     336       59060 :       CALL keyword_release(keyword)
     337             : 
     338             :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_RI", &
     339             :                           variants=(/"DRI"/), &
     340             :                           description="Target accuracy in the absolute difference between the RI-MP2 "// &
     341             :                           "and the exact MP2 energy, DRI=ABS(E_MP2-E_RI-MP2).", &
     342             :                           usage="DELTA_RI  1.0E-6_dp", &
     343      118120 :                           default_r_val=5.0E-6_dp)
     344       59060 :       CALL section_add_keyword(section, keyword)
     345       59060 :       CALL keyword_release(keyword)
     346             : 
     347             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DERIV", &
     348             :                           variants=(/"EPS_NUM_DERIV"/), &
     349             :                           description="The derivatives of the MP2 energy with respect to the "// &
     350             :                           "exponents of the basis are calculated numerically. "// &
     351             :                           "The change in the exponent a_i employed for the numerical evaluation "// &
     352             :                           "is defined as h_i=EPS_DERIV*a_i.", &
     353             :                           usage="EPS_DERIV  1.0E-3_dp", &
     354      118120 :                           default_r_val=1.0E-3_dp)
     355       59060 :       CALL section_add_keyword(section, keyword)
     356       59060 :       CALL keyword_release(keyword)
     357             : 
     358             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
     359             :                           variants=(/"MAX_NUM_ITER"/), &
     360             :                           description="Specifies the maximum number of steps in the RI basis optimization.", &
     361             :                           usage="MAX_ITER 100", &
     362      118120 :                           default_i_val=50)
     363       59060 :       CALL section_add_keyword(section, keyword)
     364       59060 :       CALL keyword_release(keyword)
     365             : 
     366             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_FUNC", &
     367             :                           description="Specifies the number of function, for each angular momentum (s, p, d ...), "// &
     368             :                           "employed in the automatically generated initial guess. "// &
     369             :                           "This will be effective only if RI_AUX_BASIS_SET in the KIND section is not specified.", &
     370             :                           usage="NUM_FUNC {number of s func.} {number of p func.} ...", &
     371       59060 :                           n_var=-1, default_i_vals=(/-1/), type_of_var=integer_t)
     372       59060 :       CALL section_add_keyword(section, keyword)
     373       59060 :       CALL keyword_release(keyword)
     374             : 
     375             :       CALL keyword_create(keyword, __LOCATION__, name="BASIS_SIZE", &
     376             :                           description="Specifies the size of the auxiliary basis set automatically "// &
     377             :                           "generated as initial guess. This will be effective only if RI_AUX_BASIS_SET "// &
     378             :                           "in the KIND section and NUM_FUNC are not specified.", &
     379             :                           usage="BASIS_SIZE  (MEDIUM|LARGE|VERY_LARGE)", &
     380             :                           enum_c_vals=s2a("MEDIUM", "LARGE", "VERY_LARGE"), &
     381             :                           enum_i_vals=(/0, 1, 2/), &
     382       59060 :                           default_i_val=0)
     383       59060 :       CALL section_add_keyword(section, keyword)
     384       59060 :       CALL keyword_release(keyword)
     385             : 
     386       59060 :    END SUBROUTINE create_opt_ri_basis
     387             : 
     388             : ! **************************************************************************************************
     389             : !> \brief ...
     390             : !> \param section ...
     391             : ! **************************************************************************************************
     392       59060 :    SUBROUTINE create_ri_laplace(section)
     393             :       TYPE(section_type), POINTER                        :: section
     394             : 
     395             :       TYPE(keyword_type), POINTER                        :: keyword
     396             : 
     397       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     398             :       CALL section_create(section, __LOCATION__, name="RI_SOS_MP2", &
     399             :                           description="Parameters influencing the RI-SOS-MP2-Laplace method", &
     400             :                           n_keywords=3, n_subsections=1, repeats=.FALSE., &
     401      118120 :                           citations=(/DelBen2013/))
     402             : 
     403       59060 :       NULLIFY (keyword)
     404             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     405             :                           description="Putting the &RI_SOS_MP2 section activates RI-SOS-MP2 calculation.", &
     406             :                           usage="&RI_SOS_MP2 .TRUE.", &
     407       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     408       59060 :       CALL section_add_keyword(section, keyword)
     409       59060 :       CALL keyword_release(keyword)
     410             : 
     411             :       CALL keyword_create( &
     412             :          keyword, __LOCATION__, name="QUADRATURE_POINTS", &
     413             :          variants=(/"LAPLACE_NUM_QUAD_POINTS"/), &
     414             :          description="Number of quadrature points for the numerical integration in the RI-SOS-MP2-Laplace method.", &
     415             :          usage="QUADRATURE_POINTS 6", &
     416      118120 :          default_i_val=5)
     417       59060 :       CALL section_add_keyword(section, keyword)
     418       59060 :       CALL keyword_release(keyword)
     419             : 
     420             :       CALL keyword_create( &
     421             :          keyword, __LOCATION__, name="NUM_INTEG_GROUPS", &
     422             :          description="Number of groups for the integration in the Laplace method. Each groups processes "// &
     423             :          "the same amount of quadrature points. It must be a divisor of the number of quadrature points and "// &
     424             :          "NUM_INTEG_GROUPS*GROUP_SIZE must be a divisor of the total number of processes. The default (-1) is automatic.", &
     425             :          usage="SIZE_INTEG_GROUP 2", &
     426       59060 :          default_i_val=-1)
     427       59060 :       CALL section_add_keyword(section, keyword)
     428       59060 :       CALL keyword_release(keyword)
     429             : 
     430       59060 :    END SUBROUTINE create_ri_laplace
     431             : 
     432             : ! **************************************************************************************************
     433             : !> \brief ...
     434             : !> \param section ...
     435             : ! **************************************************************************************************
     436       59060 :    SUBROUTINE create_canonical_gradients(section)
     437             :       TYPE(section_type), POINTER                        :: section
     438             : 
     439             :       TYPE(keyword_type), POINTER                        :: keyword
     440             :       TYPE(section_type), POINTER                        :: subsection
     441             : 
     442       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     443             :       CALL section_create(section, __LOCATION__, name="CANONICAL_GRADIENTS", &
     444             :                           description="Parameters influencing gradient calculations of canonical RI methods. "// &
     445             :                           "Ignored if the IM_TIME section is set.", &
     446             :                           n_keywords=3, n_subsections=1, repeats=.FALSE., &
     447      295300 :                           citations=(/DelBen2015b, Rybkin2016, Stein2022, Stein2024/))
     448             : 
     449       59060 :       NULLIFY (subsection, keyword)
     450       59060 :       CALL create_cphf(subsection)
     451       59060 :       CALL section_add_subsection(section, subsection)
     452       59060 :       CALL section_release(subsection)
     453             : 
     454             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CANONICAL", &
     455             :                           description="Threshold under which a given ij or ab pair is considered to be degenerate and "// &
     456             :                           "its contribution to the density matrix is calculated directly. "// &
     457             :                           "Ignored in case of energy-only calculation.", &
     458             :                           usage="EPS_CANONICAL 1.0E-8", type_of_var=real_t, &
     459       59060 :                           default_r_val=1.0E-7_dp)
     460       59060 :       CALL section_add_keyword(section, keyword)
     461       59060 :       CALL keyword_release(keyword)
     462             : 
     463             :       CALL keyword_create( &
     464             :          keyword, __LOCATION__, &
     465             :          name="FREE_HFX_BUFFER", &
     466             :          description="Free the buffer containing the 4 center integrals used in the Hartree-Fock exchange calculation. "// &
     467             :          "Ignored for energy-only calculations. May fail.", &
     468             :          usage="FREE_HFX_BUFFER", &
     469             :          default_l_val=.FALSE., &
     470       59060 :          lone_keyword_l_val=.TRUE.)
     471       59060 :       CALL section_add_keyword(section, keyword)
     472       59060 :       CALL keyword_release(keyword)
     473             : 
     474             :       CALL keyword_create( &
     475             :          keyword, __LOCATION__, &
     476             :          name="DOT_PRODUCT_BLKSIZE", &
     477             :          description="Dot products for the calculation of the RPA/SOS-MP2 density matrices "// &
     478             :          "are calculated in batches of the size given by this keyword. Larger block sizes "// &
     479             :          "improve the performance but reduce the numerical accuracy. Recommended block sizes are multiples of the number of "// &
     480             :          "doubles per cache line (usually 8). Ignored with MP2 gradients. Set it to -1 to prevent blocking.", &
     481       59060 :          default_i_val=-1)
     482       59060 :       CALL section_add_keyword(section, keyword)
     483       59060 :       CALL keyword_release(keyword)
     484             : 
     485             :       CALL keyword_create( &
     486             :          keyword, __LOCATION__, &
     487             :          name="MAX_PARALLEL_COMM", &
     488             :          description="Sets the maximum number of parallel communication steps of the non-blocking communication scheme. "// &
     489             :          "The number of channels is determined from the available memory. If set to a value smaller than one, "// &
     490             :          "CP2K will use all memory for communication. A value of one enforces the blocking communication scheme "// &
     491             :          "increasing the communication costs.", &
     492       59060 :          default_i_val=2)
     493       59060 :       CALL section_add_keyword(section, keyword)
     494       59060 :       CALL keyword_release(keyword)
     495             : 
     496       59060 :    END SUBROUTINE create_canonical_gradients
     497             : 
     498             : ! **************************************************************************************************
     499             : !> \brief ...
     500             : !> \param section ...
     501             : ! **************************************************************************************************
     502       59060 :    SUBROUTINE create_ri_rpa(section)
     503             :       TYPE(section_type), POINTER                        :: section
     504             : 
     505             :       TYPE(keyword_type), POINTER                        :: keyword
     506             :       TYPE(section_type), POINTER                        :: subsection
     507             : 
     508       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     509             :       CALL section_create(section, __LOCATION__, name="RI_RPA", &
     510             :                           description="Parameters influencing RI-RPA and GW.", &
     511             :                           n_keywords=8, n_subsections=4, repeats=.FALSE., &
     512      177180 :                           citations=(/DelBen2013, DelBen2015/))
     513             : 
     514       59060 :       NULLIFY (keyword, subsection)
     515             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     516             :                           description="Putting the &RI_RPA section activates RI-RPA calculation.", &
     517             :                           usage="&RI_RPA .TRUE.", &
     518       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     519       59060 :       CALL section_add_keyword(section, keyword)
     520       59060 :       CALL keyword_release(keyword)
     521             : 
     522             :       CALL keyword_create(keyword, __LOCATION__, name="QUADRATURE_POINTS", &
     523             :                           variants=(/"RPA_NUM_QUAD_POINTS"/), &
     524             :                           description="Number of quadrature points for the numerical integration in the RI-RPA method.", &
     525             :                           usage="QUADRATURE_POINTS 60", &
     526      118120 :                           default_i_val=40)
     527       59060 :       CALL section_add_keyword(section, keyword)
     528       59060 :       CALL keyword_release(keyword)
     529             : 
     530             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_INTEG_GROUPS", &
     531             :                           description="Number of groups for the integration in the Laplace method. Each groups processes "// &
     532             :                           "the same amount of quadrature points. It must be a divisor of the number of quadrature points and "// &
     533             :                           "NUM_INTEG_GROUPS*GROUP_SIZE must be a divisor of the total number of processes. "// &
     534             :                           "The default (-1) is automatic.", &
     535             :                           usage="SIZE_INTEG_GROUP 2", &
     536       59060 :                           default_i_val=-1)
     537       59060 :       CALL section_add_keyword(section, keyword)
     538       59060 :       CALL keyword_release(keyword)
     539             : 
     540             :       CALL keyword_create(keyword, __LOCATION__, &
     541             :                           name="MM_STYLE", &
     542             :                           description="Matrix multiplication style for the Q matrix.", &
     543             :                           usage="MM_STYLE GEMM", &
     544             :                           enum_c_vals=s2a("GEMM", "SYRK"), &
     545             :                           enum_i_vals=(/wfc_mm_style_gemm, wfc_mm_style_syrk/), &
     546             :                           enum_desc=s2a("Use pdgemm: more flops, maybe faster.", &
     547             :                                         "Use pdysrk: fewer flops, maybe slower."), &
     548       59060 :                           default_i_val=wfc_mm_style_gemm)
     549       59060 :       CALL section_add_keyword(section, keyword)
     550       59060 :       CALL keyword_release(keyword)
     551             : 
     552             :       CALL keyword_create( &
     553             :          keyword, __LOCATION__, &
     554             :          name="MINIMAX_QUADRATURE", &
     555             :          variants=(/"MINIMAX"/), &
     556             :          description="Use the Minimax quadrature scheme for performing the numerical integration. "// &
     557             :          "Maximum number of quadrature point limited to 20.", &
     558             :          usage="MINIMAX_QUADRATURE", &
     559             :          default_l_val=.FALSE., &
     560      118120 :          lone_keyword_l_val=.TRUE.)
     561       59060 :       CALL section_add_keyword(section, keyword)
     562       59060 :       CALL keyword_release(keyword)
     563             : 
     564             :       CALL keyword_create( &
     565             :          keyword, __LOCATION__, &
     566             :          name="RSE", &
     567             :          variants=(/"SE"/), &
     568             :          description="Decide whether to add singles correction.", &
     569             :          usage="RSE", &
     570             :          default_l_val=.FALSE., &
     571      118120 :          lone_keyword_l_val=.TRUE.)
     572       59060 :       CALL section_add_keyword(section, keyword)
     573       59060 :       CALL keyword_release(keyword)
     574             : 
     575             :       CALL keyword_create( &
     576             :          keyword, __LOCATION__, &
     577             :          name="ADMM", &
     578             :          description="Decide whether to perform ADMM in the exact exchange calc. for RPA and/or GW. "// &
     579             :          "The ADMM XC correction is governed by the AUXILIARY_DENSITY_MATRIX_METHOD section in &DFT. "// &
     580             :          "In most cases, the Hartree-Fock exchange is not too expensive and there is no need for ADMM, "// &
     581             :          "ADMM can however provide significant speedup and memory savings in case of diffuse basis sets. "// &
     582             :          "If it is a GW bandgap calculations, RI_SIGMA_X can also be used. ", &
     583             :          usage="ADMM", &
     584             :          default_l_val=.FALSE., &
     585       59060 :          lone_keyword_l_val=.TRUE.)
     586       59060 :       CALL section_add_keyword(section, keyword)
     587       59060 :       CALL keyword_release(keyword)
     588             : 
     589             :       CALL keyword_create( &
     590             :          keyword, __LOCATION__, &
     591             :          name="SCALE_RPA", &
     592             :          description="Scales RPA energy contributions (RPA, exchange correction).", &
     593             :          usage="SCALE_RPA 1.0", &
     594       59060 :          default_r_val=1.0_dp)
     595       59060 :       CALL section_add_keyword(section, keyword)
     596       59060 :       CALL keyword_release(keyword)
     597             : 
     598             :       CALL keyword_create( &
     599             :          keyword, __LOCATION__, &
     600             :          name="PRINT_DGEMM_INFO", &
     601             :          description="Print details about all DGEMM calls.", &
     602             :          lone_keyword_l_val=.TRUE., &
     603       59060 :          default_l_val=.FALSE.)
     604       59060 :       CALL section_add_keyword(section, keyword)
     605       59060 :       CALL keyword_release(keyword)
     606             : 
     607             :       ! here we generate a hfx subsection to use in the case EXX has to be computed after RPA
     608       59060 :       CALL create_hfx_section(subsection)
     609       59060 :       CALL section_add_subsection(section, subsection)
     610       59060 :       CALL section_release(subsection)
     611             : 
     612             :       ! here we generate a G0W0 subsection to use if G0W0 is desired
     613       59060 :       CALL create_ri_g0w0(subsection)
     614       59060 :       CALL section_add_subsection(section, subsection)
     615       59060 :       CALL section_release(subsection)
     616             : 
     617             :       ! here we the RPA exchange section
     618       59060 :       CALL create_rpa_exchange(subsection)
     619       59060 :       CALL section_add_subsection(section, subsection)
     620       59060 :       CALL section_release(subsection)
     621             : 
     622       59060 :    END SUBROUTINE create_ri_rpa
     623             : 
     624             : ! **************************************************************************************************
     625             : !> \brief ...
     626             : !> \param section ...
     627             : ! **************************************************************************************************
     628       59060 :    SUBROUTINE create_rpa_exchange(section)
     629             :       TYPE(section_type), POINTER                        :: section
     630             : 
     631             :       TYPE(keyword_type), POINTER                        :: keyword
     632             : 
     633       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     634             :       CALL section_create(section, __LOCATION__, name="EXCHANGE_CORRECTION", &
     635             :                           description="Parameters influencing exchange corrections to RPA. No gradients available.", &
     636       59060 :                           n_keywords=3, n_subsections=1, repeats=.FALSE.)
     637             : 
     638       59060 :       NULLIFY (keyword)
     639             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     640             :                           description="Choose the kind of exchange correction.", &
     641             :                           usage="&EXCHANGE_CORRECTION AXK", &
     642             :                           enum_c_vals=s2a("NONE", "AXK", "SOSEX"), &
     643             :                           enum_i_vals=(/rpa_exchange_none, rpa_exchange_axk, rpa_exchange_sosex/), &
     644             :                           enum_desc=s2a("Apply no exchange correction.", &
     645             :                                         "Apply Approximate eXchange Kernel (AXK) correction.", &
     646             :                                         "Apply Second Order Screened eXchange (SOSEX) correction."), &
     647       59060 :                           default_i_val=rpa_exchange_none)
     648       59060 :       CALL section_add_keyword(section, keyword)
     649       59060 :       CALL keyword_release(keyword)
     650             : 
     651             :       CALL keyword_create( &
     652             :          keyword, __LOCATION__, &
     653             :          name="BLOCK_SIZE", &
     654             :          description="Choose the block size of the contraction step. Larger block sizes improve performance but "// &
     655             :          "require more memory (quadratically!, number of stored elements: $o^2\cdot N_B^2$). "// &
     656             :          "Nonpositive numbers turn off blocking.", &
     657             :          usage="BLOCK_SIZE 1", &
     658       59060 :          default_i_val=1)
     659       59060 :       CALL section_add_keyword(section, keyword)
     660       59060 :       CALL keyword_release(keyword)
     661             : 
     662             :       CALL keyword_create( &
     663             :          keyword, __LOCATION__, &
     664             :          name="USE_HFX_IMPLEMENTATION", &
     665             :          description="Use a HF-based implementation with RI_RPA%HF section. Recommended for large systems.", &
     666             :          usage="USE_HFX_IMPLEMENTATION T", &
     667       59060 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     668       59060 :       CALL section_add_keyword(section, keyword)
     669       59060 :       CALL keyword_release(keyword)
     670             : 
     671       59060 :    END SUBROUTINE create_rpa_exchange
     672             : 
     673             : ! **************************************************************************************************
     674             : !> \brief ...
     675             : !> \param section ...
     676             : ! **************************************************************************************************
     677       59060 :    SUBROUTINE create_ri_g0w0(section)
     678             :       TYPE(section_type), POINTER                        :: section
     679             : 
     680             :       TYPE(keyword_type), POINTER                        :: keyword
     681             :       TYPE(section_type), POINTER                        :: subsection
     682             : 
     683       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
     684             :       CALL section_create(section, __LOCATION__, name="GW", &
     685             :                           description="Parameters influencing GW calculations on molecules, "// &
     686             :                           "see also 'Electronic band structure from GW', "// &
     687             :                           "https://manual.cp2k.org/trunk/methods/properties/bandstructure_gw.html.", &
     688       59060 :                           n_keywords=24, n_subsections=1, repeats=.FALSE.)
     689             : 
     690       59060 :       NULLIFY (keyword, subsection)
     691             : 
     692             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     693             :                           description="Activates GW calculations.", &
     694             :                           usage="&GW .TRUE.", &
     695       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     696       59060 :       CALL section_add_keyword(section, keyword)
     697       59060 :       CALL keyword_release(keyword)
     698             : 
     699             :       CALL keyword_create(keyword, __LOCATION__, name="SELF_CONSISTENCY", &
     700             :                           description="Decide the level of self-consistency of eigenvalues "// &
     701             :                           "(= quasiparticle energies = single-electron energies) in GW. "// &
     702             :                           "Updates of Kohn-Sham orbitals (for example qsGW) are not implemented. "// &
     703             :                           "For details which type of eigenvalue self-consistency might be good, "// &
     704             :                           "please consult Golze, Dvorak, Rinke, Front. Chem. 2019.", &
     705             :                           usage="GW_SELF_CONSISTENCY evGW0", &
     706             :                           enum_c_vals=s2a("G0W0", "evGW0", "evGW"), &
     707             :                           enum_i_vals=(/G0W0, evGW0, evGW/), &
     708             :                           enum_desc=s2a("Use DFT eigenvalues; not update.", &
     709             :                                         "Update DFT eigenvalues in G, not in W.", &
     710             :                                         "Update DFT eigenvalues in G and W."), &
     711       59060 :                           default_i_val=G0W0)
     712       59060 :       CALL section_add_keyword(section, keyword)
     713       59060 :       CALL keyword_release(keyword)
     714             : 
     715             :       CALL keyword_create(keyword, __LOCATION__, name="CORR_MOS_OCC", &
     716             :                           variants=(/"CORR_OCC"/), &
     717             :                           description="Number of occupied MOs whose energies are corrected in GW. "// &
     718             :                           "Counting beginning from HOMO, e.g. 3 corrected occ. MOs correspond "// &
     719             :                           "to correction of HOMO, HOMO-1 and HOMO-2. Numerical effort and "// &
     720             :                           "storage of RI-G0W0 increase linearly with this number. In case you "// &
     721             :                           "want to correct all occ. MOs, insert either a negative number or "// &
     722             :                           "a number larger than the number of occ. MOs. Invoking CORR_MOS_OCC -2 "// &
     723             :                           "together with a BSE cutoff, sets a sufficiently large CORR_MOS_OCC "// &
     724             :                           "for the given BSE cutoff deduced from DFT eigenvalues.", &
     725             :                           usage="CORR_OCC 3", &
     726      118120 :                           default_i_val=10)
     727       59060 :       CALL section_add_keyword(section, keyword)
     728       59060 :       CALL keyword_release(keyword)
     729             : 
     730             :       CALL keyword_create(keyword, __LOCATION__, name="CORR_MOS_VIRT", &
     731             :                           variants=(/"CORR_VIRT"/), &
     732             :                           description="Number of virtual MOs whose energies are corrected by GW. "// &
     733             :                           "Counting beginning from LUMO, e.g. 3 corrected occ. MOs correspond "// &
     734             :                           "to correction of LUMO, LUMO+1 and LUMO+2. Numerical effort and "// &
     735             :                           "storage of RI-G0W0 increase linearly with this number. In case you "// &
     736             :                           "want to correct all virt. MOs, insert either a negative number or "// &
     737             :                           "a number larger than the number of virt. MOs. Invoking CORR_MOS_VIRT -2 "// &
     738             :                           "together with a BSE cutoff, sets a sufficiently large CORR_MOS_VIRT "// &
     739             :                           "for the given BSE cutoff deduced from DFT eigenvalues.", &
     740             :                           usage="CORR_VIRT 3", &
     741      118120 :                           default_i_val=10)
     742       59060 :       CALL section_add_keyword(section, keyword)
     743       59060 :       CALL keyword_release(keyword)
     744             : 
     745             :       CALL keyword_create(keyword, __LOCATION__, name="NUMB_POLES", &
     746             :                           description="Number of poles for the fitting. Usually, two poles are sufficient. ", &
     747             :                           usage="NUMB_POLES 2", &
     748       59060 :                           default_i_val=2)
     749       59060 :       CALL section_add_keyword(section, keyword)
     750       59060 :       CALL keyword_release(keyword)
     751             : 
     752             :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA_MAX_FIT", &
     753             :                           description="Determines fitting range for the self-energy on the imaginary axis: "// &
     754             :                           "[0, OMEGA_MAX_FIT] for virt orbitals, [-OMEGA_MAX_FIT,0] for occ orbitals. "// &
     755             :                           "Unit: Hartree. Default: 0.734996 H = 20 eV. ", &
     756             :                           usage="OMEGA_MAX_FIT 0.5", &
     757       59060 :                           default_r_val=0.734996_dp)
     758       59060 :       CALL section_add_keyword(section, keyword)
     759       59060 :       CALL keyword_release(keyword)
     760             : 
     761             :       CALL keyword_create(keyword, __LOCATION__, name="CROSSING_SEARCH", &
     762             :                           description="Determines, how the self_energy is evaluated on the real axis.", &
     763             :                           usage="CROSSING_SEARCH Z_SHOT", &
     764             :                           enum_c_vals=s2a("Z_SHOT", "NEWTON", "BISECTION"), &
     765             :                           enum_i_vals=(/ri_rpa_g0w0_crossing_z_shot, &
     766             :                                         ri_rpa_g0w0_crossing_newton, ri_rpa_g0w0_crossing_bisection/), &
     767             :                           enum_desc=s2a("Calculate the derivative of Sigma and out of it Z. Then extrapolate using Z.", &
     768             :                                         "Make a Newton-Raphson fix point iteration.", &
     769             :                                         "Make a bisection fix point iteration."), &
     770       59060 :                           default_i_val=ri_rpa_g0w0_crossing_newton)
     771       59060 :       CALL section_add_keyword(section, keyword)
     772       59060 :       CALL keyword_release(keyword)
     773             : 
     774             :       CALL keyword_create(keyword, __LOCATION__, name="FERMI_LEVEL_OFFSET", &
     775             :                           description="Fermi level for occ. orbitals: e_HOMO + FERMI_LEVEL_OFFSET; "// &
     776             :                           "Fermi level for virt. orbitals: e_LUMO - FERMI_LEVEL_OFFSET. "// &
     777             :                           "In case e_homo + FERMI_LEVEL_OFFSET < e_lumo - FERMI_LEVEL_OFFSET, "// &
     778             :                           "we set Fermi level = (e_HOMO+e_LUMO)/2. For cubic-scaling GW, the Fermi level "// &
     779             :                           "is always equal to (e_HOMO+e_LUMO)/2 regardless of FERMI_LEVEL_OFFSET.", &
     780             :                           usage="FERMI_LEVEL_OFFSET 1.0E-2", &
     781       59060 :                           default_r_val=2.0E-2_dp)
     782       59060 :       CALL section_add_keyword(section, keyword)
     783       59060 :       CALL keyword_release(keyword)
     784             : 
     785             :       CALL keyword_create(keyword, __LOCATION__, name="HEDIN_SHIFT", &
     786             :                           description="If true, use Hedin's shift in G0W0, evGW and evGW0 "// &
     787             :                           "(aka scGW0). Details see in Li et al. JCTC 18, 7570 "// &
     788             :                           "(2022), Figure 1. G0W0 with Hedin's shift should give "// &
     789             :                           "similar GW eigenvalues as evGW0; at a lower "// &
     790             :                           "computational cost.", &
     791             :                           usage="HEDIN_SHIFT", &
     792             :                           default_l_val=.FALSE., &
     793       59060 :                           lone_keyword_l_val=.TRUE.)
     794       59060 :       CALL section_add_keyword(section, keyword)
     795       59060 :       CALL keyword_release(keyword)
     796             : 
     797             :       CALL keyword_create(keyword, __LOCATION__, name="EV_GW_ITER", &
     798             :                           description="Maximum number of iterations for eigenvalue "// &
     799             :                           "self-consistency cycle. The computational effort of GW scales "// &
     800             :                           "linearly with this number. In case of choosing "// &
     801             :                           "GW_SELF_CONSISTENCY EVGW, the code sets EV_GW_ITER 10.", &
     802             :                           usage="EV_GW_ITER 3", &
     803       59060 :                           default_i_val=1)
     804       59060 :       CALL section_add_keyword(section, keyword)
     805       59060 :       CALL keyword_release(keyword)
     806             : 
     807             :       CALL keyword_create(keyword, __LOCATION__, name="SC_GW0_ITER", &
     808             :                           description="Maximum number of iterations for GW0 "// &
     809             :                           "self-consistency cycle. The computational effort "// &
     810             :                           "of GW is not much affected by the number of scGW0 cycles. "// &
     811             :                           "In case of choosing "// &
     812             :                           "GW_SELF_CONSISTENCY EVGW0, the code sets SC_GW0_ITER 10.", &
     813             :                           usage="SC_GW0_ITER 3", &
     814       59060 :                           default_i_val=1)
     815       59060 :       CALL section_add_keyword(section, keyword)
     816       59060 :       CALL keyword_release(keyword)
     817             : 
     818             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
     819             :                           description="Target accuracy for the eigenvalue self-consistency. "// &
     820             :                           "If the G0W0 HOMO-LUMO gap differs by less than the "// &
     821             :                           "target accuracy during the iteration, the eigenvalue "// &
     822             :                           "self-consistency cycle stops. Unit: Hartree.", &
     823             :                           usage="EPS_EV_SC_ITER 0.00005", &
     824             :                           default_r_val=cp_unit_to_cp2k(value=0.00136_dp, unit_str="eV"), &
     825       59060 :                           unit_str="eV")
     826             : 
     827       59060 :       CALL section_add_keyword(section, keyword)
     828       59060 :       CALL keyword_release(keyword)
     829             : 
     830             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_EXX", &
     831             :                           description="Print exchange self-energy minus exchange correlation potential for Gamma-only "// &
     832             :                           "calculation (PRINT). For a GW calculation with k-points we use this output as "// &
     833             :                           "exchange self-energy (READ). This is a temporary solution because the hybrid MPI/OMP "// &
     834             :                           "parallelization in the HFX by Manuel Guidon conflicts with the parallelization in "// &
     835             :                           "low-scaling GW k-points which is most efficient with maximum number of MPI tasks and "// &
     836             :                           "minimum number of OMP threads. For HFX by M. Guidon, the density matrix is "// &
     837             :                           "fully replicated on every MPI rank which necessitates a high number of OMP threads per MPI "// &
     838             :                           "rank for large systems to prevent out of memory. "// &
     839             :                           "Such a high number of OMP threads would slow down the GW calculation "// &
     840             :                           "severely. Therefore, it was decided to temporarily divide the GW k-point calculation in a "// &
     841             :                           "Gamma-only HF calculation with high number of OMP threads to prevent out of memory and "// &
     842             :                           "a GW k-point calculation with 1 OMP thread per MPI rank reading the previousHF output.", &
     843             :                           usage="PRINT_EXX TRUE", &
     844             :                           enum_c_vals=s2a("TRUE", "FALSE", "READ", "SKIP_FOR_REGTEST"), &
     845             :                           enum_i_vals=(/gw_print_exx, gw_no_print_exx, gw_read_exx, gw_skip_for_regtest/), &
     846             :                           enum_desc=s2a("Please, put TRUE for Gamma only calculation to get the exchange self-energy. "// &
     847             :                                         "If 'SIGMA_X' and the corresponding values for the exchange-energy are written, "// &
     848             :                                         "the writing has been successful", &
     849             :                                         "FALSE is needed if you want to do nothing here.", &
     850             :                                         "Please, put READ for the k-point GW calculation to read the exact exchange. "// &
     851             :                                         "You have to provide an output file including the exact exchange. This file "// &
     852             :                                         "has to be named 'exx.dat'.", &
     853             :                                         "SKIP_FOR_REGTEST is only used for the GW k-point regtest where no exchange "// &
     854             :                                         "self-energy is computed."), &
     855       59060 :                           default_i_val=gw_no_print_exx)
     856       59060 :       CALL section_add_keyword(section, keyword)
     857       59060 :       CALL keyword_release(keyword)
     858             : 
     859             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_SELF_ENERGY", &
     860             :                           description="If true, print the self-energy for all levels for real energy "// &
     861             :                           "together with the straight line to see the quasiparticle energy as intersection. "// &
     862             :                           "In addition, prints the self-energy for imaginary frequencies together with the Pade fit.", &
     863             :                           usage="SELF_ENERGY", &
     864             :                           default_l_val=.FALSE., &
     865       59060 :                           lone_keyword_l_val=.TRUE.)
     866       59060 :       CALL section_add_keyword(section, keyword)
     867       59060 :       CALL keyword_release(keyword)
     868             : 
     869             :       CALL keyword_create(keyword, __LOCATION__, name="RI_SIGMA_X", &
     870             :                           description="If true, the exchange self-energy is calculated approximatively with RI. "// &
     871             :                           "If false, the Hartree-Fock implementation in CP2K is used.", &
     872             :                           usage="RI_SIGMA_X", &
     873             :                           default_l_val=.TRUE., &
     874       59060 :                           lone_keyword_l_val=.TRUE.)
     875       59060 :       CALL section_add_keyword(section, keyword)
     876       59060 :       CALL keyword_release(keyword)
     877             : 
     878             :       CALL keyword_create(keyword, __LOCATION__, name="IC_CORR_LIST", &
     879             :                           description="List of image charge correction from a previous calculation to be applied in G0W0 "// &
     880             :                           "or evGW. Keyword is active, if the first entry is positive (since IC corrections are positive "// &
     881             :                           "occupied MOs. The start corresponds to the first corrected GW level.", &
     882             :                           usage="IC_CORR_LIST <REAL> ... <REAL>", &
     883             :                           default_r_vals=(/-1.0_dp/), &
     884       59060 :                           type_of_var=real_t, n_var=-1, unit_str="eV")
     885       59060 :       CALL section_add_keyword(section, keyword)
     886       59060 :       CALL keyword_release(keyword)
     887             : 
     888             :       CALL keyword_create(keyword, __LOCATION__, name="IC_CORR_LIST_BETA", &
     889             :                           description="IC_CORR_LIST for beta spins in case of open shell calculation.", &
     890             :                           usage="IC_CORR_LIST_BETA <REAL> ... <REAL>", &
     891             :                           default_r_vals=(/-1.0_dp/), &
     892       59060 :                           type_of_var=real_t, n_var=-1, unit_str="eV")
     893       59060 :       CALL section_add_keyword(section, keyword)
     894       59060 :       CALL keyword_release(keyword)
     895             : 
     896             :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC_CORRECTION", &
     897             :                           description="If true, the periodic correction scheme is used employing k-points. "// &
     898             :                           "Method is not recommended to use, use instead PERIODIC_LOW_SCALING which much "// &
     899             :                           "more accurate than the periodic correction.", &
     900             :                           usage="PERIODIC_CORRECTION", &
     901             :                           default_l_val=.FALSE., &
     902       59060 :                           lone_keyword_l_val=.TRUE.)
     903       59060 :       CALL section_add_keyword(section, keyword)
     904       59060 :       CALL keyword_release(keyword)
     905             : 
     906             :       CALL keyword_create(keyword, __LOCATION__, name="IMAGE_CHARGE_MODEL", &
     907             :                           variants=(/"IC"/), &
     908             :                           description="If true, an image charge model is applied to mimic the renormalization of "// &
     909             :                           "electronic levels of a molecule at a metallic surface. For this calculation, the molecule "// &
     910             :                           "has to be reflected on the desired xy image plane. The coordinates of the reflected molecule "// &
     911             :                           "have to be added to the coord file as ghost atoms. For the ghost atoms, identical basis sets "// &
     912             :                           "the normal atoms have to be used.", &
     913             :                           usage="IC TRUE", &
     914             :                           default_l_val=.FALSE., &
     915      118120 :                           lone_keyword_l_val=.TRUE.)
     916       59060 :       CALL section_add_keyword(section, keyword)
     917       59060 :       CALL keyword_release(keyword)
     918             : 
     919             :       CALL keyword_create(keyword, __LOCATION__, name="ANALYTIC_CONTINUATION", &
     920             :                           description="Defines which type of analytic continuation for the self energy is used", &
     921             :                           usage="ANALYTIC_CONTINUATION", &
     922             :                           enum_c_vals=s2a("TWO_POLE", "PADE"), &
     923             :                           enum_i_vals=(/gw_two_pole_model, gw_pade_approx/), &
     924             :                           enum_desc=s2a("Use 'two-pole' model.", &
     925             :                                         "Use Pade approximation."), &
     926       59060 :                           default_i_val=gw_pade_approx)
     927       59060 :       CALL section_add_keyword(section, keyword)
     928       59060 :       CALL keyword_release(keyword)
     929             : 
     930             :       CALL keyword_create(keyword, __LOCATION__, name="NPARAM_PADE", &
     931             :                           description="Number of parameters for the Pade approximation "// &
     932             :                           "when using the latter for the analytic continuation of the "// &
     933             :                           "self energy. 16 parameters (corresponding to 8 poles) are "// &
     934             :                           "are recommended.", &
     935             :                           usage="NPARAM_PADE 16", &
     936       59060 :                           default_i_val=16)
     937       59060 :       CALL section_add_keyword(section, keyword)
     938       59060 :       CALL keyword_release(keyword)
     939             : 
     940             :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA_ONLY_SIGMA", &
     941             :                           variants=(/"GAMMA"/), &
     942             :                           description="If true, the correlation self-energy is only computed at the Gamma point. "// &
     943             :                           "The Gamma point itself is obtained by averaging over all kpoints of the DFT mesh.", &
     944             :                           usage="GAMMA TRUE", &
     945             :                           default_l_val=.FALSE., &
     946      118120 :                           lone_keyword_l_val=.TRUE.)
     947       59060 :       CALL section_add_keyword(section, keyword)
     948       59060 :       CALL keyword_release(keyword)
     949             : 
     950             :       CALL keyword_create(keyword, __LOCATION__, name="UPDATE_XC_ENERGY", &
     951             :                           description="If true, the Hartree-Fock and RPA total energy are printed and the total energy "// &
     952             :                           "is corrected using exact exchange and the RPA correlation energy.", &
     953             :                           usage="UPDATE_XC_ENERGY", &
     954             :                           default_l_val=.FALSE., &
     955       59060 :                           lone_keyword_l_val=.TRUE.)
     956       59060 :       CALL section_add_keyword(section, keyword)
     957       59060 :       CALL keyword_release(keyword)
     958             : 
     959             :       CALL keyword_create(keyword, __LOCATION__, name="KPOINTS_SELF_ENERGY", &
     960             :                           description="Specify number of k-points for the k-point grid of the self-energy. Internally, a "// &
     961             :                           "Monkhorst-Pack grid is used. A dense k-point grid may be necessary to compute an accurate density "// &
     962             :                           "of state from GW. Large self-energy k-meshes do not cost much more computation time.", &
     963             :                           usage="KPOINTS  nx  ny  nz", repeats=.TRUE., &
     964       59060 :                           n_var=3, type_of_var=integer_t, default_i_vals=(/0, 0, 0/))
     965       59060 :       CALL section_add_keyword(section, keyword)
     966       59060 :       CALL keyword_release(keyword)
     967             : 
     968             :       CALL keyword_create(keyword, __LOCATION__, name="REGULARIZATION_MINIMAX", &
     969             :                           description="Tikhonov regularization for computing weights of the Fourier transform "// &
     970             :                           "from imaginary time to imaginary frequency and vice versa. Needed for large minimax "// &
     971             :                           "grids with 20 or more points and a small range.", &
     972             :                           usage="REGULARIZATION_MINIMAX 1.0E-6", &
     973       59060 :                           default_r_val=0.0_dp)
     974       59060 :       CALL section_add_keyword(section, keyword)
     975       59060 :       CALL keyword_release(keyword)
     976             : 
     977             :       CALL keyword_create(keyword, __LOCATION__, name="SOC", &
     978             :                           description="Calculate the spin-orbit splitting of the eigenvalues/band structure "// &
     979             :                           "using the spin-orbit part of the GTH pseudos parametrized in Hartwigsen, Goedecker, "// &
     980             :                           "Hutter, Phys. Rev. B 58, 3641 (1998), Eq. 19, "// &
     981             :                           "parameters in Table I.", &
     982             :                           usage="SOC", &
     983             :                           enum_c_vals=s2a("NONE", "LDA", "PBE"), &
     984             :                           enum_i_vals=(/soc_none, soc_lda, soc_pbe/), &
     985             :                           enum_desc=s2a("No SOC.", &
     986             :                                         "Use parameters from LDA (PADE) pseudopotential.", &
     987             :                                         "Use parameters from PBE pseudopotential."), &
     988       59060 :                           default_i_val=soc_none)
     989       59060 :       CALL section_add_keyword(section, keyword)
     990       59060 :       CALL keyword_release(keyword)
     991             : 
     992             :       CALL keyword_create(keyword, __LOCATION__, name="SOC_ENERGY_WINDOW", &
     993             :                           description="For perturbative SOC calculation, only "// &
     994             :                           "take frontier levels in an energy window "// &
     995             :                           "[E_HOMO - SOC_ENERGY_WINDOW/2 , E_LUMO + SOC_ENERGY_WINDOW/2 "// &
     996             :                           "into account for the diagonalization of H^GW,SOC.", &
     997             :                           usage="SOC_ENERGY_WINDOW 20.0_eV", &
     998             :                           default_r_val=cp_unit_to_cp2k(value=50.0_dp, unit_str="eV"), &
     999       59060 :                           unit_str="eV")
    1000       59060 :       CALL section_add_keyword(section, keyword)
    1001       59060 :       CALL keyword_release(keyword)
    1002             : 
    1003             :       ! here we generate a subsection for the periodic GW correction
    1004       59060 :       CALL create_periodic_gw_correction_section(subsection)
    1005       59060 :       CALL section_add_subsection(section, subsection)
    1006       59060 :       CALL section_release(subsection)
    1007             : 
    1008             :       ! here we generate a subsection for Bethe-Salpeter
    1009       59060 :       CALL create_bse_section(subsection)
    1010       59060 :       CALL section_add_subsection(section, subsection)
    1011       59060 :       CALL section_release(subsection)
    1012             : 
    1013             :       ! here we generate a subsection for image charge calculations
    1014       59060 :       CALL create_ic_section(subsection)
    1015       59060 :       CALL section_add_subsection(section, subsection)
    1016       59060 :       CALL section_release(subsection)
    1017             : 
    1018             :       ! here we generate a subsection for calculating the GW band structures
    1019       59060 :       CALL create_kpoint_set_section(subsection)
    1020       59060 :       CALL section_add_subsection(section, subsection)
    1021       59060 :       CALL section_release(subsection)
    1022             : 
    1023             :       ! here we generate a subsection for additional printing
    1024       59060 :       CALL create_print_section(subsection)
    1025       59060 :       CALL section_add_subsection(section, subsection)
    1026       59060 :       CALL section_release(subsection)
    1027             : 
    1028       59060 :    END SUBROUTINE create_ri_g0w0
    1029             : 
    1030             : ! **************************************************************************************************
    1031             : !> \brief ...
    1032             : !> \param section ...
    1033             : ! **************************************************************************************************
    1034       59060 :    SUBROUTINE create_print_section(section)
    1035             :       TYPE(section_type), POINTER                        :: section
    1036             : 
    1037             :       TYPE(keyword_type), POINTER                        :: keyword
    1038             :       TYPE(section_type), POINTER                        :: gw_dos_section, print_key
    1039             : 
    1040       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1041       59060 :       NULLIFY (print_key, keyword)
    1042       59060 :       NULLIFY (gw_dos_section, keyword)
    1043             :       CALL section_create(section, __LOCATION__, name="PRINT", &
    1044             :                           description="Section of possible print options specific for the GW code.", &
    1045       59060 :                           n_keywords=0, n_subsections=2, repeats=.FALSE.)
    1046             : 
    1047             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LOCAL_BANDGAP", &
    1048             :                                        description="Prints a local bandgap E_gap(r), derived from the local density of "// &
    1049             :                                        "states rho(r,E). Details and formulae in the SI of the periodic GW paper (2023).", &
    1050             :                                        print_level=high_print_level, add_last=add_last_numeric, &
    1051             :                                        filename="LOCAL_BANDGAP", &
    1052       59060 :                                        common_iter_levels=3)
    1053             : 
    1054             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_WINDOW", &
    1055             :                           description="Energy window in the LDOS for searching the gap.", &
    1056             :                           usage="ENERGY_WINDOW 6.0", &
    1057             :                           default_r_val=cp_unit_to_cp2k(value=6.0_dp, unit_str="eV"), &
    1058       59060 :                           unit_str="eV")
    1059       59060 :       CALL section_add_keyword(print_key, keyword)
    1060       59060 :       CALL keyword_release(keyword)
    1061             : 
    1062             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_SPACING", &
    1063             :                           description="Energy spacing of the LDOS for searching the gap.", &
    1064             :                           usage="ENERGY_SPACING 0.03", &
    1065             :                           default_r_val=cp_unit_to_cp2k(value=0.03_dp, unit_str="eV"), &
    1066       59060 :                           unit_str="eV")
    1067       59060 :       CALL section_add_keyword(print_key, keyword)
    1068       59060 :       CALL keyword_release(keyword)
    1069             : 
    1070             :       CALL keyword_create(keyword, __LOCATION__, name="LDOS_THRESHOLD_GAP", &
    1071             :                           description="Relative LDOS threshold that determines the local bandgap.", &
    1072             :                           usage="LDOS_THRESHOLD_GAP 0.1", &
    1073       59060 :                           default_r_val=0.1_dp)
    1074       59060 :       CALL section_add_keyword(print_key, keyword)
    1075       59060 :       CALL keyword_release(keyword)
    1076             : 
    1077             :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
    1078             :                           description="The stride (X,Y,Z) used to write the cube file "// &
    1079             :                           "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
    1080             :                           " 1 number valid for all components.", &
    1081       59060 :                           usage="STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=integer_t)
    1082       59060 :       CALL section_add_keyword(print_key, keyword)
    1083       59060 :       CALL keyword_release(keyword)
    1084             : 
    1085       59060 :       CALL section_add_subsection(section, print_key)
    1086       59060 :       CALL section_release(print_key)
    1087             : 
    1088             :       CALL section_create(gw_dos_section, __LOCATION__, name="GW_DOS", &
    1089             :                           description="Section for printing the spectral function.", &
    1090       59060 :                           n_keywords=6, n_subsections=0, repeats=.FALSE.)
    1091             : 
    1092             :       CALL keyword_create(keyword, __LOCATION__, name="LOWER_BOUND", &
    1093             :                           description="Lower bound for GW-DOS in eV.", &
    1094             :                           usage="GW_DOS_LOWER_BOUND -20.0", &
    1095             :                           default_r_val=cp_unit_to_cp2k(value=-20.0_dp, unit_str="eV"), &
    1096       59060 :                           unit_str="eV")
    1097       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1098       59060 :       CALL keyword_release(keyword)
    1099             : 
    1100             :       CALL keyword_create(keyword, __LOCATION__, name="UPPER_BOUND", &
    1101             :                           description="Upper bound for GW-DOS in eV.", &
    1102             :                           usage="GW_DOS_UPPER_BOUND 5.0", &
    1103             :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
    1104       59060 :                           unit_str="eV")
    1105       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1106       59060 :       CALL keyword_release(keyword)
    1107             : 
    1108             :       CALL keyword_create(keyword, __LOCATION__, name="STEP", &
    1109             :                           description="Difference of two consecutive energy levels for GW-DOS.", &
    1110             :                           usage="GW_DOS_PRECISION 0.1", &
    1111             :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
    1112       59060 :                           unit_str="eV")
    1113       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1114       59060 :       CALL keyword_release(keyword)
    1115             : 
    1116             :       CALL keyword_create(keyword, __LOCATION__, name="MIN_LEVEL_SPECTRAL", &
    1117             :                           description="Lowest energy level to print the self energy to files.", &
    1118             :                           usage="MIN_LEVEL_SELF_ENERGY 3", &
    1119       59060 :                           default_i_val=1)
    1120       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1121       59060 :       CALL keyword_release(keyword)
    1122             : 
    1123             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_LEVEL_SPECTRAL", &
    1124             :                           description="Highest energy level to print the self energy to files.", &
    1125             :                           usage="MAX_LEVEL_SELF_ENERGY 6", &
    1126       59060 :                           default_i_val=0)
    1127       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1128       59060 :       CALL keyword_release(keyword)
    1129             : 
    1130             :       CALL keyword_create(keyword, __LOCATION__, name="MIN_LEVEL_SELF_ENERGY", &
    1131             :                           description="Lowest energy level to print the self energy to files.", &
    1132             :                           usage="MIN_LEVEL_SELF_ENERGY 3", &
    1133       59060 :                           default_i_val=1)
    1134       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1135       59060 :       CALL keyword_release(keyword)
    1136             : 
    1137             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_LEVEL_SELF_ENERGY", &
    1138             :                           description="Highest energy level to print the self energy to files.", &
    1139             :                           usage="MAX_LEVEL_SELF_ENERGY 6", &
    1140       59060 :                           default_i_val=0)
    1141       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1142       59060 :       CALL keyword_release(keyword)
    1143             : 
    1144             :       CALL keyword_create(keyword, __LOCATION__, name="BROADENING", &
    1145             :                           description="Broadening parameter for spectral function.", &
    1146             :                           usage="BROADENING 0.001", &
    1147             :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="eV"), &
    1148       59060 :                           unit_str="eV")
    1149       59060 :       CALL section_add_keyword(gw_dos_section, keyword)
    1150       59060 :       CALL keyword_release(keyword)
    1151             : 
    1152       59060 :       CALL section_add_subsection(section, gw_dos_section)
    1153       59060 :       CALL section_release(gw_dos_section)
    1154             : 
    1155       59060 :    END SUBROUTINE
    1156             : 
    1157             : ! **************************************************************************************************
    1158             : !> \brief ...
    1159             : !> \param section ...
    1160             : ! **************************************************************************************************
    1161       59060 :    SUBROUTINE create_periodic_gw_correction_section(section)
    1162             :       TYPE(section_type), POINTER                        :: section
    1163             : 
    1164             :       TYPE(keyword_type), POINTER                        :: keyword
    1165             : 
    1166       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1167             :       CALL section_create(section, __LOCATION__, name="PERIODIC_CORRECTION", &
    1168             :                           description="Parameters influencing correction for periodic GW. Old method, "// &
    1169             :                           "not recommended to use", &
    1170       59060 :                           n_keywords=12, n_subsections=1, repeats=.FALSE.)
    1171             : 
    1172       59060 :       NULLIFY (keyword)
    1173             : 
    1174             :       CALL keyword_create(keyword, __LOCATION__, name="KPOINTS", &
    1175             :                           description="Specify number of k-points for a single k-point grid. Internally, a "// &
    1176             :                           "Monkhorst-Pack grid is used. Typically, even numbers are chosen such that the Gamma "// &
    1177             :                           "point is excluded from the k-point mesh.", &
    1178             :                           usage="KPOINTS  nx  ny  nz", repeats=.TRUE., &
    1179       59060 :                           n_var=3, type_of_var=integer_t, default_i_vals=(/16, 16, 16/))
    1180       59060 :       CALL section_add_keyword(section, keyword)
    1181       59060 :       CALL keyword_release(keyword)
    1182             : 
    1183             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_KP_GRIDS", &
    1184             :                           description="Number of k-point grids around the Gamma point with different resolution. "// &
    1185             :                           "E.g. for KPOINTS 4 4 4 and NUM_KP_GRIDS 3, there will be a 3x3x3 Monkhorst-Pack (MP) k-point "// &
    1186             :                           "grid for the whole Brillouin zone (excluding Gamma), another 3x3x3 MP grid with smaller  "// &
    1187             :                           "spacing around Gamma (again excluding Gamma) and a very fine 4x4x4 MP grid around Gamma.", &
    1188             :                           usage="NUM_KP_GRIDS 5", &
    1189       59060 :                           default_i_val=1)
    1190       59060 :       CALL section_add_keyword(section, keyword)
    1191       59060 :       CALL keyword_release(keyword)
    1192             : 
    1193             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_KPOINT", &
    1194             :                           description="If the absolute value of a k-point is below EPS_KPOINT, this kpoint is "// &
    1195             :                           "neglected since the Gamma point is not included in the periodic correction.", &
    1196             :                           usage="EPS_KPOINT 1.0E-4", &
    1197       59060 :                           default_r_val=1.0E-05_dp)
    1198       59060 :       CALL section_add_keyword(section, keyword)
    1199       59060 :       CALL keyword_release(keyword)
    1200             : 
    1201             :       CALL keyword_create(keyword, __LOCATION__, name="MO_COEFF_GAMMA", &
    1202             :                           description="If true, only the MO coefficients at the Gamma point are used for the periodic  "// &
    1203             :                           "correction. Otherwise, the MO coeffs are computed at every k-point which is much more "// &
    1204             :                           "expensive. It should be okay to use the Gamma MO coefficients.", &
    1205             :                           usage="MO_COEFF_GAMMA", &
    1206             :                           default_l_val=.TRUE., &
    1207       59060 :                           lone_keyword_l_val=.TRUE.)
    1208       59060 :       CALL section_add_keyword(section, keyword)
    1209       59060 :       CALL keyword_release(keyword)
    1210             : 
    1211             :       CALL keyword_create(keyword, __LOCATION__, name="AVERAGE_DEGENERATE_LEVELS", &
    1212             :                           variants=(/"ADL"/), &
    1213             :                           description="If true, the correlation self-energy of degenerate levels is averaged.", &
    1214             :                           usage="AVERAGE_DEGENERATE_LEVELS", &
    1215             :                           default_l_val=.TRUE., &
    1216      118120 :                           lone_keyword_l_val=.TRUE.)
    1217       59060 :       CALL section_add_keyword(section, keyword)
    1218       59060 :       CALL keyword_release(keyword)
    1219             : 
    1220             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_EIGENVAL", &
    1221             :                           description="Threshold for considering levels as degenerate. Unit: Hartree.", &
    1222             :                           usage="EPS_EIGENVAL 1.0E-5", &
    1223       59060 :                           default_r_val=2.0E-04_dp)
    1224       59060 :       CALL section_add_keyword(section, keyword)
    1225       59060 :       CALL keyword_release(keyword)
    1226             : 
    1227             :       CALL keyword_create(keyword, __LOCATION__, name="EXTRAPOLATE_KPOINTS", &
    1228             :                           variants=(/"EXTRAPOLATE"/), &
    1229             :                           description="If true, extrapolates the k-point mesh. Only working if k-point mesh numbers are "// &
    1230             :                           "divisible by 4, e.g. 8x8x8 or 12x12x12 is recommended.", &
    1231             :                           usage="EXTRAPOLATE_KPOINTS FALSE", &
    1232             :                           default_l_val=.TRUE., &
    1233      118120 :                           lone_keyword_l_val=.TRUE.)
    1234       59060 :       CALL section_add_keyword(section, keyword)
    1235       59060 :       CALL keyword_release(keyword)
    1236             : 
    1237             :       CALL keyword_create(keyword, __LOCATION__, name="DO_AUX_BAS_GW", &
    1238             :                           description="If true, use a different basis for the periodic correction. This can be necessary "// &
    1239             :                           "in case a diffused basis is used for GW to converge the HOMO-LUMO gap. In this case, "// &
    1240             :                           "numerical problems may occur due to diffuse functions in the basis. This keyword only works if "// &
    1241             :                           "AUX_GW <basis set>  is specified in the kind section for every atom kind.", &
    1242             :                           usage="AUX_BAS_GW TRUE", &
    1243             :                           default_l_val=.FALSE., &
    1244       59060 :                           lone_keyword_l_val=.TRUE.)
    1245       59060 :       CALL section_add_keyword(section, keyword)
    1246       59060 :       CALL keyword_release(keyword)
    1247             : 
    1248             :       CALL keyword_create(keyword, __LOCATION__, name="FRACTION_AUX_MOS", &
    1249             :                           description="Fraction how many MOs are used in the auxiliary basis.", &
    1250             :                           usage="FRACTION_AUX_MOS 0.6", &
    1251       59060 :                           default_r_val=0.5_dp)
    1252       59060 :       CALL section_add_keyword(section, keyword)
    1253       59060 :       CALL keyword_release(keyword)
    1254             : 
    1255             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_OMEGA_POINTS", &
    1256             :                           description="Number of Clenshaw-Curtis integration points for the periodic correction in cubic- "// &
    1257             :                           "scaling GW. This variable is a dummy variable for canonical N^4 GW calculations.", &
    1258             :                           usage="NUM_OMEGA_POINTS 200", &
    1259       59060 :                           default_i_val=300)
    1260       59060 :       CALL section_add_keyword(section, keyword)
    1261       59060 :       CALL keyword_release(keyword)
    1262             : 
    1263       59060 :    END SUBROUTINE
    1264             : 
    1265             : ! **************************************************************************************************
    1266             : !> \brief ...
    1267             : !> \param section ...
    1268             : ! **************************************************************************************************
    1269       59060 :    SUBROUTINE create_bse_section(section)
    1270             :       TYPE(section_type), POINTER                        :: section
    1271             : 
    1272             :       TYPE(keyword_type), POINTER                        :: keyword
    1273             :       TYPE(section_type), POINTER                        :: subsection
    1274             : 
    1275       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1276             :       CALL section_create(section, __LOCATION__, name="BSE", &
    1277             :                           description="Parameters for a calculation solving the Bethe-Salpeter equation "// &
    1278             :                           "(BSE) for electronic excitations. The full BSE "// &
    1279             :                           "$\left( \begin{array}{cc}A &  B\\B &  A\end{array} \right)$ "// &
    1280             :                           "$\left( \begin{array}{cc}\mathbf{X}^{(n)}\\\mathbf{Y}^{(n)}\end{array} \right) = "// &
    1281             :                           "\Omega^{(n)}\left(\begin{array}{cc}1&0\\0&-1\end{array}\right)$ "// &
    1282             :                           "$\left(\begin{array}{cc}\mathbf{X}^{(n)}\\\mathbf{Y}^{(n)}\end{array}\right)$ "// &
    1283             :                           "enables of electronic excitation energies $\Omega^{(n)}$. The BSE can be solved by diagonalizing "// &
    1284             :                           "the full ABBA-matrix or by setting B=0, i.e. within the Tamm-Dancoff approximation (TDA). "// &
    1285             :                          "Preliminary reference: Eq. (35) in PRB 92, 045209 (2015); http://dx.doi.org/10.1103/PhysRevB.92.045209", &
    1286       59060 :                           n_keywords=8, n_subsections=3, repeats=.FALSE.)
    1287             : 
    1288       59060 :       NULLIFY (keyword)
    1289             : 
    1290             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1291             :                           description="Activates BSE calculations.", &
    1292             :                           usage="&BSE .TRUE.", &
    1293       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1294       59060 :       CALL section_add_keyword(section, keyword)
    1295       59060 :       CALL keyword_release(keyword)
    1296             : 
    1297             :       CALL keyword_create(keyword, __LOCATION__, name="SPIN_CONFIG", &
    1298             :                           description="Choose between calculation of singlet or triplet excitation (cf. given Reference above).", &
    1299             :                           usage="SPIN_CONFIG TRIPLET", &
    1300             :                           enum_c_vals=s2a("SINGLET", "TRIPLET"), &
    1301             :                           enum_i_vals=(/bse_singlet, bse_triplet/), &
    1302             :                           enum_desc=s2a("Computes singlet excitations.", &
    1303             :                                         "Computes triplet excitations."), &
    1304       59060 :                           default_i_val=bse_singlet)
    1305       59060 :       CALL section_add_keyword(section, keyword)
    1306       59060 :       CALL keyword_release(keyword)
    1307             : 
    1308             :       CALL keyword_create(keyword, __LOCATION__, name="BSE_DIAG_METHOD", &
    1309             :                           description="Method for BSE calculations. "// &
    1310             :                           "Choose between full or iterative diagonalization.", &
    1311             :                           usage="&BSE_DIAG_METHOD FULLDIAG", &
    1312             :                           enum_c_vals=s2a("FULLDIAG", "ITERDIAG"), &
    1313             :                           enum_i_vals=(/bse_fulldiag, bse_iterdiag/), &
    1314             :                           enum_desc=s2a("Fully diagonalizes the BSE matrices within the chosen level of approximation.", &
    1315             :                                         "Iterative diagonalization has not been implemented yet."), &
    1316       59060 :                           default_i_val=bse_fulldiag)
    1317       59060 :       CALL section_add_keyword(section, keyword)
    1318       59060 :       CALL keyword_release(keyword)
    1319             : 
    1320             :       CALL keyword_create(keyword, __LOCATION__, name="TDA", &
    1321             :                           description="Level of approximation applied to BSE calculations. "// &
    1322             :                           "Choose between Tamm Dancoff approximation (TDA) and/or diagonalization of the full ABBA-matrix.", &
    1323             :                           usage="&TDA ON", &
    1324             :                           enum_c_vals=s2a("ON", "OFF", "TDA+ABBA"), &
    1325             :                           enum_i_vals=(/bse_tda, bse_abba, bse_both/), &
    1326             :                           enum_desc=s2a("The TDA is applied, i.e. B=0.", &
    1327             :                                         "The ABBA-matrix is diagonalized, i.e. the TDA is not applied.", &
    1328             :                                         "The BSE is solved within the TDA (B=0) as well as for the full ABBA-matrix."), &
    1329       59060 :                           default_i_val=bse_tda)
    1330       59060 :       CALL section_add_keyword(section, keyword)
    1331       59060 :       CALL keyword_release(keyword)
    1332             : 
    1333             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_CUTOFF_OCC", &
    1334             :                           description="Remove all orbitals with indices i,j from A_ia,jb and B_ia,jb with energy difference "// &
    1335             :                           "to HOMO level larger than the given energy cutoff, i.e. "// &
    1336             :                "$\varepsilon_i\in[\varepsilon_{i=\text{HOMO}}^{GW}-E_\text{cut}^\text{occ},\varepsilon_{i=\text{HOMO}}^{GW}]$. "// &
    1337             :                           "Can be used to accelerate runtime and reduce memory consumption.", &
    1338             :                           usage="ENERGY_CUTOFF_OCC 10.0", unit_str="eV", &
    1339       59060 :                           type_of_var=real_t, default_r_val=-1.0_dp)
    1340       59060 :       CALL section_add_keyword(section, keyword)
    1341       59060 :       CALL keyword_release(keyword)
    1342             : 
    1343             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_CUTOFF_EMPTY", &
    1344             :                           description="Remove all orbitals with indices a,b from A_ia,jb and B_ia,jb with energy difference "// &
    1345             :                           "to LUMO level larger than the given energy cutoff, i.e. "// &
    1346             :              "$\varepsilon_a\in[\varepsilon_{a=\text{LUMO}}^{GW},\varepsilon_{a=\text{LUMO}}^{GW}+E_\text{cut}^\text{empty}]$. "// &
    1347             :                           "Can be used to accelerate runtime and reduce memory consumption.", &
    1348             :                           usage="ENERGY_CUTOFF_EMPTY 10.0", unit_str="eV", &
    1349       59060 :                           type_of_var=real_t, default_r_val=-1.0_dp)
    1350       59060 :       CALL section_add_keyword(section, keyword)
    1351       59060 :       CALL keyword_release(keyword)
    1352             : 
    1353             :       CALL keyword_create(keyword, __LOCATION__, name="BSE_DEBUG_PRINT", &
    1354             :                           description="Activates debug print statements in the BSE calculation.", &
    1355             :                           usage="&BSE_DEBUG_PRINT .TRUE.", &
    1356       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1357       59060 :       CALL section_add_keyword(section, keyword)
    1358       59060 :       CALL keyword_release(keyword)
    1359             : 
    1360             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_PRINT_EXC", &
    1361             :                           description="Number of printed excitation energies. Does not affect computation time.", &
    1362             :                           usage="NUM_PRINT_EXC 25", &
    1363       59060 :                           default_i_val=25)
    1364       59060 :       CALL section_add_keyword(section, keyword)
    1365       59060 :       CALL keyword_release(keyword)
    1366             : 
    1367             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_X", &
    1368             :                           description="Threshold for printing contributions of singleparticle "// &
    1369             :                           "transitions, i.e. elements of the eigenvector $X_{ia}^{(n)}$.", &
    1370             :                           usage="EPS_X 0.1", &
    1371       59060 :                           type_of_var=real_t, default_r_val=0.1_dp)
    1372       59060 :       CALL section_add_keyword(section, keyword)
    1373       59060 :       CALL keyword_release(keyword)
    1374             : 
    1375       59060 :       NULLIFY (subsection)
    1376       59060 :       CALL create_bse_iterat_section(subsection)
    1377       59060 :       CALL section_add_subsection(section, subsection)
    1378       59060 :       CALL section_release(subsection)
    1379             : 
    1380       59060 :       NULLIFY (subsection)
    1381       59060 :       CALL create_bse_spectrum_section(subsection)
    1382       59060 :       CALL section_add_subsection(section, subsection)
    1383       59060 :       CALL section_release(subsection)
    1384             : 
    1385       59060 :    END SUBROUTINE
    1386             : 
    1387       59060 :    SUBROUTINE create_bse_spectrum_section(section)
    1388             :       TYPE(section_type), POINTER                        :: section
    1389             : 
    1390             :       TYPE(keyword_type), POINTER                        :: keyword
    1391             : 
    1392       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1393             :       CALL section_create(section, __LOCATION__, name="BSE_SPECTRUM", &
    1394             :                           description="Parameters influencing the output of the optical spectrum "// &
    1395             :                           "obtained from a BSE calculation.", &
    1396       59060 :                           n_keywords=9, n_subsections=0, repeats=.FALSE.)
    1397             : 
    1398       59060 :       NULLIFY (keyword)
    1399             : 
    1400             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1401             :                           description="Activates printing of optical spectrum after a BSE calculation.", &
    1402             :                           usage="&BSE .TRUE.", &
    1403       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1404       59060 :       CALL section_add_keyword(section, keyword)
    1405       59060 :       CALL keyword_release(keyword)
    1406             : 
    1407             :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY_STEP_SIZE", &
    1408             :                           description="Step size of frequencies for the optical spectrum.", &
    1409             :                           usage="FREQUENCY_STEP_SIZE 0.1", unit_str="eV", &
    1410             :                           type_of_var=real_t, &
    1411       59060 :                           default_r_val=cp_unit_to_cp2k(value=0.1_dp, unit_str="eV"))
    1412       59060 :       CALL section_add_keyword(section, keyword)
    1413       59060 :       CALL keyword_release(keyword)
    1414             : 
    1415             :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY_STARTING_POINT", &
    1416             :                           description="First frequency to print in the optical spectrum.", &
    1417             :                           usage="FREQUENCY_STARTING_POINT 0", unit_str="eV", &
    1418       59060 :                           type_of_var=real_t, default_r_val=0.0_dp)
    1419       59060 :       CALL section_add_keyword(section, keyword)
    1420       59060 :       CALL keyword_release(keyword)
    1421             : 
    1422             :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY_END_POINT", &
    1423             :                           description="Last frequency to print in the optical spectrum.", &
    1424             :                           usage="FREQUENCY_END_POINT 0", unit_str="eV", &
    1425             :                           type_of_var=real_t, &
    1426       59060 :                           default_r_val=cp_unit_to_cp2k(value=100.0_dp, unit_str="eV"))
    1427       59060 :       CALL section_add_keyword(section, keyword)
    1428       59060 :       CALL keyword_release(keyword)
    1429             : 
    1430             :       CALL keyword_create(keyword, __LOCATION__, name="ETA_LIST", &
    1431             :                           description="List of broadening of the peaks in the optical spectrum.", &
    1432             :                           usage="ETA_LIST 0.01 ...", unit_str="eV", &
    1433             :                           default_r_vals=(/0.01_dp/), &
    1434       59060 :                           type_of_var=real_t, n_var=-1)
    1435       59060 :       CALL section_add_keyword(section, keyword)
    1436       59060 :       CALL keyword_release(keyword)
    1437             : 
    1438       59060 :    END SUBROUTINE
    1439             : 
    1440             : ! **************************************************************************************************
    1441             : !> \brief ...
    1442             : !> \param section ...
    1443             : ! **************************************************************************************************
    1444       59060 :    SUBROUTINE create_bse_iterat_section(section)
    1445             :       TYPE(section_type), POINTER                        :: section
    1446             : 
    1447             :       TYPE(keyword_type), POINTER                        :: keyword
    1448             : 
    1449       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1450             :       CALL section_create(section, __LOCATION__, name="BSE_ITERAT", &
    1451             :                           description="Parameters influencing the iterative Bethe-Salpeter calculation. "// &
    1452             :                           "The iterative solver has not been fully implemented yet.", &
    1453       59060 :                           n_keywords=9, n_subsections=0, repeats=.FALSE.)
    1454             : 
    1455       59060 :       NULLIFY (keyword)
    1456             : 
    1457             :       CALL keyword_create(keyword, __LOCATION__, name="DAVIDSON_ABORT_COND", &
    1458             :                           description="Desired abortion condition for Davidson solver", &
    1459             :                           usage="DAVIDSON_ABORT_COND OR", &
    1460             :                           enum_c_vals=s2a("EN", "RES", "OR"), &
    1461             :                           enum_i_vals=(/bse_iter_en_cond, bse_iter_res_cond, bse_iter_both_cond/), &
    1462             :                           enum_desc=s2a("Uses energy threshold for successfully exiting solver.", &
    1463             :                                         "Uses residual threshold for successfully exiting solver.", &
    1464             :                                         "Uses either energy or residual threshold for successfully exiting solver."), &
    1465       59060 :                           default_i_val=bse_iter_en_cond)
    1466       59060 :       CALL section_add_keyword(section, keyword)
    1467       59060 :       CALL keyword_release(keyword)
    1468             : 
    1469             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_EXC_EN", &
    1470             :                           description="Number of lowest excitation energies to be computed.", &
    1471             :                           usage="NUM_EXC_EN 3", &
    1472       59060 :                           default_i_val=3)
    1473       59060 :       CALL section_add_keyword(section, keyword)
    1474       59060 :       CALL keyword_release(keyword)
    1475             : 
    1476             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_ADD_START_Z_SPACE", &
    1477             :                           description="Determines the initial dimension of the subspace as "// &
    1478             :                           "dim = (NUM_EXC_EN+NUM_ADD_START_Z_SPACE)", &
    1479             :                           usage="NUM_ADD_START_Z_SPACE 1", &
    1480       59060 :                           default_i_val=0)
    1481       59060 :       CALL section_add_keyword(section, keyword)
    1482       59060 :       CALL keyword_release(keyword)
    1483             : 
    1484             :       CALL keyword_create(keyword, __LOCATION__, name="FAC_MAX_Z_SPACE", &
    1485             :                           description="Factor to determine maximum dimension of the Davidson subspace. "// &
    1486             :                           "dimension = (NUM_EXC_EN+NUM_ADD_START_Z_SPACE)*FAC_MAX_Z_SPACE", &
    1487             :                           usage="FAC_MAX_Z_SPACE 5", &
    1488       59060 :                           default_i_val=5)
    1489       59060 :       CALL section_add_keyword(section, keyword)
    1490       59060 :       CALL keyword_release(keyword)
    1491             : 
    1492             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_NEW_T", &
    1493             :                           description="Number of new t vectors added. "// &
    1494             :                           "Must be smaller/equals (NUM_EXC_EN+NUM_ADD_START_Z_SPACE)", &
    1495             :                           usage="NUM_NEW_T 4", &
    1496       59060 :                           default_i_val=1)
    1497       59060 :       CALL section_add_keyword(section, keyword)
    1498       59060 :       CALL keyword_release(keyword)
    1499             : 
    1500             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RES", &
    1501             :                           description="Threshold for stopping the iteration for computing the transition energies. "// &
    1502             :                           "If the residuals inside the Davidson space change by less than EPS_RES (in eV), the iteration "// &
    1503             :                           "stops.", &
    1504             :                           usage="EPS_RES 0.001", unit_str="eV", &
    1505       59060 :                           type_of_var=real_t, default_r_val=0.001_dp)
    1506       59060 :       CALL section_add_keyword(section, keyword)
    1507       59060 :       CALL keyword_release(keyword)
    1508             : 
    1509             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_EXC_EN", &
    1510             :                           description="Threshold for stopping the iteration for computing the transition energies. "// &
    1511             :                           "If the desired excitation energies change by less than EPS_EXC_EN (in eV), the iteration "// &
    1512             :                           "stops.", &
    1513             :                           usage="EPS_EXC_EN 0.001", unit_str="eV", &
    1514       59060 :                           type_of_var=real_t, default_r_val=0.001_dp)
    1515       59060 :       CALL section_add_keyword(section, keyword)
    1516       59060 :       CALL keyword_release(keyword)
    1517             : 
    1518             :       CALL keyword_create(keyword, __LOCATION__, name="NUM_DAVIDSON_ITER", &
    1519             :                           description="Maximum number of iterations for determining the transition energies.", &
    1520             :                           usage="MAX_ITER 100", &
    1521       59060 :                           default_i_val=100)
    1522       59060 :       CALL section_add_keyword(section, keyword)
    1523       59060 :       CALL keyword_release(keyword)
    1524             : 
    1525             :       CALL keyword_create(keyword, __LOCATION__, name="Z_SPACE_ENERGY_CUTOFF", &
    1526             :                           description="Cutoff (in eV) for maximal energy difference entering the A matrix. "// &
    1527             :                           "Per default and for negative values, there is no cutoff applied.", &
    1528             :                           usage="Z_SPACE_ENERGY_CUTOFF 60", unit_str="eV", &
    1529       59060 :                           type_of_var=real_t, default_r_val=-1.0_dp)
    1530       59060 :       CALL section_add_keyword(section, keyword)
    1531       59060 :       CALL keyword_release(keyword)
    1532       59060 :    END SUBROUTINE
    1533             : 
    1534             : ! **************************************************************************************************
    1535             : !> \brief ...
    1536             : !> \param section ...
    1537             : ! **************************************************************************************************
    1538       59060 :    SUBROUTINE create_ic_section(section)
    1539             :       TYPE(section_type), POINTER                        :: section
    1540             : 
    1541             :       TYPE(keyword_type), POINTER                        :: keyword
    1542             : 
    1543       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1544             :       CALL section_create(section, __LOCATION__, name="IC", &
    1545             :                           description="Parameters influencing the image charge correction. "// &
    1546             :                           "The image plane is always an xy plane, so adjust the molecule according "// &
    1547             :                           "to that. ", &
    1548       59060 :                           n_keywords=3, n_subsections=1, repeats=.FALSE.)
    1549             : 
    1550       59060 :       NULLIFY (keyword)
    1551             : 
    1552             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_IC_LIST", &
    1553             :                           description="If true, the image charge correction values are printed in a list, "// &
    1554             :                           "such that it can be used as input for a subsequent evGW calculation.", &
    1555             :                           usage="PRINT_IC_VALUES", &
    1556             :                           default_l_val=.FALSE., &
    1557       59060 :                           lone_keyword_l_val=.TRUE.)
    1558       59060 :       CALL section_add_keyword(section, keyword)
    1559       59060 :       CALL keyword_release(keyword)
    1560             : 
    1561             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DIST", &
    1562             :                           description="Threshold where molecule and image molecule have to coincide. ", &
    1563             :                           usage="EPS_DIST 0.1", unit_str="angstrom", &
    1564       59060 :                           type_of_var=real_t, default_r_val=3.0E-02_dp, repeats=.FALSE.)
    1565       59060 :       CALL section_add_keyword(section, keyword)
    1566       59060 :       CALL keyword_release(keyword)
    1567             : 
    1568       59060 :    END SUBROUTINE
    1569             : 
    1570             : ! **************************************************************************************************
    1571             : !> \brief ...
    1572             : !> \param section ...
    1573             : ! **************************************************************************************************
    1574       59060 :    SUBROUTINE create_low_scaling(section)
    1575             :       TYPE(section_type), POINTER                        :: section
    1576             : 
    1577             :       TYPE(keyword_type), POINTER                        :: keyword
    1578             :       TYPE(section_type), POINTER                        :: subsection
    1579             : 
    1580       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1581             :       CALL section_create( &
    1582             :          section, __LOCATION__, name="LOW_SCALING", &
    1583             :          description="Cubic scaling RI-RPA, GW and Laplace-SOS-MP2 method using the imaginary time formalism. "// &
    1584             :          "EPS_GRID in WFC_GPW section controls accuracy / req. memory for 3-center integrals. "// &
    1585             :          "SORT_BASIS EXP should be specified in DFT section.", &
    1586             :          n_keywords=12, n_subsections=2, repeats=.FALSE., &
    1587      236240 :          citations=(/Wilhelm2016b, Wilhelm2018, Bussy2023/))
    1588             : 
    1589       59060 :       NULLIFY (keyword)
    1590             :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1591             :                           description="Activates cubic-scaling RPA, GW and Laplace-SOS-MP2 calculations.", &
    1592             :                           usage="&LOW_SCALING .TRUE.", &
    1593       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1594       59060 :       CALL section_add_keyword(section, keyword)
    1595       59060 :       CALL keyword_release(keyword)
    1596             : 
    1597             :       CALL keyword_create(keyword, __LOCATION__, name="MEMORY_CUT", &
    1598             :                           description="Reduces memory for sparse tensor contractions by this factor. "// &
    1599             :                           "A high value leads to some loss of performance. "// &
    1600             :                           "This memory reduction factor applies to storage of the tensors 'M occ' / 'M virt' "// &
    1601             :                           "but does not reduce storage of '3c ints'.", &
    1602             :                           usage="MEMORY_CUT 16", &
    1603       59060 :                           default_i_val=5)
    1604       59060 :       CALL section_add_keyword(section, keyword)
    1605       59060 :       CALL keyword_release(keyword)
    1606             : 
    1607             :       CALL keyword_create(keyword, __LOCATION__, name="MEMORY_INFO", &
    1608             :                           description="Decide whether to print memory info on the sparse matrices.", &
    1609             :                           usage="MEMORY_INFO", &
    1610             :                           default_l_val=.FALSE., &
    1611       59060 :                           lone_keyword_l_val=.TRUE.)
    1612       59060 :       CALL section_add_keyword(section, keyword)
    1613       59060 :       CALL keyword_release(keyword)
    1614             : 
    1615             :       CALL keyword_create( &
    1616             :          keyword, __LOCATION__, name="EPS_FILTER", &
    1617             :          description="Determines a threshold for the DBCSR based multiply. "// &
    1618             :          "Normally, this EPS_FILTER determines accuracy and timing of low-scaling RPA and GW calculations.", &
    1619             :          usage="EPS_FILTER 1.0E-10 ", type_of_var=real_t, &
    1620       59060 :          default_r_val=1.0E-9_dp)
    1621       59060 :       CALL section_add_keyword(section, keyword)
    1622       59060 :       CALL keyword_release(keyword)
    1623             : 
    1624             :       CALL keyword_create( &
    1625             :          keyword, __LOCATION__, name="EPS_FILTER_FACTOR", &
    1626             :          description="Multiply EPS_FILTER with this factor to determine filter epsilon "// &
    1627             :          "for DBCSR based multiply P(it)=(Mocc(it))^T*Mvirt(it) "// &
    1628             :          "Default should be kept.", &
    1629             :          type_of_var=real_t, &
    1630       59060 :          default_r_val=10.0_dp)
    1631       59060 :       CALL section_add_keyword(section, keyword)
    1632       59060 :       CALL keyword_release(keyword)
    1633             : 
    1634             :       CALL keyword_create( &
    1635             :          keyword, __LOCATION__, &
    1636             :          name="EPS_STORAGE_SCALING", &
    1637             :          variants=(/"EPS_STORAGE"/), &
    1638             :          description="Scaling factor to scale EPS_FILTER. Storage threshold for compression "// &
    1639             :          "will be EPS_FILTER*EPS_STORAGE_SCALING.", &
    1640      118120 :          default_r_val=1.0E-3_dp)
    1641       59060 :       CALL section_add_keyword(section, keyword)
    1642       59060 :       CALL keyword_release(keyword)
    1643             : 
    1644             :       CALL keyword_create( &
    1645             :          keyword, __LOCATION__, &
    1646             :          name="DO_KPOINTS", &
    1647             :          description="Besides in DFT, this keyword has to be switched on if one wants to do kpoints in. "// &
    1648             :          "cubic RPA.", &
    1649             :          usage="DO_KPOINTS", &
    1650             :          default_l_val=.FALSE., &
    1651       59060 :          lone_keyword_l_val=.TRUE.)
    1652       59060 :       CALL section_add_keyword(section, keyword)
    1653       59060 :       CALL keyword_release(keyword)
    1654             : 
    1655             :       CALL keyword_create( &
    1656             :          keyword, __LOCATION__, name="KPOINTS", &
    1657             :          description="Keyword activates periodic, low-scaling GW calculations (&LOW_SCALING section also needed). "// &
    1658             :          "For periodic calculations, kpoints are used for the density response, the "// &
    1659             :          "Coulomb interaction and the screened Coulomb interaction. For 2d periodic systems, e.g. xz "// &
    1660             :          "periodicity, please also specify KPOINTS, e.g.  N_x  1  N_z.", &
    1661             :          usage="KPOINTS  N_x  N_y  N_z", &
    1662       59060 :          n_var=3, type_of_var=integer_t, default_i_vals=(/0, 0, 0/))
    1663       59060 :       CALL section_add_keyword(section, keyword)
    1664       59060 :       CALL keyword_release(keyword)
    1665             : 
    1666             :       CALL keyword_create( &
    1667             :          keyword, __LOCATION__, &
    1668             :          name="KPOINT_WEIGHTS_W", &
    1669             :          description="For kpoints in low-scaling GW, a Monkhorst-Pack mesh is used. The screened Coulomb "// &
    1670             :          "interaction W(k) needs special care near the Gamma point (e.g. in 3d, W(k) diverges at the "// &
    1671             :          "Gamma point with W(k) ~ k^alpha). KPOINT_WEIGHTS_W decides how the weights of the "// &
    1672             :          "Monkhorst-Pack mesh are chosen to compute W(R) = int_BZ W(k) exp(ikR) dk (BZ=Brllouin zone). ", &
    1673             :          usage="KPOINT_WEIGHTS_W AUTO", &
    1674             :          enum_c_vals=s2a("TAILORED", "AUTO", "UNIFORM"), &
    1675             :          enum_i_vals=(/kp_weights_W_tailored, kp_weights_W_auto, kp_weights_W_uniform/), &
    1676             :          enum_desc=s2a("Choose k-point integration weights such that the function f(k)=k^alpha is "// &
    1677             :                        "exactly integrated. alpha is specified using EXPONENT_TAILORED_WEIGHTS.", &
    1678             :                        "As 'TAILORED', but alpha is chosen automatically according to dimensionality "// &
    1679             :                        "(3D: alpha = -2 for 3D, 2D: alpha = -1 for exchange self-energy, uniform "// &
    1680             :                        "weights for correlation self-energy).", &
    1681             :                        "Choose the same weight for every k-point (original Monkhorst-Pack method)."), &
    1682       59060 :          default_i_val=kp_weights_W_uniform)
    1683       59060 :       CALL section_add_keyword(section, keyword)
    1684       59060 :       CALL keyword_release(keyword)
    1685             : 
    1686             :       CALL keyword_create( &
    1687             :          keyword, __LOCATION__, &
    1688             :          name="EXPONENT_TAILORED_WEIGHTS", &
    1689             :          description="Gives the exponent of exactly integrated function in case 'KPOINT_WEIGHTS_W "// &
    1690             :          "TAILORED' is chosen.", &
    1691             :          usage="EXPONENT_TAILORED_WEIGHTS -2", &
    1692       59060 :          default_r_val=-2.0_dp)
    1693       59060 :       CALL section_add_keyword(section, keyword)
    1694       59060 :       CALL keyword_release(keyword)
    1695             : 
    1696             :       CALL keyword_create( &
    1697             :          keyword, __LOCATION__, &
    1698             :          name="REGULARIZATION_RI", &
    1699             :          description="Parameter to reduce the expansion coefficients in RI for periodic GW. Larger parameter "// &
    1700             :          "means smaller expansion coefficients that leads to a more stable calculation at the price "// &
    1701             :          "of a slightly worse RI approximation. In case the parameter 0.0 is chosen, ordinary RI is used.", &
    1702             :          usage="REGULARIZATION_RI 1.0E-4", &
    1703       59060 :          default_r_val=0.0_dp)
    1704       59060 :       CALL section_add_keyword(section, keyword)
    1705       59060 :       CALL keyword_release(keyword)
    1706             : 
    1707             :       CALL keyword_create( &
    1708             :          keyword, __LOCATION__, &
    1709             :          name="EPS_EIGVAL_S", &
    1710             :          description="Parameter to reduce the expansion coefficients in RI for periodic GW. Removes all "// &
    1711             :          "eigenvectors and eigenvalues of S_PQ(k) that are smaller than EPS_EIGVAL_S. ", &
    1712             :          usage="EPS_EIGVAL_S 1.0E-3", &
    1713       59060 :          default_r_val=0.0_dp)
    1714       59060 :       CALL section_add_keyword(section, keyword)
    1715       59060 :       CALL keyword_release(keyword)
    1716             : 
    1717             :       CALL keyword_create( &
    1718             :          keyword, __LOCATION__, &
    1719             :          name="EPS_EIGVAL_S_GAMMA", &
    1720             :          description="Parameter to reduce the expansion coefficients in RI for periodic GW. Removes all "// &
    1721             :          "eigenvectors and eigenvalues of M_PQ(k=0) that are smaller than EPS_EIGVAL_S. ", &
    1722             :          usage="EPS_EIGVAL_S 1.0E-3", &
    1723       59060 :          default_r_val=0.0_dp)
    1724       59060 :       CALL section_add_keyword(section, keyword)
    1725       59060 :       CALL keyword_release(keyword)
    1726             : 
    1727             :       CALL keyword_create( &
    1728             :          keyword, __LOCATION__, &
    1729             :          name="MAKE_CHI_POS_DEFINITE", &
    1730             :          description="If true, makes eigenvalue decomposition of chi(iw,k) and removes negative "// &
    1731             :          "eigenvalues. May increase computational cost significantly. Only recommended to try in case "// &
    1732             :          "Cholesky decomposition of epsilon(iw,k) fails.", &
    1733             :          usage="MAKE_CHI_POS_DEFINITE", &
    1734             :          default_l_val=.TRUE., &
    1735       59060 :          lone_keyword_l_val=.TRUE.)
    1736       59060 :       CALL section_add_keyword(section, keyword)
    1737       59060 :       CALL keyword_release(keyword)
    1738             : 
    1739             :       CALL keyword_create( &
    1740             :          keyword, __LOCATION__, &
    1741             :          name="MAKE_OVERLAP_MAT_AO_POS_DEFINITE", &
    1742             :          description="If true, makes eigenvalue decomposition of S_mu,nu(k) and removes negative "// &
    1743             :          "eigenvalues. Slightly increases computational cost. Only recommended to try in case "// &
    1744             :          "Cholesky decomposition of S_mu,nu(k) fails (error message: Cholesky decompose failed: "// &
    1745             :          "matrix is not positive definite or ill-conditioned; when calling create_kp_and_calc_kp_orbitals).", &
    1746             :          usage="MAKE_OVERLAP_MAT_AO_POS_DEFINITE", &
    1747             :          default_l_val=.FALSE., &
    1748       59060 :          lone_keyword_l_val=.TRUE.)
    1749       59060 :       CALL section_add_keyword(section, keyword)
    1750       59060 :       CALL keyword_release(keyword)
    1751             : 
    1752             :       CALL keyword_create( &
    1753             :          keyword, __LOCATION__, &
    1754             :          name="DO_EXTRAPOLATE_KPOINTS", &
    1755             :          description="If true, use a larger k-mesh to extrapolate the k-point integration of W. "// &
    1756             :          "For example, in 2D, when using  KPOINTS 4 4 1, an additional 6x6x1 mesh will be used to "// &
    1757             :          "extrapolate the k-point integration of W with N_k^-0.5, where Nk is the number of k-points.", &
    1758             :          usage="DO_EXTRAPOLATE_KPOINTS FALSE", &
    1759             :          default_l_val=.TRUE., &
    1760       59060 :          lone_keyword_l_val=.TRUE.)
    1761       59060 :       CALL section_add_keyword(section, keyword)
    1762       59060 :       CALL keyword_release(keyword)
    1763             : 
    1764             :       CALL keyword_create( &
    1765             :          keyword, __LOCATION__, &
    1766             :          name="TRUNC_COULOMB_RI_X", &
    1767             :          description="If true, use the truncated Coulomb operator for the exchange-self-energy in "// &
    1768             :          "periodic GW.", &
    1769             :          usage="TRUNC_COULOMB_RI_X", &
    1770             :          default_l_val=.TRUE., &
    1771       59060 :          lone_keyword_l_val=.TRUE.)
    1772       59060 :       CALL section_add_keyword(section, keyword)
    1773       59060 :       CALL keyword_release(keyword)
    1774             : 
    1775             :       CALL keyword_create( &
    1776             :          keyword, __LOCATION__, &
    1777             :          name="REL_CUTOFF_TRUNC_COULOMB_RI_X", &
    1778             :          description="Only active in case TRUNC_COULOMB_RI_X = True. Normally, relative cutoff = 0.5 is "// &
    1779             :          "good choice; still needs to be evaluated for RI schemes. ", &
    1780             :          usage="REL_CUTOFF_TRUNC_COULOMB_RI_X 0.3", &
    1781       59060 :          default_r_val=0.5_dp)
    1782       59060 :       CALL section_add_keyword(section, keyword)
    1783       59060 :       CALL keyword_release(keyword)
    1784             : 
    1785             :       CALL keyword_create( &
    1786             :          keyword, __LOCATION__, &
    1787             :          name="KEEP_QUADRATURE", &
    1788             :          variants=s2a("KEEP_WEIGHTS", "KEEP_QUAD", "KEEP_WEIGHT"), &
    1789             :          description="Keep the Laplace quadrature defined at the first energy evaluations throughout "// &
    1790             :          "the run. Allows to have consistent force evaluations.", &
    1791             :          usage="KEEP_QUADRATURE", &
    1792             :          default_l_val=.TRUE., &
    1793       59060 :          lone_keyword_l_val=.TRUE.)
    1794       59060 :       CALL section_add_keyword(section, keyword)
    1795       59060 :       CALL keyword_release(keyword)
    1796             : 
    1797             :       CALL keyword_create( &
    1798             :          keyword, __LOCATION__, &
    1799             :          name="K_MESH_G_FACTOR", &
    1800             :          description="The k-mesh for the Green's function can be chosen to be larger than the k-mesh for "// &
    1801             :          "W (without much higher computational cost). The factor given here multiplies the mesh for W to obtain "// &
    1802             :          "the k-mesh for G. Example: factor 4, k-mesh for W: 4x4x1 -> k-mesh for G: 16x16x1 (z-dir. is "// &
    1803             :          "non-periodic).", &
    1804       59060 :          default_i_val=1)
    1805       59060 :       CALL section_add_keyword(section, keyword)
    1806       59060 :       CALL keyword_release(keyword)
    1807             : 
    1808             :       CALL keyword_create( &
    1809             :          keyword, __LOCATION__, &
    1810             :          name="MIN_BLOCK_SIZE", &
    1811             :          description="Minimum tensor block size. Adjusting this value may have minor effect on "// &
    1812             :          "performance but default should be good enough.", &
    1813       59060 :          default_i_val=5)
    1814       59060 :       CALL section_add_keyword(section, keyword)
    1815       59060 :       CALL keyword_release(keyword)
    1816             : 
    1817             :       CALL keyword_create( &
    1818             :          keyword, __LOCATION__, &
    1819             :          name="MIN_BLOCK_SIZE_MO", &
    1820             :          description="Tensor block size for MOs. Only relevant for GW calculations. "// &
    1821             :          "The memory consumption of GW scales as O(MIN_BLOCK_SIZE_MO). It is recommended to "// &
    1822             :          "set this parameter to a smaller number if GW runs out of memory. "// &
    1823             :          "Otherwise the default should not be changed.", &
    1824       59060 :          default_i_val=64)
    1825       59060 :       CALL section_add_keyword(section, keyword)
    1826       59060 :       CALL keyword_release(keyword)
    1827             : 
    1828       59060 :       NULLIFY (subsection)
    1829       59060 :       CALL create_low_scaling_cphf(subsection)
    1830       59060 :       CALL section_add_subsection(section, subsection)
    1831       59060 :       CALL section_release(subsection)
    1832             : 
    1833       59060 :    END SUBROUTINE
    1834             : 
    1835             : ! **************************************************************************************************
    1836             : !> \brief ...
    1837             : !> \param section ...
    1838             : ! **************************************************************************************************
    1839       59060 :    SUBROUTINE create_wfc_gpw(section)
    1840             :       TYPE(section_type), POINTER                        :: section
    1841             : 
    1842             :       TYPE(keyword_type), POINTER                        :: keyword
    1843             : 
    1844       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1845             :       CALL section_create(section, __LOCATION__, name="WFC_GPW", &
    1846             :                           description="Parameters for the GPW approach in Wavefunction-based Correlation methods", &
    1847       59060 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    1848             : 
    1849       59060 :       NULLIFY (keyword)
    1850             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GRID", &
    1851             :                           description="Determines a threshold for the GPW based integration", &
    1852             :                           usage="EPS_GRID 1.0E-9 ", type_of_var=real_t, &
    1853       59060 :                           default_r_val=1.0E-8_dp)
    1854       59060 :       CALL section_add_keyword(section, keyword)
    1855       59060 :       CALL keyword_release(keyword)
    1856             : 
    1857             :       CALL keyword_create( &
    1858             :          keyword, __LOCATION__, name="EPS_FILTER", &
    1859             :          description="Determines a threshold for the DBCSR based multiply (usually 10 times smaller than EPS_GRID). "// &
    1860             :          "Normally, this EPS_FILTER determines accuracy and timing of cubic-scaling RPA calculation.", &
    1861             :          usage="EPS_FILTER 1.0E-10 ", type_of_var=real_t, &
    1862       59060 :          default_r_val=1.0E-9_dp)
    1863       59060 :       CALL section_add_keyword(section, keyword)
    1864       59060 :       CALL keyword_release(keyword)
    1865             : 
    1866             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
    1867             :                           description="The cutoff of the finest grid level in the MP2 gpw integration.", &
    1868             :                           usage="CUTOFF 300", type_of_var=real_t, &
    1869       59060 :                           default_r_val=300.0_dp)
    1870       59060 :       CALL section_add_keyword(section, keyword)
    1871       59060 :       CALL keyword_release(keyword)
    1872             : 
    1873             :       CALL keyword_create(keyword, __LOCATION__, name="REL_CUTOFF", &
    1874             :                           variants=(/"RELATIVE_CUTOFF"/), &
    1875             :                           description="Determines the grid at which a Gaussian is mapped.", &
    1876             :                           usage="REL_CUTOFF 50", type_of_var=real_t, &
    1877      118120 :                           default_r_val=50.0_dp)
    1878       59060 :       CALL section_add_keyword(section, keyword)
    1879       59060 :       CALL keyword_release(keyword)
    1880             : 
    1881             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
    1882             :                           variants=(/"IOLEVEL"/), &
    1883             :                           description="How much output is written by the individual groups.", &
    1884             :                           usage="PRINT_LEVEL HIGH", &
    1885             :                           default_i_val=silent_print_level, enum_c_vals= &
    1886             :                           s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
    1887             :                           enum_desc=s2a("Almost no output", &
    1888             :                                         "Little output", "Quite some output", "Lots of output", &
    1889             :                                         "Everything is written out, useful for debugging purposes only"), &
    1890             :                           enum_i_vals=(/silent_print_level, low_print_level, medium_print_level, &
    1891      118120 :                                         high_print_level, debug_print_level/))
    1892       59060 :       CALL section_add_keyword(section, keyword)
    1893       59060 :       CALL keyword_release(keyword)
    1894             : 
    1895             :       CALL keyword_create( &
    1896             :          keyword, __LOCATION__, name="EPS_PGF_ORB_S", &
    1897             :          description="Screening for overlap matrix in RI. Usually, it is best to choose this parameter "// &
    1898             :          "to be very small since the inversion of overlap matrix might be ill-conditioned.", &
    1899             :          usage="EPS_PGF_ORB_S 1.0E-10 ", type_of_var=real_t, &
    1900       59060 :          default_r_val=1.0E-10_dp)
    1901       59060 :       CALL section_add_keyword(section, keyword)
    1902       59060 :       CALL keyword_release(keyword)
    1903             : 
    1904       59060 :    END SUBROUTINE create_wfc_gpw
    1905             : 
    1906             : ! **************************************************************************************************
    1907             : !> \brief ...
    1908             : !> \param section ...
    1909             : ! **************************************************************************************************
    1910       59060 :    SUBROUTINE create_cphf(section)
    1911             :       TYPE(section_type), POINTER                        :: section
    1912             : 
    1913             :       TYPE(keyword_type), POINTER                        :: keyword
    1914             : 
    1915       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    1916             :       CALL section_create( &
    1917             :          section, __LOCATION__, name="CPHF", &
    1918             :          description="Parameters influencing the solution of the Z-vector equations in MP2 gradients calculations.", &
    1919             :          n_keywords=2, n_subsections=0, repeats=.FALSE., &
    1920      118120 :          citations=(/DelBen2013/))
    1921             : 
    1922       59060 :       NULLIFY (keyword)
    1923             : 
    1924             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    1925             :                           variants=(/"MAX_NUM_ITER"/), &
    1926             :                           description="Maximum number of iterations allowed for the solution of the Z-vector equations.", &
    1927             :                           usage="MAX_ITER  50", &
    1928      118120 :                           default_i_val=30)
    1929       59060 :       CALL section_add_keyword(section, keyword)
    1930       59060 :       CALL keyword_release(keyword)
    1931             : 
    1932             :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_EVERY", &
    1933             :                           description="Restart iteration every given number of steps.", &
    1934             :                           usage="RESTART_EVERY 5", &
    1935       59060 :                           default_i_val=5)
    1936       59060 :       CALL section_add_keyword(section, keyword)
    1937       59060 :       CALL keyword_release(keyword)
    1938             : 
    1939             :       CALL keyword_create(keyword, __LOCATION__, name="SOLVER_METHOD", &
    1940             :                           description="Chose solver of the z-vector equations.", &
    1941             :                           usage="SOLVER_METHOD POPLE", enum_c_vals= &
    1942             :                           s2a("POPLE", "CG", "RICHARDSON", "SD"), &
    1943             :                           enum_desc=s2a("Pople's method (Default).", &
    1944             :                                         "Conjugated gradient method (equivalent to Pople).", &
    1945             :                                         "Richardson iteration", &
    1946             :                                         "Steepest Descent iteration"), &
    1947             :                           enum_i_vals=(/z_solver_pople, z_solver_cg, z_solver_richardson, z_solver_sd/), &
    1948       59060 :                           default_i_val=z_solver_pople)
    1949       59060 :       CALL section_add_keyword(section, keyword)
    1950       59060 :       CALL keyword_release(keyword)
    1951             : 
    1952             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CONV", &
    1953             :                           description="Convergence threshold for the solution of the Z-vector equations. "// &
    1954             :                           "The Z-vector equations have the form of a linear system of equations Ax=b, "// &
    1955             :                           "convergence is achieved when |Ax-b|<=EPS_CONV.", &
    1956             :                           usage="EPS_CONV 1.0E-6", type_of_var=real_t, &
    1957       59060 :                           default_r_val=1.0E-4_dp)
    1958       59060 :       CALL section_add_keyword(section, keyword)
    1959       59060 :       CALL keyword_release(keyword)
    1960             : 
    1961             :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_STEP_SIZE", &
    1962             :                           description="Scaling factor of each step.", &
    1963             :                           usage="SCALE_STEP_SIZE 1.0", &
    1964       59060 :                           default_r_val=1.0_dp)
    1965       59060 :       CALL section_add_keyword(section, keyword)
    1966       59060 :       CALL keyword_release(keyword)
    1967             : 
    1968             :       CALL keyword_create(keyword, __LOCATION__, name="ENFORCE_DECREASE", &
    1969             :                           description="Restarts if residual does not decrease.", &
    1970             :                           usage="ENFORCE_DECREASE T", &
    1971             :                           lone_keyword_l_val=.TRUE., &
    1972       59060 :                           default_l_val=.FALSE.)
    1973       59060 :       CALL section_add_keyword(section, keyword)
    1974       59060 :       CALL keyword_release(keyword)
    1975             : 
    1976             :       CALL keyword_create(keyword, __LOCATION__, name="DO_POLAK_RIBIERE", &
    1977             :                           description="Use a Polak-Ribiere update of the search vector in CG instead of the Fletcher "// &
    1978             :                           "Reeves update. Improves the convergence with modified step sizes. "// &
    1979             :                           "Ignored with other methods than CG.", &
    1980             :                           usage="ENFORCE_DECREASE T", &
    1981             :                           lone_keyword_l_val=.TRUE., &
    1982       59060 :                           default_l_val=.FALSE.)
    1983       59060 :       CALL section_add_keyword(section, keyword)
    1984       59060 :       CALL keyword_release(keyword)
    1985             : 
    1986             :       CALL keyword_create(keyword, __LOCATION__, name="RECALC_RESIDUAL", &
    1987             :                           description="Recalculates residual in every step.", &
    1988             :                           usage="RECALC_RESIDUAL T", &
    1989             :                           lone_keyword_l_val=.TRUE., &
    1990       59060 :                           default_l_val=.FALSE.)
    1991       59060 :       CALL section_add_keyword(section, keyword)
    1992       59060 :       CALL keyword_release(keyword)
    1993             : 
    1994       59060 :    END SUBROUTINE create_cphf
    1995             : 
    1996             : ! **************************************************************************************************
    1997             : !> \brief ...
    1998             : !> \param section ...
    1999             : ! **************************************************************************************************
    2000       59060 :    SUBROUTINE create_low_scaling_cphf(section)
    2001             :       TYPE(section_type), POINTER                        :: section
    2002             : 
    2003             :       TYPE(keyword_type), POINTER                        :: keyword
    2004             : 
    2005       59060 :       NULLIFY (keyword)
    2006             : 
    2007       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    2008             :       CALL section_create(section, __LOCATION__, name="CPHF", &
    2009             :                           description="Parameters influencing the solution of the Z-vector equations "// &
    2010             :                           "in low-scaling Laplace-SOS-MP2 gradients calculations.", &
    2011       59060 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    2012             : 
    2013             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CONV", &
    2014             :                           description="Target accuracy for Z-vector euation solution.", &
    2015       59060 :                           usage="EPS 1.e-6", default_r_val=1.e-6_dp)
    2016       59060 :       CALL section_add_keyword(section, keyword)
    2017       59060 :       CALL keyword_release(keyword)
    2018             : 
    2019             :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
    2020             :                           description="Maximum number of conjugate gradient iteration to be performed for one optimization.", &
    2021       59060 :                           usage="MAX_ITER 200", default_i_val=50)
    2022       59060 :       CALL section_add_keyword(section, keyword)
    2023       59060 :       CALL keyword_release(keyword)
    2024             : 
    2025             :       CALL keyword_create( &
    2026             :          keyword, __LOCATION__, name="PRECONDITIONER", &
    2027             :          description="Type of preconditioner to be used with all minimization schemes. "// &
    2028             :          "They differ in effectiveness, cost of construction, cost of application. "// &
    2029             :          "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
    2030             :          usage="PRECONDITIONER FULL_ALL", &
    2031             :          default_i_val=ot_precond_full_all, &
    2032             :          enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_SINGLE", "FULL_KINETIC", "FULL_S_INVERSE", &
    2033             :                          "NONE"), &
    2034             :          enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
    2035             :                        "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
    2036             :                        "This preconditioner is recommended for almost all systems, except very large systems where "// &
    2037             :                        "make_preconditioner would dominate the total computational cost.", &
    2038             :                        "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
    2039             :                        "but cheaper to construct, "// &
    2040             :                        "might be somewhat less robust. Recommended for large systems.", &
    2041             :                        "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
    2042             :                        "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
    2043             :                        "use for very large systems.", &
    2044             :                        "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
    2045             :                        "skip preconditioning"), &
    2046             :          enum_i_vals=(/ot_precond_full_all, ot_precond_full_single_inverse, ot_precond_full_single, &
    2047       59060 :                        ot_precond_full_kinetic, ot_precond_s_inverse, ot_precond_none/))
    2048       59060 :       CALL section_add_keyword(section, keyword)
    2049       59060 :       CALL keyword_release(keyword)
    2050             : 
    2051             :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_GAP", &
    2052             :                           description="Energy gap estimate [a.u.] for preconditioning", &
    2053             :                           usage="ENERGY_GAP 0.1", &
    2054       59060 :                           default_r_val=0.2_dp)
    2055       59060 :       CALL section_add_keyword(section, keyword)
    2056       59060 :       CALL keyword_release(keyword)
    2057             : 
    2058       59060 :    END SUBROUTINE create_low_scaling_cphf
    2059             : 
    2060             : ! **************************************************************************************************
    2061             : !> \brief ...
    2062             : !> \param section ...
    2063             : ! **************************************************************************************************
    2064       59060 :    SUBROUTINE create_mp2_potential(section)
    2065             :       TYPE(section_type), POINTER                        :: section
    2066             : 
    2067             :       TYPE(keyword_type), POINTER                        :: keyword
    2068             : 
    2069       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    2070             :       CALL section_create(section, __LOCATION__, name="INTERACTION_POTENTIAL", &
    2071             :                           description="Parameters the interaction potential in computing the biel integrals", &
    2072       59060 :                           n_keywords=4, n_subsections=0, repeats=.FALSE.)
    2073             : 
    2074       59060 :       NULLIFY (keyword)
    2075             :       CALL keyword_create( &
    2076             :          keyword, __LOCATION__, &
    2077             :          name="POTENTIAL_TYPE", &
    2078             :          description="Which interaction potential should be used "// &
    2079             :          "(Coulomb, TShPSC operator).", &
    2080             :          usage="POTENTIAL_TYPE TSHPSC", &
    2081             :          enum_c_vals=s2a("COULOMB", "TShPSC", "LONGRANGE", "SHORTRANGE", "TRUNCATED", "MIX_CL", "IDENTITY"), &
    2082             :          enum_i_vals=(/do_potential_coulomb, &
    2083             :                        do_potential_TShPSC, &
    2084             :                        do_potential_long, &
    2085             :                        do_potential_short, &
    2086             :                        do_potential_truncated, &
    2087             :                        do_potential_mix_cl, &
    2088             :                        do_potential_id/), &
    2089             :          enum_desc=s2a("Coulomb potential: 1/r", &
    2090             :                        "| Range | TShPSC |"//newline// &
    2091             :                        "| ----- | ------ |"//newline// &
    2092             :                        "| $ x \leq R_c $ | $ 1/x - s/R_c $ |"//newline// &
    2093             :                        "| $ R_c < x \leq nR_c $ | "// &
    2094             :                        "$ (1 - s)/R_c - (x - R_c)/R_c^2 + (x - R_c)^2/R_c^3 - "// &
    2095             :                        "(2n^2 - 7n + 9 - 4s)(x - R_c)^3/(R_c^4(n^2 - 2n + 1)(n - 1)) + "// &
    2096             :                        "(6-3s - 4n + n^2)(x - R_c)^4/(R_c^5(n^4 - 4n^3 + 6n^2 - 4n + 1)) $ "// &
    2097             :                        "(4th order polynomial) | "//newline// &
    2098             :                        "| $ x > nR_c $ | $ 0 $ | "//newline, &
    2099             :                        "Longrange Coulomb potential: $ \operatorname{erf}(wr)/r $", &
    2100             :                        "Shortrange Coulomb potential: $ \operatorname{erfc}(wr)/r $", &
    2101             :                        "Truncated Coulomb potential", &
    2102             :                        "Mixed Coulomb/Longrange Coulomb potential", &
    2103             :                        "Delta potential"), &
    2104       59060 :          default_i_val=do_potential_coulomb)
    2105       59060 :       CALL section_add_keyword(section, keyword)
    2106       59060 :       CALL keyword_release(keyword)
    2107             : 
    2108             :       CALL keyword_create(keyword, __LOCATION__, name="TRUNCATION_RADIUS", &
    2109             :                           variants=(/"CUTOFF_RADIUS"/), &
    2110             :                           description="Determines truncation radius for the truncated potentials. "// &
    2111             :                           "Only valid when doing truncated calculations", &
    2112             :                           usage="TRUNCATION_RADIUS 10.0", type_of_var=real_t, &
    2113             :                           default_r_val=10.0_dp, &
    2114      118120 :                           unit_str="angstrom")
    2115       59060 :       CALL section_add_keyword(section, keyword)
    2116       59060 :       CALL keyword_release(keyword)
    2117             : 
    2118             :       CALL keyword_create( &
    2119             :          keyword, __LOCATION__, &
    2120             :          name="POTENTIAL_DATA", &
    2121             :          variants=s2a("TShPSC_DATA", "T_C_G_DATA"), &
    2122             :          description="Location of the file TShPSC.dat or t_c_g.dat that contains the data for the "// &
    2123             :          "evaluation of the evaluation of the truncated potentials", &
    2124             :          usage="TShPSC_DATA t_sh_p_s_c.dat", &
    2125       59060 :          default_c_val="t_sh_p_s_c.dat")
    2126       59060 :       CALL section_add_keyword(section, keyword)
    2127       59060 :       CALL keyword_release(keyword)
    2128             : 
    2129             :       CALL keyword_create( &
    2130             :          keyword, __LOCATION__, &
    2131             :          name="OMEGA", &
    2132             :          description="Range separation parameter for the longrange or shortrange potential. "// &
    2133             :          "Only valid when longrange or shortrange potential is requested.", &
    2134             :          usage="OMEGA 0.5", type_of_var=real_t, &
    2135       59060 :          default_r_val=0.5_dp)
    2136       59060 :       CALL section_add_keyword(section, keyword)
    2137       59060 :       CALL keyword_release(keyword)
    2138             : 
    2139             :       CALL keyword_create( &
    2140             :          keyword, __LOCATION__, &
    2141             :          name="SCALE_COULOMB", &
    2142             :          description="Scaling factor of (truncated) Coulomb potential in mixed (truncated) Coulomb/Longrange potential. "// &
    2143             :          "Only valid when mixed potential is requested.", &
    2144             :          usage="OMEGA 0.5", type_of_var=real_t, &
    2145       59060 :          default_r_val=1.0_dp)
    2146       59060 :       CALL section_add_keyword(section, keyword)
    2147       59060 :       CALL keyword_release(keyword)
    2148             : 
    2149             :       CALL keyword_create( &
    2150             :          keyword, __LOCATION__, &
    2151             :          name="SCALE_LONGRANGE", &
    2152             :          description="Scaling factor of longrange Coulomb potential in mixed (truncated) Coulomb/Longrange potential. "// &
    2153             :          "Only valid when mixed potential is requested.", &
    2154             :          usage="OMEGA 0.5", type_of_var=real_t, &
    2155       59060 :          default_r_val=1.0_dp)
    2156       59060 :       CALL section_add_keyword(section, keyword)
    2157       59060 :       CALL keyword_release(keyword)
    2158             : 
    2159       59060 :    END SUBROUTINE create_mp2_potential
    2160             : 
    2161             : ! **************************************************************************************************
    2162             : !> \brief ...
    2163             : !> \param section ...
    2164             : ! **************************************************************************************************
    2165       59060 :    SUBROUTINE create_ri_section(section)
    2166             :       TYPE(section_type), POINTER                        :: section
    2167             : 
    2168             :       TYPE(keyword_type), POINTER                        :: keyword
    2169             :       TYPE(section_type), POINTER                        :: subsection
    2170             : 
    2171       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    2172             :       CALL section_create(section, __LOCATION__, name="RI", &
    2173             :                           description="Parameters influencing resolution of the identity (RI) that is "// &
    2174             :                           "used in RI-MP2, RI-RPA, RI-SOS-MP2 and GW (inside RI-RPA).", &
    2175       59060 :                           n_keywords=6, n_subsections=2, repeats=.FALSE.)
    2176             : 
    2177       59060 :       NULLIFY (subsection)
    2178       59060 :       CALL create_RI_metric_section(subsection)
    2179       59060 :       CALL section_add_subsection(section, subsection)
    2180       59060 :       CALL section_release(subsection)
    2181             : 
    2182       59060 :       CALL create_opt_ri_basis(subsection)
    2183       59060 :       CALL section_add_subsection(section, subsection)
    2184       59060 :       CALL section_release(subsection)
    2185             : 
    2186       59060 :       NULLIFY (keyword)
    2187             :       CALL keyword_create( &
    2188             :          keyword, __LOCATION__, &
    2189             :          name="ROW_BLOCK", &
    2190             :          variants=(/"ROW_BLOCK_SIZE"/), &
    2191             :          description="Size of the row block used in the SCALAPACK block cyclic data distribution. "// &
    2192             :          "Default is (ROW_BLOCK=-1) is automatic. "// &
    2193             :          "A proper choice can speedup the parallel matrix multiplication in the case of RI-RPA and RI-SOS-MP2-Laplace.", &
    2194             :          usage="ROW_BLOCK 512", &
    2195      118120 :          default_i_val=-1)
    2196       59060 :       CALL section_add_keyword(section, keyword)
    2197       59060 :       CALL keyword_release(keyword)
    2198             : 
    2199             :       CALL keyword_create( &
    2200             :          keyword, __LOCATION__, &
    2201             :          name="COL_BLOCK", &
    2202             :          variants=(/"COL_BLOCK_SIZE"/), &
    2203             :          description="Size of the column block used in the SCALAPACK block cyclic data distribution. "// &
    2204             :          "Default is (COL_BLOCK=-1) is automatic. "// &
    2205             :          "A proper choice can speedup the parallel matrix multiplication in the case of RI-RPA and RI-SOS-MP2-Laplace.", &
    2206             :          usage="COL_BLOCK 512", &
    2207      118120 :          default_i_val=-1)
    2208       59060 :       CALL section_add_keyword(section, keyword)
    2209       59060 :       CALL keyword_release(keyword)
    2210             : 
    2211             :       CALL keyword_create( &
    2212             :          keyword, __LOCATION__, &
    2213             :          name="CALC_COND_NUM", &
    2214             :          variants=(/"CALC_CONDITION_NUMBER"/), &
    2215             :          description="Calculate the condition number of the (P|Q) matrix for the RI methods.", &
    2216             :          usage="CALC_COND_NUM", &
    2217             :          default_l_val=.FALSE., &
    2218      118120 :          lone_keyword_l_val=.TRUE.)
    2219       59060 :       CALL section_add_keyword(section, keyword)
    2220       59060 :       CALL keyword_release(keyword)
    2221             : 
    2222             :       CALL keyword_create(keyword, __LOCATION__, name="DO_SVD", &
    2223             :                           description="Wether to perform a singular value decomposition instead of the Cholesky decomposition "// &
    2224             :                           "of the potential operator in the RI basis. Computationally expensive but numerically more stable. "// &
    2225             :                           "It reduces the computational costs of some subsequent steps. Recommended when a longrange Coulomb "// &
    2226             :                           "potential is employed.", &
    2227             :                           usage="DO_SVD  .TRUE.", &
    2228       59060 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2229       59060 :       CALL section_add_keyword(section, keyword)
    2230       59060 :       CALL keyword_release(keyword)
    2231             : 
    2232             :       CALL keyword_create(keyword, __LOCATION__, name="ERI_BLKSIZE", &
    2233             :                           description="block sizes for tensors (only used if ERI_METHOD=MME). First value "// &
    2234             :                           "is the block size for ORB basis, second value is the block size for RI_AUX basis.", &
    2235             :                           usage="ERI_BLKSIZE", &
    2236             :                           n_var=2, &
    2237       59060 :                           default_i_vals=(/4, 16/))
    2238       59060 :       CALL section_add_keyword(section, keyword)
    2239       59060 :       CALL keyword_release(keyword)
    2240             : 
    2241       59060 :    END SUBROUTINE create_ri_section
    2242             : 
    2243             : ! **************************************************************************************************
    2244             : !> \brief ...
    2245             : !> \param section ...
    2246             : ! **************************************************************************************************
    2247       59060 :    SUBROUTINE create_integrals_section(section)
    2248             :       TYPE(section_type), POINTER                        :: section
    2249             : 
    2250             :       TYPE(keyword_type), POINTER                        :: keyword
    2251             :       TYPE(section_type), POINTER                        :: subsection
    2252             : 
    2253       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    2254             :       CALL section_create(section, __LOCATION__, name="INTEGRALS", &
    2255             :                           description="Parameters controlling how to compute integrals that are needed "// &
    2256             :                           "in MP2, RI-MP2, RI-RPA, RI-SOS-MP2 and GW (inside RI-RPA).", &
    2257       59060 :                           n_keywords=2, n_subsections=3, repeats=.FALSE.)
    2258             : 
    2259       59060 :       NULLIFY (subsection)
    2260       59060 :       CALL create_eri_mme_section(subsection)
    2261       59060 :       CALL section_add_subsection(section, subsection)
    2262       59060 :       CALL section_release(subsection)
    2263             : 
    2264       59060 :       CALL create_wfc_gpw(subsection)
    2265       59060 :       CALL section_add_subsection(section, subsection)
    2266       59060 :       CALL section_release(subsection)
    2267             : 
    2268       59060 :       CALL create_mp2_potential(subsection)
    2269       59060 :       CALL section_add_subsection(section, subsection)
    2270       59060 :       CALL section_release(subsection)
    2271             : 
    2272       59060 :       NULLIFY (keyword)
    2273             :       CALL keyword_create(keyword, __LOCATION__, name="ERI_METHOD", &
    2274             :                           description="Method for calculating periodic electron repulsion integrals "// &
    2275             :                           "(MME method is faster but experimental, forces not yet implemented). "// &
    2276             :                           "Obara-Saika (OS) for the Coulomb operator can only be used for non-periodic calculations.", &
    2277             :                           usage="ERI_METHOD MME", &
    2278             :                           enum_c_vals=s2a("DEFAULT", "GPW", "MME", "OS"), &
    2279             :                           enum_i_vals=(/eri_default, do_eri_gpw, do_eri_mme, do_eri_os/), &
    2280             :                           enum_desc=s2a("Use default ERI method (for periodic systems: GPW, for molecules: OS, "// &
    2281             :                                         "for MP2 and RI-MP2: GPW in any case).", &
    2282             :                                         "Uses Gaussian Plane Wave method [DelBen2013].", &
    2283             :                                         "Uses MiniMax-Ewald method (experimental, ERI_MME subsection, only for fully periodic "// &
    2284             :                                         "systems with orthorhombic cells).", &
    2285             :                                         "Use analytical Obara-Saika method."), &
    2286       59060 :                           default_i_val=eri_default)
    2287       59060 :       CALL section_add_keyword(section, keyword)
    2288       59060 :       CALL keyword_release(keyword)
    2289             : 
    2290             :       CALL keyword_create(keyword, __LOCATION__, name="SIZE_LATTICE_SUM", &
    2291             :                           description="Size of sum range L. ", &
    2292             :                           usage="SIZE_LATTICE_SUM  10", &
    2293       59060 :                           default_i_val=5)
    2294       59060 :       CALL section_add_keyword(section, keyword)
    2295       59060 :       CALL keyword_release(keyword)
    2296             : 
    2297       59060 :    END SUBROUTINE create_integrals_section
    2298             : 
    2299             : ! **************************************************************************************************
    2300             : !> \brief ...
    2301             : !> \param section ...
    2302             : ! **************************************************************************************************
    2303       59060 :    SUBROUTINE create_RI_metric_section(section)
    2304             :       TYPE(section_type), POINTER                        :: section
    2305             : 
    2306             :       TYPE(keyword_type), POINTER                        :: keyword
    2307             : 
    2308       59060 :       CPASSERT(.NOT. ASSOCIATED(section))
    2309             :       CALL section_create(section, __LOCATION__, name="RI_METRIC", &
    2310             :                           description="Sets up RI metric", &
    2311       59060 :                           repeats=.FALSE.)
    2312             : 
    2313       59060 :       NULLIFY (keyword)
    2314             :       CALL keyword_create( &
    2315             :          keyword, __LOCATION__, &
    2316             :          name="POTENTIAL_TYPE", &
    2317             :          description="Decides which operator/metric is used for resolution of the identity (RI).", &
    2318             :          usage="POTENTIAL_TYPE DEFAULT", &
    2319             :          enum_c_vals=s2a("DEFAULT", "COULOMB", "IDENTITY", "LONGRANGE", "SHORTRANGE", "TRUNCATED"), &
    2320             :          enum_i_vals=(/ri_default, do_potential_coulomb, do_potential_id, do_potential_long, &
    2321             :                        do_potential_short, do_potential_truncated/), &
    2322             :          enum_desc=s2a("Use Coulomb metric for RI-MP2 and normal-scaling RI-SOS-MP2, RI-RPA and GW. "// &
    2323             :                        "Use Overlap metric for low-scaling RI-SOS-MP2, RI-RPA and GW for periodic systems. "// &
    2324             :                        "Use truncated Coulomb metric for low-scaling RI-SOS-MP2, RI-RPA and GW for non-periodic systems.", &
    2325             :                        "Coulomb metric: 1/r. Recommended for RI-MP2,", &
    2326             :                        "Overlap metric: delta(r).", &
    2327             :                        "Longrange metric: erf(omega*r)/r. Not recommended with DO_SVD .TRUE.", &
    2328             :                        "Shortrange metric: erfc(omega*r)/r", &
    2329             :                        "Truncated Coulomb metric: if (r &lt; R_c) 1/r else 0. More "// &
    2330             :                        "accurate than IDENTITY for non-periodic systems. Recommended for low-scaling methods."), &
    2331       59060 :          default_i_val=ri_default)
    2332       59060 :       CALL section_add_keyword(section, keyword)
    2333       59060 :       CALL keyword_release(keyword)
    2334             : 
    2335       59060 :       NULLIFY (keyword)
    2336             :       CALL keyword_create( &
    2337             :          keyword, __LOCATION__, &
    2338             :          name="OMEGA", &
    2339             :          description="The range parameter for the short/long range operator (in 1/a0).", &
    2340             :          usage="OMEGA 0.5", &
    2341       59060 :          default_r_val=0.0_dp)
    2342       59060 :       CALL section_add_keyword(section, keyword)
    2343       59060 :       CALL keyword_release(keyword)
    2344             : 
    2345             :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
    2346             :                           description="The cutoff radius (in Angstrom) for the truncated Coulomb operator.", &
    2347             :                           usage="CUTOFF_RADIUS 3.0", default_r_val=cp_unit_to_cp2k(value=3.0_dp, unit_str="angstrom"), &
    2348       59060 :                           type_of_var=real_t, unit_str="angstrom")
    2349       59060 :       CALL section_add_keyword(section, keyword)
    2350       59060 :       CALL keyword_release(keyword)
    2351             : 
    2352             :       CALL keyword_create( &
    2353             :          keyword, __LOCATION__, &
    2354             :          name="T_C_G_DATA", &
    2355             :          description="Location of the file t_c_g.dat that contains the data for the "// &
    2356             :          "evaluation of the truncated gamma function ", &
    2357       59060 :          default_c_val="t_c_g.dat")
    2358       59060 :       CALL section_add_keyword(section, keyword)
    2359       59060 :       CALL keyword_release(keyword)
    2360             : 
    2361             :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RANGE", &
    2362             :                           description="The threshold to determine the effective range of the short range "// &
    2363             :                           "RI metric: erfc(omega*eff_range)/eff_range = EPS_RANGE", &
    2364             :                           default_r_val=1.0E-08_dp, &
    2365       59060 :                           repeats=.FALSE.)
    2366       59060 :       CALL section_add_keyword(section, keyword)
    2367       59060 :       CALL keyword_release(keyword)
    2368             : 
    2369       59060 :    END SUBROUTINE create_RI_metric_section
    2370             : 
    2371             : END MODULE input_cp2k_mp2

Generated by: LCOV version 1.15