(git:1155b05)
Loading...
Searching...
No Matches
input_cp2k_ec.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief function that build the dft section of the input
10!> \par History
11!> 10.2005 moved out of input_cp2k [fawzi]
12!> \author fawzi
13! **************************************************************************************************
15 USE bibliography, ONLY: niklasson2003,&
21 USE cp_units, ONLY: cp_unit_to_cp2k
22 USE input_constants, ONLY: &
44 USE input_val_types, ONLY: char_t,&
45 integer_t,&
46 real_t
47 USE kinds, ONLY: dp
48 USE string_utilities, ONLY: s2a
49#include "./base/base_uses.f90"
50
51 IMPLICIT NONE
52 PRIVATE
53
54 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_ec'
55
56 PUBLIC :: create_ec_section
57
58CONTAINS
59
60! **************************************************************************************************
61!> \brief creates the ENERGY CORRECTION section
62!> \param section ...
63!> \author JGH
64! **************************************************************************************************
65 SUBROUTINE create_ec_section(section)
66 TYPE(section_type), POINTER :: section
67
68 TYPE(keyword_type), POINTER :: keyword
69 TYPE(section_type), POINTER :: subsection
70
71 cpassert(.NOT. ASSOCIATED(section))
72
73 NULLIFY (keyword)
74 CALL section_create(section, __location__, name="ENERGY_CORRECTION", &
75 description="Sets the various options for the Energy Correction", &
76 n_keywords=0, n_subsections=2, repeats=.false.)
77
78 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
79 description="Controls the activation of the energy_correction", &
80 usage="&ENERGY_CORRECTION T", &
81 default_l_val=.false., &
82 lone_keyword_l_val=.true.)
83 CALL section_add_keyword(section, keyword)
84 CALL keyword_release(keyword)
85
86 ! add a special XC section
87 NULLIFY (subsection)
88 CALL create_xc_section(subsection)
89 CALL section_add_subsection(section, subsection)
90 CALL section_release(subsection)
91
92 ! add a special kpoint section
93 NULLIFY (subsection)
94 CALL create_kpoints_section(subsection)
95 CALL section_add_subsection(section, subsection)
96 CALL section_release(subsection)
97
98 ! add a section for solver keywords
99 NULLIFY (subsection)
100 CALL create_ec_solver_section(subsection)
101 CALL section_add_subsection(section, subsection)
102 CALL section_release(subsection)
103
104 ! add a print section for properties
105 NULLIFY (subsection)
106 CALL create_ec_print_section(subsection)
107 CALL section_add_subsection(section, subsection)
108 CALL section_release(subsection)
109
110 CALL keyword_create(keyword, __location__, name="ENERGY_FUNCTIONAL", &
111 description="Functional used in energy correction", &
112 usage="ENERGY_FUNCTIONAL HARRIS", &
113 default_i_val=ec_functional_harris, &
114 enum_c_vals=s2a("HARRIS", "DCDFT", "EXTERNAL"), &
115 enum_desc=s2a("Harris functional", &
116 "Density-corrected DFT", &
117 "External calculated energy"), &
119 CALL section_add_keyword(section, keyword)
120 CALL keyword_release(keyword)
121
122 CALL keyword_create(keyword, __location__, name="HARRIS_BASIS", &
123 description="Specifies the type of basis to be used for the KG energy correction. "// &
124 "Options are: (1) the default orbital basis (ORBITAL); "// &
125 "(2) the primitive functions of the default orbital basis (PRIMITIVE); "// &
126 "(3) the basis set labeled in Kind section (HARRIS)", &
127 usage="HARRIS_BASIS ORBITAL", &
128 type_of_var=char_t, default_c_val="ORBITAL", n_var=-1)
129 CALL section_add_keyword(section, keyword)
130 CALL keyword_release(keyword)
131
132 CALL keyword_create(keyword, __location__, name="DEBUG_FORCES", &
133 description="Additional output to debug energy correction forces.", &
134 usage="DEBUG_FORCES T", default_l_val=.false., lone_keyword_l_val=.true.)
135 CALL section_add_keyword(section, keyword)
136 CALL keyword_release(keyword)
137 CALL keyword_create(keyword, __location__, name="DEBUG_STRESS", &
138 description="Additional output to debug energy correction forces.", &
139 usage="DEBUG_STRESS T", default_l_val=.false., lone_keyword_l_val=.true.)
140 CALL section_add_keyword(section, keyword)
141 CALL keyword_release(keyword)
142 CALL keyword_create(keyword, __location__, name="DEBUG_EXTERNAL_METHOD", &
143 description="Uses an internal pseudo-energy to test EXTERNAL energy method.", &
144 usage="DEBUG_EXTERNAL_METHOD T", default_l_val=.false., lone_keyword_l_val=.true.)
145 CALL section_add_keyword(section, keyword)
146 CALL keyword_release(keyword)
147
148 CALL keyword_create(keyword, __location__, name="SKIP_EC", &
149 description="Skip EC calculation if ground-state calculation has not converged.", &
150 usage="SKIP_EC T", default_l_val=.false., lone_keyword_l_val=.true.)
151 CALL section_add_keyword(section, keyword)
152 CALL keyword_release(keyword)
153
154 CALL keyword_create(keyword, __location__, name="MAO", &
155 description="Use modified atomic orbitals (MAO) to solve Harris equation", &
156 usage="MAO T", default_l_val=.false., lone_keyword_l_val=.true.)
157 CALL section_add_keyword(section, keyword)
158 CALL keyword_release(keyword)
159
160 CALL keyword_create(keyword, __location__, name="MAO_MAX_ITER", &
161 description="Maximum iterations in MAO optimization. ", &
162 usage="MAO_MAX_ITER 100 ", default_i_val=0)
163 CALL section_add_keyword(section, keyword)
164 CALL keyword_release(keyword)
165
166 CALL keyword_create(keyword, __location__, name="MAO_EPS_GRAD", &
167 description="Threshold used for MAO iterations. ", &
168 usage="MAO_EPS_GRAD 1.0E-4 ", default_r_val=1.0e-5_dp)
169 CALL section_add_keyword(section, keyword)
170 CALL keyword_release(keyword)
171
172 CALL keyword_create(keyword, __location__, name="MAO_EPS1", &
173 description="Occupation threshold used to determine number of MAOs."// &
174 " KIND section MAO keyword sets the minimum.", &
175 usage="MAO_EPS1 0.001 ", default_r_val=1000.0_dp)
176 CALL section_add_keyword(section, keyword)
177 CALL keyword_release(keyword)
178
179 CALL keyword_create(keyword, __location__, name="MAO_IOLEVEL", &
180 description="Verbosity of MAO output: (0) no output ... (3) fully verbose", &
181 usage="MAO_IOLEVEL 0 ", default_i_val=1)
182 CALL section_add_keyword(section, keyword)
183 CALL keyword_release(keyword)
184
185 CALL keyword_create(keyword, __location__, &
186 name="ELECTRONIC_TEMPERATURE", &
187 variants=s2a("ELEC_TEMP", "FD_TEMP"), &
188 description="Electronic temperature for Harris functional with "// &
189 "Fermi-Dirac smearing.", &
190 repeats=.false., &
191 n_var=1, &
192 type_of_var=real_t, &
193 default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
194 unit_str="K", &
195 usage="ELECTRONIC_TEMPERATURE [K] 300")
196 CALL section_add_keyword(section, keyword)
197 CALL keyword_release(keyword)
198
199 CALL keyword_create(keyword, __location__, name="ALGORITHM", &
200 description="Algorithm used to solve KS equation", &
201 usage="ALGORITHM DIAGONALIZATION", &
202 default_i_val=ec_diagonalization, &
203 enum_c_vals=s2a("DIAGONALIZATION", "MATRIX_SIGN", &
204 "TRS4", "TC2", "OT_DIAG"), &
205 enum_desc=s2a("Diagonalization of KS matrix.", &
206 "Matrix Sign algorithm", &
207 "Trace resetting trs4 algorithm", &
208 "Trace resetting tc2 algorithm", &
209 "OT diagonalization"), &
210 enum_i_vals=[ec_diagonalization, ec_matrix_sign, &
212 CALL section_add_keyword(section, keyword)
213 CALL keyword_release(keyword)
214
215 CALL keyword_create(keyword, __location__, name="FACTORIZATION", &
216 description="Algorithm used to calculate factorization of overlap matrix", &
217 usage="FACTORIZATION CHOLESKY", &
218 default_i_val=kg_cholesky, &
219 enum_c_vals=s2a("CHOLESKY"), &
220 enum_desc=s2a("Cholesky factorization of overlap matrix"), &
221 enum_i_vals=[kg_cholesky])
222 CALL section_add_keyword(section, keyword)
223 CALL keyword_release(keyword)
224
225 CALL keyword_create(keyword, __location__, name="EPS_DEFAULT", &
226 description="Threshold used for accuracy estimates within energy correction. ", &
227 usage="EPS_DEFAULT 1.0E-7 ", default_r_val=1.0e-7_dp)
228 CALL section_add_keyword(section, keyword)
229 CALL keyword_release(keyword)
230
231 ! Keywords for LS solver of Harris functional
232 CALL keyword_create(keyword, __location__, name="EPS_FILTER", &
233 description="Threshold used for filtering matrix operations.", &
234 usage="EPS_FILTER 1.0E-12", default_r_val=1.0e-12_dp)
235 CALL section_add_keyword(section, keyword)
236 CALL keyword_release(keyword)
237
238 CALL keyword_create(keyword, __location__, name="EPS_LANCZOS", &
239 description="Threshold used for lanczos estimates.", &
240 usage="EPS_LANCZOS 1.0E-4", default_r_val=1.0e-3_dp)
241 CALL section_add_keyword(section, keyword)
242 CALL keyword_release(keyword)
243
244 CALL keyword_create(keyword, __location__, name="MAX_ITER_LANCZOS", &
245 description="Maximum number of lanczos iterations.", &
246 usage="MAX_ITER_LANCZOS ", default_i_val=128)
247 CALL section_add_keyword(section, keyword)
248 CALL keyword_release(keyword)
249
250 CALL keyword_create(keyword, __location__, name="MU", &
251 description="Value (or initial guess) for the chemical potential,"// &
252 " i.e. some suitable energy between HOMO and LUMO energy.", &
253 usage="MU 0.0", default_r_val=-0.1_dp)
254 CALL section_add_keyword(section, keyword)
255 CALL keyword_release(keyword)
256
257 CALL keyword_create(keyword, __location__, name="FIXED_MU", &
258 description="Should the calculation be performed at fixed chemical potential,"// &
259 " or should it be found fixing the number of electrons", &
260 usage="FIXED_MU .TRUE.", default_l_val=.false., lone_keyword_l_val=.true.)
261 CALL section_add_keyword(section, keyword)
262 CALL keyword_release(keyword)
263
264 CALL keyword_create(keyword, __location__, name="S_PRECONDITIONER", &
265 description="Preconditions S with some appropriate form.", &
266 usage="S_PRECONDITIONER MOLECULAR", &
267 default_i_val=ls_s_preconditioner_atomic, &
268 enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
269 enum_desc=s2a("No preconditioner", &
270 "Using atomic blocks", &
271 "Using molecular sub-blocks. Recommended if molecules are defined and not too large."), &
273 CALL section_add_keyword(section, keyword)
274 CALL keyword_release(keyword)
275
276 CALL keyword_create(keyword, __location__, name="S_SQRT_METHOD", &
277 description="Method for the caclulation of the sqrt of S.", &
278 usage="S_SQRT_METHOD NEWTONSCHULZ", &
279 default_i_val=ls_s_sqrt_ns, &
280 enum_c_vals=s2a("NEWTONSCHULZ", "PROOT"), &
281 enum_desc=s2a("Using a Newton-Schulz-like iteration", &
282 "Using the p-th root method."), &
283 enum_i_vals=[ls_s_sqrt_ns, ls_s_sqrt_proot])
284 CALL section_add_keyword(section, keyword)
285 CALL keyword_release(keyword)
286
287 CALL keyword_create(keyword, __location__, name="S_SQRT_ORDER", &
288 variants=s2a("SIGN_SQRT_ORDER"), &
289 description="Order of the iteration method for the calculation of the sqrt of S.", &
290 usage="S_SQRT_ORDER 3", default_i_val=3)
291 CALL section_add_keyword(section, keyword)
292 CALL keyword_release(keyword)
293
294 CALL keyword_create(keyword, __location__, name="SIGN_METHOD", &
295 description="Method used for the computation of the sign matrix.", &
296 usage="SIGN_METHOD NEWTONSCHULZ", &
297 default_i_val=ls_scf_sign_ns, &
298 citations=[vandevondele2012, niklasson2003], &
299 enum_c_vals=s2a("NEWTONSCHULZ", "PROOT"), &
300 enum_desc=s2a("Newton-Schulz iteration.", &
301 "p-th order root iteration"), &
302 enum_i_vals=[ls_scf_sign_ns, ls_scf_sign_proot])
303 CALL section_add_keyword(section, keyword)
304 CALL keyword_release(keyword)
305
306 CALL keyword_create(keyword, __location__, name="SIGN_ORDER", &
307 description="Order of the method used for the computation of the sign matrix.", &
308 usage="SIGN_ORDER 2", &
309 default_i_val=2)
310 CALL section_add_keyword(section, keyword)
311 CALL keyword_release(keyword)
312
313 CALL keyword_create(keyword, __location__, name="DYNAMIC_THRESHOLD", &
314 description="Should the threshold for the purification be chosen dynamically", &
315 usage="DYNAMIC_THRESHOLD .TRUE.", default_l_val=.false., lone_keyword_l_val=.true.)
316 CALL section_add_keyword(section, keyword)
317 CALL keyword_release(keyword)
318
319 CALL keyword_create(keyword, __location__, name="NON_MONOTONIC", &
320 description="Should the purification be performed non-monotonically. Relevant for TC2 only.", &
321 usage="NON_MONOTONIC .TRUE.", default_l_val=.true., lone_keyword_l_val=.true.)
322 CALL section_add_keyword(section, keyword)
323 CALL keyword_release(keyword)
324
325 CALL keyword_create( &
326 keyword, __location__, name="MATRIX_CLUSTER_TYPE", &
327 description="Specify how atomic blocks should be clustered in the used matrices, in order to improve flop rate, "// &
328 "and possibly speedup the matrix multiply. Note that the atomic s_preconditioner can not be used. "// &
329 "Furthermore, since screening is on matrix blocks, "// &
330 "slightly more accurate results can be expected with molecular.", &
331 usage="MATRIX_CLUSTER_TYPE MOLECULAR", &
332 default_i_val=ls_cluster_atomic, &
333 enum_c_vals=s2a("ATOMIC", "MOLECULAR"), &
334 enum_desc=s2a("Using atomic blocks", &
335 "Using molecular blocks."), &
337 CALL section_add_keyword(section, keyword)
338 CALL keyword_release(keyword)
339
340 CALL keyword_create(keyword, __location__, name="S_INVERSION", &
341 description="Method used to compute the inverse of S.", &
342 usage="S_INVERSION MOLECULAR", &
343 default_i_val=ls_s_inversion_sign_sqrt, &
344 enum_c_vals=s2a("SIGN_SQRT", "HOTELLING"), &
345 enum_desc=s2a("Using the inverse sqrt as obtained from sign function iterations.", &
346 "Using the Hotellign iteration."), &
348 CALL section_add_keyword(section, keyword)
349 CALL keyword_release(keyword)
350
351 CALL keyword_create(keyword, __location__, name="REPORT_ALL_SPARSITIES", &
352 description="Run the sparsity report at the end of the SCF", &
353 usage="REPORT_ALL_SPARSITIES", default_l_val=.false., lone_keyword_l_val=.true.)
354 CALL section_add_keyword(section, keyword)
355 CALL keyword_release(keyword)
356
357 CALL keyword_create(keyword, __location__, name="CHECK_S_INV", &
358 description="Perform an accuracy check on the inverse/sqrt of the s matrix.", &
359 usage="CHECK_S_INV", default_l_val=.false., lone_keyword_l_val=.true.)
360 CALL section_add_keyword(section, keyword)
361 CALL keyword_release(keyword)
362
363 CALL keyword_create(keyword, __location__, name="OT_INITIAL_GUESS", &
364 description="Initial guess of density matrix used for OT Diagonalization", &
365 usage="OT_INITIAL_GUESS ATOMIC", &
366 default_i_val=ec_ot_atomic, &
367 enum_c_vals=s2a("ATOMIC", "GROUND_STATE"), &
368 enum_desc=s2a("Generate an atomic density using the atomic code", &
369 "Using the ground-state density."), &
370 enum_i_vals=[ec_ot_atomic, ec_ot_gs])
371 CALL section_add_keyword(section, keyword)
372 CALL keyword_release(keyword)
373
374 CALL keyword_create( &
375 keyword, __location__, &
376 name="ADMM", &
377 description="Decide whether to perform ADMM in the exact exchange calc. for DC-DFT. "// &
378 "The ADMM XC correction is governed by the AUXILIARY_DENSITY_MATRIX_METHOD section in &DFT. "// &
379 "In most cases, the Hartree-Fock exchange is not too expensive and there is no need for ADMM, "// &
380 "ADMM can however provide significant speedup and memory savings in case of diffuse basis sets. ", &
381 usage="ADMM", &
382 default_l_val=.false., &
383 lone_keyword_l_val=.true.)
384 CALL section_add_keyword(section, keyword)
385 CALL keyword_release(keyword)
386
387 CALL keyword_create(keyword, __location__, name="EXTERNAL_RESPONSE_FILENAME", &
388 description="Name of the file that contains response information.", &
389 usage="EXTERNAL_RESPONSE_FILENAME <FILENAME>", &
390 default_c_val="TREXIO")
391 CALL section_add_keyword(section, keyword)
392 CALL keyword_release(keyword)
393
394 CALL keyword_create(keyword, __location__, name="EXTERNAL_RESPONSE_ERROR_FILENAME", &
395 description="Name of the file that contains response error information.", &
396 usage="EXTERNAL_RESPONSE_ERROR_FILENAME <FILENAME>", &
397 default_c_val="TREXIO")
398 CALL section_add_keyword(section, keyword)
399 CALL keyword_release(keyword)
400
401 CALL keyword_create(keyword, __location__, name="EXTERNAL_RESULT_FILENAME", &
402 description="Name of the file that contains results from external response calculation.", &
403 usage="EXTERNAL_RESULT_FILENAME <FILENAME>", &
404 default_c_val="CP2K_EXRESP.result")
405 CALL section_add_keyword(section, keyword)
406 CALL keyword_release(keyword)
407
408 CALL keyword_create( &
409 keyword, __location__, &
410 name="ERROR_ESTIMATION", &
411 description="Perform an error estimation for the response forces/stress. "// &
412 "Requires error estimates for the RHS of the response equation from input. ", &
413 usage="ERROR_ESTIMATION", &
414 default_l_val=.false., &
415 lone_keyword_l_val=.true.)
416 CALL section_add_keyword(section, keyword)
417 CALL keyword_release(keyword)
418
419 CALL keyword_create(keyword, __location__, name="ERROR_ESTIMATION_METHOD", &
420 description="Method used for error estimation: F(ull); D(ifferenc); E(xtrapolate).", &
421 usage="ERROR_ESTIMATION_METHOD E", &
422 default_c_val="E")
423 CALL section_add_keyword(section, keyword)
424 CALL keyword_release(keyword)
425
426 CALL keyword_create(keyword, __location__, name="ERROR_CUTOFF", &
427 description="Cutoff value for error estimation.", &
428 usage="ERROR_CUTOFF 1.E-6", &
429 default_r_val=1.e-5_dp)
430 CALL section_add_keyword(section, keyword)
431 CALL keyword_release(keyword)
432
433 CALL keyword_create(keyword, __location__, name="ERROR_SUBSPACE_SIZE", &
434 description="MAX. size of subspace for response vector extrapolation.", &
435 usage="ERROR_SUBSPACE_SIZE 100", &
436 default_i_val=250)
437 CALL section_add_keyword(section, keyword)
438 CALL keyword_release(keyword)
439
440 END SUBROUTINE create_ec_section
441
442! **************************************************************************************************
443!> \brief creates the linear scaling solver section
444!> \param section ...
445!> \author Joost VandeVondele [2010-10], JGH [2019-12]
446! **************************************************************************************************
447 SUBROUTINE create_ec_solver_section(section)
448 TYPE(section_type), POINTER :: section
449
450 TYPE(keyword_type), POINTER :: keyword
451
452 cpassert(.NOT. ASSOCIATED(section))
453 CALL section_create(section, __location__, name="RESPONSE_SOLVER", &
454 description="Specifies the parameters of the linear scaling solver routines", &
455 n_keywords=24, n_subsections=3, repeats=.false., &
456 citations=[vandevondele2012])
457
458 NULLIFY (keyword)
459
460 CALL keyword_create(keyword, __location__, name="EPS", &
461 description="Target accuracy for the convergence of the conjugate gradient.", &
462 usage="EPS 1.e-10", default_r_val=1.e-12_dp)
463 CALL section_add_keyword(section, keyword)
464 CALL keyword_release(keyword)
465
466 CALL keyword_create(keyword, __location__, name="EPS_FILTER", &
467 description="Threshold used for filtering matrix operations.", &
468 usage="EPS_FILTER 1.0E-10", default_r_val=1.0e-10_dp)
469 CALL section_add_keyword(section, keyword)
470 CALL keyword_release(keyword)
471
472 CALL keyword_create(keyword, __location__, name="EPS_LANCZOS", &
473 description="Threshold used for lanczos estimates.", &
474 usage="EPS_LANCZOS 1.0E-4", default_r_val=1.0e-3_dp)
475 CALL section_add_keyword(section, keyword)
476 CALL keyword_release(keyword)
477
478 CALL keyword_create(keyword, __location__, name="MAX_ITER", &
479 description="Maximum number of conjugate gradient iteration "// &
480 "to be performed for one optimization.", &
481 usage="MAX_ITER 200", default_i_val=50)
482 CALL section_add_keyword(section, keyword)
483 CALL keyword_release(keyword)
484
485 CALL keyword_create(keyword, __location__, name="MAX_ITER_LANCZOS", &
486 description="Maximum number of lanczos iterations.", &
487 usage="MAX_ITER_LANCZOS 128", default_i_val=128)
488 CALL section_add_keyword(section, keyword)
489 CALL keyword_release(keyword)
490
491 CALL keyword_create(keyword, __location__, name="METHOD", &
492 description="Algorithm used to solve response equation. "// &
493 "Both solver are conjugate gradient based, but use either a vector (MO-coefficient) "// &
494 "or density matrix formalism in the orthonormal AO-basis to obtain response density", &
495 usage="METHOD SOLVER", &
496 default_i_val=ec_ls_solver, &
497 enum_c_vals=s2a("MO_SOLVER", "AO_ORTHO"), &
498 enum_desc=s2a("Solver based on MO (vector) formalism", &
499 "Solver based on density matrix formalism"), &
500 enum_i_vals=[ec_mo_solver, ec_ls_solver])
501 CALL section_add_keyword(section, keyword)
502 CALL keyword_release(keyword)
503
504 CALL keyword_create( &
505 keyword, __location__, name="PRECONDITIONER", &
506 description="Type of preconditioner to be used with MO conjugate gradient solver. "// &
507 "They differ in effectiveness, cost of construction, cost of application. "// &
508 "Properly preconditioned minimization can be orders of magnitude faster than doing nothing. "// &
509 "Only multi-level conjugate gradient preconditioner (MULTI_LEVEL) available for AO response solver (AO_ORTHO). ", &
510 usage="PRECONDITIONER FULL_ALL", &
511 default_i_val=precond_mlp, &
512 enum_c_vals=s2a("FULL_ALL", "FULL_SINGLE_INVERSE", "FULL_SINGLE", "FULL_KINETIC", "FULL_S_INVERSE", &
513 "MULTI_LEVEL", "NONE"), &
514 enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "// &
515 "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
516 "This preconditioner is recommended for almost all systems, except very large systems where "// &
517 "make_preconditioner would dominate the total computational cost.", &
518 "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
519 "but cheaper to construct, "// &
520 "might be somewhat less robust. Recommended for large systems.", &
521 "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
522 "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
523 "use for very large systems.", &
524 "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
525 "Based on same CG as AO-solver itself, but uses cheaper linear transformation", &
526 "skip preconditioning"), &
529 CALL section_add_keyword(section, keyword)
530 CALL keyword_release(keyword)
531
532 CALL keyword_create(keyword, __location__, name="S_PRECONDITIONER", &
533 description="Preconditions S with some appropriate form.", &
534 usage="S_PRECONDITIONER MOLECULAR", &
535 default_i_val=ls_s_preconditioner_atomic, &
536 enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
537 enum_desc=s2a("No preconditioner", &
538 "Using atomic blocks", &
539 "Using molecular sub-blocks. Recommended if molecules are defined and not too large."), &
541 CALL section_add_keyword(section, keyword)
542 CALL keyword_release(keyword)
543
544 CALL keyword_create(keyword, __location__, name="S_SQRT_METHOD", &
545 description="Method for the caclulation of the sqrt of S.", &
546 usage="S_SQRT_METHOD NEWTONSCHULZ", &
547 default_i_val=ls_s_sqrt_ns, &
548 enum_c_vals=s2a("NEWTONSCHULZ", "PROOT"), &
549 enum_desc=s2a("Using a Newton-Schulz-like iteration", &
550 "Using the p-th root method."), &
551 enum_i_vals=[ls_s_sqrt_ns, ls_s_sqrt_proot])
552 CALL section_add_keyword(section, keyword)
553 CALL keyword_release(keyword)
554
555 CALL keyword_create(keyword, __location__, name="S_SQRT_ORDER", &
556 variants=s2a("SIGN_SQRT_ORDER"), &
557 description="Order of the iteration method for the calculation of the sqrt of S.", &
558 usage="S_SQRT_ORDER 3", default_i_val=3)
559 CALL section_add_keyword(section, keyword)
560 CALL keyword_release(keyword)
561
562 CALL keyword_create( &
563 keyword, __location__, name="MATRIX_CLUSTER_TYPE", &
564 description="Specify how atomic blocks should be clustered in the used matrices, in order to improve flop rate, "// &
565 "and possibly speedup the matrix multiply. Note that the atomic s_preconditioner can not be used. "// &
566 "Furthermore, since screening is on matrix blocks, "// &
567 "slightly more accurate results can be expected with molecular.", &
568 usage="MATRIX_CLUSTER_TYPE MOLECULAR", &
569 default_i_val=ls_cluster_atomic, &
570 enum_c_vals=s2a("ATOMIC", "MOLECULAR"), &
571 enum_desc=s2a("Using atomic blocks", &
572 "Using molecular blocks."), &
574 CALL section_add_keyword(section, keyword)
575 CALL keyword_release(keyword)
576
577 CALL keyword_create(keyword, __location__, name="S_INVERSION", &
578 description="Method used to compute the inverse of S.", &
579 usage="S_INVERSION MOLECULAR", &
580 default_i_val=ls_s_inversion_sign_sqrt, &
581 enum_c_vals=s2a("SIGN_SQRT", "HOTELLING"), &
582 enum_desc=s2a("Using the inverse sqrt as obtained from sign function iterations.", &
583 "Using the Hotellign iteration."), &
585 CALL section_add_keyword(section, keyword)
586 CALL keyword_release(keyword)
587
588 CALL keyword_create(keyword, __location__, name="RESTART", &
589 description="Restart the response calculation if the restart file exists", &
590 usage="RESTART", &
591 default_l_val=.false., lone_keyword_l_val=.true.)
592 CALL section_add_keyword(section, keyword)
593 CALL keyword_release(keyword)
594
595 CALL keyword_create(keyword, __location__, name="RESTART_EVERY", &
596 description="Restart the conjugate gradient after the specified number of iterations.", &
597 usage="RESTART_EVERY 50", default_i_val=50)
598 CALL section_add_keyword(section, keyword)
599 CALL keyword_release(keyword)
600
601 END SUBROUTINE create_ec_solver_section
602
603! **************************************************************************************************
604!> \brief Create the print dft section
605!> \param section the section to create
606!> \author fbelle - from create_print_dft_section
607! **************************************************************************************************
608 SUBROUTINE create_ec_print_section(section)
609 TYPE(section_type), POINTER :: section
610
611 TYPE(keyword_type), POINTER :: keyword
612 TYPE(section_type), POINTER :: print_key
613
614 cpassert(.NOT. ASSOCIATED(section))
615 CALL section_create(section, __location__, name="PRINT", &
616 description="Section of possible print options in EC code.", &
617 n_keywords=0, n_subsections=1, repeats=.false.)
618
619 NULLIFY (print_key, keyword)
620
621 ! Output of BQB volumetric files
622 CALL cp_print_key_section_create(print_key, __location__, name="E_DENSITY_BQB", &
623 description="Controls the output of the electron density to the losslessly"// &
624 " compressed BQB file format, see [Brehm2018]"// &
625 " (via LibBQB see <https://brehm-research.de/bqb>)."// &
626 " Currently does not work with changing cell vector (NpT ensemble).", &
627 print_level=debug_print_level + 1, filename="", &
628 citations=[brehm2018])
629
630 CALL keyword_create(keyword, __location__, name="SKIP_FIRST", &
631 description="Skips the first step of a MD run (avoids duplicate step if restarted).", &
632 usage="SKIP_FIRST T", default_l_val=.false., lone_keyword_l_val=.true.)
633 CALL section_add_keyword(print_key, keyword)
634 CALL keyword_release(keyword)
635
636 CALL keyword_create(keyword, __location__, name="STORE_STEP_NUMBER", &
637 description="Stores the step number and simulation time in the comment line of each BQB"// &
638 " frame. Switch it off for binary compatibility with original CP2k CUBE files.", &
639 usage="STORE_STEP_NUMBER F", default_l_val=.true., lone_keyword_l_val=.true.)
640 CALL section_add_keyword(print_key, keyword)
641 CALL keyword_release(keyword)
642
643 CALL keyword_create(keyword, __location__, name="CHECK", &
644 description="Performs an on-the-fly decompression of each compressed BQB frame to check"// &
645 " whether the volumetric data exactly matches, and aborts the run if not so.", &
646 usage="CHECK T", default_l_val=.false., lone_keyword_l_val=.true.)
647 CALL section_add_keyword(print_key, keyword)
648 CALL keyword_release(keyword)
649
650 CALL keyword_create(keyword, __location__, name="OVERWRITE", &
651 description="Specify this keyword to overwrite the output BQB file if"// &
652 " it already exists. By default, the data is appended to an existing file.", &
653 usage="OVERWRITE T", default_l_val=.false., lone_keyword_l_val=.true.)
654 CALL section_add_keyword(print_key, keyword)
655 CALL keyword_release(keyword)
656
657 CALL keyword_create(keyword, __location__, name="HISTORY", &
658 description="Controls how many previous steps are taken into account for extrapolation in"// &
659 " compression. Use a value of 1 to compress the frames independently.", &
660 usage="HISTORY 10", n_var=1, default_i_val=10, type_of_var=integer_t)
661 CALL section_add_keyword(print_key, keyword)
662 CALL keyword_release(keyword)
663
664 CALL keyword_create(keyword, __location__, name="PARAMETER_KEY", &
665 description="Allows to supply previously optimized compression parameters via a"// &
666 " parameter key (alphanumeric character sequence starting with 'at')."// &
667 " Just leave away the 'at' sign here, because CP2k will otherwise"// &
668 " assume it is a variable name in the input", &
669 usage="PARAMETER_KEY <KEY>", n_var=1, default_c_val="", type_of_var=char_t)
670 CALL section_add_keyword(print_key, keyword)
671 CALL keyword_release(keyword)
672
673 CALL keyword_create(keyword, __location__, name="OPTIMIZE", &
674 description="Controls the time spent to optimize the parameters for compression efficiency.", &
675 usage="OPTIMIZE {OFF,QUICK,NORMAL,PATIENT,EXHAUSTIVE}", repeats=.false., n_var=1, &
676 default_i_val=bqb_opt_quick, &
677 enum_c_vals=s2a("OFF", "QUICK", "NORMAL", "PATIENT", "EXHAUSTIVE"), &
678 enum_desc=s2a("No optimization (use defaults)", "Quick optimization", &
679 "Standard optimization", "Precise optimization", "Exhaustive optimization"), &
681 CALL section_add_keyword(print_key, keyword)
682 CALL keyword_release(keyword)
683
684 CALL section_add_subsection(section, print_key)
685 CALL section_release(print_key)
686
687 ! Voronoi Integration via LibVori
688 NULLIFY (print_key)
689 CALL create_print_voronoi_section(print_key)
690 CALL section_add_subsection(section, print_key)
691 CALL section_release(print_key)
692
693 !Printing of Moments
694 CALL create_dipoles_section(print_key, "MOMENTS", high_print_level)
695 CALL keyword_create( &
696 keyword, __location__, &
697 name="MAX_MOMENT", &
698 description="Maximum moment to be calculated. Values higher than 1 not implemented under periodic boundaries.", &
699 usage="MAX_MOMENT {integer}", &
700 repeats=.false., &
701 n_var=1, &
702 type_of_var=integer_t, &
703 default_i_val=1)
704 CALL section_add_keyword(print_key, keyword)
705 CALL keyword_release(keyword)
706 CALL keyword_create(keyword, __location__, &
707 name="MAGNETIC", &
708 description="Calculate also magnetic moments, only implemented without periodic boundaries", &
709 usage="MAGNETIC yes", &
710 repeats=.false., &
711 n_var=1, &
712 default_l_val=.false., &
713 lone_keyword_l_val=.true.)
714 CALL section_add_keyword(print_key, keyword)
715 CALL keyword_release(keyword)
716 CALL section_add_subsection(section, print_key)
717 CALL section_release(print_key)
718
719 END SUBROUTINE create_ec_print_section
720
721END MODULE input_cp2k_ec
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public vandevondele2012
integer, save, public niklasson2003
integer, save, public brehm2018
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public debug_print_level
integer, parameter, public high_print_level
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:1149
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public ec_functional_harris
integer, parameter, public bqb_opt_quick
integer, parameter, public ec_functional_dc
integer, parameter, public ls_s_preconditioner_molecular
integer, parameter, public precond_mlp
integer, parameter, public ls_s_inversion_hotelling
integer, parameter, public ls_cluster_molecular
integer, parameter, public ec_ot_atomic
integer, parameter, public ls_s_preconditioner_atomic
integer, parameter, public ec_mo_solver
integer, parameter, public bqb_opt_normal
integer, parameter, public ot_precond_full_kinetic
integer, parameter, public bqb_opt_off
integer, parameter, public ec_ot_diag
integer, parameter, public ec_ot_gs
integer, parameter, public bqb_opt_exhaustive
integer, parameter, public ls_s_sqrt_proot
integer, parameter, public ot_precond_full_single
integer, parameter, public ls_s_sqrt_ns
integer, parameter, public ls_s_preconditioner_none
integer, parameter, public ls_scf_sign_proot
integer, parameter, public ot_precond_none
integer, parameter, public ot_precond_full_single_inverse
integer, parameter, public ec_matrix_tc2
integer, parameter, public ec_diagonalization
integer, parameter, public ec_matrix_trs4
integer, parameter, public ec_functional_ext
integer, parameter, public ls_scf_sign_ns
integer, parameter, public ec_matrix_sign
integer, parameter, public ls_s_inversion_sign_sqrt
integer, parameter, public bqb_opt_patient
integer, parameter, public ot_precond_s_inverse
integer, parameter, public kg_cholesky
integer, parameter, public ot_precond_full_all
integer, parameter, public ls_cluster_atomic
integer, parameter, public ec_ls_solver
function that build the dft section of the input
subroutine, public create_ec_section(section)
creates the ENERGY CORRECTION section
function that build the kpoints section of the input
subroutine, public create_kpoints_section(section)
Creates the Kpoints section SECTION: &kpoint... &end SCHEME [None, Gamma, Monkhorst-Pack,...
creates the mm section of the input
subroutine, public create_dipoles_section(print_key, label, print_level)
creates the input section for the qs part
function that build the dft section of the input
subroutine, public create_print_voronoi_section(print_key)
Create the print voronoi section.
function that build the xc section of the input
subroutine, public create_xc_section(section)
creates the input section for the xc part
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
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file