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