(git:6344619)
Loading...
Searching...
No Matches
input_cp2k_scf.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 scf section of the input
10!> \par History
11!> 10.2005 moved out of input_cp2k [fawzi]
12!> 07.2024 moved out of input_cp2k_dft [JGH]
13!> \author fawzi
14! **************************************************************************************************
16 USE bibliography, ONLY: &
24 USE cp_units, ONLY: cp_unit_to_cp2k
25 USE input_constants, ONLY: &
60 USE input_val_types, ONLY: char_t,&
61 integer_t,&
62 real_t
63 USE kinds, ONLY: dp
67 USE string_utilities, ONLY: newline,&
68 s2a
69#include "./base/base_uses.f90"
70
71 IMPLICIT NONE
72 PRIVATE
73
74 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_scf'
75
77
78CONTAINS
79
80! **************************************************************************************************
81!> \brief creates the structure of the section with the DFT SCF parameters
82!> \param section will contain the SCF section
83!> \author fawzi
84! **************************************************************************************************
85 SUBROUTINE create_scf_section(section)
86 TYPE(section_type), POINTER :: section
87
88 TYPE(keyword_type), POINTER :: keyword
89 TYPE(section_type), POINTER :: print_key, subsection
90
91 NULLIFY (print_key)
92
93 cpassert(.NOT. ASSOCIATED(section))
94 CALL section_create(section, __location__, name="scf", &
95 description="Parameters needed to perform an SCF run.", &
96 n_keywords=21, n_subsections=8, repeats=.false.)
97
98 NULLIFY (subsection)
99
100 CALL create_ot_section(subsection)
101 CALL section_add_subsection(section, subsection)
102 CALL section_release(subsection)
103
104 CALL create_diagonalization_section(subsection)
105 CALL section_add_subsection(section, subsection)
106 CALL section_release(subsection)
107
108 CALL create_outer_scf_section(subsection)
109 CALL section_add_subsection(section, subsection)
110 CALL section_release(subsection)
111
112 CALL create_smear_section(subsection)
113 CALL section_add_subsection(section, subsection)
114 CALL section_release(subsection)
115
116 CALL create_mixing_section(subsection)
117 CALL section_add_subsection(section, subsection)
118 CALL section_release(subsection)
119
120 CALL create_adiis_section(subsection)
121 CALL section_add_subsection(section, subsection)
122 CALL section_release(subsection)
123
124 CALL create_mom_section(subsection)
125 CALL section_add_subsection(section, subsection)
126 CALL section_release(subsection)
127
128 CALL create_gce_section(subsection)
129 CALL section_add_subsection(section, subsection)
130 CALL section_release(subsection)
131
132 NULLIFY (keyword)
133
134 CALL keyword_create(keyword, __location__, name="MAX_ITER_LUMO", &
135 variants=["MAX_ITER_LUMOS"], &
136 description="Maximum number of iterations for the calculation of the LUMO energies "// &
137 "with the OT eigensolver.", &
138 usage="MAX_ITER_LUMO 100", default_i_val=299)
139 CALL section_add_keyword(section, keyword)
140 CALL keyword_release(keyword)
141
142 CALL keyword_create(keyword, __location__, name="EPS_LUMO", &
143 variants=["EPS_LUMOS"], &
144 description="Target accuracy for the calculation of the LUMO energies with the OT eigensolver.", &
145 usage="EPS_LUMO 1.0E-6", default_r_val=1.0e-5_dp)
146 CALL section_add_keyword(section, keyword)
147 CALL keyword_release(keyword)
148
149 CALL keyword_create(keyword, __location__, name="MAX_SCF", &
150 description="Maximum number of inner SCF iterations for one electronic optimization.", &
151 usage="MAX_SCF 200", default_i_val=50)
152 CALL section_add_keyword(section, keyword)
153 CALL keyword_release(keyword)
154
155 CALL keyword_create(keyword, __location__, name="MAX_SCF_HISTORY", variants=["MAX_SCF_HIST"], &
156 description="Maximum number of SCF iterations after the history pipeline is filled", &
157 usage="MAX_SCF_HISTORY 1", default_i_val=0, lone_keyword_i_val=1)
158 CALL section_add_keyword(section, keyword)
159 CALL keyword_release(keyword)
160
161 CALL keyword_create(keyword, __location__, name="MAX_DIIS", &
162 variants=["MAX_DIIS_BUFFER_SIZE"], &
163 description="Maximum number of conventional DIIS subspace vectors to be used", &
164 usage="MAX_DIIS 3", default_i_val=4)
165 CALL section_add_keyword(section, keyword)
166 CALL keyword_release(keyword)
167
168 CALL keyword_create(keyword, __location__, name="LEVEL_SHIFT", &
169 variants=["LSHIFT"], &
170 description="Use level shifting to improve convergence", &
171 unit_str="au_e", &
172 usage="LEVEL_SHIFT 0.1", &
173 default_r_val=0.0_dp)
174 CALL section_add_keyword(section, keyword)
175 CALL keyword_release(keyword)
176
177 CALL keyword_create(keyword, __location__, name="EPS_SCF", &
178 description="Target convergence threshold for the inner SCF cycle.", &
179 usage="EPS_SCF 1.e-6", default_r_val=1.e-5_dp)
180 CALL section_add_keyword(section, keyword)
181 CALL keyword_release(keyword)
182
183 CALL keyword_create(keyword, __location__, name="EPS_SCF_HISTORY", variants=["EPS_SCF_HIST"], &
184 description="Target accuracy for the SCF convergence after the history pipeline is filled.", &
185 usage="EPS_SCF_HISTORY 1.e-5", default_r_val=0.0_dp, lone_keyword_r_val=1.0e-5_dp)
186 CALL section_add_keyword(section, keyword)
187 CALL keyword_release(keyword)
188
189 CALL keyword_create(keyword, __location__, name="CHOLESKY", &
190 description="If the cholesky method should be used for computing "// &
191 "the inverse of S, and in this case calling which Lapack routines", &
192 usage="CHOLESKY REDUCE", default_i_val=cholesky_restore, &
193 enum_c_vals=s2a("OFF", "REDUCE", "RESTORE", "INVERSE", "INVERSE_DBCSR"), &
194 enum_desc=s2a("The cholesky algorithm is not used", "Reduce is called", &
195 "Reduce is replaced by two restore", &
196 "Restore uses operator multiply by inverse of the triangular matrix", &
197 "Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
199 CALL section_add_keyword(section, keyword)
200 CALL keyword_release(keyword)
201
202 CALL keyword_create(keyword, __location__, name="EPS_EIGVAL", &
203 description="Throw away linear combinations of basis functions with a small eigenvalue in S", &
204 usage="EPS_EIGVAL 1.0", default_r_val=1.0e-5_dp)
205 CALL section_add_keyword(section, keyword)
206 CALL keyword_release(keyword)
207
208 CALL keyword_create(keyword, __location__, name="EPS_DIIS", &
209 description="Threshold on the convergence to start using DIAG/DIIS or OT/DIIS."// &
210 " Default for OT/DIIS is never to switch.", &
211 usage="EPS_DIIS 5.0e-2", default_r_val=0.1_dp)
212 CALL section_add_keyword(section, keyword)
213 CALL keyword_release(keyword)
214
215 CALL keyword_create( &
216 keyword, __location__, name="SCF_GUESS", &
217 description="Selects how the initial wavefunction or density matrix is generated.", &
218 usage="SCF_GUESS RESTART", default_i_val=atomic_guess, &
219 enum_c_vals=s2a("ATOMIC", "RESTART", "RANDOM", "CORE", &
220 "HISTORY_RESTART", "MOPAC", "EHT", "SPARSE", "EXTERNAL_DENSITY", "NONE"), &
221 enum_desc=s2a("Generate an atomic density using the atomic code and internal default values", &
222 "Use the RESTART file as an initial guess (and ATOMIC if not present).", &
223 "Use random wavefunction coefficients.", &
224 "Diagonalize the core hamiltonian for an initial guess.", &
225 "Extrapolated from previous RESTART files.", &
226 "Use same guess as MOPAC for semi-empirical methods or a simple diagonal density matrix for other methods", &
227 "Use the EHT (gfn0-xTB) code to generate an initial wavefunction.", &
228 "Generate a sparse wavefunction using the atomic code (for OT based methods)", &
229 "Read a scalar electron density from a cube file for the first SCF Hamiltonian", &
230 "Skip initial guess (only for non-self consistent methods)."), &
233 CALL section_add_keyword(section, keyword)
234 CALL keyword_release(keyword)
235
236 CALL keyword_create(keyword, __location__, name="EXTERNAL_DENSITY_FILE_NAME", &
237 description="Cube file containing the electron density used when SCF_GUESS is "// &
238 "EXTERNAL_DENSITY. The density is consumed once to build the first KS Hamiltonian; "// &
239 "all subsequent densities are generated by the regular SCF solver. The cube grid "// &
240 "has to coincide with the finest CP2K real-space grid.", &
241 usage="EXTERNAL_DENSITY_FILE_NAME <FILENAME>", &
242 type_of_var=char_t, default_c_val="", n_var=1)
243 CALL section_add_keyword(section, keyword)
244 CALL keyword_release(keyword)
245
246 CALL keyword_create(keyword, __location__, name="NROW_BLOCK", &
247 description="sets the number of rows in a scalapack block", &
248 usage="NROW_BLOCK 31", default_i_val=32)
249 CALL section_add_keyword(section, keyword)
250 CALL keyword_release(keyword)
251
252 CALL keyword_create(keyword, __location__, name="NCOL_BLOCK", &
253 description="Sets the number of columns in a scalapack block", &
254 usage="NCOL_BLOCK 31", default_i_val=32)
255 CALL section_add_keyword(section, keyword)
256 CALL keyword_release(keyword)
257
258 CALL keyword_create(keyword, __location__, name="ADDED_MOS", &
259 description="Number of additional molecular orbitals added for each spin channel. "// &
260 "This is commonly needed for smearing, excited-state, or post-Hartree-Fock calculations. "// &
261 "Use -1 to add all available orbitals. For k-point smearing, use AUTO "// &
262 "to select and adapt the virtual-space buffer.", &
263 usage="ADDED_MOS {integer|AUTO}", default_c_val="0", n_var=-1)
264 CALL section_add_keyword(section, keyword)
265 CALL keyword_release(keyword)
266
267 CALL keyword_create(keyword, __location__, &
268 name="ROKS_SCHEME", &
269 description="Selects the ROKS scheme when ROKS is applied.", &
270 usage="ROKS_SCHEME HIGH-SPIN", &
271 repeats=.false., &
272 n_var=1, &
273 enum_c_vals=s2a("GENERAL", "HIGH-SPIN"), &
274 enum_i_vals=[general_roks, high_spin_roks], &
275 default_i_val=high_spin_roks)
276 CALL section_add_keyword(section, keyword)
277 CALL keyword_release(keyword)
278
279 CALL keyword_create(keyword, __location__, &
280 name="ROKS_F", &
281 variants=["F_ROKS"], &
282 description="Allows to define the parameter f for the "// &
283 "general ROKS scheme.", &
284 usage="ROKS_F 1/2", &
285 repeats=.false., &
286 n_var=1, &
287 type_of_var=real_t, &
288 default_r_val=0.5_dp)
289 CALL section_add_keyword(section, keyword)
290 CALL keyword_release(keyword)
291
292 CALL keyword_create(keyword, __location__, &
293 name="ROKS_PARAMETERS", &
294 variants=["ROKS_PARAMETER"], &
295 description="Allows to define all parameters for the high-spin "// &
296 "ROKS scheme explicitly. "// &
297 "The full set of 6 parameters has to be specified "// &
298 "in the order acc, bcc, aoo, boo, avv, bvv", &
299 usage="ROKS_PARAMETERS 1/2 1/2 1/2 1/2 1/2 1/2", &
300 repeats=.false., &
301 n_var=6, &
302 type_of_var=real_t, &
303 default_r_vals=[-0.5_dp, 1.5_dp, 0.5_dp, 0.5_dp, 1.5_dp, -0.5_dp])
304 CALL section_add_keyword(section, keyword)
305 CALL keyword_release(keyword)
306
307 CALL keyword_create(keyword, __location__, name="IGNORE_CONVERGENCE_FAILURE", &
308 description="If true, only a warning is issued if an SCF "// &
309 "iteration has not converged. By default, a run is aborted "// &
310 "if the required convergence criteria have not been achieved.", &
311 usage="IGNORE_CONVERGENCE_FAILURE logical_value", &
312 default_l_val=.false., &
313 lone_keyword_l_val=.true.)
314 CALL section_add_keyword(section, keyword)
315 CALL keyword_release(keyword)
316
317 CALL keyword_create(keyword, __location__, name="FORCE_SCF_CALCULATION", &
318 description="Request a SCF type solution even for nonSCF methods. ", &
319 usage="FORCE_SCF_CALCULATION logical_value", &
320 default_l_val=.false., &
321 lone_keyword_l_val=.true.)
322 CALL section_add_keyword(section, keyword)
323 CALL keyword_release(keyword)
324
325 CALL section_create(subsection, __location__, name="PRINT", &
326 description="Printing of information during the SCF.", repeats=.false.)
327
328 CALL cp_print_key_section_create(print_key, __location__, "RESTART", &
329 description="Controls the dumping of the latest wavefunction restart "// &
330 "file during SCF. The file suffix will be `.wfn` for a Gamma-only "// &
331 "calculation and `.kp` for a k-point sampling calculation by default; "// &
332 "both are unformatted binary files and are not interchangeable for "// &
333 "restarting purposes. The FORCE_EVAL/DFT/WFN_RESTART_FILE_NAME "// &
334 "keyword can be used to read a restart file generated here for "// &
335 "MO information. See also RESTART_HISTORY.", &
336 print_level=low_print_level, common_iter_levels=3, &
337 each_iter_names=s2a("QS_SCF"), each_iter_values=[20], &
338 add_last=add_last_numeric, filename="RESTART", do_backup=.true.)
339 CALL section_add_subsection(subsection, print_key)
340 CALL section_release(print_key)
341
343 print_key, __location__, "RESTART_HISTORY", &
344 description="Dumps unique wavefunction restart files during the run, keeping all of them. "// &
345 "For the latest wavefunction restart file, see RESTART, which shares the same file formats.", &
346 print_level=low_print_level, common_iter_levels=0, &
347 each_iter_names=s2a("__ROOT__", "MD", "GEO_OPT", "ROT_OPT", "NEB", "METADYNAMICS", "QS_SCF"), &
348 each_iter_values=[500, 500, 500, 500, 500, 500, 500], &
349 filename="RESTART", do_backup=.true.)
350 CALL section_add_subsection(subsection, print_key)
351 CALL section_release(print_key)
352
353 CALL cp_print_key_section_create(print_key, __location__, "iteration_info", &
354 description="Controls the printing of basic iteration information during the SCF.", &
355 print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
356 CALL keyword_create(keyword, __location__, name="time_cumul", &
357 description="If the printkey is activated switches the printing of timings"// &
358 " to cumulative (over the SCF).", &
359 default_l_val=.false., lone_keyword_l_val=.true.)
360 CALL section_add_keyword(print_key, keyword)
361 CALL keyword_release(keyword)
362 CALL section_add_subsection(subsection, print_key)
363 CALL section_release(print_key)
364
365 CALL cp_print_key_section_create(print_key, __location__, "program_run_info", &
366 description="Controls the printing of basic information during the SCF.", &
367 print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
368 CALL section_add_subsection(subsection, print_key)
369 CALL section_release(print_key)
370
371 CALL cp_print_key_section_create(print_key, __location__, "MO_ORTHONORMALITY", &
372 description="Controls the printing relative to the orthonormality of MOs (CT S C).", &
373 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
374 CALL section_add_subsection(subsection, print_key)
375 CALL section_release(print_key)
376
377 CALL cp_print_key_section_create(print_key, __location__, "MO_MAGNITUDE", &
378 description="Prints the min/max eigenvalues of the overlap of the MOs without S (CT C).", &
379 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
380 CALL section_add_subsection(subsection, print_key)
381 CALL section_release(print_key)
382
383 CALL cp_print_key_section_create(print_key, __location__, "detailed_energy", &
384 description="Controls the printing of detailed energy information.", &
385 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
386 CALL section_add_subsection(subsection, print_key)
387 CALL section_release(print_key)
388
389 CALL cp_print_key_section_create(print_key, __location__, "diis_info", &
390 description="Controls the printing of DIIS information.", &
391 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
392 CALL section_add_subsection(subsection, print_key)
393 CALL section_release(print_key)
394
395 CALL cp_print_key_section_create(print_key, __location__, "total_densities", &
396 description="Controls the printing of total densities.", &
397 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
398 CALL section_add_subsection(subsection, print_key)
399 CALL section_release(print_key)
400
401 CALL cp_print_key_section_create(print_key, __location__, "Lanczos", &
402 description="Controls the printing of information on Lanczos refinement iterations.", &
403 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
404 CALL section_add_subsection(subsection, print_key)
405 CALL section_release(print_key)
406
408 print_key, __location__, "DIAG_SUB_SCF", &
409 description="Controls the printing of information on subspace diagonalization internal loop. ", &
410 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
411 CALL section_add_subsection(subsection, print_key)
412 CALL section_release(print_key)
413
414 CALL cp_print_key_section_create(print_key, __location__, "Davidson", &
415 description="Controls the printing of information on Davidson iterations.", &
416 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
417 CALL section_add_subsection(subsection, print_key)
418 CALL section_release(print_key)
419
420 CALL cp_print_key_section_create(print_key, __location__, "FILTER_MATRIX", &
421 description="Controls the printing of information on Filter Matrix method.", &
422 print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
423 CALL section_add_subsection(subsection, print_key)
424 CALL section_release(print_key)
425
426 CALL keyword_create(keyword, __location__, name="DM_RESTART_WRITE", &
427 description="Write the density matrix into a binary file at the end of the SCF.", &
428 usage="DM_RESTART_WRITE", default_l_val=.false., lone_keyword_l_val=.true.)
429 CALL section_add_keyword(subsection, keyword)
430 CALL keyword_release(keyword)
431
432 CALL section_add_subsection(section, subsection)
433 CALL section_release(subsection)
434
435 END SUBROUTINE create_scf_section
436
437! **************************************************************************************************
438!> \brief creates the structure of the section with SCF parameters
439!> controlling an other loop
440!> \param section will contain the SCF section
441!> \author Joost VandeVondele [2006.03]
442! **************************************************************************************************
443 SUBROUTINE create_outer_scf_section(section)
444 TYPE(section_type), POINTER :: section
445
446 TYPE(keyword_type), POINTER :: keyword
447 TYPE(section_type), POINTER :: subsection
448
449 cpassert(.NOT. ASSOCIATED(section))
450 CALL section_create(section, __location__, name="OUTER_SCF", &
451 description="Controls an outer SCF loop, often used to stabilize difficult OT convergence, "// &
452 "constraints, or other variables wrapped around the inner SCF cycle.", &
453 n_keywords=13, n_subsections=1, repeats=.false.)
454
455 NULLIFY (keyword)
456
457 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
458 description="Activates the outer SCF loop.", &
459 usage="&OUTER_SCF ON", default_l_val=.false., lone_keyword_l_val=.true.)
460 CALL section_add_keyword(section, keyword)
461 CALL keyword_release(keyword)
462
463 ! add CDFT_OPT section
464 NULLIFY (subsection)
465 CALL create_cdft_opt_section(subsection)
466 CALL section_add_subsection(section, subsection)
467 CALL section_release(subsection)
468
469 CALL keyword_create(keyword, __location__, name="TYPE", &
470 description="Specifies which kind of outer SCF should be employed", &
471 usage="TYPE DDAPC_CONSTRAINT ", &
472 default_i_val=outer_scf_none, &
473 enum_c_vals=s2a("DDAPC_CONSTRAINT", "S2_CONSTRAINT", &
474 "BASIS_CENTER_OPT", "CDFT_CONSTRAINT", "NONE"), &
475 enum_desc=s2a("Enforce a constraint on the DDAPC, requires the corresponding section", &
476 "Enforce a constraint on the S2, requires the corresponding section", &
477 "Optimize positions of basis functions, if atom types FLOATING_BASIS_CENTER "// &
478 "are defined", &
479 "Enforce a constraint on a generic CDFT weight population. "// &
480 "Requires the corresponding section QS&CDFT"// &
481 " which determines the type of weight used.", &
482 "Do nothing in the outer loop, useful for resetting the inner loop,"), &
485 CALL section_add_keyword(section, keyword)
486 CALL keyword_release(keyword)
487
488 CALL keyword_create(keyword, __location__, name="OPTIMIZER", &
489 description="Method used to bring the outer loop to a stationary point", &
490 usage="OPTIMIZER SD", &
491 default_i_val=outer_scf_optimizer_none, &
492 enum_c_vals=s2a("SD", "DIIS", "NONE", "BISECT", "BROYDEN", "NEWTON", "SECANT", "NEWTON_LS"), &
493 enum_desc=s2a("Takes steps in the direction of the gradient, multiplied by step_size", &
494 "Uses a Direct Inversion in the Iterative Subspace method", &
495 "Do nothing, useful only with the none type", &
496 "Bisection of the gradient, useful for difficult one dimensional cases", &
497 "Broyden's method. Variant defined in BROYDEN_TYPE.", &
498 "Newton's method. Only compatible with CDFT constraints.", &
499 "Secant method. Only for one dimensional cases. See Broyden for "// &
500 "multidimensional cases.", &
501 "Newton's method with backtracking line search to find the optimal step size. "// &
502 "Only compatible with CDFT constraints. Starts from the regular Newton solution "// &
503 "and successively reduces the step size until the L2 norm of the CDFT gradient "// &
504 "decreases or MAX_LS steps is reached. Potentially very expensive because "// &
505 "each iteration performs a full SCF calculation."), &
510 CALL section_add_keyword(section, keyword)
511 CALL keyword_release(keyword)
512
513 CALL keyword_create(keyword, __location__, name="BISECT_TRUST_COUNT", &
514 description="Maximum number of times the same point will be used in bisection,"// &
515 " a small number guards against the effect of wrongly converged states.", &
516 usage="BISECT_TRUST_COUNT 5", default_i_val=10)
517 CALL section_add_keyword(section, keyword)
518 CALL keyword_release(keyword)
519
520 CALL keyword_create(keyword, __location__, name="EPS_SCF", &
521 description="The target gradient of the outer SCF variables. "// &
522 "Notice that the EPS_SCF of the inner loop also determines "// &
523 "the value that can be reached in the outer loop, "// &
524 "typically EPS_SCF of the outer loop must be smaller "// &
525 "than or equal to EPS_SCF of the inner loop.", &
526 usage="EPS_SCF 1.0E-6 ", default_r_val=1.0e-5_dp)
527 CALL section_add_keyword(section, keyword)
528 CALL keyword_release(keyword)
529
530 CALL keyword_create(keyword, __location__, name="DIIS_BUFFER_LENGTH", &
531 description="Maximum number of DIIS vectors used ", &
532 usage="DIIS_BUFFER_LENGTH 5", default_i_val=3)
533 CALL section_add_keyword(section, keyword)
534 CALL keyword_release(keyword)
535
536 CALL keyword_create(keyword, __location__, name="EXTRAPOLATION_ORDER", &
537 description="Number of past states used in the extrapolation of the variables during e.g. MD", &
538 usage="EXTRAPOLATION_ORDER 5", default_i_val=3)
539 CALL section_add_keyword(section, keyword)
540 CALL keyword_release(keyword)
541
542 CALL keyword_create(keyword, __location__, name="MAX_SCF", &
543 description="Maximum number of outer SCF loops.", &
544 usage="MAX_SCF 20", default_i_val=50)
545 CALL section_add_keyword(section, keyword)
546 CALL keyword_release(keyword)
547
548 CALL keyword_create(keyword, __location__, name="STEP_SIZE", &
549 description="The initial step_size used in the optimizer (currently steepest descent). "// &
550 "Note that in cases where a sadle point is sought for (constrained DFT),"// &
551 " this can be negative. For Newton and Broyden optimizers, use a value less/higher than "// &
552 "the default 1.0 (in absolute value, the sign is not significant) to active an under/overrelaxed "// &
553 "optimizer.", &
554 usage="STEP_SIZE -1.0", default_r_val=0.5_dp)
555 CALL section_add_keyword(section, keyword)
556 CALL keyword_release(keyword)
557
558 END SUBROUTINE create_outer_scf_section
559
560! **************************************************************************************************
561!> \brief makes the orbital transformation section
562!> \param section ...
563!> \param diagonalization ...
564!> \par History
565!> 11.2004 created [Joost VandeVondele]
566! **************************************************************************************************
567 SUBROUTINE create_ot_section(section, diagonalization)
568 TYPE(section_type), POINTER :: section
569 LOGICAL, INTENT(IN), OPTIONAL :: diagonalization
570
571 LOGICAL :: is_diagonalization
572 TYPE(keyword_type), POINTER :: keyword
573
574 cpassert(.NOT. ASSOCIATED(section))
575 is_diagonalization = .false.
576 IF (PRESENT(diagonalization)) is_diagonalization = diagonalization
577 IF (is_diagonalization) THEN
578 CALL section_create(section, __location__, name="OT", &
579 description="Configures OT as the iterative eigensolver selected by "// &
580 "SCF%DIAGONALIZATION%ALGORITHM OT. The solver minimizes the trace of the "// &
581 "requested orbital subspace for a fixed Kohn-Sham matrix. Orbital energies, "// &
582 "occupations, smearing, density construction, and density mixing are handled "// &
583 "afterwards by the parent DIAGONALIZATION SCF path.", &
584 n_keywords=28, n_subsections=0, repeats=.false., &
585 citations=[vandevondele2003, weber2008])
586 ELSE
587 CALL section_create(section, __location__, name="OT", &
588 description="Sets the various options for the orbital transformation (OT) method. "// &
589 "Default settings already provide an efficient, yet robust method. "// &
590 "Most systems benefit from using the FULL_ALL preconditioner "// &
591 "combined with a small value (0.001) of ENERGY_GAP. "// &
592 "Well-behaved systems might benefit from using a DIIS minimizer. "//newline//newline// &
593 "**Advantages:** "// &
594 "It's fast, because no expensive diagonalisation is performed. "// &
595 "If preconditioned correctly, method guaranteed to find minimum. "//newline//newline// &
596 "**Disadvantages:** "// &
597 "Sensitive to preconditioning. A good preconditioner can be expensive. "// &
598 "Metallic systems require a sufficiently large virtual orbital space and "// &
599 "the coupled ROTATION and ENERGIES variables.", &
600 n_keywords=28, n_subsections=0, repeats=.false., &
601 citations=[vandevondele2003, weber2008])
602 END IF
603
604 NULLIFY (keyword)
605
606 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
607 description="controls the activation of the ot method", &
608 usage="&OT T", &
609 default_l_val=.false., &
610 lone_keyword_l_val=.true.)
611 CALL section_add_keyword(section, keyword)
612 CALL keyword_release(keyword)
613
614 CALL keyword_create(keyword, __location__, name="ALGORITHM", &
615 description="Algorithm to be used for OT", &
616 usage="ALGORITHM STRICT", &
617 default_i_val=ot_algo_taylor_or_diag, &
618 enum_c_vals=s2a("STRICT", "IRAC"), &
619 enum_desc=s2a("Strict orthogonality: Taylor or diagonalization based algorithm.", &
620 "Orbital Transformation based Iterative Refinement "// &
621 "of the Approximative Congruence transformation (OT/IR)."), &
622 enum_i_vals=[ot_algo_taylor_or_diag, ot_algo_irac], &
624 CALL section_add_keyword(section, keyword)
625 CALL keyword_release(keyword)
626
627 CALL keyword_create(keyword, __location__, name="IRAC_DEGREE", &
628 description="The refinement polynomial degree (2, 3 or 4).", &
629 usage="IRAC_DEGREE 4", &
630 default_i_val=4)
631 CALL section_add_keyword(section, keyword)
632 CALL keyword_release(keyword)
633
634 CALL keyword_create(keyword, __location__, name="MAX_IRAC", &
635 description="Maximum allowed refinement iteration.", &
636 usage="MAX_IRAC 5", &
637 default_i_val=50)
638 CALL section_add_keyword(section, keyword)
639 CALL keyword_release(keyword)
640
641 CALL keyword_create(keyword, __location__, name="ORTHO_IRAC", &
642 description="The orthogonality method.", &
643 usage="ORTHO_IRAC POLY", &
644 default_i_val=ot_chol_irac, &
645 enum_c_vals=s2a("CHOL", "POLY", "LWDN"), &
646 enum_desc=s2a("Cholesky.", "Polynomial.", "Loewdin."), &
647 enum_i_vals=[ot_chol_irac, ot_poly_irac, ot_lwdn_irac])
648 CALL section_add_keyword(section, keyword)
649 CALL keyword_release(keyword)
650
651 CALL keyword_create(keyword, __location__, name="EPS_IRAC_FILTER_MATRIX", &
652 description="Sets the threshold for filtering the matrices.", &
653 usage="EPS_IRAC_FILTER_MATRIX 1.0E-5", &
654 default_r_val=0.0_dp)
655 CALL section_add_keyword(section, keyword)
656 CALL keyword_release(keyword)
657
658 CALL keyword_create(keyword, __location__, name="EPS_IRAC", &
659 description="Targeted accuracy during the refinement iteration.", &
660 usage="EPS_IRAC 1.0E-5", &
661 default_r_val=1.0e-10_dp)
662 CALL section_add_keyword(section, keyword)
663 CALL keyword_release(keyword)
664
665 CALL keyword_create(keyword, __location__, name="EPS_IRAC_QUICK_EXIT", &
666 description="Only one extra refinement iteration is "// &
667 "done when the norm is below this value.", &
668 usage="EPS_IRAC_QUICK_EXIT 1.0E-2", &
669 default_r_val=1.0e-5_dp)
670 CALL section_add_keyword(section, keyword)
671 CALL keyword_release(keyword)
672
673 CALL keyword_create(keyword, __location__, name="EPS_IRAC_SWITCH", &
674 description="The algorithm switches to the polynomial "// &
675 "refinement when the norm is below this value.", &
676 usage="EPS_IRAC_SWITCH 1.0E-3", &
677 default_r_val=1.0e-2_dp)
678 CALL section_add_keyword(section, keyword)
679 CALL keyword_release(keyword)
680
681 CALL keyword_create(keyword, __location__, name="ON_THE_FLY_LOC", &
682 description="On the fly localization of the molecular orbitals. "// &
683 "Can only be used with OT/IRAC.", &
684 usage="ON_THE_FLY_LOC T", &
685 default_l_val=.false.)
686 CALL section_add_keyword(section, keyword)
687 CALL keyword_release(keyword)
688
689 CALL keyword_create( &
690 keyword, __location__, name="MINIMIZER", &
691 description="Minimizer to be used with the OT method", &
692 usage="MINIMIZER DIIS", &
693 default_i_val=ot_mini_cg, &
694 enum_c_vals=s2a("SD", "CG", "DIIS", "BROYDEN", "LBFGS"), &
695 enum_desc=s2a("Steepest descent: not recommended", "Conjugate Gradients: most reliable, use for difficult systems."// &
696 " The total energy should decrease at every OT CG step if the line search is appropriate.", &
697 "Direct inversion in the iterative subspace: less reliable than CG, but sometimes about 50% faster", &
698 "Broyden mixing approximating the inverse Hessian", &
699 "Limited-memory BFGS in the fixed OT product chart. The selected OT preconditioner is used"// &
700 " as the initial inverse Hessian. The secant history is reset after a tenfold increase in"// &
701 " the raw fixed-chart gradient norm. With OUTER_SCF, an explicit EPS_DIIS can switch later"// &
702 " outer iterations to OT/DIIS. Available with ALGORITHM STRICT or IRAC."), &
704 CALL section_add_keyword(section, keyword)
705 CALL keyword_release(keyword)
706
707 CALL keyword_create(keyword, __location__, name="SAFE_DIIS", &
708 variants=["SAFER_DIIS"], &
709 description="Reject DIIS steps if they point away from the"// &
710 " minimum, do SD in that case.", &
711 usage="SAFE_DIIS ON", default_l_val=.true.)
712 CALL section_add_keyword(section, keyword)
713 CALL keyword_release(keyword)
714
715 CALL keyword_create(keyword, __location__, name="MAX_SCF_DIIS", &
716 description="Maximum DIIS SCF inner loop cycles. This can be used to extend"// &
717 " SCF cycles after a switch to DIIS (see eps_diis).", &
718 usage="MAX_SCF_DIIS 20", &
719 default_i_val=0)
720 CALL section_add_keyword(section, keyword)
721 CALL keyword_release(keyword)
722
723 CALL keyword_create(keyword, __location__, name="N_HISTORY_VEC", &
724 variants=s2a("NDIIS", "N_DIIS", "N_BROYDEN", "N_LBFGS"), &
725 description="Number of history vectors to be used with DIIS, BROYDEN, or LBFGS", &
726 usage="N_HISTORY_VEC 7", &
727 default_i_val=7)
728 CALL section_add_keyword(section, keyword)
729 CALL keyword_release(keyword)
730
731 CALL keyword_create( &
732 keyword, __location__, name="LBFGS_CURVATURE_TOL", &
733 description="Minimum dimensionless relative curvature accepted for an LBFGS secant pair."// &
734 " Values are restricted to the interval [0,1).", &
735 usage="LBFGS_CURVATURE_TOL 1.0E-4", &
736 default_r_val=1.0e-4_dp)
737 CALL section_add_keyword(section, keyword)
738 CALL keyword_release(keyword)
739
740 CALL keyword_create( &
741 keyword, __location__, name="LBFGS_DAMPING", &
742 description="Regularize weak or negative LBFGS curvature by the smallest shift of the"// &
743 " gradient difference along the step that satisfies LBFGS_CURVATURE_TOL."// &
744 " If disabled, such secant pairs are skipped.", &
745 usage="LBFGS_DAMPING ON", &
746 default_l_val=.true., &
747 lone_keyword_l_val=.true.)
748 CALL section_add_keyword(section, keyword)
749 CALL keyword_release(keyword)
750
751 CALL keyword_create(keyword, __location__, name="BROYDEN_BETA", &
752 description="Underrelaxation for the broyden mixer", &
753 usage="BROYDEN_BETA 0.9", &
754 default_r_val=0.9_dp)
755 CALL section_add_keyword(section, keyword)
756 CALL keyword_release(keyword)
757
758 CALL keyword_create(keyword, __location__, name="BROYDEN_GAMMA", &
759 description="Backtracking parameter", &
760 usage="BROYDEN_GAMMA 0.5", &
761 default_r_val=0.5_dp)
762 CALL section_add_keyword(section, keyword)
763 CALL keyword_release(keyword)
764
765 CALL keyword_create(keyword, __location__, name="BROYDEN_SIGMA", &
766 description="Curvature of energy functional.", &
767 usage="BROYDEN_SIGMA 0.25", &
768 default_r_val=0.25_dp)
769 CALL section_add_keyword(section, keyword)
770 CALL keyword_release(keyword)
771
772 CALL keyword_create(keyword, __location__, name="BROYDEN_ETA", &
773 description="Dampening of estimated energy curvature.", &
774 usage="BROYDEN_ETA 0.7", &
775 default_r_val=0.7_dp)
776 CALL section_add_keyword(section, keyword)
777 CALL keyword_release(keyword)
778
779 CALL keyword_create(keyword, __location__, name="BROYDEN_OMEGA", &
780 description="Growth limit of curvature.", &
781 usage="BROYDEN_OMEGA 1.1", &
782 default_r_val=1.1_dp)
783 CALL section_add_keyword(section, keyword)
784 CALL keyword_release(keyword)
785
786 CALL keyword_create(keyword, __location__, name="BROYDEN_SIGMA_DECREASE", &
787 description="Reduction of curvature on bad approximation.", &
788 usage="BROYDEN_SIGMA_DECREASE 0.7", &
789 default_r_val=0.7_dp)
790 CALL section_add_keyword(section, keyword)
791 CALL keyword_release(keyword)
792
793 CALL keyword_create(keyword, __location__, name="BROYDEN_SIGMA_MIN", &
794 description="Minimum adaptive curvature.", &
795 usage="BROYDEN_SIGMA_MIN 0.05", &
796 default_r_val=0.05_dp)
797 CALL section_add_keyword(section, keyword)
798 CALL keyword_release(keyword)
799
800 CALL keyword_create(keyword, __location__, name="BROYDEN_FORGET_HISTORY", &
801 description="Forget history on bad approximation", &
802 usage="BROYDEN_FORGET_HISTORY OFF", default_l_val=.false., &
803 lone_keyword_l_val=.true.)
804 CALL section_add_keyword(section, keyword)
805 CALL keyword_release(keyword)
806
807 CALL keyword_create(keyword, __location__, name="BROYDEN_ADAPTIVE_SIGMA", &
808 description="Enable adaptive curvature estimation", &
809 usage="BROYDEN_ADAPTIVE_SIGMA ON", default_l_val=.true., &
810 lone_keyword_l_val=.true.)
811 CALL section_add_keyword(section, keyword)
812 CALL keyword_release(keyword)
813
814 CALL keyword_create(keyword, __location__, name="BROYDEN_ENABLE_FLIP", &
815 description="Ensure positive definite update", &
816 usage="BROYDEN_ENABLE_FLIP ON", default_l_val=.true., &
817 lone_keyword_l_val=.true.)
818 CALL section_add_keyword(section, keyword)
819 CALL keyword_release(keyword)
820
821 CALL keyword_create(keyword, __location__, name="LINESEARCH", &
822 variants=["LINE_SEARCH"], &
823 description="1D line search algorithm to be used with the OT minimizer,"// &
824 " in increasing order of robustness and cost. MINIMIZER CG combined with"// &
825 " LINESEARCH GOLD should always find an electronic minimum."// &
826 " Whereas the 2PNT minimizer is almost always OK, 3PNT might be needed for systems"// &
827 " in which successive OT CG steps do not decrease the total energy.", &
828 usage="LINESEARCH GOLD", &
829 default_i_val=ls_2pnt, &
830 enum_c_vals=s2a("ADAPT", "NONE", "2PNT", "3PNT", "GOLD"), &
831 enum_desc=s2a("extrapolates usually based on 3 points, "// &
832 "uses additional points on demand, very robust.", &
833 "always take steps of fixed length", &
834 "extrapolate based on 2 points", &
835 "extrapolate based on 3 points", &
836 "perform 1D golden section search of the minimum (very expensive)"), &
837 enum_i_vals=[ls_adapt, ls_none, ls_2pnt, ls_3pnt, ls_gold])
838 CALL section_add_keyword(section, keyword)
839 CALL keyword_release(keyword)
840
841 CALL keyword_create( &
842 keyword, __location__, name="STEPSIZE", &
843 description="Initial stepsize used for the line search, sometimes this parameter can be reduced to stabilize DIIS"// &
844 " or to improve the CG behavior in the first few steps."// &
845 " The optimal value depends on the quality of the preconditioner."// &
846 " A negative values leaves the choice to CP2K depending on the preconditioner.", &
847 usage="STEPSIZE 0.4", &
848 default_r_val=-1.0_dp)
849 CALL section_add_keyword(section, keyword)
850 CALL keyword_release(keyword)
851
852 CALL keyword_create(keyword, __location__, name="GOLD_TARGET", &
853 description="Target relative uncertainty in the location of the minimum for LINESEARCH GOLD", &
854 usage="GOLD_TARGET 0.1", &
855 default_r_val=0.01_dp)
856 CALL section_add_keyword(section, keyword)
857 CALL keyword_release(keyword)
858
859 CALL keyword_create( &
860 keyword, __location__, name="PRECONDITIONER", &
861 description="Type of preconditioner to be used with all minimization schemes. "// &
862 "They differ in effectiveness, cost of construction, cost of application. "// &
863 "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
864 usage="PRECONDITIONER FULL_ALL", &
865 default_i_val=ot_precond_full_kinetic, &
866 enum_c_vals=s2a("FULL_ALL", "FERMI_LOW_RANK", "FULL_ALL_COVARIANT", &
867 "FULL_SINGLE_INVERSE", "FULL_SINGLE", &
868 "FULL_KINETIC", "FULL_S_INVERSE", "NONE"), &
869 enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
870 "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
871 "This preconditioner is recommended for almost all systems, except very large systems where "// &
872 "make_preconditioner would dominate the total computational cost.", &
873 "Experimental rotationally covariant bounded spectral preconditioner. It applies an "// &
874 "overlap-inverse base plus a configurable number of complementary-state corrections relative to a "// &
875 "common occupied reference level. Construction currently retains a full diagonalization. "// &
876 "Application can be cheaper when the complementary space is larger than the retained rank.", &
877 "Experimental rotation-covariant form of FULL_ALL. It diagonalizes a private copy of the "// &
878 "occupied projected Hamiltonian, applies the complete state-selective Sylvester spectrum "// &
879 "in that canonical copy, and rotates every input and output consistently without changing "// &
880 "the physical orbitals. Complex K-point ROKS canonicalization is restricted to orbital "// &
881 "subspaces with equal alpha/beta occupation signatures. Real Gamma-point use still "// &
882 "requires uniform occupations and excludes ROKS.", &
883 "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
884 "but cheaper to construct, "// &
885 "might be somewhat less robust. Recommended for large systems.", &
886 "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
887 "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
888 "use for very large systems.", &
889 "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
890 "skip preconditioning"), &
895 CALL section_add_keyword(section, keyword)
896 CALL keyword_release(keyword)
897
898 CALL keyword_create( &
899 keyword, __location__, name="FERMI_LOW_RANK_BASE", &
900 description="Base operator used only with PRECONDITIONER FERMI_LOW_RANK. OVERLAP_INVERSE "// &
901 "applies the exact dense inverse overlap. LATTICE_FFT projects the overlap onto translations "// &
902 "of an explicitly replicated SUBSYS multiple unit cell, inverts its small reciprocal-space "// &
903 "blocks, and applies the approximate inverse with lattice FFTs. This choice implies "// &
904 "LATTICE_FFT ON; use the general LATTICE_FFT keyword for AUTO selection. The experimental "// &
905 "FFT path is restricted to real Gamma-point OT calculations.", &
906 usage="FERMI_LOW_RANK_BASE LATTICE_FFT", &
907 default_i_val=ot_low_rank_base_overlap, &
908 enum_c_vals=s2a("OVERLAP_INVERSE", "LATTICE_FFT"), &
909 enum_desc=s2a("Exact dense inverse-overlap base", &
910 "Approximate block-circulant inverse applied by lattice FFT"), &
912 CALL section_add_keyword(section, keyword)
913 CALL keyword_release(keyword)
914
915 CALL keyword_create( &
916 keyword, __location__, name="FERMI_LOW_RANK_MAX_RANK", &
917 description="Maximum number of complementary eigenstates retained by PRECONDITIONER FERMI_LOW_RANK. "// &
918 "Larger values approach the complete common-reference spectral operator at higher application cost. "// &
919 "A value of -1 retains the entire complementary space. A finite cap never splits a numerically "// &
920 "degenerate boundary manifold.", &
921 usage="FERMI_LOW_RANK_MAX_RANK 64", &
922 default_i_val=48)
923 CALL section_add_keyword(section, keyword)
924 CALL keyword_release(keyword)
925
926 CALL keyword_create( &
927 keyword, __location__, name="LATTICE_FFT", &
928 description="Apply the inverse of a block-circulant projection of the selected OT "// &
929 "preconditioner with FFTs over explicitly replicated cells. Supported by FULL_S_INVERSE, "// &
930 "FULL_KINETIC, FULL_SINGLE_INVERSE, FULL_ALL_COVARIANT, and FERMI_LOW_RANK in real "// &
931 "Gamma-point calculations. FULL_ALL_COVARIANT projects and inverts one gap-floored "// &
932 "state-dependent Hessian operator per canonical occupied state. "// &
933 "ON requires the projected reciprocal-space blocks to be positive definite. AUTO uses the "// &
934 "FFT operator only for at least eight replicated cells and a relative projection error no "// &
935 "larger than 1.0E-3. It also requires an estimated application-work ratio no larger than "// &
936 "0.8 and limits reciprocal-block storage to four times one dense real operator; otherwise "// &
937 "it retains the conventional solver. The estimates include reference-cell block size, "// &
938 "occupied-column batch size, state-operator count, and message-passing ranks. Construction "// &
939 "of state-independent operators accumulates only the projected reference-cell blocks across "// &
940 "ranks. FULL_ALL_COVARIANT and explicit local corrections still require dense construction "// &
941 "data. Application routes complete orbital columns across ranks and distributes the FFT "// &
942 "batches over those columns.", &
943 usage="LATTICE_FFT AUTO", &
944 default_i_val=ot_lattice_fft_off, &
945 enum_c_vals=s2a("OFF", "ON", "AUTO"), &
946 enum_desc=s2a("Use the conventional OT preconditioner solver", &
947 "Always use the approximate lattice-FFT inverse", &
948 "Use the lattice-FFT inverse only when conservative selection criteria pass"), &
950 CALL section_add_keyword(section, keyword)
951 CALL keyword_release(keyword)
952
953 CALL keyword_create( &
954 keyword, __location__, name="LATTICE_FFT_LOCAL_CELLS", &
955 description="Number of replicated cell blocks retained in an optional balanced local"// &
956 " correction to LATTICE_FFT ON. Cells are selected from the largest block-row"// &
957 " contributions to the non-circulant residual. The two-level correction is symmetric"// &
958 " positive definite and exactly inverts the selected coordinate subspace. A value of"// &
959 " zero disables the correction. The correction is deliberately unavailable with AUTO,"// &
960 " which continues to reject defective or otherwise non-circulant operators.", &
961 usage="LATTICE_FFT_LOCAL_CELLS 1", &
962 default_i_val=0)
963 CALL section_add_keyword(section, keyword)
964 CALL keyword_release(keyword)
965
966 CALL keyword_create(keyword, __location__, name="CHOLESKY", &
967 description="If FULL_ALL the cholesky decomposition of the S matrix is used. "// &
968 "Options on the algorithm to be used.", &
969 usage="CHOLESKY REDUCE", default_i_val=cholesky_reduce, &
970 enum_c_vals=s2a("OFF", "REDUCE", "RESTORE", "INVERSE", "INVERSE_DBCSR"), &
971 enum_desc=s2a("The cholesky algorithm is not used", "Reduce is called", &
972 "Reduce is replaced by two restore", &
973 "Restore uses operator multiply by inverse of the triangular matrix", &
974 "Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
976 CALL section_add_keyword(section, keyword)
977 CALL keyword_release(keyword)
978
979 CALL keyword_create( &
980 keyword, __location__, name="PRECOND_SOLVER", &
981 description="How the preconditioner is applied to the residual.", &
982 usage="PRECOND_SOLVER DIRECT", &
983 default_i_val=ot_precond_solver_default, &
984 enum_c_vals=s2a("DEFAULT", "DIRECT", "INVERSE_CHOLESKY", "INVERSE_UPDATE", "CHEBYSHEV"), &
985 enum_desc=s2a("the default", "Cholesky decomposition followed by triangular solve "// &
986 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
987 "Cholesky decomposition followed by explicit inversion "// &
988 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
989 "Performs a Hotelling update of the inverse if a previous preconditioner is present. "// &
990 "Mainly useful for GPU accelerated systems (works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
991 "Applies a bounded Chebyshev approximation to the inverse using matrix products only "// &
992 "(currently requires FULL_KINETIC)."), &
993 enum_i_vals=[ot_precond_solver_default, &
998 CALL section_add_keyword(section, keyword)
999 CALL keyword_release(keyword)
1000
1001 CALL keyword_create( &
1002 keyword, __location__, name="CHEBYSHEV_DEGREE", &
1003 description="Polynomial degree of the positive Chebyshev semi-iterative inverse used by "// &
1004 "PRECOND_SOLVER CHEBYSHEV.", &
1005 usage="CHEBYSHEV_DEGREE 8", &
1006 default_i_val=8)
1007 CALL section_add_keyword(section, keyword)
1008 CALL keyword_release(keyword)
1009
1010 CALL keyword_create( &
1011 keyword, __location__, name="ENERGY_GAP", &
1012 description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
1013 "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
1014 "of the gap (can be a small number, e.g. 0.002)."// &
1015 " FULL_SINGLE_INVERSE takes it as lower bound (values below 0.05 can cause stability issues)."// &
1016 " In general, higher values will tame the preconditioner in case of poor initial guesses."// &
1017 " A negative value will leave the choice to CP2K depending on type of preconditioner.", &
1018 usage="ENERGY_GAP 0.001", &
1019 default_r_val=-1.0_dp)
1020 CALL section_add_keyword(section, keyword)
1021 CALL keyword_release(keyword)
1022
1023 CALL keyword_create( &
1024 keyword, __location__, name="EPS_TAYLOR", &
1025 variants=["EPSTAYLOR"], &
1026 description="Target accuracy of the taylor expansion for the matrix functions, should normally be kept as is.", &
1027 usage="EPS_TAYLOR 1.0E-15", &
1028 default_r_val=1.0e-16_dp)
1029 CALL section_add_keyword(section, keyword)
1030 CALL keyword_release(keyword)
1031
1032 CALL keyword_create( &
1033 keyword, __location__, name="MAX_TAYLOR", &
1034 description="Maximum order of the Taylor expansion before diagonalisation is preferred, for large parallel runs"// &
1035 " a slightly higher order could sometimes result in a small speedup.", &
1036 usage="MAX_TAYLOR 5", &
1037 default_i_val=4)
1038 CALL section_add_keyword(section, keyword)
1039 CALL keyword_release(keyword)
1040
1041 CALL keyword_create(keyword, __location__, name="ROTATION", &
1042 description="Introduce additional variables so that rotations of the occupied"// &
1043 " subspace are allowed as well, only needed for cases where the energy is not invariant under"// &
1044 " a rotation of the occupied subspace such as non-singlet restricted calculations"// &
1045 " or fractional occupations. This variable is not used by DIAGONALIZATION%OT, "// &
1046 "which canonicalizes the converged eigenspace explicitly.", &
1047 usage="ROTATION", lone_keyword_l_val=.true., &
1048 default_l_val=.false.)
1049 CALL section_add_keyword(section, keyword)
1050 CALL keyword_release(keyword)
1051
1052 CALL keyword_create(keyword, __location__, name="ENERGIES", &
1053 description="Optimize auxiliary orbital energies for Mermin smearing in direct SCF%OT "// &
1054 "(requires ROTATION and smearing to be active). DIAGONALIZATION%OT obtains "// &
1055 "orbital energies by canonicalizing its converged eigenspace instead.", &
1056 usage="ENERGIES", lone_keyword_l_val=.true., &
1057 default_l_val=.false.)
1058 CALL section_add_keyword(section, keyword)
1059 CALL keyword_release(keyword)
1060
1061 CALL keyword_create(keyword, __location__, name="OCCUPATION_PRECONDITIONER", &
1062 description="Augment the direct SCF%OT orbital metric with coupled fixed-N "// &
1063 "occupation response. This augments the independently selected orbital "// &
1064 "preconditioner. It is not used by DIAGONALIZATION%OT, where occupations are "// &
1065 "assigned after the eigensolver has converged.", &
1066 usage="OCCUPATION_PRECONDITIONER", lone_keyword_l_val=.true., &
1067 default_l_val=.false.)
1068 CALL section_add_keyword(section, keyword)
1069 CALL keyword_release(keyword)
1070
1071 CALL keyword_create(keyword, __location__, name="NONDIAG_ENERGY", &
1072 description="Add a non-diagonal auxiliary-energy penalty in direct SCF%OT. "// &
1073 "It is not used by DIAGONALIZATION%OT.", &
1074 usage="NONDIAG_ENERGY", lone_keyword_l_val=.true., &
1075 default_l_val=.false.)
1076 CALL section_add_keyword(section, keyword)
1077 CALL keyword_release(keyword)
1078
1079 CALL keyword_create(keyword, __location__, name="NONDIAG_ENERGY_STRENGTH", &
1080 description="The prefactor for the non-diagonal energy penalty (FD smearing)", &
1081 usage="NONDIAG_ENERGY_STRENGTH", default_r_val=1.0_dp)
1082 CALL section_add_keyword(section, keyword)
1083 CALL keyword_release(keyword)
1084
1085 END SUBROUTINE create_ot_section
1086
1087! **************************************************************************************************
1088!> \brief creates the ADIIS section
1089!> \param section ...
1090! **************************************************************************************************
1091 SUBROUTINE create_adiis_section(section)
1092 TYPE(section_type), POINTER :: section
1093
1094 TYPE(keyword_type), POINTER :: keyword
1095
1096 cpassert(.NOT. ASSOCIATED(section))
1097 CALL section_create(section, __location__, name="ADIIS", &
1098 description="Parameters for the ADIIS SCF update method.", &
1099 n_keywords=3, n_subsections=0, repeats=.false.)
1100
1101 NULLIFY (keyword)
1102 CALL keyword_create(keyword, __location__, name="MAX_HISTORY", &
1103 description="Maximum number of paired density/Fock states retained by ADIIS. "// &
1104 "Histories up to 12 use exact active-face enumeration; larger histories use "// &
1105 "deterministic pairwise simplex minimization.", &
1106 usage="MAX_HISTORY 7", default_i_val=16)
1107 CALL section_add_keyword(section, keyword)
1108 CALL keyword_release(keyword)
1109
1110 CALL keyword_create(keyword, __location__, name="ADAPTIVE_LEVEL_SHIFT", &
1111 description="Initial occupied-space level shift for experimental ADIIS candidate stabilization. "// &
1112 "Positive values enable adaptation using the energy and gradient of successive "// &
1113 "SCF states, without additional KS builds. Zero disables the shift. "// &
1114 "The shift fades out during CDIIS handover and is omitted in raw-map checks. "// &
1115 "Requires MAX_HISTORY >= 2 and cannot be combined with SCF%LEVEL_SHIFT.", &
1116 unit_str="au_e", usage="ADAPTIVE_LEVEL_SHIFT 1.0", default_r_val=0.0_dp)
1117 CALL section_add_keyword(section, keyword)
1118 CALL keyword_release(keyword)
1119
1120 CALL keyword_create(keyword, __location__, name="VERBOSE", &
1121 description="Print per-iteration ADIIS and candidate shift diagnostic metrics.", &
1122 usage="VERBOSE", lone_keyword_l_val=.true., default_l_val=.false.)
1123 CALL section_add_keyword(section, keyword)
1124 CALL keyword_release(keyword)
1125
1126 END SUBROUTINE create_adiis_section
1127
1128! **************************************************************************************************
1129!> \brief creates the diagonalization section
1130!> \param section ...
1131!> \par History
1132!> 10.2008 created [JGH]
1133! **************************************************************************************************
1134 SUBROUTINE create_diagonalization_section(section)
1135 TYPE(section_type), POINTER :: section
1136
1137 TYPE(keyword_type), POINTER :: keyword
1138 TYPE(section_type), POINTER :: subsection
1139
1140 cpassert(.NOT. ASSOCIATED(section))
1141 CALL section_create(section, __location__, name="DIAGONALIZATION", &
1142 description="Set up type and parameters for Kohn-Sham matrix diagonalization.", &
1143 n_keywords=0, n_subsections=1, repeats=.false.)
1144
1145 NULLIFY (keyword)
1146
1147 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
1148 description="controls the activation of the diagonalization method", &
1149 usage="&DIAGONALIZATION T", &
1150 default_l_val=.false., &
1151 lone_keyword_l_val=.true.)
1152 CALL section_add_keyword(section, keyword)
1153 CALL keyword_release(keyword)
1154
1155 CALL keyword_create(keyword, __location__, name="UPDATE_METHOD", &
1156 description="Selects the SCF update method used with diagonalization. MIXING uses "// &
1157 "the existing density-mixing and DIIS workflow; ADIIS uses augmented-DIIS "// &
1158 "Fock-space interpolation and accepts the diagonalized density directly.", &
1159 usage="UPDATE_METHOD ADIIS", default_i_val=diag_update_method_mixing, &
1160 enum_c_vals=s2a("MIXING", "ADIIS"), &
1161 enum_desc=s2a("Use the existing density-mixing SCF workflow", &
1162 "Use augmented-DIIS Fock-space interpolation"), &
1164 citations=[hu2010])
1165 CALL section_add_keyword(section, keyword)
1166 CALL keyword_release(keyword)
1167
1168 CALL keyword_create(keyword, __location__, name="ALGORITHM", &
1169 description="Algorithm to be used for diagonalization", &
1170 usage="ALGORITHM STANDARD", &
1171 default_i_val=diag_standard, &
1172 enum_c_vals=s2a("STANDARD", "OT", "LANCZOS", "DAVIDSON", "FILTER_MATRIX"), &
1173 enum_desc=s2a("AO-basis Kohn-Sham diagonalization using LAPACK-compatible methods"// &
1174 " or a late-SCF Jacobi sweep.", &
1175 "Iterative diagonalization using OT method", &
1176 "Block Krylov-space approach to self-consistent diagonalisation", &
1177 "Preconditioned blocked Davidson", &
1178 "Filter matrix diagonalization"), &
1181 CALL section_add_keyword(section, keyword)
1182 CALL keyword_release(keyword)
1183
1184 CALL keyword_create(keyword, __location__, name="JACOBI_THRESHOLD", &
1185 description="Controls the accuracy of the pseudo-diagonalization method using Jacobi rotations", &
1186 usage="JACOBI_THRESHOLD 1.0E-6", &
1187 default_r_val=1.0e-7_dp, &
1188 citations=[stewart1982])
1189 CALL section_add_keyword(section, keyword)
1190 CALL keyword_release(keyword)
1191
1192 CALL keyword_create(keyword, __location__, name="EPS_JACOBI", &
1193 description="Below this threshold value for the SCF convergence the pseudo-diagonalization "// &
1194 "method using Jacobi rotations is activated. This method is much faster than a "// &
1195 "real diagonalization and it is even speeding up while achieving full convergence. "// &
1196 "However, it needs a pre-converged wavefunction obtained by at least one real "// &
1197 "diagonalization which is further optimized while keeping the original eigenvalue "// &
1198 "spectrum. The MO eigenvalues are NOT updated. The method might be useful to speed "// &
1199 "up calculations for large systems e.g. using a semi-empirical method.", &
1200 usage="EPS_JACOBI 1.0E-5", &
1201 default_r_val=0.0_dp, &
1202 citations=[stewart1982])
1203 CALL section_add_keyword(section, keyword)
1204 CALL keyword_release(keyword)
1205
1206 CALL keyword_create(keyword, __location__, name="EPS_ADAPT", &
1207 description="Tolerance of the iterative diagonalization relative to the current SCF convergence. "// &
1208 "A positive value makes the inner tolerance the looser of EPS_ITER and this factor "// &
1209 "times the SCF error: loose while the density is far from self-consistency, "// &
1210 "tightening as the SCF converges. The value 0 disables the tracking.", &
1211 usage="EPS_ADAPT 0.01", &
1212 default_r_val=0._dp)
1213 CALL section_add_keyword(section, keyword)
1214 CALL keyword_release(keyword)
1215
1216 CALL keyword_create(keyword, __location__, name="MAX_ITER", &
1217 description="Maximum number of iterations in iterative diagonalization", &
1218 usage="MAX_ITER 20", &
1219 default_i_val=2)
1220 CALL section_add_keyword(section, keyword)
1221 CALL keyword_release(keyword)
1222
1223 CALL keyword_create(keyword, __location__, name="EPS_ITER", &
1224 description="Required accuracy in iterative diagonalization", &
1225 usage="EPS_ITER 1.e-8", &
1226 default_r_val=1.e-8_dp)
1227 CALL section_add_keyword(section, keyword)
1228 CALL keyword_release(keyword)
1229
1230 NULLIFY (subsection)
1231 CALL create_ot_section(subsection, diagonalization=.true.)
1232 CALL section_add_subsection(section, subsection)
1233 CALL section_release(subsection)
1234
1235 NULLIFY (subsection)
1236 CALL create_krylov_section(subsection)
1237 CALL section_add_subsection(section, subsection)
1238 CALL section_release(subsection)
1239
1240 NULLIFY (subsection)
1241 CALL create_diag_subspace_section(subsection)
1242 CALL section_add_subsection(section, subsection)
1243 CALL section_release(subsection)
1244
1245 NULLIFY (subsection)
1246 CALL create_davidson_section(subsection)
1247 CALL section_add_subsection(section, subsection)
1248 CALL section_release(subsection)
1249
1250 NULLIFY (subsection)
1251 CALL create_filtermatrix_section(subsection)
1252 CALL section_add_subsection(section, subsection)
1253 CALL section_release(subsection)
1254
1255 END SUBROUTINE create_diagonalization_section
1256
1257! **************************************************************************************************
1258!> \brief ...
1259!> \param section ...
1260! **************************************************************************************************
1261 SUBROUTINE create_davidson_section(section)
1262 TYPE(section_type), POINTER :: section
1263
1264 TYPE(keyword_type), POINTER :: keyword
1265
1266 cpassert(.NOT. ASSOCIATED(section))
1267 CALL section_create(section, __location__, name="DAVIDSON", &
1268 description="Settings of the blocked Davidson iterative diagonalization. "// &
1269 "Also available at symmetry-reduced complex k points.", &
1270 n_keywords=2, n_subsections=0, repeats=.false., &
1271 citations=[blaha2010, kressefurthmueller1996])
1272
1273 NULLIFY (keyword)
1274
1275 CALL keyword_create( &
1276 keyword, __location__, name="PRECONDITIONER", &
1277 description="Type of preconditioner to be used with all minimization schemes. "// &
1278 "With k points, all preconditioners except NONE use the complex "// &
1279 "k-point preconditioners.", &
1280 usage="PRECONDITIONER FULL_ALL", &
1281 default_i_val=ot_precond_full_all, &
1282 enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_KINETIC", "FULL_S_INVERSE", "NONE"), &
1283 enum_desc=s2a("Most effective state selective preconditioner based on diagonalization ", &
1284 "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
1285 "but cheaper to construct, might be somewhat less robust. Recommended for large systems.", &
1286 "Preconditioner based on the kinetic energy matrix", &
1287 "Preconditioner based on the overlap matrix", &
1288 "skip preconditioning"), &
1291 citations=[vandevondele2003])
1292 CALL section_add_keyword(section, keyword)
1293 CALL keyword_release(keyword)
1294
1295 CALL keyword_create(keyword, __location__, name="PRECOND_SOLVER", &
1296 description="How the preconditioner is applied to the residual.", &
1297 usage="PRECOND_SOLVER DIRECT", &
1298 default_i_val=ot_precond_solver_default, &
1299 enum_c_vals=s2a("DEFAULT", "DIRECT", "INVERSE_CHOLESKY"), &
1300 enum_desc=s2a("the default", "Cholesky decomposition followed by triangular solve "// &
1301 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
1302 "Cholesky decomposition followed by explicit inversion "// &
1303 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"), &
1304 enum_i_vals=[ot_precond_solver_default, &
1307 CALL section_add_keyword(section, keyword)
1308 CALL keyword_release(keyword)
1309
1310 CALL keyword_create( &
1311 keyword, __location__, name="ENERGY_GAP", &
1312 description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
1313 "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
1314 "of the gap (0.001 doing normally fine). For the other preconditioners, making this value larger (0.2)"// &
1315 " will tame the preconditioner in case of poor initial guesses.", &
1316 usage="ENERGY_GAP 0.001", &
1317 default_r_val=0.2_dp)
1318 CALL section_add_keyword(section, keyword)
1319 CALL keyword_release(keyword)
1320
1321 CALL keyword_create(keyword, __location__, name="NEW_PREC_EACH", &
1322 description="Number of SCF iterations after which a new Preconditioner is computed", &
1323 usage="NEW_PREC_EACH 10", default_i_val=20)
1324 CALL section_add_keyword(section, keyword)
1325 CALL keyword_release(keyword)
1326
1327 CALL keyword_create(keyword, __location__, name="FIRST_PREC", &
1328 description="First SCF iteration at which a Preconditioner is employed. "// &
1329 "With k points the first build waits until after the cold start, whatever lower value is set. "// &
1330 "The preconditioner makers read the MO coefficients, and only the cold start fills them.", &
1331 usage="FIRST_PREC 1", default_i_val=1)
1332 CALL section_add_keyword(section, keyword)
1333 CALL keyword_release(keyword)
1334
1335 CALL keyword_create(keyword, __location__, name="CONV_MOS_PERCENT", &
1336 description="Minimal percent of MOS that have to converge within the Davidson loop"// &
1337 " before the SCF iteration is completed and a new Hamiltonian is computed", &
1338 usage="CONV_MOS_PERCENT 0.8", default_r_val=0.5_dp)
1339 CALL section_add_keyword(section, keyword)
1340 CALL keyword_release(keyword)
1341
1342 CALL keyword_create(keyword, __location__, name="NOISE_SCALE", &
1343 description="Divisor that maps the SCF mixing error onto the adaptive Davidson tolerance. "// &
1344 "The inner tolerance tracks EPS_ADAPT times the mixing error divided by this value. "// &
1345 "The value approximates how much the per-column residuals amplify the density mixing error. "// &
1346 "A measured amplification on a smeared slab is 20. Increase the value for looser tracking. "// &
1347 "Only used with EPS_ADAPT.", &
1348 usage="NOISE_SCALE 100", default_r_val=100.0_dp)
1349 CALL section_add_keyword(section, keyword)
1350 CALL keyword_release(keyword)
1351
1352 CALL keyword_create(keyword, __location__, name="SPARSE_MOS", &
1353 description="Use MOS as sparse matrix and avoid as much as possible multiplications with full matrices. "// &
1354 "Not used with k points.", &
1355 usage="SPARSE_MOS", default_l_val=.true., &
1356 lone_keyword_l_val=.true.)
1357 CALL section_add_keyword(section, keyword)
1358 CALL keyword_release(keyword)
1359
1360 END SUBROUTINE create_davidson_section
1361
1362! **************************************************************************************************
1363!> \brief ...
1364!> \param section ...
1365! **************************************************************************************************
1366 SUBROUTINE create_krylov_section(section)
1367 TYPE(section_type), POINTER :: section
1368
1369 TYPE(keyword_type), POINTER :: keyword
1370
1371 cpassert(.NOT. ASSOCIATED(section))
1372 CALL section_create(section, __location__, name="KRYLOV", &
1373 description=" ", &
1374 n_keywords=2, n_subsections=0, repeats=.false.)
1375
1376 NULLIFY (keyword)
1377
1378 CALL keyword_create(keyword, __location__, name="NKRYLOV", &
1379 description="Dimension of the Krylov space used for the Lanczos refinement", &
1380 usage="NKRYLOV 20", &
1381 default_i_val=4)
1382 CALL section_add_keyword(section, keyword)
1383 CALL keyword_release(keyword)
1384
1385 CALL keyword_create(keyword, __location__, name="NBLOCK", &
1386 description="Size of the block of vectors refined simultaneously by the Lanczos procedure", &
1387 usage="NBLOCK 1", &
1388 default_i_val=32)
1389 CALL section_add_keyword(section, keyword)
1390 CALL keyword_release(keyword)
1391
1392 CALL keyword_create(keyword, __location__, name="EPS_KRYLOV", &
1393 description="Convergence criterion for the MOs", &
1394 usage="EPS_KRYLOV 0.00001", &
1395 default_r_val=0.0000001_dp)
1396 CALL section_add_keyword(section, keyword)
1397 CALL keyword_release(keyword)
1398
1399 CALL keyword_create(keyword, __location__, name="EPS_STD_DIAG", &
1400 description="Level of convergence to be reached before starting the Lanczos procedure."// &
1401 " Above this threshold a standard diagonalization method is used."// &
1402 " If negative Lanczos is started at the first iteration", &
1403 usage="EPS_STD_DIAG 0.001", &
1404 default_r_val=-1.0_dp)
1405 CALL section_add_keyword(section, keyword)
1406 CALL keyword_release(keyword)
1407
1408 CALL keyword_create(keyword, __location__, name="CHECK_MOS_CONV", &
1409 description="This requires to check the convergence of MOS also when standard "// &
1410 "diagonalization steps are performed, if the block krylov approach is active.", &
1411 usage="CHECK_MOS_CONV T", &
1412 default_l_val=.false., &
1413 lone_keyword_l_val=.true.)
1414 CALL section_add_keyword(section, keyword)
1415 CALL keyword_release(keyword)
1416
1417 END SUBROUTINE create_krylov_section
1418
1419! **************************************************************************************************
1420!> \brief ...
1421!> \param section ...
1422! **************************************************************************************************
1423 SUBROUTINE create_diag_subspace_section(section)
1424 TYPE(section_type), POINTER :: section
1425
1426 TYPE(keyword_type), POINTER :: keyword
1427 TYPE(section_type), POINTER :: subsection
1428
1429 cpassert(.NOT. ASSOCIATED(section))
1430 CALL section_create(section, __location__, name="DIAG_SUB_SCF", &
1431 description="Activation of self-consistenf subspace refinement by diagonalization "// &
1432 "of H by adjusting the occupation but keeping the MOS unchanged.", &
1433 n_keywords=2, n_subsections=1, repeats=.false.)
1434
1435 NULLIFY (keyword, subsection)
1436
1437 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
1438 description="controls the activation of inner SCF loop to refine occupations in MOS subspace", &
1439 usage="&DIAG_SUB_SCF T", &
1440 default_l_val=.false., &
1441 lone_keyword_l_val=.true.)
1442 CALL section_add_keyword(section, keyword)
1443 CALL keyword_release(keyword)
1444
1445 CALL keyword_create(keyword, __location__, name="MAX_ITER", &
1446 description="Maximum number of iterations for the SCF inner loop", &
1447 usage="MAX_ITER 20", &
1448 default_i_val=2)
1449 CALL section_add_keyword(section, keyword)
1450 CALL keyword_release(keyword)
1451
1452 CALL keyword_create(keyword, __location__, name="EPS_ENE", &
1453 description="Required energy accuracy for convergence of subspace diagonalization", &
1454 usage="EPS_ENE 1.e-8", &
1455 default_r_val=1.e-4_dp)
1456 CALL section_add_keyword(section, keyword)
1457 CALL keyword_release(keyword)
1458
1459 CALL keyword_create(keyword, __location__, name="EPS_ADAPT_SCF", &
1460 description="Required density matrix accuracy as compared to current SCF convergence", &
1461 usage="EPS_ADAPT_SCF 1.e-1", &
1462 default_r_val=1._dp)
1463 CALL section_add_keyword(section, keyword)
1464 CALL keyword_release(keyword)
1465
1466 CALL keyword_create( &
1467 keyword, __location__, name="EPS_SKIP_SUB_DIAG", &
1468 description="Level of convergence to be reached before starting the internal loop of subspace rotations."// &
1469 " Above this threshold only the outer diagonalization method is used."// &
1470 " If negative the subspace rotation is started at the first iteration", &
1471 usage="EPS_SKIP_SUB_DIAG 0.001", &
1472 default_r_val=-1.0_dp)
1473 CALL section_add_keyword(section, keyword)
1474 CALL keyword_release(keyword)
1475
1476 CALL create_mixing_section(subsection)
1477 CALL section_add_subsection(section, subsection)
1478 CALL section_release(subsection)
1479 END SUBROUTINE create_diag_subspace_section
1480
1481! **************************************************************************************************
1482!> \brief Create CP2K input section for the smearing of occupation numbers
1483!> \param section ...
1484!> \date 27.08.2008
1485!> \author Matthias Krack (MK)
1486!> \version 1.0
1487! **************************************************************************************************
1488 SUBROUTINE create_smear_section(section)
1489
1490 TYPE(section_type), POINTER :: section
1491
1492 TYPE(keyword_type), POINTER :: keyword
1493
1494 cpassert(.NOT. ASSOCIATED(section))
1495
1496 CALL section_create(section, __location__, &
1497 name="SMEAR", &
1498 description="Controls smearing of MO occupation numbers for systems with small or zero gaps.", &
1499 n_keywords=6, &
1500 n_subsections=0, &
1501 repeats=.false.)
1502
1503 NULLIFY (keyword)
1504
1505 CALL keyword_create(keyword, __location__, &
1506 name="_SECTION_PARAMETERS_", &
1507 description="Controls the activation of smearing", &
1508 usage="&SMEAR ON", &
1509 default_l_val=.false., &
1510 lone_keyword_l_val=.true.)
1511 CALL section_add_keyword(section, keyword)
1512 CALL keyword_release(keyword)
1513
1514 CALL keyword_create(keyword, __location__, &
1515 name="METHOD", &
1516 description="Selects the smearing method to apply.", &
1517 usage="METHOD Fermi_Dirac", &
1518 default_i_val=smear_gaussian, &
1519 enum_c_vals=s2a("FERMI_DIRAC", "ENERGY_WINDOW", "LIST", "GAUSSIAN", &
1520 "METHFESSEL_PAXTON", "MARZARI_VANDERBILT"), &
1523 enum_desc=s2a("Fermi-Dirac distribution defined by the keyword ELECTRONIC_TEMPERATURE. "// &
1524 "Use this method if the temperature equivalence is important for you, "// &
1525 "e.g. if you want to compute some properties based on the occupations. "// &
1526 "If you use this method without interest in electronic temperature, "// &
1527 "it's suggested to use extrapolated result from finite ELECTRONIC_TEMPERATURE "// &
1528 "to ELECTRONIC_TEMPERATURE = 0. Note the forces and stress are consistent "// &
1529 "with the free energy and not with the extrapolated energy.", &
1530 "Energy window defined by the keyword WINDOW_SIZE.", &
1531 "Use a fixed list of occupations.", &
1532 "Gaussian broadening with width SIGMA; should work well in most cases. "// &
1533 "With this method you have to use extrapolated results from finite "// &
1534 "SIGMA results to SIGMA = 0, but usually this value would not be quite "// &
1535 "accurate without systematically reducing SIGMA. Note the forces and stress "// &
1536 "are consistent with the free energy and not with the extrapolated energy.", &
1537 "First-order Methfessel-Paxton distribution with width SIGMA. Don't "// &
1538 "use it for semiconductors and insulators because the partial "// &
1539 "occupancies can be unphysical and thus lead to wrong results.", &
1540 "Marzari-Vanderbilt cold smearing with width SIGMA."))
1541 CALL section_add_keyword(section, keyword)
1542 CALL keyword_release(keyword)
1543
1544 CALL keyword_create(keyword, __location__, &
1545 name="LIST", &
1546 description="A list of fractional occupations to use. Must match the number of states "// &
1547 "and sum up to the correct number of electrons", &
1548 repeats=.false., &
1549 n_var=-1, &
1550 type_of_var=real_t, &
1551 usage="LIST 2.0 0.6666 0.6666 0.66666 0.0 0.0")
1552 CALL section_add_keyword(section, keyword)
1553 CALL keyword_release(keyword)
1554
1555 CALL keyword_create(keyword, __location__, &
1556 name="ELECTRONIC_TEMPERATURE", &
1557 variants=s2a("ELEC_TEMP", "TELEC"), &
1558 description="Electronic temperature used for Fermi-Dirac smearing.", &
1559 repeats=.false., &
1560 n_var=1, &
1561 type_of_var=real_t, &
1562 default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K"), &
1563 unit_str="K", &
1564 usage="ELECTRONIC_TEMPERATURE [K] 300")
1565 CALL section_add_keyword(section, keyword)
1566 CALL keyword_release(keyword)
1567
1568 CALL keyword_create(keyword, __location__, &
1569 name="EPS_FERMI_DIRAC", &
1570 description="Accuracy checks on occupation numbers use this as a tolerance", &
1571 repeats=.false., &
1572 n_var=1, &
1573 type_of_var=real_t, &
1574 default_r_val=1.0e-10_dp, &
1575 usage="EPS_FERMI_DIRAC 1.0E-6")
1576 CALL section_add_keyword(section, keyword)
1577 CALL keyword_release(keyword)
1578
1579 CALL keyword_create(keyword, __location__, &
1580 name="SIGMA", &
1581 description="Smearing width sigma (in energy units) in the case of "// &
1582 "Gaussian, Methfessel-Paxton or Marzari-Vanderbilt smearing.", &
1583 repeats=.false., &
1584 n_var=1, &
1585 type_of_var=real_t, &
1586 default_r_val=0.002_dp, &
1587 unit_str="au_e", &
1588 usage="SIGMA [eV] 0.2")
1589 CALL section_add_keyword(section, keyword)
1590 CALL keyword_release(keyword)
1591
1592 CALL keyword_create(keyword, __location__, &
1593 name="WINDOW_SIZE", &
1594 description="Size of the energy window centred at the Fermi level", &
1595 repeats=.false., &
1596 n_var=1, &
1597 type_of_var=real_t, &
1598 default_r_val=0.0_dp, &
1599 unit_str="au_e", &
1600 usage="WINDOW_SIZE [eV] 0.3")
1601 CALL section_add_keyword(section, keyword)
1602 CALL keyword_release(keyword)
1603
1604 CALL keyword_create(keyword, __location__, name="FIXED_MAGNETIC_MOMENT", &
1605 description="Imposed difference between the numbers of electrons of spin up "// &
1606 "and spin down: m = n(up) - n(down). A negative value (default) allows "// &
1607 "for a change of the magnetic moment. -1 specifically keeps an integer "// &
1608 "number of spin up and spin down electrons.", &
1609 repeats=.false., &
1610 n_var=1, &
1611 type_of_var=real_t, &
1612 default_r_val=-100.0_dp, &
1613 usage="FIXED_MAGNETIC_MOMENT 1.5")
1614 CALL section_add_keyword(section, keyword)
1615 CALL keyword_release(keyword)
1616
1617 END SUBROUTINE create_smear_section
1618
1619! **************************************************************************************************
1620!> \brief Creates the input section for defining CDFT constraints.
1621!> \param section the section to create
1622! **************************************************************************************************
1624 TYPE(section_type), POINTER :: section
1625
1626 TYPE(keyword_type), POINTER :: keyword
1627 TYPE(section_type), POINTER :: group_section, print_key, subsection
1628
1629 NULLIFY (keyword, subsection, group_section, print_key)
1630
1631 cpassert(.NOT. ASSOCIATED(section))
1632 CALL section_create(section, __location__, name="CDFT", &
1633 description="Parameters needed to set up a constrained DFT calculation."// &
1634 " Each repetition of the ATOM_GROUP section defines a new constraint."// &
1635 " The constraint(s) is (are) converged in a separate external SCF loop with settings"// &
1636 " read from the OUTER_SCF section. Supported constraints: Becke and Gaussian"// &
1637 " Hirshfeld (partial).", n_keywords=8, n_subsections=2, &
1638 repeats=.false., citations=[holmberg2017, holmberg2018])
1639
1640 NULLIFY (subsection, keyword)
1641 CALL create_outer_scf_section(subsection)
1642 CALL section_add_subsection(section, subsection)
1643 CALL section_release(subsection)
1644
1645 CALL create_becke_constraint_section(subsection)
1646 CALL section_add_subsection(section, subsection)
1647 CALL section_release(subsection)
1648
1649 CALL create_hirshfeld_constraint_section(subsection)
1650 CALL section_add_subsection(section, subsection)
1651 CALL section_release(subsection)
1652
1653 CALL keyword_create(keyword, __location__, name="TYPE_OF_CONSTRAINT", &
1654 description="Specifies the type of constraint used.", &
1655 usage="TYPE_OF_CONSTRAINT (NONE|HIRSHFELD|BECKE)", &
1656 enum_c_vals=s2a("NONE", "HIRSHFELD", "BECKE"), &
1659 enum_desc=s2a("No constraint (disables section).", &
1660 "Gaussian Hirshfeld constraint. Partial implementation: no forces. "// &
1661 "Requires corresponding section. Not as extensively tested.", &
1662 "Becke constraint. Requires corresponding section."), &
1663 citations=[becke1988b], &
1664 default_i_val=outer_scf_none)
1665 CALL section_add_keyword(section, keyword)
1666 CALL keyword_release(keyword)
1667
1668 CALL keyword_create(keyword, __location__, name="STRENGTH", &
1669 description="Constraint force constants (Lagrange multipliers). "// &
1670 "Give one value per constraint group.", &
1671 type_of_var=real_t, n_var=-1, &
1672 default_r_val=0.0_dp)
1673 CALL section_add_keyword(section, keyword)
1674 CALL keyword_release(keyword)
1675
1676 CALL keyword_create(keyword, __location__, name="TARGET", &
1677 description="Constraint target values. Give one value per constraint group. "// &
1678 "The target value is the desired number of valence electrons, spin moment, or the number of "// &
1679 "alpha or beta electrons on the atoms that define the constraint, suitably multiplied by "// &
1680 "atomic coefficients in case a relative constraint between two sets of atoms is employed. "// &
1681 "Note that core charges are not subtracted from the target value.", &
1682 usage="TARGET {real}", repeats=.false., &
1683 type_of_var=real_t, n_var=-1, &
1684 default_r_val=0.0_dp)
1685 CALL section_add_keyword(section, keyword)
1686 CALL keyword_release(keyword)
1687
1688 CALL keyword_create(keyword, __location__, name="ATOMIC_CHARGES", &
1689 description="Calculate atomic CDFT charges with selected weight function"// &
1690 " (Z = Z_core - Z_CDFT). With fragment based constraints, charges are"// &
1691 " relative to the fragment reference state i.e. Z = Z_CDFT -"// &
1692 " Z_frag_reference. Note: if the number of atoms is greater than the"// &
1693 " default pw_pool max cache, calculation of atomic CDFT charges"// &
1694 " will prompt harmless warnings during deallocation of atomic grids.", &
1695 usage="ATOMIC_CHARGES", &
1696 default_l_val=.false., lone_keyword_l_val=.true.)
1697 CALL section_add_keyword(section, keyword)
1698 CALL keyword_release(keyword)
1699
1700 CALL keyword_create(keyword, __location__, name="FRAGMENT_A_FILE_NAME", variants=["FRAGMENT_A_FILE"], &
1701 description="Name of the reference total electron density cube file for fragment A."// &
1702 " May include a path. The reference electron density needs to be outputted"// &
1703 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1704 " For GAPW, generate the cube with E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY;"// &
1705 " a regular GAPW electron-density cube contains only the soft density and is rejected.", &
1706 usage="FRAGMENT_A_FILE_NAME <FILENAME>", &
1707 default_lc_val="fragment_a.cube")
1708 CALL section_add_keyword(section, keyword)
1709 CALL keyword_release(keyword)
1710
1711 CALL keyword_create(keyword, __location__, name="FRAGMENT_B_FILE_NAME", variants=["FRAGMENT_B_FILE"], &
1712 description="Name of the reference total electron density cube file for fragment B."// &
1713 " May include a path. The reference electron density needs to be outputted"// &
1714 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1715 " For GAPW, generate the cube with E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY;"// &
1716 " a regular GAPW electron-density cube contains only the soft density and is rejected.", &
1717 usage="FRAGMENT_B_FILE_NAME <FILENAME>", &
1718 default_lc_val="fragment_b.cube")
1719 CALL section_add_keyword(section, keyword)
1720 CALL keyword_release(keyword)
1721
1722 CALL keyword_create(keyword, __location__, name="FRAGMENT_A_SPIN_FILE", &
1723 variants=["FRAGMENT_A_SPIN_FILE_NAME"], &
1724 description="Name of the reference spin density cube file for fragment A."// &
1725 " May include a path. The reference spin density needs to be outputted"// &
1726 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1727 " For GAPW, use the TOTAL_SPIN_DENSITY cube generated together with"// &
1728 " E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY.", &
1729 usage="FRAGMENT_A_SPIN_FILE <FILENAME>", &
1730 default_lc_val="fragment_a_spin.cube")
1731 CALL section_add_keyword(section, keyword)
1732 CALL keyword_release(keyword)
1733
1734 CALL keyword_create(keyword, __location__, name="FRAGMENT_B_SPIN_FILE", &
1735 variants=["FRAGMENT_B_SPIN_FILE_NAME"], &
1736 description="Name of the reference spin density cube file for fragment B."// &
1737 " May include a path. The reference spin density needs to be outputted"// &
1738 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1739 " For GAPW, use the TOTAL_SPIN_DENSITY cube generated together with"// &
1740 " E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY.", &
1741 usage="FRAGMENT_B_SPIN_FILE <FILENAME>", &
1742 default_lc_val="fragment_b_spin.cube")
1743 CALL section_add_keyword(section, keyword)
1744 CALL keyword_release(keyword)
1745
1746 CALL keyword_create(keyword, __location__, name="FLIP_FRAGMENT_A", &
1747 description="Logical which determines if the reference spin difference density "// &
1748 "(rho_alpha-rho_beta) for fragment A should be flipped. With default (off) "// &
1749 "value, the fragment is constrained to have more alpha than beta electrons "// &
1750 "if the isolated fragment has unpaired electrons. Useful in conjunction with "// &
1751 "FLIP_FRAGMENT_B.", &
1752 usage="FLIP_FRAGMENT_A", &
1753 default_l_val=.false., lone_keyword_l_val=.true.)
1754 CALL section_add_keyword(section, keyword)
1755 CALL keyword_release(keyword)
1756
1757 CALL keyword_create(keyword, __location__, name="FLIP_FRAGMENT_B", &
1758 description="Logical which determines if the reference spin difference density "// &
1759 "(rho_alpha-rho_beta) for fragment B should be flipped. With default (off) "// &
1760 "value, the fragment is constrained to have more alpha than beta electrons "// &
1761 "if the isolated fragment has unpaired electrons. Useful in conjunction with "// &
1762 "FLIP_FRAGMENT_A.", &
1763 usage="FLIP_FRAGMENT_B", &
1764 default_l_val=.false., lone_keyword_l_val=.true.)
1765 CALL section_add_keyword(section, keyword)
1766 CALL keyword_release(keyword)
1767
1768 CALL cp_print_key_section_create(print_key, __location__, "PROGRAM_RUN_INFO", &
1769 description="Controls the printing of basic info about the method.", &
1770 print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
1771
1772 CALL section_create(subsection, __location__, name="WEIGHT_FUNCTION", &
1773 description="Controls the printing of cube files with "// &
1774 "the CDFT weight function(s). Intended for single-point testing. "// &
1775 "In multistep simulations, generated cube files are overwritten each step.", &
1776 n_keywords=1, n_subsections=0, repeats=.false.)
1777
1778 CALL keyword_create(keyword, __location__, name="STRIDE", &
1779 description="The stride (X,Y,Z) used to write the cube file "// &
1780 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
1781 " 1 number valid for all components.", &
1782 usage="STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=integer_t)
1783 CALL section_add_keyword(subsection, keyword)
1784 CALL keyword_release(keyword)
1785
1786 CALL section_add_subsection(print_key, subsection)
1787 CALL section_release(subsection)
1788
1789 CALL section_add_subsection(section, print_key)
1790 CALL section_release(print_key)
1791
1792 CALL section_create(group_section, __location__, name="ATOM_GROUP", &
1793 description="Define a group of atoms for use in a CDFT constraint. Each repetition of "// &
1794 "this section creates a new constraint.", &
1795 n_keywords=4, n_subsections=0, repeats=.true.)
1796
1797 CALL keyword_create(keyword, __location__, name="ATOMS", &
1798 description="Specifies the list of atoms that are included in the constraint group.", &
1799 usage="ATOMS {integer} {integer} .. {integer}", &
1800 n_var=-1, type_of_var=integer_t)
1801 CALL section_add_keyword(group_section, keyword)
1802 CALL keyword_release(keyword)
1803
1804 CALL keyword_create(keyword, __location__, name="COEFF", &
1805 description="Defines coefficients for the atoms in the list of atoms. Accepts values +/-1.0.", &
1806 usage="COEFF 1.0 -1.0", repeats=.true., &
1807 type_of_var=real_t, n_var=-1)
1808 CALL section_add_keyword(group_section, keyword)
1809 CALL keyword_release(keyword)
1810
1811 CALL keyword_create(keyword, __location__, name="CONSTRAINT_TYPE ", &
1812 description="Determines what type of constraint to apply. ", &
1813 usage="CONSTRAINT_TYPE (CHARGE|MAGNETIZATION|ALPHA|BETA)", &
1814 enum_c_vals=s2a("CHARGE", "MAGNETIZATION", "ALPHA", "BETA"), &
1817 enum_desc=s2a("Total charge density constraint (rho_alpha + rho_beta).", &
1818 "Magnetization density constraint (rho_alpha - rho_beta).", &
1819 "Alpha spin density constraint.", &
1820 "Beta spin density constraint."), &
1821 default_i_val=cdft_charge_constraint)
1822 CALL section_add_keyword(group_section, keyword)
1823 CALL keyword_release(keyword)
1824
1825 CALL keyword_create(keyword, __location__, name="FRAGMENT_CONSTRAINT", &
1826 description="Use a fragment based constraint. "// &
1827 "Takes as input the electron densities of two isolated fragments in the "// &
1828 "same geometry that they have in the full system. "// &
1829 "The isolated fragment densities are read from cube files defined in FRAGMENT_{A,B}_FILE. "// &
1830 "For magnetization density constraints, additional files containing the spin difference "// &
1831 "densities must be defined with the keywords FRAGMENT_{A,B}_SPIN_FILE. "// &
1832 "With this keyword active, the target value of the constraint is calculated from the "// &
1833 "the superposition of the isolated fragment densities. Supports only static calculations.", &
1834 usage="FRAGMENT_CONSTRAINT", &
1835 default_l_val=.false., lone_keyword_l_val=.true.)
1836 CALL section_add_keyword(group_section, keyword)
1837 CALL keyword_release(keyword)
1838
1839 CALL section_add_subsection(section, group_section)
1840 CALL section_release(group_section)
1841
1842 CALL section_create(group_section, __location__, name="DUMMY_ATOMS", &
1843 description="Define an extra group of atoms for which only atomic CDFT charges "// &
1844 "should be computed. The section cannot contain any constraint "// &
1845 "atoms that were included in section ATOM_GROUP.", &
1846 n_keywords=1, n_subsections=0, repeats=.true.)
1847
1848 CALL keyword_create(keyword, __location__, name="ATOMS", &
1849 description="Specifies the list of atoms that are included in the DUMMY_ATOMS group.", &
1850 usage="ATOMS {integer} {integer} .. {integer}", &
1851 n_var=-1, type_of_var=integer_t)
1852 CALL section_add_keyword(group_section, keyword)
1853 CALL keyword_release(keyword)
1854
1855 CALL section_add_subsection(section, group_section)
1856 CALL section_release(group_section)
1857
1858 CALL keyword_create(keyword, __location__, name="REUSE_PRECOND", &
1859 description="Reuse a previously built OT preconditioner between subsequent CDFT SCF iterations "// &
1860 "if the inner OT SCF loop converged in PRECOND_FREQ steps or less. Intended mainly for MD "// &
1861 "simulations with the FULL_ALL preconditioner to speed up the final iterations of the CDFT SCF loop.", &
1862 usage="REUSE_PRECOND yes", repeats=.false., n_var=1, &
1863 default_l_val=.false., lone_keyword_l_val=.true.)
1864 CALL section_add_keyword(section, keyword)
1865 CALL keyword_release(keyword)
1866
1867 CALL keyword_create(keyword, __location__, name="PRECOND_FREQ", &
1868 description="See REUSE_PRECOND.", &
1869 usage="PRECOND_FREQ {int}", default_i_val=0)
1870 CALL section_add_keyword(section, keyword)
1871 CALL keyword_release(keyword)
1872
1873 CALL keyword_create(keyword, __location__, name="MAX_REUSE", &
1874 description="Determines how many times a previously built preconditioner can be reused.", &
1875 usage="MAX_REUSE {int}", default_i_val=0)
1876 CALL section_add_keyword(section, keyword)
1877 CALL keyword_release(keyword)
1878
1879 CALL keyword_create(keyword, __location__, name="PURGE_HISTORY", &
1880 description="Purge wavefunction and constraint history to improve SCF convergence during MD."// &
1881 " Counts how often the convergence of the first CDFT SCF iteration takes 2 or more outer SCF"// &
1882 " iterations and purges the history if the counter exceeds PURGE_FREQ, and PURGE_OFFSET"// &
1883 " MD steps have passed since the last purge."// &
1884 " The counter is zeroed after each purge.", &
1885 usage="PURGE_HISTORY yes", repeats=.false., n_var=1, &
1886 default_l_val=.false., lone_keyword_l_val=.true.)
1887 CALL section_add_keyword(section, keyword)
1888 CALL keyword_release(keyword)
1889
1890 CALL keyword_create(keyword, __location__, name="PURGE_FREQ", &
1891 description="See PURGE_HISTORY.", &
1892 usage="PURGE_FREQ {int} ", default_i_val=1)
1893 CALL section_add_keyword(section, keyword)
1894 CALL keyword_release(keyword)
1895
1896 CALL keyword_create(keyword, __location__, name="PURGE_OFFSET", &
1897 description="See PURGE_HISTORY.", &
1898 usage="PURGE_OFFSET {int} ", default_i_val=1)
1899 CALL section_add_keyword(section, keyword)
1900 CALL keyword_release(keyword)
1901
1902 CALL keyword_create(keyword, __location__, name="COUNTER", &
1903 description="A counter to track the total number of energy evaluations. Needed by"// &
1904 " some optimizers to print information. Useful mainly for restarts.", &
1905 usage="COUNTER {int} ", default_i_val=0)
1906 CALL section_add_keyword(section, keyword)
1907 CALL keyword_release(keyword)
1908
1909 CALL keyword_create(keyword, __location__, name="IN_MEMORY", &
1910 description="Precompute gradients due to constraint during"// &
1911 " initial formation of constraint and store them in memory. Does"// &
1912 " nothing if forces are not calculated.", &
1913 usage="IN_MEMORY", &
1914 default_l_val=.false., lone_keyword_l_val=.true.)
1915 CALL section_add_keyword(section, keyword)
1916 CALL keyword_release(keyword)
1917
1918 END SUBROUTINE create_cdft_control_section
1919
1920! **************************************************************************************************
1921!> \brief Creates the input section for defining Gaussian Hirshfeld CDFT constraints.
1922!> \param section the section to create
1923! **************************************************************************************************
1924 SUBROUTINE create_hirshfeld_constraint_section(section)
1925 TYPE(section_type), POINTER :: section
1926
1927 TYPE(keyword_type), POINTER :: keyword
1928
1929 NULLIFY (keyword)
1930
1931 cpassert(.NOT. ASSOCIATED(section))
1932 CALL section_create(section, __location__, name="HIRSHFELD_CONSTRAINT", &
1933 description="Parameters for CDFT with a Gaussian Hirshfeld constraint.", &
1934 n_keywords=11, n_subsections=0, repeats=.false.)
1935
1936 CALL keyword_create(keyword, __location__, name="SHAPE_FUNCTION", &
1937 description="Type of shape function used for Hirshfeld partitioning.", &
1938 usage="SHAPE_FUNCTION {Gaussian,Density}", repeats=.false., n_var=1, &
1939 default_i_val=shape_function_gaussian, &
1940 enum_c_vals=s2a("GAUSSIAN", "DENSITY"), &
1941 enum_desc=s2a("One Gaussian per atom with radius determined by the keyword GAUSSIAN_SHAPE.", &
1942 "Atomic density expanded in terms of multiple Gaussians."), &
1944 CALL section_add_keyword(section, keyword)
1945 CALL keyword_release(keyword)
1946
1947 CALL keyword_create(keyword, __location__, name="GAUSSIAN_SHAPE", &
1948 description="Specifies the type of Gaussian used for SHAPE_FUNCTION GAUSSIAN.", &
1949 usage="GAUSSIAN_SHAPE (SINGLE|VDW|COVALENT|USER)", &
1950 enum_c_vals=s2a("DEFAULT", "SINGLE", "VDW", "COVALENT", "USER"), &
1952 enum_desc=s2a("Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
1953 " 1.0_dp radius for elements with a radius larger than this value.", &
1954 "Single Gaussian for all atom types with radius given by GAUSSIAN_RADIUS.", &
1955 "Use van der Waals radii to construct Gaussians.", &
1956 "Use covalent radii to construct Gaussians.", &
1957 "Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians."), &
1958 default_i_val=radius_default)
1959 CALL section_add_keyword(section, keyword)
1960 CALL keyword_release(keyword)
1961
1962 CALL keyword_create(keyword, __location__, name="GAUSSIAN_RADIUS", &
1963 description="Radius parameter controlling the creation of Gaussians.", &
1964 usage="GAUSSIAN_RADIUS <REAL>", &
1965 unit_str="angstrom", &
1966 default_r_val=cp_unit_to_cp2k(3.0_dp, "angstrom"), &
1967 type_of_var=real_t, n_var=1)
1968 CALL section_add_keyword(section, keyword)
1969 CALL keyword_release(keyword)
1970
1971 CALL keyword_create(keyword, __location__, name="ATOMIC_RADII", &
1972 description="Defines custom radii to setup the spherical Gaussians. "// &
1973 "Give one value per element in the same order as they "// &
1974 "appear in the input coordinates.", &
1975 usage="ATOMIC_RADII {real} {real} {real}", repeats=.false., &
1976 unit_str="angstrom", &
1977 type_of_var=real_t, n_var=-1)
1978 CALL section_add_keyword(section, keyword)
1979 CALL keyword_release(keyword)
1980
1981 CALL keyword_create(keyword, __location__, name="USE_BOHR", &
1982 description="Convert the Gaussian radius from angstrom to bohr. This results in a larger "// &
1983 "Gaussian than without unit conversion.", &
1984 usage="USE_BOHR .TRUE.", &
1985 default_l_val=.false., lone_keyword_l_val=.true.)
1986 CALL section_add_keyword(section, keyword)
1987 CALL keyword_release(keyword)
1988
1989 CALL keyword_create(keyword, __location__, name="PRINT_DENSITY", &
1990 description="Logical to control printing of Hirshfeld densities to .cube file.", &
1991 usage="PRINT_DENSITY TRUE", &
1992 default_l_val=.false., lone_keyword_l_val=.true.)
1993 CALL section_add_keyword(section, keyword)
1994 CALL keyword_release(keyword)
1995
1996 CALL keyword_create(keyword, __location__, name="ATOMS_MEMORY", &
1997 description="Number of atomic gradients to store in memory.", &
1998 usage="ATOMS_MEMORY", &
1999 n_var=1, type_of_var=integer_t, &
2000 default_i_val=80)
2001 CALL section_add_keyword(section, keyword)
2002 CALL keyword_release(keyword)
2003
2004 CALL keyword_create(keyword, __location__, name="USE_ATOMIC_CUTOFF", &
2005 description="Logical to control use of ATOMIC_CUTOFF.", &
2006 usage="USE_ATOMIC_CUTOFF TRUE", &
2007 default_l_val=.true., lone_keyword_l_val=.true.)
2008 CALL section_add_keyword(section, keyword)
2009 CALL keyword_release(keyword)
2010
2011 CALL keyword_create(keyword, __location__, name="EPS_CUTOFF", &
2012 description="Numerical cutoff for calculation of weight function.", &
2013 usage="EPS_CUTOFF {real} ", default_r_val=1.0e-12_dp)
2014 CALL section_add_keyword(section, keyword)
2015 CALL keyword_release(keyword)
2016
2017 CALL keyword_create(keyword, __location__, name="ATOMIC_CUTOFF", &
2018 description="Numerical cutoff for calculation of Hirshfeld densities.", &
2019 usage="ATOMIC_CUTOFF {real} ", default_r_val=1.0e-12_dp)
2020 CALL section_add_keyword(section, keyword)
2021 CALL keyword_release(keyword)
2022
2023 END SUBROUTINE create_hirshfeld_constraint_section
2024
2025! **************************************************************************************************
2026!> \brief Create input section to define CDFT constraint settings specific to Becke weight function.
2027!> \param section the section to create
2028! **************************************************************************************************
2029 SUBROUTINE create_becke_constraint_section(section)
2030 TYPE(section_type), POINTER :: section
2031
2032 TYPE(keyword_type), POINTER :: keyword
2033
2034 NULLIFY (keyword)
2035 cpassert(.NOT. ASSOCIATED(section))
2036 CALL section_create(section, __location__, name="BECKE_CONSTRAINT", &
2037 description="Define settings influencing the construction of the Becke weight function.", &
2038 n_keywords=13, repeats=.false., citations=[becke1988b])
2039
2040 CALL keyword_create(keyword, __location__, name="ADJUST_SIZE", &
2041 description="Adjust Becke cell boundaries with atomic"// &
2042 " radii to generate a heteronuclear cutoff profile. These"// &
2043 " radii are defined with the keyword ATOMIC_RADII.", &
2044 usage="ADJUST_SIZE", &
2045 default_l_val=.false., lone_keyword_l_val=.true.)
2046 CALL section_add_keyword(section, keyword)
2047 CALL keyword_release(keyword)
2048
2049 CALL keyword_create(keyword, __location__, name="ATOMIC_RADII", &
2050 description="Defines atomic radii to generate a heteronuclear cutoff profile."// &
2051 " Give one value per element in the same order as they"// &
2052 " appear in the input coordinates.", &
2053 usage="ATOMIC_RADII {real} {real} {real}", repeats=.false., &
2054 unit_str="angstrom", &
2055 type_of_var=real_t, n_var=-1)
2056 CALL section_add_keyword(section, keyword)
2057 CALL keyword_release(keyword)
2058
2059 CALL keyword_create(keyword, __location__, name="SHOULD_SKIP", &
2060 description="If grid point is farther than GLOBAL_CUTOFF from all constraint atoms, "// &
2061 "move directly to next grid point, thus saving computational resources.", &
2062 usage="SHOULD_SKIP", &
2063 default_l_val=.false., lone_keyword_l_val=.true.)
2064 CALL section_add_keyword(section, keyword)
2065 CALL keyword_release(keyword)
2066
2067 CALL keyword_create(keyword, __location__, name="CAVITY_CONFINE", &
2068 description="Activates Gaussian cavity confinement. The constraint is evaluated only inside "// &
2069 "the cavity. The cavity is formed by summing spherical Gaussians centered on the constraint atoms.", &
2070 usage="CAVITY_CONFINE", &
2071 default_l_val=.false., lone_keyword_l_val=.true.)
2072 CALL section_add_keyword(section, keyword)
2073 CALL keyword_release(keyword)
2074
2075 CALL keyword_create(keyword, __location__, name="CAVITY_SHAPE", &
2076 description="Specifies the type of Gaussian cavity used.", &
2077 usage="CAVITY_SHAPE (SINGLE|VDW|COVALENT|USER)", &
2078 enum_c_vals=s2a("DEFAULT", "SINGLE", "VDW", "COVALENT", "USER"), &
2080 enum_desc=s2a("Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
2081 " 1.0_dp radius for elements with a radius larger than this value.", &
2082 "Single Gaussian for all atom types with radius given by CAVITY_RADIUS.", &
2083 "Use van der Waals radii to construct Gaussians.", &
2084 "Use covalent radii to construct Gaussians.", &
2085 "Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians."), &
2086 default_i_val=radius_default)
2087 CALL section_add_keyword(section, keyword)
2088 CALL keyword_release(keyword)
2089
2090 CALL keyword_create(keyword, __location__, name="CAVITY_USE_BOHR", &
2091 description="Convert the cavity radius from angstrom to bohr. This results in a larger"// &
2092 " confinement cavity than without unit conversion.", &
2093 usage="CAVITY_USE_BOHR TRUE", &
2094 default_l_val=.false., lone_keyword_l_val=.true.)
2095 CALL section_add_keyword(section, keyword)
2096 CALL keyword_release(keyword)
2097
2098 CALL keyword_create(keyword, __location__, name="CAVITY_PRINT", &
2099 description="Print cavity in Gaussian cube file format. Currently, printing options"// &
2100 " are hardcoded.", &
2101 usage="CAVITY_PRINT", &
2102 default_l_val=.false., lone_keyword_l_val=.true.)
2103 CALL section_add_keyword(section, keyword)
2104 CALL keyword_release(keyword)
2105
2106 CALL keyword_create(keyword, __location__, name="CAVITY_RADIUS", &
2107 description="Radius parameter controlling the creation of Gaussian cavity confinement.", &
2108 usage="CAVITY_RADIUS <REAL>", &
2109 unit_str="angstrom", &
2110 default_r_val=cp_unit_to_cp2k(3.0_dp, "angstrom"), &
2111 type_of_var=real_t, n_var=1)
2112 CALL section_add_keyword(section, keyword)
2113 CALL keyword_release(keyword)
2114
2115 CALL keyword_create(keyword, __location__, name="EPS_CAVITY", &
2116 description="Density threshold for cavity creation. Grid points where the Gaussian"// &
2117 " density falls below the threshold are ignored.", &
2118 usage="EPS_CAVITY {real} ", default_r_val=1.0e-6_dp)
2119 CALL section_add_keyword(section, keyword)
2120 CALL keyword_release(keyword)
2121
2122 CALL keyword_create(keyword, __location__, name="CUTOFF_TYPE", &
2123 description="Specifies the type of cutoff used when building the Becke weight function.", &
2124 usage="CUTOFF_TYPE (GLOBAL|ELEMENT)", &
2125 enum_c_vals=s2a("GLOBAL", "ELEMENT"), &
2127 enum_desc=s2a("Use a single value for all elements. Read from GLOBAL_CUTOFF.", &
2128 "Use a different value for all elements. Values read from ELEMENT_CUTOFF."), &
2129 default_i_val=becke_cutoff_global)
2130 CALL section_add_keyword(section, keyword)
2131 CALL keyword_release(keyword)
2132
2133 CALL keyword_create(keyword, __location__, name="GLOBAL_CUTOFF", &
2134 description="Parameter used to select which atoms contribute to the"// &
2135 " weight function at each real space grid point.", &
2136 usage="GLOBAL_CUTOFF <REAL>", &
2137 unit_str="angstrom", &
2138 default_r_val=cp_unit_to_cp2k(3.1750632515_dp, "angstrom"), &
2139 type_of_var=real_t, n_var=1)
2140 CALL section_add_keyword(section, keyword)
2141 CALL keyword_release(keyword)
2142
2143 CALL keyword_create(keyword, __location__, name="ELEMENT_CUTOFF", &
2144 description="Defines element specific cutoffs to decide which atoms contribute to the"// &
2145 " weight function at each real space grid point. Give one value per element in the same"// &
2146 " order as they appear in the coordinates.", &
2147 usage="ELEMENT_CUTOFF {real} {real} {real}", repeats=.false., &
2148 unit_str="angstrom", &
2149 type_of_var=real_t, n_var=-1)
2150 CALL section_add_keyword(section, keyword)
2151 CALL keyword_release(keyword)
2152
2153 CALL keyword_create(keyword, __location__, name="IN_MEMORY", &
2154 description="Precompute gradients due to Becke constraint during"// &
2155 " initial formation of constraint and store them in memory. Useful"// &
2156 " in combination with confinement, memory intensive otherwise. Does"// &
2157 " nothing if forces are not calculated.", &
2158 usage="IN_MEMORY", &
2159 default_l_val=.false., lone_keyword_l_val=.true.)
2160 CALL section_add_keyword(section, keyword)
2161 CALL keyword_release(keyword)
2162
2163 END SUBROUTINE create_becke_constraint_section
2164
2165! **************************************************************************************************
2166!> \brief creates the input section for parameters related to CDFT specific optimizers
2167!> \param section the section to be created
2168!> \par History
2169!> 03.2018 separated from create_outer_scf_section [Nico Holmberg]
2170!> \author Nico Holmberg
2171! **************************************************************************************************
2172 SUBROUTINE create_cdft_opt_section(section)
2173 TYPE(section_type), POINTER :: section
2174
2175 TYPE(keyword_type), POINTER :: keyword
2176
2177 cpassert(.NOT. ASSOCIATED(section))
2178 CALL section_create(section, __location__, name="CDFT_OPT", &
2179 description="Parameters controlling optimization methods that are compatible "// &
2180 "only with CDFT based constraints (i.e. CDFT SCF is active). Specifically, "// &
2181 "the control parameters for the Broyden and Newton optimizers are defined in this "// &
2182 "section.", &
2183 n_keywords=10, n_subsections=0, repeats=.false.)
2184
2185 NULLIFY (keyword)
2186
2187 CALL keyword_create(keyword, __location__, name="BROYDEN_TYPE", &
2188 description="Specifies the Broyden optimizer variant to use.", &
2189 usage="BROYDEN_TYPE BT1", &
2190 default_i_val=broyden_type_1, &
2191 enum_c_vals=s2a("BT1", "BT1_EXPLICIT", "BT2", "BT2_EXPLICIT", &
2192 "BT1_LS", "BT1_EXPLICIT_LS", "BT2_LS", "BT2_EXPLICIT_LS"), &
2193 enum_desc=s2a("Broyden's first method, also known as the good method. The initial Jacobian"// &
2194 " is built from MD history if available. Otherwise switches to SD for one"// &
2195 " SCF iteration until a Jacobian can be built from the SCF history.", &
2196 "Same as BT1, but computes the explicit Jacobian with finite differences. "// &
2197 "Requires a CDFT SCF procedure to be active.", &
2198 "Same as BT1, but uses Broyden's second method, also known as the bad method.", &
2199 "Same as BT1_EXPLICIT, but using Broyden's second method.", &
2200 "Same as BT1, but uses backtracking line search for optimizing the step size "// &
2201 "(see optimizer NEWTON_LS).", &
2202 "Same as BT1_EXPLICIT, but uses backtracking line search for optimizing the step size.", &
2203 "Same as BT2, but uses backtracking line search for optimizing the step size.", &
2204 "Same as BT2_EXPLICIT, but uses backtracking line search for optimizing the step size."), &
2208 CALL section_add_keyword(section, keyword)
2209 CALL keyword_release(keyword)
2210
2211 CALL keyword_create(keyword, __location__, name="JACOBIAN_TYPE", &
2212 description="Finite difference method used to calculate the inverse Jacobian "// &
2213 "needed by some optimizers. Compatible only with CDFT constraints.", &
2214 usage="JACOBIAN_TYPE FD1", &
2215 default_i_val=jacobian_fd1, &
2216 enum_c_vals=s2a("FD1", "FD1_BACKWARD", "FD2", "FD2_BACKWARD", "FD1_CENTRAL"), &
2217 enum_desc=s2a("First order forward difference (one extra energy evaluation per constraint).", &
2218 "First order backward difference (one extra energy evaluation per constraint).", &
2219 "Second order forward difference (two extra energy evaluations per constraint).", &
2220 "Second order backward difference (two extra energy evaluations per constraint).", &
2221 "First order central difference (two extra energy evaluations per constraint)."), &
2224 CALL section_add_keyword(section, keyword)
2225 CALL keyword_release(keyword)
2226
2227 CALL keyword_create(keyword, __location__, name="JACOBIAN_STEP", &
2228 description="Step size to use in the calculation of the inverse Jacobian with finite differences. "// &
2229 "Expects one value for all constraints, or one value per constraint.", &
2230 usage="JACOBIAN_STEP 5.0E-3 ", n_var=-1, default_r_val=5.0e-3_dp)
2231 CALL section_add_keyword(section, keyword)
2232 CALL keyword_release(keyword)
2233
2234 CALL keyword_create(keyword, __location__, name="JACOBIAN_FREQ", &
2235 description="Defines parameters that control how often the explicit Jacobian is built,"// &
2236 " which is needed by some optimizers. Expects two values. The first value"// &
2237 " determines how many consecutive CDFT SCF iterations should skip a rebuild,"// &
2238 " whereas the latter how many MD steps. The values can be zero (meaning never"// &
2239 " rebuild) or positive. Both values cannot be zero.", &
2240 usage="JACOBIAN_FREQ 1 1", n_var=2, &
2241 default_i_vals=[1, 1], type_of_var=integer_t)
2242 CALL section_add_keyword(section, keyword)
2243 CALL keyword_release(keyword)
2244
2245 CALL keyword_create(keyword, __location__, name="JACOBIAN_RESTART", &
2246 description="Restart the inverse Jacobian using the vector defined with keyword JACOBIAN_VECTOR.", &
2247 usage="JACOBIAN_RESTART TRUE", &
2248 default_l_val=.false., lone_keyword_l_val=.true.)
2249 CALL section_add_keyword(section, keyword)
2250 CALL keyword_release(keyword)
2251
2252 CALL keyword_create(keyword, __location__, name="JACOBIAN_VECTOR", &
2253 description="Defines the inverse Jacobian matrix. Useful for restarting calculations. "// &
2254 "Expects n^2 values where n is the total number of constraints. "// &
2255 "The matrix should be given in row major order.", &
2256 usage="JACOBIAN_VECTOR 1.0 0.0", n_var=-1, type_of_var=real_t)
2257 CALL section_add_keyword(section, keyword)
2258 CALL keyword_release(keyword)
2259
2260 CALL keyword_create(keyword, __location__, name="MAX_LS", &
2261 description="The maximum number of backtracking line search steps to perform.", &
2262 usage="MAX_LS 5", default_i_val=5)
2263 CALL section_add_keyword(section, keyword)
2264 CALL keyword_release(keyword)
2265
2266 CALL keyword_create(keyword, __location__, name="FACTOR_LS", &
2267 description="Control parameter for backtracking line search. The step size is reduced by "// &
2268 "this factor on every line search iteration. Value must be between 0 and 1 (exclusive).", &
2269 usage="FACTOR_LS 0.5", default_r_val=0.5_dp)
2270 CALL section_add_keyword(section, keyword)
2271 CALL keyword_release(keyword)
2272
2273 CALL keyword_create(keyword, __location__, name="CONTINUE_LS", &
2274 description="Continue backtracking line search until MAX_LS steps are reached or the "// &
2275 "norm of the CDFT gradient no longer decreases. Default (false) behavior exits the "// &
2276 "line search procedure on the first step that the gradient decreases.", &
2277 usage="CONTINUE_LS TRUE", &
2278 default_l_val=.false., lone_keyword_l_val=.true.)
2279 CALL section_add_keyword(section, keyword)
2280 CALL keyword_release(keyword)
2281
2282 END SUBROUTINE create_cdft_opt_section
2283
2284! **************************************************************************************************
2285!> \brief Create CP2K input section for the grand canonical SCF
2286!> \param section ...
2287!> \date
2288!> \author Ziwei Chai
2289!> \version 1.0
2290! **************************************************************************************************
2291 SUBROUTINE create_gce_section(section)
2292
2293 TYPE(section_type), POINTER :: section
2294
2295 TYPE(keyword_type), POINTER :: keyword
2296
2297 cpassert(.NOT. ASSOCIATED(section))
2298
2299 CALL section_create(section, __location__, &
2300 name="GCE", &
2301 description="Enables grand canonical SCF calculations for "// &
2302 "slab models with a target work function specified by the "// &
2303 "user. The current implementation is intended for three "// &
2304 "dimensional periodic calculations and should be used "// &
2305 "together with the planar counter charge model. The planar "// &
2306 "counter charge screens the net charge of the DFT slab, so "// &
2307 "that the work function can be obtained from the planar "// &
2308 "averaged Hartree potential in the implicit solvent region "// &
2309 "or vacuum region. During the SCF iterations, the work "// &
2310 "function is mixed toward the target value. "// &
2311 "The reported GCE charges during SCF iterations are the "// &
2312 "current net charge of the DFT system excluding the planar "// &
2313 "counter charge. A positive value means electron deficiency. "// &
2314 "The input CHARGE value in the DFT section defines the "// &
2315 "reference charge state. The quantity N_e^(abs,alpha) is "// &
2316 "evaluated as the input CHARGE value minus the reported GCE "// &
2317 "charge. The reported GCE free energy is the sum of the DFT "// &
2318 "total energy and the product of the target work function "// &
2319 "and N_e^(abs,alpha).", &
2320 citations=[chai2024a], &
2321 n_keywords=3, &
2322 n_subsections=0, &
2323 repeats=.false.)
2324
2325 NULLIFY (keyword)
2326
2327 CALL keyword_create(keyword, __location__, &
2328 name="_SECTION_PARAMETERS_", &
2329 description="Controls the activation of grand canonical SCF", &
2330 usage="&GCE ON", &
2331 default_l_val=.false., &
2332 lone_keyword_l_val=.true.)
2333 CALL section_add_keyword(section, keyword)
2334 CALL keyword_release(keyword)
2335
2336 CALL keyword_create(keyword, __location__, &
2337 name="TARGET_WORKFUNCTION", &
2338 description="The user input target work function of the symmetric slab model", &
2339 repeats=.false., &
2340 n_var=1, &
2341 type_of_var=real_t, &
2342 default_r_val=0.16_dp, &
2343 unit_str="au_e", &
2344 usage="TARGET_WORKFUNCTION [eV] 0.16")
2345 CALL section_add_keyword(section, keyword)
2346 CALL keyword_release(keyword)
2347
2348 CALL keyword_create(keyword, __location__, &
2349 name="MIXING_COEF", &
2350 description="The proportion of the target work function mixed with the "// &
2351 "work function of the previous SCF iteration", &
2352 repeats=.false., &
2353 n_var=1, &
2354 type_of_var=real_t, &
2355 default_r_val=0.3_dp, &
2356 usage="MIXING_COEF 0.3")
2357 CALL section_add_keyword(section, keyword)
2358 CALL keyword_release(keyword)
2359
2360 END SUBROUTINE create_gce_section
2361
2362END MODULE input_cp2k_scf
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public vandevondele2003
integer, save, public blaha2010
integer, save, public holmberg2017
integer, save, public vandevondele2005a
integer, save, public schiffmann2015
integer, save, public hu2010
integer, save, public weber2008
integer, save, public kressefurthmueller1996
integer, save, public holmberg2018
integer, save, public becke1988b
integer, save, public stewart1982
integer, save, public chai2024a
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str, do_backup)
creates a print_key section
integer, parameter, public low_print_level
integer, parameter, public high_print_level
integer, parameter, public add_last_numeric
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
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public jacobian_fd1_central
integer, parameter, public smear_fermi_dirac
integer, parameter, public core_guess
integer, parameter, public mopac_guess
integer, parameter, public ot_precond_solver_chebyshev
integer, parameter, public ls_adapt
integer, parameter, public radius_vdw
integer, parameter, public external_density_guess
integer, parameter, public outer_scf_optimizer_sd
integer, parameter, public cholesky_restore
integer, parameter, public ot_chol_irac
integer, parameter, public cdft_beta_constraint
integer, parameter, public broyden_type_2_explicit_ls
integer, parameter, public cdft_magnetization_constraint
integer, parameter, public outer_scf_optimizer_bisect
integer, parameter, public outer_scf_optimizer_secant
integer, parameter, public smear_energy_window
integer, parameter, public ls_3pnt
integer, parameter, public diag_block_krylov
integer, parameter, public becke_cutoff_element
integer, parameter, public outer_scf_cdft_constraint
integer, parameter, public ot_low_rank_base_overlap
integer, parameter, public broyden_type_1_explicit
integer, parameter, public no_guess
integer, parameter, public broyden_type_2_ls
integer, parameter, public jacobian_fd2
integer, parameter, public broyden_type_1
integer, parameter, public radius_default
integer, parameter, public outer_scf_optimizer_broyden
integer, parameter, public atomic_guess
integer, parameter, public ot_precond_full_all_covariant
integer, parameter, public broyden_type_1_explicit_ls
integer, parameter, public ot_algo_irac
integer, parameter, public outer_scf_basis_center_opt
integer, parameter, public cholesky_dbcsr
integer, parameter, public broyden_type_2_explicit
integer, parameter, public ot_low_rank_base_lattice_fft
integer, parameter, public outer_scf_s2_constraint
integer, parameter, public ot_algo_taylor_or_diag
integer, parameter, public ot_poly_irac
integer, parameter, public history_guess
integer, parameter, public cholesky_off
integer, parameter, public cdft_charge_constraint
integer, parameter, public smear_list
integer, parameter, public jacobian_fd1
integer, parameter, public broyden_type_2
integer, parameter, public ot_mini_cg
integer, parameter, public ot_lattice_fft_on
integer, parameter, public ot_precond_full_kinetic
integer, parameter, public cholesky_reduce
integer, parameter, public high_spin_roks
integer, parameter, public cholesky_inverse
integer, parameter, public ot_lattice_fft_auto
integer, parameter, public ot_mini_diis
integer, parameter, public diag_update_method_mixing
integer, parameter, public diag_ot
integer, parameter, public outer_scf_ddapc_constraint
integer, parameter, public ot_precond_solver_default
integer, parameter, public ot_lattice_fft_off
integer, parameter, public outer_scf_becke_constraint
integer, parameter, public radius_user
integer, parameter, public random_guess
integer, parameter, public ot_precond_full_single
integer, parameter, public smear_gaussian
integer, parameter, public ot_precond_solver_inv_chol
integer, parameter, public shape_function_density
integer, parameter, public outer_scf_hirshfeld_constraint
integer, parameter, public radius_covalent
integer, parameter, public jacobian_fd1_backward
integer, parameter, public ot_precond_none
integer, parameter, public jacobian_fd2_backward
integer, parameter, public ls_2pnt
integer, parameter, public smear_mv
integer, parameter, public ls_none
integer, parameter, public ot_precond_full_single_inverse
integer, parameter, public ot_lwdn_irac
integer, parameter, public diag_update_method_adiis
integer, parameter, public diag_filter_matrix
integer, parameter, public ls_gold
integer, parameter, public sparse_guess
integer, parameter, public diag_block_davidson
integer, parameter, public shape_function_gaussian
integer, parameter, public radius_single
integer, parameter, public outer_scf_optimizer_newton_ls
integer, parameter, public gaussian
integer, parameter, public outer_scf_optimizer_none
integer, parameter, public outer_scf_optimizer_newton
integer, parameter, public ot_precond_fermi_low_rank
integer, parameter, public general_roks
integer, parameter, public outer_scf_none
integer, parameter, public ot_mini_lbfgs
integer, parameter, public diag_standard
integer, parameter, public smear_mp
integer, parameter, public becke_cutoff_global
integer, parameter, public cdft_alpha_constraint
integer, parameter, public broyden_type_1_ls
integer, parameter, public restart_guess
integer, parameter, public ot_precond_s_inverse
integer, parameter, public ot_mini_broyden
integer, parameter, public ot_precond_solver_update
integer, parameter, public outer_scf_optimizer_diis
integer, parameter, public ot_mini_sd
integer, parameter, public numerical
integer, parameter, public ot_precond_full_all
integer, parameter, public ot_precond_solver_direct
integer, parameter, public eht_guess
function that build the scf section of the input
subroutine, public create_scf_section(section)
creates the structure of the section with the DFT SCF parameters
subroutine, public create_cdft_control_section(section)
Creates the input section for defining CDFT constraints.
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
integer, parameter, public integer_t
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
module that contains the definitions of the scf types
subroutine, public create_mixing_section(section, ls_scf, active_space)
Create CP2K input section for SCF or active-space density mixing.
subroutine, public create_filtermatrix_section(section)
Input section for filter matrix diagonalisation method.
Definition qs_fb_input.F:37
manage control variables for the maximum overlap method
subroutine, public create_mom_section(section)
Create CP2K input section for variable occupancy using the Maximum Overlap Method....
Utilities for string manipulations.
character(len=1), parameter, public newline
represent a keyword in the input
represent a section of the input file