LCOV - code coverage report
Current view: top level - src - input_cp2k_qs.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:591cf04) Lines: 99.6 % 280 279
Test Date: 2026-09-21 02:17:57 Functions: 100.0 % 5 5

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief function that build the QS section of the input
      10              : !> \par History
      11              : !>      10.2005 moved out of input_cp2k [fawzi]
      12              : !>      07.2024 moved out of input_cp2k_dft [JGH]
      13              : !> \author fawzi
      14              : ! **************************************************************************************************
      15              : MODULE input_cp2k_qs
      16              :    USE bibliography,                    ONLY: &
      17              :         Andermatt2016, Brelaz1979, Dewar1977, Dewar1985, Golze2017a, Golze2017b, Iannuzzi2006, &
      18              :         Kolafa2004, Krack2000, Kuhne2007, Lippert1997, Lippert1999, Repasky2002, Rocha2006, &
      19              :         Schenter2008, Stewart1989, Stewart2007, Thiel1992, VanVoorhis2015, VandeVondele2005a, &
      20              :         VandeVondele2006
      21              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      22              :                                               cp_print_key_section_create,&
      23              :                                               low_print_level
      24              :    USE input_constants,                 ONLY: &
      25              :         do_ddapc_constraint, do_ddapc_restraint, do_full_density, do_gapw_gcs, do_gapw_gct, &
      26              :         do_gapw_log, do_lri_inv, do_lri_inv_auto, do_lri_pseudoinv_diag, do_lri_pseudoinv_svd, &
      27              :         do_method_am1, do_method_dftb, do_method_gapw, do_method_gapw_xc, do_method_gpw, &
      28              :         do_method_lrigpw, do_method_mndo, do_method_mndod, do_method_ofgpw, do_method_pdg, &
      29              :         do_method_pm3, do_method_pm6, do_method_pm6fm, do_method_pnnl, do_method_rigpw, &
      30              :         do_method_rm1, do_method_xtb, do_ppl_analytic, do_ppl_grid, do_pwgrid_ns_fullspace, &
      31              :         do_pwgrid_ns_halfspace, do_pwgrid_spherical, do_s2_constraint, do_s2_restraint, &
      32              :         do_spin_density, gapw_1c_large, gapw_1c_medium, gapw_1c_orb, gapw_1c_small, &
      33              :         gapw_1c_very_large, gaussian, numerical, slater, wfi_aspc_nr, wfi_frozen_method_nr, &
      34              :         wfi_gext_proj_nr, wfi_gext_proj_qtr_nr, wfi_linear_p_method_nr, wfi_linear_ps_method_nr, &
      35              :         wfi_linear_wf_method_nr, wfi_ps_method_nr, wfi_use_guess_method_nr, &
      36              :         wfi_use_prev_p_method_nr, wfi_use_prev_wf_method_nr
      37              :    USE input_cp2k_distribution,         ONLY: create_distribution_section
      38              :    USE input_cp2k_opt,                  ONLY: create_optimize_dmfet,&
      39              :                                               create_optimize_embed,&
      40              :                                               create_optimize_lri_basis_section
      41              :    USE input_cp2k_scf,                  ONLY: create_cdft_control_section
      42              :    USE input_cp2k_se,                   ONLY: create_se_control_section
      43              :    USE input_cp2k_tb,                   ONLY: create_dftb_control_section,&
      44              :                                               create_xtb_control_section
      45              :    USE input_keyword_types,             ONLY: keyword_create,&
      46              :                                               keyword_release,&
      47              :                                               keyword_type
      48              :    USE input_section_types,             ONLY: section_add_keyword,&
      49              :                                               section_add_subsection,&
      50              :                                               section_create,&
      51              :                                               section_release,&
      52              :                                               section_type
      53              :    USE input_val_types,                 ONLY: integer_t,&
      54              :                                               lchar_t,&
      55              :                                               real_t
      56              :    USE kinds,                           ONLY: dp
      57              :    USE pw_grids,                        ONLY: do_pw_grid_blocked_false,&
      58              :                                               do_pw_grid_blocked_free,&
      59              :                                               do_pw_grid_blocked_true
      60              :    USE string_utilities,                ONLY: s2a
      61              : #include "./base/base_uses.f90"
      62              : 
      63              :    IMPLICIT NONE
      64              :    PRIVATE
      65              : 
      66              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_qs'
      67              : 
      68              :    PUBLIC :: create_qs_section, create_lrigpw_section, create_ddapc_restraint_section
      69              : 
      70              : CONTAINS
      71              : 
      72              : ! **************************************************************************************************
      73              : !> \brief creates the input section for the qs part
      74              : !> \param section the section to create
      75              : !> \author teo
      76              : ! **************************************************************************************************
      77         1399 :    SUBROUTINE create_qs_section(section)
      78              :       TYPE(section_type), POINTER                        :: section
      79              : 
      80              :       TYPE(keyword_type), POINTER                        :: keyword
      81              :       TYPE(section_type), POINTER                        :: subsection
      82              : 
      83         1399 :       CPASSERT(.NOT. ASSOCIATED(section))
      84              :       CALL section_create(section, __LOCATION__, name="qs", &
      85              :                           description="parameters needed to set up the Quickstep framework", &
      86         1399 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
      87              : 
      88         1399 :       NULLIFY (keyword, subsection)
      89              : 
      90              :       ! Reals
      91              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DEFAULT", &
      92              :                           description="Try setting all EPS_xxx to values leading to an energy correct up to EPS_DEFAULT", &
      93         1399 :                           usage="EPS_DEFAULT real", default_r_val=1.0E-10_dp)
      94         1399 :       CALL section_add_keyword(section, keyword)
      95         1399 :       CALL keyword_release(keyword)
      96              : 
      97              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CORE_CHARGE", &
      98              :                           description="Precision for mapping the core charges.Overrides EPS_DEFAULT/100.0 value", &
      99         1399 :                           usage="EPS_CORE_CHARGE real", type_of_var=real_t)
     100         1399 :       CALL section_add_keyword(section, keyword)
     101         1399 :       CALL keyword_release(keyword)
     102              : 
     103              :       CALL keyword_create( &
     104              :          keyword, __LOCATION__, name="EPS_GVG_RSPACE", &
     105              :          variants=["EPS_GVG"], &
     106              :          description="Sets precision of the realspace KS matrix element integration. Overrides SQRT(EPS_DEFAULT) value", &
     107         2798 :          usage="EPS_GVG_RSPACE real", type_of_var=real_t)
     108         1399 :       CALL section_add_keyword(section, keyword)
     109         1399 :       CALL keyword_release(keyword)
     110              : 
     111              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_PGF_ORB", &
     112              :                           description="Sets precision of the overlap matrix elements. Overrides SQRT(EPS_DEFAULT) value", &
     113         1399 :                           usage="EPS_PGF_ORB real", type_of_var=real_t)
     114         1399 :       CALL section_add_keyword(section, keyword)
     115         1399 :       CALL keyword_release(keyword)
     116              : 
     117              :       CALL keyword_create( &
     118              :          keyword, __LOCATION__, name="EPS_KG_ORB", &
     119              :          description="Sets precision used in coloring the subsets for the Kim-Gordon method. Overrides SQRT(EPS_DEFAULT) value", &
     120              :          usage="EPS_KG_ORB 1.0E-8", &
     121         1399 :          type_of_var=real_t)
     122         1399 :       CALL section_add_keyword(section, keyword)
     123         1399 :       CALL keyword_release(keyword)
     124              : 
     125              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_PPL", &
     126              :                           description="Adjusts the precision for the local part of the pseudo potential. ", &
     127         1399 :                           usage="EPS_PPL real", type_of_var=real_t, default_r_val=1.0E-2_dp)
     128         1399 :       CALL section_add_keyword(section, keyword)
     129         1399 :       CALL keyword_release(keyword)
     130              : 
     131              :       CALL keyword_create( &
     132              :          keyword, __LOCATION__, name="EPS_PPNL", &
     133              :          description="Sets precision of the non-local part of the pseudo potential. Overrides sqrt(EPS_DEFAULT) value", &
     134         1399 :          usage="EPS_PPNL real", type_of_var=real_t)
     135         1399 :       CALL section_add_keyword(section, keyword)
     136         1399 :       CALL keyword_release(keyword)
     137              : 
     138              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CPC", &
     139              :                           description="Sets precision of the GAPW projection. Overrides EPS_DEFAULT value", &
     140         1399 :                           usage="EPS_CPC real", type_of_var=real_t)
     141         1399 :       CALL section_add_keyword(section, keyword)
     142         1399 :       CALL keyword_release(keyword)
     143              : 
     144              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RHO", &
     145              :                           description="Sets precision of the density mapping on the grids.Overrides EPS_DEFAULT value", &
     146         1399 :                           usage="EPS_RHO real", type_of_var=real_t)
     147         1399 :       CALL section_add_keyword(section, keyword)
     148         1399 :       CALL keyword_release(keyword)
     149              : 
     150              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RHO_RSPACE", &
     151              :                           description="Sets precision of the density mapping in rspace.Overrides EPS_DEFAULT value."// &
     152              :                           " Overrides EPS_RHO value", &
     153         1399 :                           usage="EPS_RHO_RSPACE real", type_of_var=real_t)
     154         1399 :       CALL section_add_keyword(section, keyword)
     155         1399 :       CALL keyword_release(keyword)
     156              : 
     157              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_RHO_GSPACE", &
     158              :                           description="Sets precision of the density mapping in gspace.Overrides EPS_DEFAULT value."// &
     159              :                           " Overrides EPS_RHO value", &
     160         1399 :                           usage="EPS_RHO_GSPACE real", type_of_var=real_t)
     161         1399 :       CALL section_add_keyword(section, keyword)
     162         1399 :       CALL keyword_release(keyword)
     163              : 
     164              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_FILTER_MATRIX", &
     165              :                           description="Sets the threshold for filtering matrix elements.", &
     166         1399 :                           usage="EPS_FILTER_MATRIX 1.0E-6", type_of_var=real_t, default_r_val=0.0E0_dp)
     167         1399 :       CALL section_add_keyword(section, keyword)
     168         1399 :       CALL keyword_release(keyword)
     169              : 
     170              :       CALL keyword_create(keyword, __LOCATION__, name="EPSFIT", &
     171              :                           variants=["EPS_FIT"], &
     172              :                           description="GAPW: tolerance controlling the split of Gaussian basis functions "// &
     173              :                           "into hard atom-centered and soft grid-expanded parts. Smaller values include "// &
     174              :                           "harder Gaussians in the soft density and can require a larger MGRID cutoff.", &
     175         2798 :                           usage="EPSFIT real", default_r_val=1.0E-4_dp)
     176         1399 :       CALL section_add_keyword(section, keyword)
     177         1399 :       CALL keyword_release(keyword)
     178              : 
     179              :       CALL keyword_create(keyword, __LOCATION__, name="EPSISO", &
     180              :                           variants=["EPS_ISO"], &
     181              :                           description="GAPW: precision to determine an isolated projector", &
     182         2798 :                           usage="EPSISO real", default_r_val=1.0E-12_dp)
     183         1399 :       CALL section_add_keyword(section, keyword)
     184         1399 :       CALL keyword_release(keyword)
     185              : 
     186              :       CALL keyword_create(keyword, __LOCATION__, name="EPSSVD", &
     187              :                           variants=["EPS_SVD"], &
     188              :                           description="GAPW: tolerance used in the singular value decomposition of the "// &
     189              :                           "projector matrix. Smaller values can improve numerical accuracy at increased cost.", &
     190         2798 :                           usage="EPS_SVD real", default_r_val=1.0E-8_dp)
     191         1399 :       CALL section_add_keyword(section, keyword)
     192         1399 :       CALL keyword_release(keyword)
     193              : 
     194              :       CALL keyword_create(keyword, __LOCATION__, name="EPSRHO0", &
     195              :                           variants=s2a("EPSVRHO0", "EPS_VRHO0"), &
     196              :                           description="GAPW: tolerance used to determine the range of the "// &
     197              :                           "V(rho0-rho0_soft) compensation contribution.", &
     198         1399 :                           usage="EPSRHO0 real", default_r_val=1.0E-6_dp)
     199         1399 :       CALL section_add_keyword(section, keyword)
     200         1399 :       CALL keyword_release(keyword)
     201              : 
     202              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA0_HARD", &
     203              :                           variants=s2a("ALPHA0_H", "ALPHA0"), &
     204              :                           description="GAPW: Exponent for hard compensation charge", &
     205         1399 :                           usage="ALPHA0_HARD real", default_r_val=0.0_dp)
     206         1399 :       CALL section_add_keyword(section, keyword)
     207         1399 :       CALL keyword_release(keyword)
     208              : 
     209              :       CALL keyword_create( &
     210              :          keyword, __LOCATION__, name="FORCE_PAW", &
     211              :          description="Use the GAPW scheme also for atoms with soft basis sets, i.e. "// &
     212              :          "the local densities are computed even if hard and soft should be equal. "// &
     213              :          "If this keyword is not set to true, those atoms with soft basis sets are treated by a GPW scheme, i.e. "// &
     214              :          "the corresponding density contribution goes on the global grid and is expanded in PW. "// &
     215              :          "This option nullifies the effect of the GPW_TYPE in the atomic KIND", &
     216              :          usage="FORCE_PAW", &
     217         1399 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     218         1399 :       CALL section_add_keyword(section, keyword)
     219         1399 :       CALL keyword_release(keyword)
     220              : 
     221              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_RAD_LOCAL", &
     222              :                           description="GAPW : maximum radius of gaussian functions"// &
     223              :                           " included in the generation of projectors", &
     224         1399 :                           usage="MAX_RAD_LOCAL real", default_r_val=25.0_dp)
     225         1399 :       CALL section_add_keyword(section, keyword)
     226         1399 :       CALL keyword_release(keyword)
     227              : 
     228              :       CALL keyword_create(keyword, __LOCATION__, name="GAPW_1C_BASIS", &
     229              :                           description="Specifies how to construct the GAPW one center basis set. "// &
     230              :                           "Default is to use the primitives from the orbital basis.", &
     231              :                           usage="GAPW_1C_BASIS MEDIUM", &
     232              :                           enum_c_vals=s2a("ORB", "EXT_SMALL", "EXT_MEDIUM", "EXT_LARGE", "EXT_VERY_LARGE"), &
     233              :                           enum_desc=s2a("Use orbital basis set.", &
     234              :                                         "Extension using Small number of primitive Gaussians.", &
     235              :                                         "Extension using Medium number of primitive Gaussians.", &
     236              :                                         "Extension using Large number of primitive Gaussians.", &
     237              :                                         "Extension using Very Large number of primitive Gaussians."), &
     238              :                           enum_i_vals=[gapw_1c_orb, gapw_1c_small, gapw_1c_medium, &
     239              :                                        gapw_1c_large, gapw_1c_very_large], &
     240         1399 :                           default_i_val=gapw_1c_orb)
     241         1399 :       CALL section_add_keyword(section, keyword)
     242         1399 :       CALL keyword_release(keyword)
     243              : 
     244              :       CALL keyword_create( &
     245              :          keyword, __LOCATION__, name="GAPW_ACCURATE_XCINT", &
     246              :          description="Use the accurate GAPW/GAPW_XC XC integration scheme for one-center hard/soft "// &
     247              :          "density differences. This opt-in path covers regular GAPW/GAPW_XC XC energy, potential, "// &
     248              :          "forces, mGGA/tau terms, NLCC, Fine-XC grids, local XC energy-density transfer, analytical "// &
     249              :          "stress, TDDFPT/response forces, ADMM-GAPW force paths, an ADMM-GAPW diagonal stress "// &
     250              :          "debug path, nonlocal vdW smoke coverage, representative k-point, XAS_TDP, and RTBSE "// &
     251              :          "smoke cases, and KG GAPW/GAPW_XC EMBED, EMBED_RI, ATOMIC, and NONE cases. Regular-grid "// &
     252              :          "local energy and stress cube print keys keep their existing soft-grid semantics and are "// &
     253              :          "not changed by this keyword. The default remains off while this coverage is being prepared "// &
     254              :          "for a future default change.", &
     255              :          usage="GAPW_ACCURATE_XCINT", &
     256         1399 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     257         1399 :       CALL section_add_keyword(section, keyword)
     258         1399 :       CALL keyword_release(keyword)
     259              : 
     260              :       CALL keyword_create( &
     261              :          keyword, __LOCATION__, name="ALPHA_WEIGHTS", &
     262              :          description="Gaussian exponent reference (rc=1.2 Bohr) in weight function for "// &
     263              :          "accurate integration in GAPW.", &
     264         1399 :          usage="ALPHA_WEIGHTS 10.0", default_r_val=6.0_dp)
     265         1399 :       CALL section_add_keyword(section, keyword)
     266         1399 :       CALL keyword_release(keyword)
     267              : 
     268              :       CALL keyword_create( &
     269              :          keyword, __LOCATION__, name="ORDER_WEIGHTS", &
     270              :          description="Order of r^2 polynomial (2n) in weight function for "// &
     271              :          "accurate integration in GAPW.", &
     272         1399 :          usage="ORDER_WEIGHTS 1", default_i_val=0)
     273         1399 :       CALL section_add_keyword(section, keyword)
     274         1399 :       CALL keyword_release(keyword)
     275              : 
     276              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_PAIR_LIST_RADIUS", &
     277              :                           description="Set the minimum value [Bohr] for the overlap pair list radius."// &
     278              :                           " Default is 0.0 Bohr, negative values are changed to the cell size."// &
     279              :                           " This allows to control the sparsity of the KS matrix for HFX calculations.", &
     280         1399 :                           usage="MIN_PAIR_LIST_RADIUS real", default_r_val=0.0_dp)
     281         1399 :       CALL section_add_keyword(section, keyword)
     282         1399 :       CALL keyword_release(keyword)
     283              : 
     284              :       ! Logicals
     285              :       CALL keyword_create(keyword, __LOCATION__, name="LS_SCF", &
     286              :                           description="Perform a linear scaling SCF", &
     287              :                           usage="LS_SCF", lone_keyword_l_val=.TRUE., &
     288         1399 :                           default_l_val=.FALSE.)
     289         1399 :       CALL section_add_keyword(section, keyword)
     290         1399 :       CALL keyword_release(keyword)
     291              : 
     292              :       CALL keyword_create(keyword, __LOCATION__, name="ALMO_SCF", &
     293              :                           description="Perform ALMO SCF", &
     294              :                           usage="ALMO_SCF", lone_keyword_l_val=.TRUE., &
     295         1399 :                           default_l_val=.FALSE.)
     296         1399 :       CALL section_add_keyword(section, keyword)
     297         1399 :       CALL keyword_release(keyword)
     298              : 
     299              :       CALL keyword_create(keyword, __LOCATION__, name="TRANSPORT", &
     300              :                           description="Perform transport calculations (coupling CP2K and OMEN)", &
     301              :                           usage="TRANSPORT", lone_keyword_l_val=.TRUE., &
     302         1399 :                           default_l_val=.FALSE.)
     303         1399 :       CALL section_add_keyword(section, keyword)
     304         1399 :       CALL keyword_release(keyword)
     305              : 
     306              :       CALL keyword_create(keyword, __LOCATION__, name="KG_METHOD", &
     307              :                           description="Use a Kim-Gordon-like scheme.", &
     308              :                           usage="KG_METHOD", lone_keyword_l_val=.TRUE., &
     309         5596 :                           default_l_val=.FALSE., citations=[Iannuzzi2006, Brelaz1979, Andermatt2016])
     310         1399 :       CALL section_add_keyword(section, keyword)
     311         1399 :       CALL keyword_release(keyword)
     312              : 
     313              :       CALL keyword_create(keyword, __LOCATION__, name="REF_EMBED_SUBSYS", &
     314              :                           description="A total, reference, system in DFT embedding. ", &
     315              :                           usage="REF_EMBED_SUBSYS FALSE", &
     316         1399 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     317         1399 :       CALL section_add_keyword(section, keyword)
     318         1399 :       CALL keyword_release(keyword)
     319              : 
     320              :       CALL keyword_create(keyword, __LOCATION__, name="CLUSTER_EMBED_SUBSYS", &
     321              :                           description="A cluster treated with DFT in DFT embedding. ", &
     322              :                           usage="CLUSTER_EMBED_SUBSYS FALSE", &
     323         1399 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     324         1399 :       CALL section_add_keyword(section, keyword)
     325         1399 :       CALL keyword_release(keyword)
     326              : 
     327              :       CALL keyword_create(keyword, __LOCATION__, name="HIGH_LEVEL_EMBED_SUBSYS", &
     328              :                           description="A cluster treated with a high-level method in DFT embedding. ", &
     329              :                           usage="HIGH_LEVEL_EMBED_SUBSYS FALSE", &
     330         1399 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     331         1399 :       CALL section_add_keyword(section, keyword)
     332         1399 :       CALL keyword_release(keyword)
     333              : 
     334              :       CALL keyword_create(keyword, __LOCATION__, name="DFET_EMBEDDED", &
     335              :                           description="Calculation with DFT-embedding potential. ", &
     336              :                           usage="DFET_EMBEDDED FALSE", &
     337         1399 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     338         1399 :       CALL section_add_keyword(section, keyword)
     339         1399 :       CALL keyword_release(keyword)
     340              : 
     341              :       CALL keyword_create(keyword, __LOCATION__, name="DMFET_EMBEDDED", &
     342              :                           description="Calculation with DM embedding potential. ", &
     343              :                           usage="DMFET_EMBEDDED FALSE", &
     344         1399 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     345         1399 :       CALL section_add_keyword(section, keyword)
     346         1399 :       CALL keyword_release(keyword)
     347              : 
     348              :       ! Integers
     349              :       CALL keyword_create(keyword, __LOCATION__, name="STO_NG", &
     350              :                           description="Order of Gaussian type expansion of Slater orbital basis sets.", &
     351         1399 :                           usage="STO_NG", default_i_val=6)
     352         1399 :       CALL section_add_keyword(section, keyword)
     353         1399 :       CALL keyword_release(keyword)
     354              : 
     355              :       CALL keyword_create(keyword, __LOCATION__, name="LMAXN1", &
     356              :                           variants=["LMAXRHO1"], &
     357              :                           description="GAPW : max L number for expansion of the atomic densities in spherical gaussians", &
     358              :                           usage="LMAXN1 integer", &
     359         2798 :                           default_i_val=-1)
     360         1399 :       CALL section_add_keyword(section, keyword)
     361         1399 :       CALL keyword_release(keyword)
     362              : 
     363              :       CALL keyword_create(keyword, __LOCATION__, name="LMAXN0", &
     364              :                           variants=["LMAXRHO0"], &
     365              :                           description="GAPW : max L number for the expansion compensation densities in spherical gaussians", &
     366              :                           usage="LMAXN0 integer", &
     367         2798 :                           default_i_val=2)
     368         1399 :       CALL section_add_keyword(section, keyword)
     369         1399 :       CALL keyword_release(keyword)
     370              : 
     371              :       CALL keyword_create(keyword, __LOCATION__, name="LADDN0", &
     372              :                           description="GAPW : integer added to the max L of the basis set, used to determine the "// &
     373              :                           "maximum value of L for the compensation charge density.", &
     374              :                           usage="LADDN0 integer", &
     375         1399 :                           default_i_val=99)
     376         1399 :       CALL section_add_keyword(section, keyword)
     377         1399 :       CALL keyword_release(keyword)
     378              : 
     379              :       ! Characters
     380              :       CALL keyword_create(keyword, __LOCATION__, name="QUADRATURE", &
     381              :                           description="GAPW: algorithm to construct the atomic radial grids", &
     382              :                           usage="QUADRATURE GC_SIMPLE", &
     383              :                           enum_c_vals=s2a("GC_SIMPLE", "GC_TRANSFORMED", "GC_LOG"), &
     384              :                           enum_i_vals=[do_gapw_gcs, do_gapw_gct, do_gapw_log], &
     385              :                           enum_desc=s2a("Gauss-Chebyshev quadrature", &
     386              :                                         "Transformed Gauss-Chebyshev quadrature", &
     387              :                                         "Logarithmic transformed Gauss-Chebyshev quadrature"), &
     388         1399 :                           default_i_val=do_gapw_log)
     389         1399 :       CALL section_add_keyword(section, keyword)
     390         1399 :       CALL keyword_release(keyword)
     391              : 
     392              :       CALL keyword_create(keyword, __LOCATION__, name="PW_GRID", &
     393              :                           description="What kind of PW_GRID should be employed", &
     394              :                           usage="PW_GRID NS-FULLSPACE", &
     395              :                           enum_c_vals=s2a("SPHERICAL", "NS-FULLSPACE", "NS-HALFSPACE"), &
     396              :                           enum_desc=s2a("- not tested", " tested", " - not tested"), &
     397              :                           enum_i_vals=[do_pwgrid_spherical, do_pwgrid_ns_fullspace, do_pwgrid_ns_halfspace], &
     398         1399 :                           default_i_val=do_pwgrid_ns_fullspace)
     399         1399 :       CALL section_add_keyword(section, keyword)
     400         1399 :       CALL keyword_release(keyword)
     401              : 
     402              :       CALL keyword_create(keyword, __LOCATION__, name="PW_GRID_LAYOUT", &
     403              :                           description="Force a particular real-space layout for the plane waves grids. "// &
     404              :                           "Numbers &le; 0 mean that this dimension is free, incorrect layouts will be ignored. "// &
     405              :                           "The default (/-1,-1/) causes CP2K to select a good value, "// &
     406              :                           "i.e. plane distributed for large grids, more general distribution for small grids.", &
     407              :                           usage="PW_GRID_LAYOUT 4 16", &
     408              :                           repeats=.FALSE., n_var=2, &
     409         1399 :                           default_i_vals=[-1, -1])
     410         1399 :       CALL section_add_keyword(section, keyword)
     411         1399 :       CALL keyword_release(keyword)
     412              : 
     413              :       CALL keyword_create(keyword, __LOCATION__, name="PW_GRID_BLOCKED", &
     414              :                           description="Can be used to set the distribution in g-space for the pw grids and their FFT.", &
     415              :                           usage="PW_GRID_BLOCKED FREE", &
     416              :                           enum_c_vals=s2a("FREE", "TRUE", "FALSE"), &
     417              :                           enum_desc=s2a("CP2K will select an appropriate value", "blocked", "not blocked"), &
     418              :                           enum_i_vals=[do_pw_grid_blocked_free, do_pw_grid_blocked_true, do_pw_grid_blocked_false], &
     419         1399 :                           default_i_val=do_pw_grid_blocked_free)
     420         1399 :       CALL section_add_keyword(section, keyword)
     421         1399 :       CALL keyword_release(keyword)
     422              : 
     423              :       CALL keyword_create( &
     424              :          keyword, __LOCATION__, name="EXTRAPOLATION", &
     425              :          variants=s2a("INTERPOLATION", "WF_INTERPOLATION"), &
     426              :          description="Extrapolation strategy for the wavefunction during e.g. MD. "// &
     427              :          "Not all options are available for all simulation methods. "// &
     428              :          "PS and ASPC are recommended, see also EXTRAPOLATION_ORDER.", &
     429              :          citations=[Kolafa2004, VandeVondele2005a, Kuhne2007], &
     430              :          usage="EXTRAPOLATION PS", &
     431              :          enum_c_vals=s2a("USE_GUESS", "USE_PREV_P", "LINEAR_WF", "LINEAR_P", "LINEAR_PS", &
     432              :                          "USE_PREV_WF", "PS", "FROZEN", "ASPC", "GEXT_PROJ", "GEXT_PROJ_QTR"), &
     433              :          enum_desc=s2a( &
     434              :          "Use the method specified with SCF_GUESS, i.e. no extrapolation", &
     435              :          "Use the previous density matrix", &
     436              :          "Linear extrapolation of the wavefunction (not available for k-points)", &
     437              :          "Linear extrapolation of the density matrix", &
     438              :          "Linear extrapolation of the density matrix times the overlap matrix (not available for k-points)", &
     439              :          "Use the previous wavefunction", &
     440              :          "Higher order extrapolation of the density matrix times the overlap matrix", &
     441              :          "Frozen ... (not available for k-points)", &
     442              :          "Always stable predictor corrector, similar to PS, but going for MD stability instead of initial guess accuracy.", &
     443              :          "GExt extrapolation for the density matrix times the overlap matrix.", &
     444              :          "Quasi time reversible GExt extrapolation for the density matrix times the overlap matrix."), &
     445              :          enum_i_vals=[ &
     446              :          wfi_use_guess_method_nr, &
     447              :          wfi_use_prev_p_method_nr, &
     448              :          wfi_linear_wf_method_nr, &
     449              :          wfi_linear_p_method_nr, &
     450              :          wfi_linear_ps_method_nr, &
     451              :          wfi_use_prev_wf_method_nr, &
     452              :          wfi_ps_method_nr, &
     453              :          wfi_frozen_method_nr, &
     454              :          wfi_aspc_nr, &
     455              :          wfi_gext_proj_nr, &
     456              :          wfi_gext_proj_qtr_nr], &
     457         5596 :          default_i_val=wfi_aspc_nr)
     458         1399 :       CALL section_add_keyword(section, keyword)
     459         1399 :       CALL keyword_release(keyword)
     460              : 
     461              :       CALL keyword_create(keyword, __LOCATION__, name="EXTRAPOLATION_ORDER", &
     462              :                           description="Order for the PS, ASPC extrapolation (typically 2-4) or "// &
     463              :                           "order for the GEXT_PROJ, GEXT_PROJ_QTR extrapolation (typically 4-10). "// &
     464              :                           "Higher order might bring more accuracy, but comes, "// &
     465              :                           "for large systems, also at some cost. "// &
     466              :                           "In some cases, a high order extrapolation is not stable,"// &
     467              :                           " and the order needs to be reduced.", &
     468         1399 :                           usage="EXTRAPOLATION_ORDER {integer}", default_i_val=3)
     469         1399 :       CALL section_add_keyword(section, keyword)
     470         1399 :       CALL keyword_release(keyword)
     471              : 
     472              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
     473              :                           description="Specifies the electronic structure method that should be employed", &
     474              :                           usage="METHOD GAPW", &
     475              :                           enum_c_vals=s2a("GAPW", "GAPW_XC", "GPW", "LRIGPW", "RIGPW", &
     476              :                                     "MNDO", "MNDOD", "AM1", "PM3", "PM6", "PM6-FM", "PDG", "RM1", "PNNL", "DFTB", "xTB", "OFGPW"), &
     477              :                           enum_desc=s2a("Gaussian and augmented plane waves method", &
     478              :                                         "Gaussian and augmented plane waves method only for XC", &
     479              :                                         "Gaussian and plane waves method", &
     480              :                                         "Local resolution of identity method", &
     481              :                                         "Resolution of identity method for HXC terms", &
     482              :                                         "MNDO semiempirical", "MNDO-d semiempirical", "AM1 semiempirical", &
     483              :                                         "PM3 semiempirical", "PM6 semiempirical", "PM6-FM semiempirical", "PDG semiempirical", &
     484              :                                         "RM1 semiempirical", &
     485              :                                         "PNNL semiempirical", &
     486              :                                         "DFTB Density Functional based Tight-Binding", &
     487              :                                         "GFN-xTB Extended Tight-Binding", &
     488              :                                         "OFGPW Orbital-free GPW method"), &
     489              :                           enum_i_vals=[do_method_gapw, do_method_gapw_xc, do_method_gpw, do_method_lrigpw, do_method_rigpw, &
     490              :                                        do_method_mndo, do_method_mndod, do_method_am1, do_method_pm3, &
     491              :                                        do_method_pm6, do_method_pm6fm, do_method_pdg, do_method_rm1, &
     492              :                                        do_method_pnnl, do_method_dftb, do_method_xtb, do_method_ofgpw], &
     493              :                           citations=[Lippert1997, Lippert1999, Krack2000, VandeVondele2005a, &
     494              :                                      VandeVondele2006, Dewar1977, Dewar1985, Rocha2006, Stewart1989, Thiel1992, &
     495              :                                      Repasky2002, Stewart2007, VanVoorhis2015, Schenter2008], &
     496        20985 :                           default_i_val=do_method_gpw)
     497         1399 :       CALL section_add_keyword(section, keyword)
     498         1399 :       CALL keyword_release(keyword)
     499              : 
     500              :       CALL keyword_create(keyword, __LOCATION__, name="CORE_PPL", &
     501              :                           description="Specifies the method used to calculate the local pseudopotential contribution.", &
     502              :                           usage="CORE_PPL ANALYTIC", &
     503              :                           enum_c_vals=s2a("ANALYTIC", "GRID"), &
     504              :                           enum_desc=s2a("Analytic integration of integrals", &
     505              :                                         "Numerical integration on real space grid. Lumped together with core charge"), &
     506              :                           enum_i_vals=[do_ppl_analytic, do_ppl_grid], &
     507         1399 :                           default_i_val=do_ppl_analytic)
     508         1399 :       CALL section_add_keyword(section, keyword)
     509         1399 :       CALL keyword_release(keyword)
     510              : 
     511              :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_RESTART_FILE_NAME", &
     512              :                           description="Root of the file name where to read the embedding "// &
     513              :                           "potential guess.", &
     514              :                           usage="EMBED_RESTART_FILE_NAME <FILENAME>", &
     515         1399 :                           type_of_var=lchar_t)
     516         1399 :       CALL section_add_keyword(section, keyword)
     517         1399 :       CALL keyword_release(keyword)
     518              : 
     519              :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_CUBE_FILE_NAME", &
     520              :                           description="Root of the file name where to read the embedding "// &
     521              :                           "potential (guess) as a cube. Whitespace-separated cube values are accepted. If "// &
     522              :                           "adjacent values are written without whitespace, each value must occupy a "// &
     523              :                           "13-character E13.5 field.", &
     524              :                           usage="EMBED_CUBE_FILE_NAME <FILENAME>", &
     525         1399 :                           type_of_var=lchar_t)
     526         1399 :       CALL section_add_keyword(section, keyword)
     527         1399 :       CALL keyword_release(keyword)
     528              : 
     529              :       CALL keyword_create(keyword, __LOCATION__, name="EMBED_SPIN_CUBE_FILE_NAME", &
     530              :                           description="Root of the file name where to read the spin part "// &
     531              :                           "of the embedding potential (guess) as a cube. Whitespace-separated cube values are "// &
     532              :                           "accepted. If adjacent values are written without whitespace, each value must occupy "// &
     533              :                           "a 13-character E13.5 field.", &
     534              :                           usage="EMBED_SPIN_CUBE_FILE_NAME <FILENAME>", &
     535         1399 :                           type_of_var=lchar_t)
     536         1399 :       CALL section_add_keyword(section, keyword)
     537         1399 :       CALL keyword_release(keyword)
     538              : 
     539         1399 :       CALL create_distribution_section(subsection)
     540         1399 :       CALL section_add_subsection(section, subsection)
     541         1399 :       CALL section_release(subsection)
     542              : 
     543         1399 :       CALL create_dftb_control_section(subsection)
     544         1399 :       CALL section_add_subsection(section, subsection)
     545         1399 :       CALL section_release(subsection)
     546              : 
     547         1399 :       CALL create_xtb_control_section(subsection)
     548         1399 :       CALL section_add_subsection(section, subsection)
     549         1399 :       CALL section_release(subsection)
     550              : 
     551         1399 :       CALL create_se_control_section(subsection)
     552         1399 :       CALL section_add_subsection(section, subsection)
     553         1399 :       CALL section_release(subsection)
     554              : 
     555         1399 :       CALL create_mulliken_section(subsection)
     556         1399 :       CALL section_add_subsection(section, subsection)
     557         1399 :       CALL section_release(subsection)
     558              : 
     559         1399 :       CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT")
     560         1399 :       CALL section_add_subsection(section, subsection)
     561         1399 :       CALL section_release(subsection)
     562              : 
     563         1399 :       CALL create_cdft_control_section(subsection)
     564         1399 :       CALL section_add_subsection(section, subsection)
     565         1399 :       CALL section_release(subsection)
     566              : 
     567         1399 :       CALL create_s2_restraint_section(subsection)
     568         1399 :       CALL section_add_subsection(section, subsection)
     569         1399 :       CALL section_release(subsection)
     570              : 
     571         1399 :       CALL create_lrigpw_section(subsection)
     572         1399 :       CALL section_add_subsection(section, subsection)
     573         1399 :       CALL section_release(subsection)
     574              : 
     575         1399 :       CALL create_optimize_lri_basis_section(subsection)
     576         1399 :       CALL section_add_subsection(section, subsection)
     577         1399 :       CALL section_release(subsection)
     578              : 
     579              :       ! Embedding subsections: DFET and DMFET
     580         1399 :       CALL create_optimize_embed(subsection)
     581         1399 :       CALL section_add_subsection(section, subsection)
     582         1399 :       CALL section_release(subsection)
     583              : 
     584         1399 :       CALL create_optimize_dmfet(subsection)
     585         1399 :       CALL section_add_subsection(section, subsection)
     586         1399 :       CALL section_release(subsection)
     587              : 
     588         1399 :    END SUBROUTINE create_qs_section
     589              : 
     590              : ! **************************************************************************************************
     591              : !> \brief ...
     592              : !> \param section ...
     593              : ! **************************************************************************************************
     594         1399 :    SUBROUTINE create_mulliken_section(section)
     595              :       TYPE(section_type), POINTER                        :: section
     596              : 
     597              :       TYPE(keyword_type), POINTER                        :: keyword
     598              : 
     599         1399 :       NULLIFY (keyword)
     600         1399 :       CPASSERT(.NOT. ASSOCIATED(section))
     601              :       CALL section_create(section, __LOCATION__, name="MULLIKEN_RESTRAINT", &
     602              :                           description="Use mulliken charges in a restraint (check code for details)", &
     603         1399 :                           n_keywords=7, n_subsections=0, repeats=.FALSE.)
     604              : 
     605              :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
     606              :                           description="force constant of the restraint", &
     607         1399 :                           usage="STRENGTH {real} ", default_r_val=0.1_dp)
     608         1399 :       CALL section_add_keyword(section, keyword)
     609         1399 :       CALL keyword_release(keyword)
     610              : 
     611              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
     612              :                           description="target value of the restraint", &
     613         1399 :                           usage="TARGET {real} ", default_r_val=1._dp)
     614         1399 :       CALL section_add_keyword(section, keyword)
     615         1399 :       CALL keyword_release(keyword)
     616              : 
     617              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
     618              :                           description="Specifies the list of atoms that is summed in the restraint", &
     619              :                           usage="ATOMS {integer} {integer} .. {integer}", &
     620         1399 :                           n_var=-1, type_of_var=integer_t)
     621         1399 :       CALL section_add_keyword(section, keyword)
     622         1399 :       CALL keyword_release(keyword)
     623              : 
     624         1399 :    END SUBROUTINE create_mulliken_section
     625              : 
     626              : ! **************************************************************************************************
     627              : !> \brief ...
     628              : !> \param section ...
     629              : !> \param section_name ...
     630              : ! **************************************************************************************************
     631         4159 :    SUBROUTINE create_ddapc_restraint_section(section, section_name)
     632              :       TYPE(section_type), POINTER                        :: section
     633              :       CHARACTER(len=*), INTENT(in)                       :: section_name
     634              : 
     635              :       TYPE(keyword_type), POINTER                        :: keyword
     636              :       TYPE(section_type), POINTER                        :: print_key
     637              : 
     638         4159 :       NULLIFY (keyword, print_key)
     639            0 :       CPASSERT(.NOT. ASSOCIATED(section))
     640              :       CALL section_create(section, __LOCATION__, name=TRIM(ADJUSTL(section_name)), &
     641              :                           description="Use DDAPC charges in a restraint (check code for details)", &
     642         4159 :                           n_keywords=7, n_subsections=0, repeats=.TRUE.)
     643              : 
     644              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE_OF_DENSITY", &
     645              :                           description="Specifies the type of density used for the fitting", &
     646              :                           usage="TYPE_OF_DENSITY (FULL|SPIN)", &
     647              :                           enum_c_vals=s2a("FULL", "SPIN"), &
     648              :                           enum_i_vals=[do_full_density, do_spin_density], &
     649              :                           enum_desc=s2a("Full density", "Spin density"), &
     650         4159 :                           default_i_val=do_full_density)
     651         4159 :       CALL section_add_keyword(section, keyword)
     652         4159 :       CALL keyword_release(keyword)
     653              : 
     654              :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
     655              :                           description="force constant of the restraint", &
     656         4159 :                           usage="STRENGTH {real} ", default_r_val=0.1_dp)
     657         4159 :       CALL section_add_keyword(section, keyword)
     658         4159 :       CALL keyword_release(keyword)
     659              : 
     660              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
     661              :                           description="target value of the restraint", &
     662         4159 :                           usage="TARGET {real} ", default_r_val=1._dp)
     663         4159 :       CALL section_add_keyword(section, keyword)
     664         4159 :       CALL keyword_release(keyword)
     665              : 
     666              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
     667              :                           description="Specifies the list of atoms that is summed in the restraint", &
     668              :                           usage="ATOMS {integer} {integer} .. {integer}", &
     669         4159 :                           n_var=-1, type_of_var=integer_t)
     670         4159 :       CALL section_add_keyword(section, keyword)
     671         4159 :       CALL keyword_release(keyword)
     672              : 
     673              :       CALL keyword_create(keyword, __LOCATION__, name="COEFF", &
     674              :                           description="Defines the the coefficient of the atom in the atom list (default is one) ", &
     675              :                           usage="COEFF 1.0 -1.0", &
     676         4159 :                           type_of_var=real_t, n_var=-1)
     677         4159 :       CALL section_add_keyword(section, keyword)
     678         4159 :       CALL keyword_release(keyword)
     679              : 
     680              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL_FORM", &
     681              :                           description="Specifies the functional form of the term added", &
     682              :                           usage="FUNCTIONAL_FORM RESTRAINT", &
     683              :                           enum_c_vals=s2a("RESTRAINT", "CONSTRAINT"), &
     684              :                           enum_i_vals=[do_ddapc_restraint, do_ddapc_constraint], &
     685              :                           enum_desc=s2a("Harmonic potential: s*(q-t)**2", "Constraint form: s*(q-t)"), &
     686         4159 :                           default_i_val=do_ddapc_restraint)
     687         4159 :       CALL section_add_keyword(section, keyword)
     688         4159 :       CALL keyword_release(keyword)
     689              : 
     690              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     691              :                                        description="Controls the printing basic info about the method", &
     692         4159 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     693         4159 :       CALL section_add_subsection(section, print_key)
     694         4159 :       CALL section_release(print_key)
     695              : 
     696         4159 :    END SUBROUTINE create_ddapc_restraint_section
     697              : 
     698              : ! **************************************************************************************************
     699              : !> \brief ...
     700              : !> \param section ...
     701              : ! **************************************************************************************************
     702         1399 :    SUBROUTINE create_s2_restraint_section(section)
     703              :       TYPE(section_type), POINTER                        :: section
     704              : 
     705              :       TYPE(keyword_type), POINTER                        :: keyword
     706              : 
     707         1399 :       NULLIFY (keyword)
     708         1399 :       CPASSERT(.NOT. ASSOCIATED(section))
     709              : 
     710              :       CALL section_create(section, __LOCATION__, name="S2_RESTRAINT", &
     711              :                           description="Use S2 in a re/constraint (OT only)", &
     712         1399 :                           n_keywords=7, n_subsections=0, repeats=.FALSE.)
     713              : 
     714              :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
     715              :                           description="force constant of the restraint", &
     716         1399 :                           usage="STRENGTH {real} ", default_r_val=0.1_dp)
     717         1399 :       CALL section_add_keyword(section, keyword)
     718         1399 :       CALL keyword_release(keyword)
     719              : 
     720              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET", &
     721              :                           description="target value of the restraint", &
     722         1399 :                           usage="TARGET {real} ", default_r_val=1._dp)
     723         1399 :       CALL section_add_keyword(section, keyword)
     724         1399 :       CALL keyword_release(keyword)
     725              : 
     726              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL_FORM", &
     727              :                           description="Specifies the functional form of the term added", &
     728              :                           usage="FUNCTIONAL_FORM RESTRAINT", &
     729              :                           enum_c_vals=s2a("RESTRAINT", "CONSTRAINT"), &
     730              :                           enum_i_vals=[do_s2_restraint, do_s2_constraint], &
     731              :                           enum_desc=s2a("Harmonic potential: s*(q-t)**2", "Constraint form: s*(q-t)"), &
     732         1399 :                           default_i_val=do_s2_restraint)
     733         1399 :       CALL section_add_keyword(section, keyword)
     734         1399 :       CALL keyword_release(keyword)
     735              : 
     736         1399 :    END SUBROUTINE create_s2_restraint_section
     737              : 
     738              : ! **************************************************************************************************
     739              : !> \brief input section for optional parameters for LRIGPW
     740              : !>        LRI: local resolution of identity
     741              : !> \param section the section to create
     742              : !> \author Dorothea Golze [02.2015]
     743              : ! **************************************************************************************************
     744         5558 :    SUBROUTINE create_lrigpw_section(section)
     745              :       TYPE(section_type), POINTER                        :: section
     746              : 
     747              :       TYPE(keyword_type), POINTER                        :: keyword
     748              : 
     749         5558 :       CPASSERT(.NOT. ASSOCIATED(section))
     750              :       CALL section_create(section, __LOCATION__, name="LRIGPW", &
     751              :                           description="This section specifies optional parameters for LRIGPW.", &
     752        11116 :                           n_keywords=3, n_subsections=0, repeats=.FALSE., citations=[Golze2017b])
     753              : 
     754         5558 :       NULLIFY (keyword)
     755              : 
     756              :       CALL keyword_create(keyword, __LOCATION__, name="LRI_OVERLAP_MATRIX", &
     757              :                           description="Specifies whether to calculate the inverse or the "// &
     758              :                           "pseudoinverse of the overlap matrix of the auxiliary "// &
     759              :                           "basis set. Calculating the pseudoinverse is necessary "// &
     760              :                           "for very large auxiliary basis sets, but more expensive. "// &
     761              :                           "Using the pseudoinverse, consistent forces are not "// &
     762              :                           "guaranteed yet.", &
     763              :                           usage="LRI_OVERLAP_MATRIX INVERSE", &
     764              :                           enum_c_vals=s2a("INVERSE", "PSEUDO_INVERSE_SVD", "PSEUDO_INVERSE_DIAG", &
     765              :                                           "AUTOSELECT"), &
     766              :                           enum_desc=s2a("Calculate inverse of the overlap matrix.", &
     767              :                                         "Calculate the pseuodinverse of the overlap matrix "// &
     768              :                                         "using singular value decomposition.", &
     769              :                                         "Calculate the pseudoinverse of the overlap matrix "// &
     770              :                                         "by prior diagonalization.", &
     771              :                                         "Choose automatically for each pair whether to "// &
     772              :                                         "calculate the inverse or pseudoinverse based on the "// &
     773              :                                         "condition number of the overlap matrix for each pair. "// &
     774              :                                         "Calculating the pseudoinverse is much more expensive."), &
     775              :                           enum_i_vals=[do_lri_inv, do_lri_pseudoinv_svd, &
     776              :                                        do_lri_pseudoinv_diag, do_lri_inv_auto], &
     777         5558 :                           default_i_val=do_lri_inv)
     778         5558 :       CALL section_add_keyword(section, keyword)
     779         5558 :       CALL keyword_release(keyword)
     780              : 
     781              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_CONDITION_NUM", &
     782              :                           description="If AUTOSELECT is chosen for LRI_OVERLAP_MATRIX, this "// &
     783              :                           "keyword specifies that the pseudoinverse is calculated "// &
     784              :                           "only if the LOG of the condition number of the lri "// &
     785              :                           "overlap matrix is larger than the given value.", &
     786         5558 :                           usage="MAX_CONDITION_NUM 20.0", default_r_val=20.0_dp)
     787         5558 :       CALL section_add_keyword(section, keyword)
     788         5558 :       CALL keyword_release(keyword)
     789              : 
     790              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_O3_INT", &
     791              :                           description="Threshold for ABA and ABB integrals in LRI. "// &
     792              :                           "This is used for screening in the KS and "// &
     793              :                           "force calculations (tensor contractions).", &
     794         5558 :                           usage="EPS_O3_INT 1.e-10", default_r_val=1.0e-14_dp)
     795         5558 :       CALL section_add_keyword(section, keyword)
     796         5558 :       CALL keyword_release(keyword)
     797              : 
     798              :       CALL keyword_create(keyword, __LOCATION__, name="DEBUG_LRI_INTEGRALS", &
     799              :                           description="Debug the integrals needed for LRIGPW.", &
     800              :                           usage="DEBUG_LRI_INTEGRALS TRUE", &
     801         5558 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     802         5558 :       CALL section_add_keyword(section, keyword)
     803         5558 :       CALL keyword_release(keyword)
     804              : 
     805              :       CALL keyword_create(keyword, __LOCATION__, name="EXACT_1C_TERMS", &
     806              :                           description="Don't use LRI for one center densities.", &
     807              :                           usage="EXACT_1C_TERMS TRUE", &
     808         5558 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     809         5558 :       CALL section_add_keyword(section, keyword)
     810         5558 :       CALL keyword_release(keyword)
     811              : 
     812              :       CALL keyword_create(keyword, __LOCATION__, name="PPL_RI", &
     813              :                           description="Use LRI/RI for local pseudopotential.", &
     814              :                           usage="PPL_RI TRUE", &
     815         5558 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     816         5558 :       CALL section_add_keyword(section, keyword)
     817         5558 :       CALL keyword_release(keyword)
     818              : 
     819              :       CALL keyword_create(keyword, __LOCATION__, name="RI_STATISTIC", &
     820              :                           description="Print statistical information on the RI calculation.", &
     821              :                           usage="RI_STATISTIC TRUE", &
     822         5558 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     823         5558 :       CALL section_add_keyword(section, keyword)
     824         5558 :       CALL keyword_release(keyword)
     825              : 
     826              :       CALL keyword_create(keyword, __LOCATION__, name="DISTANT_PAIR_APPROXIMATION", &
     827              :                           description="Calculate distant pairs using an independent atom approximation.", &
     828              :                           usage="DISTANT_PAIR_APPROXIMATION TRUE", &
     829         5558 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     830         5558 :       CALL section_add_keyword(section, keyword)
     831         5558 :       CALL keyword_release(keyword)
     832              : 
     833              :       CALL keyword_create(keyword, __LOCATION__, name="DISTANT_PAIR_METHOD", &
     834              :                           description="Method used to separate pair density for distant pairs. "// &
     835              :                           "Options: EW (equal weights); AW (atomic weights); SW (set weights); "// &
     836              :                           "LW (shell function weights)", &
     837              :                           usage="DISTANT_PAIR_METHOD {method}", &
     838         5558 :                           default_c_val="LW")
     839         5558 :       CALL section_add_keyword(section, keyword)
     840         5558 :       CALL keyword_release(keyword)
     841              : 
     842              :       CALL keyword_create(keyword, __LOCATION__, name="DISTANT_PAIR_RADII", &
     843              :                           description="Inner and outer radii used in distant "// &
     844              :                           "pair separation. Smooth interpolation between inner and outer "// &
     845              :                           "radius is used.", &
     846              :                           usage="DISTANT_PAIR_RADII r_inner {real} r_outer {real} ", &
     847              :                           n_var=2, default_r_vals=[8._dp, 12._dp], unit_str='bohr', &
     848         5558 :                           type_of_var=real_t)
     849         5558 :       CALL section_add_keyword(section, keyword)
     850         5558 :       CALL keyword_release(keyword)
     851              : 
     852              :       CALL keyword_create(keyword, __LOCATION__, name="SHG_LRI_INTEGRALS", &
     853              :                           description="Uses the SHG (solid harmonic Gaussian) integral "// &
     854              :                           "scheme instead of Obara-Saika", &
     855              :                           usage="SHG_LRI_INTEGRALS TRUE", &
     856              :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE., &
     857        11116 :                           citations=[Golze2017a])
     858         5558 :       CALL section_add_keyword(section, keyword)
     859         5558 :       CALL keyword_release(keyword)
     860              : 
     861              :       CALL keyword_create(keyword, __LOCATION__, name="RI_SINV", &
     862              :                           description="Approximation to be used for the inverse of the "// &
     863              :                           "RI overlap matrix. INVF, INVS: exact inverse, apply directly "// &
     864              :                           "for solver (F:full matrix, S:sparsematrix). AINV approximate inverse, use with PCG. "// &
     865              :                           "NONE: no approximation used with CG solver.", &
     866         5558 :                           usage="RI_SINV NONE", default_c_val="INVF")
     867         5558 :       CALL section_add_keyword(section, keyword)
     868         5558 :       CALL keyword_release(keyword)
     869              : 
     870         5558 :    END SUBROUTINE create_lrigpw_section
     871              : 
     872              : END MODULE input_cp2k_qs
        

Generated by: LCOV version 2.0-1