LCOV - code coverage report
Current view: top level - src - input_cp2k_xc.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:e7e05ae) Lines: 593 593 100.0 %
Date: 2024-04-18 06:59:28 Functions: 8 8 100.0 %

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

Generated by: LCOV version 1.15