LCOV - code coverage report
Current view: top level - src - input_cp2k_xc.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:21ef868) Lines: 100.0 % 731 731
Test Date: 2026-08-14 07:04:57 Functions: 100.0 % 9 9

            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 xc section of the input
      10              : !> \par History
      11              : !>      10.2009 moved out of input_cp2k_dft [jgh]
      12              : !> \author fawzi
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_xc
      15              :    USE bibliography,                    ONLY: &
      16              :         Becke1988, Becke1997, BeckeRoussel1989, Caldeweyher2020, Goedecker1996, Grimme2006, &
      17              :         Grimme2010, Grimme2011, Heyd2004, Kruse2012, Lee1988, Ortiz1994, Perdew1981, Perdew1996, &
      18              :         Perdew2008, Proynov2007, Tao2003, Tran2013, Vosko1980, Wellendorff2012, Zhang1998
      19              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      20              :                                               cp_print_key_section_create,&
      21              :                                               high_print_level
      22              :    USE eeq_input,                       ONLY: create_eeq_control_section
      23              :    USE input_constants,                 ONLY: &
      24              :         do_adiabatic_hybrid_mcy3, do_adiabatic_model_pade, fxc_funct_gga, fxc_funct_lda, &
      25              :         fxc_funct_pade, fxc_none, gaussian, slater, vdw_nl_drsll, vdw_nl_lmkll, vdw_nl_rvv10, &
      26              :         vdw_pairpot_dftd2, vdw_pairpot_dftd3, vdw_pairpot_dftd3bj, vdw_pairpot_dftd4, &
      27              :         xc_funct_b3lyp, xc_funct_beefvdw, xc_funct_blyp, xc_funct_bp, xc_funct_hcth120, &
      28              :         xc_funct_no_shortcut, xc_funct_olyp, xc_funct_pade, xc_funct_pbe, xc_funct_pbe0, &
      29              :         xc_funct_tpss, xc_none, xc_pot_energy_none, xc_pot_energy_sum_eigenvalues, &
      30              :         xc_pot_energy_xc_functional, xc_vdw_fun_none, xc_vdw_fun_nonloc, xc_vdw_fun_pairpot
      31              :    USE input_cp2k_hfx,                  ONLY: create_hfx_section
      32              :    USE input_cp2k_mp2,                  ONLY: create_mp2_section
      33              :    USE input_keyword_types,             ONLY: keyword_create,&
      34              :                                               keyword_release,&
      35              :                                               keyword_type
      36              :    USE input_section_types,             ONLY: section_add_keyword,&
      37              :                                               section_add_subsection,&
      38              :                                               section_create,&
      39              :                                               section_release,&
      40              :                                               section_type
      41              :    USE input_val_types,                 ONLY: char_t,&
      42              :                                               integer_t,&
      43              :                                               real_t
      44              :    USE kinds,                           ONLY: dp
      45              :    USE string_utilities,                ONLY: s2a
      46              :    USE xc_input_constants,              ONLY: &
      47              :         c_pw92, c_pw92dmc, c_pw92vmc, c_pz, c_pzdmc, c_pzvmc, do_vwn3, do_vwn5, ke_lc, ke_llp, &
      48              :         ke_ol1, ke_ol2, ke_pbe, ke_pw86, ke_pw91, ke_t92, pz_orig, skala_gapw_cp2k_default, &
      49              :         skala_gapw_direct_valence, skala_gapw_paw_one_center, skala_gapw_paw_one_center_split, &
      50              :         xalpha, xc_b97_3c, xc_b97_grimme, xc_b97_mardirossian, xc_b97_orig, xc_deriv_collocate, &
      51              :         xc_deriv_nn10_smooth, xc_deriv_nn50_smooth, xc_deriv_pw, xc_deriv_spline2, &
      52              :         xc_deriv_spline2_smooth, xc_deriv_spline3, xc_deriv_spline3_smooth, xc_pbe_orig, &
      53              :         xc_pbe_rev, xc_pbe_sol, xc_rho_nn10, xc_rho_nn50, xc_rho_no_smooth, xc_rho_spline2_smooth, &
      54              :         xc_rho_spline3_smooth, xgga_b88x, xgga_ev93, xgga_opt, xgga_pbex, xgga_pw86, xgga_pw91, &
      55              :         xgga_revpbe
      56              :    USE xc_libxc,                        ONLY: libxc_add_sections
      57              : #include "./base/base_uses.f90"
      58              : 
      59              :    IMPLICIT NONE
      60              :    PRIVATE
      61              : 
      62              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      63              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_xc'
      64              : 
      65              :    PUBLIC :: create_xc_section, create_xc_fun_section
      66              : 
      67              : CONTAINS
      68              : 
      69              : ! **************************************************************************************************
      70              : !> \brief creates the structure of the section needed to select the xc functional
      71              : !> \param section the section that will be created
      72              : !> \author fawzi
      73              : ! **************************************************************************************************
      74       106335 :    SUBROUTINE create_xc_fun_section(section)
      75              :       TYPE(section_type), POINTER                        :: section
      76              : 
      77              :       TYPE(keyword_type), POINTER                        :: keyword
      78              :       TYPE(section_type), POINTER                        :: subsection
      79              : 
      80       106335 :       CPASSERT(.NOT. ASSOCIATED(section))
      81              :       CALL section_create(section, __LOCATION__, name="xc_functional", &
      82              :                           description="The eXchange-Correlation functional to use. In case of hybrid functionals, all scaling "// &
      83              :                           "parameters and potential types have to be specified in the HF section except from a few "// &
      84              :                           "predefined combinations (see _SECTION_PARAMETERS_ below). CP2K does NOT set it up "// &
      85              :                           "automatically not even for LibXC functionals.", &
      86              :                           n_keywords=0, n_subsections=4, repeats=.FALSE., &
      87              :                           citations=[Ortiz1994, Becke1988, Perdew1996, Zhang1998, Lee1988, &
      88              :                                      Heyd2004, Vosko1980, Goedecker1996, Perdew1981, &
      89      1276020 :                                      Tao2003, Wellendorff2012])
      90              : 
      91       106335 :       NULLIFY (subsection, keyword)
      92              :       CALL keyword_create( &
      93              :          keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
      94              :          description="Shortcut for the most common functional combinations. These make use of the implementations provided by "// &
      95              :          "native CP2K (without LibXC). In case of hybrid functionals (B3LYP, PBE0), set the "// &
      96              :          "accuracy-related and system-dependent parameters in the HF section (especially MAX_MEMORY, EPS_SCHWARZ, "// &
      97              :          "CUTOFF_RADIUS, POTENTIAL_TYPE) as these are not set automatically.", &
      98              :          usage="&xc_functional BLYP", &
      99              :          enum_c_vals=s2a("B3LYP", "PBE0", "BLYP", "BP", "PADE", "LDA", "PBE", &
     100              :                          "TPSS", "HCTH120", "OLYP", "BEEFVDW", "NO_SHORTCUT", "NONE"), &
     101              :          enum_i_vals=[xc_funct_b3lyp, xc_funct_pbe0, xc_funct_blyp, xc_funct_bp, xc_funct_pade, xc_funct_pade, xc_funct_pbe, &
     102              :                       xc_funct_tpss, xc_funct_hcth120, xc_funct_olyp, xc_funct_beefvdw, xc_funct_no_shortcut, xc_none], &
     103              :          enum_desc=s2a("B3LYP", &
     104              :                        "PBE0 (see note in section XC/XC_FUNCTIONAL/PBE)", &
     105              :                        "BLYP", "BP", "PADE", "Alias for PADE", &
     106              :                        "PBE (see note in section XC/XC_FUNCTIONAL/PBE)", &
     107              :                        "TPSS (not available with LSD, use LIBXC version instead)", "HCTH120", "OLYP", &
     108              :                        "BEEFVDW", "NO_SHORTCUT", "NONE"), &
     109              :          default_i_val=xc_funct_no_shortcut, &
     110       106335 :          lone_keyword_i_val=xc_funct_no_shortcut)
     111       106335 :       CALL section_add_keyword(section, keyword)
     112       106335 :       CALL keyword_release(keyword)
     113              : 
     114              :       CALL section_create(subsection, __LOCATION__, name="BECKE88", &
     115              :                           description="Uses the Becke 88 exchange functional", &
     116              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     117       212670 :                           citations=[Becke1988])
     118              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     119              :                           description="activates the functional", &
     120       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     121       106335 :       CALL section_add_keyword(subsection, keyword)
     122       106335 :       CALL keyword_release(keyword)
     123              :       CALL keyword_create( &
     124              :          keyword, __LOCATION__, name="scale_x", &
     125              :          description="scales the exchange part of the functional", &
     126       106335 :          default_r_val=1._dp)
     127       106335 :       CALL section_add_keyword(subsection, keyword)
     128       106335 :       CALL keyword_release(keyword)
     129              : 
     130       106335 :       CALL section_add_subsection(section, subsection)
     131       106335 :       CALL section_release(subsection)
     132              : 
     133              :       CALL section_create(subsection, __LOCATION__, name="LYP_ADIABATIC", &
     134              :                           description="Uses the LYP correlation functional in an adiabatic fashion", &
     135              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     136       212670 :                           citations=[Lee1988])
     137              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     138              :                           description="activates the functional", &
     139       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     140       106335 :       CALL section_add_keyword(subsection, keyword)
     141       106335 :       CALL keyword_release(keyword)
     142              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
     143              :                           description="Defines the parameter of the adiabatic curve.", &
     144       106335 :                           default_r_val=1._dp)
     145       106335 :       CALL section_add_keyword(subsection, keyword)
     146       106335 :       CALL keyword_release(keyword)
     147              : 
     148       106335 :       CALL section_add_subsection(section, subsection)
     149       106335 :       CALL section_release(subsection)
     150              : 
     151              :       CALL section_create(subsection, __LOCATION__, name="BECKE88_LR_ADIABATIC", &
     152              :                           description="Uses the Becke 88 longrange exchange functional in an adiabatic fashion", &
     153              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     154       212670 :                           citations=[Becke1988])
     155              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     156              :                           description="activates the functional", &
     157       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     158       106335 :       CALL section_add_keyword(subsection, keyword)
     159       106335 :       CALL keyword_release(keyword)
     160              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     161              :                           description="scales the exchange part of the functional", &
     162       106335 :                           default_r_val=1._dp)
     163       106335 :       CALL section_add_keyword(subsection, keyword)
     164       106335 :       CALL keyword_release(keyword)
     165              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     166              :                           description="Potential parameter in erf(omega*r)/r", &
     167       106335 :                           default_r_val=1._dp)
     168       106335 :       CALL section_add_keyword(subsection, keyword)
     169       106335 :       CALL keyword_release(keyword)
     170              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
     171              :                           description="Defines the parameter of the adiabatic curve", &
     172       106335 :                           default_r_val=1._dp)
     173       106335 :       CALL section_add_keyword(subsection, keyword)
     174       106335 :       CALL keyword_release(keyword)
     175              : 
     176       106335 :       CALL section_add_subsection(section, subsection)
     177       106335 :       CALL section_release(subsection)
     178              : 
     179              :       CALL section_create(subsection, __LOCATION__, name="BECKE88_LR", &
     180              :                           description="Uses the Becke 88 longrange exchange functional", &
     181              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     182       212670 :                           citations=[Becke1988])
     183              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     184              :                           description="activates the functional", &
     185       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     186       106335 :       CALL section_add_keyword(subsection, keyword)
     187       106335 :       CALL keyword_release(keyword)
     188              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     189              :                           description="scales the exchange part of the functional", &
     190       106335 :                           default_r_val=1._dp)
     191       106335 :       CALL section_add_keyword(subsection, keyword)
     192       106335 :       CALL keyword_release(keyword)
     193              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     194              :                           description="Potential parameter in erf(omega*r)/r", &
     195       106335 :                           default_r_val=1._dp)
     196       106335 :       CALL section_add_keyword(subsection, keyword)
     197       106335 :       CALL keyword_release(keyword)
     198              : 
     199       106335 :       CALL section_add_subsection(section, subsection)
     200       106335 :       CALL section_release(subsection)
     201              : 
     202              :       CALL section_create(subsection, __LOCATION__, name="LYP", &
     203              :                           description="Uses the LYP functional", &
     204              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     205       212670 :                           citations=[Lee1988])
     206              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     207              :                           description="activates the functional", &
     208       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     209       106335 :       CALL section_add_keyword(subsection, keyword)
     210       106335 :       CALL keyword_release(keyword)
     211              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     212              :                           description="scales the correlation part of the functional", &
     213       106335 :                           default_r_val=1._dp)
     214       106335 :       CALL section_add_keyword(subsection, keyword)
     215       106335 :       CALL keyword_release(keyword)
     216       106335 :       CALL section_add_subsection(section, subsection)
     217       106335 :       CALL section_release(subsection)
     218              : 
     219              :       CALL section_create(subsection, __LOCATION__, name="PADE", &
     220              :                           description="Uses the PADE functional", &
     221              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     222       212670 :                           citations=[Goedecker1996])
     223              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     224              :                           description="activates the functional", &
     225       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     226       106335 :       CALL section_add_keyword(subsection, keyword)
     227       106335 :       CALL keyword_release(keyword)
     228       106335 :       CALL section_add_subsection(section, subsection)
     229       106335 :       CALL section_release(subsection)
     230              : 
     231              :       CALL section_create(subsection, __LOCATION__, name="HCTH", &
     232              :                           description="Uses the HCTH class of functionals", &
     233       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     234              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_SET", &
     235              :                           description="Which version of the parameters should be used", &
     236              :                           usage="PARAMETER_SET 407", &
     237              :                           enum_c_vals=["93 ", "120", "147", "407", "HLE"], &
     238              :                           enum_i_vals=[93, 120, 147, 407, 408], &
     239       638010 :                           default_i_val=120)
     240       106335 :       CALL section_add_keyword(subsection, keyword)
     241       106335 :       CALL keyword_release(keyword)
     242              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     243              :                           description="activates the functional", &
     244       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     245       106335 :       CALL section_add_keyword(subsection, keyword)
     246       106335 :       CALL keyword_release(keyword)
     247       106335 :       CALL section_add_subsection(section, subsection)
     248       106335 :       CALL section_release(subsection)
     249              : 
     250              :       CALL section_create(subsection, __LOCATION__, name="OPTX", &
     251              :                           description="Uses the OPTX functional", &
     252       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     253              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     254              :                           description="activates the functional", &
     255       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     256       106335 :       CALL section_add_keyword(subsection, keyword)
     257       106335 :       CALL keyword_release(keyword)
     258              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     259              :                           description="scales the exchange part of the functional", &
     260       106335 :                           default_r_val=1._dp)
     261       106335 :       CALL section_add_keyword(subsection, keyword)
     262       106335 :       CALL keyword_release(keyword)
     263              :       CALL keyword_create(keyword, __LOCATION__, name="a1", &
     264              :                           description="OPTX a1 coefficient", &
     265       106335 :                           default_r_val=1.05151_dp)
     266       106335 :       CALL section_add_keyword(subsection, keyword)
     267       106335 :       CALL keyword_release(keyword)
     268              :       CALL keyword_create(keyword, __LOCATION__, name="a2", &
     269              :                           description="OPTX a2 coefficient", &
     270       106335 :                           default_r_val=1.43169_dp)
     271       106335 :       CALL section_add_keyword(subsection, keyword)
     272       106335 :       CALL keyword_release(keyword)
     273              :       CALL keyword_create(keyword, __LOCATION__, name="gamma", &
     274              :                           description="OPTX gamma coefficient", &
     275       106335 :                           default_r_val=0.006_dp)
     276       106335 :       CALL section_add_keyword(subsection, keyword)
     277       106335 :       CALL keyword_release(keyword)
     278       106335 :       CALL section_add_subsection(section, subsection)
     279       106335 :       CALL section_release(subsection)
     280              : 
     281       106335 :       CALL libxc_add_sections(section)
     282              : 
     283              :       CALL section_create(subsection, __LOCATION__, name="CS1", &
     284              :                           description="Uses the CS1 functional", &
     285       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     286              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     287              :                           description="activates the functional", &
     288       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     289       106335 :       CALL section_add_keyword(subsection, keyword)
     290       106335 :       CALL keyword_release(keyword)
     291       106335 :       CALL section_add_subsection(section, subsection)
     292       106335 :       CALL section_release(subsection)
     293              : 
     294              :       CALL section_create(subsection, __LOCATION__, name="XGGA", &
     295              :                           description="Uses one of the XGGA functionals (optimized versions of "// &
     296              :                           "some of these functionals might be available outside this section).", &
     297       106335 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     298              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     299              :                           description="activates the functional", &
     300       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     301       106335 :       CALL section_add_keyword(subsection, keyword)
     302       106335 :       CALL keyword_release(keyword)
     303              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL", &
     304              :                           description="Which one of the XGGA functionals should be used", &
     305              :                           usage="FUNCTIONAL PW86X", &
     306              :                           enum_c_vals=[ &
     307              :                           "BECKE88X", &
     308              :                           "PW86X   ", &
     309              :                           "PW91X   ", &
     310              :                           "PBEX    ", &
     311              :                           "REV_PBEX", &
     312              :                           "OPTX    ", &
     313              :                           "EV93    "], &
     314              :                           enum_i_vals=[xgga_b88x, xgga_pw86, xgga_pw91, xgga_pbex, xgga_revpbe, xgga_opt, xgga_ev93], &
     315       850680 :                           default_i_val=xgga_b88x)
     316       106335 :       CALL section_add_keyword(subsection, keyword)
     317       106335 :       CALL keyword_release(keyword)
     318       106335 :       CALL section_add_subsection(section, subsection)
     319       106335 :       CALL section_release(subsection)
     320              : 
     321              :       CALL section_create(subsection, __LOCATION__, name="KE_GGA", &
     322              :                           description="Uses one of the KE_GGA functionals (optimized versions of "// &
     323              :                           "some of these functionals might be available outside this section). "// &
     324              :                           "These functionals are needed for the computation of the kinetic "// &
     325              :                           "energy in the Kim-Gordon method.", &
     326       106335 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     327              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     328              :                           description="activates the functional", &
     329       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     330       106335 :       CALL section_add_keyword(subsection, keyword)
     331       106335 :       CALL keyword_release(keyword)
     332              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL", &
     333              :                           description="Which one of the KE_GGA functionals should be used", &
     334              :                           usage="FUNCTIONAL (OL1|OL2|LLP|PW86|PW91|LC|T92|PBE)", &
     335              :                           enum_c_vals=["OL1 ", "OL2 ", "LLP ", "PW86", "PW91", "LC  ", "T92 ", "PBE "], &
     336              :                           enum_i_vals=[ke_ol1, ke_ol2, ke_llp, ke_pw86, ke_pw91, ke_lc, ke_t92, ke_pbe], &
     337              :                           enum_desc=s2a("Uses first Ou-Yang and Levy functional, currently not producing correct results", &
     338              :                                         "Uses second Ou-Yang and Levy functional, currently not producing correct results", &
     339              :                                         "Uses Lee, Lee, and Parr functional", &
     340              :                                         "Uses Perdew and Wang's 1986 functional", &
     341              :                                         "Uses Perdew and Wang's 1991 functional", &
     342              :                                         "Uses Lembarki and Chermette functional", &
     343              :                                         "Uses Thakkar functional", &
     344              :                                         "Uses the 1996 functional of Perdew, Burke and Ernzerhof"), &
     345       957015 :                           default_i_val=ke_llp)
     346       106335 :       CALL section_add_keyword(subsection, keyword)
     347       106335 :       CALL keyword_release(keyword)
     348       106335 :       CALL section_add_subsection(section, subsection)
     349       106335 :       CALL section_release(subsection)
     350              : 
     351              :       CALL section_create(subsection, __LOCATION__, name="P86C", &
     352              :                           description="Uses the P86C functional", &
     353       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     354              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     355              :                           description="activates the functional", &
     356       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     357       106335 :       CALL section_add_keyword(subsection, keyword)
     358       106335 :       CALL keyword_release(keyword)
     359              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     360              :                           description="scales the correlation part of the functional", &
     361       106335 :                           default_r_val=1._dp)
     362       106335 :       CALL section_add_keyword(subsection, keyword)
     363       106335 :       CALL keyword_release(keyword)
     364       106335 :       CALL section_add_subsection(section, subsection)
     365       106335 :       CALL section_release(subsection)
     366              : 
     367              :       CALL section_create(subsection, __LOCATION__, name="PW92", &
     368              :                           description="Uses the PerdewWang correlation functional.", &
     369       106335 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     370              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     371              :                           description="activates the functional", &
     372       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     373       106335 :       CALL section_add_keyword(subsection, keyword)
     374       106335 :       CALL keyword_release(keyword)
     375              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
     376              :                           description="Scaling of the energy functional", &
     377       106335 :                           default_r_val=1.0_dp)
     378       106335 :       CALL section_add_keyword(subsection, keyword)
     379       106335 :       CALL keyword_release(keyword)
     380              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETRIZATION", &
     381              :                           description="Which one of parametrizations should be used", &
     382              :                           usage="PARAMETRIZATION DMC", &
     383              :                           enum_c_vals=[ &
     384              :                           "ORIGINAL", &
     385              :                           "DMC     ", &
     386              :                           "VMC     "], &
     387              :                           enum_i_vals=[c_pw92, c_pw92dmc, c_pw92vmc], &
     388       425340 :                           default_i_val=c_pw92)
     389       106335 :       CALL section_add_keyword(subsection, keyword)
     390       106335 :       CALL keyword_release(keyword)
     391       106335 :       CALL section_add_subsection(section, subsection)
     392       106335 :       CALL section_release(subsection)
     393              : 
     394              :       CALL section_create(subsection, __LOCATION__, name="PZ81", &
     395              :                           description="Uses the PZ functional.", &
     396              :                           n_keywords=1, n_subsections=0, repeats=.FALSE., &
     397       319005 :                           citations=[Perdew1981, Ortiz1994])
     398              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     399              :                           description="activates the functional", &
     400       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     401       106335 :       CALL section_add_keyword(subsection, keyword)
     402       106335 :       CALL keyword_release(keyword)
     403              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETRIZATION", &
     404              :                           description="Which one of parametrizations should be used", &
     405              :                           usage="PARAMETRIZATION DMC", &
     406              :                           enum_c_vals=[ &
     407              :                           "ORIGINAL", &
     408              :                           "DMC     ", &
     409              :                           "VMC     "], &
     410              :                           enum_i_vals=[c_pz, c_pzdmc, c_pzvmc], &
     411       425340 :                           default_i_val=pz_orig)
     412       106335 :       CALL section_add_keyword(subsection, keyword)
     413       106335 :       CALL keyword_release(keyword)
     414              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     415              :                           description="scales the correlation part of the functional", &
     416       106335 :                           default_r_val=1._dp)
     417       106335 :       CALL section_add_keyword(subsection, keyword)
     418       106335 :       CALL keyword_release(keyword)
     419       106335 :       CALL section_add_subsection(section, subsection)
     420       106335 :       CALL section_release(subsection)
     421              : 
     422              :       CALL section_create(subsection, __LOCATION__, name="TFW", &
     423              :                           description="Uses the TFW functional", &
     424       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     425              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     426              :                           description="activates the functional", &
     427       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     428       106335 :       CALL section_add_keyword(subsection, keyword)
     429       106335 :       CALL keyword_release(keyword)
     430       106335 :       CALL section_add_subsection(section, subsection)
     431       106335 :       CALL section_release(subsection)
     432              : 
     433              :       CALL section_create(subsection, __LOCATION__, name="TF", &
     434              :                           description="Uses the TF functional", &
     435       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     436              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     437              :                           description="activates the functional", &
     438       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     439       106335 :       CALL section_add_keyword(subsection, keyword)
     440       106335 :       CALL keyword_release(keyword)
     441       106335 :       CALL section_add_subsection(section, subsection)
     442       106335 :       CALL section_release(subsection)
     443              : 
     444              :       CALL section_create(subsection, __LOCATION__, name="VWN", &
     445              :                           description="Uses the VWN functional", &
     446              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     447       212670 :                           citations=[Vosko1980])
     448              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     449              :                           description="activates the functional", &
     450       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     451       106335 :       CALL section_add_keyword(subsection, keyword)
     452       106335 :       CALL keyword_release(keyword)
     453              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     454              :                           description="scales the correlation part of the functional", &
     455       106335 :                           default_r_val=1._dp)
     456       106335 :       CALL section_add_keyword(subsection, keyword)
     457       106335 :       CALL keyword_release(keyword)
     458              : 
     459              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL_TYPE", &
     460              :                           description="Which version of the VWN functional should be used", &
     461              :                           usage="FUNCTIONAL_TYPE VWN5", &
     462              :                           enum_c_vals=s2a("VWN5", "VWN3"), &
     463              :                           enum_i_vals=[do_vwn5, do_vwn3], &
     464              :                           enum_desc=s2a("This is the recommended (correct) version of the VWN functional", &
     465              :                                         "This version is the default in Gaussian, but not recommended. "// &
     466              :                                         "Notice that it is also employed in Gaussian's default version of B3LYP"), &
     467       106335 :                           default_i_val=do_vwn5)
     468              : 
     469       106335 :       CALL section_add_keyword(subsection, keyword)
     470       106335 :       CALL keyword_release(keyword)
     471       106335 :       CALL section_add_subsection(section, subsection)
     472       106335 :       CALL section_release(subsection)
     473              : 
     474              :       CALL section_create(subsection, __LOCATION__, name="XALPHA", &
     475              :                           description="Uses the XALPHA (SLATER) functional.", &
     476       106335 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     477              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     478              :                           description="activates the functional", &
     479       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     480       106335 :       CALL section_add_keyword(subsection, keyword)
     481       106335 :       CALL keyword_release(keyword)
     482              :       CALL keyword_create(keyword, __LOCATION__, name="XA", &
     483              :                           description="Value of the xa parameter (this does not change the exponent, "// &
     484              :                           "just the mixing)", &
     485       106335 :                           usage="XA 0.7", default_r_val=2._dp/3._dp)
     486       106335 :       CALL section_add_keyword(subsection, keyword)
     487       106335 :       CALL keyword_release(keyword)
     488              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     489              :                           description="scales the exchange part of the functional", &
     490       106335 :                           default_r_val=1._dp)
     491       106335 :       CALL section_add_keyword(subsection, keyword)
     492       106335 :       CALL keyword_release(keyword)
     493       106335 :       CALL section_add_subsection(section, subsection)
     494       106335 :       CALL section_release(subsection)
     495              : 
     496              :       CALL section_create(subsection, __LOCATION__, name="TPSS", &
     497              :                           description="Uses the TPSS functional. Note, that there is no LSD version available. "// &
     498              :                           "In such cases, use the LIBXC version instead.", &
     499              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     500       212670 :                           citations=[Tao2003])
     501              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     502              :                           description="Activates the functional", &
     503       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     504       106335 :       CALL section_add_keyword(subsection, keyword)
     505       106335 :       CALL keyword_release(keyword)
     506              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     507              :                           description="scales the exchange part of the functional", &
     508       106335 :                           default_r_val=1._dp)
     509       106335 :       CALL section_add_keyword(subsection, keyword)
     510       106335 :       CALL keyword_release(keyword)
     511              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     512              :                           description="scales the correlation part of the functional", &
     513       106335 :                           default_r_val=1._dp)
     514       106335 :       CALL section_add_keyword(subsection, keyword)
     515       106335 :       CALL keyword_release(keyword)
     516       106335 :       CALL section_add_subsection(section, subsection)
     517       106335 :       CALL section_release(subsection)
     518              : 
     519              :       CALL section_create(subsection, __LOCATION__, name="PBE", &
     520              :                           description="Uses the PBE functional", &
     521              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     522       425340 :                           citations=[Perdew1996, Zhang1998, Perdew2008])
     523              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     524              :                           description="activates the functional", &
     525       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     526       106335 :       CALL section_add_keyword(subsection, keyword)
     527       106335 :       CALL keyword_release(keyword)
     528              :       CALL keyword_create(keyword, __LOCATION__, name="parametrization", &
     529              :                           description="switches between the different "// &
     530              :                           "parametrizations of the functional. "// &
     531              :                           "Note: Beta parameters used have only 5 significant digits, "// &
     532              :                           "as published. For higher precision and program comparison "// &
     533              :                           "use the LIBXC library.", &
     534              :                           enum_i_vals=[xc_pbe_orig, xc_pbe_rev, xc_pbe_sol], &
     535              :                           enum_c_vals=["ORIG  ", "revPBE", "PBEsol"], &
     536              :                           enum_desc=["original PBE                        ", &
     537              :                                      "revised PBE (revPBE)                ", &
     538              :                                      "PBE for solids and surfaces (PBEsol)"], &
     539       744345 :                           default_i_val=xc_pbe_orig)
     540       106335 :       CALL section_add_keyword(subsection, keyword)
     541       106335 :       CALL keyword_release(keyword)
     542              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     543              :                           description="scales the exchange part of the functional", &
     544       106335 :                           default_r_val=1._dp)
     545       106335 :       CALL section_add_keyword(subsection, keyword)
     546       106335 :       CALL keyword_release(keyword)
     547              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     548              :                           description="scales the correlation part of the functional", &
     549       106335 :                           default_r_val=1._dp)
     550       106335 :       CALL section_add_keyword(subsection, keyword)
     551       106335 :       CALL keyword_release(keyword)
     552       106335 :       CALL section_add_subsection(section, subsection)
     553       106335 :       CALL section_release(subsection)
     554              : 
     555       106335 :       CALL create_gauxc_section(subsection)
     556       106335 :       CALL section_add_subsection(section, subsection)
     557       106335 :       CALL section_release(subsection)
     558              : 
     559              :       CALL section_create(subsection, __LOCATION__, name="XWPBE", &
     560              :                           description="Uses the short range PBE functional", &
     561              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     562       212670 :                           citations=[Heyd2004])
     563              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     564              :                           description="activates the functional", &
     565       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     566       106335 :       CALL section_add_keyword(subsection, keyword)
     567       106335 :       CALL keyword_release(keyword)
     568              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     569              :                           description="scales the exchange part of the functional", &
     570       106335 :                           default_r_val=1._dp)
     571       106335 :       CALL section_add_keyword(subsection, keyword)
     572       106335 :       CALL keyword_release(keyword)
     573              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x0", &
     574              :                           description="scales the exchange part of the original hole PBE-functional", &
     575       106335 :                           default_r_val=0.0_dp)
     576       106335 :       CALL section_add_keyword(subsection, keyword)
     577       106335 :       CALL keyword_release(keyword)
     578              :       CALL keyword_create(keyword, __LOCATION__, name="omega", &
     579              :                           description="screening parameter", &
     580       106335 :                           default_r_val=1._dp)
     581       106335 :       CALL section_add_keyword(subsection, keyword)
     582       106335 :       CALL keyword_release(keyword)
     583       106335 :       CALL section_add_subsection(section, subsection)
     584       106335 :       CALL section_release(subsection)
     585              : 
     586              :       CALL section_create(subsection, __LOCATION__, name="BECKE97", &
     587              :                           description="Uses the Becke 97 exchange correlation functional", &
     588              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     589       319005 :                           citations=[Becke1997, Grimme2006])
     590              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     591              :                           description="activates the functional", &
     592       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     593       106335 :       CALL section_add_keyword(subsection, keyword)
     594       106335 :       CALL keyword_release(keyword)
     595              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     596              :                 description="scales the exchange part of the functional, if -1 the default for the given parametrization is used", &
     597       106335 :                           default_r_val=-1._dp)
     598       106335 :       CALL section_add_keyword(subsection, keyword)
     599       106335 :       CALL keyword_release(keyword)
     600              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     601              :                           description="scales the correlation part of the functional", &
     602       106335 :                           default_r_val=1._dp)
     603       106335 :       CALL section_add_keyword(subsection, keyword)
     604       106335 :       CALL keyword_release(keyword)
     605              :       CALL keyword_create(keyword, __LOCATION__, name="parametrization", &
     606              :                           description="switches between the B97 and Grimme parametrization ", &
     607              :                           enum_i_vals=[xc_b97_orig, xc_b97_grimme, xc_b97_grimme, xc_b97_mardirossian, xc_b97_3c], &
     608              :                           enum_c_vals=["ORIG      ", "B97GRIMME ", "B97_GRIMME", "wB97X-V   ", "B97-3c    "], &
     609       638010 :                           default_i_val=xc_b97_orig)
     610       106335 :       CALL section_add_keyword(subsection, keyword)
     611       106335 :       CALL keyword_release(keyword)
     612              : 
     613       106335 :       CALL section_add_subsection(section, subsection)
     614       106335 :       CALL section_release(subsection)
     615              : 
     616              :       CALL section_create(subsection, __LOCATION__, name="BECKE_ROUSSEL", &
     617              :                           description="Becke Roussel exchange hole model. Can be used "// &
     618              :                           "as long range correction with a truncated coulomb potential", &
     619              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     620       319005 :                           citations=[BeckeRoussel1989, Proynov2007])
     621              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     622              :                           description="activates the functional", &
     623       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     624       106335 :       CALL section_add_keyword(subsection, keyword)
     625       106335 :       CALL keyword_release(keyword)
     626              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     627              :                           description="scales the exchange part of the functional", &
     628       106335 :                           default_r_val=1._dp)
     629       106335 :       CALL section_add_keyword(subsection, keyword)
     630       106335 :       CALL keyword_release(keyword)
     631              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     632              :                           description="Defines the cutoff radius for the truncation. "// &
     633              :                           "If put to zero, the standard full range potential will be used", &
     634       106335 :                           usage="CUTOFF_RADIUS 2.0", default_r_val=0.0_dp)
     635       106335 :       CALL section_add_keyword(subsection, keyword)
     636       106335 :       CALL keyword_release(keyword)
     637              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     638              :                           description="Parameter in the exchange hole. "// &
     639              :                           "Usually this is put to 1.0 or 0.8", &
     640       106335 :                           usage="GAMMA 0.8", default_r_val=1.0_dp)
     641       106335 :       CALL section_add_keyword(subsection, keyword)
     642       106335 :       CALL keyword_release(keyword)
     643       106335 :       CALL section_add_subsection(section, subsection)
     644       106335 :       CALL section_release(subsection)
     645              : 
     646              :       CALL section_create(subsection, __LOCATION__, name="LDA_HOLE_T_C_LR", &
     647              :                           description="LDA exchange hole model in truncated coulomb potential", &
     648       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     649              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     650              :                           description="activates the functional", &
     651       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     652       106335 :       CALL section_add_keyword(subsection, keyword)
     653       106335 :       CALL keyword_release(keyword)
     654              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     655              :                           description="scales the exchange part of the functional", &
     656       106335 :                           default_r_val=1._dp)
     657       106335 :       CALL section_add_keyword(subsection, keyword)
     658       106335 :       CALL keyword_release(keyword)
     659              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     660              :                           description="Defines cutoff for lower integration boundary", &
     661       106335 :                           default_r_val=0.0_dp, unit_str="angstrom")
     662       106335 :       CALL section_add_keyword(subsection, keyword)
     663       106335 :       CALL keyword_release(keyword)
     664       106335 :       CALL section_add_subsection(section, subsection)
     665       106335 :       CALL section_release(subsection)
     666              : 
     667              :       CALL section_create(subsection, __LOCATION__, name="PBE_HOLE_T_C_LR", &
     668              :                           description="PBE exchange hole model in trucanted coulomb potential", &
     669       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     670              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     671              :                           description="activates the functional", &
     672       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     673       106335 :       CALL section_add_keyword(subsection, keyword)
     674       106335 :       CALL keyword_release(keyword)
     675              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     676              :                           description="scales the exchange part of the functional", &
     677       106335 :                           default_r_val=1._dp)
     678       106335 :       CALL section_add_keyword(subsection, keyword)
     679       106335 :       CALL keyword_release(keyword)
     680              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     681              :                           description="Defines cutoff for lower integration boundary", &
     682       106335 :                           default_r_val=1.0_dp, unit_str="angstrom")
     683       106335 :       CALL section_add_keyword(subsection, keyword)
     684       106335 :       CALL keyword_release(keyword)
     685       106335 :       CALL section_add_subsection(section, subsection)
     686       106335 :       CALL section_release(subsection)
     687              : 
     688              :       CALL section_create(subsection, __LOCATION__, name="GV09", &
     689              :                           description="Combination of three different exchange hole models", &
     690       106335 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     691              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     692              :                           description="activates the functional", &
     693       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     694       106335 :       CALL section_add_keyword(subsection, keyword)
     695       106335 :       CALL keyword_release(keyword)
     696              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     697              :                           description="scales the exchange part of the functional", &
     698       106335 :                           default_r_val=1._dp)
     699       106335 :       CALL section_add_keyword(subsection, keyword)
     700       106335 :       CALL keyword_release(keyword)
     701              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     702              :                           description="Defines cutoff for lower integration boundary", &
     703       106335 :                           default_r_val=0.0_dp, unit_str="angstrom")
     704       106335 :       CALL section_add_keyword(subsection, keyword)
     705       106335 :       CALL keyword_release(keyword)
     706              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     707              :                           description="Parameter for Becke Roussel hole", &
     708       106335 :                           default_r_val=1.0_dp)
     709       106335 :       CALL section_add_keyword(subsection, keyword)
     710       106335 :       CALL keyword_release(keyword)
     711       106335 :       CALL section_add_subsection(section, subsection)
     712       106335 :       CALL section_release(subsection)
     713              : 
     714              :       CALL section_create(subsection, __LOCATION__, name="BEEF", & !rk: BEEF Exchange
     715              :                           description="Uses the BEEFvdW exchange functional", &
     716              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     717       212670 :                           citations=[Wellendorff2012])
     718              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     719              :                           description="activates the functional", &
     720       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     721       106335 :       CALL section_add_keyword(subsection, keyword)
     722       106335 :       CALL keyword_release(keyword)
     723              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     724              :                           description="scales the exchange part of the functional", &
     725       106335 :                           default_r_val=1._dp)
     726       106335 :       CALL section_add_keyword(subsection, keyword)
     727       106335 :       CALL keyword_release(keyword)
     728       106335 :       CALL section_add_subsection(section, subsection)
     729       106335 :       CALL section_release(subsection)
     730              : 
     731       106335 :    END SUBROUTINE create_xc_fun_section
     732              : 
     733              : ! **************************************************************************************************
     734              : !> \brief creates the structure of the section needed to select an xc potential
     735              : !> \param section the section that will be created
     736              : !> \author thomas chassaing
     737              : ! **************************************************************************************************
     738        85068 :    SUBROUTINE create_xc_potential_section(section)
     739              :       TYPE(section_type), POINTER                        :: section
     740              : 
     741              :       TYPE(keyword_type), POINTER                        :: keyword
     742              :       TYPE(section_type), POINTER                        :: subsection
     743              : 
     744        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
     745              :       CALL section_create(section, __LOCATION__, name="xc_potential", &
     746              :                           description="The xc potential to use (CAREFUL: xc potential here refers "// &
     747              :                           "to potentials that are not derived from an xc functional, but rather are "// &
     748              :                           "modelled directly. Therefore there is no consistent xc energy available. "// &
     749              :                           "To still get an energy expression, see ENERGY below", &
     750        85068 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     751              : 
     752        85068 :       NULLIFY (subsection, keyword)
     753              :       CALL section_create(subsection, __LOCATION__, name="SAOP", &
     754              :                           description="Uses the SAOP potential", &
     755        85068 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     756              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     757              :                           description="Value of the alpha parameter (default = 1.19).", &
     758        85068 :                           usage="ALPHA 1.19", default_r_val=1.19_dp)
     759        85068 :       CALL section_add_keyword(subsection, keyword)
     760        85068 :       CALL keyword_release(keyword)
     761              :       CALL keyword_create(keyword, __LOCATION__, name="BETA", &
     762              :                           description="Value of the beta parameter (default = 0.01).", &
     763        85068 :                           usage="BETA 0.01", default_r_val=0.01_dp)
     764        85068 :       CALL section_add_keyword(subsection, keyword)
     765        85068 :       CALL keyword_release(keyword)
     766              :       CALL keyword_create(keyword, __LOCATION__, name="K_RHO", &
     767              :                           description="Value of the K_rho parameter (default = 0.42).", &
     768        85068 :                           usage="K_RHO 0.42", default_r_val=0.42_dp)
     769        85068 :       CALL section_add_keyword(subsection, keyword)
     770        85068 :       CALL keyword_release(keyword)
     771        85068 :       CALL section_add_subsection(section, subsection)
     772        85068 :       CALL section_release(subsection)
     773              : 
     774              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
     775              :                           description="How to determine the total energy.", &
     776              :                           usage="ENERGY [NONE,XC_FUNCTIONAL,SUM_EIGENVALUES", &
     777              :                           enum_c_vals=s2a("NONE", "XC_FUNCTIONAL", "FUNCTIONAL", "SUM_EIGENVALUES", "SOE"), &
     778              :                           enum_i_vals=[xc_pot_energy_none, &
     779              :                                        xc_pot_energy_xc_functional, &
     780              :                                        xc_pot_energy_xc_functional, &
     781              :                                        xc_pot_energy_sum_eigenvalues, &
     782              :                                        xc_pot_energy_sum_eigenvalues], &
     783        85068 :                           default_i_val=xc_pot_energy_none)
     784        85068 :       CALL section_add_keyword(section, keyword)
     785        85068 :       CALL keyword_release(keyword)
     786              : 
     787        85068 :    END SUBROUTINE create_xc_potential_section
     788              : 
     789              : ! **************************************************************************************************
     790              : !> \brief creates the structure of the section needed to select an xc kernel
     791              : !> \param section the section that will be created
     792              : !> \author JGH
     793              : ! **************************************************************************************************
     794        85068 :    SUBROUTINE create_xc_kernel_section(section)
     795              :       TYPE(section_type), POINTER                        :: section
     796              : 
     797              :       TYPE(keyword_type), POINTER                        :: keyword
     798              : 
     799        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
     800              :       CALL section_create(section, __LOCATION__, name="XC_KERNEL", &
     801              :                           description="The xc kernel to use (CAREFUL: xc kernel here refers "// &
     802              :                           "to kernels that are not derived from an xc functional, but rather are "// &
     803              :                           "modelled directly. This kernel will be used in a TDDFPT calculation. "// &
     804              :                           "Cannot be combined with XC_FUNCTIONAL or XC_POTENTIAL.", &
     805        85068 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     806              : 
     807        85068 :       NULLIFY (keyword)
     808              :       CALL keyword_create( &
     809              :          keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     810              :          description="Selection of kernel functionals.", &
     811              :          usage="&XC_KERNEL LDAfxc", &
     812              :          enum_c_vals=s2a("PADEfxc", "LDAfxc", "GGAfxc", "NONE"), &
     813              :          enum_i_vals=[fxc_funct_pade, fxc_funct_lda, fxc_funct_gga, fxc_none], &
     814              :          enum_desc=s2a("Fxc based on LDA PADE approximation", &
     815              :                        "Fxc based on LDA functionals", &
     816              :                        "Fxc model from fit to PBE functional", &
     817              :                        "NONE"), &
     818              :          default_i_val=fxc_none, &
     819        85068 :          lone_keyword_i_val=fxc_none)
     820        85068 :       CALL section_add_keyword(section, keyword)
     821        85068 :       CALL keyword_release(keyword)
     822              : 
     823              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER", &
     824              :                           description="List of parameters specific to the kernel function", &
     825              :                           usage="PARAMETER <REAL> .. <REAL>", &
     826        85068 :                           type_of_var=real_t, n_var=-1)
     827        85068 :       CALL section_add_keyword(section, keyword)
     828        85068 :       CALL keyword_release(keyword)
     829              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     830              :                           description="B97 GAMMA parameters [gx, gab, gaa]", &
     831              :                           usage="GAMMA <REAL> <REAL> <REAL>", &
     832              :                           default_r_vals=[0.004_dp, 0.006_dp, 0.2_dp], &
     833        85068 :                           type_of_var=real_t, n_var=3)
     834        85068 :       CALL section_add_keyword(section, keyword)
     835        85068 :       CALL keyword_release(keyword)
     836              :       CALL keyword_create(keyword, __LOCATION__, name="C_XAA", &
     837              :                           description="B97 C parameters for exchange", &
     838              :                           usage="C_XAA <REAL> <REAL> <REAL>", &
     839              :                           default_r_vals=[1.0_dp, 0.63_dp, 0.94_dp], &
     840        85068 :                           type_of_var=real_t, n_var=3)
     841        85068 :       CALL section_add_keyword(section, keyword)
     842        85068 :       CALL keyword_release(keyword)
     843              :       CALL keyword_create(keyword, __LOCATION__, name="C_CAB", &
     844              :                           description="B97 C parameters for same spin correlation.", &
     845              :                           usage="C_CAB <REAL> <REAL> <REAL>", &
     846              :                           default_r_vals=[1.0_dp, 0.75_dp, -4.60_dp], &
     847        85068 :                           type_of_var=real_t, n_var=3)
     848        85068 :       CALL section_add_keyword(section, keyword)
     849        85068 :       CALL keyword_release(keyword)
     850              :       CALL keyword_create(keyword, __LOCATION__, name="C_CAA", &
     851              :                           description="B97 C parameters for opposite spin correlation.", &
     852              :                           usage="C_CAA <REAL> <REAL> <REAL>", &
     853              :                           default_r_vals=[0.17_dp, 2.35_dp, -2.55_dp], &
     854        85068 :                           type_of_var=real_t, n_var=3)
     855        85068 :       CALL section_add_keyword(section, keyword)
     856        85068 :       CALL keyword_release(keyword)
     857              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     858              :                           description="Scaling parameter for exchange kernel.", &
     859        85068 :                           usage="SCALE_X 0.2", default_r_val=1.0_dp)
     860        85068 :       CALL section_add_keyword(section, keyword)
     861        85068 :       CALL keyword_release(keyword)
     862              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_C", &
     863              :                           description="Scaling parameter for correlation kernel.", &
     864        85068 :                           usage="SCALE_C 0.2", default_r_val=1.0_dp)
     865        85068 :       CALL section_add_keyword(section, keyword)
     866        85068 :       CALL keyword_release(keyword)
     867              : 
     868        85068 :    END SUBROUTINE create_xc_kernel_section
     869              : 
     870              : ! **************************************************************************************************
     871              : !> \brief creates the structure of the section needed to select an hfx kernel
     872              : !> \param section the section that will be created
     873              : !> \author JGH
     874              : ! **************************************************************************************************
     875        85068 :    SUBROUTINE create_hfx_kernel_section(section)
     876              :       TYPE(section_type), POINTER                        :: section
     877              : 
     878              :       TYPE(keyword_type), POINTER                        :: keyword
     879              :       TYPE(section_type), POINTER                        :: subsection
     880              : 
     881        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
     882              :       CALL section_create(section, __LOCATION__, name="HFX_KERNEL", &
     883              :                           description="The hfx kernel to use. Cannot be combined with HF section.", &
     884        85068 :                           n_keywords=1, n_subsections=2, repeats=.FALSE.)
     885              : 
     886        85068 :       NULLIFY (subsection, keyword)
     887              :       CALL keyword_create(keyword, __LOCATION__, name="DO_HFXSR", &
     888              :                           description="Switch to use the HFXSR (short range) kernel.", &
     889              :                           usage="DO_HFXSR T/F", default_l_val=.FALSE., &
     890        85068 :                           lone_keyword_l_val=.TRUE.)
     891        85068 :       CALL section_add_keyword(section, keyword)
     892        85068 :       CALL keyword_release(keyword)
     893        85068 :       NULLIFY (subsection, keyword)
     894              :       CALL keyword_create(keyword, __LOCATION__, name="HFXSR_PRIMBAS", &
     895              :                           description="Default number of primitives in ADMM basis in HFXSR. "// &
     896              :                           "0 indicates the use of a contracted minimal basis. ", &
     897        85068 :                           usage="HFXSR_PRIMBAS 3", default_i_val=0)
     898        85068 :       CALL section_add_keyword(section, keyword)
     899        85068 :       CALL keyword_release(keyword)
     900              : 
     901        85068 :       CALL create_hfx_section(subsection)
     902        85068 :       CALL section_add_subsection(section, subsection)
     903        85068 :       CALL section_release(subsection)
     904              : 
     905              :       CALL section_create(subsection, __LOCATION__, name="HFXLR", &
     906              :                           description="Uses the HFXLR (long range) kernel", &
     907        85068 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     908              :       CALL keyword_create(keyword, __LOCATION__, name="RCUT", &
     909              :                           description="Value of lower range cutoff of interaction [Bohr]", &
     910        85068 :                           usage="RCUT 5.00", default_r_val=6.00_dp, unit_str="bohr")
     911        85068 :       CALL section_add_keyword(subsection, keyword)
     912        85068 :       CALL keyword_release(keyword)
     913              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
     914              :                           description="Scaling parameter for HFX kernel.", &
     915        85068 :                           usage="SCALE 0.25", default_r_val=1.00_dp)
     916        85068 :       CALL section_add_keyword(subsection, keyword)
     917        85068 :       CALL keyword_release(keyword)
     918        85068 :       CALL section_add_subsection(section, subsection)
     919        85068 :       CALL section_release(subsection)
     920              : 
     921        85068 :    END SUBROUTINE create_hfx_kernel_section
     922              : ! **************************************************************************************************
     923              : !> \brief creates the structure of the section needed for vdW potentials
     924              : !> \param section the section that will be created
     925              : !> \author jgh
     926              : ! **************************************************************************************************
     927        85068 :    SUBROUTINE create_vdw_potential_section(section)
     928              :       TYPE(section_type), POINTER                        :: section
     929              : 
     930              :       TYPE(keyword_type), POINTER                        :: keyword
     931              :       TYPE(section_type), POINTER                        :: newsection, print_key, subsection
     932              : 
     933        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
     934              :       CALL section_create(section, __LOCATION__, name="vdw_potential", &
     935              :                           description="This section combines all possible additional dispersion "// &
     936              :                           "corrections to the normal XC functionals. This can be more functionals "// &
     937              :                           "or simple empirical pair potentials. ", &
     938              :                           citations=[grimme2006, Tran2013], &
     939       255204 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     940              : 
     941        85068 :       NULLIFY (subsection, keyword)
     942              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
     943              :                           variants=s2a("DISPERSION_FUNCTIONAL"), &
     944              :                           description="Type of dispersion/vdW functional or potential to use", &
     945              :                           usage="POTENTIAL_TYPE (NONE|PAIR_POTENTIAL|NON_LOCAL)", &
     946              :                           enum_c_vals=s2a("NONE", "PAIR_POTENTIAL", "NON_LOCAL"), &
     947              :                           enum_i_vals=[xc_vdw_fun_none, xc_vdw_fun_pairpot, xc_vdw_fun_nonloc], &
     948              :                           enum_desc=s2a("No dispersion/van der Waals functional.", &
     949              :                                         "Pair potential van der Waals density functional, "// &
     950              :                                         "including Grimme's empirical DFT-D methods.", &
     951              :                                         "Nonlocal van der Waals density functional; more "// &
     952              :                                         "rigorous in principle, but significantly more "// &
     953              :                                         "time-consuming."), &
     954        85068 :                           default_i_val=xc_vdw_fun_none)
     955        85068 :       CALL section_add_keyword(section, keyword)
     956        85068 :       CALL keyword_release(keyword)
     957              : 
     958              :       CALL section_create(subsection, __LOCATION__, name="PAIR_POTENTIAL", &
     959              :                           description="Information on the pair potential to calculate dispersion", &
     960        85068 :                           n_keywords=5, n_subsections=0, repeats=.TRUE.)
     961              :       CALL keyword_create(keyword, __LOCATION__, name="R_CUTOFF", &
     962              :                           variants=s2a("D3_CUTOFF", "D4_3B_CUTOFF"), &
     963              :                           description="Range of potential. The cutoff will be 2 times this value. "// &
     964              :                           "In the case of D4 it will be used for the 3-body term", &
     965              :                           usage="R_CUTOFF 20.0", default_r_val=20.0_dp, &
     966        85068 :                           unit_str="angstrom")
     967        85068 :       CALL section_add_keyword(subsection, keyword)
     968        85068 :       CALL keyword_release(keyword)
     969              :       CALL keyword_create(keyword, __LOCATION__, name="D4_CUTOFF", &
     970              :                           description="Range of potential. The cutoff will be 2 times this value. "// &
     971              :                           "Only used for the 2-body term of D4", &
     972              :                           usage="D4_CUTOFF 30.0", default_r_val=20.0_dp, &
     973        85068 :                           unit_str="angstrom")
     974        85068 :       CALL section_add_keyword(subsection, keyword)
     975        85068 :       CALL keyword_release(keyword)
     976              :       CALL keyword_create(keyword, __LOCATION__, name="D4_CN_CUTOFF", &
     977              :                           description="Coordination number cutoff for D4", &
     978              :                           usage="D4_CN_CUTOFF 30.0", default_r_val=-1.0_dp, &
     979        85068 :                           unit_str="angstrom")
     980        85068 :       CALL section_add_keyword(subsection, keyword)
     981        85068 :       CALL keyword_release(keyword)
     982              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
     983              :                           description="Type of potential", &
     984              :                           citations=[grimme2006, grimme2010, grimme2011, Caldeweyher2020], &
     985              :                           usage="TYPE (DFTD2|DFTD3|DFTD3(BJ)|DFTD4)", &
     986              :                           enum_c_vals=s2a("DFTD2", "DFTD3", "DFTD3(BJ)", "DFTD4"), &
     987              :                           enum_i_vals=[vdw_pairpot_dftd2, vdw_pairpot_dftd3, &
     988              :                                        vdw_pairpot_dftd3bj, vdw_pairpot_dftd4], &
     989              :                           enum_desc=s2a("Grimme D2 method", &
     990              :                                         "Grimme D3 method (zero damping)", &
     991              :                                         "Grimme D3 method (Becke-Johnson damping)", &
     992              :                                         "Grimme D4 method"), &
     993       425340 :                           default_i_val=vdw_pairpot_dftd3bj)
     994        85068 :       CALL section_add_keyword(subsection, keyword)
     995        85068 :       CALL keyword_release(keyword)
     996              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_FILE_NAME", &
     997              :                           description="Name of the parameter file, may include a path (not used for D4)", &
     998              :                           usage="PARAMETER_FILE_NAME <FILENAME>", &
     999        85068 :                           default_lc_val="dftd3.dat")
    1000        85068 :       CALL section_add_keyword(subsection, keyword)
    1001        85068 :       CALL keyword_release(keyword)
    1002              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_FUNCTIONAL", &
    1003              :                           description="Use parameters for this specific density functional. "// &
    1004              :                           "For available DFT-D4 functionals and parameters see: "// &
    1005              :                           "<https://github.com/dftd4/dftd4/blob/main/src/dftd4/param.f90>. "// &
    1006              :                           "For available D3 and D3(BJ) parameters see: "// &
    1007              :                           "<https://www.chemie.uni-bonn.de/grimme/de/software/dft-d3>. "// &
    1008              :                           "For Skala with D3(BJ), SKALA selects the B3LYP D3(BJ) parameters.", &
    1009              :                           usage="REFERENCE_FUNCTIONAL <functional>", &
    1010        85068 :                           type_of_var=char_t)
    1011        85068 :       CALL section_add_keyword(subsection, keyword)
    1012        85068 :       CALL keyword_release(keyword)
    1013              :       CALL keyword_create(keyword, __LOCATION__, name="D4_REFERENCE_CODE", &
    1014              :                           description="Calculate D4 energy using external library entirely. "// &
    1015              :                           "Not recommended if you are using an MPI version of CP2K, because "// &
    1016              :                           "DFT-D4 package does not support MPI parallelization. However, "// &
    1017              :                           "if D4_DEBUG is triggered, you will need to switch this on. Note "// &
    1018              :                           "that the external library is always needed no matter if this "// &
    1019              :                           "option is triggered or not.", &
    1020              :                           usage="D4_REFERENCE_CODE", default_l_val=.FALSE., &
    1021        85068 :                           lone_keyword_l_val=.TRUE.)
    1022        85068 :       CALL section_add_keyword(subsection, keyword)
    1023        85068 :       CALL keyword_release(keyword)
    1024              :       CALL keyword_create(keyword, __LOCATION__, name="D4_DEBUG", &
    1025              :                           description="Debug output for D4 method using reference code.", &
    1026              :                           usage="D4_DEBUG", default_l_val=.FALSE., &
    1027        85068 :                           lone_keyword_l_val=.TRUE.)
    1028        85068 :       CALL section_add_keyword(subsection, keyword)
    1029        85068 :       CALL keyword_release(keyword)
    1030              :       CALL keyword_create(keyword, __LOCATION__, name="D3_REFERENCE_CODE", &
    1031              :                           description="Use D3 damping parameters from s-dftd3 library instead of built-in values. "// &
    1032              :                           "Requires s-dftd3 library to be compiled in.", &
    1033              :                           usage="D3_REFERENCE_CODE", default_l_val=.FALSE., &
    1034        85068 :                           lone_keyword_l_val=.TRUE.)
    1035        85068 :       CALL section_add_keyword(subsection, keyword)
    1036        85068 :       CALL keyword_release(keyword)
    1037              :       CALL keyword_create(keyword, __LOCATION__, name="D2_SCALING", &
    1038              :                           variants=["SCALING"], &
    1039              :                           description="XC Functional dependent scaling parameter. If omitted, CP2K attempts"// &
    1040              :                           " to guess the xc functional that is in use and sets the associated scaling parameter.", &
    1041       170136 :                           usage="SCALING 0.2", default_r_val=0._dp)
    1042        85068 :       CALL section_add_keyword(subsection, keyword)
    1043        85068 :       CALL keyword_release(keyword)
    1044              :       CALL keyword_create(keyword, __LOCATION__, name="D2_EXP_PRE", &
    1045              :                           variants=["EXP_PRE"], &
    1046              :                           description="Prefactor in exponential damping factor (DFT-D2 potential)", &
    1047       170136 :                           usage="D2_EXP_PRE 20.", default_r_val=20._dp)
    1048        85068 :       CALL section_add_keyword(subsection, keyword)
    1049        85068 :       CALL keyword_release(keyword)
    1050              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CN", &
    1051              :                           description="Cutoff value for coordination number function (DFT-D3 method)", &
    1052        85068 :                           usage="EPS_CN 1.e-6_dp", default_r_val=1.e-6_dp)
    1053        85068 :       CALL section_add_keyword(subsection, keyword)
    1054        85068 :       CALL keyword_release(keyword)
    1055              :       CALL keyword_create(keyword, __LOCATION__, name="D3_SCALING", &
    1056              :                           description="XC Functional dependent scaling parameters (s6,sr6,s8) for the DFT-D3 method."// &
    1057              :                           " If omitted, CP2K attempts"// &
    1058              :                           " to guess the xc functional from REFERENCE_FUNCTIONAL and sets the associated scaling parameter.", &
    1059              :                           usage="D3_SCALING 1.0 1.0 1.0", n_var=3, &
    1060        85068 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
    1061        85068 :       CALL section_add_keyword(subsection, keyword)
    1062        85068 :       CALL keyword_release(keyword)
    1063              :       CALL keyword_create(keyword, __LOCATION__, name="D3BJ_SCALING", &
    1064              :                           description="XC Functional dependent scaling parameters (s6,a1,s8,a2) for the DFT-D3(BJ) method."// &
    1065              :                           " If omitted, CP2K attempts"// &
    1066              :                           " to guess the xc functional from REFERENCE_FUNCTIONAL and sets the associated scaling parameter.", &
    1067              :                           usage="D3BJ_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
    1068        85068 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
    1069        85068 :       CALL section_add_keyword(subsection, keyword)
    1070        85068 :       CALL keyword_release(keyword)
    1071              :       CALL keyword_create(keyword, __LOCATION__, name="D4_SCALING", &
    1072              :                           description="XC Functional dependent scaling parameters (s6,a1,s8,a2) for the DFT-D4 method."// &
    1073              :                           " If omitted, CP2K attempts"// &
    1074              :                           " to guess the xc functional from REFERENCE_FUNCTIONAL and sets the associated scaling parameter.", &
    1075              :                           usage="D4_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
    1076        85068 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
    1077        85068 :       CALL section_add_keyword(subsection, keyword)
    1078        85068 :       CALL keyword_release(keyword)
    1079              :       CALL keyword_create(keyword, __LOCATION__, name="CALCULATE_C9_TERM", &
    1080              :                           description="Calculate C9 terms in DFT-D3 model", &
    1081              :                           usage="CALCULATE_C9_TERM", default_l_val=.FALSE., &
    1082        85068 :                           lone_keyword_l_val=.TRUE.)
    1083        85068 :       CALL section_add_keyword(subsection, keyword)
    1084        85068 :       CALL keyword_release(keyword)
    1085              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_C9_TERM", &
    1086              :                           description="Calculate C9 terms in DFT-D3 model using reference coordination numbers", &
    1087              :                           usage="REFERENCE_C9_TERM", default_l_val=.FALSE., &
    1088        85068 :                           lone_keyword_l_val=.TRUE.)
    1089        85068 :       CALL section_add_keyword(subsection, keyword)
    1090        85068 :       CALL keyword_release(keyword)
    1091              :       CALL keyword_create(keyword, __LOCATION__, name="FACTOR_S9_TERM", &
    1092              :                           description="S9 prefactor of the many-body term in the DFT-D4 method.", &
    1093        85068 :                           usage="FACTOR_S9_TERM 1.e-0", default_r_val=1.00_dp)
    1094        85068 :       CALL section_add_keyword(subsection, keyword)
    1095        85068 :       CALL keyword_release(keyword)
    1096              :       CALL keyword_create(keyword, __LOCATION__, name="LONG_RANGE_CORRECTION", &
    1097              :                           description="Calculate a long range correction to the DFT-D3 model."// &
    1098              :                           " WARNING: Use with care! Only for isotropic dense systems.", &
    1099              :                           usage="LONG_RANGE_CORRECTION", default_l_val=.FALSE., &
    1100        85068 :                           lone_keyword_l_val=.TRUE.)
    1101        85068 :       CALL section_add_keyword(subsection, keyword)
    1102        85068 :       CALL keyword_release(keyword)
    1103              :       CALL keyword_create(keyword, __LOCATION__, name="SHORT_RANGE_CORRECTION", &
    1104              :                           description="Calculate a short-range bond correction to the DFT-D3 model", &
    1105              :                           usage="SHORT_RANGE_CORRECTION", default_l_val=.FALSE., &
    1106        85068 :                           lone_keyword_l_val=.TRUE.)
    1107        85068 :       CALL section_add_keyword(subsection, keyword)
    1108        85068 :       CALL keyword_release(keyword)
    1109              :       CALL keyword_create(keyword, __LOCATION__, name="SHORT_RANGE_CORRECTION_PARAMETERS", &
    1110              :                           description="Parameters for the short-range bond correction to the DFT-D3 model. "// &
    1111              :                           "s*(za*zb)^t1*EXP(-g*dr*r0ab^t2), parameters: s, g, t1, t2 "// &
    1112              :                           "Defaults: s=0.08, g=10.0, t1=0.5, t2=-1.0 ", &
    1113              :                           usage="SHORT_RANGE_CORRECTION_PARAMETERS", default_r_vals=[0.08_dp, 10.0_dp, 0.5_dp, -1.0_dp], &
    1114        85068 :                           n_var=4, type_of_var=real_t)
    1115        85068 :       CALL section_add_keyword(subsection, keyword)
    1116        85068 :       CALL keyword_release(keyword)
    1117              :       ! KG molecular corrections
    1118              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE_CORRECTION", &
    1119              :                           description="Calculate a intermolecular correction to the DFT-D3 model", &
    1120              :                           usage="MOLECULE_CORRECTION", default_l_val=.FALSE., &
    1121        85068 :                           lone_keyword_l_val=.TRUE.)
    1122        85068 :       CALL section_add_keyword(subsection, keyword)
    1123        85068 :       CALL keyword_release(keyword)
    1124              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE_CORRECTION_C8", &
    1125              :                           description="Calculate a intermolecular correction to the C8 term in the DFT-D3 model", &
    1126        85068 :                           usage="MOLECULE_CORRECTION_C8  1.0 ", default_r_val=0.0_dp)
    1127        85068 :       CALL section_add_keyword(subsection, keyword)
    1128        85068 :       CALL keyword_release(keyword)
    1129              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE_OUTPUT", &
    1130              :                           description="Extensive output for the DFT-D2 and DFT-D3 models."// &
    1131              :                           " Needs PRINT_DFTD section to be specified.", &
    1132              :                           usage="VERBOSE_OUTPUT", default_l_val=.FALSE., &
    1133        85068 :                           lone_keyword_l_val=.TRUE.)
    1134        85068 :       CALL section_add_keyword(subsection, keyword)
    1135        85068 :       CALL keyword_release(keyword)
    1136              : 
    1137              :       ! Set coordination numbers by atom numbers
    1138              :       CALL keyword_create(keyword, __LOCATION__, name="D3_EXCLUDE_KIND", &
    1139              :                           description="Specifies the atomic kinds excluded in the DFT-D3 calculation.", &
    1140              :                           usage="D3_EXCLUDE_KIND kind1 kind2 ... ", repeats=.FALSE., &
    1141        85068 :                           n_var=-1, type_of_var=integer_t)
    1142        85068 :       CALL section_add_keyword(subsection, keyword)
    1143        85068 :       CALL keyword_release(keyword)
    1144              : 
    1145              :       ! Ignore selected pair interactins
    1146              :       CALL keyword_create(keyword, __LOCATION__, name="D3_EXCLUDE_KIND_PAIR", &
    1147              :                           description="Specifies the atomic kinds for interactions excluded from the DFT-D3 calculation.", &
    1148              :                           usage="D3_EXCLUDE_KIND_PAIR kind1 kind2 ", repeats=.TRUE., &
    1149        85068 :                           n_var=2, type_of_var=integer_t)
    1150        85068 :       CALL section_add_keyword(subsection, keyword)
    1151        85068 :       CALL keyword_release(keyword)
    1152              : 
    1153              :       ! Set coordination numbers by atom kinds
    1154              :       CALL keyword_create(keyword, __LOCATION__, name="KIND_COORDINATION_NUMBERS", &
    1155              :                           description="Specifies the coordination number for a kind for the C9 term in DFT-D3.", &
    1156              :                           usage="KIND_COORDINATION_NUMBERS CN kind ", repeats=.TRUE., &
    1157        85068 :                           n_var=-1, type_of_var=char_t)
    1158        85068 :       CALL section_add_keyword(subsection, keyword)
    1159        85068 :       CALL keyword_release(keyword)
    1160              :       ! Set coordination numbers by atom numbers
    1161              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_COORDINATION_NUMBERS", &
    1162              :                           description="Specifies the coordination number of a set of atoms for the C9 term in DFT-D3.", &
    1163              :                           usage="ATOM_COORDINATION_NUMBERS CN atom1 atom2 ... ", repeats=.TRUE., &
    1164        85068 :                           n_var=-1, type_of_var=char_t)
    1165        85068 :       CALL section_add_keyword(subsection, keyword)
    1166        85068 :       CALL keyword_release(keyword)
    1167              : 
    1168              :       ! parameter specification atom by atom
    1169              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMPARM", &
    1170              :                           description="Specifies parameters for atom types (in atomic units). If "// &
    1171              :                           "not provided default parameters are used (DFT-D2).", &
    1172              :                           usage="ATOMPARM <ELEMENT> <C6_parameter> <vdw_radii>", &
    1173        85068 :                           repeats=.TRUE., n_var=-1, type_of_var=char_t)
    1174        85068 :       CALL section_add_keyword(subsection, keyword)
    1175        85068 :       CALL keyword_release(keyword)
    1176              : 
    1177        85068 :       NULLIFY (print_key)
    1178              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT_DFTD", &
    1179              :                                        description="Controls the printing of some info about DFTD contributions", &
    1180        85068 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1181        85068 :       CALL section_add_subsection(subsection, print_key)
    1182        85068 :       CALL section_release(print_key)
    1183              : 
    1184        85068 :       NULLIFY (newsection)
    1185        85068 :       CALL create_eeq_control_section(newsection)
    1186        85068 :       CALL section_add_subsection(subsection, newsection)
    1187        85068 :       CALL section_release(newsection)
    1188              : 
    1189        85068 :       CALL section_add_subsection(section, subsection)
    1190        85068 :       CALL section_release(subsection)
    1191              : 
    1192              :       ! nonlocal section
    1193        85068 :       NULLIFY (subsection, keyword)
    1194              :       CALL section_create(subsection, __LOCATION__, name="NON_LOCAL", &
    1195              :                           description="Information on the non local part of dispersion functionals. "// &
    1196              :                           "Correct functionals require a corresponding setting of XC_FUNCTIONAL.", &
    1197        85068 :                           n_keywords=0, n_subsections=0, repeats=.TRUE.)
    1198              : 
    1199              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
    1200              :                           description="Type of functional (the corresponding kernel data file should be selected). "// &
    1201              :                           "Allows for common forms such as vdW-DF, vdW-DF2, optB88-vdW, rVV10.", &
    1202              :                           usage="TYPE DRSLL", &
    1203              :                           enum_c_vals=s2a("DRSLL", "LMKLL", "RVV10"), &
    1204              :                           enum_i_vals=[vdw_nl_DRSLL, vdw_nl_LMKLL, vdw_nl_RVV10], &
    1205              :                           enum_desc=s2a("Dion-Rydberg-Schroeder-Langreth-Lundqvist nonlocal van der Waals density functional", &
    1206              :                                         "Lee-Murray-Kong-Lundqvist-Langreth nonlocal van der Waals density functional", &
    1207              :                                         "Revised Vydrov-van Voorhis nonlocal van der Waals density functional"), &
    1208              :                           citations=[Tran2013], &
    1209       170136 :                           default_i_val=vdw_nl_DRSLL)
    1210        85068 :       CALL section_add_keyword(subsection, keyword)
    1211        85068 :       CALL keyword_release(keyword)
    1212              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE_OUTPUT", &
    1213              :                           description="Extensive output for non local functionals", &
    1214              :                           usage="VERBOSE_OUTPUT", default_l_val=.FALSE., &
    1215        85068 :                           lone_keyword_l_val=.TRUE.)
    1216        85068 :       CALL section_add_keyword(subsection, keyword)
    1217        85068 :       CALL keyword_release(keyword)
    1218              :       CALL keyword_create(keyword, __LOCATION__, name="KERNEL_FILE_NAME", &
    1219              :                           description="Name of the kernel data file, may include a path. "// &
    1220              :                           "vdW_kernel_table.dat is for DRSLL and LMKLL and "// &
    1221              :                           "rVV10_kernel_table.dat is for rVV10.", &
    1222              :                           usage="KERNEL_FILE_NAME <FILENAME>", &
    1223        85068 :                           default_lc_val="vdW_kernel_table.dat")
    1224        85068 :       CALL section_add_keyword(subsection, keyword)
    1225        85068 :       CALL keyword_release(keyword)
    1226              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
    1227              :                           description="The cutoff of the FFT grid used in the calculation "// &
    1228              :                           "of the nonlocal vdW functional [Ry].", &
    1229              :                           usage="CUTOFF 300", &
    1230        85068 :                           default_r_val=-1._dp, unit_str="Ry")
    1231        85068 :       CALL section_add_keyword(subsection, keyword)
    1232        85068 :       CALL keyword_release(keyword)
    1233              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETERS", &
    1234              :                           description="Parameters b and C of the rVV10 functional", &
    1235              :                           usage="PARAMETERS 6.3 0.0093", &
    1236        85068 :                           type_of_var=real_t, default_r_vals=[6.3_dp, 0.0093_dp], n_var=2)
    1237        85068 :       CALL section_add_keyword(subsection, keyword)
    1238        85068 :       CALL keyword_release(keyword)
    1239              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
    1240              :                           description="Scales the energy contribution of the rVV10 functional", &
    1241              :                           usage="SCALE 1.0", &
    1242        85068 :                           type_of_var=real_t, default_r_val=1.0_dp)
    1243        85068 :       CALL section_add_keyword(subsection, keyword)
    1244        85068 :       CALL keyword_release(keyword)
    1245              : 
    1246        85068 :       CALL section_add_subsection(section, subsection)
    1247        85068 :       CALL section_release(subsection)
    1248              : 
    1249        85068 :    END SUBROUTINE create_vdw_potential_section
    1250              : 
    1251              : ! **************************************************************************************************
    1252              : !> \brief creates the structure of the section needed for gCP potentials
    1253              : !> \param section the section that will be created
    1254              : !> \author jgh
    1255              : ! **************************************************************************************************
    1256        85068 :    SUBROUTINE create_gcp_potential_section(section)
    1257              :       TYPE(section_type), POINTER                        :: section
    1258              : 
    1259              :       TYPE(keyword_type), POINTER                        :: keyword
    1260              : 
    1261        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
    1262              :       CALL section_create(section, __LOCATION__, name="gcp_potential", &
    1263              :                           description="This section combines geometrical counterpoise potentials."// &
    1264              :                           " This is a simple empirical pair potential to correct for BSSE. ", &
    1265              :                           citations=[Kruse2012], &
    1266       170136 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1267              : 
    1268        85068 :       NULLIFY (keyword)
    1269              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_FILE_NAME", &
    1270              :                           description="Name of the parameter file, may include a path", &
    1271              :                           usage="PARAMETER_FILE_NAME <FILENAME>", &
    1272        85068 :                           default_lc_val="---")
    1273        85068 :       CALL section_add_keyword(section, keyword)
    1274        85068 :       CALL keyword_release(keyword)
    1275              : 
    1276              :       CALL keyword_create(keyword, __LOCATION__, name="GLOBAL_PARAMETERS", &
    1277              :                           description="Global parameters of the gCP method."// &
    1278              :                           " Parameters are sigma, alpha, beta, eta from the original paper.", &
    1279              :                           usage="GLOBAL_PARAMETERS 1.0 1.0 1.0 1.0", n_var=4, &
    1280        85068 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
    1281        85068 :       CALL section_add_keyword(section, keyword)
    1282        85068 :       CALL keyword_release(keyword)
    1283              : 
    1284              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_ENERGY", &
    1285              :                           description="Specify the delta energy [Hartree] term for an atom kind", &
    1286              :                           usage="DELTA_ENERGY  type value", &
    1287       255204 :                           type_of_var=char_t, repeats=.TRUE., n_var=-1, default_c_vals=["XX ", "0.0"])
    1288        85068 :       CALL section_add_keyword(section, keyword)
    1289        85068 :       CALL keyword_release(keyword)
    1290              : 
    1291              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", &
    1292              :                           description="Verbose output for gCP calculation", &
    1293              :                           usage="VERBOSE logical_value", &
    1294        85068 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1295        85068 :       CALL section_add_keyword(section, keyword)
    1296        85068 :       CALL keyword_release(keyword)
    1297              : 
    1298        85068 :    END SUBROUTINE create_gcp_potential_section
    1299              : 
    1300              : ! **************************************************************************************************
    1301              : !> \brief creates the structure of the GAUXC section
    1302              : !> \param section the section that will be created
    1303              : !> \author fawzi
    1304              : ! **************************************************************************************************
    1305       106335 :    SUBROUTINE create_gauxc_section(section)
    1306              :       TYPE(section_type), POINTER                        :: section
    1307              : 
    1308              :       TYPE(keyword_type), POINTER                        :: keyword
    1309              : 
    1310       106335 :       CPASSERT(.NOT. ASSOCIATED(section))
    1311              :       CALL section_create(section, __LOCATION__, name="GAUXC", &
    1312              :                           description="Use exchange-correlation functionals provided by GauXC. "// &
    1313              :                           "The current CP2K bridge uses GauXC's molecular quadrature. Periodic inputs "// &
    1314              :                           "are limited to isolated validation cells and are not compact periodic "// &
    1315              :                           "material calculations.", &
    1316       106335 :                           n_keywords=28, n_subsections=0, repeats=.FALSE.)
    1317              : 
    1318       106335 :       NULLIFY (keyword)
    1319              : 
    1320              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1321              :                           description="activates the functional", &
    1322       106335 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
    1323       106335 :       CALL section_add_keyword(section, keyword)
    1324       106335 :       CALL keyword_release(keyword)
    1325              : 
    1326              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL", &
    1327              :                           description="Functional name used to create the GauXC integrator. "// &
    1328              :                           "If MODEL is set, this optional base functional defaults to PBE and "// &
    1329              :                           "does not need to be specified for MODEL SKALA inputs.", &
    1330       106335 :                           default_c_val="PBE")
    1331       106335 :       CALL section_add_keyword(section, keyword)
    1332       106335 :       CALL keyword_release(keyword)
    1333              : 
    1334              :       CALL keyword_create(keyword, __LOCATION__, name="MODEL", &
    1335              :                           description="GauXC Skala model name or path. Use NONE for conventional GauXC. "// &
    1336              :                           "MODEL SKALA selects the installed Skala-1.1 model when available; "// &
    1337              :                           "other Skala models are supplied as .fun files or model names. "// &
    1338              :                           "NLCC pseudopotentials are rejected by the direct molecular GauXC "// &
    1339              :                           "Skala path. Pseudopotential GAPW PAW_ONE_CENTER and the CP2K-native "// &
    1340              :                           "SKALA grid path include NLCC in their reconstructed primitive fields.", &
    1341              :                           usage="MODEL SKALA", &
    1342       106335 :                           default_c_val="NONE")
    1343       106335 :       CALL section_add_keyword(section, keyword)
    1344       106335 :       CALL keyword_release(keyword)
    1345              : 
    1346              :       CALL keyword_create( &
    1347              :          keyword, __LOCATION__, name="PSEUDOPOTENTIAL_GAPW_REPRESENTATION", &
    1348              :          description="Select the density representation used by an active GauXC model for "// &
    1349              :          "METHOD GAPW/GAPW_XC kinds with GTH or ECP pseudopotentials. "// &
    1350              :          "DIRECT_VALENCE treats those kinds as GPW_TYPE and evaluates the model on "// &
    1351              :          "the direct valence density; this is the default for non-local models such "// &
    1352              :          "as Skala. PAW_ONE_CENTER combines the smooth and all hard-minus-soft "// &
    1353              :          "one-center primitive fields before one model evaluation, retaining all 15 pairwise "// &
    1354              :          "spin-gradient cross terms (14 additional to the smooth-density baseline) and the "// &
    1355              :          "non-local couplings. PAW_ONE_CENTER_SPLIT is a diagnostic that evaluates smooth, hard, "// &
    1356              :          "and soft fields separately. CP2K_DEFAULT retains the representation selected "// &
    1357              :          "by KIND%GPW_TYPE, basis hardness, and DFT%QS%FORCE_PAW. All-electron kinds "// &
    1358              :          "and conventional GauXC MODEL NONE calculations are unaffected.", &
    1359              :          usage="PSEUDOPOTENTIAL_GAPW_REPRESENTATION DIRECT_VALENCE", &
    1360              :          enum_c_vals=s2a("DIRECT_VALENCE", "PAW_ONE_CENTER", "CP2K_DEFAULT", &
    1361              :                          "PAW_ONE_CENTER_SPLIT"), &
    1362              :          enum_i_vals=[skala_gapw_direct_valence, skala_gapw_paw_one_center, &
    1363              :                       skala_gapw_cp2k_default, skala_gapw_paw_one_center_split], &
    1364              :          enum_desc=s2a("Use the direct pseudopotential valence density", &
    1365              :                        "Reconstruct the GAPW primitive fields before model evaluation", &
    1366              :                        "Use the representation selected by the ordinary CP2K GAPW rules", &
    1367              :                        "Diagnose the separate smooth plus hard-minus-soft energy expression"), &
    1368       106335 :          default_i_val=skala_gapw_direct_valence)
    1369       106335 :       CALL section_add_keyword(section, keyword)
    1370       106335 :       CALL keyword_release(keyword)
    1371              : 
    1372              :       CALL keyword_create(keyword, __LOCATION__, name="GRID", &
    1373              :                           description="Atomic grid size for GauXC. Skala defaults to SUPERFINE "// &
    1374              :                           "unless this keyword is set explicitly.", &
    1375              :                           usage="GRID fine", &
    1376              :                           enum_c_vals=s2a("FINE", "ULTRAFINE", "SUPERFINE", "GM3", "GM5"), &
    1377              :                           enum_i_vals=[1, 2, 3, 4, 5], &
    1378              :                           enum_desc=s2a("Fine grid (default)", &
    1379              :                                         "Ultra fine grid", &
    1380              :                                         "Super fine grid", &
    1381              :                                         "GM3 grid", &
    1382              :                                         "GM5 grid"), &
    1383       106335 :                           default_i_val=1)
    1384       106335 :       CALL section_add_keyword(section, keyword)
    1385       106335 :       CALL keyword_release(keyword)
    1386              : 
    1387              :       CALL keyword_create(keyword, __LOCATION__, name="RADIAL_QUADRATURE", &
    1388              :                           description="Radial quadrature scheme for GauXC", &
    1389              :                           usage="RADIAL_QUADRATURE muraknowles", &
    1390              :                           enum_c_vals=s2a("MURAKNOWLES", "BECKE", "TREUTLERAHLRICHS", "MURRAYHANDYLAMING"), &
    1391              :                           enum_i_vals=[1, 2, 3, 4], &
    1392              :                           enum_desc=s2a("Mura-Knowles radial quadrature (default)", &
    1393              :                                         "Becke radial quadrature", &
    1394              :                                         "Treutler-Ahlrichs radial quadrature", &
    1395              :                                         "Murray-Handy-Laming radial quadrature"), &
    1396       106335 :                           default_i_val=1)
    1397       106335 :       CALL section_add_keyword(section, keyword)
    1398       106335 :       CALL keyword_release(keyword)
    1399              : 
    1400              :       CALL keyword_create(keyword, __LOCATION__, name="PRUNING_SCHEME", &
    1401              :                           description="Pruning scheme for GauXC. Skala defaults to UNPRUNED "// &
    1402              :                           "unless this keyword is set explicitly.", &
    1403              :                           usage="PRUNING_SCHEME robust", &
    1404              :                           enum_c_vals=s2a("ROBUST", "TREUTLER", "UNPRUNED"), &
    1405              :                           enum_i_vals=[1, 2, 3], &
    1406              :                           enum_desc=s2a("Robust pruning (default)", &
    1407              :                                         "Treutler pruning", &
    1408              :                                         "Unpruned grid"), &
    1409       106335 :                           default_i_val=1)
    1410       106335 :       CALL section_add_keyword(section, keyword)
    1411       106335 :       CALL keyword_release(keyword)
    1412              : 
    1413              :       CALL keyword_create(keyword, __LOCATION__, name="BATCH_SIZE", &
    1414              :                           description="Batch size for GauXC evaluation", &
    1415              :                           usage="BATCH_SIZE 512", &
    1416       106335 :                           default_i_val=512)
    1417       106335 :       CALL section_add_keyword(section, keyword)
    1418       106335 :       CALL keyword_release(keyword)
    1419              : 
    1420              :       CALL keyword_create(keyword, __LOCATION__, name="DEVICE_RUNTIME_FILL_FRACTION", &
    1421              :                           description="Fraction of currently available GPU memory preallocated by "// &
    1422              :                           "a GauXC device runtime. Lower values leave more memory for Skala "// &
    1423              :                           "Torch inference; this keyword is used only with LB_EXECUTION_SPACE DEVICE.", &
    1424              :                           usage="DEVICE_RUNTIME_FILL_FRACTION 0.1", &
    1425       106335 :                           default_r_val=0.1_dp)
    1426       106335 :       CALL section_add_keyword(section, keyword)
    1427       106335 :       CALL keyword_release(keyword)
    1428              : 
    1429              :       CALL keyword_create(keyword, __LOCATION__, name="MODEL_ATOM_CHUNK_SIZE", &
    1430              :                           description="Atom chunk size for GauXC Skala Torch inference. "// &
    1431              :                           "A positive value evaluates the Torch model atom block by atom block; "// &
    1432              :                           "zero disables chunking; the default leaves GauXC's model-specific policy "// &
    1433              :                           "or the GAUXC_ONEDFT_ATOM_CHUNK_SIZE environment variable in control.", &
    1434              :                           usage="MODEL_ATOM_CHUNK_SIZE 3", &
    1435       106335 :                           default_i_val=-1)
    1436       106335 :       CALL section_add_keyword(section, keyword)
    1437       106335 :       CALL keyword_release(keyword)
    1438              : 
    1439              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC_REFERENCE", &
    1440              :                           description="Explicitly opt into the limited isolated-cell GauXC reference "// &
    1441              :                           "path for periodic CP2K inputs. This path is restricted to Gamma-only, "// &
    1442              :                           "single-image METHOD GPW calculations with GTH pseudopotentials and uses "// &
    1443              :                           "GauXC's molecular quadrature; compact periodic materials require a "// &
    1444              :                           "dedicated periodic GauXC interface.", &
    1445              :                           usage="PERIODIC_REFERENCE T", &
    1446       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1447       106335 :       CALL section_add_keyword(section, keyword)
    1448       106335 :       CALL keyword_release(keyword)
    1449              : 
    1450              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID", &
    1451              :                           description="Experimental CP2K-native GPW real-space-grid path for SKALA "// &
    1452              :                           "TorchScript models. This bypasses GauXC molecular quadrature and supports "// &
    1453              :                           "isolated, partially periodic, and fully periodic METHOD GPW cells with "// &
    1454              :                           "GTH/ECP pseudopotentials and METHOD GAPW/GAPW_XC cells. GAPW with "// &
    1455              :                           "GTH/ECP pseudopotentials can use KIND%GPW_TYPE regular-grid features or "// &
    1456              :                           "the GAPW one-center XC correction; GAPW all-electron uses the "// &
    1457              :                           "all-electron regular-grid density. The current implementation is limited "// &
    1458              :                           "to a single GAUXC functional and provides energy, VXC, and experimental "// &
    1459              :                           "analytical nuclear-gradient/stress evaluations. K-point runs use CP2K's "// &
    1460              :                           "standard k-point and symmetry-reduction infrastructure; CPU k-point "// &
    1461              :                           "runs require mutually compatible BLAS, ScaLAPACK, OpenMP, and LibTorch "// &
    1462              :                           "runtimes, while CUDA evaluation is selected explicitly. "// &
    1463              :                           "Energy/VXC runs split the Torch evaluation into atom blocks by default "// &
    1464              :                           "and route dynamic features and gradients between MPI ranks. "// &
    1465              :                           "PAW/one-center GAPW+GTH/ECP and METHOD GAPW_XC use CP2K's GAPW hard/soft "// &
    1466              :                           "one-center XC correction with a selectable "// &
    1467              :                           "NATIVE_GRID_GAPW_DENSITY_PARTITION. ROKS, ADMM, and non-k-point "// &
    1468              :                           "multiple-image calculations are not implemented.", &
    1469              :                           usage="NATIVE_GRID T", &
    1470       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1471       106335 :       CALL section_add_keyword(section, keyword)
    1472       106335 :       CALL keyword_release(keyword)
    1473              : 
    1474              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_USE_CUDA", &
    1475              :                           description="Evaluate the experimental CP2K-native SKALA GPW TorchScript "// &
    1476              :                           "model on CUDA when libtorch CUDA support is available. This requires a "// &
    1477              :                           "CUDA-compatible SKALA model export; MODEL SKALA first checks "// &
    1478              :                           "GAUXC_SKALA_CUDA_MODEL in this mode and otherwise falls back to "// &
    1479              :                           "GAUXC_SKALA_MODEL. The portable default uses CPU tensors.", &
    1480              :                           usage="NATIVE_GRID_USE_CUDA T", &
    1481       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1482       106335 :       CALL section_add_keyword(section, keyword)
    1483       106335 :       CALL keyword_release(keyword)
    1484              : 
    1485              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_CUDA_DEVICE", &
    1486              :                           description="CUDA device used by the experimental CP2K-native SKALA GPW "// &
    1487              :                           "TorchScript path when NATIVE_GRID_USE_CUDA is enabled. A negative value "// &
    1488              :                           "maps the MPI-local rank to one of the CUDA devices visible to the process; "// &
    1489              :                           "CUDA exports with device-specific TorchScript constants may require a "// &
    1490              :                           "rank-local CUDA_VISIBLE_DEVICES list. A non-negative value selects that "// &
    1491              :                           "visible CUDA device explicitly.", &
    1492              :                           usage="NATIVE_GRID_CUDA_DEVICE -1", &
    1493       106335 :                           default_i_val=-1)
    1494       106335 :       CALL section_add_keyword(section, keyword)
    1495       106335 :       CALL keyword_release(keyword)
    1496              : 
    1497              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_ATOM_PARTITION", &
    1498              :                           description="Atom partition used to build the experimental CP2K-native "// &
    1499              :                           "SKALA regular-grid feature block. HARD assigns each native grid point to "// &
    1500              :                           "the nearest periodic atom and is intended for legacy energy/VXC-only runs. "// &
    1501              :                           "SMOOTH uses a Becke-like fuzzy-cell partition on the native grid and creates "// &
    1502              :                           "weighted atom rows. Internal atom-grid weights vanish through a smooth taper "// &
    1503              :                           "when sparse rows reach the partition cutoff. Analytical atom forces and stress "// &
    1504              :                           "include both the partition and taper derivatives in the SKALA feature response.", &
    1505              :                           usage="NATIVE_GRID_ATOM_PARTITION SMOOTH", &
    1506              :                           enum_c_vals=s2a("HARD", "SMOOTH"), &
    1507              :                           enum_i_vals=[1, 2], &
    1508              :                           enum_desc=s2a("Assign each grid point to the nearest atom", &
    1509              :                                         "Use a smooth Becke-like native-grid atom partition"), &
    1510       106335 :                           default_i_val=2)
    1511       106335 :       CALL section_add_keyword(section, keyword)
    1512       106335 :       CALL keyword_release(keyword)
    1513              : 
    1514              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_GAPW_DENSITY_PARTITION", &
    1515              :                           description="Hard/soft one-center density contribution used by METHOD "// &
    1516              :                           "GAPW and METHOD GAPW_XC in Skala atomic-grid corrections. "// &
    1517              :                           "HARD_MINUS_SOFT evaluates the SKALA model on hard and soft atomic "// &
    1518              :                           "densities separately and adds the GAPW hard-minus-soft correction; this "// &
    1519              :                           "is the default because it follows CP2K's GAPW XC expression. For "// &
    1520              :                           "pseudopotential PAW/one-center GAPW this is distinct from KIND%GPW_TYPE, "// &
    1521              :                           "which uses the regular-grid valence-density approximation. "// &
    1522              :                           "HARD_ONLY, SOFT_ONLY, and NONE are diagnostic variants.", &
    1523              :                           usage="NATIVE_GRID_GAPW_DENSITY_PARTITION HARD_MINUS_SOFT", &
    1524              :                           enum_c_vals=s2a("HARD_MINUS_SOFT", "HARD_ONLY", "SOFT_ONLY", "NONE"), &
    1525              :                           enum_i_vals=[1, 2, 3, 4], &
    1526              :                           enum_desc=s2a("Use the hard-minus-soft GAPW one-center correction", &
    1527              :                                         "Use only the hard one-center density", &
    1528              :                                         "Use only the soft one-center density with the GAPW sign", &
    1529              :                                         "Disable the GAPW one-center SKALA correction"), &
    1530       106335 :                           default_i_val=1)
    1531       106335 :       CALL section_add_keyword(section, keyword)
    1532       106335 :       CALL keyword_release(keyword)
    1533              : 
    1534              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_GAPW_COMPOSITE_REFERENCE", &
    1535              :                           description="Evaluate native-grid SKALA for METHOD GAPW or GAPW_XC on "// &
    1536              :                           "rho and tau reconstructed as smooth plus hard-minus-soft before nonlinear "// &
    1537              :                           "feature construction on one common regular grid. No separate one-center "// &
    1538              :                           "SKALA energy is added. This expensive, cutoff-sensitive diagnostic is "// &
    1539              :                           "intended to validate the nonlinear hard/soft cross terms.", &
    1540              :                           usage="NATIVE_GRID_GAPW_COMPOSITE_REFERENCE T", &
    1541       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1542       106335 :       CALL section_add_keyword(section, keyword)
    1543       106335 :       CALL keyword_release(keyword)
    1544              : 
    1545              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_GAPW_COMPOSITE_DIRECT_AO", &
    1546              :                           description="Use direct full-ORB rho and tau collocation for the native-grid "// &
    1547              :                           "GAPW composite diagnostic. This is the variational all-electron "// &
    1548              :                           "counterpart of the reconstructed smooth plus hard-minus-soft fields and "// &
    1549              :                           "provides a reference for their common-grid adjoint.", &
    1550              :                           usage="NATIVE_GRID_GAPW_COMPOSITE_DIRECT_AO T", &
    1551       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1552       106335 :       CALL section_add_keyword(section, keyword)
    1553       106335 :       CALL keyword_release(keyword)
    1554              : 
    1555              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_GAPW_ATOM_COMPOSITE_REFERENCE", &
    1556              :                           description="Replace the native smooth plus separate GAPW one-center SKALA "// &
    1557              :                           "terms by one atom-centered evaluation of smooth plus hard-minus-soft "// &
    1558              :                           "primitive fields before nonlinear feature construction. The smooth PW "// &
    1559              :                           "and one-center VXC adjoints are returned consistently. MPI ranks assemble "// &
    1560              :                           "the atom rows collectively; one communicator root evaluates the model and "// &
    1561              :                           "broadcasts the energy and feature adjoints.", &
    1562              :                           usage="NATIVE_GRID_GAPW_ATOM_COMPOSITE_REFERENCE T", &
    1563       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1564       106335 :       CALL section_add_keyword(section, keyword)
    1565       106335 :       CALL keyword_release(keyword)
    1566              : 
    1567              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_GAPW_ATOM_COMPOSITE_DIAGNOSTIC", &
    1568              :                           description="Evaluate an energy-only GAPW diagnostic on the combined "// &
    1569              :                           "smooth plus one-center hard-minus-soft density before nonlinear SKALA "// &
    1570              :                           "feature construction. The smooth native-grid density is interpolated to "// &
    1571              :                           "the atom-centered GAPW quadrature and all atomic grids are evaluated in "// &
    1572              :                           "one model call. This single-rank diagnostic does not replace the active "// &
    1573              :                           "XC energy or potential.", &
    1574              :                           usage="NATIVE_GRID_GAPW_ATOM_COMPOSITE_DIAGNOSTIC T", &
    1575       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1576       106335 :       CALL section_add_keyword(section, keyword)
    1577       106335 :       CALL keyword_release(keyword)
    1578              : 
    1579              :       CALL keyword_create(keyword, __LOCATION__, &
    1580              :                           name="NATIVE_GRID_GAPW_ATOM_COMPOSITE_COMPONENTS", &
    1581              :                           description="Select which one-center hard-minus-soft fields enter the "// &
    1582              :                           "atom-composite SKALA diagnostic. FULL combines rho, gradient, and tau; "// &
    1583              :                           "RHO_GRAD and TAU isolate the corresponding reconstruction; SMOOTH "// &
    1584              :                           "uses only interpolated smooth fields.", &
    1585              :                           usage="NATIVE_GRID_GAPW_ATOM_COMPOSITE_COMPONENTS FULL", &
    1586              :                           enum_c_vals=s2a("FULL", "RHO_GRAD", "TAU", "SMOOTH"), &
    1587              :                           enum_i_vals=[1, 2, 3, 4], &
    1588              :                           enum_desc=s2a("Combine rho, gradient, and tau corrections", &
    1589              :                                         "Combine only rho and gradient corrections", &
    1590              :                                         "Combine only the tau correction", &
    1591              :                                         "Use only interpolated smooth fields"), &
    1592       106335 :                           default_i_val=1)
    1593       106335 :       CALL section_add_keyword(section, keyword)
    1594       106335 :       CALL keyword_release(keyword)
    1595              : 
    1596              :       CALL keyword_create(keyword, __LOCATION__, &
    1597              :                           name="NATIVE_GRID_GAPW_ATOM_COMPOSITE_FD_STEP", &
    1598              :                           description="Central finite-difference step used by the atom-composite "// &
    1599              :                           "feature-VXC diagnostic.", &
    1600              :                           usage="NATIVE_GRID_GAPW_ATOM_COMPOSITE_FD_STEP 3.0E-3", &
    1601       106335 :                           default_r_val=3.0E-3_dp)
    1602       106335 :       CALL section_add_keyword(section, keyword)
    1603       106335 :       CALL keyword_release(keyword)
    1604              : 
    1605              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_ATOM_CHUNKS", &
    1606              :                           description="Split the experimental CP2K-native SKALA GPW TorchScript "// &
    1607              :                           "evaluation into contiguous atom blocks. MPI runs evaluate one atom block per "// &
    1608              :                           "rank, while single-rank runs can still use atom subchunks to reduce peak CUDA "// &
    1609              :                           "memory. Dynamic feature rows and VXC gradients are routed between their "// &
    1610              :                           "local grid and atom-block owner ranks. This is enabled by default; set it to "// &
    1611              :                           "false to retain the replicated global feature block. Analytical force and "// &
    1612              :                           "stress runs use the full differentiable tensor graph instead of routed atom "// &
    1613              :                           "chunks.", &
    1614              :                           usage="NATIVE_GRID_ATOM_CHUNKS T", &
    1615       106335 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1616       106335 :       CALL section_add_keyword(section, keyword)
    1617       106335 :       CALL keyword_release(keyword)
    1618              : 
    1619              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_ATOM_CHUNK_ROUTING", &
    1620              :                           description="Compatibility alias for the routed experimental CP2K-native "// &
    1621              :                           "SKALA GPW atom chunks. This implies NATIVE_GRID_ATOM_CHUNKS.", &
    1622              :                           usage="NATIVE_GRID_ATOM_CHUNK_ROUTING T", &
    1623       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1624       106335 :       CALL section_add_keyword(section, keyword)
    1625       106335 :       CALL keyword_release(keyword)
    1626              : 
    1627              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_ATOM_CHUNK_MAX_ROWS", &
    1628              :                           description="Maximum number of atom-grid rows evaluated by one TorchScript "// &
    1629              :                           "call in the experimental CP2K-native SKALA GPW atom-chunk path. A positive "// &
    1630              :                           "value splits each rank-local atom chunk into contiguous atom subchunks to "// &
    1631              :                           "reduce peak CPU or CUDA memory use; zero disables subchunking; -1 selects "// &
    1632              :                           "an automatic row cap.", &
    1633              :                           usage="NATIVE_GRID_ATOM_CHUNK_MAX_ROWS 250000", &
    1634       106335 :                           default_i_val=-1)
    1635       106335 :       CALL section_add_keyword(section, keyword)
    1636       106335 :       CALL keyword_release(keyword)
    1637              : 
    1638              :       CALL keyword_create(keyword, __LOCATION__, name="NATIVE_GRID_DIAGNOSTICS", &
    1639              :                           description="Print diagnostic integrals of the CP2K-native SKALA GPW feature "// &
    1640              :                           "block, including electron count, spin moment, and summed grid weights.", &
    1641              :                           usage="NATIVE_GRID_DIAGNOSTICS T", &
    1642       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1643       106335 :       CALL section_add_keyword(section, keyword)
    1644       106335 :       CALL keyword_release(keyword)
    1645              : 
    1646              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULAR_VIRIAL", &
    1647              :                           description="Print a molecular XC virial diagnostic computed from GauXC "// &
    1648              :                           "nuclear gradients. This is not an analytical periodic stress tensor.", &
    1649              :                           usage="MOLECULAR_VIRIAL T", &
    1650       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1651       106335 :       CALL section_add_keyword(section, keyword)
    1652       106335 :       CALL keyword_release(keyword)
    1653              : 
    1654              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULAR_VIRIAL_DEBUG", &
    1655              :                           description="Check the GauXC molecular XC virial diagnostic against a "// &
    1656              :                           "finite-difference affine scaling of the molecular coordinates.", &
    1657              :                           usage="MOLECULAR_VIRIAL_DEBUG T", &
    1658       106335 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1659       106335 :       CALL section_add_keyword(section, keyword)
    1660       106335 :       CALL keyword_release(keyword)
    1661              : 
    1662              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULAR_VIRIAL_DEBUG_DX", &
    1663              :                           description="Dimensionless finite-difference step for MOLECULAR_VIRIAL_DEBUG.", &
    1664              :                           usage="MOLECULAR_VIRIAL_DEBUG_DX 1.0E-4", &
    1665       106335 :                           default_r_val=1.0E-4_dp)
    1666       106335 :       CALL section_add_keyword(section, keyword)
    1667       106335 :       CALL keyword_release(keyword)
    1668              : 
    1669              :       CALL keyword_create(keyword, __LOCATION__, name="LB_EXECUTION_SPACE", &
    1670              :                           description="Execution space for load balancer in GauXC", &
    1671              :                           usage="LB_EXECUTION_SPACE host", &
    1672              :                           enum_c_vals=s2a("HOST", "DEVICE"), &
    1673              :                           enum_i_vals=[1, 2], &
    1674              :                           enum_desc=s2a("Run on host (default)", &
    1675              :                                         "Run on device"), &
    1676       106335 :                           default_i_val=1)
    1677       106335 :       CALL section_add_keyword(section, keyword)
    1678       106335 :       CALL keyword_release(keyword)
    1679              : 
    1680              :       CALL keyword_create(keyword, __LOCATION__, name="INT_EXECUTION_SPACE", &
    1681              :                           description="Execution space for integrator in GauXC", &
    1682              :                           usage="INT_EXECUTION_SPACE host", &
    1683              :                           enum_c_vals=s2a("HOST", "DEVICE"), &
    1684              :                           enum_i_vals=[1, 2], &
    1685              :                           enum_desc=s2a("Run on host (default)", &
    1686              :                                         "Run on device"), &
    1687       106335 :                           default_i_val=1)
    1688       106335 :       CALL section_add_keyword(section, keyword)
    1689       106335 :       CALL keyword_release(keyword)
    1690              : 
    1691              :       CALL keyword_create(keyword, __LOCATION__, name="LWD_KERNEL", &
    1692              :                           description="Local work driver kernel used by the GauXC integrator. "// &
    1693              :                           "AUTO uses SCHEME1-CUTLASS for device SKALA when GauXC provides it "// &
    1694              :                           "and otherwise uses GauXC's default for the selected execution space. "// &
    1695              :                           "DEFAULT always uses GauXC's default. "// &
    1696              :                           "Device builds with CUTLASS support can use SCHEME1-CUTLASS to run "// &
    1697              :                           "the grouped local potential update through CUTLASS.", &
    1698              :                           usage="LWD_KERNEL AUTO", &
    1699       106335 :                           default_c_val="AUTO")
    1700       106335 :       CALL section_add_keyword(section, keyword)
    1701       106335 :       CALL keyword_release(keyword)
    1702              : 
    1703              :       CALL keyword_create(keyword, __LOCATION__, name="SKALA_RUNTIME", &
    1704              :                           description="MPI communicator policy for GauXC Skala. AUTO uses "// &
    1705              :                           "the force-evaluation communicator for closed-shell calculations and a "// &
    1706              :                           "rank-local replicated runtime for open-shell calculations. MPI forces the "// &
    1707              :                           "force-evaluation communicator. SELF forces the previous replicated mode.", &
    1708              :                           usage="SKALA_RUNTIME AUTO", &
    1709              :                           enum_c_vals=s2a("AUTO", "MPI", "SELF"), &
    1710              :                           enum_i_vals=[1, 2, 3], &
    1711              :                           enum_desc=s2a("Closed-shell MPI, open-shell replicated (default)", &
    1712              :                                         "Use the force-evaluation MPI communicator", &
    1713              :                                         "Use rank-local replicated GauXC runtimes"), &
    1714       106335 :                           default_i_val=1)
    1715       106335 :       CALL section_add_keyword(section, keyword)
    1716       106335 :       CALL keyword_release(keyword)
    1717              : 
    1718              :       CALL keyword_create(keyword, __LOCATION__, name="MODEL_GRADIENT_RUNTIME", &
    1719              :                           description="MPI communicator policy for GauXC Skala nuclear gradients. "// &
    1720              :                           "AUTO keeps the conservative rank-local gradient runtime when energy/VXC uses "// &
    1721              :                           "the MPI communicator. MPI uses the force-evaluation communicator for gradients "// &
    1722              :                           "and requires GauXC support for distributed Skala gradients. SELF forces "// &
    1723              :                           "rank-local replicated gradient runtimes.", &
    1724              :                           usage="MODEL_GRADIENT_RUNTIME AUTO", &
    1725              :                           enum_c_vals=s2a("AUTO", "MPI", "SELF"), &
    1726              :                           enum_i_vals=[1, 2, 3], &
    1727              :                           enum_desc=s2a("Conservative replicated gradient runtime (default)", &
    1728              :                                         "Use the force-evaluation MPI communicator when supported", &
    1729              :                                         "Use rank-local replicated gradient runtimes"), &
    1730       106335 :                           default_i_val=1)
    1731       106335 :       CALL section_add_keyword(section, keyword)
    1732       106335 :       CALL keyword_release(keyword)
    1733              : 
    1734              :       CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_PATH", &
    1735              :                           description="Optional path to an existing directory for GauXC HDF5 debug output. "// &
    1736              :                           "If set, molecule and basis set data are written as separate HDF5 files.", &
    1737              :                           usage="OUTPUT_PATH /path/to/output", &
    1738       106335 :                           default_c_val="")
    1739       106335 :       CALL section_add_keyword(section, keyword)
    1740       106335 :       CALL keyword_release(keyword)
    1741              : 
    1742       106335 :    END SUBROUTINE create_gauxc_section
    1743              : 
    1744              : ! **************************************************************************************************
    1745              : !> \brief creates the input section for the xc part
    1746              : !> \param section the section to create
    1747              : !> \author fawzi
    1748              : ! **************************************************************************************************
    1749        85068 :    SUBROUTINE create_xc_section(section)
    1750              :       TYPE(section_type), POINTER                        :: section
    1751              : 
    1752              :       TYPE(keyword_type), POINTER                        :: keyword
    1753              :       TYPE(section_type), POINTER                        :: subsection
    1754              : 
    1755        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
    1756              :       CALL section_create(section, __LOCATION__, name="xc", &
    1757              :                           description="Parameters needed for the calculation of the eXchange and Correlation potential", &
    1758        85068 :                           n_keywords=5, n_subsections=2, repeats=.FALSE.)
    1759              : 
    1760        85068 :       NULLIFY (subsection, keyword)
    1761              : 
    1762              :       CALL keyword_create(keyword, __LOCATION__, name="density_cutoff", &
    1763              :                           description="The cutoff on the density used by the xc calculation", &
    1764        85068 :                           usage="density_cutoff 1.e-11", default_r_val=1.0e-10_dp)
    1765        85068 :       CALL section_add_keyword(section, keyword)
    1766        85068 :       CALL keyword_release(keyword)
    1767              : 
    1768              :       CALL keyword_create(keyword, __LOCATION__, name="gradient_cutoff", &
    1769              :                           description="The cutoff on the gradient of the density used by the "// &
    1770              :                           "xc calculation", &
    1771        85068 :                           usage="gradient_cutoff 1.e-11", default_r_val=1.0e-10_dp)
    1772        85068 :       CALL section_add_keyword(section, keyword)
    1773        85068 :       CALL keyword_release(keyword)
    1774              : 
    1775              :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY_SMOOTH_CUTOFF_RANGE", &
    1776              :                           description="Parameter for the smoothing procedure in xc calculation", &
    1777        85068 :                           usage="DENSITY_SMOOTH_CUTOFF_RANGE {real}", default_r_val=0.0_dp)
    1778        85068 :       CALL section_add_keyword(section, keyword)
    1779        85068 :       CALL keyword_release(keyword)
    1780              : 
    1781              :       CALL keyword_create(keyword, __LOCATION__, name="tau_cutoff", &
    1782              :                           description="The cutoff on tau used by the xc calculation", &
    1783        85068 :                           usage="tau_cutoff 1.e-11", default_r_val=1.0e-10_dp)
    1784        85068 :       CALL section_add_keyword(section, keyword)
    1785        85068 :       CALL keyword_release(keyword)
    1786              : 
    1787              :       CALL section_create(subsection, __LOCATION__, name="xc_grid", & !FM to do
    1788              :                           description="The xc parameters used when calculating the xc on the grid", &
    1789        85068 :                           n_keywords=6, n_subsections=0, repeats=.FALSE.)
    1790              :       CALL keyword_create(keyword, __LOCATION__, name="xc_smooth_rho", &
    1791              :                           description="The density smoothing used for the xc calculation", &
    1792              :                           usage="xc_smooth_rho nn10", default_i_val=xc_rho_no_smooth, &
    1793              :                           enum_c_vals=s2a("NONE", "NN50", "NN10", "SPLINE2", "NN6", "SPLINE3", "NN4"), &
    1794              :                           enum_i_vals=[xc_rho_no_smooth, xc_rho_nn50, xc_rho_nn10, &
    1795              :                                        xc_rho_spline2_smooth, xc_rho_spline2_smooth, xc_rho_spline3_smooth, &
    1796        85068 :                                        xc_rho_spline3_smooth])
    1797        85068 :       CALL section_add_keyword(subsection, keyword)
    1798        85068 :       CALL keyword_release(keyword)
    1799              : 
    1800              :       CALL keyword_create(keyword, __LOCATION__, name="xc_deriv", &
    1801              :                           description="The method used to compute the derivatives", &
    1802              :                           usage="xc_deriv NN10_SMOOTH", default_i_val=xc_deriv_pw, &
    1803              :                           enum_c_vals=s2a("PW", "SPLINE3", "SPLINE2", "NN50_SMOOTH", "NN10_SMOOTH", &
    1804              :                                           "SPLINE2_SMOOTH", "NN6_SMOOTH", "SPLINE3_SMOOTH", "NN4_SMOOTH", "COLLOCATE"), &
    1805              :                           enum_i_vals=[xc_deriv_pw, xc_deriv_spline3, xc_deriv_spline2, &
    1806              :                                        xc_deriv_nn50_smooth, xc_deriv_nn10_smooth, xc_deriv_spline2_smooth, &
    1807              :                                        xc_deriv_spline2_smooth, xc_deriv_spline3_smooth, xc_deriv_spline3_smooth, &
    1808        85068 :                                        xc_deriv_collocate])
    1809        85068 :       CALL section_add_keyword(subsection, keyword)
    1810        85068 :       CALL keyword_release(keyword)
    1811              : 
    1812              :       CALL keyword_create(keyword, __LOCATION__, name="use_finer_grid", &
    1813              :                           description="Uses a finer grid only to calculate the xc", &
    1814              :                           usage="use_finer_grid", default_l_val=.FALSE., &
    1815        85068 :                           lone_keyword_l_val=.TRUE.)
    1816        85068 :       CALL section_add_keyword(subsection, keyword)
    1817        85068 :       CALL keyword_release(keyword)
    1818              : 
    1819              :       CALL keyword_create(keyword, __LOCATION__, name="fine_grid_factor", &
    1820              :                           description="Factor by which the XC grid cutoff is increased when USE_FINER_GRID is active. "// &
    1821              :                           "This setting has no effect unless USE_FINER_GRID is enabled. The default of 4.0 preserves "// &
    1822              :                           "the historical finer XC grid. Smaller factors can reduce the finer-grid cost, but should "// &
    1823              :                           "be checked together with the regular MGRID cutoff convergence.", &
    1824              :                           usage="FINE_GRID_FACTOR 4.0", default_r_val=4.0_dp, &
    1825       170136 :                           variants=["FINE_XC_FACTOR"])
    1826        85068 :       CALL section_add_keyword(subsection, keyword)
    1827        85068 :       CALL keyword_release(keyword)
    1828              : 
    1829              :       CALL keyword_create(keyword, __LOCATION__, name="2ND_DERIV_ANALYTICAL", &
    1830              :                           description="Use analytical formulas or finite differences for 2nd derivatives of XC", &
    1831              :                           usage="2ND_DERIV_ANALYTICAL logical", default_l_val=.TRUE., &
    1832        85068 :                           lone_keyword_l_val=.TRUE.)
    1833        85068 :       CALL section_add_keyword(section, keyword)
    1834        85068 :       CALL keyword_release(keyword)
    1835              : 
    1836              :       CALL keyword_create(keyword, __LOCATION__, name="3RD_DERIV_ANALYTICAL", &
    1837              :                           description="Use analytical formulas or finite differences for 3rd derivatives of XC", &
    1838              :                           usage="3RD_DERIV_ANALYTICAL logical", default_l_val=.TRUE., &
    1839        85068 :                           lone_keyword_l_val=.TRUE.)
    1840        85068 :       CALL section_add_keyword(section, keyword)
    1841        85068 :       CALL keyword_release(keyword)
    1842              : 
    1843              :       CALL keyword_create(keyword, __LOCATION__, name="STEP_SIZE", &
    1844              :                           description="Step size in terms of the first order potential for the numerical "// &
    1845              :                           "evaluation of XC derivatives", &
    1846        85068 :                           usage="STEP_SIZE 1.0E-3", default_r_val=1e-3_dp)
    1847        85068 :       CALL section_add_keyword(section, keyword)
    1848        85068 :       CALL keyword_release(keyword)
    1849              : 
    1850              :       CALL keyword_create(keyword, __LOCATION__, name="NSTEPS", &
    1851              :                           description="Number of steps to consider in each direction for the numerical "// &
    1852              :                           "evaluation of XC derivatives. Must be a value from 1 to 4 (Default: 3).", &
    1853        85068 :                           usage="NSTEPS 4", default_i_val=3)
    1854        85068 :       CALL section_add_keyword(section, keyword)
    1855        85068 :       CALL keyword_release(keyword)
    1856              : 
    1857        85068 :       CALL section_add_subsection(section, subsection)
    1858        85068 :       CALL section_release(subsection)
    1859              : 
    1860        85068 :       CALL create_xc_fun_section(subsection)
    1861        85068 :       CALL section_add_subsection(section, subsection)
    1862        85068 :       CALL section_release(subsection)
    1863              : 
    1864        85068 :       CALL create_hfx_section(subsection)
    1865        85068 :       CALL section_add_subsection(section, subsection)
    1866        85068 :       CALL section_release(subsection)
    1867              : 
    1868        85068 :       CALL create_mp2_section(subsection)
    1869        85068 :       CALL section_add_subsection(section, subsection)
    1870        85068 :       CALL section_release(subsection)
    1871              : 
    1872        85068 :       CALL create_adiabatic_section(subsection)
    1873        85068 :       CALL section_add_subsection(section, subsection)
    1874        85068 :       CALL section_release(subsection)
    1875              : 
    1876        85068 :       CALL create_xc_potential_section(subsection)
    1877        85068 :       CALL section_add_subsection(section, subsection)
    1878        85068 :       CALL section_release(subsection)
    1879              : 
    1880        85068 :       CALL create_xc_kernel_section(subsection)
    1881        85068 :       CALL section_add_subsection(section, subsection)
    1882        85068 :       CALL section_release(subsection)
    1883              : 
    1884        85068 :       CALL create_hfx_kernel_section(subsection)
    1885        85068 :       CALL section_add_subsection(section, subsection)
    1886        85068 :       CALL section_release(subsection)
    1887              : 
    1888        85068 :       CALL create_vdw_potential_section(subsection)
    1889        85068 :       CALL section_add_subsection(section, subsection)
    1890        85068 :       CALL section_release(subsection)
    1891              : 
    1892        85068 :       CALL create_gcp_potential_section(subsection)
    1893        85068 :       CALL section_add_subsection(section, subsection)
    1894        85068 :       CALL section_release(subsection)
    1895              : 
    1896        85068 :    END SUBROUTINE create_xc_section
    1897              : 
    1898              : ! **************************************************************************************************
    1899              : !> \brief creates the section for adiabatic hybrid functionals
    1900              : !> \param section ...
    1901              : !> \author Manuel Guidon
    1902              : ! **************************************************************************************************
    1903        85068 :    SUBROUTINE create_adiabatic_section(section)
    1904              :       TYPE(section_type), POINTER                        :: section
    1905              : 
    1906              :       TYPE(keyword_type), POINTER                        :: keyword
    1907              : 
    1908        85068 :       CPASSERT(.NOT. ASSOCIATED(section))
    1909              :       CALL section_create(section, __LOCATION__, name="ADIABATIC_RESCALING", &
    1910              :                           description="Parameters for self interaction corrected hybrid functionals", &
    1911        85068 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
    1912        85068 :       NULLIFY (keyword)
    1913              :       CALL keyword_create( &
    1914              :          keyword, __LOCATION__, &
    1915              :          name="FUNCTIONAL_TYPE", &
    1916              :          description="Which Hybrid functional should be used. "// &
    1917              :          "(Has to be consistent with the definitions in XC and HF).", &
    1918              :          usage="FUNCTIONAL_TYPE MCY3", &
    1919              :          enum_c_vals=s2a("MCY3"), &
    1920              :          enum_i_vals=[do_adiabatic_hybrid_mcy3], &
    1921              :          enum_desc=s2a("Use MCY3 hybrid functional"), &
    1922        85068 :          default_i_val=do_adiabatic_hybrid_mcy3)
    1923        85068 :       CALL section_add_keyword(section, keyword)
    1924        85068 :       CALL keyword_release(keyword)
    1925              : 
    1926        85068 :       NULLIFY (keyword)
    1927              :       CALL keyword_create( &
    1928              :          keyword, __LOCATION__, &
    1929              :          name="LAMBDA", &
    1930              :          description="The point to be used along the adiabatic curve (0 &lt; &lambda; &lt; 1)", &
    1931              :          usage="LAMBDA 0.71", &
    1932        85068 :          default_r_val=0.71_dp)
    1933        85068 :       CALL section_add_keyword(section, keyword)
    1934        85068 :       CALL keyword_release(keyword)
    1935              : 
    1936        85068 :       NULLIFY (keyword)
    1937              :       CALL keyword_create( &
    1938              :          keyword, __LOCATION__, &
    1939              :          name="OMEGA", &
    1940              :          description="Long-range parameter", &
    1941              :          usage="OMEGA 0.2", &
    1942        85068 :          default_r_val=0.2_dp)
    1943        85068 :       CALL section_add_keyword(section, keyword)
    1944        85068 :       CALL keyword_release(keyword)
    1945              : 
    1946        85068 :       NULLIFY (keyword)
    1947              :       CALL keyword_create( &
    1948              :          keyword, __LOCATION__, &
    1949              :          name="FUNCTIONAL_MODEL", &
    1950              :          description="Which model for the coupling constant integration should be used. ", &
    1951              :          usage="FUNCTIONAL_MODEL PADE", &
    1952              :          enum_c_vals=s2a("PADE"), &
    1953              :          enum_i_vals=[do_adiabatic_model_pade], &
    1954              :          enum_desc=s2a("Use pade model: W(lambda)=a+(b*lambda)/(1+c*lambda)"), &
    1955        85068 :          default_i_val=do_adiabatic_model_pade)
    1956        85068 :       CALL section_add_keyword(section, keyword)
    1957        85068 :       CALL keyword_release(keyword)
    1958        85068 :    END SUBROUTINE create_adiabatic_section
    1959              : 
    1960              : END MODULE input_cp2k_xc
        

Generated by: LCOV version 2.0-1