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