35#include "./base/base_uses.f90"
40 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_tb'
56 cpassert(.NOT.
ASSOCIATED(section))
58 description=
"Parameters needed to set up the DFTB methods", &
59 n_keywords=1, n_subsections=1, repeats=.false., &
63 CALL create_dftb_parameter_section(subsection)
68 CALL keyword_create(keyword, __location__, name=
"self_consistent", &
69 description=
"Use self-consistent method", &
71 usage=
"SELF_CONSISTENT", default_l_val=.true.)
75 CALL keyword_create(keyword, __location__, name=
"orthogonal_basis", &
76 description=
"Assume orthogonal basis set", &
77 usage=
"ORTHOGONAL_BASIS", default_l_val=.false.)
82 description=
"Deprecated debug override for the DFTB Ewald treatment. "// &
83 "By default the setting is inferred from SUBSYS/CELL/PERIODIC. "// &
84 "If set to TRUE, the DFT/POISSON section must use a periodic Poisson solver.", &
85 usage=
"DO_EWALD", default_l_val=.false., lone_keyword_l_val=.true., &
86 deprecation_notice=
"Use SUBSYS/CELL/PERIODIC to select periodicity. "// &
87 "DO_EWALD is retained only as a debug override for the DFTB Ewald path.")
92 description=
"Use dispersion correction", &
94 usage=
"DISPERSION", default_l_val=.false.)
98 CALL keyword_create(keyword, __location__, name=
"DIAGONAL_DFTB3", &
99 description=
"Use a diagonal version of the 3rd order energy correction (DFTB3) ", &
100 lone_keyword_l_val=.true., &
101 usage=
"DIAGONAL_DFTB3", default_l_val=.false.)
106 description=
"Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
107 "specifically tuned for hydrogen bonds.", &
108 citations=[
hu2007], lone_keyword_l_val=.true., &
109 usage=
"HB_SR_GAMMA", default_l_val=.false.)
114 description=
"Define accuracy of dispersion interaction", &
115 usage=
"EPS_DISP", default_r_val=0.0001_dp)
119 CALL add_tb_scc_mixer_keywords(section,
"CP2K-internal DFTB", &
120 "AUTO keeps the existing CP2K density/SCF mixing path for DFTB.")
134 cpassert(.NOT.
ASSOCIATED(section))
136 description=
"Parameters needed to set up the xTB methods", &
137 n_keywords=1, n_subsections=1, repeats=.false., &
141 CALL create_xtb_parameter_section(subsection)
145 CALL create_xtb_nonbonded_section(subsection)
153 CALL create_xtb_tblite_section(subsection)
159 description=
"Selects the xTB backend. GFN_TYPE 1 uses the CP2K-internal GFN1-xTB "// &
160 "implementation. GFN_TYPE TBLITE uses the tblite backend and requires an XTB/TBLITE "// &
161 "section, where the actual tblite method is selected.", &
162 usage=
"GFN_TYPE (0|1|TBLITE)", &
163 enum_c_vals=
s2a(
"0",
"1",
"TBLITE"), &
165 enum_desc=
s2a(
"Use the CP2K-internal GFN0-xTB implementation.", &
166 "Use the CP2K-internal GFN1-xTB implementation.", &
167 "Use the CP2K/tblite backend; requires XTB/TBLITE."), &
172 CALL add_tb_scc_mixer_keywords(section,
"CP2K-internal xTB", &
173 "AUTO keeps the CP2K charge mixer for CP2K-internal xTB.")
176 description=
"Deprecated debug override for the xTB Ewald treatment. "// &
177 "By default the setting is inferred from SUBSYS/CELL/PERIODIC. "// &
178 "If set to TRUE for CP2K-internal xTB, the DFT/POISSON section must use a periodic "// &
179 "Poisson solver. For CP2K/tblite, the periodic long-range treatment is performed "// &
181 usage=
"DO_EWALD", default_l_val=.false., lone_keyword_l_val=.true., &
182 deprecation_notice=
"Use SUBSYS/CELL/PERIODIC to select periodicity. "// &
183 "DO_EWALD is retained only as a debug override for the CP2K-internal xTB Ewald path.")
188 description=
"Provides the order of the Slater orbital expansion in GTOs.", &
189 usage=
"STO_NG 3", default_i_val=6)
193 CALL keyword_create(keyword, __location__, name=
"HYDROGEN_STO_NG", &
194 description=
"Number of GTOs for Hydrogen basis expansion.", &
195 usage=
"HYDROGEN_STO_NG 3", default_i_val=4)
199 CALL keyword_create(keyword, __location__, name=
"USE_HALOGEN_CORRECTION", &
200 description=
"Use XB interaction term", &
201 usage=
"USE_HALOGEN_CORRECTION T", default_l_val=.true., lone_keyword_l_val=.true.)
206 description=
"Controls the computation of real-space "// &
207 "(short-range) nonbonded interactions as correction to xTB.", &
208 usage=
"DO_NONBONDED T", default_l_val=.false., lone_keyword_l_val=.true.)
212 CALL keyword_create(keyword, __location__, name=
"VDW_POTENTIAL", &
213 description=
"vdW potential to be used: NONE, DFTD3, DFTD4. "// &
214 "Defaults: DFTD3(gfn1), DFTD4(gfn0, gfn2).", &
215 usage=
"VDW_POTENTIAL type", default_c_val=
"")
219 CALL keyword_create(keyword, __location__, name=
"COULOMB_INTERACTION", &
220 description=
"Use Coulomb interaction terms (electrostatics + TB3); for debug only", &
221 usage=
"COULOMB_INTERACTION T", default_l_val=.true., lone_keyword_l_val=.true.)
226 description=
"Use Coulomb LR (1/r) interaction terms; for debug only", &
227 usage=
"COULOMB_LR T", default_l_val=.true., lone_keyword_l_val=.true.)
231 CALL keyword_create(keyword, __location__, name=
"TB3_INTERACTION", &
232 description=
"Use TB3 interaction terms; for debug only", &
233 usage=
"TB3_INTERACTION T", default_l_val=.true., lone_keyword_l_val=.true.)
237 CALL keyword_create(keyword, __location__, name=
"CHECK_ATOMIC_CHARGES", &
238 description=
"Stop calculation if atomic charges are outside chemical range.", &
239 usage=
"CHECK_ATOMIC_CHARGES T", default_l_val=.true., lone_keyword_l_val=.true.)
243 CALL keyword_create(keyword, __location__, name=
"VARIATIONAL_DIPOLE", &
244 description=
"gfn0-xTB use dipole definition from energy derivative.", &
245 usage=
"VARIATIONAL_DIPOLE T", default_l_val=.false., lone_keyword_l_val=.true.)
249 CALL keyword_create(keyword, __location__, name=
"EPS_PAIRPOTENTIAL", &
250 description=
"Accuracy for the repulsive pair potential.", &
251 usage=
"EPS_PAIRPOTENTIAL 1.0E-8", default_r_val=1.0e-10_dp)
255 CALL keyword_create(keyword, __location__, name=
"EN_SHIFT_TYPE", &
256 description=
"Shift function for electronegativity in EEQ method. "// &
257 "[Select/Molecule/Crystal] Default Select from periodicity.", &
258 usage=
"EN_SHIFT_TYPE [Select/Molecule/Crystal]", &
259 n_var=1, type_of_var=
char_t, default_c_val=
"Molecule")
269 SUBROUTINE create_dftb_parameter_section(section)
275 cpassert(.NOT.
ASSOCIATED(section))
278 description=
"Information on where to find DFTB parameters", &
279 n_keywords=1, n_subsections=0, repeats=.false.)
283 description=
"Define parameter file for atom pair", &
284 usage=
"SK_FILE a1 a2 filename", &
285 n_var=3, type_of_var=
char_t, repeats=.true.)
289 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_PATH", &
290 description=
"Specify the directory with the DFTB parameter files. "// &
291 "Used in combination with the filenames specified in the file "// &
292 "given in PARAM_FILE_NAME.", usage=
"PARAM_FILE_PATH pathname", &
293 n_var=1, type_of_var=
char_t, default_c_val=
"./")
297 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_NAME", &
298 description=
"Specify file that contains the names of "// &
299 "Slater-Koster tables: A plain text file, each line has the "// &
300 'format "ATOM1 ATOM2 filename.spl".', &
301 usage=
"PARAM_FILE_NAME filename", &
302 n_var=1, type_of_var=
char_t, default_c_val=
"")
306 CALL keyword_create(keyword, __location__, name=
"DISPERSION_TYPE", &
307 description=
"Use dispersion correction of the specified type."// &
308 " Dispersion correction has to be switched on in the DFTB section.", &
309 usage=
"DISPERSION_TYPE (UFF|D3|D3(BJ)|D2)", &
310 enum_c_vals=
s2a(
"UFF",
"D3",
"D3(BJ)",
"D2"), &
312 enum_desc=
s2a(
"Uses the UFF force field for a pair potential dispersion correction.", &
313 "Uses the Grimme D3 method (simplified) for a pair potential dispersion correction.", &
314 "Uses the Grimme D3 method (simplified) with Becke-Johnson attenuation.", &
315 "Uses the Grimme D2 method for pair potential dispersion correction."), &
320 CALL keyword_create(keyword, __location__, name=
"UFF_FORCE_FIELD", &
321 description=
"Name of file with UFF parameters that will be used "// &
322 "for the dispersion correction. Needs to be specified when "// &
323 "DISPERSION==.TRUE., otherwise cp2k crashes with a Segmentation "// &
324 "Fault.", usage=
"UFF_FORCE_FIELD filename", &
325 n_var=1, type_of_var=
char_t, default_c_val=
"")
329 CALL keyword_create(keyword, __location__, name=
"DISPERSION_PARAMETER_FILE", &
330 description=
"Specify file that contains the atomic dispersion "// &
331 "parameters for the D3 method", &
332 usage=
"DISPERSION_PARAMETER_FILE filename", &
333 n_var=1, type_of_var=
char_t, default_c_val=
"")
337 CALL keyword_create(keyword, __location__, name=
"DISPERSION_RADIUS", &
338 description=
"Define radius of dispersion interaction", &
339 usage=
"DISPERSION_RADIUS", default_r_val=15._dp)
343 CALL keyword_create(keyword, __location__, name=
"COORDINATION_CUTOFF", &
344 description=
"Define cutoff for coordination number calculation", &
345 usage=
"COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
350 description=
"Scaling parameters (s6,sr6,s8) for the D3 dispersion method,", &
351 usage=
"D3_SCALING 1.0 1.0 1.0", n_var=3, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
356 description=
"Scaling parameters (s6,a1,s8,a2) for the D3(BJ) dispersion method,", &
357 usage=
"D3BJ_SCALING 1.0 1.0 1.0 1.0", n_var=4, &
358 default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp, 0.0_dp])
363 description=
"Scaling parameter for the D2 dispersion method,", &
364 usage=
"D2_SCALING 1.0", default_r_val=1.0_dp)
369 description=
"Exp prefactor for damping for the D2 dispersion method,", &
370 usage=
"D2_EXP_PRE 2.0", default_r_val=2.0_dp)
375 description=
"Uses a modified version for the GAMMA within the SCC-DFTB scheme, "// &
376 "specifically tuned for hydrogen bonds. Specify the exponent used in the exponential.", &
377 usage=
"HB_SR_PARAM {real}", default_r_val=4.0_dp)
381 END SUBROUTINE create_dftb_parameter_section
387 SUBROUTINE create_xtb_parameter_section(section)
393 cpassert(.NOT.
ASSOCIATED(section))
396 description=
"Information on and where to find xTB parameters", &
397 n_keywords=1, n_subsections=0, repeats=.false.)
400 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_PATH", &
401 description=
"Specify the directory with the xTB parameter file. ", &
402 usage=
"PARAM_FILE_PATH pathname", &
403 n_var=1, type_of_var=
char_t, default_c_val=
"")
407 CALL keyword_create(keyword, __location__, name=
"PARAM_FILE_NAME", &
408 description=
"Specify file that contains all xTB default parameters. ", &
409 usage=
"PARAM_FILE_NAME filename", &
410 n_var=1, type_of_var=
char_t, default_c_val=
"xTB_parameters")
414 CALL keyword_create(keyword, __location__, name=
"DISPERSION_PARAMETER_FILE", &
415 description=
"Specify file that contains the atomic dispersion "// &
416 "parameters for the D3 method", &
417 usage=
"DISPERSION_PARAMETER_FILE filename", &
418 n_var=1, type_of_var=
char_t, default_c_val=
"dftd3.dat")
422 CALL keyword_create(keyword, __location__, name=
"DISPERSION_RADIUS", &
423 description=
"Define radius of dispersion interaction", &
424 usage=
"DISPERSION_RADIUS", default_r_val=15._dp)
428 CALL keyword_create(keyword, __location__, name=
"COORDINATION_CUTOFF", &
429 description=
"Define cutoff for coordination number calculation", &
430 usage=
"COORDINATION_CUTOFF", default_r_val=1.e-6_dp)
435 description=
"Scaling parameters (s6,s8) for the D3 dispersion method.", &
436 usage=
"D3BJ_SCALING 1.0 2.4", n_var=2, default_r_vals=[1.0_dp, 2.4_dp])
441 description=
"Becke-Johnson parameters (a1, a2 for the D3 dispersion method.", &
442 usage=
"D3BJ_PARAM 0.63 5.0", n_var=2, default_r_vals=[0.63_dp, 5.0_dp])
446 CALL keyword_create(keyword, __location__, name=
"HUCKEL_CONSTANTS", &
447 description=
"Huckel parameters (s, p, d, sp, 2sH).", &
448 usage=
"HUCKEL_CONSTANTS 1.85 2.25 2.00 2.08 2.85", n_var=5, &
449 default_r_vals=[1.85_dp, 2.25_dp, 2.00_dp, 2.08_dp, 2.85_dp])
453 CALL keyword_create(keyword, __location__, name=
"COULOMB_CONSTANTS", &
454 description=
"Scaling parameters for Coulomb interactions (electrons, nuclei).", &
455 usage=
"COULOMB_CONSTANTS 2.00 1.50", n_var=2, &
456 default_r_vals=[2.00_dp, 1.50_dp])
461 description=
"Scaling parameters for Coordination number correction term.", &
462 usage=
"CN_CONSTANTS 0.006 -0.003 -0.005", n_var=3, &
463 default_r_vals=[0.006_dp, -0.003_dp, -0.005_dp])
468 description=
"Scaling parameters for electronegativity correction term.", &
469 usage=
"EN_CONSTANTS -0.007 0.000 0.000", n_var=3, &
470 default_r_vals=[-0.007_dp, 0.000_dp, 0.000_dp])
475 description=
"Scaling parameter for electronegativity correction term.", &
476 usage=
"BEN_CONSTANT 4.0", n_var=1, &
477 default_r_val=4.0_dp)
482 description=
"Scaling parameter repulsive energy (dEN in exponential).", &
483 usage=
"ENSCALE 0.01", n_var=1, &
484 default_r_val=0.0_dp)
488 CALL keyword_create(keyword, __location__, name=
"HALOGEN_BINDING", &
489 description=
"Scaling parameters for electronegativity correction term.", &
490 usage=
"HALOGEN_BINDING 1.30 0.44", n_var=2, default_r_vals=[1.30_dp, 0.44_dp])
495 description=
"Specifies the specific Kab value for types A and B.", &
496 usage=
"KAB_PARAM kind1 kind2 value ", repeats=.true., &
497 n_var=-1, type_of_var=
char_t)
502 description=
"Specifies the radius [Bohr] of the XB pair interaction in xTB.", &
503 usage=
"XB_RADIUS 20.0 ", repeats=.false., &
504 n_var=1, default_r_val=20.0_dp)
508 CALL keyword_create(keyword, __location__, name=
"COULOMB_SR_CUT", &
509 description=
"Maximum range of short range part of Coulomb interaction.", &
510 usage=
"COULOMB_SR_CUT 20.0 ", repeats=.false., &
511 n_var=1, default_r_val=20.0_dp)
515 CALL keyword_create(keyword, __location__, name=
"COULOMB_SR_EPS", &
516 description=
"Cutoff for short range part of Coulomb interaction.", &
517 usage=
"COULOMB_SR_EPS 1.E-3 ", repeats=.false., &
518 n_var=1, default_r_val=1.0e-03_dp)
522 CALL keyword_create(keyword, __location__, name=
"SRB_PARAMETER", &
523 description=
"SRB parameters (ksrb, esrb, gscal, c1, c2, shift).", &
524 usage=
"SRB_PARAMETER -0.0129 3.48 0.51 -1.71 2.11 0.0537", n_var=6, &
525 default_r_vals=[-0.0129_dp, 3.4847_dp, 0.5097_dp, &
526 -1.70549806_dp, 2.10878369_dp, 0.0537_dp])
530 END SUBROUTINE create_xtb_parameter_section
535 SUBROUTINE create_xtb_nonbonded_section(section)
541 cpassert(.NOT.
ASSOCIATED(section))
543 description=
"This section specifies the input parameters for NON-BONDED interactions.", &
544 n_keywords=1, n_subsections=0, repeats=.false.)
553 description=
"Parameter used for computing the derivative with the Ridders' method.", &
554 usage=
"DX <REAL>", default_r_val=0.1_dp, unit_str=
"bohr")
559 description=
"Checks that the error in computing the derivative is not larger than "// &
560 "the value set; in case error is larger a warning message is printed.", &
561 usage=
"ERROR_LIMIT <REAL>", default_r_val=1.0e-12_dp)
565 END SUBROUTINE create_xtb_nonbonded_section
571 SUBROUTINE create_xtb_tblite_section(section)
577 cpassert(.NOT.
ASSOCIATED(section))
579 description=
"Section used to specify options for an xTB computation using tblite. "// &
580 "This section is required when XTB/GFN_TYPE is set to TBLITE. "// &
581 "Periodicity follows SUBSYS/CELL/PERIODIC; the deprecated XTB/DO_EWALD keyword "// &
582 "is read consistently with CP2K-internal xTB for diagnostics/debugging.", &
587 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
588 description=
"Marks the tblite options section as present. The tblite backend is selected "// &
589 "with XTB/GFN_TYPE TBLITE.", &
590 lone_keyword_l_val=.true., default_l_val=.false.)
596 description=
"Selection of the method used in tblite.", &
597 usage=
"METHOD (GFN1|GFN2|IPEA1)", &
598 enum_c_vals=
s2a(
"GFN1",
"GFN2",
"IPEA1"), &
600 enum_desc=
s2a(
"Uses the GFN1-XTB method by Grimme.", &
601 "Uses the GFN2-XTB method by Grimme.", &
602 "Uses the IEPEA1 method by Grimme."), &
607 CALL add_tb_scc_mixer_keywords(section,
"CP2K/tblite xTB", &
608 "AUTO uses tblite's internal SCC mixer.")
611 CALL keyword_create(keyword, __location__, name=
"REFERENCE_CLI", &
612 description=
"Enable the native tblite CLI reference check. If true, the "// &
613 "XTB/TBLITE/REFERENCE_CLI section must be present. The reference check is also "// &
614 "enabled whenever that section is present. This diagnostic path is skipped for "// &
615 "CP2K multi-k-point calculations, because the native tblite CLI does not reproduce "// &
616 "CP2K KPOINTS sampling.", &
617 usage=
"REFERENCE_CLI", default_l_val=.false., lone_keyword_l_val=.true.)
622 CALL create_xtb_reference_cli_section(subsection)
626 END SUBROUTINE create_xtb_tblite_section
634 SUBROUTINE add_tb_scc_mixer_keywords(section, TARGET, auto_desc)
636 CHARACTER(LEN=*),
INTENT(IN) ::
target, auto_desc
642 description=
"Selects the SCC variable mixer for "//
TARGET//
" calculations. "// &
643 auto_desc//
" TBLITE forces the tblite modified Broyden SCC mixer, CP2K forces CP2K "// &
644 "charge mixing, and NONE updates SCC variables without mixing.", &
645 usage=
"SCC_MIXER (AUTO|TBLITE|CP2K|NONE)", &
646 enum_c_vals=
s2a(
"AUTO",
"TBLITE",
"CP2K",
"NONE"), &
649 enum_desc=
s2a(
"Default method-dependent choice.", &
650 "Use the tblite modified Broyden SCC mixer.", &
651 "Use CP2K charge mixing for SCC variables.", &
652 "Do not mix SCC variables; for debugging."), &
657 CALL keyword_create(keyword, __location__, name=
"TBLITE_MIXER_DAMPING", &
658 description=
"Damping parameter for the tblite modified Broyden SCC mixer. "// &
659 "Only active when the effective SCC mixer is TBLITE, either explicitly or via AUTO. "// &
660 "The iteration limit is taken from DFT/SCF/MAX_SCF.", &
661 usage=
"TBLITE_MIXER_DAMPING 0.4", default_r_val=0.4_dp)
665 END SUBROUTINE add_tb_scc_mixer_keywords
671 SUBROUTINE create_xtb_reference_cli_section(section)
676 cpassert(.NOT.
ASSOCIATED(section))
677 CALL section_create(section, __location__, name=
"REFERENCE_CLI", &
678 description=
"Run the native tblite command line interface as a reference "// &
679 "for CP2K/tblite energies, nuclear gradients, and optionally virials. "// &
680 "The section is a lone section: if it is present, the reference check is enabled.", &
681 n_keywords=1, n_subsections=0, repeats=.false.)
684 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
685 description=
"Activates the native tblite CLI reference check when the section is present.", &
686 lone_keyword_l_val=.true., default_l_val=.false.)
691 description=
"Executable name or path for the native tblite command line program.", &
692 usage=
"PROGRAM_NAME tblite", n_var=1, type_of_var=
char_t, default_c_val=
"tblite")
696 CALL keyword_create(keyword, __location__, name=
"WORK_DIRECTORY", &
697 description=
"Directory used for temporary native tblite CLI input and output files.", &
698 usage=
"WORK_DIRECTORY .", n_var=1, type_of_var=
char_t, default_c_val=
".")
703 description=
"Prefix for temporary native tblite CLI input and output files.", &
704 usage=
"PREFIX tblite-reference", n_var=1, type_of_var=
char_t, &
705 default_c_val=
"tblite-reference")
710 description=
"Keep the temporary native tblite CLI input and output files.", &
711 usage=
"KEEP_FILES T", default_l_val=.false., lone_keyword_l_val=.true.)
716 description=
"Tolerance for reporting reference CLI deviations.", &
717 usage=
"ERROR_LIMIT 1.0E-8", default_r_val=1.0e-8_dp)
721 CALL keyword_create(keyword, __location__, name=
"STOP_ON_ERROR", &
722 description=
"Abort if a checked reference CLI deviation exceeds ERROR_LIMIT.", &
723 usage=
"STOP_ON_ERROR T", default_l_val=.false., lone_keyword_l_val=.true.)
728 description=
"Compare CP2K/tblite energy against the native tblite CLI energy.", &
729 usage=
"CHECK_ENERGY T", default_l_val=.true., lone_keyword_l_val=.true.)
734 description=
"Compare CP2K/tblite nuclear gradients against native tblite CLI gradients.", &
735 usage=
"CHECK_FORCES T", default_l_val=.true., lone_keyword_l_val=.true.)
740 description=
"Compare CP2K/tblite virial against the native tblite CLI virial.", &
741 usage=
"CHECK_VIRIAL T", default_l_val=.false., lone_keyword_l_val=.true.)
746 description=
"Value passed to native tblite as --acc.", &
747 usage=
"ACCURACY 1.0", default_r_val=1.0_dp)
752 description=
"Value passed to native tblite as --iterations.", &
753 usage=
"ITERATIONS 250", default_i_val=250)
757 END SUBROUTINE create_xtb_reference_cli_section
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public caldeweyher2020
integer, save, public caldeweyher2017
integer, save, public grimme2017
integer, save, public elstner1998
integer, save, public hu2007
integer, save, public asgeirsson2017
integer, save, public porezag1995
integer, save, public bannwarth2019
integer, save, public seifert1996
integer, save, public zhechkov2005
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.