LCOV - code coverage report
Current view: top level - src - input_cp2k_xc.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:1be8651) Lines: 100.0 % 634 634
Test Date: 2026-11-24 01:22:08 Functions: 100.0 % 8 8

            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, Chai2008, Goedecker1996, &
      17              :         Grimme2006, Grimme2010, Grimme2011, Heyd2004, Kruse2012, Lee1988, Ortiz1994, Perdew1981, &
      18              :         Perdew1996, Perdew2008, Proynov2007, Tao2003, Tran2013, Vosko1980, Wellendorff2012, &
      19              :         Zhang1998
      20              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      21              :                                               cp_print_key_section_create,&
      22              :                                               high_print_level
      23              :    USE eeq_input,                       ONLY: create_eeq_control_section
      24              :    USE input_constants,                 ONLY: &
      25              :         do_adiabatic_hybrid_mcy3, do_adiabatic_model_pade, do_libxc_cpu, do_libxc_gpu, &
      26              :         fxc_funct_gga, fxc_funct_lda, fxc_funct_pade, fxc_none, gaussian, slater, vdw_nl_drsll, &
      27              :         vdw_nl_lmkll, vdw_nl_rvv10, vdw_pairpot_dftd2, vdw_pairpot_dftd2chg, vdw_pairpot_dftd3, &
      28              :         vdw_pairpot_dftd3bj, vdw_pairpot_dftd4, xc_funct_b3lyp, xc_funct_beefvdw, xc_funct_blyp, &
      29              :         xc_funct_bp, xc_funct_hcth120, xc_funct_no_shortcut, xc_funct_olyp, xc_funct_pade, &
      30              :         xc_funct_pbe, xc_funct_pbe0, xc_funct_tpss, xc_none, xc_pot_energy_none, &
      31              :         xc_pot_energy_sum_eigenvalues, xc_pot_energy_xc_functional, xc_vdw_fun_none, &
      32              :         xc_vdw_fun_nonloc, xc_vdw_fun_pairpot
      33              :    USE input_cp2k_hfx,                  ONLY: create_hfx_section
      34              :    USE input_cp2k_mp2,                  ONLY: create_mp2_section
      35              :    USE input_cp2k_skala,                ONLY: create_gauxc_section,&
      36              :                                               create_skala_native_section
      37              :    USE input_keyword_types,             ONLY: keyword_create,&
      38              :                                               keyword_release,&
      39              :                                               keyword_type
      40              :    USE input_section_types,             ONLY: section_add_keyword,&
      41              :                                               section_add_subsection,&
      42              :                                               section_create,&
      43              :                                               section_release,&
      44              :                                               section_type
      45              :    USE input_val_types,                 ONLY: char_t,&
      46              :                                               integer_t,&
      47              :                                               real_t
      48              :    USE kinds,                           ONLY: dp
      49              :    USE string_utilities,                ONLY: s2a
      50              :    USE xc_input_constants,              ONLY: &
      51              :         c_pw92, c_pw92dmc, c_pw92vmc, c_pz, c_pzdmc, c_pzvmc, do_vwn3, do_vwn5, ke_lc, ke_llp, &
      52              :         ke_ol1, ke_ol2, ke_pbe, ke_pw86, ke_pw91, ke_t92, pz_orig, xalpha, xc_b97_3c, &
      53              :         xc_b97_grimme, xc_b97_mardirossian, xc_b97_orig, xc_deriv_collocate, xc_deriv_nn10_smooth, &
      54              :         xc_deriv_nn50_smooth, xc_deriv_pw, xc_deriv_spline2, xc_deriv_spline2_smooth, &
      55              :         xc_deriv_spline3, xc_deriv_spline3_smooth, xc_pbe_orig, xc_pbe_rev, xc_pbe_sol, &
      56              :         xc_rho_nn10, xc_rho_nn50, xc_rho_no_smooth, xc_rho_spline2_smooth, xc_rho_spline3_smooth, &
      57              :         xgga_b88x, xgga_ev93, xgga_opt, xgga_pbex, xgga_pw86, xgga_pw91, xgga_revpbe
      58              :    USE xc_libxc,                        ONLY: libxc_add_sections
      59              : #include "./base/base_uses.f90"
      60              : 
      61              :    IMPLICIT NONE
      62              :    PRIVATE
      63              : 
      64              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      65              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_xc'
      66              : 
      67              :    PUBLIC :: create_xc_section, create_xc_fun_section
      68              : 
      69              : CONTAINS
      70              : 
      71              : ! **************************************************************************************************
      72              : !> \brief creates the structure of the section needed to select the xc functional
      73              : !> \param section the section that will be created
      74              : !> \author fawzi
      75              : ! **************************************************************************************************
      76        14913 :    SUBROUTINE create_xc_fun_section(section)
      77              :       TYPE(section_type), POINTER                        :: section
      78              : 
      79              :       TYPE(keyword_type), POINTER                        :: keyword
      80              :       TYPE(section_type), POINTER                        :: subsection
      81              : 
      82        14913 :       CPASSERT(.NOT. ASSOCIATED(section))
      83              :       CALL section_create(section, __LOCATION__, name="xc_functional", &
      84              :                           description="The eXchange-Correlation functional to use. In case of hybrid functionals, all scaling "// &
      85              :                           "parameters and potential types have to be specified in the HF section except from a few "// &
      86              :                           "predefined combinations (see _SECTION_PARAMETERS_ below). CP2K does NOT set it up "// &
      87              :                           "automatically not even for LibXC functionals.", &
      88              :                           n_keywords=0, n_subsections=4, repeats=.FALSE., &
      89              :                           citations=[Ortiz1994, Becke1988, Perdew1996, Zhang1998, Lee1988, &
      90              :                                      Heyd2004, Vosko1980, Goedecker1996, Perdew1981, &
      91       178956 :                                      Tao2003, Wellendorff2012])
      92              : 
      93        14913 :       NULLIFY (subsection, keyword)
      94              :       CALL keyword_create( &
      95              :          keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
      96              :          description="Shortcut for the most common functional combinations. These make use of the implementations provided by "// &
      97              :          "native CP2K (without LibXC). In case of hybrid functionals (B3LYP, PBE0), set the "// &
      98              :          "accuracy-related and system-dependent parameters in the HF section (especially MAX_MEMORY, EPS_SCHWARZ, "// &
      99              :          "CUTOFF_RADIUS, POTENTIAL_TYPE) as these are not set automatically.", &
     100              :          usage="&xc_functional BLYP", &
     101              :          enum_c_vals=s2a("B3LYP", "PBE0", "BLYP", "BP", "PADE", "LDA", "PBE", &
     102              :                          "TPSS", "HCTH120", "OLYP", "BEEFVDW", "NO_SHORTCUT", "NONE"), &
     103              :          enum_i_vals=[xc_funct_b3lyp, xc_funct_pbe0, xc_funct_blyp, xc_funct_bp, xc_funct_pade, xc_funct_pade, xc_funct_pbe, &
     104              :                       xc_funct_tpss, xc_funct_hcth120, xc_funct_olyp, xc_funct_beefvdw, xc_funct_no_shortcut, xc_none], &
     105              :          enum_desc=s2a("B3LYP", &
     106              :                        "PBE0 (see note in section XC/XC_FUNCTIONAL/PBE)", &
     107              :                        "BLYP", "BP", "PADE", "Alias for PADE", &
     108              :                        "PBE (see note in section XC/XC_FUNCTIONAL/PBE)", &
     109              :                        "TPSS (not available with LSD, use LIBXC version instead)", "HCTH120", "OLYP", &
     110              :                        "BEEFVDW", "NO_SHORTCUT", "NONE"), &
     111              :          default_i_val=xc_funct_no_shortcut, &
     112        14913 :          lone_keyword_i_val=xc_funct_no_shortcut)
     113        14913 :       CALL section_add_keyword(section, keyword)
     114        14913 :       CALL keyword_release(keyword)
     115              : 
     116              :       CALL section_create(subsection, __LOCATION__, name="BECKE88", &
     117              :                           description="Uses the Becke 88 exchange functional", &
     118              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     119        29826 :                           citations=[Becke1988])
     120              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     121              :                           description="activates the functional", &
     122        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     123        14913 :       CALL section_add_keyword(subsection, keyword)
     124        14913 :       CALL keyword_release(keyword)
     125              :       CALL keyword_create( &
     126              :          keyword, __LOCATION__, name="scale_x", &
     127              :          description="scales the exchange part of the functional", &
     128        14913 :          default_r_val=1._dp)
     129        14913 :       CALL section_add_keyword(subsection, keyword)
     130        14913 :       CALL keyword_release(keyword)
     131              : 
     132        14913 :       CALL section_add_subsection(section, subsection)
     133        14913 :       CALL section_release(subsection)
     134              : 
     135              :       CALL section_create(subsection, __LOCATION__, name="LYP_ADIABATIC", &
     136              :                           description="Uses the LYP correlation functional in an adiabatic fashion", &
     137              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     138        29826 :                           citations=[Lee1988])
     139              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     140              :                           description="activates the functional", &
     141        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     142        14913 :       CALL section_add_keyword(subsection, keyword)
     143        14913 :       CALL keyword_release(keyword)
     144              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
     145              :                           description="Defines the parameter of the adiabatic curve.", &
     146        14913 :                           default_r_val=1._dp)
     147        14913 :       CALL section_add_keyword(subsection, keyword)
     148        14913 :       CALL keyword_release(keyword)
     149              : 
     150        14913 :       CALL section_add_subsection(section, subsection)
     151        14913 :       CALL section_release(subsection)
     152              : 
     153              :       CALL section_create(subsection, __LOCATION__, name="BECKE88_LR_ADIABATIC", &
     154              :                           description="Uses the Becke 88 longrange exchange functional in an adiabatic fashion", &
     155              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     156        29826 :                           citations=[Becke1988])
     157              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     158              :                           description="activates the functional", &
     159        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     160        14913 :       CALL section_add_keyword(subsection, keyword)
     161        14913 :       CALL keyword_release(keyword)
     162              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     163              :                           description="scales the exchange part of the functional", &
     164        14913 :                           default_r_val=1._dp)
     165        14913 :       CALL section_add_keyword(subsection, keyword)
     166        14913 :       CALL keyword_release(keyword)
     167              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     168              :                           description="Potential parameter in erf(omega*r)/r", &
     169        14913 :                           default_r_val=1._dp)
     170        14913 :       CALL section_add_keyword(subsection, keyword)
     171        14913 :       CALL keyword_release(keyword)
     172              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
     173              :                           description="Defines the parameter of the adiabatic curve", &
     174        14913 :                           default_r_val=1._dp)
     175        14913 :       CALL section_add_keyword(subsection, keyword)
     176        14913 :       CALL keyword_release(keyword)
     177              : 
     178        14913 :       CALL section_add_subsection(section, subsection)
     179        14913 :       CALL section_release(subsection)
     180              : 
     181              :       CALL section_create(subsection, __LOCATION__, name="BECKE88_LR", &
     182              :                           description="Uses the Becke 88 longrange exchange functional", &
     183              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     184        29826 :                           citations=[Becke1988])
     185              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     186              :                           description="activates the functional", &
     187        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     188        14913 :       CALL section_add_keyword(subsection, keyword)
     189        14913 :       CALL keyword_release(keyword)
     190              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     191              :                           description="scales the exchange part of the functional", &
     192        14913 :                           default_r_val=1._dp)
     193        14913 :       CALL section_add_keyword(subsection, keyword)
     194        14913 :       CALL keyword_release(keyword)
     195              :       CALL keyword_create(keyword, __LOCATION__, name="OMEGA", &
     196              :                           description="Potential parameter in erf(omega*r)/r", &
     197        14913 :                           default_r_val=1._dp)
     198        14913 :       CALL section_add_keyword(subsection, keyword)
     199        14913 :       CALL keyword_release(keyword)
     200              : 
     201        14913 :       CALL section_add_subsection(section, subsection)
     202        14913 :       CALL section_release(subsection)
     203              : 
     204              :       CALL section_create(subsection, __LOCATION__, name="LYP", &
     205              :                           description="Uses the LYP functional", &
     206              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     207        29826 :                           citations=[Lee1988])
     208              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     209              :                           description="activates the functional", &
     210        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     211        14913 :       CALL section_add_keyword(subsection, keyword)
     212        14913 :       CALL keyword_release(keyword)
     213              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     214              :                           description="scales the correlation part of the functional", &
     215        14913 :                           default_r_val=1._dp)
     216        14913 :       CALL section_add_keyword(subsection, keyword)
     217        14913 :       CALL keyword_release(keyword)
     218        14913 :       CALL section_add_subsection(section, subsection)
     219        14913 :       CALL section_release(subsection)
     220              : 
     221              :       CALL section_create(subsection, __LOCATION__, name="PADE", &
     222              :                           description="Uses the PADE functional", &
     223              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     224        29826 :                           citations=[Goedecker1996])
     225              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     226              :                           description="activates the functional", &
     227        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     228        14913 :       CALL section_add_keyword(subsection, keyword)
     229        14913 :       CALL keyword_release(keyword)
     230        14913 :       CALL section_add_subsection(section, subsection)
     231        14913 :       CALL section_release(subsection)
     232              : 
     233              :       CALL section_create(subsection, __LOCATION__, name="HCTH", &
     234              :                           description="Uses the HCTH class of functionals", &
     235        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     236              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_SET", &
     237              :                           description="Which version of the parameters should be used", &
     238              :                           usage="PARAMETER_SET 407", &
     239              :                           enum_c_vals=["93 ", "120", "147", "407", "HLE"], &
     240              :                           enum_i_vals=[93, 120, 147, 407, 408], &
     241        89478 :                           default_i_val=120)
     242        14913 :       CALL section_add_keyword(subsection, keyword)
     243        14913 :       CALL keyword_release(keyword)
     244              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     245              :                           description="activates the functional", &
     246        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     247        14913 :       CALL section_add_keyword(subsection, keyword)
     248        14913 :       CALL keyword_release(keyword)
     249        14913 :       CALL section_add_subsection(section, subsection)
     250        14913 :       CALL section_release(subsection)
     251              : 
     252              :       CALL section_create(subsection, __LOCATION__, name="OPTX", &
     253              :                           description="Uses the OPTX functional", &
     254        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     255              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     256              :                           description="activates the functional", &
     257        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     258        14913 :       CALL section_add_keyword(subsection, keyword)
     259        14913 :       CALL keyword_release(keyword)
     260              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     261              :                           description="scales the exchange part of the functional", &
     262        14913 :                           default_r_val=1._dp)
     263        14913 :       CALL section_add_keyword(subsection, keyword)
     264        14913 :       CALL keyword_release(keyword)
     265              :       CALL keyword_create(keyword, __LOCATION__, name="a1", &
     266              :                           description="OPTX a1 coefficient", &
     267        14913 :                           default_r_val=1.05151_dp)
     268        14913 :       CALL section_add_keyword(subsection, keyword)
     269        14913 :       CALL keyword_release(keyword)
     270              :       CALL keyword_create(keyword, __LOCATION__, name="a2", &
     271              :                           description="OPTX a2 coefficient", &
     272        14913 :                           default_r_val=1.43169_dp)
     273        14913 :       CALL section_add_keyword(subsection, keyword)
     274        14913 :       CALL keyword_release(keyword)
     275              :       CALL keyword_create(keyword, __LOCATION__, name="gamma", &
     276              :                           description="OPTX gamma coefficient", &
     277        14913 :                           default_r_val=0.006_dp)
     278        14913 :       CALL section_add_keyword(subsection, keyword)
     279        14913 :       CALL keyword_release(keyword)
     280        14913 :       CALL section_add_subsection(section, subsection)
     281        14913 :       CALL section_release(subsection)
     282              : 
     283        14913 :       CALL libxc_add_sections(section)
     284              : 
     285              :       CALL section_create(subsection, __LOCATION__, name="CS1", &
     286              :                           description="Uses the CS1 functional", &
     287        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     288              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     289              :                           description="activates the functional", &
     290        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     291        14913 :       CALL section_add_keyword(subsection, keyword)
     292        14913 :       CALL keyword_release(keyword)
     293        14913 :       CALL section_add_subsection(section, subsection)
     294        14913 :       CALL section_release(subsection)
     295              : 
     296              :       CALL section_create(subsection, __LOCATION__, name="XGGA", &
     297              :                           description="Uses one of the XGGA functionals (optimized versions of "// &
     298              :                           "some of these functionals might be available outside this section).", &
     299        14913 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     300              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     301              :                           description="activates the functional", &
     302        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     303        14913 :       CALL section_add_keyword(subsection, keyword)
     304        14913 :       CALL keyword_release(keyword)
     305              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL", &
     306              :                           description="Which one of the XGGA functionals should be used", &
     307              :                           usage="FUNCTIONAL PW86X", &
     308              :                           enum_c_vals=[ &
     309              :                           "BECKE88X", &
     310              :                           "PW86X   ", &
     311              :                           "PW91X   ", &
     312              :                           "PBEX    ", &
     313              :                           "REV_PBEX", &
     314              :                           "OPTX    ", &
     315              :                           "EV93    "], &
     316              :                           enum_i_vals=[xgga_b88x, xgga_pw86, xgga_pw91, xgga_pbex, xgga_revpbe, xgga_opt, xgga_ev93], &
     317       119304 :                           default_i_val=xgga_b88x)
     318        14913 :       CALL section_add_keyword(subsection, keyword)
     319        14913 :       CALL keyword_release(keyword)
     320        14913 :       CALL section_add_subsection(section, subsection)
     321        14913 :       CALL section_release(subsection)
     322              : 
     323              :       CALL section_create(subsection, __LOCATION__, name="KE_GGA", &
     324              :                           description="Uses one of the KE_GGA functionals (optimized versions of "// &
     325              :                           "some of these functionals might be available outside this section). "// &
     326              :                           "These functionals are needed for the computation of the kinetic "// &
     327              :                           "energy in the Kim-Gordon method.", &
     328        14913 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     329              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     330              :                           description="activates the functional", &
     331        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     332        14913 :       CALL section_add_keyword(subsection, keyword)
     333        14913 :       CALL keyword_release(keyword)
     334              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL", &
     335              :                           description="Which one of the KE_GGA functionals should be used", &
     336              :                           usage="FUNCTIONAL (OL1|OL2|LLP|PW86|PW91|LC|T92|PBE)", &
     337              :                           enum_c_vals=["OL1 ", "OL2 ", "LLP ", "PW86", "PW91", "LC  ", "T92 ", "PBE "], &
     338              :                           enum_i_vals=[ke_ol1, ke_ol2, ke_llp, ke_pw86, ke_pw91, ke_lc, ke_t92, ke_pbe], &
     339              :                           enum_desc=s2a("Uses first Ou-Yang and Levy functional, currently not producing correct results", &
     340              :                                         "Uses second Ou-Yang and Levy functional, currently not producing correct results", &
     341              :                                         "Uses Lee, Lee, and Parr functional", &
     342              :                                         "Uses Perdew and Wang's 1986 functional", &
     343              :                                         "Uses Perdew and Wang's 1991 functional", &
     344              :                                         "Uses Lembarki and Chermette functional", &
     345              :                                         "Uses Thakkar functional", &
     346              :                                         "Uses the 1996 functional of Perdew, Burke and Ernzerhof"), &
     347       134217 :                           default_i_val=ke_llp)
     348        14913 :       CALL section_add_keyword(subsection, keyword)
     349        14913 :       CALL keyword_release(keyword)
     350        14913 :       CALL section_add_subsection(section, subsection)
     351        14913 :       CALL section_release(subsection)
     352              : 
     353              :       CALL section_create(subsection, __LOCATION__, name="P86C", &
     354              :                           description="Uses the P86C functional", &
     355        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     356              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     357              :                           description="activates the functional", &
     358        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     359        14913 :       CALL section_add_keyword(subsection, keyword)
     360        14913 :       CALL keyword_release(keyword)
     361              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     362              :                           description="scales the correlation part of the functional", &
     363        14913 :                           default_r_val=1._dp)
     364        14913 :       CALL section_add_keyword(subsection, keyword)
     365        14913 :       CALL keyword_release(keyword)
     366        14913 :       CALL section_add_subsection(section, subsection)
     367        14913 :       CALL section_release(subsection)
     368              : 
     369              :       CALL section_create(subsection, __LOCATION__, name="PW92", &
     370              :                           description="Uses the PerdewWang correlation functional.", &
     371        14913 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     372              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     373              :                           description="activates the functional", &
     374        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     375        14913 :       CALL section_add_keyword(subsection, keyword)
     376        14913 :       CALL keyword_release(keyword)
     377              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
     378              :                           description="Scaling of the energy functional", &
     379        14913 :                           default_r_val=1.0_dp)
     380        14913 :       CALL section_add_keyword(subsection, keyword)
     381        14913 :       CALL keyword_release(keyword)
     382              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETRIZATION", &
     383              :                           description="Which one of parametrizations should be used", &
     384              :                           usage="PARAMETRIZATION DMC", &
     385              :                           enum_c_vals=[ &
     386              :                           "ORIGINAL", &
     387              :                           "DMC     ", &
     388              :                           "VMC     "], &
     389              :                           enum_i_vals=[c_pw92, c_pw92dmc, c_pw92vmc], &
     390        59652 :                           default_i_val=c_pw92)
     391        14913 :       CALL section_add_keyword(subsection, keyword)
     392        14913 :       CALL keyword_release(keyword)
     393        14913 :       CALL section_add_subsection(section, subsection)
     394        14913 :       CALL section_release(subsection)
     395              : 
     396              :       CALL section_create(subsection, __LOCATION__, name="PZ81", &
     397              :                           description="Uses the PZ functional.", &
     398              :                           n_keywords=1, n_subsections=0, repeats=.FALSE., &
     399        44739 :                           citations=[Perdew1981, Ortiz1994])
     400              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     401              :                           description="activates the functional", &
     402        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     403        14913 :       CALL section_add_keyword(subsection, keyword)
     404        14913 :       CALL keyword_release(keyword)
     405              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETRIZATION", &
     406              :                           description="Which one of parametrizations should be used", &
     407              :                           usage="PARAMETRIZATION DMC", &
     408              :                           enum_c_vals=[ &
     409              :                           "ORIGINAL", &
     410              :                           "DMC     ", &
     411              :                           "VMC     "], &
     412              :                           enum_i_vals=[c_pz, c_pzdmc, c_pzvmc], &
     413        59652 :                           default_i_val=pz_orig)
     414        14913 :       CALL section_add_keyword(subsection, keyword)
     415        14913 :       CALL keyword_release(keyword)
     416              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     417              :                           description="scales the correlation part of the functional", &
     418        14913 :                           default_r_val=1._dp)
     419        14913 :       CALL section_add_keyword(subsection, keyword)
     420        14913 :       CALL keyword_release(keyword)
     421        14913 :       CALL section_add_subsection(section, subsection)
     422        14913 :       CALL section_release(subsection)
     423              : 
     424              :       CALL section_create(subsection, __LOCATION__, name="TFW", &
     425              :                           description="Uses the TFW functional", &
     426        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     427              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     428              :                           description="activates the functional", &
     429        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     430        14913 :       CALL section_add_keyword(subsection, keyword)
     431        14913 :       CALL keyword_release(keyword)
     432        14913 :       CALL section_add_subsection(section, subsection)
     433        14913 :       CALL section_release(subsection)
     434              : 
     435              :       CALL section_create(subsection, __LOCATION__, name="TF", &
     436              :                           description="Uses the TF functional", &
     437        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     438              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     439              :                           description="activates the functional", &
     440        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     441        14913 :       CALL section_add_keyword(subsection, keyword)
     442        14913 :       CALL keyword_release(keyword)
     443        14913 :       CALL section_add_subsection(section, subsection)
     444        14913 :       CALL section_release(subsection)
     445              : 
     446              :       CALL section_create(subsection, __LOCATION__, name="VWN", &
     447              :                           description="Uses the VWN functional", &
     448              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     449        29826 :                           citations=[Vosko1980])
     450              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     451              :                           description="activates the functional", &
     452        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     453        14913 :       CALL section_add_keyword(subsection, keyword)
     454        14913 :       CALL keyword_release(keyword)
     455              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     456              :                           description="scales the correlation part of the functional", &
     457        14913 :                           default_r_val=1._dp)
     458        14913 :       CALL section_add_keyword(subsection, keyword)
     459        14913 :       CALL keyword_release(keyword)
     460              : 
     461              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTIONAL_TYPE", &
     462              :                           description="Which version of the VWN functional should be used", &
     463              :                           usage="FUNCTIONAL_TYPE VWN5", &
     464              :                           enum_c_vals=s2a("VWN5", "VWN3"), &
     465              :                           enum_i_vals=[do_vwn5, do_vwn3], &
     466              :                           enum_desc=s2a("This is the recommended (correct) version of the VWN functional", &
     467              :                                         "This version is the default in Gaussian, but not recommended. "// &
     468              :                                         "Notice that it is also employed in Gaussian's default version of B3LYP"), &
     469        14913 :                           default_i_val=do_vwn5)
     470              : 
     471        14913 :       CALL section_add_keyword(subsection, keyword)
     472        14913 :       CALL keyword_release(keyword)
     473        14913 :       CALL section_add_subsection(section, subsection)
     474        14913 :       CALL section_release(subsection)
     475              : 
     476              :       CALL section_create(subsection, __LOCATION__, name="XALPHA", &
     477              :                           description="Uses the XALPHA (SLATER) functional.", &
     478        14913 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     479              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     480              :                           description="activates the functional", &
     481        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     482        14913 :       CALL section_add_keyword(subsection, keyword)
     483        14913 :       CALL keyword_release(keyword)
     484              :       CALL keyword_create(keyword, __LOCATION__, name="XA", &
     485              :                           description="Value of the xa parameter (this does not change the exponent, "// &
     486              :                           "just the mixing)", &
     487        14913 :                           usage="XA 0.7", default_r_val=2._dp/3._dp)
     488        14913 :       CALL section_add_keyword(subsection, keyword)
     489        14913 :       CALL keyword_release(keyword)
     490              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     491              :                           description="scales the exchange part of the functional", &
     492        14913 :                           default_r_val=1._dp)
     493        14913 :       CALL section_add_keyword(subsection, keyword)
     494        14913 :       CALL keyword_release(keyword)
     495        14913 :       CALL section_add_subsection(section, subsection)
     496        14913 :       CALL section_release(subsection)
     497              : 
     498              :       CALL section_create(subsection, __LOCATION__, name="TPSS", &
     499              :                           description="Uses the TPSS functional. Note, that there is no LSD version available. "// &
     500              :                           "In such cases, use the LIBXC version instead.", &
     501              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     502        29826 :                           citations=[Tao2003])
     503              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     504              :                           description="Activates the functional", &
     505        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     506        14913 :       CALL section_add_keyword(subsection, keyword)
     507        14913 :       CALL keyword_release(keyword)
     508              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     509              :                           description="scales the exchange part of the functional", &
     510        14913 :                           default_r_val=1._dp)
     511        14913 :       CALL section_add_keyword(subsection, keyword)
     512        14913 :       CALL keyword_release(keyword)
     513              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     514              :                           description="scales the correlation part of the functional", &
     515        14913 :                           default_r_val=1._dp)
     516        14913 :       CALL section_add_keyword(subsection, keyword)
     517        14913 :       CALL keyword_release(keyword)
     518        14913 :       CALL section_add_subsection(section, subsection)
     519        14913 :       CALL section_release(subsection)
     520              : 
     521              :       CALL section_create(subsection, __LOCATION__, name="PBE", &
     522              :                           description="Uses the PBE functional", &
     523              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     524        59652 :                           citations=[Perdew1996, Zhang1998, Perdew2008])
     525              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     526              :                           description="activates the functional", &
     527        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     528        14913 :       CALL section_add_keyword(subsection, keyword)
     529        14913 :       CALL keyword_release(keyword)
     530              :       CALL keyword_create(keyword, __LOCATION__, name="parametrization", &
     531              :                           description="switches between the different "// &
     532              :                           "parametrizations of the functional. "// &
     533              :                           "Note: Beta parameters used have only 5 significant digits, "// &
     534              :                           "as published. For higher precision and program comparison "// &
     535              :                           "use the LIBXC library.", &
     536              :                           enum_i_vals=[xc_pbe_orig, xc_pbe_rev, xc_pbe_sol], &
     537              :                           enum_c_vals=["ORIG  ", "revPBE", "PBEsol"], &
     538              :                           enum_desc=["original PBE                        ", &
     539              :                                      "revised PBE (revPBE)                ", &
     540              :                                      "PBE for solids and surfaces (PBEsol)"], &
     541       104391 :                           default_i_val=xc_pbe_orig)
     542        14913 :       CALL section_add_keyword(subsection, keyword)
     543        14913 :       CALL keyword_release(keyword)
     544              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     545              :                           description="scales the exchange part of the functional", &
     546        14913 :                           default_r_val=1._dp)
     547        14913 :       CALL section_add_keyword(subsection, keyword)
     548        14913 :       CALL keyword_release(keyword)
     549              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     550              :                           description="scales the correlation part of the functional", &
     551        14913 :                           default_r_val=1._dp)
     552        14913 :       CALL section_add_keyword(subsection, keyword)
     553        14913 :       CALL keyword_release(keyword)
     554        14913 :       CALL section_add_subsection(section, subsection)
     555        14913 :       CALL section_release(subsection)
     556              : 
     557        14913 :       CALL create_gauxc_section(subsection)
     558        14913 :       CALL section_add_subsection(section, subsection)
     559        14913 :       CALL section_release(subsection)
     560              : 
     561        14913 :       CALL create_skala_native_section(subsection)
     562        14913 :       CALL section_add_subsection(section, subsection)
     563        14913 :       CALL section_release(subsection)
     564              : 
     565              :       CALL section_create(subsection, __LOCATION__, name="XWPBE", &
     566              :                           description="Uses the short range PBE functional", &
     567              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     568        29826 :                           citations=[Heyd2004])
     569              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     570              :                           description="activates the functional", &
     571        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     572        14913 :       CALL section_add_keyword(subsection, keyword)
     573        14913 :       CALL keyword_release(keyword)
     574              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     575              :                           description="scales the exchange part of the functional", &
     576        14913 :                           default_r_val=1._dp)
     577        14913 :       CALL section_add_keyword(subsection, keyword)
     578        14913 :       CALL keyword_release(keyword)
     579              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x0", &
     580              :                           description="scales the exchange part of the original hole PBE-functional", &
     581        14913 :                           default_r_val=0.0_dp)
     582        14913 :       CALL section_add_keyword(subsection, keyword)
     583        14913 :       CALL keyword_release(keyword)
     584              :       CALL keyword_create(keyword, __LOCATION__, name="omega", &
     585              :                           description="screening parameter", &
     586        14913 :                           default_r_val=1._dp)
     587        14913 :       CALL section_add_keyword(subsection, keyword)
     588        14913 :       CALL keyword_release(keyword)
     589        14913 :       CALL section_add_subsection(section, subsection)
     590        14913 :       CALL section_release(subsection)
     591              : 
     592              :       CALL section_create(subsection, __LOCATION__, name="BECKE97", &
     593              :                           description="Uses the Becke 97 exchange correlation functional", &
     594              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     595        44739 :                           citations=[Becke1997, Grimme2006])
     596              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     597              :                           description="activates the functional", &
     598        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     599        14913 :       CALL section_add_keyword(subsection, keyword)
     600        14913 :       CALL keyword_release(keyword)
     601              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     602              :                 description="scales the exchange part of the functional, if -1 the default for the given parametrization is used", &
     603        14913 :                           default_r_val=-1._dp)
     604        14913 :       CALL section_add_keyword(subsection, keyword)
     605        14913 :       CALL keyword_release(keyword)
     606              :       CALL keyword_create(keyword, __LOCATION__, name="scale_c", &
     607              :                           description="scales the correlation part of the functional", &
     608        14913 :                           default_r_val=1._dp)
     609        14913 :       CALL section_add_keyword(subsection, keyword)
     610        14913 :       CALL keyword_release(keyword)
     611              :       CALL keyword_create(keyword, __LOCATION__, name="parametrization", &
     612              :                           description="switches between the B97 and Grimme parametrization ", &
     613              :                           enum_i_vals=[xc_b97_orig, xc_b97_grimme, xc_b97_grimme, xc_b97_mardirossian, xc_b97_3c], &
     614              :                           enum_c_vals=["ORIG      ", "B97GRIMME ", "B97_GRIMME", "wB97X-V   ", "B97-3c    "], &
     615        89478 :                           default_i_val=xc_b97_orig)
     616        14913 :       CALL section_add_keyword(subsection, keyword)
     617        14913 :       CALL keyword_release(keyword)
     618              : 
     619        14913 :       CALL section_add_subsection(section, subsection)
     620        14913 :       CALL section_release(subsection)
     621              : 
     622              :       CALL section_create(subsection, __LOCATION__, name="BECKE_ROUSSEL", &
     623              :                           description="Becke Roussel exchange hole model. Can be used "// &
     624              :                           "as long range correction with a truncated coulomb potential", &
     625              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     626        44739 :                           citations=[BeckeRoussel1989, Proynov2007])
     627              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     628              :                           description="activates the functional", &
     629        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     630        14913 :       CALL section_add_keyword(subsection, keyword)
     631        14913 :       CALL keyword_release(keyword)
     632              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     633              :                           description="scales the exchange part of the functional", &
     634        14913 :                           default_r_val=1._dp)
     635        14913 :       CALL section_add_keyword(subsection, keyword)
     636        14913 :       CALL keyword_release(keyword)
     637              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     638              :                           description="Defines the cutoff radius for the truncation. "// &
     639              :                           "If put to zero, the standard full range potential will be used", &
     640        14913 :                           usage="CUTOFF_RADIUS 2.0", default_r_val=0.0_dp)
     641        14913 :       CALL section_add_keyword(subsection, keyword)
     642        14913 :       CALL keyword_release(keyword)
     643              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     644              :                           description="Parameter in the exchange hole. "// &
     645              :                           "Usually this is put to 1.0 or 0.8", &
     646        14913 :                           usage="GAMMA 0.8", default_r_val=1.0_dp)
     647        14913 :       CALL section_add_keyword(subsection, keyword)
     648        14913 :       CALL keyword_release(keyword)
     649        14913 :       CALL section_add_subsection(section, subsection)
     650        14913 :       CALL section_release(subsection)
     651              : 
     652              :       CALL section_create(subsection, __LOCATION__, name="LDA_HOLE_T_C_LR", &
     653              :                           description="LDA exchange hole model in truncated coulomb potential", &
     654        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     655              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     656              :                           description="activates the functional", &
     657        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     658        14913 :       CALL section_add_keyword(subsection, keyword)
     659        14913 :       CALL keyword_release(keyword)
     660              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     661              :                           description="scales the exchange part of the functional", &
     662        14913 :                           default_r_val=1._dp)
     663        14913 :       CALL section_add_keyword(subsection, keyword)
     664        14913 :       CALL keyword_release(keyword)
     665              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     666              :                           description="Defines cutoff for lower integration boundary", &
     667        14913 :                           default_r_val=0.0_dp, unit_str="angstrom")
     668        14913 :       CALL section_add_keyword(subsection, keyword)
     669        14913 :       CALL keyword_release(keyword)
     670        14913 :       CALL section_add_subsection(section, subsection)
     671        14913 :       CALL section_release(subsection)
     672              : 
     673              :       CALL section_create(subsection, __LOCATION__, name="PBE_HOLE_T_C_LR", &
     674              :                           description="PBE exchange hole model in trucanted coulomb potential", &
     675        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     676              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     677              :                           description="activates the functional", &
     678        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     679        14913 :       CALL section_add_keyword(subsection, keyword)
     680        14913 :       CALL keyword_release(keyword)
     681              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     682              :                           description="scales the exchange part of the functional", &
     683        14913 :                           default_r_val=1._dp)
     684        14913 :       CALL section_add_keyword(subsection, keyword)
     685        14913 :       CALL keyword_release(keyword)
     686              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     687              :                           description="Defines cutoff for lower integration boundary", &
     688        14913 :                           default_r_val=1.0_dp, unit_str="angstrom")
     689        14913 :       CALL section_add_keyword(subsection, keyword)
     690        14913 :       CALL keyword_release(keyword)
     691        14913 :       CALL section_add_subsection(section, subsection)
     692        14913 :       CALL section_release(subsection)
     693              : 
     694              :       CALL section_create(subsection, __LOCATION__, name="GV09", &
     695              :                           description="Combination of three different exchange hole models", &
     696        14913 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     697              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     698              :                           description="activates the functional", &
     699        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     700        14913 :       CALL section_add_keyword(subsection, keyword)
     701        14913 :       CALL keyword_release(keyword)
     702              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     703              :                           description="scales the exchange part of the functional", &
     704        14913 :                           default_r_val=1._dp)
     705        14913 :       CALL section_add_keyword(subsection, keyword)
     706        14913 :       CALL keyword_release(keyword)
     707              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF_RADIUS", &
     708              :                           description="Defines cutoff for lower integration boundary", &
     709        14913 :                           default_r_val=0.0_dp, unit_str="angstrom")
     710        14913 :       CALL section_add_keyword(subsection, keyword)
     711        14913 :       CALL keyword_release(keyword)
     712              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     713              :                           description="Parameter for Becke Roussel hole", &
     714        14913 :                           default_r_val=1.0_dp)
     715        14913 :       CALL section_add_keyword(subsection, keyword)
     716        14913 :       CALL keyword_release(keyword)
     717        14913 :       CALL section_add_subsection(section, subsection)
     718        14913 :       CALL section_release(subsection)
     719              : 
     720              :       CALL section_create(subsection, __LOCATION__, name="BEEF", & !rk: BEEF Exchange
     721              :                           description="Uses the BEEFvdW exchange functional", &
     722              :                           n_keywords=0, n_subsections=0, repeats=.FALSE., &
     723        29826 :                           citations=[Wellendorff2012])
     724              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     725              :                           description="activates the functional", &
     726        14913 :                           lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
     727        14913 :       CALL section_add_keyword(subsection, keyword)
     728        14913 :       CALL keyword_release(keyword)
     729              :       CALL keyword_create(keyword, __LOCATION__, name="scale_x", &
     730              :                           description="scales the exchange part of the functional", &
     731        14913 :                           default_r_val=1._dp)
     732        14913 :       CALL section_add_keyword(subsection, keyword)
     733        14913 :       CALL keyword_release(keyword)
     734        14913 :       CALL section_add_subsection(section, subsection)
     735        14913 :       CALL section_release(subsection)
     736              : 
     737        14913 :    END SUBROUTINE create_xc_fun_section
     738              : 
     739              : ! **************************************************************************************************
     740              : !> \brief creates the structure of the section needed to select an xc potential
     741              : !> \param section the section that will be created
     742              : !> \author thomas chassaing
     743              : ! **************************************************************************************************
     744        11932 :    SUBROUTINE create_xc_potential_section(section)
     745              :       TYPE(section_type), POINTER                        :: section
     746              : 
     747              :       TYPE(keyword_type), POINTER                        :: keyword
     748              :       TYPE(section_type), POINTER                        :: subsection
     749              : 
     750        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
     751              :       CALL section_create(section, __LOCATION__, name="xc_potential", &
     752              :                           description="The xc potential to use (CAREFUL: xc potential here refers "// &
     753              :                           "to potentials that are not derived from an xc functional, but rather are "// &
     754              :                           "modelled directly. Therefore there is no consistent xc energy available. "// &
     755              :                           "To still get an energy expression, see ENERGY below", &
     756        11932 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     757              : 
     758        11932 :       NULLIFY (subsection, keyword)
     759              :       CALL section_create(subsection, __LOCATION__, name="SAOP", &
     760              :                           description="Uses the SAOP potential", &
     761        11932 :                           n_keywords=3, n_subsections=0, repeats=.TRUE.)
     762              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     763              :                           description="Value of the alpha parameter (default = 1.19).", &
     764        11932 :                           usage="ALPHA 1.19", default_r_val=1.19_dp)
     765        11932 :       CALL section_add_keyword(subsection, keyword)
     766        11932 :       CALL keyword_release(keyword)
     767              :       CALL keyword_create(keyword, __LOCATION__, name="BETA", &
     768              :                           description="Value of the beta parameter (default = 0.01).", &
     769        11932 :                           usage="BETA 0.01", default_r_val=0.01_dp)
     770        11932 :       CALL section_add_keyword(subsection, keyword)
     771        11932 :       CALL keyword_release(keyword)
     772              :       CALL keyword_create(keyword, __LOCATION__, name="K_RHO", &
     773              :                           description="Value of the K_rho parameter (default = 0.42).", &
     774        11932 :                           usage="K_RHO 0.42", default_r_val=0.42_dp)
     775        11932 :       CALL section_add_keyword(subsection, keyword)
     776        11932 :       CALL keyword_release(keyword)
     777        11932 :       CALL section_add_subsection(section, subsection)
     778        11932 :       CALL section_release(subsection)
     779              : 
     780              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
     781              :                           description="How to determine the total energy.", &
     782              :                           usage="ENERGY [NONE,XC_FUNCTIONAL,SUM_EIGENVALUES", &
     783              :                           enum_c_vals=s2a("NONE", "XC_FUNCTIONAL", "FUNCTIONAL", "SUM_EIGENVALUES", "SOE"), &
     784              :                           enum_i_vals=[xc_pot_energy_none, &
     785              :                                        xc_pot_energy_xc_functional, &
     786              :                                        xc_pot_energy_xc_functional, &
     787              :                                        xc_pot_energy_sum_eigenvalues, &
     788              :                                        xc_pot_energy_sum_eigenvalues], &
     789        11932 :                           default_i_val=xc_pot_energy_none)
     790        11932 :       CALL section_add_keyword(section, keyword)
     791        11932 :       CALL keyword_release(keyword)
     792              : 
     793        11932 :    END SUBROUTINE create_xc_potential_section
     794              : 
     795              : ! **************************************************************************************************
     796              : !> \brief creates the structure of the section needed to select an xc kernel
     797              : !> \param section the section that will be created
     798              : !> \author JGH
     799              : ! **************************************************************************************************
     800        11932 :    SUBROUTINE create_xc_kernel_section(section)
     801              :       TYPE(section_type), POINTER                        :: section
     802              : 
     803              :       TYPE(keyword_type), POINTER                        :: keyword
     804              : 
     805        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
     806              :       CALL section_create(section, __LOCATION__, name="XC_KERNEL", &
     807              :                           description="The xc kernel to use (CAREFUL: xc kernel here refers "// &
     808              :                           "to kernels that are not derived from an xc functional, but rather are "// &
     809              :                           "modelled directly. This kernel will be used in a TDDFPT calculation. "// &
     810              :                           "Cannot be combined with XC_FUNCTIONAL or XC_POTENTIAL.", &
     811        11932 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     812              : 
     813        11932 :       NULLIFY (keyword)
     814              :       CALL keyword_create( &
     815              :          keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     816              :          description="Selection of kernel functionals.", &
     817              :          usage="&XC_KERNEL LDAfxc", &
     818              :          enum_c_vals=s2a("PADEfxc", "LDAfxc", "GGAfxc", "NONE"), &
     819              :          enum_i_vals=[fxc_funct_pade, fxc_funct_lda, fxc_funct_gga, fxc_none], &
     820              :          enum_desc=s2a("Fxc based on LDA PADE approximation", &
     821              :                        "Fxc based on LDA functionals", &
     822              :                        "Fxc model from fit to PBE functional", &
     823              :                        "NONE"), &
     824              :          default_i_val=fxc_none, &
     825        11932 :          lone_keyword_i_val=fxc_none)
     826        11932 :       CALL section_add_keyword(section, keyword)
     827        11932 :       CALL keyword_release(keyword)
     828              : 
     829              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER", &
     830              :                           description="List of parameters specific to the kernel function", &
     831              :                           usage="PARAMETER <REAL> .. <REAL>", &
     832        11932 :                           type_of_var=real_t, n_var=-1)
     833        11932 :       CALL section_add_keyword(section, keyword)
     834        11932 :       CALL keyword_release(keyword)
     835              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     836              :                           description="B97 GAMMA parameters [gx, gab, gaa]", &
     837              :                           usage="GAMMA <REAL> <REAL> <REAL>", &
     838              :                           default_r_vals=[0.004_dp, 0.006_dp, 0.2_dp], &
     839        11932 :                           type_of_var=real_t, n_var=3)
     840        11932 :       CALL section_add_keyword(section, keyword)
     841        11932 :       CALL keyword_release(keyword)
     842              :       CALL keyword_create(keyword, __LOCATION__, name="C_XAA", &
     843              :                           description="B97 C parameters for exchange", &
     844              :                           usage="C_XAA <REAL> <REAL> <REAL>", &
     845              :                           default_r_vals=[1.0_dp, 0.63_dp, 0.94_dp], &
     846        11932 :                           type_of_var=real_t, n_var=3)
     847        11932 :       CALL section_add_keyword(section, keyword)
     848        11932 :       CALL keyword_release(keyword)
     849              :       CALL keyword_create(keyword, __LOCATION__, name="C_CAB", &
     850              :                           description="B97 C parameters for same spin correlation.", &
     851              :                           usage="C_CAB <REAL> <REAL> <REAL>", &
     852              :                           default_r_vals=[1.0_dp, 0.75_dp, -4.60_dp], &
     853        11932 :                           type_of_var=real_t, n_var=3)
     854        11932 :       CALL section_add_keyword(section, keyword)
     855        11932 :       CALL keyword_release(keyword)
     856              :       CALL keyword_create(keyword, __LOCATION__, name="C_CAA", &
     857              :                           description="B97 C parameters for opposite spin correlation.", &
     858              :                           usage="C_CAA <REAL> <REAL> <REAL>", &
     859              :                           default_r_vals=[0.17_dp, 2.35_dp, -2.55_dp], &
     860        11932 :                           type_of_var=real_t, n_var=3)
     861        11932 :       CALL section_add_keyword(section, keyword)
     862        11932 :       CALL keyword_release(keyword)
     863              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", &
     864              :                           description="Scaling parameter for exchange kernel.", &
     865        11932 :                           usage="SCALE_X 0.2", default_r_val=1.0_dp)
     866        11932 :       CALL section_add_keyword(section, keyword)
     867        11932 :       CALL keyword_release(keyword)
     868              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_C", &
     869              :                           description="Scaling parameter for correlation kernel.", &
     870        11932 :                           usage="SCALE_C 0.2", default_r_val=1.0_dp)
     871        11932 :       CALL section_add_keyword(section, keyword)
     872        11932 :       CALL keyword_release(keyword)
     873              : 
     874        11932 :    END SUBROUTINE create_xc_kernel_section
     875              : 
     876              : ! **************************************************************************************************
     877              : !> \brief creates the structure of the section needed to select an hfx kernel
     878              : !> \param section the section that will be created
     879              : !> \author JGH
     880              : ! **************************************************************************************************
     881        11932 :    SUBROUTINE create_hfx_kernel_section(section)
     882              :       TYPE(section_type), POINTER                        :: section
     883              : 
     884              :       TYPE(keyword_type), POINTER                        :: keyword
     885              :       TYPE(section_type), POINTER                        :: subsection
     886              : 
     887        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
     888              :       CALL section_create(section, __LOCATION__, name="HFX_KERNEL", &
     889              :                           description="The hfx kernel to use. Cannot be combined with HF section.", &
     890        11932 :                           n_keywords=1, n_subsections=2, repeats=.FALSE.)
     891              : 
     892        11932 :       NULLIFY (subsection, keyword)
     893              :       CALL keyword_create(keyword, __LOCATION__, name="DO_HFXSR", &
     894              :                           description="Switch to use the HFXSR (short range) kernel.", &
     895              :                           usage="DO_HFXSR T/F", default_l_val=.FALSE., &
     896        11932 :                           lone_keyword_l_val=.TRUE.)
     897        11932 :       CALL section_add_keyword(section, keyword)
     898        11932 :       CALL keyword_release(keyword)
     899        11932 :       NULLIFY (subsection, keyword)
     900              :       CALL keyword_create(keyword, __LOCATION__, name="HFXSR_PRIMBAS", &
     901              :                           description="Default number of primitives in ADMM basis in HFXSR. "// &
     902              :                           "0 indicates the use of a contracted minimal basis. ", &
     903        11932 :                           usage="HFXSR_PRIMBAS 3", default_i_val=0)
     904        11932 :       CALL section_add_keyword(section, keyword)
     905        11932 :       CALL keyword_release(keyword)
     906              : 
     907        11932 :       CALL create_hfx_section(subsection)
     908        11932 :       CALL section_add_subsection(section, subsection)
     909        11932 :       CALL section_release(subsection)
     910              : 
     911              :       CALL section_create(subsection, __LOCATION__, name="HFXLR", &
     912              :                           description="Uses the HFXLR (long range) kernel", &
     913        11932 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     914              :       CALL keyword_create(keyword, __LOCATION__, name="RCUT", &
     915              :                           description="Value of lower range cutoff of interaction [Bohr]", &
     916        11932 :                           usage="RCUT 5.00", default_r_val=6.00_dp, unit_str="bohr")
     917        11932 :       CALL section_add_keyword(subsection, keyword)
     918        11932 :       CALL keyword_release(keyword)
     919              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
     920              :                           description="Scaling parameter for HFX kernel.", &
     921        11932 :                           usage="SCALE 0.25", default_r_val=1.00_dp)
     922        11932 :       CALL section_add_keyword(subsection, keyword)
     923        11932 :       CALL keyword_release(keyword)
     924        11932 :       CALL section_add_subsection(section, subsection)
     925        11932 :       CALL section_release(subsection)
     926              : 
     927        11932 :    END SUBROUTINE create_hfx_kernel_section
     928              : ! **************************************************************************************************
     929              : !> \brief creates the structure of the section needed for vdW potentials
     930              : !> \param section the section that will be created
     931              : !> \author jgh
     932              : ! **************************************************************************************************
     933        11932 :    SUBROUTINE create_vdw_potential_section(section)
     934              :       TYPE(section_type), POINTER                        :: section
     935              : 
     936              :       TYPE(keyword_type), POINTER                        :: keyword
     937              :       TYPE(section_type), POINTER                        :: newsection, print_key, subsection
     938              : 
     939        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
     940              :       CALL section_create(section, __LOCATION__, name="vdw_potential", &
     941              :                           description="This section combines all possible additional dispersion "// &
     942              :                           "corrections to the normal XC functionals. This can be more functionals "// &
     943              :                           "or simple empirical pair potentials. ", &
     944              :                           citations=[grimme2006, Tran2013], &
     945        35796 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     946              : 
     947        11932 :       NULLIFY (subsection, keyword)
     948              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
     949              :                           variants=s2a("DISPERSION_FUNCTIONAL"), &
     950              :                           description="Type of dispersion/vdW functional or potential to use", &
     951              :                           usage="POTENTIAL_TYPE (NONE|PAIR_POTENTIAL|NON_LOCAL)", &
     952              :                           enum_c_vals=s2a("NONE", "PAIR_POTENTIAL", "NON_LOCAL"), &
     953              :                           enum_i_vals=[xc_vdw_fun_none, xc_vdw_fun_pairpot, xc_vdw_fun_nonloc], &
     954              :                           enum_desc=s2a("No dispersion/van der Waals functional.", &
     955              :                                         "Pair potential van der Waals density functional, "// &
     956              :                                         "including Grimme's empirical DFT-D methods.", &
     957              :                                         "Nonlocal van der Waals density functional; more "// &
     958              :                                         "rigorous in principle, but significantly more "// &
     959              :                                         "time-consuming."), &
     960        11932 :                           default_i_val=xc_vdw_fun_none)
     961        11932 :       CALL section_add_keyword(section, keyword)
     962        11932 :       CALL keyword_release(keyword)
     963              : 
     964              :       CALL section_create(subsection, __LOCATION__, name="PAIR_POTENTIAL", &
     965              :                           description="Information on the pair potential to calculate dispersion", &
     966        11932 :                           n_keywords=5, n_subsections=0, repeats=.TRUE.)
     967              :       CALL keyword_create(keyword, __LOCATION__, name="R_CUTOFF", &
     968              :                           variants=s2a("D3_CUTOFF", "D4_3B_CUTOFF"), &
     969              :                           description="Range of potential. The cutoff will be 2 times this value. "// &
     970              :                           "In the case of D4 it will be used for the 3-body term", &
     971              :                           usage="R_CUTOFF 20.0", default_r_val=20.0_dp, &
     972        11932 :                           unit_str="angstrom")
     973        11932 :       CALL section_add_keyword(subsection, keyword)
     974        11932 :       CALL keyword_release(keyword)
     975              :       CALL keyword_create(keyword, __LOCATION__, name="D4_CUTOFF", &
     976              :                           description="Range of potential. The cutoff will be 2 times this value. "// &
     977              :                           "Only used for the 2-body term of D4", &
     978              :                           usage="D4_CUTOFF 30.0", default_r_val=20.0_dp, &
     979        11932 :                           unit_str="angstrom")
     980        11932 :       CALL section_add_keyword(subsection, keyword)
     981        11932 :       CALL keyword_release(keyword)
     982              :       CALL keyword_create(keyword, __LOCATION__, name="D4_CUTOFF_WIDTH", &
     983              :                           variants=["D4_2B_CUTOFF_WIDTH"], &
     984              :                           description="Width of the smooth cutoff for the 2-body term of D4. "// &
     985              :                           "A value of zero disables smoothing.", &
     986              :                           usage="D4_CUTOFF_WIDTH 0.05", default_r_val=0.05_dp, &
     987        23864 :                           unit_str="bohr")
     988        11932 :       CALL section_add_keyword(subsection, keyword)
     989        11932 :       CALL keyword_release(keyword)
     990              :       CALL keyword_create(keyword, __LOCATION__, name="D4_3B_CUTOFF_WIDTH", &
     991              :                           description="Width of the smooth cutoff for the 3-body term of D4. "// &
     992              :                           "A value of zero disables smoothing.", &
     993              :                           usage="D4_3B_CUTOFF_WIDTH 0.0", default_r_val=0.0_dp, &
     994        11932 :                           unit_str="bohr")
     995        11932 :       CALL section_add_keyword(subsection, keyword)
     996        11932 :       CALL keyword_release(keyword)
     997              :       CALL keyword_create(keyword, __LOCATION__, name="D4_CN_CUTOFF", &
     998              :                           description="Coordination number cutoff for D4", &
     999              :                           usage="D4_CN_CUTOFF 30.0", default_r_val=-1.0_dp, &
    1000        11932 :                           unit_str="angstrom")
    1001        11932 :       CALL section_add_keyword(subsection, keyword)
    1002        11932 :       CALL keyword_release(keyword)
    1003              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
    1004              :                           description="Type of potential", &
    1005              :                           citations=[grimme2006, Chai2008, grimme2010, grimme2011, Caldeweyher2020], &
    1006              :                           usage="TYPE (DFTD2|DFTD2(CHG)|DFTD3|DFTD3(BJ)|DFTD4)", &
    1007              :                           enum_c_vals=s2a("DFTD2", "DFTD2(CHG)", "DFTD3", "DFTD3(BJ)", "DFTD4"), &
    1008              :                           enum_i_vals=[vdw_pairpot_dftd2, vdw_pairpot_dftd2chg, vdw_pairpot_dftd3, &
    1009              :                                        vdw_pairpot_dftd3bj, vdw_pairpot_dftd4], &
    1010              :                           enum_desc=s2a("Grimme D2 method", &
    1011              :                                         "D2 with Chai-Head-Gordon damping (wB97X-D, a=6, alpha=12)", &
    1012              :                                         "Grimme D3 method (zero damping)", &
    1013              :                                         "Grimme D3 method (Becke-Johnson damping)", &
    1014              :                                         "Grimme D4 method"), &
    1015        71592 :                           default_i_val=vdw_pairpot_dftd3bj)
    1016        11932 :       CALL section_add_keyword(subsection, keyword)
    1017        11932 :       CALL keyword_release(keyword)
    1018              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_FILE_NAME", &
    1019              :                           description="Name of the parameter file, may include a path (not used for D4)", &
    1020              :                           usage="PARAMETER_FILE_NAME <FILENAME>", &
    1021        11932 :                           default_lc_val="dftd3.dat")
    1022        11932 :       CALL section_add_keyword(subsection, keyword)
    1023        11932 :       CALL keyword_release(keyword)
    1024              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_FUNCTIONAL", &
    1025              :                           description="Use parameters for this specific density functional. "// &
    1026              :                           "For DFTD2(CHG), use WB97X-D. "// &
    1027              :                           "For available DFT-D4 functionals and parameters see: "// &
    1028              :                           "<https://github.com/dftd4/dftd4/blob/main/src/dftd4/param.f90>. "// &
    1029              :                           "For available D3 and D3(BJ) parameters see: "// &
    1030              :                           "<https://www.chemie.uni-bonn.de/grimme/de/software/dft-d3>. "// &
    1031              :                           "For Skala with D3(BJ), SKALA selects the B3LYP D3(BJ) parameters.", &
    1032              :                           usage="REFERENCE_FUNCTIONAL <functional>", &
    1033        11932 :                           type_of_var=char_t)
    1034        11932 :       CALL section_add_keyword(subsection, keyword)
    1035        11932 :       CALL keyword_release(keyword)
    1036              :       CALL keyword_create(keyword, __LOCATION__, name="D4_REFERENCE_CODE", &
    1037              :                           description="Calculate D4 correction using external library entirely. "// &
    1038              :                           "Switch off to use native reimplementation in CP2K. Note that the "// &
    1039              :                           "external library is always needed no matter if this option is "// &
    1040              :                           "triggered or not.", &
    1041              :                           usage="D4_REFERENCE_CODE", default_l_val=.TRUE., &
    1042        11932 :                           lone_keyword_l_val=.TRUE.)
    1043        11932 :       CALL section_add_keyword(subsection, keyword)
    1044        11932 :       CALL keyword_release(keyword)
    1045              :       CALL keyword_create(keyword, __LOCATION__, name="D4_DEBUG", &
    1046              :                           description="Debug output for D4 method using reference code; "// &
    1047              :                           "requires D4_REFERENCE_CODE F to work and VERBOSE_OUTPUT T to "// &
    1048              :                           "show the debugging result.", &
    1049              :                           usage="D4_DEBUG", default_l_val=.FALSE., &
    1050        11932 :                           lone_keyword_l_val=.TRUE.)
    1051        11932 :       CALL section_add_keyword(subsection, keyword)
    1052        11932 :       CALL keyword_release(keyword)
    1053              :       CALL keyword_create(keyword, __LOCATION__, name="D3_REFERENCE_CODE", &
    1054              :                           description="Use D3 damping parameters from s-dftd3 library instead of built-in values. "// &
    1055              :                           "Requires s-dftd3 library to be compiled in.", &
    1056              :                           usage="D3_REFERENCE_CODE", default_l_val=.FALSE., &
    1057        11932 :                           lone_keyword_l_val=.TRUE.)
    1058        11932 :       CALL section_add_keyword(subsection, keyword)
    1059        11932 :       CALL keyword_release(keyword)
    1060              :       CALL keyword_create(keyword, __LOCATION__, name="D2_SCALING", &
    1061              :                           variants=["SCALING"], &
    1062              :                           description="XC Functional dependent scaling parameter. If omitted, CP2K attempts"// &
    1063              :                           " to guess the xc functional that is in use and sets the associated scaling parameter.", &
    1064        23864 :                           usage="SCALING 0.2", default_r_val=0._dp)
    1065        11932 :       CALL section_add_keyword(subsection, keyword)
    1066        11932 :       CALL keyword_release(keyword)
    1067              :       CALL keyword_create(keyword, __LOCATION__, name="D2_EXP_PRE", &
    1068              :                           variants=["EXP_PRE"], &
    1069              :                           description="Prefactor in exponential damping factor (DFT-D2 potential). "// &
    1070              :                           "Not applicable to DFTD2(CHG).", &
    1071        23864 :                           usage="D2_EXP_PRE 20.", default_r_val=20._dp)
    1072        11932 :       CALL section_add_keyword(subsection, keyword)
    1073        11932 :       CALL keyword_release(keyword)
    1074              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CN", &
    1075              :                           description="Cutoff value for coordination number function (DFT-D3 method)", &
    1076        11932 :                           usage="EPS_CN 1.e-6_dp", default_r_val=1.e-6_dp)
    1077        11932 :       CALL section_add_keyword(subsection, keyword)
    1078        11932 :       CALL keyword_release(keyword)
    1079              :       CALL keyword_create(keyword, __LOCATION__, name="D3_SCALING", &
    1080              :                           description="XC Functional dependent scaling parameters (s6,sr6,s8) for the DFT-D3 method."// &
    1081              :                           " If omitted, CP2K attempts"// &
    1082              :                           " to guess the xc functional from REFERENCE_FUNCTIONAL and sets the associated scaling parameter.", &
    1083              :                           usage="D3_SCALING 1.0 1.0 1.0", n_var=3, &
    1084        11932 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
    1085        11932 :       CALL section_add_keyword(subsection, keyword)
    1086        11932 :       CALL keyword_release(keyword)
    1087              :       CALL keyword_create(keyword, __LOCATION__, name="D3BJ_SCALING", &
    1088              :                           description="XC Functional dependent scaling parameters (s6,a1,s8,a2) for the DFT-D3(BJ) method."// &
    1089              :                           " If omitted, CP2K attempts"// &
    1090              :                           " to guess the xc functional from REFERENCE_FUNCTIONAL and sets the associated scaling parameter.", &
    1091              :                           usage="D3BJ_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
    1092        11932 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
    1093        11932 :       CALL section_add_keyword(subsection, keyword)
    1094        11932 :       CALL keyword_release(keyword)
    1095              :       CALL keyword_create(keyword, __LOCATION__, name="D4_SCALING", &
    1096              :                           description="XC Functional dependent scaling parameters (s6,a1,s8,a2) for the DFT-D4 method."// &
    1097              :                           " If omitted, CP2K attempts"// &
    1098              :                           " to guess the xc functional from REFERENCE_FUNCTIONAL and sets the associated scaling parameter.", &
    1099              :                           usage="D4_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
    1100        11932 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
    1101        11932 :       CALL section_add_keyword(subsection, keyword)
    1102        11932 :       CALL keyword_release(keyword)
    1103              :       CALL keyword_create(keyword, __LOCATION__, name="CALCULATE_C9_TERM", &
    1104              :                           description="Calculate C9 terms in DFT-D3 model", &
    1105              :                           usage="CALCULATE_C9_TERM", default_l_val=.FALSE., &
    1106        11932 :                           lone_keyword_l_val=.TRUE.)
    1107        11932 :       CALL section_add_keyword(subsection, keyword)
    1108        11932 :       CALL keyword_release(keyword)
    1109              :       CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_C9_TERM", &
    1110              :                           description="Calculate C9 terms in DFT-D3 model using reference coordination numbers", &
    1111              :                           usage="REFERENCE_C9_TERM", default_l_val=.FALSE., &
    1112        11932 :                           lone_keyword_l_val=.TRUE.)
    1113        11932 :       CALL section_add_keyword(subsection, keyword)
    1114        11932 :       CALL keyword_release(keyword)
    1115              :       CALL keyword_create(keyword, __LOCATION__, name="FACTOR_S9_TERM", &
    1116              :                           description="S9 prefactor of the many-body term in the DFT-D4 method.", &
    1117        11932 :                           usage="FACTOR_S9_TERM 1.e-0", default_r_val=1.00_dp)
    1118        11932 :       CALL section_add_keyword(subsection, keyword)
    1119        11932 :       CALL keyword_release(keyword)
    1120              :       CALL keyword_create(keyword, __LOCATION__, name="LONG_RANGE_CORRECTION", &
    1121              :                           description="Calculate a long range correction to the DFT-D3 model."// &
    1122              :                           " WARNING: Use with care! Only for isotropic dense systems.", &
    1123              :                           usage="LONG_RANGE_CORRECTION", default_l_val=.FALSE., &
    1124        11932 :                           lone_keyword_l_val=.TRUE.)
    1125        11932 :       CALL section_add_keyword(subsection, keyword)
    1126        11932 :       CALL keyword_release(keyword)
    1127              :       CALL keyword_create(keyword, __LOCATION__, name="SHORT_RANGE_CORRECTION", &
    1128              :                           description="Calculate a short-range bond correction to the DFT-D3 model", &
    1129              :                           usage="SHORT_RANGE_CORRECTION", default_l_val=.FALSE., &
    1130        11932 :                           lone_keyword_l_val=.TRUE.)
    1131        11932 :       CALL section_add_keyword(subsection, keyword)
    1132        11932 :       CALL keyword_release(keyword)
    1133              :       CALL keyword_create(keyword, __LOCATION__, name="SHORT_RANGE_CORRECTION_PARAMETERS", &
    1134              :                           description="Parameters for the short-range bond correction to the DFT-D3 model. "// &
    1135              :                           "s*(za*zb)^t1*EXP(-g*dr*r0ab^t2), parameters: s, g, t1, t2 "// &
    1136              :                           "Defaults: s=0.08, g=10.0, t1=0.5, t2=-1.0 ", &
    1137              :                           usage="SHORT_RANGE_CORRECTION_PARAMETERS", default_r_vals=[0.08_dp, 10.0_dp, 0.5_dp, -1.0_dp], &
    1138        11932 :                           n_var=4, type_of_var=real_t)
    1139        11932 :       CALL section_add_keyword(subsection, keyword)
    1140        11932 :       CALL keyword_release(keyword)
    1141              :       ! KG molecular corrections
    1142              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE_CORRECTION", &
    1143              :                           description="Calculate a intermolecular correction to the DFT-D3 model", &
    1144              :                           usage="MOLECULE_CORRECTION", default_l_val=.FALSE., &
    1145        11932 :                           lone_keyword_l_val=.TRUE.)
    1146        11932 :       CALL section_add_keyword(subsection, keyword)
    1147        11932 :       CALL keyword_release(keyword)
    1148              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULE_CORRECTION_C8", &
    1149              :                           description="Calculate a intermolecular correction to the C8 term in the DFT-D3 model", &
    1150        11932 :                           usage="MOLECULE_CORRECTION_C8  1.0 ", default_r_val=0.0_dp)
    1151        11932 :       CALL section_add_keyword(subsection, keyword)
    1152        11932 :       CALL keyword_release(keyword)
    1153              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE_OUTPUT", &
    1154              :                           description="Extensive output for the DFT-D2 and DFT-D3 models."// &
    1155              :                           " Needs PRINT_DFTD section to be specified.", &
    1156              :                           usage="VERBOSE_OUTPUT", default_l_val=.FALSE., &
    1157        11932 :                           lone_keyword_l_val=.TRUE.)
    1158        11932 :       CALL section_add_keyword(subsection, keyword)
    1159        11932 :       CALL keyword_release(keyword)
    1160              : 
    1161              :       ! Set coordination numbers by atom numbers
    1162              :       CALL keyword_create(keyword, __LOCATION__, name="D3_EXCLUDE_KIND", &
    1163              :                           description="Specifies the atomic kinds excluded in the DFT-D3 calculation.", &
    1164              :                           usage="D3_EXCLUDE_KIND kind1 kind2 ... ", repeats=.FALSE., &
    1165        11932 :                           n_var=-1, type_of_var=integer_t)
    1166        11932 :       CALL section_add_keyword(subsection, keyword)
    1167        11932 :       CALL keyword_release(keyword)
    1168              : 
    1169              :       ! Ignore selected pair interactins
    1170              :       CALL keyword_create(keyword, __LOCATION__, name="D3_EXCLUDE_KIND_PAIR", &
    1171              :                           description="Specifies the atomic kinds for interactions excluded from the DFT-D3 calculation.", &
    1172              :                           usage="D3_EXCLUDE_KIND_PAIR kind1 kind2 ", repeats=.TRUE., &
    1173        11932 :                           n_var=2, type_of_var=integer_t)
    1174        11932 :       CALL section_add_keyword(subsection, keyword)
    1175        11932 :       CALL keyword_release(keyword)
    1176              : 
    1177              :       ! Set coordination numbers by atom kinds
    1178              :       CALL keyword_create(keyword, __LOCATION__, name="KIND_COORDINATION_NUMBERS", &
    1179              :                           description="Specifies the coordination number for a kind for the C9 term in DFT-D3.", &
    1180              :                           usage="KIND_COORDINATION_NUMBERS CN kind ", repeats=.TRUE., &
    1181        11932 :                           n_var=-1, type_of_var=char_t)
    1182        11932 :       CALL section_add_keyword(subsection, keyword)
    1183        11932 :       CALL keyword_release(keyword)
    1184              :       ! Set coordination numbers by atom numbers
    1185              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_COORDINATION_NUMBERS", &
    1186              :                           description="Specifies the coordination number of a set of atoms for the C9 term in DFT-D3.", &
    1187              :                           usage="ATOM_COORDINATION_NUMBERS CN atom1 atom2 ... ", repeats=.TRUE., &
    1188        11932 :                           n_var=-1, type_of_var=char_t)
    1189        11932 :       CALL section_add_keyword(subsection, keyword)
    1190        11932 :       CALL keyword_release(keyword)
    1191              : 
    1192              :       ! parameter specification atom by atom
    1193              :       CALL keyword_create(keyword, __LOCATION__, name="ATOMPARM", &
    1194              :                           description="Specifies parameters for atom types (in atomic units). If "// &
    1195              :                           "not provided default parameters are used (DFT-D2).", &
    1196              :                           usage="ATOMPARM <ELEMENT> <C6_parameter> <vdw_radii>", &
    1197        11932 :                           repeats=.TRUE., n_var=-1, type_of_var=char_t)
    1198        11932 :       CALL section_add_keyword(subsection, keyword)
    1199        11932 :       CALL keyword_release(keyword)
    1200              : 
    1201        11932 :       NULLIFY (print_key)
    1202              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT_DFTD", &
    1203              :                                        description="Controls the printing of some info about DFTD contributions", &
    1204        11932 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="")
    1205        11932 :       CALL section_add_subsection(subsection, print_key)
    1206        11932 :       CALL section_release(print_key)
    1207              : 
    1208        11932 :       NULLIFY (newsection)
    1209        11932 :       CALL create_eeq_control_section(newsection)
    1210        11932 :       CALL section_add_subsection(subsection, newsection)
    1211        11932 :       CALL section_release(newsection)
    1212              : 
    1213        11932 :       CALL section_add_subsection(section, subsection)
    1214        11932 :       CALL section_release(subsection)
    1215              : 
    1216              :       ! nonlocal section
    1217        11932 :       NULLIFY (subsection, keyword)
    1218              :       CALL section_create(subsection, __LOCATION__, name="NON_LOCAL", &
    1219              :                           description="Information on the non local part of dispersion functionals. "// &
    1220              :                           "Correct functionals require a corresponding setting of XC_FUNCTIONAL.", &
    1221        11932 :                           n_keywords=0, n_subsections=0, repeats=.TRUE.)
    1222              : 
    1223              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
    1224              :                           description="Type of functional (the corresponding kernel data file should be selected). "// &
    1225              :                           "Allows for common forms such as vdW-DF, vdW-DF2, optB88-vdW, rVV10.", &
    1226              :                           usage="TYPE DRSLL", &
    1227              :                           enum_c_vals=s2a("DRSLL", "LMKLL", "RVV10"), &
    1228              :                           enum_i_vals=[vdw_nl_DRSLL, vdw_nl_LMKLL, vdw_nl_RVV10], &
    1229              :                           enum_desc=s2a("Dion-Rydberg-Schroeder-Langreth-Lundqvist nonlocal van der Waals density functional", &
    1230              :                                         "Lee-Murray-Kong-Lundqvist-Langreth nonlocal van der Waals density functional", &
    1231              :                                         "Revised Vydrov-van Voorhis nonlocal van der Waals density functional"), &
    1232              :                           citations=[Tran2013], &
    1233        23864 :                           default_i_val=vdw_nl_DRSLL)
    1234        11932 :       CALL section_add_keyword(subsection, keyword)
    1235        11932 :       CALL keyword_release(keyword)
    1236              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE_OUTPUT", &
    1237              :                           description="Extensive output for non local functionals", &
    1238              :                           usage="VERBOSE_OUTPUT", default_l_val=.FALSE., &
    1239        11932 :                           lone_keyword_l_val=.TRUE.)
    1240        11932 :       CALL section_add_keyword(subsection, keyword)
    1241        11932 :       CALL keyword_release(keyword)
    1242              :       CALL keyword_create(keyword, __LOCATION__, name="KERNEL_FILE_NAME", &
    1243              :                           description="Name of the kernel data file, may include a path. "// &
    1244              :                           "vdW_kernel_table.dat is for DRSLL and LMKLL and "// &
    1245              :                           "rVV10_kernel_table.dat is for rVV10.", &
    1246              :                           usage="KERNEL_FILE_NAME <FILENAME>", &
    1247        11932 :                           default_lc_val="vdW_kernel_table.dat")
    1248        11932 :       CALL section_add_keyword(subsection, keyword)
    1249        11932 :       CALL keyword_release(keyword)
    1250              :       CALL keyword_create(keyword, __LOCATION__, name="CUTOFF", &
    1251              :                           description="The cutoff of the FFT grid used in the calculation "// &
    1252              :                           "of the nonlocal vdW functional [Ry].", &
    1253              :                           usage="CUTOFF 300", &
    1254        11932 :                           default_r_val=-1._dp, unit_str="Ry")
    1255        11932 :       CALL section_add_keyword(subsection, keyword)
    1256        11932 :       CALL keyword_release(keyword)
    1257              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETERS", &
    1258              :                           description="Parameters b and C of the rVV10 functional", &
    1259              :                           usage="PARAMETERS 6.3 0.0093", &
    1260        11932 :                           type_of_var=real_t, default_r_vals=[6.3_dp, 0.0093_dp], n_var=2)
    1261        11932 :       CALL section_add_keyword(subsection, keyword)
    1262        11932 :       CALL keyword_release(keyword)
    1263              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
    1264              :                           description="Scales the energy contribution of the rVV10 functional", &
    1265              :                           usage="SCALE 1.0", &
    1266        11932 :                           type_of_var=real_t, default_r_val=1.0_dp)
    1267        11932 :       CALL section_add_keyword(subsection, keyword)
    1268        11932 :       CALL keyword_release(keyword)
    1269              : 
    1270        11932 :       CALL section_add_subsection(section, subsection)
    1271        11932 :       CALL section_release(subsection)
    1272              : 
    1273        11932 :    END SUBROUTINE create_vdw_potential_section
    1274              : 
    1275              : ! **************************************************************************************************
    1276              : !> \brief creates the structure of the section needed for gCP potentials
    1277              : !> \param section the section that will be created
    1278              : !> \author jgh
    1279              : ! **************************************************************************************************
    1280        11932 :    SUBROUTINE create_gcp_potential_section(section)
    1281              :       TYPE(section_type), POINTER                        :: section
    1282              : 
    1283              :       TYPE(keyword_type), POINTER                        :: keyword
    1284              : 
    1285        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
    1286              :       CALL section_create(section, __LOCATION__, name="gcp_potential", &
    1287              :                           description="This section combines geometrical counterpoise potentials."// &
    1288              :                           " This is a simple empirical pair potential to correct for BSSE. ", &
    1289              :                           citations=[Kruse2012], &
    1290        23864 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1291              : 
    1292        11932 :       NULLIFY (keyword)
    1293              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER_FILE_NAME", &
    1294              :                           description="Name of the parameter file, may include a path", &
    1295              :                           usage="PARAMETER_FILE_NAME <FILENAME>", &
    1296        11932 :                           default_lc_val="---")
    1297        11932 :       CALL section_add_keyword(section, keyword)
    1298        11932 :       CALL keyword_release(keyword)
    1299              : 
    1300              :       CALL keyword_create(keyword, __LOCATION__, name="GLOBAL_PARAMETERS", &
    1301              :                           description="Global parameters of the gCP method."// &
    1302              :                           " Parameters are sigma, alpha, beta, eta from the original paper.", &
    1303              :                           usage="GLOBAL_PARAMETERS 1.0 1.0 1.0 1.0", n_var=4, &
    1304        11932 :                           default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
    1305        11932 :       CALL section_add_keyword(section, keyword)
    1306        11932 :       CALL keyword_release(keyword)
    1307              : 
    1308              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_ENERGY", &
    1309              :                           description="Specify the delta energy [Hartree] term for an atom kind", &
    1310              :                           usage="DELTA_ENERGY  type value", &
    1311        35796 :                           type_of_var=char_t, repeats=.TRUE., n_var=-1, default_c_vals=["XX ", "0.0"])
    1312        11932 :       CALL section_add_keyword(section, keyword)
    1313        11932 :       CALL keyword_release(keyword)
    1314              : 
    1315              :       CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", &
    1316              :                           description="Verbose output for gCP calculation", &
    1317              :                           usage="VERBOSE logical_value", &
    1318        11932 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1319        11932 :       CALL section_add_keyword(section, keyword)
    1320        11932 :       CALL keyword_release(keyword)
    1321              : 
    1322        11932 :    END SUBROUTINE create_gcp_potential_section
    1323              : 
    1324              : ! **************************************************************************************************
    1325              : !> \brief creates the input section for the xc part
    1326              : !> \param section the section to create
    1327              : !> \author fawzi
    1328              : ! **************************************************************************************************
    1329        11932 :    SUBROUTINE create_xc_section(section)
    1330              :       TYPE(section_type), POINTER                        :: section
    1331              : 
    1332              :       INTEGER                                            :: default_libxc_backend
    1333              :       TYPE(keyword_type), POINTER                        :: keyword
    1334              :       TYPE(section_type), POINTER                        :: subsection
    1335              : 
    1336        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
    1337              :       CALL section_create(section, __LOCATION__, name="xc", &
    1338              :                           description="Parameters needed for the calculation of the eXchange and Correlation potential", &
    1339        11932 :                           n_keywords=6, n_subsections=2, repeats=.FALSE.)
    1340              : 
    1341        11932 :       NULLIFY (subsection, keyword)
    1342              : 
    1343              :       CALL keyword_create(keyword, __LOCATION__, name="density_cutoff", &
    1344              :                           description="The cutoff on the density used by the xc calculation", &
    1345        11932 :                           usage="density_cutoff 1.e-11", default_r_val=1.0e-10_dp)
    1346        11932 :       CALL section_add_keyword(section, keyword)
    1347        11932 :       CALL keyword_release(keyword)
    1348              : 
    1349              :       CALL keyword_create(keyword, __LOCATION__, name="gradient_cutoff", &
    1350              :                           description="The cutoff on the gradient of the density used by the "// &
    1351              :                           "xc calculation", &
    1352        11932 :                           usage="gradient_cutoff 1.e-11", default_r_val=1.0e-10_dp)
    1353        11932 :       CALL section_add_keyword(section, keyword)
    1354        11932 :       CALL keyword_release(keyword)
    1355              : 
    1356              :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY_SMOOTH_CUTOFF_RANGE", &
    1357              :                           description="Parameter for the smoothing procedure in xc calculation", &
    1358        11932 :                           usage="DENSITY_SMOOTH_CUTOFF_RANGE {real}", default_r_val=0.0_dp)
    1359        11932 :       CALL section_add_keyword(section, keyword)
    1360        11932 :       CALL keyword_release(keyword)
    1361              : 
    1362              :       CALL keyword_create(keyword, __LOCATION__, name="tau_cutoff", &
    1363              :                           description="The cutoff on tau used by the xc calculation", &
    1364        11932 :                           usage="tau_cutoff 1.e-11", default_r_val=1.0e-10_dp)
    1365        11932 :       CALL section_add_keyword(section, keyword)
    1366        11932 :       CALL keyword_release(keyword)
    1367              : 
    1368              :       ! The GPU backend is the default on builds with a device path; HOST is the
    1369              :       ! only option without one, and DEVICE aborts when no GPU is usable.
    1370              : #if defined(__OFFLOAD) && !defined(__NO_OFFLOAD_LIBXC)
    1371              :       default_libxc_backend = do_libxc_gpu
    1372              : #else
    1373        11932 :       default_libxc_backend = do_libxc_cpu
    1374              : #endif
    1375              :       CALL keyword_create(keyword, __LOCATION__, name="LIBXC_GPU_BACKEND", &
    1376              :                           description="Runtime device/host backend selection for LibXC. "// &
    1377              :                           "DEVICE selects the GPU backend (the default on GPU "// &
    1378              :                           "builds), HOST the CPU backend. DEVICE is an error "// &
    1379              :                           "(abort) when no usable GPU is found at runtime; HOST "// &
    1380              :                           "always runs.", &
    1381              :                           usage="LIBXC_GPU_BACKEND HOST", &
    1382              :                           default_i_val=default_libxc_backend, &
    1383              :                           enum_i_vals=[do_libxc_gpu, do_libxc_cpu], &
    1384              :                           enum_c_vals=s2a("DEVICE", "HOST"), &
    1385        11932 :                           enum_desc=s2a("LibXC GPU backend", "LibXC CPU backend"))
    1386        11932 :       CALL section_add_keyword(section, keyword)
    1387        11932 :       CALL keyword_release(keyword)
    1388              : 
    1389              :       CALL section_create(subsection, __LOCATION__, name="xc_grid", & !FM to do
    1390              :                           description="The xc parameters used when calculating the xc on the grid", &
    1391        11932 :                           n_keywords=6, n_subsections=0, repeats=.FALSE.)
    1392              :       CALL keyword_create(keyword, __LOCATION__, name="xc_smooth_rho", &
    1393              :                           description="The density smoothing used for the xc calculation", &
    1394              :                           usage="xc_smooth_rho nn10", default_i_val=xc_rho_no_smooth, &
    1395              :                           enum_c_vals=s2a("NONE", "NN50", "NN10", "SPLINE2", "NN6", "SPLINE3", "NN4"), &
    1396              :                           enum_i_vals=[xc_rho_no_smooth, xc_rho_nn50, xc_rho_nn10, &
    1397              :                                        xc_rho_spline2_smooth, xc_rho_spline2_smooth, xc_rho_spline3_smooth, &
    1398        11932 :                                        xc_rho_spline3_smooth])
    1399        11932 :       CALL section_add_keyword(subsection, keyword)
    1400        11932 :       CALL keyword_release(keyword)
    1401              : 
    1402              :       CALL keyword_create(keyword, __LOCATION__, name="xc_deriv", &
    1403              :                           description="The method used to compute the derivatives", &
    1404              :                           usage="xc_deriv NN10_SMOOTH", default_i_val=xc_deriv_pw, &
    1405              :                           enum_c_vals=s2a("PW", "SPLINE3", "SPLINE2", "NN50_SMOOTH", "NN10_SMOOTH", &
    1406              :                                           "SPLINE2_SMOOTH", "NN6_SMOOTH", "SPLINE3_SMOOTH", "NN4_SMOOTH", "COLLOCATE"), &
    1407              :                           enum_i_vals=[xc_deriv_pw, xc_deriv_spline3, xc_deriv_spline2, &
    1408              :                                        xc_deriv_nn50_smooth, xc_deriv_nn10_smooth, xc_deriv_spline2_smooth, &
    1409              :                                        xc_deriv_spline2_smooth, xc_deriv_spline3_smooth, xc_deriv_spline3_smooth, &
    1410        11932 :                                        xc_deriv_collocate])
    1411        11932 :       CALL section_add_keyword(subsection, keyword)
    1412        11932 :       CALL keyword_release(keyword)
    1413              : 
    1414              :       CALL keyword_create(keyword, __LOCATION__, name="use_finer_grid", &
    1415              :                           description="Uses a finer grid only to calculate the xc", &
    1416              :                           usage="use_finer_grid", default_l_val=.FALSE., &
    1417        11932 :                           lone_keyword_l_val=.TRUE.)
    1418        11932 :       CALL section_add_keyword(subsection, keyword)
    1419        11932 :       CALL keyword_release(keyword)
    1420              : 
    1421              :       CALL keyword_create(keyword, __LOCATION__, name="fine_grid_factor", &
    1422              :                           description="Factor by which the XC grid cutoff is increased when USE_FINER_GRID is active. "// &
    1423              :                           "This setting has no effect unless USE_FINER_GRID is enabled. The default of 4.0 preserves "// &
    1424              :                           "the historical finer XC grid. Smaller factors can reduce the finer-grid cost, but should "// &
    1425              :                           "be checked together with the regular MGRID cutoff convergence.", &
    1426              :                           usage="FINE_GRID_FACTOR 4.0", default_r_val=4.0_dp, &
    1427        23864 :                           variants=["FINE_XC_FACTOR"])
    1428        11932 :       CALL section_add_keyword(subsection, keyword)
    1429        11932 :       CALL keyword_release(keyword)
    1430              : 
    1431              :       CALL keyword_create(keyword, __LOCATION__, name="2ND_DERIV_ANALYTICAL", &
    1432              :                           description="Use analytical formulas or finite differences for 2nd derivatives of XC", &
    1433              :                           usage="2ND_DERIV_ANALYTICAL logical", default_l_val=.TRUE., &
    1434        11932 :                           lone_keyword_l_val=.TRUE.)
    1435        11932 :       CALL section_add_keyword(section, keyword)
    1436        11932 :       CALL keyword_release(keyword)
    1437              : 
    1438              :       CALL keyword_create(keyword, __LOCATION__, name="3RD_DERIV_ANALYTICAL", &
    1439              :                           description="Use analytical formulas or finite differences for 3rd derivatives of XC", &
    1440              :                           usage="3RD_DERIV_ANALYTICAL logical", default_l_val=.FALSE., &
    1441        11932 :                           lone_keyword_l_val=.TRUE.)
    1442        11932 :       CALL section_add_keyword(section, keyword)
    1443        11932 :       CALL keyword_release(keyword)
    1444              : 
    1445              :       CALL keyword_create(keyword, __LOCATION__, name="STEP_SIZE", &
    1446              :                           description="Step size in terms of the first order potential for the numerical "// &
    1447              :                           "evaluation of XC derivatives", &
    1448        11932 :                           usage="STEP_SIZE 1.0E-3", default_r_val=1e-3_dp)
    1449        11932 :       CALL section_add_keyword(section, keyword)
    1450        11932 :       CALL keyword_release(keyword)
    1451              : 
    1452              :       CALL keyword_create(keyword, __LOCATION__, name="NSTEPS", &
    1453              :                           description="Number of steps to consider in each direction for the numerical "// &
    1454              :                           "evaluation of XC derivatives. Must be a value from 1 to 4 (Default: 3).", &
    1455        11932 :                           usage="NSTEPS 4", default_i_val=3)
    1456        11932 :       CALL section_add_keyword(section, keyword)
    1457        11932 :       CALL keyword_release(keyword)
    1458              : 
    1459        11932 :       CALL section_add_subsection(section, subsection)
    1460        11932 :       CALL section_release(subsection)
    1461              : 
    1462        11932 :       CALL create_xc_fun_section(subsection)
    1463        11932 :       CALL section_add_subsection(section, subsection)
    1464        11932 :       CALL section_release(subsection)
    1465              : 
    1466        11932 :       CALL create_hfx_section(subsection)
    1467        11932 :       CALL section_add_subsection(section, subsection)
    1468        11932 :       CALL section_release(subsection)
    1469              : 
    1470        11932 :       CALL create_mp2_section(subsection)
    1471        11932 :       CALL section_add_subsection(section, subsection)
    1472        11932 :       CALL section_release(subsection)
    1473              : 
    1474        11932 :       CALL create_adiabatic_section(subsection)
    1475        11932 :       CALL section_add_subsection(section, subsection)
    1476        11932 :       CALL section_release(subsection)
    1477              : 
    1478        11932 :       CALL create_xc_potential_section(subsection)
    1479        11932 :       CALL section_add_subsection(section, subsection)
    1480        11932 :       CALL section_release(subsection)
    1481              : 
    1482        11932 :       CALL create_xc_kernel_section(subsection)
    1483        11932 :       CALL section_add_subsection(section, subsection)
    1484        11932 :       CALL section_release(subsection)
    1485              : 
    1486        11932 :       CALL create_hfx_kernel_section(subsection)
    1487        11932 :       CALL section_add_subsection(section, subsection)
    1488        11932 :       CALL section_release(subsection)
    1489              : 
    1490        11932 :       CALL create_vdw_potential_section(subsection)
    1491        11932 :       CALL section_add_subsection(section, subsection)
    1492        11932 :       CALL section_release(subsection)
    1493              : 
    1494        11932 :       CALL create_gcp_potential_section(subsection)
    1495        11932 :       CALL section_add_subsection(section, subsection)
    1496        11932 :       CALL section_release(subsection)
    1497              : 
    1498        11932 :    END SUBROUTINE create_xc_section
    1499              : 
    1500              : ! **************************************************************************************************
    1501              : !> \brief creates the section for adiabatic hybrid functionals
    1502              : !> \param section ...
    1503              : !> \author Manuel Guidon
    1504              : ! **************************************************************************************************
    1505        11932 :    SUBROUTINE create_adiabatic_section(section)
    1506              :       TYPE(section_type), POINTER                        :: section
    1507              : 
    1508              :       TYPE(keyword_type), POINTER                        :: keyword
    1509              : 
    1510        11932 :       CPASSERT(.NOT. ASSOCIATED(section))
    1511              :       CALL section_create(section, __LOCATION__, name="ADIABATIC_RESCALING", &
    1512              :                           description="Parameters for self interaction corrected hybrid functionals", &
    1513        11932 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
    1514        11932 :       NULLIFY (keyword)
    1515              :       CALL keyword_create( &
    1516              :          keyword, __LOCATION__, &
    1517              :          name="FUNCTIONAL_TYPE", &
    1518              :          description="Which Hybrid functional should be used. "// &
    1519              :          "(Has to be consistent with the definitions in XC and HF).", &
    1520              :          usage="FUNCTIONAL_TYPE MCY3", &
    1521              :          enum_c_vals=s2a("MCY3"), &
    1522              :          enum_i_vals=[do_adiabatic_hybrid_mcy3], &
    1523              :          enum_desc=s2a("Use MCY3 hybrid functional"), &
    1524        11932 :          default_i_val=do_adiabatic_hybrid_mcy3)
    1525        11932 :       CALL section_add_keyword(section, keyword)
    1526        11932 :       CALL keyword_release(keyword)
    1527              : 
    1528        11932 :       NULLIFY (keyword)
    1529              :       CALL keyword_create( &
    1530              :          keyword, __LOCATION__, &
    1531              :          name="LAMBDA", &
    1532              :          description="The point to be used along the adiabatic curve (0 &lt; &lambda; &lt; 1)", &
    1533              :          usage="LAMBDA 0.71", &
    1534        11932 :          default_r_val=0.71_dp)
    1535        11932 :       CALL section_add_keyword(section, keyword)
    1536        11932 :       CALL keyword_release(keyword)
    1537              : 
    1538        11932 :       NULLIFY (keyword)
    1539              :       CALL keyword_create( &
    1540              :          keyword, __LOCATION__, &
    1541              :          name="OMEGA", &
    1542              :          description="Long-range parameter", &
    1543              :          usage="OMEGA 0.2", &
    1544        11932 :          default_r_val=0.2_dp)
    1545        11932 :       CALL section_add_keyword(section, keyword)
    1546        11932 :       CALL keyword_release(keyword)
    1547              : 
    1548        11932 :       NULLIFY (keyword)
    1549              :       CALL keyword_create( &
    1550              :          keyword, __LOCATION__, &
    1551              :          name="FUNCTIONAL_MODEL", &
    1552              :          description="Which model for the coupling constant integration should be used. ", &
    1553              :          usage="FUNCTIONAL_MODEL PADE", &
    1554              :          enum_c_vals=s2a("PADE"), &
    1555              :          enum_i_vals=[do_adiabatic_model_pade], &
    1556              :          enum_desc=s2a("Use pade model: W(lambda)=a+(b*lambda)/(1+c*lambda)"), &
    1557        11932 :          default_i_val=do_adiabatic_model_pade)
    1558        11932 :       CALL section_add_keyword(section, keyword)
    1559        11932 :       CALL keyword_release(keyword)
    1560        11932 :    END SUBROUTINE create_adiabatic_section
    1561              : 
    1562              : END MODULE input_cp2k_xc
        

Generated by: LCOV version 2.0-1