(git:3f0d10b)
Loading...
Searching...
No Matches
input_cp2k_tb.F
Go to the documentation of this file.
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! **************************************************************************************************
15 USE bibliography, ONLY: elstner1998,&
17 hu2007,&
22 USE cp_units, ONLY: cp_unit_to_cp2k
24 USE input_constants, ONLY: &
45 USE input_val_types, ONLY: char_t,&
46 real_t
47 USE kinds, ONLY: dp
48 USE string_utilities, ONLY: s2a
49#include "../base/base_uses.f90"
50
51 IMPLICIT NONE
52 PRIVATE
53
54 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_tb'
55
57
58CONTAINS
59
60! **************************************************************************************************
61!> \brief ...
62!> \param section ...
63! **************************************************************************************************
64 SUBROUTINE create_dftb_control_section(section)
65 TYPE(section_type), POINTER :: section
66
67 TYPE(keyword_type), POINTER :: keyword
68 TYPE(section_type), POINTER :: subsection
69
70 cpassert(.NOT. ASSOCIATED(section))
71 CALL section_create(section, __location__, name="DFTB", &
72 description="Parameters needed to set up the DFTB methods", &
73 n_keywords=1, n_subsections=1, repeats=.false., &
75
76 NULLIFY (subsection)
77 CALL create_dftb_parameter_section(subsection)
78 CALL section_add_subsection(section, subsection)
79 CALL section_release(subsection)
80
81 NULLIFY (subsection)
82 CALL create_tblite_mixer_section(subsection)
83 CALL section_add_subsection(section, subsection)
84 CALL section_release(subsection)
85
86 NULLIFY (keyword)
87 CALL keyword_create(keyword, __location__, name="self_consistent", &
88 description="Use self-consistent method", &
89 citations=[elstner1998], &
90 usage="SELF_CONSISTENT", default_l_val=.true.)
91 CALL section_add_keyword(section, keyword)
92 CALL keyword_release(keyword)
93
94 CALL keyword_create(keyword, __location__, name="orthogonal_basis", &
95 description="Assume orthogonal basis set", &
96 usage="ORTHOGONAL_BASIS", default_l_val=.false.)
97 CALL section_add_keyword(section, keyword)
98 CALL keyword_release(keyword)
99
100 CALL keyword_create(keyword, __location__, name="do_ewald", &
101 description="Deprecated debug override for the DFTB Ewald treatment. "// &
102 "By default the setting is inferred from SUBSYS/CELL/PERIODIC. "// &
103 "If set to TRUE, the DFT/POISSON section must use a periodic Poisson solver.", &
104 usage="DO_EWALD", default_l_val=.false., lone_keyword_l_val=.true., &
105 deprecation_notice="Use SUBSYS/CELL/PERIODIC to select periodicity. "// &
106 "DO_EWALD is retained only as a debug override for the DFTB Ewald path.")
107 CALL section_add_keyword(section, keyword)
108 CALL keyword_release(keyword)
109
110 CALL keyword_create(keyword, __location__, name="dispersion", &
111 description="Use dispersion correction", &
112 citations=[zhechkov2005], lone_keyword_l_val=.true., &
113 usage="DISPERSION", default_l_val=.false.)
114 CALL section_add_keyword(section, keyword)
115 CALL keyword_release(keyword)
116
117 CALL keyword_create(keyword, __location__, name="DIAGONAL_DFTB3", &
118 description="Use a diagonal version of the 3rd order energy correction (DFTB3) ", &
119 lone_keyword_l_val=.true., &
120 usage="DIAGONAL_DFTB3", default_l_val=.false.)
121 CALL section_add_keyword(section, keyword)
122 CALL keyword_release(keyword)
123
124 CALL keyword_create(keyword, __location__, name="HB_SR_GAMMA", &
125 description="Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
126 "specifically tuned for hydrogen bonds.", &
127 citations=[hu2007], lone_keyword_l_val=.true., &
128 usage="HB_SR_GAMMA", default_l_val=.false.)
129 CALL section_add_keyword(section, keyword)
130 CALL keyword_release(keyword)
131
132 CALL keyword_create(keyword, __location__, name="eps_disp", &
133 description="Define accuracy of dispersion interaction", &
134 usage="EPS_DISP", default_r_val=0.0001_dp)
135 CALL section_add_keyword(section, keyword)
136 CALL keyword_release(keyword)
137
138 CALL add_tb_scc_mixer_keywords(section, "CP2K-internal DFTB", &
139 "AUTO keeps the existing CP2K density/SCF mixing path for DFTB.")
140
141 END SUBROUTINE create_dftb_control_section
142
143! **************************************************************************************************
144!> \brief ...
145!> \param section ...
146! **************************************************************************************************
147 SUBROUTINE create_xtb_control_section(section)
148 TYPE(section_type), POINTER :: section
149
150 TYPE(keyword_type), POINTER :: keyword
151 TYPE(section_type), POINTER :: subsection
152
153 cpassert(.NOT. ASSOCIATED(section))
154 CALL section_create(section, __location__, name="xTB", &
155 description="Parameters needed to set up the xTB methods", &
156 n_keywords=1, n_subsections=1, repeats=.false., &
157 citations=[grimme2017])
158
159 NULLIFY (subsection)
160 CALL create_xtb_parameter_section(subsection)
161 CALL section_add_subsection(section, subsection)
162 CALL section_release(subsection)
163
164 CALL create_xtb_nonbonded_section(subsection)
165 CALL section_add_subsection(section, subsection)
166 CALL section_release(subsection)
167
168 CALL create_eeq_control_section(subsection)
169 CALL section_add_subsection(section, subsection)
170 CALL section_release(subsection)
171
172 CALL create_tblite_mixer_section(subsection)
173 CALL section_add_subsection(section, subsection)
174 CALL section_release(subsection)
175
176 CALL create_xtb_tblite_section(subsection)
177 CALL section_add_subsection(section, subsection)
178 CALL section_release(subsection)
179
180 NULLIFY (keyword)
181 CALL keyword_create(keyword, __location__, name="GFN_TYPE", &
182 description="Selects the xTB backend. GFN_TYPE 1 uses the CP2K-internal GFN1-xTB "// &
183 "implementation. GFN_TYPE 0 uses the CP2K-internal GFN0-xTB implementation, which "// &
184 "has no SCC variables to mix, so XTB/SCC_MIXER AUTO is treated as NONE. "// &
185 "GFN_TYPE TBLITE uses the tblite backend and requires an XTB/TBLITE "// &
186 "section, where the actual tblite method is selected.", &
187 usage="GFN_TYPE (0|1|TBLITE)", &
188 enum_c_vals=s2a("0", "1", "TBLITE"), &
189 enum_i_vals=[0, gfn1xtb, gfn_tblite], &
190 enum_desc=s2a("Use the CP2K-internal GFN0-xTB implementation.", &
191 "Use the CP2K-internal GFN1-xTB implementation.", &
192 "Use the CP2K/tblite backend; requires XTB/TBLITE."), &
193 default_i_val=gfn1xtb)
194 CALL section_add_keyword(section, keyword)
195 CALL keyword_release(keyword)
196
197 CALL add_tb_scc_mixer_keywords(section, "xTB", &
198 "AUTO is treated as NONE for CP2K-internal GFN0-xTB, keeps the CP2K "// &
199 "charge mixer for CP2K-internal GFN1-xTB, and uses "// &
200 "tblite's native SCC mixer for XTB/GFN_TYPE TBLITE.")
201
202 CALL keyword_create(keyword, __location__, name="DO_EWALD", &
203 description="Deprecated debug override for the xTB Ewald treatment. "// &
204 "By default the setting is inferred from SUBSYS/CELL/PERIODIC. "// &
205 "If set to TRUE for CP2K-internal xTB, the DFT/POISSON section must use a periodic "// &
206 "Poisson solver. For CP2K/tblite, the periodic long-range treatment is performed "// &
207 "inside tblite.", &
208 usage="DO_EWALD", default_l_val=.false., lone_keyword_l_val=.true., &
209 deprecation_notice="Use SUBSYS/CELL/PERIODIC to select periodicity. "// &
210 "DO_EWALD is retained only as a debug override for the CP2K-internal xTB Ewald path.")
211 CALL section_add_keyword(section, keyword)
212 CALL keyword_release(keyword)
213
214 CALL keyword_create(keyword, __location__, name="STO_NG", &
215 description="Provides the order of the Slater orbital expansion in GTOs.", &
216 usage="STO_NG 3", default_i_val=6)
217 CALL section_add_keyword(section, keyword)
218 CALL keyword_release(keyword)
219
220 CALL keyword_create(keyword, __location__, name="HYDROGEN_STO_NG", &
221 description="Number of GTOs for Hydrogen basis expansion.", &
222 usage="HYDROGEN_STO_NG 3", default_i_val=4)
223 CALL section_add_keyword(section, keyword)
224 CALL keyword_release(keyword)
225
226 CALL keyword_create(keyword, __location__, name="STO_FLEX", &
227 description="Use element- and shell-specific numbers of Gaussian primitives.", &
228 usage="STO_FLEX T", default_l_val=.false., lone_keyword_l_val=.true.)
229 CALL section_add_keyword(section, keyword)
230 CALL keyword_release(keyword)
231
232 CALL keyword_create(keyword, __location__, name="USE_HALOGEN_CORRECTION", &
233 description="Use XB interaction term", &
234 usage="USE_HALOGEN_CORRECTION T", default_l_val=.true., lone_keyword_l_val=.true.)
235 CALL section_add_keyword(section, keyword)
236 CALL keyword_release(keyword)
237
238 CALL keyword_create(keyword, __location__, name="DO_NONBONDED", &
239 description="Controls the computation of real-space "// &
240 "(short-range) nonbonded interactions as correction to xTB.", &
241 usage="DO_NONBONDED T", default_l_val=.false., lone_keyword_l_val=.true.)
242 CALL section_add_keyword(section, keyword)
243 CALL keyword_release(keyword)
244
245 CALL keyword_create(keyword, __location__, name="VDW_POTENTIAL", &
246 description="vdW potential to be used: NONE, DFTD3, DFTD4. "// &
247 "Defaults: DFTD3(gfn1), DFTD4(gfn0, gfn2).", &
248 usage="VDW_POTENTIAL type", default_c_val="")
249 CALL section_add_keyword(section, keyword)
250 CALL keyword_release(keyword)
251
252 CALL keyword_create(keyword, __location__, name="SPIN_POLARISATION", &
253 description="Use the spin polarisation Hamiltonian for gfn1/2. "// &
254 "Enabled by default for gfn1; not available for gfn0.", &
255 usage="SPIN_POLARISATION T", default_l_val=.true., lone_keyword_l_val=.true.)
256 CALL section_add_keyword(section, keyword)
257 CALL keyword_release(keyword)
258
259 CALL keyword_create(keyword, __location__, name="COULOMB_INTERACTION", &
260 description="Use Coulomb interaction terms (electrostatics + TB3); for debug only", &
261 usage="COULOMB_INTERACTION T", default_l_val=.true., lone_keyword_l_val=.true.)
262 CALL section_add_keyword(section, keyword)
263 CALL keyword_release(keyword)
264
265 CALL keyword_create(keyword, __location__, name="COULOMB_LR", &
266 description="Use Coulomb LR (1/r) interaction terms; for debug only", &
267 usage="COULOMB_LR T", default_l_val=.true., lone_keyword_l_val=.true.)
268 CALL section_add_keyword(section, keyword)
269 CALL keyword_release(keyword)
270
271 CALL keyword_create(keyword, __location__, name="TB3_INTERACTION", &
272 description="Use TB3 interaction terms; for debug only", &
273 usage="TB3_INTERACTION T", default_l_val=.true., lone_keyword_l_val=.true.)
274 CALL section_add_keyword(section, keyword)
275 CALL keyword_release(keyword)
276
277 CALL keyword_create(keyword, __location__, name="CHECK_ATOMIC_CHARGES", &
278 description="Stop calculation if atomic charges are outside chemical range.", &
279 usage="CHECK_ATOMIC_CHARGES T", default_l_val=.true., lone_keyword_l_val=.true.)
280 CALL section_add_keyword(section, keyword)
281 CALL keyword_release(keyword)
282
283 CALL keyword_create(keyword, __location__, name="VARIATIONAL_DIPOLE", &
284 description="gfn0-xTB use dipole definition from energy derivative.", &
285 usage="VARIATIONAL_DIPOLE T", default_l_val=.false., lone_keyword_l_val=.true.)
286 CALL section_add_keyword(section, keyword)
287 CALL keyword_release(keyword)
288
289 CALL keyword_create(keyword, __location__, name="EPS_PAIRPOTENTIAL", &
290 description="Accuracy for the repulsive pair potential.", &
291 usage="EPS_PAIRPOTENTIAL 1.0E-8", default_r_val=1.0e-10_dp)
292 CALL section_add_keyword(section, keyword)
293 CALL keyword_release(keyword)
294
295 CALL keyword_create(keyword, __location__, name="EN_SHIFT_TYPE", &
296 description="Shift function for electronegativity in EEQ method. "// &
297 "[Select/Molecule/Crystal] Default Select from periodicity.", &
298 usage="EN_SHIFT_TYPE [Select/Molecule/Crystal]", &
299 n_var=1, type_of_var=char_t, default_c_val="Molecule")
300 CALL section_add_keyword(section, keyword)
301 CALL keyword_release(keyword)
302
303 END SUBROUTINE create_xtb_control_section
304
305! **************************************************************************************************
306!> \brief ...
307!> \param section ...
308! **************************************************************************************************
309 SUBROUTINE create_dftb_parameter_section(section)
310
311 TYPE(section_type), POINTER :: section
312
313 TYPE(keyword_type), POINTER :: keyword
314
315 cpassert(.NOT. ASSOCIATED(section))
316
317 CALL section_create(section, __location__, name="PARAMETER", &
318 description="Information on where to find DFTB parameters", &
319 n_keywords=1, n_subsections=0, repeats=.false.)
320
321 NULLIFY (keyword)
322 CALL keyword_create(keyword, __location__, name="SK_FILE", &
323 description="Define parameter file for atom pair", &
324 usage="SK_FILE a1 a2 filename", &
325 n_var=3, type_of_var=char_t, repeats=.true.)
326 CALL section_add_keyword(section, keyword)
327 CALL keyword_release(keyword)
328
329 CALL keyword_create(keyword, __location__, name="PARAM_FILE_PATH", &
330 description="Specify the directory with the DFTB parameter files. "// &
331 "Used in combination with the filenames specified in the file "// &
332 "given in PARAM_FILE_NAME.", usage="PARAM_FILE_PATH pathname", &
333 n_var=1, type_of_var=char_t, default_c_val="./")
334 CALL section_add_keyword(section, keyword)
335 CALL keyword_release(keyword)
336
337 CALL keyword_create(keyword, __location__, name="PARAM_FILE_NAME", &
338 description="Specify file that contains the names of "// &
339 "Slater-Koster tables: A plain text file, each line has the "// &
340 'format "ATOM1 ATOM2 filename.spl".', &
341 usage="PARAM_FILE_NAME filename", &
342 n_var=1, type_of_var=char_t, default_c_val="")
343 CALL section_add_keyword(section, keyword)
344 CALL keyword_release(keyword)
345
346 CALL keyword_create(keyword, __location__, name="DISPERSION_TYPE", &
347 description="Use dispersion correction of the specified type."// &
348 " Dispersion correction has to be switched on in the DFTB section.", &
349 usage="DISPERSION_TYPE (UFF|D3|D3(BJ)|D2)", &
350 enum_c_vals=s2a("UFF", "D3", "D3(BJ)", "D2"), &
352 enum_desc=s2a("Uses the UFF force field for a pair potential dispersion correction.", &
353 "Uses the Grimme D3 method (simplified) for a pair potential dispersion correction.", &
354 "Uses the Grimme D3 method (simplified) with Becke-Johnson attenuation.", &
355 "Uses the Grimme D2 method for pair potential dispersion correction."), &
356 default_i_val=dispersion_uff)
357 CALL section_add_keyword(section, keyword)
358 CALL keyword_release(keyword)
359
360 CALL keyword_create(keyword, __location__, name="UFF_FORCE_FIELD", &
361 description="Name of file with UFF parameters that will be used "// &
362 "for the dispersion correction. Needs to be specified when "// &
363 "DISPERSION==.TRUE., otherwise cp2k crashes with a Segmentation "// &
364 "Fault.", usage="UFF_FORCE_FIELD filename", &
365 n_var=1, type_of_var=char_t, default_c_val="")
366 CALL section_add_keyword(section, keyword)
367 CALL keyword_release(keyword)
368
369 CALL keyword_create(keyword, __location__, name="DISPERSION_PARAMETER_FILE", &
370 description="Specify file that contains the atomic dispersion "// &
371 "parameters for the D3 method", &
372 usage="DISPERSION_PARAMETER_FILE filename", &
373 n_var=1, type_of_var=char_t, default_c_val="")
374 CALL section_add_keyword(section, keyword)
375 CALL keyword_release(keyword)
376
377 CALL keyword_create(keyword, __location__, name="DISPERSION_RADIUS", &
378 description="Define radius of dispersion interaction", &
379 usage="DISPERSION_RADIUS", default_r_val=15._dp)
380 CALL section_add_keyword(section, keyword)
381 CALL keyword_release(keyword)
382
383 CALL keyword_create(keyword, __location__, name="COORDINATION_CUTOFF", &
384 description="Define cutoff for coordination number calculation", &
385 usage="COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
386 CALL section_add_keyword(section, keyword)
387 CALL keyword_release(keyword)
388
389 CALL keyword_create(keyword, __location__, name="D3_SCALING", &
390 description="Scaling parameters (s6,sr6,s8) for the D3 dispersion method,", &
391 usage="D3_SCALING 1.0 1.0 1.0", n_var=3, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
392 CALL section_add_keyword(section, keyword)
393 CALL keyword_release(keyword)
394
395 CALL keyword_create(keyword, __location__, name="D3BJ_SCALING", &
396 description="Scaling parameters (s6,a1,s8,a2) for the D3(BJ) dispersion method,", &
397 usage="D3BJ_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
398 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
399 CALL section_add_keyword(section, keyword)
400 CALL keyword_release(keyword)
401
402 CALL keyword_create(keyword, __location__, name="D2_SCALING", &
403 description="Scaling parameter for the D2 dispersion method,", &
404 usage="D2_SCALING 1.0", default_r_val=1.0_dp)
405 CALL section_add_keyword(section, keyword)
406 CALL keyword_release(keyword)
407
408 CALL keyword_create(keyword, __location__, name="D2_EXP_PRE", &
409 description="Exp prefactor for damping for the D2 dispersion method,", &
410 usage="D2_EXP_PRE 2.0", default_r_val=2.0_dp)
411 CALL section_add_keyword(section, keyword)
412 CALL keyword_release(keyword)
413
414 CALL keyword_create(keyword, __location__, name="HB_SR_PARAM", &
415 description="Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
416 "specifically tuned for hydrogen bonds. Specify the exponent used in the exponential.", &
417 usage="HB_SR_PARAM {real}", default_r_val=4.0_dp)
418 CALL section_add_keyword(section, keyword)
419 CALL keyword_release(keyword)
420
421 END SUBROUTINE create_dftb_parameter_section
422
423! **************************************************************************************************
424!> \brief ...
425!> \param section ...
426! **************************************************************************************************
427 SUBROUTINE create_xtb_parameter_section(section)
428
429 TYPE(section_type), POINTER :: section
430
431 TYPE(keyword_type), POINTER :: keyword
432
433 cpassert(.NOT. ASSOCIATED(section))
434
435 CALL section_create(section, __location__, name="PARAMETER", &
436 description="Information on and where to find xTB parameters", &
437 n_keywords=1, n_subsections=0, repeats=.false.)
438
439 NULLIFY (keyword)
440 CALL keyword_create(keyword, __location__, name="PARAM_FILE_PATH", &
441 description="Specify the directory with the xTB parameter file. ", &
442 usage="PARAM_FILE_PATH pathname", &
443 n_var=1, type_of_var=char_t, default_c_val="")
444 CALL section_add_keyword(section, keyword)
445 CALL keyword_release(keyword)
446
447 CALL keyword_create(keyword, __location__, name="PARAM_FILE_NAME", &
448 description="Specify file that contains all xTB default parameters. ", &
449 usage="PARAM_FILE_NAME filename", &
450 n_var=1, type_of_var=char_t, default_c_val="xTB_parameters")
451 CALL section_add_keyword(section, keyword)
452 CALL keyword_release(keyword)
453
454 CALL keyword_create(keyword, __location__, name="SPINPOL_PARAM_FILE_NAME", &
455 description="Specify file that contains parameters for "// &
456 "xTB spin polarisation Hamiltonian", &
457 usage="SPINPOL_PARAM_FILE_NAME filename", &
458 n_var=1, type_of_var=char_t, default_c_val="xTB_sp_param_060")
459 CALL section_add_keyword(section, keyword)
460 CALL keyword_release(keyword)
461
462 CALL keyword_create(keyword, __location__, name="DISPERSION_PARAMETER_FILE", &
463 description="Specify file that contains the atomic dispersion "// &
464 "parameters for the D3 method", &
465 usage="DISPERSION_PARAMETER_FILE filename", &
466 n_var=1, type_of_var=char_t, default_c_val="dftd3.dat")
467 CALL section_add_keyword(section, keyword)
468 CALL keyword_release(keyword)
469
470 CALL keyword_create(keyword, __location__, name="DISPERSION_RADIUS", &
471 description="Define radius of dispersion interaction", &
472 usage="DISPERSION_RADIUS", default_r_val=15._dp)
473 CALL section_add_keyword(section, keyword)
474 CALL keyword_release(keyword)
475
476 CALL keyword_create(keyword, __location__, name="COORDINATION_CUTOFF", &
477 description="Define cutoff for coordination number calculation", &
478 usage="COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
479 CALL section_add_keyword(section, keyword)
480 CALL keyword_release(keyword)
481
482 CALL keyword_create(keyword, __location__, name="D3BJ_SCALING", &
483 description="Scaling parameters (s6,s8) for the D3 dispersion method.", &
484 usage="D3BJ_SCALING 1.0 2.4", n_var=2, default_r_vals=[1.0_dp, 2.4_dp])
485 CALL section_add_keyword(section, keyword)
486 CALL keyword_release(keyword)
487
488 CALL keyword_create(keyword, __location__, name="D3BJ_PARAM", &
489 description="Becke-Johnson parameters (a1, a2 for the D3 dispersion method.", &
490 usage="D3BJ_PARAM 0.63 5.0", n_var=2, default_r_vals=[0.63_dp, 5.0_dp])
491 CALL section_add_keyword(section, keyword)
492 CALL keyword_release(keyword)
493
494 CALL keyword_create(keyword, __location__, name="HUCKEL_CONSTANTS", &
495 description="Huckel parameters (s, p, d, sp, 2sH).", &
496 usage="HUCKEL_CONSTANTS 1.85 2.25 2.00 2.08 2.85", n_var=5, &
497 default_r_vals=[1.85_dp, 2.25_dp, 2.00_dp, 2.08_dp, 2.85_dp])
498 CALL section_add_keyword(section, keyword)
499 CALL keyword_release(keyword)
500
501 CALL keyword_create(keyword, __location__, name="COULOMB_CONSTANTS", &
502 description="Scaling parameters for Coulomb interactions (electrons, nuclei).", &
503 usage="COULOMB_CONSTANTS 2.00 1.50", n_var=2, &
504 default_r_vals=[2.00_dp, 1.50_dp])
505 CALL section_add_keyword(section, keyword)
506 CALL keyword_release(keyword)
507
508 CALL keyword_create(keyword, __location__, name="CN_CONSTANTS", &
509 description="Scaling parameters for Coordination number correction term.", &
510 usage="CN_CONSTANTS 0.006 -0.003 -0.005", n_var=3, &
511 default_r_vals=[0.006_dp, -0.003_dp, -0.005_dp])
512 CALL section_add_keyword(section, keyword)
513 CALL keyword_release(keyword)
514
515 CALL keyword_create(keyword, __location__, name="EN_CONSTANTS", &
516 description="Scaling parameters for electronegativity correction term.", &
517 usage="EN_CONSTANTS -0.007 0.000 0.000", n_var=3, &
518 default_r_vals=[-0.007_dp, 0.000_dp, 0.000_dp])
519 CALL section_add_keyword(section, keyword)
520 CALL keyword_release(keyword)
521
522 CALL keyword_create(keyword, __location__, name="BEN_CONSTANT", &
523 description="Scaling parameter for electronegativity correction term.", &
524 usage="BEN_CONSTANT 4.0", n_var=1, &
525 default_r_val=4.0_dp)
526 CALL section_add_keyword(section, keyword)
527 CALL keyword_release(keyword)
528
529 CALL keyword_create(keyword, __location__, name="ENSCALE", &
530 description="Scaling parameter repulsive energy (dEN in exponential).", &
531 usage="ENSCALE 0.01", n_var=1, &
532 default_r_val=0.0_dp)
533 CALL section_add_keyword(section, keyword)
534 CALL keyword_release(keyword)
535
536 CALL keyword_create(keyword, __location__, name="HALOGEN_BINDING", &
537 description="Scaling parameters for electronegativity correction term.", &
538 usage="HALOGEN_BINDING 1.30 0.44", n_var=2, default_r_vals=[1.30_dp, 0.44_dp])
539 CALL section_add_keyword(section, keyword)
540 CALL keyword_release(keyword)
541
542 CALL keyword_create(keyword, __location__, name="KAB_PARAM", &
543 description="Specifies the specific Kab value for types A and B.", &
544 usage="KAB_PARAM kind1 kind2 value ", repeats=.true., &
545 n_var=-1, type_of_var=char_t)
546 CALL section_add_keyword(section, keyword)
547 CALL keyword_release(keyword)
548
549 CALL keyword_create(keyword, __location__, name="SPIN_POL_PARAM", &
550 description="Specifies the spin polarisation parameters for kind A.", &
551 usage="SPIN_POL_PARAM atomtype Wss Wsp Wpp Wsd Wpd Wdd", repeats=.true., &
552 n_var=-1, type_of_var=char_t)
553 CALL section_add_keyword(section, keyword)
554 CALL keyword_release(keyword)
555
556 CALL keyword_create(keyword, __location__, name="XB_RADIUS", &
557 description="Specifies the radius [Bohr] of the XB pair interaction in xTB.", &
558 usage="XB_RADIUS 20.0 ", repeats=.false., &
559 n_var=1, default_r_val=20.0_dp)
560 CALL section_add_keyword(section, keyword)
561 CALL keyword_release(keyword)
562
563 CALL keyword_create(keyword, __location__, name="COULOMB_SR_CUT", &
564 description="Maximum range of short range part of Coulomb interaction.", &
565 usage="COULOMB_SR_CUT 20.0 ", repeats=.false., &
566 n_var=1, default_r_val=20.0_dp)
567 CALL section_add_keyword(section, keyword)
568 CALL keyword_release(keyword)
569
570 CALL keyword_create(keyword, __location__, name="COULOMB_SR_EPS", &
571 description="Cutoff for short range part of Coulomb interaction.", &
572 usage="COULOMB_SR_EPS 1.E-3 ", repeats=.false., &
573 n_var=1, default_r_val=1.0e-03_dp)
574 CALL section_add_keyword(section, keyword)
575 CALL keyword_release(keyword)
576
577 CALL keyword_create(keyword, __location__, name="SRB_PARAMETER", &
578 description="SRB parameters (ksrb, esrb, gscal, c1, c2, shift).", &
579 usage="SRB_PARAMETER -0.0129 3.48 0.51 -1.71 2.11 0.0537", n_var=6, &
580 default_r_vals=[-0.0129_dp, 3.4847_dp, 0.5097_dp, &
581 -1.70549806_dp, 2.10878369_dp, 0.0537_dp])
582 CALL section_add_keyword(section, keyword)
583 CALL keyword_release(keyword)
584
585 END SUBROUTINE create_xtb_parameter_section
586! **************************************************************************************************
587!> \brief ...
588!> \param section ...
589! **************************************************************************************************
590 SUBROUTINE create_xtb_nonbonded_section(section)
591 TYPE(section_type), POINTER :: section
592
593 TYPE(keyword_type), POINTER :: keyword
594 TYPE(section_type), POINTER :: subsection
595
596 cpassert(.NOT. ASSOCIATED(section))
597 CALL section_create(section, __location__, name="NONBONDED", &
598 description="This section specifies the input parameters for NON-BONDED interactions.", &
599 n_keywords=1, n_subsections=0, repeats=.false.)
600 NULLIFY (subsection)
601
602 CALL create_genpot_section(subsection)
603 CALL section_add_subsection(section, subsection)
604 CALL section_release(subsection)
605
606 NULLIFY (keyword)
607 CALL keyword_create(keyword, __location__, name="DX", &
608 description="Parameter used for computing the derivative with the Ridders' method.", &
609 usage="DX <REAL>", default_r_val=0.1_dp, unit_str="bohr")
610 CALL section_add_keyword(section, keyword)
611 CALL keyword_release(keyword)
612
613 CALL keyword_create(keyword, __location__, name="ERROR_LIMIT", &
614 description="Checks that the error in computing the derivative is not larger than "// &
615 "the value set; in case error is larger a warning message is printed.", &
616 usage="ERROR_LIMIT <REAL>", default_r_val=1.0e-12_dp)
617 CALL section_add_keyword(section, keyword)
618 CALL keyword_release(keyword)
619
620 END SUBROUTINE create_xtb_nonbonded_section
621! **************************************************************************************************
622!> \brief Creates the &TBLITE section
623!> \param section the section to create
624!> \author JVP
625! **************************************************************************************************
626 SUBROUTINE create_xtb_tblite_section(section)
627 TYPE(section_type), POINTER :: section
628
629 TYPE(keyword_type), POINTER :: keyword
630 TYPE(section_type), POINTER :: subsection
631
632 cpassert(.NOT. ASSOCIATED(section))
633 CALL section_create(section, __location__, name="TBLITE", &
634 description="Section used to specify options for an xTB computation using tblite. "// &
635 "This section is required when XTB/GFN_TYPE is set to TBLITE. "// &
636 "Periodicity follows SUBSYS/CELL/PERIODIC; the deprecated XTB/DO_EWALD keyword "// &
637 "is read consistently with CP2K-internal xTB for diagnostics/debugging. "// &
638 "Initial densities and restarts are controlled by the regular CP2K SCF settings, "// &
639 "for example DFT/SCF/SCF_GUESS, not by a separate tblite guess in this section. "// &
640 "Spin-polarized CP2K/tblite calculations are selected with the regular DFT/UKS keyword "// &
641 "or its LSD/SPIN_POLARIZED aliases; DFT/MULTIPLICITY sets the number of unpaired "// &
642 "electrons. UKS uses tblite's spin-polarized Hamiltonian; AUTO selects the native tblite "// &
643 "SCC mixer for XTB/GFN_TYPE TBLITE, while SCC_MIXER CP2K mixes both total-charge and "// &
644 "magnetization SCC variables through CP2K's TB charge-mixing infrastructure. Native "// &
645 "tblite SCC convergence follows ACCURACY; SCC_MIXER CP2K follows the regular CP2K "// &
646 "SCF convergence settings such as DFT/SCF/EPS_SCF. With QS/LS_SCF, CP2K disables the "// &
647 "separate SCC-variable mixer and lets LS_SCF optimize the density matrix directly. "// &
648 "The same direct SCC-variable update is available for Gamma-point OT calculations, "// &
649 "where smearing and ADDED_MOS are not supported.", &
650 n_keywords=1, n_subsections=1, repeats=.false., citations=[katbashev2025])
651
652 NULLIFY (keyword)
653 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
654 description="Marks the tblite options section as present. The actual switch to the tblite "// &
655 "backend is XTB/GFN_TYPE TBLITE; this section then collects the numerical model, SCC "// &
656 "mixing, and optional native-reference settings used by that backend.", &
657 lone_keyword_l_val=.true., default_l_val=.false.)
658 CALL section_add_keyword(section, keyword)
659 CALL keyword_release(keyword)
660
661 NULLIFY (keyword)
662 CALL keyword_create(keyword, __location__, name="METHOD", &
663 description="Selects the xTB Hamiltonian model used by tblite. Without PARAM this chooses "// &
664 "one of tblite's built-in parametrizations, including the basis, reference occupations, "// &
665 "repulsion, dispersion, electrostatic, and coordination-number dependent terms. When PARAM "// &
666 "is given, METHOD remains the declared model family that the custom parametrization is "// &
667 "expected to implement and that CP2K uses for method-dependent setup and diagnostics.", &
668 usage="METHOD (GFN1|GFN2|IPEA1)", &
669 enum_c_vals=s2a("GFN1", "GFN2", "IPEA1"), &
670 enum_i_vals=[gfn1xtb, gfn2xtb, ipea1xtb], &
671 enum_desc=s2a("Uses the GFN1-XTB method by Grimme.", &
672 "Uses the GFN2-XTB method by Grimme.", &
673 "Uses the IPEA1 method by Grimme."), &
674 default_i_val=gfn2xtb)
675 CALL section_add_keyword(section, keyword)
676 CALL keyword_release(keyword)
677
678 CALL keyword_create(keyword, __location__, name="PARAM", &
679 description="Custom tblite parametrization file. The file is read by tblite and used to "// &
680 "construct the xTB calculator instead of the built-in parameter table for METHOD. It may "// &
681 "therefore change model constants such as Hamiltonian, repulsion, dispersion, electrostatic, "// &
682 "and coordination-number response parameters. It does not change the CP2K charge, spin, "// &
683 "cell, k-point, or SCF setup. The parametrization must be compatible with the selected "// &
684 "METHOD; CP2K does not reinterpret or validate the physical content of the file.", &
685 usage="PARAM filename", n_var=1, type_of_var=char_t, default_c_val="")
686 CALL section_add_keyword(section, keyword)
687 CALL keyword_release(keyword)
688
689 NULLIFY (keyword)
690 CALL keyword_create(keyword, __location__, name="ACCURACY", &
691 description="Numerical accuracy factor for the CP2K/tblite backend. This scales tblite's "// &
692 "internal accuracy-dependent thresholds. With the native tblite SCC mixer, this is the "// &
693 "user-visible convergence control and corresponds to native tblite's --acc setting. With "// &
694 "SCC_MIXER CP2K, SCF convergence instead follows DFT/SCF/EPS_SCF; ACCURACY still controls "// &
695 "the tblite numerical setup, such as the distance cutoff used to build the xTB basis and "// &
696 "neighbor data. "// &
697 "The default matches native tblite. Smaller values make the calculation tighter and usually "// &
698 "more expensive; larger values loosen the numerical setup and can affect energies, forces, "// &
699 "and stress. Native REFERENCE_CLI diagnostics inherit this value so the production and "// &
700 "external reference calculations use the same accuracy setting.", &
701 usage="ACCURACY 1.0", default_r_val=1.0_dp)
702 CALL section_add_keyword(section, keyword)
703 CALL keyword_release(keyword)
704
705 NULLIFY (keyword)
706 CALL keyword_create(keyword, __location__, name="REFERENCE_CLI", &
707 description="Enable an optional diagnostic comparison against an external native tblite "// &
708 "command line calculation. CP2K writes the current geometry, charge, spin, method, optional "// &
709 "PARAM file, electronic temperature, and requested reference settings to temporary files, "// &
710 "runs the external program, and compares the resulting energy, gradient, and optionally "// &
711 "virial with the CP2K/tblite values. This check is meant for debugging backend consistency, "// &
712 "not for production sampling. The native tblite CLI exposes only an electronic temperature "// &
713 "for the occupation broadening; if CP2K uses another smearing method, the reference run "// &
714 "prints a warning and uses Fermi-Dirac smearing with the CP2K electronic temperature. "// &
715 "If true, the XTB/TBLITE/REFERENCE_CLI section must be present. "// &
716 "The check is also enabled whenever that section is present. It is skipped for CP2K "// &
717 "multi-k-point calculations, because the native tblite CLI does not reproduce CP2K KPOINTS "// &
718 "sampling.", &
719 usage="REFERENCE_CLI", default_l_val=.false., lone_keyword_l_val=.true.)
720 CALL section_add_keyword(section, keyword)
721 CALL keyword_release(keyword)
722
723 NULLIFY (subsection)
724 CALL create_xtb_reference_cli_section(subsection)
725 CALL section_add_subsection(section, subsection)
726 CALL section_release(subsection)
727
728 END SUBROUTINE create_xtb_tblite_section
729
730! **************************************************************************************************
731!> \brief Creates the common &TBLITE_MIXER section for TB SCC-variable mixing.
732!> \param section section to create
733! **************************************************************************************************
734 SUBROUTINE create_tblite_mixer_section(section)
735 TYPE(section_type), POINTER :: section
736
737 TYPE(keyword_type), POINTER :: keyword
738
739 cpassert(.NOT. ASSOCIATED(section))
740 CALL section_create(section, __location__, name="TBLITE_MIXER", &
741 description="Controls tblite's modified Broyden SCC-variable mixer when SCC_MIXER is set "// &
742 "to TBLITE, either explicitly or through AUTO where AUTO selects tblite. The mixer "// &
743 "variables are the self-consistent "// &
744 "xTB/DFTB populations and, for methods that require them, atomic multipoles. ITERATIONS "// &
745 "limits the number of tblite SCC-mixer updates, while MEMORY controls how many previous "// &
746 "Broyden update vectors are retained. These are independent quantities when MEMORY is set "// &
747 "explicitly; otherwise MEMORY follows ITERATIONS, matching the tblite library default. "// &
748 "DAMPING controls the size of the retained population/multipole update. OMEGA0, "// &
749 "MIN_WEIGHT, MAX_WEIGHT, and WEIGHT_FACTOR expose tblite's modified-Broyden weighting "// &
750 "constants. ITERATIONS is the tblite-side SCC-mixer update limit and defaults to the "// &
751 "native tblite value of 250. When SCC_MIXER is explicitly set to TBLITE, CP2K also "// &
752 "sets the regular DFT/SCF/MAX_SCF limit to ITERATIONS so that the tblite SCC cycle is "// &
753 "not truncated by CP2K's default SCF limit. With SCC_MIXER AUTO or CP2K, DFT/SCF/MAX_SCF "// &
754 "keeps its normal CP2K meaning. This section configures the tblite SCC mixer, not the "// &
755 "regular CP2K charge mixer. With SCC_MIXER CP2K, the CP2K-side SCC-variable mixer is "// &
756 "controlled by DFT/SCF/MIXING. With QS/LS_SCF, this section is ignored and CP2K resets "// &
757 "SCC_MIXER to NONE internally, because LS_SCF performs the density-matrix optimization "// &
758 "instead of a separate SCC-variable mixing step. Native tblite "// &
759 "REFERENCE_CLI diagnostics inherit this section. ITERATIONS and SOLVER are representable "// &
760 "by tblite run directly; CP2K reports inherited MEMORY, DAMPING, or Broyden-weight settings "// &
761 "that native tblite CLI cannot reproduce.", &
762 n_keywords=1, repeats=.false.)
763
764 NULLIFY (keyword)
765 CALL keyword_create(keyword, __location__, name="ITERATIONS", &
766 description="Maximum number of tblite SCC-mixer updates. This is the tblite-side SCC "// &
767 "iteration limit, matching native tblite's --iterations setting for reference CLI "// &
768 "diagnostics. For explicit SCC_MIXER TBLITE runs, CP2K synchronizes DFT/SCF/MAX_SCF to "// &
769 "this value. For SCC_MIXER AUTO or CP2K, DFT/SCF/MAX_SCF remains the normal CP2K "// &
770 "SCF-loop iteration limit. ITERATIONS is independent of MEMORY, which controls the "// &
771 "Broyden history length.", &
772 usage="ITERATIONS 250", default_i_val=tblite_mixer_iterations_default)
773 CALL section_add_keyword(section, keyword)
774 CALL keyword_release(keyword)
775
776 CALL keyword_create(keyword, __location__, name="MEMORY", &
777 description="Number of previous modified-Broyden update vectors kept by the tblite SCC "// &
778 "mixer. This is a history length, not an iteration limit. Larger values retain more "// &
779 "history and use more memory; smaller values reduce the history and can be more robust for "// &
780 "difficult SCC cycles. A value of zero means library default: inherit ITERATIONS, as native "// &
781 "tblite does when it constructs the Broyden mixer from calc%max_iter.", &
782 usage="MEMORY 250", default_i_val=tblite_mixer_memory_inherit)
783 CALL section_add_keyword(section, keyword)
784 CALL keyword_release(keyword)
785
786 CALL keyword_create(keyword, __location__, name="SOLVER", &
787 description="Electronic eigensolver selected for native tblite SCC calculations where "// &
788 "tblite owns the electronic solve, and forwarded to native REFERENCE_CLI diagnostics as "// &
789 "tblite run --solver. GVD is tblite's default LAPACK divide-and-conquer generalized "// &
790 "symmetric eigensolver. GVR selects LAPACK's relatively robust generalized symmetric "// &
791 "eigensolver. Production CP2K/tblite calculations still use CP2K's electronic "// &
792 "diagonalization machinery.", &
793 usage="SOLVER (GVD|GVR)", &
794 enum_c_vals=s2a("GVD", "GVR"), &
795 enum_i_vals=[tblite_solver_gvd, tblite_solver_gvr], &
796 enum_desc=s2a("Use LAPACK's divide-and-conquer generalized symmetric eigensolver.", &
797 "Use LAPACK's relatively robust generalized symmetric eigensolver."), &
798 default_i_val=tblite_solver_gvd)
799 CALL section_add_keyword(section, keyword)
800 CALL keyword_release(keyword)
801
802 CALL keyword_create(keyword, __location__, name="DAMPING", &
803 description="Damping parameter for the tblite modified Broyden SCC mixer. It controls the "// &
804 "size of the population/multipole update retained by the native tblite mixer between SCC "// &
805 "iterations. Smaller values damp oscillatory SCC cycles more strongly but may slow "// &
806 "convergence; larger values can accelerate well-behaved cases but may destabilize difficult "// &
807 "ones. For CP2K-internal GFN1-xTB UKS k-point calculations with explicit SCC_MIXER TBLITE, "// &
808 "CP2K uses a conservative damping of 0.25 unless DAMPING is set explicitly.", &
809 usage="DAMPING 0.4", default_r_val=tblite_mixer_damping_default)
810 CALL section_add_keyword(section, keyword)
811 CALL keyword_release(keyword)
812
813 CALL keyword_create(keyword, __location__, name="OMEGA0", &
814 description="Regularization weight added to the diagonal of tblite's modified-Broyden "// &
815 "linear system. The default matches the hard-coded value in native tblite and damps nearly "// &
816 "singular history updates without changing the first simple-damping step.", &
817 usage="OMEGA0 0.01", default_r_val=tblite_mixer_omega0_default)
818 CALL section_add_keyword(section, keyword)
819 CALL keyword_release(keyword)
820
821 CALL keyword_create(keyword, __location__, name="MIN_WEIGHT", &
822 description="Lower bound for the dynamic Broyden history weight derived from the current "// &
823 "SCC residual. The default matches native tblite and prevents tiny weights from removing "// &
824 "history vectors from the update.", &
825 usage="MIN_WEIGHT 1.0", default_r_val=tblite_mixer_min_weight_default)
826 CALL section_add_keyword(section, keyword)
827 CALL keyword_release(keyword)
828
829 CALL keyword_create(keyword, __location__, name="MAX_WEIGHT", &
830 description="Upper bound for the dynamic Broyden history weight derived from the current "// &
831 "SCC residual. The default matches native tblite and caps the influence of very small "// &
832 "residual norms.", &
833 usage="MAX_WEIGHT 100000.0", default_r_val=tblite_mixer_max_weight_default)
834 CALL section_add_keyword(section, keyword)
835 CALL keyword_release(keyword)
836
837 CALL keyword_create(keyword, __location__, name="WEIGHT_FACTOR", &
838 description="Residual-to-weight scaling factor used by tblite's modified Broyden mixer. "// &
839 "For a residual norm above WEIGHT_FACTOR/MAX_WEIGHT, the dynamic weight is approximately "// &
840 "WEIGHT_FACTOR divided by that residual norm; otherwise MAX_WEIGHT is used before applying "// &
841 "MIN_WEIGHT. The default matches native tblite.", &
842 usage="WEIGHT_FACTOR 0.01", default_r_val=tblite_mixer_weight_factor_default)
843 CALL section_add_keyword(section, keyword)
844 CALL keyword_release(keyword)
845
846 END SUBROUTINE create_tblite_mixer_section
847
848! **************************************************************************************************
849!> \brief Adds common SCC-mixer keywords for TB methods.
850!> \param section section receiving the keywords
851!> \param TARGET method/path description for the manual text
852!> \param auto_desc AUTO behavior for this section
853! **************************************************************************************************
854 SUBROUTINE add_tb_scc_mixer_keywords(section, TARGET, auto_desc)
855 TYPE(section_type), POINTER :: section
856 CHARACTER(LEN=*), INTENT(IN) :: target, auto_desc
857
858 TYPE(keyword_type), POINTER :: keyword
859
860 NULLIFY (keyword)
861 CALL keyword_create(keyword, __location__, name="SCC_MIXER", &
862 description="Selects the SCC variable mixer for "//TARGET//" calculations. "// &
863 auto_desc//" The SCC variables are the model populations and, where required by the "// &
864 "selected method, atomic multipoles that feed the self-consistent xTB potential. TBLITE "// &
865 "uses tblite's modified Broyden mixer for those variables inside the CP2K SCF cycle. CP2K "// &
866 "maps the variables onto CP2K's charge-mixing infrastructure. When TBLITE is active, the "// &
867 "native SCC convergence follows XTB/TBLITE/ACCURACY and the tblite-side SCC update limit "// &
868 "follows TBLITE_MIXER/ITERATIONS. If SCC_MIXER is explicitly set to TBLITE, CP2K also "// &
869 "sets DFT/SCF/MAX_SCF to TBLITE_MIXER/ITERATIONS. With SCC_MIXER AUTO or CP2K, MAX_SCF "// &
870 "keeps its normal CP2K meaning. With QS/LS_SCF, explicit SCC_MIXER settings are reset to "// &
871 "NONE internally and CP2K emits a warning; LS_SCF controls the density-matrix optimization. "// &
872 "When CP2K is active, convergence follows the normal CP2K SCF "// &
873 "controls, in particular DFT/SCF/EPS_SCF and DFT/SCF/MIXING. For GFN2/tblite, the CP2K "// &
874 "mixer acts on the full SCC-variable set: shell charges plus atomic dipole and quadrupole "// &
875 "variables. CP2K-internal GFN0-xTB has no SCC variables to mix, so AUTO and NONE are "// &
876 "equivalent there and explicit CP2K or TBLITE mixer choices are reset to NONE. For "// &
877 "CP2K-internal GFN1 and DFTB/DFTB3, the SCC variables are only charge or shell-charge like. The "// &
878 "initial SCC variables are seeded from CP2K's current density, so DFT/SCF/SCF_GUESS and "// &
879 "DFT/WFN_RESTART_FILE_NAME define the starting point. NONE performs direct updates without "// &
880 "mixing and is intended for debugging, since it can be unstable.", &
881 usage="SCC_MIXER (AUTO|TBLITE|CP2K|NONE)", &
882 enum_c_vals=s2a("AUTO", "TBLITE", "CP2K", "NONE"), &
885 enum_desc=s2a("Default method-dependent choice.", &
886 "Use the tblite modified Broyden SCC mixer.", &
887 "Use CP2K charge mixing for SCC variables.", &
888 "Do not mix SCC variables; for debugging."), &
889 default_i_val=tblite_scc_mixer_auto)
890 CALL section_add_keyword(section, keyword)
891 CALL keyword_release(keyword)
892
893 END SUBROUTINE add_tb_scc_mixer_keywords
894
895! **************************************************************************************************
896!> \brief Creates the &REFERENCE_CLI section used to compare against native tblite.
897!> \param section the section to create
898! **************************************************************************************************
899 SUBROUTINE create_xtb_reference_cli_section(section)
900 TYPE(section_type), POINTER :: section
901
902 TYPE(keyword_type), POINTER :: keyword
903 TYPE(section_type), POINTER :: subsection
904
905 cpassert(.NOT. ASSOCIATED(section))
906 CALL section_create(section, __location__, name="REFERENCE_CLI", &
907 description="Run the native tblite command line interface as a reference "// &
908 "for CP2K/tblite energies, nuclear gradients, and optionally virials. "// &
909 "The section is a lone section: if it is present, the reference check is enabled. By default "// &
910 "the native CLI calculation inherits the CP2K/tblite method, PARAM file, ACCURACY, charge, "// &
911 "spin state, spin-polarized Hamiltonian setting, electronic temperature, "// &
912 "TBLITE_MIXER/ITERATIONS, and TBLITE_MIXER/SOLVER from the surrounding input. CP2K forwards "// &
913 "DFT/UKS, including its LSD and SPIN_POLARIZED aliases, as native tblite "// &
914 "--spin-polarized; DFT/MULTIPLICITY is forwarded separately as --spin. "// &
915 "REFERENCE_CLI/EFIELD can add a homogeneous electric field to the "// &
916 "external native tblite command only. REFERENCE_CLI/IMPLICIT_SOLVATION can add native "// &
917 "tblite implicit-solvent settings to the external reference command only. "// &
918 "Native tblite run does not expose independent options for mixer MEMORY, DAMPING, OMEGA0, "// &
919 "MIN_WEIGHT, MAX_WEIGHT, or WEIGHT_FACTOR; CP2K warns if these inherited production settings "// &
920 "cannot be reproduced and aborts when STOP_ON_ERROR is enabled. "// &
921 "Native CLI verbosity follows GLOBAL/PRINT_LEVEL: SILENT is forwarded as --silent, and "// &
922 "HIGH or DEBUG are forwarded as --verbose. "// &
923 "It remains a diagnostic one-shot calculation from temporary input files and is independent "// &
924 "of CP2K's SCF history, diagonalization, and k-point machinery. If RESTART "// &
925 "is set, the named native tblite restart file is passed to the external command. Non-Fermi "// &
926 "CP2K smearing methods cannot be represented by native tblite and are replaced by a "// &
927 "Fermi-Dirac electronic temperature in the reference command with an explicit warning.", &
928 n_keywords=1, n_subsections=0, repeats=.false.)
929
930 NULLIFY (keyword)
931 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
932 description="Activates the native tblite CLI reference check when the section is present. "// &
933 "The check compares CP2K/tblite against a freshly executed external tblite calculation.", &
934 lone_keyword_l_val=.true., default_l_val=.false.)
935 CALL section_add_keyword(section, keyword)
936 CALL keyword_release(keyword)
937
938 CALL keyword_create(keyword, __location__, name="PROGRAM_NAME", &
939 description="Executable name or path for the native tblite command line program used for "// &
940 "the reference calculation. This allows testing the CP2K/tblite implementation against a "// &
941 "specific tblite build without changing the CP2K executable.", &
942 usage="PROGRAM_NAME tblite", n_var=1, type_of_var=char_t, default_c_val="tblite")
943 CALL section_add_keyword(section, keyword)
944 CALL keyword_release(keyword)
945
946 CALL keyword_create(keyword, __location__, name="GUESS", &
947 description="Initial population guess used only for the native tblite reference command. "// &
948 "SAD uses the superposition of atomic densities, matching the default of tblite run. EEQ "// &
949 "uses electronegativity equilibration charges, while CEH uses the charge-equilibration "// &
950 "Hamiltonian guess. This keyword does not affect the production CP2K/tblite calculation; "// &
951 "there, initial densities and restarts remain controlled by CP2K's SCF machinery.", &
952 usage="GUESS (SAD|EEQ|CEH)", &
953 enum_c_vals=s2a("SAD", "EEQ", "CEH"), &
955 enum_desc=s2a("Use the superposition of atomic densities guess.", &
956 "Use the electronegativity equilibration guess.", &
957 "Use the charge-equilibration Hamiltonian guess."), &
958 default_i_val=tblite_guess_sad)
959 CALL section_add_keyword(section, keyword)
960 CALL keyword_release(keyword)
961
962 CALL keyword_create(keyword, __location__, name="WORK_DIRECTORY", &
963 description="Directory used for the temporary native tblite CLI input and output files. "// &
964 "The CP2K/tblite result is not taken from this directory; the files are only used to run and "// &
965 "inspect the independent reference calculation.", &
966 usage="WORK_DIRECTORY .", n_var=1, type_of_var=char_t, default_c_val=".")
967 CALL section_add_keyword(section, keyword)
968 CALL keyword_release(keyword)
969
970 CALL keyword_create(keyword, __location__, name="PREFIX", &
971 description="Prefix for the temporary native tblite CLI input and output files. Changing "// &
972 "the prefix is useful when several reference checks are run in the same directory or when "// &
973 "KEEP_FILES is used to inspect the generated geometry, gradient, JSON, or log files.", &
974 usage="PREFIX tblite-reference", n_var=1, type_of_var=char_t, &
975 default_c_val="tblite-reference")
976 CALL section_add_keyword(section, keyword)
977 CALL keyword_release(keyword)
978
979 CALL keyword_create(keyword, __location__, name="INPUT_FORMAT", &
980 description="Input format hint passed to native tblite run as --input. The default is GEN, "// &
981 "matching the temporary DFTB+ GEN geometry written by CP2K for the reference calculation. "// &
982 "Only change this together with a compatible externally inspected or modified input file "// &
983 "workflow; the normal CP2K-generated reference geometry is GEN.", &
984 usage="INPUT_FORMAT gen", n_var=1, type_of_var=char_t, default_c_val="gen")
985 CALL section_add_keyword(section, keyword)
986 CALL keyword_release(keyword)
987
988 CALL keyword_create(keyword, __location__, name="RESTART", &
989 description="Native tblite restart file passed to the external reference command. When this "// &
990 "keyword is absent, CP2K passes --no-restart so each diagnostic reference is a clean one-shot "// &
991 "run from the generated geometry and selected CLI options. When a filename is given, CP2K "// &
992 "passes --restart with that file. This affects only the external native tblite run; it does "// &
993 "not read or write CP2K wavefunction or density restart data and is therefore independent of "// &
994 "DFT/SCF/SCF_GUESS RESTART.", &
995 usage="RESTART filename", n_var=1, type_of_var=char_t, default_c_val="")
996 CALL section_add_keyword(section, keyword)
997 CALL keyword_release(keyword)
998
999 CALL keyword_create(keyword, __location__, name="POST_PROCESSING", &
1000 description="Additional native tblite post-SCF analysis passed as tblite run "// &
1001 "--post-processing. The value can be a built-in post-processing module name or a TOML file. "// &
1002 "Native tblite already enables Mayer-Wiberg bond-order analysis internally by default. "// &
1003 "The additional built-in module names currently exposed by tblite include molmom for "// &
1004 "molecular moments and xtbml for xTB-ML descriptors. If the value names a TOML file, tblite "// &
1005 "reads its [post-processing] configuration and can select the post-processing modules more "// &
1006 "finely. This keyword affects only the external REFERENCE_CLI diagnostic run; CP2K does not "// &
1007 "parse the generated post-processing data for the energy/force/virial comparison.", &
1008 usage="POST_PROCESSING molmom", n_var=1, type_of_var=char_t, default_c_val="")
1009 CALL section_add_keyword(section, keyword)
1010 CALL keyword_release(keyword)
1011
1012 CALL keyword_create(keyword, __location__, name="POST_PROCESSING_OUTPUT", &
1013 description="Filename passed to native tblite as --post-processing-output. Native tblite "// &
1014 "documents this as the NPZ output file for post-processing data, with tblite-data.npz as its "// &
1015 "CLI default. In the locally checked tblite 0.5.0 source this option appears in the help text "// &
1016 "but is not wired in the command-line parser, so CP2K emits it only when explicitly requested "// &
1017 "and prints a warning before running the reference command. Use this keyword only with tblite "// &
1018 "CLI builds that actually accept the option. Unless KEEP_FILES is enabled, CP2K removes this "// &
1019 "explicit output file after the reference check.", &
1020 usage="POST_PROCESSING_OUTPUT tblite-data.npz", n_var=1, type_of_var=char_t, &
1021 default_c_val="", lone_keyword_c_val="tblite-data.npz")
1022 CALL section_add_keyword(section, keyword)
1023 CALL keyword_release(keyword)
1024
1025 CALL keyword_create(keyword, __location__, name="GRAD", &
1026 description="Filename passed to native tblite as --grad for the tagged ASCII gradient output. "// &
1027 "The native file contains the total energy, energy contributions, analytical molecular "// &
1028 "gradient, and virial. CP2K reads this file for the REFERENCE_CLI energy, force, and virial "// &
1029 "checks. If the keyword is omitted, CP2K writes a temporary PREFIX.grad file in "// &
1030 "WORK_DIRECTORY. If the keyword is present without a filename, CP2K uses tblite's CLI default "// &
1031 "name tblite.txt. Unless KEEP_FILES is enabled, CP2K removes the selected file after the "// &
1032 "reference check.", &
1033 usage="GRAD tblite.txt", n_var=1, type_of_var=char_t, default_c_val="", &
1034 lone_keyword_c_val="tblite.txt")
1035 CALL section_add_keyword(section, keyword)
1036 CALL keyword_release(keyword)
1037
1038 CALL keyword_create(keyword, __location__, name="JSON", &
1039 description="Filename passed to native tblite as --json for JSON result output. Without "// &
1040 "--grad the native JSON usually contains the energy and energy contributions; because CP2K's "// &
1041 "REFERENCE_CLI path also requests --grad, native tblite can additionally include derivative "// &
1042 "data such as gradient and virial when supported by the CLI version. CP2K currently reads the "// &
1043 "tagged GRAD file for comparisons and keeps the JSON file as an inspectable native artifact. "// &
1044 "If the keyword is omitted, CP2K writes a temporary PREFIX.json file in WORK_DIRECTORY. If the "// &
1045 "keyword is present without a filename, CP2K uses tblite's CLI default name tblite.json. "// &
1046 "Unless KEEP_FILES is enabled, CP2K removes the selected file after the reference check.", &
1047 usage="JSON tblite.json", n_var=1, type_of_var=char_t, default_c_val="", &
1048 lone_keyword_c_val="tblite.json")
1049 CALL section_add_keyword(section, keyword)
1050 CALL keyword_release(keyword)
1051
1052 CALL keyword_create(keyword, __location__, name="ELECTRONIC_TEMPERATURE_GUESS", &
1053 description="Electronic temperature used only for the native tblite reference command's "// &
1054 "initial CEH population guess. CP2K forwards positive values as tblite run "// &
1055 "--etemp-guess. The value does not affect CP2K/tblite production calculations and is "// &
1056 "independent of DFT/SCF/SMEAR/ELECTRONIC_TEMPERATURE, which controls the final electronic "// &
1057 "occupation temperature passed as --etemp. A value of zero leaves the native tblite default "// &
1058 "for the guess temperature untouched. Positive values are valid only together with GUESS CEH; "// &
1059 "CP2K aborts for SAD or EEQ because native tblite uses this option for the CEH guess.", &
1060 usage="ELECTRONIC_TEMPERATURE_GUESS [K] 4000", &
1061 default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), unit_str="K")
1062 CALL section_add_keyword(section, keyword)
1063 CALL keyword_release(keyword)
1064
1065 CALL keyword_create(keyword, __location__, name="EFIELD", &
1066 description="Homogeneous electric field passed only to the native tblite reference command "// &
1067 "as tblite run --efield. The three components are given in V/Angstrom, matching the native "// &
1068 "tblite CLI convention. This keyword does not affect the production CP2K/tblite "// &
1069 "calculation because that path currently does not construct tblite's external electric "// &
1070 "field container. If enabled together with energy, force, or virial checks, the comparison "// &
1071 "therefore intentionally diagnoses the native field response rather than matching a CP2K "// &
1072 "production field calculation.", &
1073 usage="EFIELD 0.0 0.0 0.0", repeats=.false., n_var=3, type_of_var=real_t, &
1074 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
1075 CALL section_add_keyword(section, keyword)
1076 CALL keyword_release(keyword)
1077
1078 CALL keyword_create(keyword, __location__, name="KEEP_FILES", &
1079 description="Keep the temporary native tblite CLI input and output files after the "// &
1080 "comparison. This is mainly a debugging aid for inspecting the generated GEN geometry, the "// &
1081 "native tblite gradient/virial file, the JSON output, and the CLI log.", &
1082 usage="KEEP_FILES T", default_l_val=.false., lone_keyword_l_val=.true.)
1083 CALL section_add_keyword(section, keyword)
1084 CALL keyword_release(keyword)
1085
1086 CALL keyword_create(keyword, __location__, name="ERROR_LIMIT", &
1087 description="Tolerance for reporting reference CLI deviations. The value is applied to the "// &
1088 "absolute CP2K-minus-native differences printed by the enabled energy, force, and virial "// &
1089 "checks. Exceeding this limit produces a diagnostic warning, or an abort when STOP_ON_ERROR "// &
1090 "is enabled.", &
1091 usage="ERROR_LIMIT 1.0E-8", default_r_val=1.0e-8_dp)
1092 CALL section_add_keyword(section, keyword)
1093 CALL keyword_release(keyword)
1094
1095 CALL keyword_create(keyword, __location__, name="STOP_ON_ERROR", &
1096 description="Abort the CP2K run if any enabled reference CLI comparison exceeds "// &
1097 "ERROR_LIMIT. When disabled, CP2K prints the deviation but continues, which is useful for "// &
1098 "exploratory diagnostics and regression-test probes.", &
1099 usage="STOP_ON_ERROR T", default_l_val=.false., lone_keyword_l_val=.true.)
1100 CALL section_add_keyword(section, keyword)
1101 CALL keyword_release(keyword)
1102
1103 CALL keyword_create(keyword, __location__, name="CHECK_ENERGY", &
1104 description="Compare the CP2K/tblite total xTB energy with the energy obtained from the "// &
1105 "native tblite reference run. This checks the Hamiltonian setup, SCC solution, static "// &
1106 "repulsion/dispersion terms, charge and spin state, electronic temperature, and optional "// &
1107 "PARAM file consistency for the one-shot reference geometry.", &
1108 usage="CHECK_ENERGY T", default_l_val=.true., lone_keyword_l_val=.true.)
1109 CALL section_add_keyword(section, keyword)
1110 CALL keyword_release(keyword)
1111
1112 CALL keyword_create(keyword, __location__, name="CHECK_FORCES", &
1113 description="Compare CP2K/tblite nuclear gradients with the gradients written by the "// &
1114 "native tblite reference run. This is a sensitive check of derivative terms, including "// &
1115 "repulsion, dispersion, electrostatic response, and coordination-number response. The "// &
1116 "comparison uses the same geometry and model setup as the energy reference.", &
1117 usage="CHECK_FORCES T", default_l_val=.true., lone_keyword_l_val=.true.)
1118 CALL section_add_keyword(section, keyword)
1119 CALL keyword_release(keyword)
1120
1121 CALL keyword_create(keyword, __location__, name="CHECK_VIRIAL", &
1122 description="Compare CP2K/tblite virial with the virial written by the native tblite "// &
1123 "reference run. This is a diagnostic for cell derivatives and stress-related terms. It is "// &
1124 "disabled by default because virial conventions, finite periodicity, and the absence of "// &
1125 "native CLI k-point sampling make this comparison more restrictive than the energy and "// &
1126 "force checks.", &
1127 usage="CHECK_VIRIAL T", default_l_val=.false., lone_keyword_l_val=.true.)
1128 CALL section_add_keyword(section, keyword)
1129 CALL keyword_release(keyword)
1130
1131 NULLIFY (subsection)
1132 CALL create_xtb_reference_cli_guess_section(subsection)
1133 CALL section_add_subsection(section, subsection)
1134 CALL section_release(subsection)
1135
1136 NULLIFY (subsection)
1137 CALL create_xtb_reference_cli_param_section(subsection)
1138 CALL section_add_subsection(section, subsection)
1139 CALL section_release(subsection)
1140
1141 NULLIFY (subsection)
1142 CALL create_xtb_reference_cli_fit_section(subsection)
1143 CALL section_add_subsection(section, subsection)
1144 CALL section_release(subsection)
1145
1146 NULLIFY (subsection)
1147 CALL create_xtb_reference_cli_tagdiff_section(subsection)
1148 CALL section_add_subsection(section, subsection)
1149 CALL section_release(subsection)
1150
1151 NULLIFY (subsection)
1152 CALL create_xtb_reference_cli_solvation_section(subsection)
1153 CALL section_add_subsection(section, subsection)
1154 CALL section_release(subsection)
1155
1156 END SUBROUTINE create_xtb_reference_cli_section
1157
1158! **************************************************************************************************
1159!> \brief Creates the &REFERENCE_CLI%GUESS_CLI section for native tblite guess.
1160!> \param section section to create
1161! **************************************************************************************************
1162 SUBROUTINE create_xtb_reference_cli_guess_section(section)
1163 TYPE(section_type), POINTER :: section
1164
1165 TYPE(keyword_type), POINTER :: keyword
1166
1167 cpassert(.NOT. ASSOCIATED(section))
1168 CALL section_create(section, __location__, name="GUESS_CLI", &
1169 description="Run the native tblite guess subcommand as an auxiliary REFERENCE_CLI "// &
1170 "diagnostic. The command executes tblite guess on the generated GEN geometry by default and "// &
1171 "prints the initializing charges and dipole moments. CP2K forwards the surrounding charge "// &
1172 "and multiplicity as native --charge and --spin. GLOBAL/PRINT_LEVEL controls native "// &
1173 "--silent or --verbose exactly as for the main REFERENCE_CLI run command. This section is "// &
1174 "diagnostic only; CP2K does not use the generated guess data to seed the production "// &
1175 "calculation.", &
1176 n_keywords=1, n_subsections=0, repeats=.false.)
1177
1178 NULLIFY (keyword)
1179 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
1180 description="Activates the native tblite guess auxiliary command when the section is "// &
1181 "present.", lone_keyword_l_val=.true., default_l_val=.false.)
1182 CALL section_add_keyword(section, keyword)
1183 CALL keyword_release(keyword)
1184
1185 CALL keyword_create(keyword, __location__, name="METHOD", &
1186 description="Initial-population method passed to native tblite guess as --method. SAD uses "// &
1187 "superposed atomic densities, EEQ uses electronegativity equilibration, and CEH uses the "// &
1188 "charge-extended Huckel guess. The default matches native tblite guess.", &
1189 usage="METHOD (SAD|EEQ|CEH)", &
1190 enum_c_vals=s2a("SAD", "EEQ", "CEH"), &
1192 enum_desc=s2a("Use the superposition of atomic densities guess.", &
1193 "Use the electronegativity equilibration guess.", &
1194 "Use the charge-extended Huckel guess."), &
1195 default_i_val=tblite_guess_ceh)
1196 CALL section_add_keyword(section, keyword)
1197 CALL keyword_release(keyword)
1198
1199 CALL keyword_create(keyword, __location__, name="ELECTRONIC_TEMPERATURE_GUESS", &
1200 description="Electronic temperature for native tblite guess --etemp-guess. This option is "// &
1201 "used by the CEH guess in native tblite. A value of zero leaves tblite's own default "// &
1202 "untouched.", usage="ELECTRONIC_TEMPERATURE_GUESS [K] 4000", &
1203 default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), unit_str="K")
1204 CALL section_add_keyword(section, keyword)
1205 CALL keyword_release(keyword)
1206
1207 CALL keyword_create(keyword, __location__, name="SOLVER", &
1208 description="Electronic solver passed to native tblite guess as --solver. GVD is the "// &
1209 "default generalized eigenvalue decomposition solver; GVR selects the alternative solver "// &
1210 "exposed by tblite.", usage="SOLVER (GVD|GVR)", &
1211 enum_c_vals=s2a("GVD", "GVR"), enum_i_vals=[tblite_solver_gvd, tblite_solver_gvr], &
1212 enum_desc=s2a("Use the GVD electronic solver.", "Use the GVR electronic solver."), &
1213 default_i_val=tblite_solver_gvd)
1214 CALL section_add_keyword(section, keyword)
1215 CALL keyword_release(keyword)
1216
1217 CALL keyword_create(keyword, __location__, name="EFIELD", &
1218 description="Homogeneous electric field passed to native tblite guess as --efield. The "// &
1219 "three components are given in V/Angstrom, matching native tblite.", &
1220 usage="EFIELD 0.0 0.0 0.0", repeats=.false., n_var=3, type_of_var=real_t, &
1221 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
1222 CALL section_add_keyword(section, keyword)
1223 CALL keyword_release(keyword)
1224
1225 CALL keyword_create(keyword, __location__, name="GRAD", &
1226 description="Request native tblite guess --grad, evaluating the analytic gradient of the "// &
1227 "guessed charges.", usage="GRAD T", default_l_val=.false., lone_keyword_l_val=.true.)
1228 CALL section_add_keyword(section, keyword)
1229 CALL keyword_release(keyword)
1230
1231 CALL keyword_create(keyword, __location__, name="JSON", &
1232 description="Filename passed to native tblite guess as --json. If the keyword is present "// &
1233 "without a filename, CP2K uses tblite's CLI default name tblite.json. If omitted, CP2K does "// &
1234 "not request JSON output for the auxiliary guess command.", &
1235 usage="JSON tblite.json", n_var=1, type_of_var=char_t, default_c_val="", &
1236 lone_keyword_c_val="tblite.json")
1237 CALL section_add_keyword(section, keyword)
1238 CALL keyword_release(keyword)
1239
1240 CALL keyword_create(keyword, __location__, name="INPUT_FORMAT", &
1241 description="Input format hint passed to native tblite guess as --input. The default is GEN, "// &
1242 "matching the temporary DFTB+ GEN geometry written by CP2K for the enclosing reference "// &
1243 "calculation.", &
1244 usage="INPUT_FORMAT gen", n_var=1, type_of_var=char_t, default_c_val="gen")
1245 CALL section_add_keyword(section, keyword)
1246 CALL keyword_release(keyword)
1247
1248 CALL keyword_create(keyword, __location__, name="INPUT_FILE", &
1249 description="Positional input structure for native tblite guess. The file format must match "// &
1250 "GUESS_CLI/INPUT_FORMAT. If omitted, CP2K uses the temporary GEN geometry written for the "// &
1251 "enclosing REFERENCE_CLI calculation.", &
1252 usage="INPUT_FILE structure.gen", n_var=1, type_of_var=char_t, default_c_val="")
1253 CALL section_add_keyword(section, keyword)
1254 CALL keyword_release(keyword)
1255
1256 END SUBROUTINE create_xtb_reference_cli_guess_section
1257
1258! **************************************************************************************************
1259!> \brief Creates the &REFERENCE_CLI%PARAM_CLI section for native tblite param.
1260!> \param section section to create
1261! **************************************************************************************************
1262 SUBROUTINE create_xtb_reference_cli_param_section(section)
1263 TYPE(section_type), POINTER :: section
1264
1265 TYPE(keyword_type), POINTER :: keyword
1266
1267 cpassert(.NOT. ASSOCIATED(section))
1268 CALL section_create(section, __location__, name="PARAM_CLI", &
1269 description="Run the native tblite param subcommand as an auxiliary REFERENCE_CLI "// &
1270 "diagnostic. The command inspects, imports, exports, or converts tblite parameter data. "// &
1271 "If no INPUT_FILE is supplied, CP2K selects the surrounding XTB/TBLITE/METHOD as native "// &
1272 "--method. If METHOD is specified here, it overrides only this auxiliary command.", &
1273 n_keywords=1, n_subsections=0, repeats=.false.)
1274
1275 NULLIFY (keyword)
1276 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
1277 description="Activates the native tblite param auxiliary command when the section is "// &
1278 "present.", lone_keyword_l_val=.true., default_l_val=.false.)
1279 CALL section_add_keyword(section, keyword)
1280 CALL keyword_release(keyword)
1281
1282 CALL keyword_create(keyword, __location__, name="METHOD", &
1283 description="Base parametrization passed to native tblite param as --method. If omitted, "// &
1284 "CP2K uses the surrounding XTB/TBLITE/METHOD.", &
1285 usage="METHOD (GFN1|GFN2|IPEA1)", &
1286 enum_c_vals=s2a("GFN1", "GFN2", "IPEA1"), &
1287 enum_i_vals=[gfn1xtb, gfn2xtb, ipea1xtb], &
1288 enum_desc=s2a("Use the GFN1-xTB base parametrization.", &
1289 "Use the GFN2-xTB base parametrization.", &
1290 "Use the IPEA1 base parametrization."), &
1291 default_i_val=gfn2xtb)
1292 CALL section_add_keyword(section, keyword)
1293 CALL keyword_release(keyword)
1294
1295 CALL keyword_create(keyword, __location__, name="OUTPUT", &
1296 description="Output parameter file passed to native tblite param as --output. If omitted, "// &
1297 "native tblite writes to its default stream or file for the selected operation.", &
1298 usage="OUTPUT parameters.toml", n_var=1, type_of_var=char_t, default_c_val="")
1299 CALL section_add_keyword(section, keyword)
1300 CALL keyword_release(keyword)
1301
1302 CALL keyword_create(keyword, __location__, name="INPUT_FILE", &
1303 description="Optional positional input parameter file for native tblite param. If omitted, "// &
1304 "the command operates on the selected built-in METHOD.", &
1305 usage="INPUT_FILE parameters.toml", n_var=1, type_of_var=char_t, default_c_val="")
1306 CALL section_add_keyword(section, keyword)
1307 CALL keyword_release(keyword)
1308
1309 END SUBROUTINE create_xtb_reference_cli_param_section
1310
1311! **************************************************************************************************
1312!> \brief Creates the &REFERENCE_CLI%FIT_CLI section for native tblite fit.
1313!> \param section section to create
1314! **************************************************************************************************
1315 SUBROUTINE create_xtb_reference_cli_fit_section(section)
1316 TYPE(section_type), POINTER :: section
1317
1318 TYPE(keyword_type), POINTER :: keyword
1319
1320 cpassert(.NOT. ASSOCIATED(section))
1321 CALL section_create(section, __location__, name="FIT_CLI", &
1322 description="Run the native tblite fit subcommand as an auxiliary REFERENCE_CLI diagnostic. "// &
1323 "The command optimizes or dry-runs tblite parameters from a starting PARAM_FILE and a fit "// &
1324 "settings INPUT_FILE. Because native fitting can be expensive and writes its own outputs, "// &
1325 "the section is inactive unless explicitly present.", &
1326 n_keywords=1, n_subsections=0, repeats=.false.)
1327
1328 NULLIFY (keyword)
1329 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
1330 description="Activates the native tblite fit auxiliary command when the section is present.", &
1331 lone_keyword_l_val=.true., default_l_val=.false.)
1332 CALL section_add_keyword(section, keyword)
1333 CALL keyword_release(keyword)
1334
1335 CALL keyword_create(keyword, __location__, name="PARAM_FILE", &
1336 description="Starting parameter file passed as the first positional argument to native "// &
1337 "tblite fit.", usage="PARAM_FILE start.toml", n_var=1, type_of_var=char_t, default_c_val="")
1338 CALL section_add_keyword(section, keyword)
1339 CALL keyword_release(keyword)
1340
1341 CALL keyword_create(keyword, __location__, name="INPUT_FILE", &
1342 description="Fit-settings input file passed as the second positional argument to native "// &
1343 "tblite fit.", usage="INPUT_FILE fit.toml", n_var=1, type_of_var=char_t, default_c_val="")
1344 CALL section_add_keyword(section, keyword)
1345 CALL keyword_release(keyword)
1346
1347 CALL keyword_create(keyword, __location__, name="DRY_RUN", &
1348 description="Pass native tblite fit --dry-run. This expands and checks the fit setup "// &
1349 "without starting the optimization.", usage="DRY_RUN T", default_l_val=.false., &
1350 lone_keyword_l_val=.true.)
1351 CALL section_add_keyword(section, keyword)
1352 CALL keyword_release(keyword)
1353
1354 CALL keyword_create(keyword, __location__, name="COPY", &
1355 description="Filename passed to native tblite fit as --copy. Native tblite writes the full "// &
1356 "representation of the fit input to this file, with defaults filled in and masks expanded.", &
1357 usage="COPY expanded-fit.toml", n_var=1, type_of_var=char_t, default_c_val="")
1358 CALL section_add_keyword(section, keyword)
1359 CALL keyword_release(keyword)
1360
1361 END SUBROUTINE create_xtb_reference_cli_fit_section
1362
1363! **************************************************************************************************
1364!> \brief Creates the &REFERENCE_CLI%TAGDIFF_CLI section for native tblite tagdiff.
1365!> \param section section to create
1366! **************************************************************************************************
1367 SUBROUTINE create_xtb_reference_cli_tagdiff_section(section)
1368 TYPE(section_type), POINTER :: section
1369
1370 TYPE(keyword_type), POINTER :: keyword
1371
1372 cpassert(.NOT. ASSOCIATED(section))
1373 CALL section_create(section, __location__, name="TAGDIFF_CLI", &
1374 description="Run the native tblite tagdiff auxiliary command. It compares an ACTUAL tagged "// &
1375 "data file against a REFERENCE tagged data file and reports differences using the keys from "// &
1376 "the reference file.", n_keywords=1, n_subsections=0, repeats=.false.)
1377
1378 NULLIFY (keyword)
1379 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
1380 description="Activates the native tblite tagdiff auxiliary command when the section is "// &
1381 "present.", lone_keyword_l_val=.true., default_l_val=.false.)
1382 CALL section_add_keyword(section, keyword)
1383 CALL keyword_release(keyword)
1384
1385 CALL keyword_create(keyword, __location__, name="ACTUAL", &
1386 description="Actual tagged data file passed as the first positional argument to native "// &
1387 "tblite tagdiff.", usage="ACTUAL actual.tag", n_var=1, type_of_var=char_t, default_c_val="")
1388 CALL section_add_keyword(section, keyword)
1389 CALL keyword_release(keyword)
1390
1391 CALL keyword_create(keyword, __location__, name="REFERENCE", &
1392 description="Reference tagged data file passed as the second positional argument to native "// &
1393 "tblite tagdiff. Native tblite uses only keys present in this reference file.", &
1394 usage="REFERENCE reference.tag", n_var=1, type_of_var=char_t, default_c_val="")
1395 CALL section_add_keyword(section, keyword)
1396 CALL keyword_release(keyword)
1397
1398 CALL keyword_create(keyword, __location__, name="FIT", &
1399 description="Pass native tblite tagdiff --fit, producing output suitable for tblite fit.", &
1400 usage="FIT T", default_l_val=.false., lone_keyword_l_val=.true.)
1401 CALL section_add_keyword(section, keyword)
1402 CALL keyword_release(keyword)
1403
1404 END SUBROUTINE create_xtb_reference_cli_tagdiff_section
1405
1406! **************************************************************************************************
1407!> \brief Creates the &REFERENCE_CLI%IMPLICIT_SOLVATION section for native tblite.
1408!> \param section section to create
1409! **************************************************************************************************
1410 SUBROUTINE create_xtb_reference_cli_solvation_section(section)
1411 TYPE(section_type), POINTER :: section
1412
1413 TYPE(keyword_type), POINTER :: keyword
1414
1415 cpassert(.NOT. ASSOCIATED(section))
1416 CALL section_create(section, __location__, name="IMPLICIT_SOLVATION", &
1417 description="Native tblite implicit-solvation settings for the external REFERENCE_CLI "// &
1418 "diagnostic command. This section does not affect the production CP2K/tblite calculation. "// &
1419 "The section is active when present; no additional enable keyword is needed. "// &
1420 "CP2K aborts for fully three-dimensional periodic cells and prints a warning for one- or "// &
1421 "two-dimensional periodic cells because native tblite's implicit-solvent models are mainly "// &
1422 "molecular continuum-solvation diagnostics. "// &
1423 "MODEL selects the native tblite run solvation switch: ALPB maps to --alpb, GBSA to --gbsa, "// &
1424 "GBE to --gbe, GB to --gb, and CPCM to --cpcm. SOLVENT is the argument passed to that switch. "// &
1425 "For ALPB and GBSA it must be a named solvent with tblite parameters; for GBE, GB, and CPCM "// &
1426 "it can be either a named solvent or a dielectric constant written as a token such as 78.36. "// &
1427 "BORN_KERNEL maps to --born-kernel and applies only to ALPB, GBSA, GBE, and GB; AUTO leaves "// &
1428 "the native tblite model-dependent default untouched. SOLUTION_STATE maps to --solv-state "// &
1429 "and is only supported for the parametrized named solvent ALPB/GBSA models; GSOLV leaves "// &
1430 "the native tblite default untouched.", &
1431 n_keywords=4, repeats=.false.)
1432
1433 NULLIFY (keyword)
1434 CALL keyword_create(keyword, __location__, name="MODEL", &
1435 description="Implicit-solvation model passed to native tblite run. ALPB selects the "// &
1436 "parametrized analytical linearized Poisson-Boltzmann model with CDS and solution-state "// &
1437 "shift support. GBSA selects the parametrized generalized Born surface-area model with CDS "// &
1438 "and solution-state shift support. GBE selects finite-epsilon generalized Born/ALPB "// &
1439 "electrostatics without the named-solvent CDS and shift terms. GB selects generalized Born "// &
1440 "electrostatics without the named-solvent CDS and shift terms. CPCM selects tblite's "// &
1441 "conductor-like polarizable continuum model.", &
1442 usage="MODEL (ALPB|GBSA|GBE|GB|CPCM)", &
1443 enum_c_vals=s2a("ALPB", "GBSA", "GBE", "GB", "CPCM"), &
1447 enum_desc=s2a("Use native tblite --alpb.", &
1448 "Use native tblite --gbsa.", &
1449 "Use native tblite --gbe.", &
1450 "Use native tblite --gb.", &
1451 "Use native tblite --cpcm."), &
1452 default_i_val=tblite_cli_solvation_alpb)
1453 CALL section_add_keyword(section, keyword)
1454 CALL keyword_release(keyword)
1455
1456 CALL keyword_create(keyword, __location__, name="SOLVENT", &
1457 description="Solvent argument passed to the selected native tblite solvation switch. "// &
1458 "For MODEL ALPB and MODEL GBSA this must be a named solvent supported by tblite's "// &
1459 "parametrized solvation data, for example water, acetone, methanol, thf, or toluene. "// &
1460 "For MODEL GBE, MODEL GB, and MODEL CPCM this can also be a dielectric constant, for "// &
1461 "example 78.36. Native tblite normalizes names by ignoring case, spaces, commas, and "// &
1462 "hyphens before lookup.", &
1463 usage="SOLVENT water", n_var=1, type_of_var=char_t, default_c_val="")
1464 CALL section_add_keyword(section, keyword)
1465 CALL keyword_release(keyword)
1466
1467 CALL keyword_create(keyword, __location__, name="BORN_KERNEL", &
1468 description="Born interaction kernel passed to native tblite as --born-kernel. AUTO leaves "// &
1469 "the native default untouched: tblite uses p16 for ALPB/GBE and still for GB/GBSA. P16 "// &
1470 "selects the Lange p16 kernel, while STILL selects the classical Still kernel. This keyword "// &
1471 "is not valid with MODEL CPCM because CPCM does not use the Born-kernel machinery.", &
1472 usage="BORN_KERNEL (AUTO|P16|STILL)", &
1473 enum_c_vals=s2a("AUTO", "P16", "STILL"), &
1476 enum_desc=s2a("Use tblite's model-dependent default kernel.", &
1477 "Use the Lange p16 Born kernel.", &
1478 "Use the classical Still Born kernel."), &
1479 default_i_val=tblite_cli_born_kernel_auto)
1480 CALL section_add_keyword(section, keyword)
1481 CALL keyword_release(keyword)
1482
1483 CALL keyword_create(keyword, __location__, name="SOLUTION_STATE", &
1484 description="Solution-state convention passed to native tblite as --solv-state. GSOLV is "// &
1485 "the default solvation free-energy convention. BAR1MOL applies the 1 bar ideal-gas to "// &
1486 "1 mol/L liquid-solution shift. REFERENCE requests tblite's reference-state convention. "// &
1487 "Native tblite supports non-default solution-state shifts only for named parametrized "// &
1488 "ALPB/GBSA solvents, not for GBE, GB, or CPCM.", &
1489 usage="SOLUTION_STATE (GSOLV|BAR1MOL|REFERENCE)", &
1490 enum_c_vals=s2a("GSOLV", "BAR1MOL", "REFERENCE"), &
1493 enum_desc=s2a("Use tblite's default solvation free-energy convention.", &
1494 "Apply the 1 bar ideal-gas to 1 mol/L solution shift.", &
1495 "Use tblite's reference-state convention."), &
1496 default_i_val=tblite_cli_solution_state_gsolv)
1497 CALL section_add_keyword(section, keyword)
1498 CALL keyword_release(keyword)
1499
1500 END SUBROUTINE create_xtb_reference_cli_solvation_section
1501
1502END MODULE input_cp2k_tb
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public katbashev2025
integer, save, public grimme2017
integer, save, public elstner1998
integer, save, public hu2007
integer, save, public porezag1995
integer, save, public seifert1996
integer, save, public zhechkov2005
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Definition cp_units.F:1282
Input definition and setup for EEQ model.
Definition eeq_input.F:12
subroutine, public create_eeq_control_section(section)
...
Definition eeq_input.F:51
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public dispersion_d3
integer, parameter, public gfn1xtb
integer, parameter, public dispersion_uff
integer, parameter, public tblite_scc_mixer_cp2k
integer, parameter, public tblite_scc_mixer_none
integer, parameter, public tblite_mixer_memory_inherit
integer, parameter, public tblite_guess_sad
integer, parameter, public tblite_cli_born_kernel_p16
integer, parameter, public tblite_solver_gvd
real(kind=dp), parameter, public tblite_mixer_damping_default
integer, parameter, public tblite_cli_solution_state_gsolv
integer, parameter, public tblite_guess_eeq
integer, parameter, public tblite_cli_solution_state_reference
integer, parameter, public tblite_cli_born_kernel_still
integer, parameter, public ipea1xtb
integer, parameter, public tblite_cli_solvation_gb
integer, parameter, public dispersion_d3bj
integer, parameter, public tblite_solver_gvr
integer, parameter, public tblite_scc_mixer_tblite
integer, parameter, public tblite_mixer_iterations_default
integer, parameter, public tblite_cli_solution_state_bar1mol
integer, parameter, public tblite_cli_solvation_alpb
real(kind=dp), parameter, public tblite_mixer_max_weight_default
integer, parameter, public tblite_cli_born_kernel_auto
real(kind=dp), parameter, public tblite_mixer_omega0_default
integer, parameter, public tblite_scc_mixer_auto
integer, parameter, public tblite_cli_solvation_cpcm
integer, parameter, public tblite_cli_solvation_gbe
integer, parameter, public gfn_tblite
integer, parameter, public tblite_cli_solvation_gbsa
integer, parameter, public dispersion_d2
integer, parameter, public gfn2xtb
integer, parameter, public tblite_guess_ceh
real(kind=dp), parameter, public tblite_mixer_weight_factor_default
real(kind=dp), parameter, public tblite_mixer_min_weight_default
integer, parameter, public slater
creates the mm section of the input
subroutine, public create_genpot_section(section)
This section specifies the input parameters for a generic potential form.
function that build the dft section of the input
subroutine, public create_dftb_control_section(section)
...
subroutine, public create_xtb_control_section(section)
...
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations, deprecation_notice)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
subroutine, public section_add_subsection(section, subsection)
adds a subsection to the given section
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
a wrapper for basic fortran types.
integer, parameter, public real_t
integer, parameter, public char_t
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file