49#include "./base/base_uses.f90"
54 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_tb'
70 cpassert(.NOT.
ASSOCIATED(section))
72 description=
"Parameters needed to set up the DFTB methods", &
73 n_keywords=1, n_subsections=1, repeats=.false., &
77 CALL create_dftb_parameter_section(subsection)
82 CALL create_tblite_mixer_section(subsection)
87 CALL keyword_create(keyword, __location__, name=
"self_consistent", &
88 description=
"Use self-consistent method", &
90 usage=
"SELF_CONSISTENT", default_l_val=.true.)
94 CALL keyword_create(keyword, __location__, name=
"orthogonal_basis", &
95 description=
"Assume orthogonal basis set", &
96 usage=
"ORTHOGONAL_BASIS", default_l_val=.false.)
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.")
111 description=
"Use dispersion correction", &
113 usage=
"DISPERSION", default_l_val=.false.)
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.)
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.)
133 description=
"Define accuracy of dispersion interaction", &
134 usage=
"EPS_DISP", default_r_val=0.0001_dp)
138 CALL add_tb_scc_mixer_keywords(section,
"CP2K-internal DFTB", &
139 "AUTO keeps the existing CP2K density/SCF mixing path for DFTB.")
153 cpassert(.NOT.
ASSOCIATED(section))
155 description=
"Parameters needed to set up the xTB methods", &
156 n_keywords=1, n_subsections=1, repeats=.false., &
160 CALL create_xtb_parameter_section(subsection)
164 CALL create_xtb_nonbonded_section(subsection)
172 CALL create_tblite_mixer_section(subsection)
176 CALL create_xtb_tblite_section(subsection)
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"), &
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."), &
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.")
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 "// &
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.")
215 description=
"Provides the order of the Slater orbital expansion in GTOs.", &
216 usage=
"STO_NG 3", default_i_val=6)
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)
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.)
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.)
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.)
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=
"")
252 CALL keyword_create(keyword, __location__, name=
"SPIN_POLARISATION", &
253 description=
"Use the spin polarisation Hamiltonian for gfn1/2", &
254 usage=
"SPIN_POLARISATION T", default_l_val=.false., lone_keyword_l_val=.true.)
258 CALL keyword_create(keyword, __location__, name=
"COULOMB_INTERACTION", &
259 description=
"Use Coulomb interaction terms (electrostatics + TB3); for debug only", &
260 usage=
"COULOMB_INTERACTION T", default_l_val=.true., lone_keyword_l_val=.true.)
265 description=
"Use Coulomb LR (1/r) interaction terms; for debug only", &
266 usage=
"COULOMB_LR T", default_l_val=.true., lone_keyword_l_val=.true.)
270 CALL keyword_create(keyword, __location__, name=
"TB3_INTERACTION", &
271 description=
"Use TB3 interaction terms; for debug only", &
272 usage=
"TB3_INTERACTION T", default_l_val=.true., lone_keyword_l_val=.true.)
276 CALL keyword_create(keyword, __location__, name=
"CHECK_ATOMIC_CHARGES", &
277 description=
"Stop calculation if atomic charges are outside chemical range.", &
278 usage=
"CHECK_ATOMIC_CHARGES T", default_l_val=.true., lone_keyword_l_val=.true.)
282 CALL keyword_create(keyword, __location__, name=
"VARIATIONAL_DIPOLE", &
283 description=
"gfn0-xTB use dipole definition from energy derivative.", &
284 usage=
"VARIATIONAL_DIPOLE T", default_l_val=.false., lone_keyword_l_val=.true.)
288 CALL keyword_create(keyword, __location__, name=
"EPS_PAIRPOTENTIAL", &
289 description=
"Accuracy for the repulsive pair potential.", &
290 usage=
"EPS_PAIRPOTENTIAL 1.0E-8", default_r_val=1.0e-10_dp)
294 CALL keyword_create(keyword, __location__, name=
"EN_SHIFT_TYPE", &
295 description=
"Shift function for electronegativity in EEQ method. "// &
296 "[Select/Molecule/Crystal] Default Select from periodicity.", &
297 usage=
"EN_SHIFT_TYPE [Select/Molecule/Crystal]", &
298 n_var=1, type_of_var=
char_t, default_c_val=
"Molecule")
308 SUBROUTINE create_dftb_parameter_section(section)
314 cpassert(.NOT.
ASSOCIATED(section))
317 description=
"Information on where to find DFTB parameters", &
318 n_keywords=1, n_subsections=0, repeats=.false.)
322 description=
"Define parameter file for atom pair", &
323 usage=
"SK_FILE a1 a2 filename", &
324 n_var=3, type_of_var=
char_t, repeats=.true.)
328 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_PATH", &
329 description=
"Specify the directory with the DFTB parameter files. "// &
330 "Used in combination with the filenames specified in the file "// &
331 "given in PARAM_FILE_NAME.", usage=
"PARAM_FILE_PATH pathname", &
332 n_var=1, type_of_var=
char_t, default_c_val=
"./")
336 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_NAME", &
337 description=
"Specify file that contains the names of "// &
338 "Slater-Koster tables: A plain text file, each line has the "// &
339 'format "ATOM1 ATOM2 filename.spl".', &
340 usage=
"PARAM_FILE_NAME filename", &
341 n_var=1, type_of_var=
char_t, default_c_val=
"")
345 CALL keyword_create(keyword, __location__, name=
"DISPERSION_TYPE", &
346 description=
"Use dispersion correction of the specified type."// &
347 " Dispersion correction has to be switched on in the DFTB section.", &
348 usage=
"DISPERSION_TYPE (UFF|D3|D3(BJ)|D2)", &
349 enum_c_vals=
s2a(
"UFF",
"D3",
"D3(BJ)",
"D2"), &
351 enum_desc=
s2a(
"Uses the UFF force field for a pair potential dispersion correction.", &
352 "Uses the Grimme D3 method (simplified) for a pair potential dispersion correction.", &
353 "Uses the Grimme D3 method (simplified) with Becke-Johnson attenuation.", &
354 "Uses the Grimme D2 method for pair potential dispersion correction."), &
359 CALL keyword_create(keyword, __location__, name=
"UFF_FORCE_FIELD", &
360 description=
"Name of file with UFF parameters that will be used "// &
361 "for the dispersion correction. Needs to be specified when "// &
362 "DISPERSION==.TRUE., otherwise cp2k crashes with a Segmentation "// &
363 "Fault.", usage=
"UFF_FORCE_FIELD filename", &
364 n_var=1, type_of_var=
char_t, default_c_val=
"")
368 CALL keyword_create(keyword, __location__, name=
"DISPERSION_PARAMETER_FILE", &
369 description=
"Specify file that contains the atomic dispersion "// &
370 "parameters for the D3 method", &
371 usage=
"DISPERSION_PARAMETER_FILE filename", &
372 n_var=1, type_of_var=
char_t, default_c_val=
"")
376 CALL keyword_create(keyword, __location__, name=
"DISPERSION_RADIUS", &
377 description=
"Define radius of dispersion interaction", &
378 usage=
"DISPERSION_RADIUS", default_r_val=15._dp)
382 CALL keyword_create(keyword, __location__, name=
"COORDINATION_CUTOFF", &
383 description=
"Define cutoff for coordination number calculation", &
384 usage=
"COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
389 description=
"Scaling parameters (s6,sr6,s8) for the D3 dispersion method,", &
390 usage=
"D3_SCALING 1.0 1.0 1.0", n_var=3, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
395 description=
"Scaling parameters (s6,a1,s8,a2) for the D3(BJ) dispersion method,", &
396 usage=
"D3BJ_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
397 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
402 description=
"Scaling parameter for the D2 dispersion method,", &
403 usage=
"D2_SCALING 1.0", default_r_val=1.0_dp)
408 description=
"Exp prefactor for damping for the D2 dispersion method,", &
409 usage=
"D2_EXP_PRE 2.0", default_r_val=2.0_dp)
414 description=
"Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
415 "specifically tuned for hydrogen bonds. Specify the exponent used in the exponential.", &
416 usage=
"HB_SR_PARAM {real}", default_r_val=4.0_dp)
420 END SUBROUTINE create_dftb_parameter_section
426 SUBROUTINE create_xtb_parameter_section(section)
432 cpassert(.NOT.
ASSOCIATED(section))
435 description=
"Information on and where to find xTB parameters", &
436 n_keywords=1, n_subsections=0, repeats=.false.)
439 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_PATH", &
440 description=
"Specify the directory with the xTB parameter file. ", &
441 usage=
"PARAM_FILE_PATH pathname", &
442 n_var=1, type_of_var=
char_t, default_c_val=
"")
446 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_NAME", &
447 description=
"Specify file that contains all xTB default parameters. ", &
448 usage=
"PARAM_FILE_NAME filename", &
449 n_var=1, type_of_var=
char_t, default_c_val=
"xTB_parameters")
453 CALL keyword_create(keyword, __location__, name=
"SPINPOL_PARAM_FILE_NAME", &
454 description=
"Specify file that contains parameters for "// &
455 "xTB spin polarisation Hamiltonian", &
456 usage=
"SPINPOL_PARAM_FILE_NAME filename", &
457 n_var=1, type_of_var=
char_t, default_c_val=
"xTB_sp_param_060")
461 CALL keyword_create(keyword, __location__, name=
"DISPERSION_PARAMETER_FILE", &
462 description=
"Specify file that contains the atomic dispersion "// &
463 "parameters for the D3 method", &
464 usage=
"DISPERSION_PARAMETER_FILE filename", &
465 n_var=1, type_of_var=
char_t, default_c_val=
"dftd3.dat")
469 CALL keyword_create(keyword, __location__, name=
"DISPERSION_RADIUS", &
470 description=
"Define radius of dispersion interaction", &
471 usage=
"DISPERSION_RADIUS", default_r_val=15._dp)
475 CALL keyword_create(keyword, __location__, name=
"COORDINATION_CUTOFF", &
476 description=
"Define cutoff for coordination number calculation", &
477 usage=
"COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
482 description=
"Scaling parameters (s6,s8) for the D3 dispersion method.", &
483 usage=
"D3BJ_SCALING 1.0 2.4", n_var=2, default_r_vals=[1.0_dp, 2.4_dp])
488 description=
"Becke-Johnson parameters (a1, a2 for the D3 dispersion method.", &
489 usage=
"D3BJ_PARAM 0.63 5.0", n_var=2, default_r_vals=[0.63_dp, 5.0_dp])
493 CALL keyword_create(keyword, __location__, name=
"HUCKEL_CONSTANTS", &
494 description=
"Huckel parameters (s, p, d, sp, 2sH).", &
495 usage=
"HUCKEL_CONSTANTS 1.85 2.25 2.00 2.08 2.85", n_var=5, &
496 default_r_vals=[1.85_dp, 2.25_dp, 2.00_dp, 2.08_dp, 2.85_dp])
500 CALL keyword_create(keyword, __location__, name=
"COULOMB_CONSTANTS", &
501 description=
"Scaling parameters for Coulomb interactions (electrons, nuclei).", &
502 usage=
"COULOMB_CONSTANTS 2.00 1.50", n_var=2, &
503 default_r_vals=[2.00_dp, 1.50_dp])
508 description=
"Scaling parameters for Coordination number correction term.", &
509 usage=
"CN_CONSTANTS 0.006 -0.003 -0.005", n_var=3, &
510 default_r_vals=[0.006_dp, -0.003_dp, -0.005_dp])
515 description=
"Scaling parameters for electronegativity correction term.", &
516 usage=
"EN_CONSTANTS -0.007 0.000 0.000", n_var=3, &
517 default_r_vals=[-0.007_dp, 0.000_dp, 0.000_dp])
522 description=
"Scaling parameter for electronegativity correction term.", &
523 usage=
"BEN_CONSTANT 4.0", n_var=1, &
524 default_r_val=4.0_dp)
529 description=
"Scaling parameter repulsive energy (dEN in exponential).", &
530 usage=
"ENSCALE 0.01", n_var=1, &
531 default_r_val=0.0_dp)
535 CALL keyword_create(keyword, __location__, name=
"HALOGEN_BINDING", &
536 description=
"Scaling parameters for electronegativity correction term.", &
537 usage=
"HALOGEN_BINDING 1.30 0.44", n_var=2, default_r_vals=[1.30_dp, 0.44_dp])
542 description=
"Specifies the specific Kab value for types A and B.", &
543 usage=
"KAB_PARAM kind1 kind2 value ", repeats=.true., &
544 n_var=-1, type_of_var=
char_t)
548 CALL keyword_create(keyword, __location__, name=
"SPIN_POL_PARAM", &
549 description=
"Specifies the spin polarisation parameters for kind A.", &
550 usage=
"SPIN_POL_PARAM atomtype Wss Wsp Wpp Wsd Wpd Wdd", repeats=.true., &
551 n_var=-1, type_of_var=
char_t)
556 description=
"Specifies the radius [Bohr] of the XB pair interaction in xTB.", &
557 usage=
"XB_RADIUS 20.0 ", repeats=.false., &
558 n_var=1, default_r_val=20.0_dp)
562 CALL keyword_create(keyword, __location__, name=
"COULOMB_SR_CUT", &
563 description=
"Maximum range of short range part of Coulomb interaction.", &
564 usage=
"COULOMB_SR_CUT 20.0 ", repeats=.false., &
565 n_var=1, default_r_val=20.0_dp)
569 CALL keyword_create(keyword, __location__, name=
"COULOMB_SR_EPS", &
570 description=
"Cutoff for short range part of Coulomb interaction.", &
571 usage=
"COULOMB_SR_EPS 1.E-3 ", repeats=.false., &
572 n_var=1, default_r_val=1.0e-03_dp)
576 CALL keyword_create(keyword, __location__, name=
"SRB_PARAMETER", &
577 description=
"SRB parameters (ksrb, esrb, gscal, c1, c2, shift).", &
578 usage=
"SRB_PARAMETER -0.0129 3.48 0.51 -1.71 2.11 0.0537", n_var=6, &
579 default_r_vals=[-0.0129_dp, 3.4847_dp, 0.5097_dp, &
580 -1.70549806_dp, 2.10878369_dp, 0.0537_dp])
584 END SUBROUTINE create_xtb_parameter_section
589 SUBROUTINE create_xtb_nonbonded_section(section)
595 cpassert(.NOT.
ASSOCIATED(section))
597 description=
"This section specifies the input parameters for NON-BONDED interactions.", &
598 n_keywords=1, n_subsections=0, repeats=.false.)
607 description=
"Parameter used for computing the derivative with the Ridders' method.", &
608 usage=
"DX <REAL>", default_r_val=0.1_dp, unit_str=
"bohr")
613 description=
"Checks that the error in computing the derivative is not larger than "// &
614 "the value set; in case error is larger a warning message is printed.", &
615 usage=
"ERROR_LIMIT <REAL>", default_r_val=1.0e-12_dp)
619 END SUBROUTINE create_xtb_nonbonded_section
625 SUBROUTINE create_xtb_tblite_section(section)
631 cpassert(.NOT.
ASSOCIATED(section))
633 description=
"Section used to specify options for an xTB computation using tblite. "// &
634 "This section is required when XTB/GFN_TYPE is set to TBLITE. "// &
635 "Periodicity follows SUBSYS/CELL/PERIODIC; the deprecated XTB/DO_EWALD keyword "// &
636 "is read consistently with CP2K-internal xTB for diagnostics/debugging. "// &
637 "Initial densities and restarts are controlled by the regular CP2K SCF settings, "// &
638 "for example DFT/SCF/SCF_GUESS, not by a separate tblite guess in this section. "// &
639 "Spin-polarized CP2K/tblite calculations are selected with the regular DFT/UKS keyword "// &
640 "or its LSD/SPIN_POLARIZED aliases; DFT/MULTIPLICITY sets the number of unpaired "// &
641 "electrons. UKS uses tblite's spin-polarized Hamiltonian; AUTO selects the native tblite "// &
642 "SCC mixer for XTB/GFN_TYPE TBLITE, while SCC_MIXER CP2K mixes both total-charge and "// &
643 "magnetization SCC variables through CP2K's TB charge-mixing infrastructure. Native "// &
644 "tblite SCC convergence follows ACCURACY; SCC_MIXER CP2K follows the regular CP2K "// &
645 "SCF convergence settings such as DFT/SCF/EPS_SCF. With QS/LS_SCF, CP2K disables the "// &
646 "separate SCC-variable mixer and lets LS_SCF optimize the density matrix directly. "// &
647 "The same direct SCC-variable update is available for Gamma-point OT calculations, "// &
648 "where smearing and ADDED_MOS are not supported.", &
649 n_keywords=1, n_subsections=1, repeats=.false., citations=[
katbashev2025])
652 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
653 description=
"Marks the tblite options section as present. The actual switch to the tblite "// &
654 "backend is XTB/GFN_TYPE TBLITE; this section then collects the numerical model, SCC "// &
655 "mixing, and optional native-reference settings used by that backend.", &
656 lone_keyword_l_val=.true., default_l_val=.false.)
662 description=
"Selects the xTB Hamiltonian model used by tblite. Without PARAM this chooses "// &
663 "one of tblite's built-in parametrizations, including the basis, reference occupations, "// &
664 "repulsion, dispersion, electrostatic, and coordination-number dependent terms. When PARAM "// &
665 "is given, METHOD remains the declared model family that the custom parametrization is "// &
666 "expected to implement and that CP2K uses for method-dependent setup and diagnostics.", &
667 usage=
"METHOD (GFN1|GFN2|IPEA1)", &
668 enum_c_vals=
s2a(
"GFN1",
"GFN2",
"IPEA1"), &
670 enum_desc=
s2a(
"Uses the GFN1-XTB method by Grimme.", &
671 "Uses the GFN2-XTB method by Grimme.", &
672 "Uses the IPEA1 method by Grimme."), &
678 description=
"Custom tblite parametrization file. The file is read by tblite and used to "// &
679 "construct the xTB calculator instead of the built-in parameter table for METHOD. It may "// &
680 "therefore change model constants such as Hamiltonian, repulsion, dispersion, electrostatic, "// &
681 "and coordination-number response parameters. It does not change the CP2K charge, spin, "// &
682 "cell, k-point, or SCF setup. The parametrization must be compatible with the selected "// &
683 "METHOD; CP2K does not reinterpret or validate the physical content of the file.", &
684 usage=
"PARAM filename", n_var=1, type_of_var=
char_t, default_c_val=
"")
690 description=
"Numerical accuracy factor for the CP2K/tblite backend. This scales tblite's "// &
691 "internal accuracy-dependent thresholds. With the native tblite SCC mixer, this is the "// &
692 "user-visible convergence control and corresponds to native tblite's --acc setting. With "// &
693 "SCC_MIXER CP2K, SCF convergence instead follows DFT/SCF/EPS_SCF; ACCURACY still controls "// &
694 "the tblite numerical setup, such as the distance cutoff used to build the xTB basis and "// &
695 "neighbor data. "// &
696 "The default matches native tblite. Smaller values make the calculation tighter and usually "// &
697 "more expensive; larger values loosen the numerical setup and can affect energies, forces, "// &
698 "and stress. Native REFERENCE_CLI diagnostics inherit this value so the production and "// &
699 "external reference calculations use the same accuracy setting.", &
700 usage=
"ACCURACY 1.0", default_r_val=1.0_dp)
705 CALL keyword_create(keyword, __location__, name=
"REFERENCE_CLI", &
706 description=
"Enable an optional diagnostic comparison against an external native tblite "// &
707 "command line calculation. CP2K writes the current geometry, charge, spin, method, optional "// &
708 "PARAM file, electronic temperature, and requested reference settings to temporary files, "// &
709 "runs the external program, and compares the resulting energy, gradient, and optionally "// &
710 "virial with the CP2K/tblite values. This check is meant for debugging backend consistency, "// &
711 "not for production sampling. The native tblite CLI exposes only an electronic temperature "// &
712 "for the occupation broadening; if CP2K uses another smearing method, the reference run "// &
713 "prints a warning and uses Fermi-Dirac smearing with the CP2K electronic temperature. "// &
714 "If true, the XTB/TBLITE/REFERENCE_CLI section must be present. "// &
715 "The check is also enabled whenever that section is present. It is skipped for CP2K "// &
716 "multi-k-point calculations, because the native tblite CLI does not reproduce CP2K KPOINTS "// &
718 usage=
"REFERENCE_CLI", default_l_val=.false., lone_keyword_l_val=.true.)
723 CALL create_xtb_reference_cli_section(subsection)
727 END SUBROUTINE create_xtb_tblite_section
733 SUBROUTINE create_tblite_mixer_section(section)
738 cpassert(.NOT.
ASSOCIATED(section))
740 description=
"Controls tblite's modified Broyden SCC-variable mixer when SCC_MIXER is set "// &
741 "to TBLITE, either explicitly or through AUTO where AUTO selects tblite. The mixer "// &
742 "variables are the self-consistent "// &
743 "xTB/DFTB populations and, for methods that require them, atomic multipoles. ITERATIONS "// &
744 "limits the number of tblite SCC-mixer updates, while MEMORY controls how many previous "// &
745 "Broyden update vectors are retained. These are independent quantities when MEMORY is set "// &
746 "explicitly; otherwise MEMORY follows ITERATIONS, matching the tblite library default. "// &
747 "DAMPING controls the size of the retained population/multipole update. OMEGA0, "// &
748 "MIN_WEIGHT, MAX_WEIGHT, and WEIGHT_FACTOR expose tblite's modified-Broyden weighting "// &
749 "constants. ITERATIONS is the tblite-side SCC-mixer update limit and defaults to the "// &
750 "native tblite value of 250. When SCC_MIXER is explicitly set to TBLITE, CP2K also "// &
751 "sets the regular DFT/SCF/MAX_SCF limit to ITERATIONS so that the tblite SCC cycle is "// &
752 "not truncated by CP2K's default SCF limit. With SCC_MIXER AUTO or CP2K, DFT/SCF/MAX_SCF "// &
753 "keeps its normal CP2K meaning. This section configures the tblite SCC mixer, not the "// &
754 "regular CP2K charge mixer. With SCC_MIXER CP2K, the CP2K-side SCC-variable mixer is "// &
755 "controlled by DFT/SCF/MIXING. With QS/LS_SCF, this section is ignored and CP2K resets "// &
756 "SCC_MIXER to NONE internally, because LS_SCF performs the density-matrix optimization "// &
757 "instead of a separate SCC-variable mixing step. Native tblite "// &
758 "REFERENCE_CLI diagnostics inherit this section. ITERATIONS and SOLVER are representable "// &
759 "by tblite run directly; CP2K reports inherited MEMORY, DAMPING, or Broyden-weight settings "// &
760 "that native tblite CLI cannot reproduce.", &
761 n_keywords=1, repeats=.false.)
765 description=
"Maximum number of tblite SCC-mixer updates. This is the tblite-side SCC "// &
766 "iteration limit, matching native tblite's --iterations setting for reference CLI "// &
767 "diagnostics. For explicit SCC_MIXER TBLITE runs, CP2K synchronizes DFT/SCF/MAX_SCF to "// &
768 "this value. For SCC_MIXER AUTO or CP2K, DFT/SCF/MAX_SCF remains the normal CP2K "// &
769 "SCF-loop iteration limit. ITERATIONS is independent of MEMORY, which controls the "// &
770 "Broyden history length.", &
776 description=
"Number of previous modified-Broyden update vectors kept by the tblite SCC "// &
777 "mixer. This is a history length, not an iteration limit. Larger values retain more "// &
778 "history and use more memory; smaller values reduce the history and can be more robust for "// &
779 "difficult SCC cycles. A value of zero means library default: inherit ITERATIONS, as native "// &
780 "tblite does when it constructs the Broyden mixer from calc%max_iter.", &
786 description=
"Electronic eigensolver selected for native tblite SCC calculations where "// &
787 "tblite owns the electronic solve, and forwarded to native REFERENCE_CLI diagnostics as "// &
788 "tblite run --solver. GVD is tblite's default LAPACK divide-and-conquer generalized "// &
789 "symmetric eigensolver. GVR selects LAPACK's relatively robust generalized symmetric "// &
790 "eigensolver. Production CP2K/tblite calculations still use CP2K's electronic "// &
791 "diagonalization machinery.", &
792 usage=
"SOLVER (GVD|GVR)", &
793 enum_c_vals=
s2a(
"GVD",
"GVR"), &
795 enum_desc=
s2a(
"Use LAPACK's divide-and-conquer generalized symmetric eigensolver.", &
796 "Use LAPACK's relatively robust generalized symmetric eigensolver."), &
802 description=
"Damping parameter for the tblite modified Broyden SCC mixer. It controls the "// &
803 "size of the population/multipole update retained by the native tblite mixer between SCC "// &
804 "iterations. Smaller values damp oscillatory SCC cycles more strongly but may slow "// &
805 "convergence; larger values can accelerate well-behaved cases but may destabilize difficult "// &
806 "ones. For CP2K-internal GFN1-xTB UKS k-point calculations with explicit SCC_MIXER TBLITE, "// &
807 "CP2K uses a conservative damping of 0.25 unless DAMPING is set explicitly.", &
813 description=
"Regularization weight added to the diagonal of tblite's modified-Broyden "// &
814 "linear system. The default matches the hard-coded value in native tblite and damps nearly "// &
815 "singular history updates without changing the first simple-damping step.", &
821 description=
"Lower bound for the dynamic Broyden history weight derived from the current "// &
822 "SCC residual. The default matches native tblite and prevents tiny weights from removing "// &
823 "history vectors from the update.", &
829 description=
"Upper bound for the dynamic Broyden history weight derived from the current "// &
830 "SCC residual. The default matches native tblite and caps the influence of very small "// &
836 CALL keyword_create(keyword, __location__, name=
"WEIGHT_FACTOR", &
837 description=
"Residual-to-weight scaling factor used by tblite's modified Broyden mixer. "// &
838 "For a residual norm above WEIGHT_FACTOR/MAX_WEIGHT, the dynamic weight is approximately "// &
839 "WEIGHT_FACTOR divided by that residual norm; otherwise MAX_WEIGHT is used before applying "// &
840 "MIN_WEIGHT. The default matches native tblite.", &
845 END SUBROUTINE create_tblite_mixer_section
853 SUBROUTINE add_tb_scc_mixer_keywords(section, TARGET, auto_desc)
855 CHARACTER(LEN=*),
INTENT(IN) ::
target, auto_desc
861 description=
"Selects the SCC variable mixer for "//
TARGET//
" calculations. "// &
862 auto_desc//
" The SCC variables are the model populations and, where required by the "// &
863 "selected method, atomic multipoles that feed the self-consistent xTB potential. TBLITE "// &
864 "uses tblite's modified Broyden mixer for those variables inside the CP2K SCF cycle. CP2K "// &
865 "maps the variables onto CP2K's charge-mixing infrastructure. When TBLITE is active, the "// &
866 "native SCC convergence follows XTB/TBLITE/ACCURACY and the tblite-side SCC update limit "// &
867 "follows TBLITE_MIXER/ITERATIONS. If SCC_MIXER is explicitly set to TBLITE, CP2K also "// &
868 "sets DFT/SCF/MAX_SCF to TBLITE_MIXER/ITERATIONS. With SCC_MIXER AUTO or CP2K, MAX_SCF "// &
869 "keeps its normal CP2K meaning. With QS/LS_SCF, explicit SCC_MIXER settings are reset to "// &
870 "NONE internally and CP2K emits a warning; LS_SCF controls the density-matrix optimization. "// &
871 "When CP2K is active, convergence follows the normal CP2K SCF "// &
872 "controls, in particular DFT/SCF/EPS_SCF and DFT/SCF/MIXING. For GFN2/tblite, the CP2K "// &
873 "mixer acts on the full SCC-variable set: shell charges plus atomic dipole and quadrupole "// &
874 "variables. CP2K-internal GFN0-xTB has no SCC variables to mix, so AUTO and NONE are "// &
875 "equivalent there and explicit CP2K or TBLITE mixer choices are reset to NONE. For "// &
876 "CP2K-internal GFN1 and DFTB/DFTB3, the SCC variables are only charge or shell-charge like. The "// &
877 "initial SCC variables are seeded from CP2K's current density, so DFT/SCF/SCF_GUESS and "// &
878 "DFT/WFN_RESTART_FILE_NAME define the starting point. NONE performs direct updates without "// &
879 "mixing and is intended for debugging, since it can be unstable.", &
880 usage=
"SCC_MIXER (AUTO|TBLITE|CP2K|NONE)", &
881 enum_c_vals=
s2a(
"AUTO",
"TBLITE",
"CP2K",
"NONE"), &
884 enum_desc=
s2a(
"Default method-dependent choice.", &
885 "Use the tblite modified Broyden SCC mixer.", &
886 "Use CP2K charge mixing for SCC variables.", &
887 "Do not mix SCC variables; for debugging."), &
892 END SUBROUTINE add_tb_scc_mixer_keywords
898 SUBROUTINE create_xtb_reference_cli_section(section)
904 cpassert(.NOT.
ASSOCIATED(section))
905 CALL section_create(section, __location__, name=
"REFERENCE_CLI", &
906 description=
"Run the native tblite command line interface as a reference "// &
907 "for CP2K/tblite energies, nuclear gradients, and optionally virials. "// &
908 "The section is a lone section: if it is present, the reference check is enabled. By default "// &
909 "the native CLI calculation inherits the CP2K/tblite method, PARAM file, ACCURACY, charge, "// &
910 "spin state, spin-polarized Hamiltonian setting, electronic temperature, "// &
911 "TBLITE_MIXER/ITERATIONS, and TBLITE_MIXER/SOLVER from the surrounding input. CP2K forwards "// &
912 "DFT/UKS, including its LSD and SPIN_POLARIZED aliases, as native tblite "// &
913 "--spin-polarized; DFT/MULTIPLICITY is forwarded separately as --spin. "// &
914 "REFERENCE_CLI/EFIELD can add a homogeneous electric field to the "// &
915 "external native tblite command only. REFERENCE_CLI/IMPLICIT_SOLVATION can add native "// &
916 "tblite implicit-solvent settings to the external reference command only. "// &
917 "Native tblite run does not expose independent options for mixer MEMORY, DAMPING, OMEGA0, "// &
918 "MIN_WEIGHT, MAX_WEIGHT, or WEIGHT_FACTOR; CP2K warns if these inherited production settings "// &
919 "cannot be reproduced and aborts when STOP_ON_ERROR is enabled. "// &
920 "Native CLI verbosity follows GLOBAL/PRINT_LEVEL: SILENT is forwarded as --silent, and "// &
921 "HIGH or DEBUG are forwarded as --verbose. "// &
922 "It remains a diagnostic one-shot calculation from temporary input files and is independent "// &
923 "of CP2K's SCF history, diagonalization, and k-point machinery. If RESTART "// &
924 "is set, the named native tblite restart file is passed to the external command. Non-Fermi "// &
925 "CP2K smearing methods cannot be represented by native tblite and are replaced by a "// &
926 "Fermi-Dirac electronic temperature in the reference command with an explicit warning.", &
927 n_keywords=1, n_subsections=0, repeats=.false.)
930 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
931 description=
"Activates the native tblite CLI reference check when the section is present. "// &
932 "The check compares CP2K/tblite against a freshly executed external tblite calculation.", &
933 lone_keyword_l_val=.true., default_l_val=.false.)
938 description=
"Executable name or path for the native tblite command line program used for "// &
939 "the reference calculation. This allows testing the CP2K/tblite implementation against a "// &
940 "specific tblite build without changing the CP2K executable.", &
941 usage=
"PROGRAM_NAME tblite", n_var=1, type_of_var=
char_t, default_c_val=
"tblite")
946 description=
"Initial population guess used only for the native tblite reference command. "// &
947 "SAD uses the superposition of atomic densities, matching the default of tblite run. EEQ "// &
948 "uses electronegativity equilibration charges, while CEH uses the charge-equilibration "// &
949 "Hamiltonian guess. This keyword does not affect the production CP2K/tblite calculation; "// &
950 "there, initial densities and restarts remain controlled by CP2K's SCF machinery.", &
951 usage=
"GUESS (SAD|EEQ|CEH)", &
952 enum_c_vals=
s2a(
"SAD",
"EEQ",
"CEH"), &
954 enum_desc=
s2a(
"Use the superposition of atomic densities guess.", &
955 "Use the electronegativity equilibration guess.", &
956 "Use the charge-equilibration Hamiltonian guess."), &
961 CALL keyword_create(keyword, __location__, name=
"WORK_DIRECTORY", &
962 description=
"Directory used for the temporary native tblite CLI input and output files. "// &
963 "The CP2K/tblite result is not taken from this directory; the files are only used to run and "// &
964 "inspect the independent reference calculation.", &
965 usage=
"WORK_DIRECTORY .", n_var=1, type_of_var=
char_t, default_c_val=
".")
970 description=
"Prefix for the temporary native tblite CLI input and output files. Changing "// &
971 "the prefix is useful when several reference checks are run in the same directory or when "// &
972 "KEEP_FILES is used to inspect the generated geometry, gradient, JSON, or log files.", &
973 usage=
"PREFIX tblite-reference", n_var=1, type_of_var=
char_t, &
974 default_c_val=
"tblite-reference")
979 description=
"Input format hint passed to native tblite run as --input. The default is GEN, "// &
980 "matching the temporary DFTB+ GEN geometry written by CP2K for the reference calculation. "// &
981 "Only change this together with a compatible externally inspected or modified input file "// &
982 "workflow; the normal CP2K-generated reference geometry is GEN.", &
983 usage=
"INPUT_FORMAT gen", n_var=1, type_of_var=
char_t, default_c_val=
"gen")
988 description=
"Native tblite restart file passed to the external reference command. When this "// &
989 "keyword is absent, CP2K passes --no-restart so each diagnostic reference is a clean one-shot "// &
990 "run from the generated geometry and selected CLI options. When a filename is given, CP2K "// &
991 "passes --restart with that file. This affects only the external native tblite run; it does "// &
992 "not read or write CP2K wavefunction or density restart data and is therefore independent of "// &
993 "DFT/SCF/SCF_GUESS RESTART.", &
994 usage=
"RESTART filename", n_var=1, type_of_var=
char_t, default_c_val=
"")
998 CALL keyword_create(keyword, __location__, name=
"POST_PROCESSING", &
999 description=
"Additional native tblite post-SCF analysis passed as tblite run "// &
1000 "--post-processing. The value can be a built-in post-processing module name or a TOML file. "// &
1001 "Native tblite already enables Mayer-Wiberg bond-order analysis internally by default. "// &
1002 "The additional built-in module names currently exposed by tblite include molmom for "// &
1003 "molecular moments and xtbml for xTB-ML descriptors. If the value names a TOML file, tblite "// &
1004 "reads its [post-processing] configuration and can select the post-processing modules more "// &
1005 "finely. This keyword affects only the external REFERENCE_CLI diagnostic run; CP2K does not "// &
1006 "parse the generated post-processing data for the energy/force/virial comparison.", &
1007 usage=
"POST_PROCESSING molmom", n_var=1, type_of_var=
char_t, default_c_val=
"")
1011 CALL keyword_create(keyword, __location__, name=
"POST_PROCESSING_OUTPUT", &
1012 description=
"Filename passed to native tblite as --post-processing-output. Native tblite "// &
1013 "documents this as the NPZ output file for post-processing data, with tblite-data.npz as its "// &
1014 "CLI default. In the locally checked tblite 0.5.0 source this option appears in the help text "// &
1015 "but is not wired in the command-line parser, so CP2K emits it only when explicitly requested "// &
1016 "and prints a warning before running the reference command. Use this keyword only with tblite "// &
1017 "CLI builds that actually accept the option. Unless KEEP_FILES is enabled, CP2K removes this "// &
1018 "explicit output file after the reference check.", &
1019 usage=
"POST_PROCESSING_OUTPUT tblite-data.npz", n_var=1, type_of_var=
char_t, &
1020 default_c_val=
"", lone_keyword_c_val=
"tblite-data.npz")
1025 description=
"Filename passed to native tblite as --grad for the tagged ASCII gradient output. "// &
1026 "The native file contains the total energy, energy contributions, analytical molecular "// &
1027 "gradient, and virial. CP2K reads this file for the REFERENCE_CLI energy, force, and virial "// &
1028 "checks. If the keyword is omitted, CP2K writes a temporary PREFIX.grad file in "// &
1029 "WORK_DIRECTORY. If the keyword is present without a filename, CP2K uses tblite's CLI default "// &
1030 "name tblite.txt. Unless KEEP_FILES is enabled, CP2K removes the selected file after the "// &
1031 "reference check.", &
1032 usage=
"GRAD tblite.txt", n_var=1, type_of_var=
char_t, default_c_val=
"", &
1033 lone_keyword_c_val=
"tblite.txt")
1038 description=
"Filename passed to native tblite as --json for JSON result output. Without "// &
1039 "--grad the native JSON usually contains the energy and energy contributions; because CP2K's "// &
1040 "REFERENCE_CLI path also requests --grad, native tblite can additionally include derivative "// &
1041 "data such as gradient and virial when supported by the CLI version. CP2K currently reads the "// &
1042 "tagged GRAD file for comparisons and keeps the JSON file as an inspectable native artifact. "// &
1043 "If the keyword is omitted, CP2K writes a temporary PREFIX.json file in WORK_DIRECTORY. If the "// &
1044 "keyword is present without a filename, CP2K uses tblite's CLI default name tblite.json. "// &
1045 "Unless KEEP_FILES is enabled, CP2K removes the selected file after the reference check.", &
1046 usage=
"JSON tblite.json", n_var=1, type_of_var=
char_t, default_c_val=
"", &
1047 lone_keyword_c_val=
"tblite.json")
1051 CALL keyword_create(keyword, __location__, name=
"ELECTRONIC_TEMPERATURE_GUESS", &
1052 description=
"Electronic temperature used only for the native tblite reference command's "// &
1053 "initial CEH population guess. CP2K forwards positive values as tblite run "// &
1054 "--etemp-guess. The value does not affect CP2K/tblite production calculations and is "// &
1055 "independent of DFT/SCF/SMEAR/ELECTRONIC_TEMPERATURE, which controls the final electronic "// &
1056 "occupation temperature passed as --etemp. A value of zero leaves the native tblite default "// &
1057 "for the guess temperature untouched. Positive values are valid only together with GUESS CEH; "// &
1058 "CP2K aborts for SAD or EEQ because native tblite uses this option for the CEH guess.", &
1059 usage=
"ELECTRONIC_TEMPERATURE_GUESS [K] 4000", &
1060 default_r_val=
cp_unit_to_cp2k(
value=0.0_dp, unit_str=
"K"), unit_str=
"K")
1065 description=
"Homogeneous electric field passed only to the native tblite reference command "// &
1066 "as tblite run --efield. The three components are given in V/Angstrom, matching the native "// &
1067 "tblite CLI convention. This keyword does not affect the production CP2K/tblite "// &
1068 "calculation because that path currently does not construct tblite's external electric "// &
1069 "field container. If enabled together with energy, force, or virial checks, the comparison "// &
1070 "therefore intentionally diagnoses the native field response rather than matching a CP2K "// &
1071 "production field calculation.", &
1072 usage=
"EFIELD 0.0 0.0 0.0", repeats=.false., n_var=3, type_of_var=
real_t, &
1073 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
1078 description=
"Keep the temporary native tblite CLI input and output files after the "// &
1079 "comparison. This is mainly a debugging aid for inspecting the generated GEN geometry, the "// &
1080 "native tblite gradient/virial file, the JSON output, and the CLI log.", &
1081 usage=
"KEEP_FILES T", default_l_val=.false., lone_keyword_l_val=.true.)
1086 description=
"Tolerance for reporting reference CLI deviations. The value is applied to the "// &
1087 "absolute CP2K-minus-native differences printed by the enabled energy, force, and virial "// &
1088 "checks. Exceeding this limit produces a diagnostic warning, or an abort when STOP_ON_ERROR "// &
1090 usage=
"ERROR_LIMIT 1.0E-8", default_r_val=1.0e-8_dp)
1094 CALL keyword_create(keyword, __location__, name=
"STOP_ON_ERROR", &
1095 description=
"Abort the CP2K run if any enabled reference CLI comparison exceeds "// &
1096 "ERROR_LIMIT. When disabled, CP2K prints the deviation but continues, which is useful for "// &
1097 "exploratory diagnostics and regression-test probes.", &
1098 usage=
"STOP_ON_ERROR T", default_l_val=.false., lone_keyword_l_val=.true.)
1102 CALL keyword_create(keyword, __location__, name=
"CHECK_ENERGY", &
1103 description=
"Compare the CP2K/tblite total xTB energy with the energy obtained from the "// &
1104 "native tblite reference run. This checks the Hamiltonian setup, SCC solution, static "// &
1105 "repulsion/dispersion terms, charge and spin state, electronic temperature, and optional "// &
1106 "PARAM file consistency for the one-shot reference geometry.", &
1107 usage=
"CHECK_ENERGY T", default_l_val=.true., lone_keyword_l_val=.true.)
1111 CALL keyword_create(keyword, __location__, name=
"CHECK_FORCES", &
1112 description=
"Compare CP2K/tblite nuclear gradients with the gradients written by the "// &
1113 "native tblite reference run. This is a sensitive check of derivative terms, including "// &
1114 "repulsion, dispersion, electrostatic response, and coordination-number response. The "// &
1115 "comparison uses the same geometry and model setup as the energy reference.", &
1116 usage=
"CHECK_FORCES T", default_l_val=.true., lone_keyword_l_val=.true.)
1120 CALL keyword_create(keyword, __location__, name=
"CHECK_VIRIAL", &
1121 description=
"Compare CP2K/tblite virial with the virial written by the native tblite "// &
1122 "reference run. This is a diagnostic for cell derivatives and stress-related terms. It is "// &
1123 "disabled by default because virial conventions, finite periodicity, and the absence of "// &
1124 "native CLI k-point sampling make this comparison more restrictive than the energy and "// &
1126 usage=
"CHECK_VIRIAL T", default_l_val=.false., lone_keyword_l_val=.true.)
1130 NULLIFY (subsection)
1131 CALL create_xtb_reference_cli_guess_section(subsection)
1135 NULLIFY (subsection)
1136 CALL create_xtb_reference_cli_param_section(subsection)
1140 NULLIFY (subsection)
1141 CALL create_xtb_reference_cli_fit_section(subsection)
1145 NULLIFY (subsection)
1146 CALL create_xtb_reference_cli_tagdiff_section(subsection)
1150 NULLIFY (subsection)
1151 CALL create_xtb_reference_cli_solvation_section(subsection)
1155 END SUBROUTINE create_xtb_reference_cli_section
1161 SUBROUTINE create_xtb_reference_cli_guess_section(section)
1166 cpassert(.NOT.
ASSOCIATED(section))
1168 description=
"Run the native tblite guess subcommand as an auxiliary REFERENCE_CLI "// &
1169 "diagnostic. The command executes tblite guess on the generated GEN geometry by default and "// &
1170 "prints the initializing charges and dipole moments. CP2K forwards the surrounding charge "// &
1171 "and multiplicity as native --charge and --spin. GLOBAL/PRINT_LEVEL controls native "// &
1172 "--silent or --verbose exactly as for the main REFERENCE_CLI run command. This section is "// &
1173 "diagnostic only; CP2K does not use the generated guess data to seed the production "// &
1175 n_keywords=1, n_subsections=0, repeats=.false.)
1178 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
1179 description=
"Activates the native tblite guess auxiliary command when the section is "// &
1180 "present.", lone_keyword_l_val=.true., default_l_val=.false.)
1185 description=
"Initial-population method passed to native tblite guess as --method. SAD uses "// &
1186 "superposed atomic densities, EEQ uses electronegativity equilibration, and CEH uses the "// &
1187 "charge-extended Huckel guess. The default matches native tblite guess.", &
1188 usage=
"METHOD (SAD|EEQ|CEH)", &
1189 enum_c_vals=
s2a(
"SAD",
"EEQ",
"CEH"), &
1191 enum_desc=
s2a(
"Use the superposition of atomic densities guess.", &
1192 "Use the electronegativity equilibration guess.", &
1193 "Use the charge-extended Huckel guess."), &
1198 CALL keyword_create(keyword, __location__, name=
"ELECTRONIC_TEMPERATURE_GUESS", &
1199 description=
"Electronic temperature for native tblite guess --etemp-guess. This option is "// &
1200 "used by the CEH guess in native tblite. A value of zero leaves tblite's own default "// &
1201 "untouched.", usage=
"ELECTRONIC_TEMPERATURE_GUESS [K] 4000", &
1202 default_r_val=
cp_unit_to_cp2k(
value=0.0_dp, unit_str=
"K"), unit_str=
"K")
1207 description=
"Electronic solver passed to native tblite guess as --solver. GVD is the "// &
1208 "default generalized eigenvalue decomposition solver; GVR selects the alternative solver "// &
1209 "exposed by tblite.", usage=
"SOLVER (GVD|GVR)", &
1211 enum_desc=
s2a(
"Use the GVD electronic solver.",
"Use the GVR electronic solver."), &
1217 description=
"Homogeneous electric field passed to native tblite guess as --efield. The "// &
1218 "three components are given in V/Angstrom, matching native tblite.", &
1219 usage=
"EFIELD 0.0 0.0 0.0", repeats=.false., n_var=3, type_of_var=
real_t, &
1220 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
1225 description=
"Request native tblite guess --grad, evaluating the analytic gradient of the "// &
1226 "guessed charges.", usage=
"GRAD T", default_l_val=.false., lone_keyword_l_val=.true.)
1231 description=
"Filename passed to native tblite guess as --json. If the keyword is present "// &
1232 "without a filename, CP2K uses tblite's CLI default name tblite.json. If omitted, CP2K does "// &
1233 "not request JSON output for the auxiliary guess command.", &
1234 usage=
"JSON tblite.json", n_var=1, type_of_var=
char_t, default_c_val=
"", &
1235 lone_keyword_c_val=
"tblite.json")
1239 CALL keyword_create(keyword, __location__, name=
"INPUT_FORMAT", &
1240 description=
"Input format hint passed to native tblite guess as --input. The default is GEN, "// &
1241 "matching the temporary DFTB+ GEN geometry written by CP2K for the enclosing reference "// &
1243 usage=
"INPUT_FORMAT gen", n_var=1, type_of_var=
char_t, default_c_val=
"gen")
1248 description=
"Positional input structure for native tblite guess. The file format must match "// &
1249 "GUESS_CLI/INPUT_FORMAT. If omitted, CP2K uses the temporary GEN geometry written for the "// &
1250 "enclosing REFERENCE_CLI calculation.", &
1251 usage=
"INPUT_FILE structure.gen", n_var=1, type_of_var=
char_t, default_c_val=
"")
1255 END SUBROUTINE create_xtb_reference_cli_guess_section
1261 SUBROUTINE create_xtb_reference_cli_param_section(section)
1266 cpassert(.NOT.
ASSOCIATED(section))
1268 description=
"Run the native tblite param subcommand as an auxiliary REFERENCE_CLI "// &
1269 "diagnostic. The command inspects, imports, exports, or converts tblite parameter data. "// &
1270 "If no INPUT_FILE is supplied, CP2K selects the surrounding XTB/TBLITE/METHOD as native "// &
1271 "--method. If METHOD is specified here, it overrides only this auxiliary command.", &
1272 n_keywords=1, n_subsections=0, repeats=.false.)
1275 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
1276 description=
"Activates the native tblite param auxiliary command when the section is "// &
1277 "present.", lone_keyword_l_val=.true., default_l_val=.false.)
1282 description=
"Base parametrization passed to native tblite param as --method. If omitted, "// &
1283 "CP2K uses the surrounding XTB/TBLITE/METHOD.", &
1284 usage=
"METHOD (GFN1|GFN2|IPEA1)", &
1285 enum_c_vals=
s2a(
"GFN1",
"GFN2",
"IPEA1"), &
1287 enum_desc=
s2a(
"Use the GFN1-xTB base parametrization.", &
1288 "Use the GFN2-xTB base parametrization.", &
1289 "Use the IPEA1 base parametrization."), &
1295 description=
"Output parameter file passed to native tblite param as --output. If omitted, "// &
1296 "native tblite writes to its default stream or file for the selected operation.", &
1297 usage=
"OUTPUT parameters.toml", n_var=1, type_of_var=
char_t, default_c_val=
"")
1302 description=
"Optional positional input parameter file for native tblite param. If omitted, "// &
1303 "the command operates on the selected built-in METHOD.", &
1304 usage=
"INPUT_FILE parameters.toml", n_var=1, type_of_var=
char_t, default_c_val=
"")
1308 END SUBROUTINE create_xtb_reference_cli_param_section
1314 SUBROUTINE create_xtb_reference_cli_fit_section(section)
1319 cpassert(.NOT.
ASSOCIATED(section))
1321 description=
"Run the native tblite fit subcommand as an auxiliary REFERENCE_CLI diagnostic. "// &
1322 "The command optimizes or dry-runs tblite parameters from a starting PARAM_FILE and a fit "// &
1323 "settings INPUT_FILE. Because native fitting can be expensive and writes its own outputs, "// &
1324 "the section is inactive unless explicitly present.", &
1325 n_keywords=1, n_subsections=0, repeats=.false.)
1328 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
1329 description=
"Activates the native tblite fit auxiliary command when the section is present.", &
1330 lone_keyword_l_val=.true., default_l_val=.false.)
1335 description=
"Starting parameter file passed as the first positional argument to native "// &
1336 "tblite fit.", usage=
"PARAM_FILE start.toml", n_var=1, type_of_var=
char_t, default_c_val=
"")
1341 description=
"Fit-settings input file passed as the second positional argument to native "// &
1342 "tblite fit.", usage=
"INPUT_FILE fit.toml", n_var=1, type_of_var=
char_t, default_c_val=
"")
1347 description=
"Pass native tblite fit --dry-run. This expands and checks the fit setup "// &
1348 "without starting the optimization.", usage=
"DRY_RUN T", default_l_val=.false., &
1349 lone_keyword_l_val=.true.)
1354 description=
"Filename passed to native tblite fit as --copy. Native tblite writes the full "// &
1355 "representation of the fit input to this file, with defaults filled in and masks expanded.", &
1356 usage=
"COPY expanded-fit.toml", n_var=1, type_of_var=
char_t, default_c_val=
"")
1360 END SUBROUTINE create_xtb_reference_cli_fit_section
1366 SUBROUTINE create_xtb_reference_cli_tagdiff_section(section)
1371 cpassert(.NOT.
ASSOCIATED(section))
1373 description=
"Run the native tblite tagdiff auxiliary command. It compares an ACTUAL tagged "// &
1374 "data file against a REFERENCE tagged data file and reports differences using the keys from "// &
1375 "the reference file.", n_keywords=1, n_subsections=0, repeats=.false.)
1378 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
1379 description=
"Activates the native tblite tagdiff auxiliary command when the section is "// &
1380 "present.", lone_keyword_l_val=.true., default_l_val=.false.)
1385 description=
"Actual tagged data file passed as the first positional argument to native "// &
1386 "tblite tagdiff.", usage=
"ACTUAL actual.tag", n_var=1, type_of_var=
char_t, default_c_val=
"")
1391 description=
"Reference tagged data file passed as the second positional argument to native "// &
1392 "tblite tagdiff. Native tblite uses only keys present in this reference file.", &
1393 usage=
"REFERENCE reference.tag", n_var=1, type_of_var=
char_t, default_c_val=
"")
1398 description=
"Pass native tblite tagdiff --fit, producing output suitable for tblite fit.", &
1399 usage=
"FIT T", default_l_val=.false., lone_keyword_l_val=.true.)
1403 END SUBROUTINE create_xtb_reference_cli_tagdiff_section
1409 SUBROUTINE create_xtb_reference_cli_solvation_section(section)
1414 cpassert(.NOT.
ASSOCIATED(section))
1415 CALL section_create(section, __location__, name=
"IMPLICIT_SOLVATION", &
1416 description=
"Native tblite implicit-solvation settings for the external REFERENCE_CLI "// &
1417 "diagnostic command. This section does not affect the production CP2K/tblite calculation. "// &
1418 "The section is active when present; no additional enable keyword is needed. "// &
1419 "CP2K aborts for fully three-dimensional periodic cells and prints a warning for one- or "// &
1420 "two-dimensional periodic cells because native tblite's implicit-solvent models are mainly "// &
1421 "molecular continuum-solvation diagnostics. "// &
1422 "MODEL selects the native tblite run solvation switch: ALPB maps to --alpb, GBSA to --gbsa, "// &
1423 "GBE to --gbe, GB to --gb, and CPCM to --cpcm. SOLVENT is the argument passed to that switch. "// &
1424 "For ALPB and GBSA it must be a named solvent with tblite parameters; for GBE, GB, and CPCM "// &
1425 "it can be either a named solvent or a dielectric constant written as a token such as 78.36. "// &
1426 "BORN_KERNEL maps to --born-kernel and applies only to ALPB, GBSA, GBE, and GB; AUTO leaves "// &
1427 "the native tblite model-dependent default untouched. SOLUTION_STATE maps to --solv-state "// &
1428 "and is only supported for the parametrized named solvent ALPB/GBSA models; GSOLV leaves "// &
1429 "the native tblite default untouched.", &
1430 n_keywords=4, repeats=.false.)
1434 description=
"Implicit-solvation model passed to native tblite run. ALPB selects the "// &
1435 "parametrized analytical linearized Poisson-Boltzmann model with CDS and solution-state "// &
1436 "shift support. GBSA selects the parametrized generalized Born surface-area model with CDS "// &
1437 "and solution-state shift support. GBE selects finite-epsilon generalized Born/ALPB "// &
1438 "electrostatics without the named-solvent CDS and shift terms. GB selects generalized Born "// &
1439 "electrostatics without the named-solvent CDS and shift terms. CPCM selects tblite's "// &
1440 "conductor-like polarizable continuum model.", &
1441 usage=
"MODEL (ALPB|GBSA|GBE|GB|CPCM)", &
1442 enum_c_vals=
s2a(
"ALPB",
"GBSA",
"GBE",
"GB",
"CPCM"), &
1446 enum_desc=
s2a(
"Use native tblite --alpb.", &
1447 "Use native tblite --gbsa.", &
1448 "Use native tblite --gbe.", &
1449 "Use native tblite --gb.", &
1450 "Use native tblite --cpcm."), &
1456 description=
"Solvent argument passed to the selected native tblite solvation switch. "// &
1457 "For MODEL ALPB and MODEL GBSA this must be a named solvent supported by tblite's "// &
1458 "parametrized solvation data, for example water, acetone, methanol, thf, or toluene. "// &
1459 "For MODEL GBE, MODEL GB, and MODEL CPCM this can also be a dielectric constant, for "// &
1460 "example 78.36. Native tblite normalizes names by ignoring case, spaces, commas, and "// &
1461 "hyphens before lookup.", &
1462 usage=
"SOLVENT water", n_var=1, type_of_var=
char_t, default_c_val=
"")
1467 description=
"Born interaction kernel passed to native tblite as --born-kernel. AUTO leaves "// &
1468 "the native default untouched: tblite uses p16 for ALPB/GBE and still for GB/GBSA. P16 "// &
1469 "selects the Lange p16 kernel, while STILL selects the classical Still kernel. This keyword "// &
1470 "is not valid with MODEL CPCM because CPCM does not use the Born-kernel machinery.", &
1471 usage=
"BORN_KERNEL (AUTO|P16|STILL)", &
1472 enum_c_vals=
s2a(
"AUTO",
"P16",
"STILL"), &
1475 enum_desc=
s2a(
"Use tblite's model-dependent default kernel.", &
1476 "Use the Lange p16 Born kernel.", &
1477 "Use the classical Still Born kernel."), &
1482 CALL keyword_create(keyword, __location__, name=
"SOLUTION_STATE", &
1483 description=
"Solution-state convention passed to native tblite as --solv-state. GSOLV is "// &
1484 "the default solvation free-energy convention. BAR1MOL applies the 1 bar ideal-gas to "// &
1485 "1 mol/L liquid-solution shift. REFERENCE requests tblite's reference-state convention. "// &
1486 "Native tblite supports non-default solution-state shifts only for named parametrized "// &
1487 "ALPB/GBSA solvents, not for GBE, GB, or CPCM.", &
1488 usage=
"SOLUTION_STATE (GSOLV|BAR1MOL|REFERENCE)", &
1489 enum_c_vals=
s2a(
"GSOLV",
"BAR1MOL",
"REFERENCE"), &
1492 enum_desc=
s2a(
"Use tblite's default solvation free-energy convention.", &
1493 "Apply the 1 bar ideal-gas to 1 mol/L solution shift.", &
1494 "Use tblite's reference-state convention."), &
1499 END SUBROUTINE create_xtb_reference_cli_solvation_section
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
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.