Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief function that build the dft section of the input
10 : !> \par History
11 : !> 10.2005 moved out of input_cp2k [fawzi]
12 : !> \author fawzi
13 : ! **************************************************************************************************
14 : MODULE input_cp2k_tb
15 : USE bibliography, ONLY: &
16 : Asgeirsson2017, Bannwarth2019, Caldeweyher2017, Caldeweyher2020, Elstner1998, Grimme2017, &
17 : Hu2007, Porezag1995, Seifert1996, Zhechkov2005
18 : USE eeq_input, ONLY: create_eeq_control_section
19 : USE input_constants, ONLY: &
20 : dispersion_d2, dispersion_d3, dispersion_d3bj, dispersion_uff, gfn1xtb, gfn2xtb, &
21 : gfn_tblite, ipea1xtb, slater, tblite_scc_mixer_auto, tblite_scc_mixer_cp2k, &
22 : tblite_scc_mixer_none, tblite_scc_mixer_tblite
23 : USE input_cp2k_mm, ONLY: create_GENPOT_section
24 : USE input_keyword_types, ONLY: keyword_create,&
25 : keyword_release,&
26 : keyword_type
27 : USE input_section_types, ONLY: section_add_keyword,&
28 : section_add_subsection,&
29 : section_create,&
30 : section_release,&
31 : section_type
32 : USE input_val_types, ONLY: char_t
33 : USE kinds, ONLY: dp
34 : USE string_utilities, ONLY: s2a
35 : #include "./base/base_uses.f90"
36 :
37 : IMPLICIT NONE
38 : PRIVATE
39 :
40 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_tb'
41 :
42 : PUBLIC :: create_dftb_control_section, create_xtb_control_section
43 :
44 : CONTAINS
45 :
46 : ! **************************************************************************************************
47 : !> \brief ...
48 : !> \param section ...
49 : ! **************************************************************************************************
50 9839 : SUBROUTINE create_dftb_control_section(section)
51 : TYPE(section_type), POINTER :: section
52 :
53 : TYPE(keyword_type), POINTER :: keyword
54 : TYPE(section_type), POINTER :: subsection
55 :
56 9839 : CPASSERT(.NOT. ASSOCIATED(section))
57 : CALL section_create(section, __LOCATION__, name="DFTB", &
58 : description="Parameters needed to set up the DFTB methods", &
59 : n_keywords=1, n_subsections=1, repeats=.FALSE., &
60 49195 : citations=[Porezag1995, Seifert1996, Elstner1998, Zhechkov2005])
61 :
62 9839 : NULLIFY (subsection)
63 9839 : CALL create_dftb_parameter_section(subsection)
64 9839 : CALL section_add_subsection(section, subsection)
65 9839 : CALL section_release(subsection)
66 :
67 9839 : NULLIFY (keyword)
68 : CALL keyword_create(keyword, __LOCATION__, name="self_consistent", &
69 : description="Use self-consistent method", &
70 : citations=[Elstner1998], &
71 19678 : usage="SELF_CONSISTENT", default_l_val=.TRUE.)
72 9839 : CALL section_add_keyword(section, keyword)
73 9839 : CALL keyword_release(keyword)
74 :
75 : CALL keyword_create(keyword, __LOCATION__, name="orthogonal_basis", &
76 : description="Assume orthogonal basis set", &
77 9839 : usage="ORTHOGONAL_BASIS", default_l_val=.FALSE.)
78 9839 : CALL section_add_keyword(section, keyword)
79 9839 : CALL keyword_release(keyword)
80 :
81 : CALL keyword_create(keyword, __LOCATION__, name="do_ewald", &
82 : description="Deprecated debug override for the DFTB Ewald treatment. "// &
83 : "By default the setting is inferred from SUBSYS/CELL/PERIODIC. "// &
84 : "If set to TRUE, the DFT/POISSON section must use a periodic Poisson solver.", &
85 : usage="DO_EWALD", default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
86 : deprecation_notice="Use SUBSYS/CELL/PERIODIC to select periodicity. "// &
87 9839 : "DO_EWALD is retained only as a debug override for the DFTB Ewald path.")
88 9839 : CALL section_add_keyword(section, keyword)
89 9839 : CALL keyword_release(keyword)
90 :
91 : CALL keyword_create(keyword, __LOCATION__, name="dispersion", &
92 : description="Use dispersion correction", &
93 : citations=[Zhechkov2005], lone_keyword_l_val=.TRUE., &
94 19678 : usage="DISPERSION", default_l_val=.FALSE.)
95 9839 : CALL section_add_keyword(section, keyword)
96 9839 : CALL keyword_release(keyword)
97 :
98 : CALL keyword_create(keyword, __LOCATION__, name="DIAGONAL_DFTB3", &
99 : description="Use a diagonal version of the 3rd order energy correction (DFTB3) ", &
100 : lone_keyword_l_val=.TRUE., &
101 9839 : usage="DIAGONAL_DFTB3", default_l_val=.FALSE.)
102 9839 : CALL section_add_keyword(section, keyword)
103 9839 : CALL keyword_release(keyword)
104 :
105 : CALL keyword_create(keyword, __LOCATION__, name="HB_SR_GAMMA", &
106 : description="Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
107 : "specifically tuned for hydrogen bonds.", &
108 : citations=[Hu2007], lone_keyword_l_val=.TRUE., &
109 19678 : usage="HB_SR_GAMMA", default_l_val=.FALSE.)
110 9839 : CALL section_add_keyword(section, keyword)
111 9839 : CALL keyword_release(keyword)
112 :
113 : CALL keyword_create(keyword, __LOCATION__, name="eps_disp", &
114 : description="Define accuracy of dispersion interaction", &
115 9839 : usage="EPS_DISP", default_r_val=0.0001_dp)
116 9839 : CALL section_add_keyword(section, keyword)
117 9839 : CALL keyword_release(keyword)
118 :
119 : CALL add_tb_scc_mixer_keywords(section, "CP2K-internal DFTB", &
120 9839 : "AUTO keeps the existing CP2K density/SCF mixing path for DFTB.")
121 :
122 9839 : END SUBROUTINE create_dftb_control_section
123 :
124 : ! **************************************************************************************************
125 : !> \brief ...
126 : !> \param section ...
127 : ! **************************************************************************************************
128 9839 : SUBROUTINE create_xtb_control_section(section)
129 : TYPE(section_type), POINTER :: section
130 :
131 : TYPE(keyword_type), POINTER :: keyword
132 : TYPE(section_type), POINTER :: subsection
133 :
134 9839 : CPASSERT(.NOT. ASSOCIATED(section))
135 : CALL section_create(section, __LOCATION__, name="xTB", &
136 : description="Parameters needed to set up the xTB methods", &
137 : n_keywords=1, n_subsections=1, repeats=.FALSE., &
138 19678 : citations=[GRIMME2017])
139 :
140 9839 : NULLIFY (subsection)
141 9839 : CALL create_xtb_parameter_section(subsection)
142 9839 : CALL section_add_subsection(section, subsection)
143 9839 : CALL section_release(subsection)
144 :
145 9839 : CALL create_xtb_nonbonded_section(subsection)
146 9839 : CALL section_add_subsection(section, subsection)
147 9839 : CALL section_release(subsection)
148 :
149 9839 : CALL create_eeq_control_section(subsection)
150 9839 : CALL section_add_subsection(section, subsection)
151 9839 : CALL section_release(subsection)
152 :
153 9839 : CALL create_xtb_tblite_section(subsection)
154 9839 : CALL section_add_subsection(section, subsection)
155 9839 : CALL section_release(subsection)
156 :
157 9839 : NULLIFY (keyword)
158 : CALL keyword_create(keyword, __LOCATION__, name="GFN_TYPE", &
159 : description="Selects the xTB backend. GFN_TYPE 1 uses the CP2K-internal GFN1-xTB "// &
160 : "implementation. GFN_TYPE TBLITE uses the tblite backend and requires an XTB/TBLITE "// &
161 : "section, where the actual tblite method is selected.", &
162 : usage="GFN_TYPE (0|1|TBLITE)", &
163 : enum_c_vals=s2a("0", "1", "TBLITE"), &
164 : enum_i_vals=[0, gfn1xtb, gfn_tblite], &
165 : enum_desc=s2a("Use the CP2K-internal GFN0-xTB implementation.", &
166 : "Use the CP2K-internal GFN1-xTB implementation.", &
167 : "Use the CP2K/tblite backend; requires XTB/TBLITE."), &
168 9839 : default_i_val=gfn1xtb)
169 9839 : CALL section_add_keyword(section, keyword)
170 9839 : CALL keyword_release(keyword)
171 :
172 : CALL add_tb_scc_mixer_keywords(section, "CP2K-internal xTB", &
173 9839 : "AUTO keeps the CP2K charge mixer for CP2K-internal xTB.")
174 :
175 : CALL keyword_create(keyword, __LOCATION__, name="DO_EWALD", &
176 : description="Deprecated debug override for the xTB Ewald treatment. "// &
177 : "By default the setting is inferred from SUBSYS/CELL/PERIODIC. "// &
178 : "If set to TRUE for CP2K-internal xTB, the DFT/POISSON section must use a periodic "// &
179 : "Poisson solver. For CP2K/tblite, the periodic long-range treatment is performed "// &
180 : "inside tblite.", &
181 : usage="DO_EWALD", default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
182 : deprecation_notice="Use SUBSYS/CELL/PERIODIC to select periodicity. "// &
183 9839 : "DO_EWALD is retained only as a debug override for the CP2K-internal xTB Ewald path.")
184 9839 : CALL section_add_keyword(section, keyword)
185 9839 : CALL keyword_release(keyword)
186 :
187 : CALL keyword_create(keyword, __LOCATION__, name="STO_NG", &
188 : description="Provides the order of the Slater orbital expansion in GTOs.", &
189 9839 : usage="STO_NG 3", default_i_val=6)
190 9839 : CALL section_add_keyword(section, keyword)
191 9839 : CALL keyword_release(keyword)
192 :
193 : CALL keyword_create(keyword, __LOCATION__, name="HYDROGEN_STO_NG", &
194 : description="Number of GTOs for Hydrogen basis expansion.", &
195 9839 : usage="HYDROGEN_STO_NG 3", default_i_val=4)
196 9839 : CALL section_add_keyword(section, keyword)
197 9839 : CALL keyword_release(keyword)
198 :
199 : CALL keyword_create(keyword, __LOCATION__, name="USE_HALOGEN_CORRECTION", &
200 : description="Use XB interaction term", &
201 9839 : usage="USE_HALOGEN_CORRECTION T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
202 9839 : CALL section_add_keyword(section, keyword)
203 9839 : CALL keyword_release(keyword)
204 :
205 : CALL keyword_create(keyword, __LOCATION__, name="DO_NONBONDED", &
206 : description="Controls the computation of real-space "// &
207 : "(short-range) nonbonded interactions as correction to xTB.", &
208 9839 : usage="DO_NONBONDED T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
209 9839 : CALL section_add_keyword(section, keyword)
210 9839 : CALL keyword_release(keyword)
211 :
212 : CALL keyword_create(keyword, __LOCATION__, name="VDW_POTENTIAL", &
213 : description="vdW potential to be used: NONE, DFTD3, DFTD4. "// &
214 : "Defaults: DFTD3(gfn1), DFTD4(gfn0, gfn2).", &
215 9839 : usage="VDW_POTENTIAL type", default_c_val="")
216 9839 : CALL section_add_keyword(section, keyword)
217 9839 : CALL keyword_release(keyword)
218 :
219 : CALL keyword_create(keyword, __LOCATION__, name="COULOMB_INTERACTION", &
220 : description="Use Coulomb interaction terms (electrostatics + TB3); for debug only", &
221 9839 : usage="COULOMB_INTERACTION T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
222 9839 : CALL section_add_keyword(section, keyword)
223 9839 : CALL keyword_release(keyword)
224 :
225 : CALL keyword_create(keyword, __LOCATION__, name="COULOMB_LR", &
226 : description="Use Coulomb LR (1/r) interaction terms; for debug only", &
227 9839 : usage="COULOMB_LR T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
228 9839 : CALL section_add_keyword(section, keyword)
229 9839 : CALL keyword_release(keyword)
230 :
231 : CALL keyword_create(keyword, __LOCATION__, name="TB3_INTERACTION", &
232 : description="Use TB3 interaction terms; for debug only", &
233 9839 : usage="TB3_INTERACTION T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
234 9839 : CALL section_add_keyword(section, keyword)
235 9839 : CALL keyword_release(keyword)
236 :
237 : CALL keyword_create(keyword, __LOCATION__, name="CHECK_ATOMIC_CHARGES", &
238 : description="Stop calculation if atomic charges are outside chemical range.", &
239 9839 : usage="CHECK_ATOMIC_CHARGES T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
240 9839 : CALL section_add_keyword(section, keyword)
241 9839 : CALL keyword_release(keyword)
242 :
243 : CALL keyword_create(keyword, __LOCATION__, name="VARIATIONAL_DIPOLE", &
244 : description="gfn0-xTB use dipole definition from energy derivative.", &
245 9839 : usage="VARIATIONAL_DIPOLE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
246 9839 : CALL section_add_keyword(section, keyword)
247 9839 : CALL keyword_release(keyword)
248 :
249 : CALL keyword_create(keyword, __LOCATION__, name="EPS_PAIRPOTENTIAL", &
250 : description="Accuracy for the repulsive pair potential.", &
251 9839 : usage="EPS_PAIRPOTENTIAL 1.0E-8", default_r_val=1.0e-10_dp)
252 9839 : CALL section_add_keyword(section, keyword)
253 9839 : CALL keyword_release(keyword)
254 :
255 : CALL keyword_create(keyword, __LOCATION__, name="EN_SHIFT_TYPE", &
256 : description="Shift function for electronegativity in EEQ method. "// &
257 : "[Select/Molecule/Crystal] Default Select from periodicity.", &
258 : usage="EN_SHIFT_TYPE [Select/Molecule/Crystal]", &
259 9839 : n_var=1, type_of_var=char_t, default_c_val="Molecule")
260 9839 : CALL section_add_keyword(section, keyword)
261 9839 : CALL keyword_release(keyword)
262 :
263 9839 : END SUBROUTINE create_xtb_control_section
264 :
265 : ! **************************************************************************************************
266 : !> \brief ...
267 : !> \param section ...
268 : ! **************************************************************************************************
269 9839 : SUBROUTINE create_dftb_parameter_section(section)
270 :
271 : TYPE(section_type), POINTER :: section
272 :
273 : TYPE(keyword_type), POINTER :: keyword
274 :
275 9839 : CPASSERT(.NOT. ASSOCIATED(section))
276 :
277 : CALL section_create(section, __LOCATION__, name="PARAMETER", &
278 : description="Information on where to find DFTB parameters", &
279 9839 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
280 :
281 9839 : NULLIFY (keyword)
282 : CALL keyword_create(keyword, __LOCATION__, name="SK_FILE", &
283 : description="Define parameter file for atom pair", &
284 : usage="SK_FILE a1 a2 filename", &
285 9839 : n_var=3, type_of_var=char_t, repeats=.TRUE.)
286 9839 : CALL section_add_keyword(section, keyword)
287 9839 : CALL keyword_release(keyword)
288 :
289 : CALL keyword_create(keyword, __LOCATION__, name="PARAM_FILE_PATH", &
290 : description="Specify the directory with the DFTB parameter files. "// &
291 : "Used in combination with the filenames specified in the file "// &
292 : "given in PARAM_FILE_NAME.", usage="PARAM_FILE_PATH pathname", &
293 9839 : n_var=1, type_of_var=char_t, default_c_val="./")
294 9839 : CALL section_add_keyword(section, keyword)
295 9839 : CALL keyword_release(keyword)
296 :
297 : CALL keyword_create(keyword, __LOCATION__, name="PARAM_FILE_NAME", &
298 : description="Specify file that contains the names of "// &
299 : "Slater-Koster tables: A plain text file, each line has the "// &
300 : 'format "ATOM1 ATOM2 filename.spl".', &
301 : usage="PARAM_FILE_NAME filename", &
302 9839 : n_var=1, type_of_var=char_t, default_c_val="")
303 9839 : CALL section_add_keyword(section, keyword)
304 9839 : CALL keyword_release(keyword)
305 :
306 : CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_TYPE", &
307 : description="Use dispersion correction of the specified type."// &
308 : " Dispersion correction has to be switched on in the DFTB section.", &
309 : usage="DISPERSION_TYPE (UFF|D3|D3(BJ)|D2)", &
310 : enum_c_vals=s2a("UFF", "D3", "D3(BJ)", "D2"), &
311 : enum_i_vals=[dispersion_uff, dispersion_d3, dispersion_d3bj, dispersion_d2], &
312 : enum_desc=s2a("Uses the UFF force field for a pair potential dispersion correction.", &
313 : "Uses the Grimme D3 method (simplified) for a pair potential dispersion correction.", &
314 : "Uses the Grimme D3 method (simplified) with Becke-Johnson attenuation.", &
315 : "Uses the Grimme D2 method for pair potential dispersion correction."), &
316 9839 : default_i_val=dispersion_uff)
317 9839 : CALL section_add_keyword(section, keyword)
318 9839 : CALL keyword_release(keyword)
319 :
320 : CALL keyword_create(keyword, __LOCATION__, name="UFF_FORCE_FIELD", &
321 : description="Name of file with UFF parameters that will be used "// &
322 : "for the dispersion correction. Needs to be specified when "// &
323 : "DISPERSION==.TRUE., otherwise cp2k crashes with a Segmentation "// &
324 : "Fault.", usage="UFF_FORCE_FIELD filename", &
325 9839 : n_var=1, type_of_var=char_t, default_c_val="")
326 9839 : CALL section_add_keyword(section, keyword)
327 9839 : CALL keyword_release(keyword)
328 :
329 : CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_PARAMETER_FILE", &
330 : description="Specify file that contains the atomic dispersion "// &
331 : "parameters for the D3 method", &
332 : usage="DISPERSION_PARAMETER_FILE filename", &
333 9839 : n_var=1, type_of_var=char_t, default_c_val="")
334 9839 : CALL section_add_keyword(section, keyword)
335 9839 : CALL keyword_release(keyword)
336 :
337 : CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_RADIUS", &
338 : description="Define radius of dispersion interaction", &
339 9839 : usage="DISPERSION_RADIUS", default_r_val=15._dp)
340 9839 : CALL section_add_keyword(section, keyword)
341 9839 : CALL keyword_release(keyword)
342 :
343 : CALL keyword_create(keyword, __LOCATION__, name="COORDINATION_CUTOFF", &
344 : description="Define cutoff for coordination number calculation", &
345 9839 : usage="COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
346 9839 : CALL section_add_keyword(section, keyword)
347 9839 : CALL keyword_release(keyword)
348 :
349 : CALL keyword_create(keyword, __LOCATION__, name="D3_SCALING", &
350 : description="Scaling parameters (s6,sr6,s8) for the D3 dispersion method,", &
351 9839 : usage="D3_SCALING 1.0 1.0 1.0", n_var=3, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
352 9839 : CALL section_add_keyword(section, keyword)
353 9839 : CALL keyword_release(keyword)
354 :
355 : CALL keyword_create(keyword, __LOCATION__, name="D3BJ_SCALING", &
356 : description="Scaling parameters (s6,a1,s8,a2) for the D3(BJ) dispersion method,", &
357 : usage="D3BJ_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
358 9839 : default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
359 9839 : CALL section_add_keyword(section, keyword)
360 9839 : CALL keyword_release(keyword)
361 :
362 : CALL keyword_create(keyword, __LOCATION__, name="D2_SCALING", &
363 : description="Scaling parameter for the D2 dispersion method,", &
364 9839 : usage="D2_SCALING 1.0", default_r_val=1.0_dp)
365 9839 : CALL section_add_keyword(section, keyword)
366 9839 : CALL keyword_release(keyword)
367 :
368 : CALL keyword_create(keyword, __LOCATION__, name="D2_EXP_PRE", &
369 : description="Exp prefactor for damping for the D2 dispersion method,", &
370 9839 : usage="D2_EXP_PRE 2.0", default_r_val=2.0_dp)
371 9839 : CALL section_add_keyword(section, keyword)
372 9839 : CALL keyword_release(keyword)
373 :
374 : CALL keyword_create(keyword, __LOCATION__, name="HB_SR_PARAM", &
375 : description="Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
376 : "specifically tuned for hydrogen bonds. Specify the exponent used in the exponential.", &
377 9839 : usage="HB_SR_PARAM {real}", default_r_val=4.0_dp)
378 9839 : CALL section_add_keyword(section, keyword)
379 9839 : CALL keyword_release(keyword)
380 :
381 9839 : END SUBROUTINE create_dftb_parameter_section
382 :
383 : ! **************************************************************************************************
384 : !> \brief ...
385 : !> \param section ...
386 : ! **************************************************************************************************
387 9839 : SUBROUTINE create_xtb_parameter_section(section)
388 :
389 : TYPE(section_type), POINTER :: section
390 :
391 : TYPE(keyword_type), POINTER :: keyword
392 :
393 9839 : CPASSERT(.NOT. ASSOCIATED(section))
394 :
395 : CALL section_create(section, __LOCATION__, name="PARAMETER", &
396 : description="Information on and where to find xTB parameters", &
397 9839 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
398 :
399 9839 : NULLIFY (keyword)
400 : CALL keyword_create(keyword, __LOCATION__, name="PARAM_FILE_PATH", &
401 : description="Specify the directory with the xTB parameter file. ", &
402 : usage="PARAM_FILE_PATH pathname", &
403 9839 : n_var=1, type_of_var=char_t, default_c_val="")
404 9839 : CALL section_add_keyword(section, keyword)
405 9839 : CALL keyword_release(keyword)
406 :
407 : CALL keyword_create(keyword, __LOCATION__, name="PARAM_FILE_NAME", &
408 : description="Specify file that contains all xTB default parameters. ", &
409 : usage="PARAM_FILE_NAME filename", &
410 9839 : n_var=1, type_of_var=char_t, default_c_val="xTB_parameters")
411 9839 : CALL section_add_keyword(section, keyword)
412 9839 : CALL keyword_release(keyword)
413 :
414 : CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_PARAMETER_FILE", &
415 : description="Specify file that contains the atomic dispersion "// &
416 : "parameters for the D3 method", &
417 : usage="DISPERSION_PARAMETER_FILE filename", &
418 9839 : n_var=1, type_of_var=char_t, default_c_val="dftd3.dat")
419 9839 : CALL section_add_keyword(section, keyword)
420 9839 : CALL keyword_release(keyword)
421 :
422 : CALL keyword_create(keyword, __LOCATION__, name="DISPERSION_RADIUS", &
423 : description="Define radius of dispersion interaction", &
424 9839 : usage="DISPERSION_RADIUS", default_r_val=15._dp)
425 9839 : CALL section_add_keyword(section, keyword)
426 9839 : CALL keyword_release(keyword)
427 :
428 : CALL keyword_create(keyword, __LOCATION__, name="COORDINATION_CUTOFF", &
429 : description="Define cutoff for coordination number calculation", &
430 9839 : usage="COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
431 9839 : CALL section_add_keyword(section, keyword)
432 9839 : CALL keyword_release(keyword)
433 :
434 : CALL keyword_create(keyword, __LOCATION__, name="D3BJ_SCALING", &
435 : description="Scaling parameters (s6,s8) for the D3 dispersion method.", &
436 9839 : usage="D3BJ_SCALING 1.0 2.4", n_var=2, default_r_vals=[1.0_dp, 2.4_dp])
437 9839 : CALL section_add_keyword(section, keyword)
438 9839 : CALL keyword_release(keyword)
439 :
440 : CALL keyword_create(keyword, __LOCATION__, name="D3BJ_PARAM", &
441 : description="Becke-Johnson parameters (a1, a2 for the D3 dispersion method.", &
442 9839 : usage="D3BJ_PARAM 0.63 5.0", n_var=2, default_r_vals=[0.63_dp, 5.0_dp])
443 9839 : CALL section_add_keyword(section, keyword)
444 9839 : CALL keyword_release(keyword)
445 :
446 : CALL keyword_create(keyword, __LOCATION__, name="HUCKEL_CONSTANTS", &
447 : description="Huckel parameters (s, p, d, sp, 2sH).", &
448 : usage="HUCKEL_CONSTANTS 1.85 2.25 2.00 2.08 2.85", n_var=5, &
449 9839 : default_r_vals=[1.85_dp, 2.25_dp, 2.00_dp, 2.08_dp, 2.85_dp])
450 9839 : CALL section_add_keyword(section, keyword)
451 9839 : CALL keyword_release(keyword)
452 :
453 : CALL keyword_create(keyword, __LOCATION__, name="COULOMB_CONSTANTS", &
454 : description="Scaling parameters for Coulomb interactions (electrons, nuclei).", &
455 : usage="COULOMB_CONSTANTS 2.00 1.50", n_var=2, &
456 9839 : default_r_vals=[2.00_dp, 1.50_dp])
457 9839 : CALL section_add_keyword(section, keyword)
458 9839 : CALL keyword_release(keyword)
459 :
460 : CALL keyword_create(keyword, __LOCATION__, name="CN_CONSTANTS", &
461 : description="Scaling parameters for Coordination number correction term.", &
462 : usage="CN_CONSTANTS 0.006 -0.003 -0.005", n_var=3, &
463 9839 : default_r_vals=[0.006_dp, -0.003_dp, -0.005_dp])
464 9839 : CALL section_add_keyword(section, keyword)
465 9839 : CALL keyword_release(keyword)
466 :
467 : CALL keyword_create(keyword, __LOCATION__, name="EN_CONSTANTS", &
468 : description="Scaling parameters for electronegativity correction term.", &
469 : usage="EN_CONSTANTS -0.007 0.000 0.000", n_var=3, &
470 9839 : default_r_vals=[-0.007_dp, 0.000_dp, 0.000_dp])
471 9839 : CALL section_add_keyword(section, keyword)
472 9839 : CALL keyword_release(keyword)
473 :
474 : CALL keyword_create(keyword, __LOCATION__, name="BEN_CONSTANT", &
475 : description="Scaling parameter for electronegativity correction term.", &
476 : usage="BEN_CONSTANT 4.0", n_var=1, &
477 9839 : default_r_val=4.0_dp)
478 9839 : CALL section_add_keyword(section, keyword)
479 9839 : CALL keyword_release(keyword)
480 :
481 : CALL keyword_create(keyword, __LOCATION__, name="ENSCALE", &
482 : description="Scaling parameter repulsive energy (dEN in exponential).", &
483 : usage="ENSCALE 0.01", n_var=1, &
484 9839 : default_r_val=0.0_dp)
485 9839 : CALL section_add_keyword(section, keyword)
486 9839 : CALL keyword_release(keyword)
487 :
488 : CALL keyword_create(keyword, __LOCATION__, name="HALOGEN_BINDING", &
489 : description="Scaling parameters for electronegativity correction term.", &
490 9839 : usage="HALOGEN_BINDING 1.30 0.44", n_var=2, default_r_vals=[1.30_dp, 0.44_dp])
491 9839 : CALL section_add_keyword(section, keyword)
492 9839 : CALL keyword_release(keyword)
493 :
494 : CALL keyword_create(keyword, __LOCATION__, name="KAB_PARAM", &
495 : description="Specifies the specific Kab value for types A and B.", &
496 : usage="KAB_PARAM kind1 kind2 value ", repeats=.TRUE., &
497 9839 : n_var=-1, type_of_var=char_t)
498 9839 : CALL section_add_keyword(section, keyword)
499 9839 : CALL keyword_release(keyword)
500 :
501 : CALL keyword_create(keyword, __LOCATION__, name="XB_RADIUS", &
502 : description="Specifies the radius [Bohr] of the XB pair interaction in xTB.", &
503 : usage="XB_RADIUS 20.0 ", repeats=.FALSE., &
504 9839 : n_var=1, default_r_val=20.0_dp)
505 9839 : CALL section_add_keyword(section, keyword)
506 9839 : CALL keyword_release(keyword)
507 :
508 : CALL keyword_create(keyword, __LOCATION__, name="COULOMB_SR_CUT", &
509 : description="Maximum range of short range part of Coulomb interaction.", &
510 : usage="COULOMB_SR_CUT 20.0 ", repeats=.FALSE., &
511 9839 : n_var=1, default_r_val=20.0_dp)
512 9839 : CALL section_add_keyword(section, keyword)
513 9839 : CALL keyword_release(keyword)
514 :
515 : CALL keyword_create(keyword, __LOCATION__, name="COULOMB_SR_EPS", &
516 : description="Cutoff for short range part of Coulomb interaction.", &
517 : usage="COULOMB_SR_EPS 1.E-3 ", repeats=.FALSE., &
518 9839 : n_var=1, default_r_val=1.0E-03_dp)
519 9839 : CALL section_add_keyword(section, keyword)
520 9839 : CALL keyword_release(keyword)
521 :
522 : CALL keyword_create(keyword, __LOCATION__, name="SRB_PARAMETER", &
523 : description="SRB parameters (ksrb, esrb, gscal, c1, c2, shift).", &
524 : usage="SRB_PARAMETER -0.0129 3.48 0.51 -1.71 2.11 0.0537", n_var=6, &
525 : default_r_vals=[-0.0129_dp, 3.4847_dp, 0.5097_dp, &
526 9839 : -1.70549806_dp, 2.10878369_dp, 0.0537_dp])
527 9839 : CALL section_add_keyword(section, keyword)
528 9839 : CALL keyword_release(keyword)
529 :
530 9839 : END SUBROUTINE create_xtb_parameter_section
531 : ! **************************************************************************************************
532 : !> \brief ...
533 : !> \param section ...
534 : ! **************************************************************************************************
535 9839 : SUBROUTINE create_xtb_nonbonded_section(section)
536 : TYPE(section_type), POINTER :: section
537 :
538 : TYPE(keyword_type), POINTER :: keyword
539 : TYPE(section_type), POINTER :: subsection
540 :
541 9839 : CPASSERT(.NOT. ASSOCIATED(section))
542 : CALL section_create(section, __LOCATION__, name="NONBONDED", &
543 : description="This section specifies the input parameters for NON-BONDED interactions.", &
544 9839 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
545 9839 : NULLIFY (subsection)
546 :
547 9839 : CALL create_GENPOT_section(subsection)
548 9839 : CALL section_add_subsection(section, subsection)
549 9839 : CALL section_release(subsection)
550 :
551 9839 : NULLIFY (keyword)
552 : CALL keyword_create(keyword, __LOCATION__, name="DX", &
553 : description="Parameter used for computing the derivative with the Ridders' method.", &
554 9839 : usage="DX <REAL>", default_r_val=0.1_dp, unit_str="bohr")
555 9839 : CALL section_add_keyword(section, keyword)
556 9839 : CALL keyword_release(keyword)
557 :
558 : CALL keyword_create(keyword, __LOCATION__, name="ERROR_LIMIT", &
559 : description="Checks that the error in computing the derivative is not larger than "// &
560 : "the value set; in case error is larger a warning message is printed.", &
561 9839 : usage="ERROR_LIMIT <REAL>", default_r_val=1.0E-12_dp)
562 9839 : CALL section_add_keyword(section, keyword)
563 9839 : CALL keyword_release(keyword)
564 :
565 9839 : END SUBROUTINE create_xtb_nonbonded_section
566 : ! **************************************************************************************************
567 : !> \brief Creates the &TBLITE section
568 : !> \param section the section to create
569 : !> \author JVP
570 : ! **************************************************************************************************
571 9839 : SUBROUTINE create_xtb_tblite_section(section)
572 : TYPE(section_type), POINTER :: section
573 :
574 : TYPE(keyword_type), POINTER :: keyword
575 : TYPE(section_type), POINTER :: subsection
576 :
577 9839 : CPASSERT(.NOT. ASSOCIATED(section))
578 : CALL section_create(section, __LOCATION__, name="TBLITE", &
579 : description="Section used to specify options for an xTB computation using tblite. "// &
580 : "This section is required when XTB/GFN_TYPE is set to TBLITE. "// &
581 : "Periodicity follows SUBSYS/CELL/PERIODIC; the deprecated XTB/DO_EWALD keyword "// &
582 : "is read consistently with CP2K-internal xTB for diagnostics/debugging.", &
583 : n_keywords=1, n_subsections=1, repeats=.FALSE., citations=[Caldeweyher2017, Caldeweyher2020, &
584 59034 : Asgeirsson2017, Grimme2017, Bannwarth2019])
585 :
586 9839 : NULLIFY (keyword)
587 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
588 : description="Marks the tblite options section as present. The tblite backend is selected "// &
589 : "with XTB/GFN_TYPE TBLITE.", &
590 9839 : lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
591 9839 : CALL section_add_keyword(section, keyword)
592 9839 : CALL keyword_release(keyword)
593 :
594 9839 : NULLIFY (keyword)
595 : CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
596 : description="Selection of the method used in tblite.", &
597 : usage="METHOD (GFN1|GFN2|IPEA1)", &
598 : enum_c_vals=s2a("GFN1", "GFN2", "IPEA1"), &
599 : enum_i_vals=[gfn1xtb, gfn2xtb, ipea1xtb], &
600 : enum_desc=s2a("Uses the GFN1-XTB method by Grimme.", &
601 : "Uses the GFN2-XTB method by Grimme.", &
602 : "Uses the IEPEA1 method by Grimme."), &
603 9839 : default_i_val=gfn2xtb)
604 9839 : CALL section_add_keyword(section, keyword)
605 9839 : CALL keyword_release(keyword)
606 :
607 : CALL add_tb_scc_mixer_keywords(section, "CP2K/tblite xTB", &
608 9839 : "AUTO uses tblite's internal SCC mixer.")
609 :
610 9839 : NULLIFY (keyword)
611 : CALL keyword_create(keyword, __LOCATION__, name="REFERENCE_CLI", &
612 : description="Enable the native tblite CLI reference check. If true, the "// &
613 : "XTB/TBLITE/REFERENCE_CLI section must be present. The reference check is also "// &
614 : "enabled whenever that section is present. This diagnostic path is skipped for "// &
615 : "CP2K multi-k-point calculations, because the native tblite CLI does not reproduce "// &
616 : "CP2K KPOINTS sampling.", &
617 9839 : usage="REFERENCE_CLI", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
618 9839 : CALL section_add_keyword(section, keyword)
619 9839 : CALL keyword_release(keyword)
620 :
621 9839 : NULLIFY (subsection)
622 9839 : CALL create_xtb_reference_cli_section(subsection)
623 9839 : CALL section_add_subsection(section, subsection)
624 9839 : CALL section_release(subsection)
625 :
626 9839 : END SUBROUTINE create_xtb_tblite_section
627 :
628 : ! **************************************************************************************************
629 : !> \brief Adds common SCC-mixer keywords for TB methods.
630 : !> \param section section receiving the keywords
631 : !> \param TARGET method/path description for the manual text
632 : !> \param auto_desc AUTO behavior for this section
633 : ! **************************************************************************************************
634 29517 : SUBROUTINE add_tb_scc_mixer_keywords(section, TARGET, auto_desc)
635 : TYPE(section_type), POINTER :: section
636 : CHARACTER(LEN=*), INTENT(IN) :: target, auto_desc
637 :
638 : TYPE(keyword_type), POINTER :: keyword
639 :
640 29517 : NULLIFY (keyword)
641 : CALL keyword_create(keyword, __LOCATION__, name="SCC_MIXER", &
642 : description="Selects the SCC variable mixer for "//TARGET//" calculations. "// &
643 : auto_desc//" TBLITE forces the tblite modified Broyden SCC mixer, CP2K forces CP2K "// &
644 : "charge mixing, and NONE updates SCC variables without mixing.", &
645 : usage="SCC_MIXER (AUTO|TBLITE|CP2K|NONE)", &
646 : enum_c_vals=s2a("AUTO", "TBLITE", "CP2K", "NONE"), &
647 : enum_i_vals=[tblite_scc_mixer_auto, tblite_scc_mixer_tblite, &
648 : tblite_scc_mixer_cp2k, tblite_scc_mixer_none], &
649 : enum_desc=s2a("Default method-dependent choice.", &
650 : "Use the tblite modified Broyden SCC mixer.", &
651 : "Use CP2K charge mixing for SCC variables.", &
652 : "Do not mix SCC variables; for debugging."), &
653 29517 : default_i_val=tblite_scc_mixer_auto)
654 29517 : CALL section_add_keyword(section, keyword)
655 29517 : CALL keyword_release(keyword)
656 :
657 : CALL keyword_create(keyword, __LOCATION__, name="TBLITE_MIXER_DAMPING", &
658 : description="Damping parameter for the tblite modified Broyden SCC mixer. "// &
659 : "Only active when the effective SCC mixer is TBLITE, either explicitly or via AUTO. "// &
660 : "The iteration limit is taken from DFT/SCF/MAX_SCF.", &
661 29517 : usage="TBLITE_MIXER_DAMPING 0.4", default_r_val=0.4_dp)
662 29517 : CALL section_add_keyword(section, keyword)
663 29517 : CALL keyword_release(keyword)
664 :
665 29517 : END SUBROUTINE add_tb_scc_mixer_keywords
666 :
667 : ! **************************************************************************************************
668 : !> \brief Creates the &REFERENCE_CLI section used to compare against native tblite.
669 : !> \param section the section to create
670 : ! **************************************************************************************************
671 9839 : SUBROUTINE create_xtb_reference_cli_section(section)
672 : TYPE(section_type), POINTER :: section
673 :
674 : TYPE(keyword_type), POINTER :: keyword
675 :
676 9839 : CPASSERT(.NOT. ASSOCIATED(section))
677 : CALL section_create(section, __LOCATION__, name="REFERENCE_CLI", &
678 : description="Run the native tblite command line interface as a reference "// &
679 : "for CP2K/tblite energies, nuclear gradients, and optionally virials. "// &
680 : "The section is a lone section: if it is present, the reference check is enabled.", &
681 9839 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
682 :
683 9839 : NULLIFY (keyword)
684 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
685 : description="Activates the native tblite CLI reference check when the section is present.", &
686 9839 : lone_keyword_l_val=.TRUE., default_l_val=.FALSE.)
687 9839 : CALL section_add_keyword(section, keyword)
688 9839 : CALL keyword_release(keyword)
689 :
690 : CALL keyword_create(keyword, __LOCATION__, name="PROGRAM_NAME", &
691 : description="Executable name or path for the native tblite command line program.", &
692 9839 : usage="PROGRAM_NAME tblite", n_var=1, type_of_var=char_t, default_c_val="tblite")
693 9839 : CALL section_add_keyword(section, keyword)
694 9839 : CALL keyword_release(keyword)
695 :
696 : CALL keyword_create(keyword, __LOCATION__, name="WORK_DIRECTORY", &
697 : description="Directory used for temporary native tblite CLI input and output files.", &
698 9839 : usage="WORK_DIRECTORY .", n_var=1, type_of_var=char_t, default_c_val=".")
699 9839 : CALL section_add_keyword(section, keyword)
700 9839 : CALL keyword_release(keyword)
701 :
702 : CALL keyword_create(keyword, __LOCATION__, name="PREFIX", &
703 : description="Prefix for temporary native tblite CLI input and output files.", &
704 : usage="PREFIX tblite-reference", n_var=1, type_of_var=char_t, &
705 9839 : default_c_val="tblite-reference")
706 9839 : CALL section_add_keyword(section, keyword)
707 9839 : CALL keyword_release(keyword)
708 :
709 : CALL keyword_create(keyword, __LOCATION__, name="KEEP_FILES", &
710 : description="Keep the temporary native tblite CLI input and output files.", &
711 9839 : usage="KEEP_FILES T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
712 9839 : CALL section_add_keyword(section, keyword)
713 9839 : CALL keyword_release(keyword)
714 :
715 : CALL keyword_create(keyword, __LOCATION__, name="ERROR_LIMIT", &
716 : description="Tolerance for reporting reference CLI deviations.", &
717 9839 : usage="ERROR_LIMIT 1.0E-8", default_r_val=1.0E-8_dp)
718 9839 : CALL section_add_keyword(section, keyword)
719 9839 : CALL keyword_release(keyword)
720 :
721 : CALL keyword_create(keyword, __LOCATION__, name="STOP_ON_ERROR", &
722 : description="Abort if a checked reference CLI deviation exceeds ERROR_LIMIT.", &
723 9839 : usage="STOP_ON_ERROR T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
724 9839 : CALL section_add_keyword(section, keyword)
725 9839 : CALL keyword_release(keyword)
726 :
727 : CALL keyword_create(keyword, __LOCATION__, name="CHECK_ENERGY", &
728 : description="Compare CP2K/tblite energy against the native tblite CLI energy.", &
729 9839 : usage="CHECK_ENERGY T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
730 9839 : CALL section_add_keyword(section, keyword)
731 9839 : CALL keyword_release(keyword)
732 :
733 : CALL keyword_create(keyword, __LOCATION__, name="CHECK_FORCES", &
734 : description="Compare CP2K/tblite nuclear gradients against native tblite CLI gradients.", &
735 9839 : usage="CHECK_FORCES T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
736 9839 : CALL section_add_keyword(section, keyword)
737 9839 : CALL keyword_release(keyword)
738 :
739 : CALL keyword_create(keyword, __LOCATION__, name="CHECK_VIRIAL", &
740 : description="Compare CP2K/tblite virial against the native tblite CLI virial.", &
741 9839 : usage="CHECK_VIRIAL T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
742 9839 : CALL section_add_keyword(section, keyword)
743 9839 : CALL keyword_release(keyword)
744 :
745 : CALL keyword_create(keyword, __LOCATION__, name="ACCURACY", &
746 : description="Value passed to native tblite as --acc.", &
747 9839 : usage="ACCURACY 1.0", default_r_val=1.0_dp)
748 9839 : CALL section_add_keyword(section, keyword)
749 9839 : CALL keyword_release(keyword)
750 :
751 : CALL keyword_create(keyword, __LOCATION__, name="ITERATIONS", &
752 : description="Value passed to native tblite as --iterations.", &
753 9839 : usage="ITERATIONS 250", default_i_val=250)
754 9839 : CALL section_add_keyword(section, keyword)
755 9839 : CALL keyword_release(keyword)
756 :
757 9839 : END SUBROUTINE create_xtb_reference_cli_section
758 :
759 : END MODULE input_cp2k_tb
|