69#include "./base/base_uses.f90"
74 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_scf'
93 cpassert(.NOT.
ASSOCIATED(section))
95 description=
"Parameters needed to perform an SCF run.", &
96 n_keywords=21, n_subsections=8, repeats=.false.)
100 CALL create_ot_section(subsection)
104 CALL create_diagonalization_section(subsection)
108 CALL create_outer_scf_section(subsection)
112 CALL create_smear_section(subsection)
120 CALL create_adiis_section(subsection)
128 CALL create_gce_section(subsection)
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)
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)
150 description=
"Maximum number of inner SCF iterations for one electronic optimization.", &
151 usage=
"MAX_SCF 200", default_i_val=50)
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)
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)
169 variants=[
"LSHIFT"], &
170 description=
"Use level shifting to improve convergence", &
172 usage=
"LEVEL_SHIFT 0.1", &
173 default_r_val=0.0_dp)
178 description=
"Target convergence threshold for the inner SCF cycle.", &
179 usage=
"EPS_SCF 1.e-6", default_r_val=1.e-5_dp)
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)
190 description=
"If the cholesky method should be used for computing "// &
191 "the inverse of S, and in this case calling which Lapack routines", &
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"), &
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)
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)
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)."), &
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)
247 description=
"sets the number of rows in a scalapack block", &
248 usage=
"NROW_BLOCK 31", default_i_val=32)
253 description=
"Sets the number of columns in a scalapack block", &
254 usage=
"NCOL_BLOCK 31", default_i_val=32)
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)
268 name=
"ROKS_SCHEME", &
269 description=
"Selects the ROKS scheme when ROKS is applied.", &
270 usage=
"ROKS_SCHEME HIGH-SPIN", &
273 enum_c_vals=
s2a(
"GENERAL",
"HIGH-SPIN"), &
281 variants=[
"F_ROKS"], &
282 description=
"Allows to define the parameter f for the "// &
283 "general ROKS scheme.", &
284 usage=
"ROKS_F 1/2", &
288 default_r_val=0.5_dp)
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", &
303 default_r_vals=[-0.5_dp, 1.5_dp, 0.5_dp, 0.5_dp, 1.5_dp, -0.5_dp])
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.)
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.)
326 description=
"Printing of information during the SCF.", repeats=.false.)
329 description=
"Controls the dumping of the latest wavefunction restart "// &
330 "file during SCF. The file suffix will be `.wfn` for a Gamma-only "// &
331 "calculation and `.kp` for a k-point sampling calculation by default; "// &
332 "both are unformatted binary files and are not interchangeable for "// &
333 "restarting purposes. The FORCE_EVAL/DFT/WFN_RESTART_FILE_NAME "// &
334 "keyword can be used to read a restart file generated here for "// &
335 "MO information. See also RESTART_HISTORY.", &
337 each_iter_names=
s2a(
"QS_SCF"), each_iter_values=[20], &
343 print_key, __location__,
"RESTART_HISTORY", &
344 description=
"Dumps unique wavefunction restart files during the run, keeping all of them. "// &
345 "For the latest wavefunction restart file, see RESTART, which shares the same file formats.", &
347 each_iter_names=
s2a(
"__ROOT__",
"MD",
"GEO_OPT",
"ROT_OPT",
"NEB",
"METADYNAMICS",
"QS_SCF"), &
348 each_iter_values=[500, 500, 500, 500, 500, 500, 500], &
349 filename=
"RESTART", do_backup=.true.)
354 description=
"Controls the printing of basic iteration information during the SCF.", &
357 description=
"If the printkey is activated switches the printing of timings"// &
358 " to cumulative (over the SCF).", &
359 default_l_val=.false., lone_keyword_l_val=.true.)
366 description=
"Controls the printing of basic information during the SCF.", &
372 description=
"Controls the printing relative to the orthonormality of MOs (CT S C).", &
378 description=
"Prints the min/max eigenvalues of the overlap of the MOs without S (CT C).", &
384 description=
"Controls the printing of detailed energy information.", &
390 description=
"Controls the printing of DIIS information.", &
396 description=
"Controls the printing of total densities.", &
402 description=
"Controls the printing of information on Lanczos refinement iterations.", &
408 print_key, __location__,
"DIAG_SUB_SCF", &
409 description=
"Controls the printing of information on subspace diagonalization internal loop. ", &
415 description=
"Controls the printing of information on Davidson iterations.", &
421 description=
"Controls the printing of information on Filter Matrix method.", &
426 CALL keyword_create(keyword, __location__, name=
"DM_RESTART_WRITE", &
427 description=
"Write the density matrix into a binary file at the end of the SCF.", &
428 usage=
"DM_RESTART_WRITE", default_l_val=.false., lone_keyword_l_val=.true.)
443 SUBROUTINE create_outer_scf_section(section)
449 cpassert(.NOT.
ASSOCIATED(section))
451 description=
"Controls an outer SCF loop, often used to stabilize difficult OT convergence, "// &
452 "constraints, or other variables wrapped around the inner SCF cycle.", &
453 n_keywords=13, n_subsections=1, repeats=.false.)
457 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
458 description=
"Activates the outer SCF loop.", &
459 usage=
"&OUTER_SCF ON", default_l_val=.false., lone_keyword_l_val=.true.)
465 CALL create_cdft_opt_section(subsection)
470 description=
"Specifies which kind of outer SCF should be employed", &
471 usage=
"TYPE DDAPC_CONSTRAINT ", &
473 enum_c_vals=
s2a(
"DDAPC_CONSTRAINT",
"S2_CONSTRAINT", &
474 "BASIS_CENTER_OPT",
"CDFT_CONSTRAINT",
"NONE"), &
475 enum_desc=
s2a(
"Enforce a constraint on the DDAPC, requires the corresponding section", &
476 "Enforce a constraint on the S2, requires the corresponding section", &
477 "Optimize positions of basis functions, if atom types FLOATING_BASIS_CENTER "// &
479 "Enforce a constraint on a generic CDFT weight population. "// &
480 "Requires the corresponding section QS&CDFT"// &
481 " which determines the type of weight used.", &
482 "Do nothing in the outer loop, useful for resetting the inner loop,"), &
489 description=
"Method used to bring the outer loop to a stationary point", &
490 usage=
"OPTIMIZER SD", &
492 enum_c_vals=
s2a(
"SD",
"DIIS",
"NONE",
"BISECT",
"BROYDEN",
"NEWTON",
"SECANT",
"NEWTON_LS"), &
493 enum_desc=
s2a(
"Takes steps in the direction of the gradient, multiplied by step_size", &
494 "Uses a Direct Inversion in the Iterative Subspace method", &
495 "Do nothing, useful only with the none type", &
496 "Bisection of the gradient, useful for difficult one dimensional cases", &
497 "Broyden's method. Variant defined in BROYDEN_TYPE.", &
498 "Newton's method. Only compatible with CDFT constraints.", &
499 "Secant method. Only for one dimensional cases. See Broyden for "// &
500 "multidimensional cases.", &
501 "Newton's method with backtracking line search to find the optimal step size. "// &
502 "Only compatible with CDFT constraints. Starts from the regular Newton solution "// &
503 "and successively reduces the step size until the L2 norm of the CDFT gradient "// &
504 "decreases or MAX_LS steps is reached. Potentially very expensive because "// &
505 "each iteration performs a full SCF calculation."), &
513 CALL keyword_create(keyword, __location__, name=
"BISECT_TRUST_COUNT", &
514 description=
"Maximum number of times the same point will be used in bisection,"// &
515 " a small number guards against the effect of wrongly converged states.", &
516 usage=
"BISECT_TRUST_COUNT 5", default_i_val=10)
521 description=
"The target gradient of the outer SCF variables. "// &
522 "Notice that the EPS_SCF of the inner loop also determines "// &
523 "the value that can be reached in the outer loop, "// &
524 "typically EPS_SCF of the outer loop must be smaller "// &
525 "than or equal to EPS_SCF of the inner loop.", &
526 usage=
"EPS_SCF 1.0E-6 ", default_r_val=1.0e-5_dp)
530 CALL keyword_create(keyword, __location__, name=
"DIIS_BUFFER_LENGTH", &
531 description=
"Maximum number of DIIS vectors used ", &
532 usage=
"DIIS_BUFFER_LENGTH 5", default_i_val=3)
536 CALL keyword_create(keyword, __location__, name=
"EXTRAPOLATION_ORDER", &
537 description=
"Number of past states used in the extrapolation of the variables during e.g. MD", &
538 usage=
"EXTRAPOLATION_ORDER 5", default_i_val=3)
543 description=
"Maximum number of outer SCF loops.", &
544 usage=
"MAX_SCF 20", default_i_val=50)
549 description=
"The initial step_size used in the optimizer (currently steepest descent). "// &
550 "Note that in cases where a sadle point is sought for (constrained DFT),"// &
551 " this can be negative. For Newton and Broyden optimizers, use a value less/higher than "// &
552 "the default 1.0 (in absolute value, the sign is not significant) to active an under/overrelaxed "// &
554 usage=
"STEP_SIZE -1.0", default_r_val=0.5_dp)
558 END SUBROUTINE create_outer_scf_section
567 SUBROUTINE create_ot_section(section, diagonalization)
569 LOGICAL,
INTENT(IN),
OPTIONAL :: diagonalization
571 LOGICAL :: is_diagonalization
574 cpassert(.NOT.
ASSOCIATED(section))
575 is_diagonalization = .false.
576 IF (
PRESENT(diagonalization)) is_diagonalization = diagonalization
577 IF (is_diagonalization)
THEN
579 description=
"Configures OT as the iterative eigensolver selected by "// &
580 "SCF%DIAGONALIZATION%ALGORITHM OT. The solver minimizes the trace of the "// &
581 "requested orbital subspace for a fixed Kohn-Sham matrix. Orbital energies, "// &
582 "occupations, smearing, density construction, and density mixing are handled "// &
583 "afterwards by the parent DIAGONALIZATION SCF path.", &
584 n_keywords=28, n_subsections=0, repeats=.false., &
588 description=
"Sets the various options for the orbital transformation (OT) method. "// &
589 "Default settings already provide an efficient, yet robust method. "// &
590 "Most systems benefit from using the FULL_ALL preconditioner "// &
591 "combined with a small value (0.001) of ENERGY_GAP. "// &
592 "Well-behaved systems might benefit from using a DIIS minimizer. "//
newline//
newline// &
593 "**Advantages:** "// &
594 "It's fast, because no expensive diagonalisation is performed. "// &
595 "If preconditioned correctly, method guaranteed to find minimum. "//
newline//
newline// &
596 "**Disadvantages:** "// &
597 "Sensitive to preconditioning. A good preconditioner can be expensive. "// &
598 "Metallic systems require a sufficiently large virtual orbital space and "// &
599 "the coupled ROTATION and ENERGIES variables.", &
600 n_keywords=28, n_subsections=0, repeats=.false., &
606 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
607 description=
"controls the activation of the ot method", &
609 default_l_val=.false., &
610 lone_keyword_l_val=.true.)
615 description=
"Algorithm to be used for OT", &
616 usage=
"ALGORITHM STRICT", &
618 enum_c_vals=
s2a(
"STRICT",
"IRAC"), &
619 enum_desc=
s2a(
"Strict orthogonality: Taylor or diagonalization based algorithm.", &
620 "Orbital Transformation based Iterative Refinement "// &
621 "of the Approximative Congruence transformation (OT/IR)."), &
628 description=
"The refinement polynomial degree (2, 3 or 4).", &
629 usage=
"IRAC_DEGREE 4", &
635 description=
"Maximum allowed refinement iteration.", &
636 usage=
"MAX_IRAC 5", &
642 description=
"The orthogonality method.", &
643 usage=
"ORTHO_IRAC POLY", &
645 enum_c_vals=
s2a(
"CHOL",
"POLY",
"LWDN"), &
646 enum_desc=
s2a(
"Cholesky.",
"Polynomial.",
"Loewdin."), &
651 CALL keyword_create(keyword, __location__, name=
"EPS_IRAC_FILTER_MATRIX", &
652 description=
"Sets the threshold for filtering the matrices.", &
653 usage=
"EPS_IRAC_FILTER_MATRIX 1.0E-5", &
654 default_r_val=0.0_dp)
659 description=
"Targeted accuracy during the refinement iteration.", &
660 usage=
"EPS_IRAC 1.0E-5", &
661 default_r_val=1.0e-10_dp)
665 CALL keyword_create(keyword, __location__, name=
"EPS_IRAC_QUICK_EXIT", &
666 description=
"Only one extra refinement iteration is "// &
667 "done when the norm is below this value.", &
668 usage=
"EPS_IRAC_QUICK_EXIT 1.0E-2", &
669 default_r_val=1.0e-5_dp)
673 CALL keyword_create(keyword, __location__, name=
"EPS_IRAC_SWITCH", &
674 description=
"The algorithm switches to the polynomial "// &
675 "refinement when the norm is below this value.", &
676 usage=
"EPS_IRAC_SWITCH 1.0E-3", &
677 default_r_val=1.0e-2_dp)
681 CALL keyword_create(keyword, __location__, name=
"ON_THE_FLY_LOC", &
682 description=
"On the fly localization of the molecular orbitals. "// &
683 "Can only be used with OT/IRAC.", &
684 usage=
"ON_THE_FLY_LOC T", &
685 default_l_val=.false.)
690 keyword, __location__, name=
"MINIMIZER", &
691 description=
"Minimizer to be used with the OT method", &
692 usage=
"MINIMIZER DIIS", &
694 enum_c_vals=
s2a(
"SD",
"CG",
"DIIS",
"BROYDEN",
"LBFGS"), &
695 enum_desc=
s2a(
"Steepest descent: not recommended",
"Conjugate Gradients: most reliable, use for difficult systems."// &
696 " The total energy should decrease at every OT CG step if the line search is appropriate.", &
697 "Direct inversion in the iterative subspace: less reliable than CG, but sometimes about 50% faster", &
698 "Broyden mixing approximating the inverse Hessian", &
699 "Limited-memory BFGS in the fixed OT product chart. The selected OT preconditioner is used"// &
700 " as the initial inverse Hessian. The secant history is reset after a tenfold increase in"// &
701 " the raw fixed-chart gradient norm. With OUTER_SCF, an explicit EPS_DIIS can switch later"// &
702 " outer iterations to OT/DIIS. Available with ALGORITHM STRICT or IRAC."), &
708 variants=[
"SAFER_DIIS"], &
709 description=
"Reject DIIS steps if they point away from the"// &
710 " minimum, do SD in that case.", &
711 usage=
"SAFE_DIIS ON", default_l_val=.true.)
716 description=
"Maximum DIIS SCF inner loop cycles. This can be used to extend"// &
717 " SCF cycles after a switch to DIIS (see eps_diis).", &
718 usage=
"MAX_SCF_DIIS 20", &
723 CALL keyword_create(keyword, __location__, name=
"N_HISTORY_VEC", &
724 variants=
s2a(
"NDIIS",
"N_DIIS",
"N_BROYDEN",
"N_LBFGS"), &
725 description=
"Number of history vectors to be used with DIIS, BROYDEN, or LBFGS", &
726 usage=
"N_HISTORY_VEC 7", &
732 keyword, __location__, name=
"LBFGS_CURVATURE_TOL", &
733 description=
"Minimum dimensionless relative curvature accepted for an LBFGS secant pair."// &
734 " Values are restricted to the interval [0,1).", &
735 usage=
"LBFGS_CURVATURE_TOL 1.0E-4", &
736 default_r_val=1.0e-4_dp)
741 keyword, __location__, name=
"LBFGS_DAMPING", &
742 description=
"Regularize weak or negative LBFGS curvature by the smallest shift of the"// &
743 " gradient difference along the step that satisfies LBFGS_CURVATURE_TOL."// &
744 " If disabled, such secant pairs are skipped.", &
745 usage=
"LBFGS_DAMPING ON", &
746 default_l_val=.true., &
747 lone_keyword_l_val=.true.)
752 description=
"Underrelaxation for the broyden mixer", &
753 usage=
"BROYDEN_BETA 0.9", &
754 default_r_val=0.9_dp)
758 CALL keyword_create(keyword, __location__, name=
"BROYDEN_GAMMA", &
759 description=
"Backtracking parameter", &
760 usage=
"BROYDEN_GAMMA 0.5", &
761 default_r_val=0.5_dp)
765 CALL keyword_create(keyword, __location__, name=
"BROYDEN_SIGMA", &
766 description=
"Curvature of energy functional.", &
767 usage=
"BROYDEN_SIGMA 0.25", &
768 default_r_val=0.25_dp)
773 description=
"Dampening of estimated energy curvature.", &
774 usage=
"BROYDEN_ETA 0.7", &
775 default_r_val=0.7_dp)
779 CALL keyword_create(keyword, __location__, name=
"BROYDEN_OMEGA", &
780 description=
"Growth limit of curvature.", &
781 usage=
"BROYDEN_OMEGA 1.1", &
782 default_r_val=1.1_dp)
786 CALL keyword_create(keyword, __location__, name=
"BROYDEN_SIGMA_DECREASE", &
787 description=
"Reduction of curvature on bad approximation.", &
788 usage=
"BROYDEN_SIGMA_DECREASE 0.7", &
789 default_r_val=0.7_dp)
793 CALL keyword_create(keyword, __location__, name=
"BROYDEN_SIGMA_MIN", &
794 description=
"Minimum adaptive curvature.", &
795 usage=
"BROYDEN_SIGMA_MIN 0.05", &
796 default_r_val=0.05_dp)
800 CALL keyword_create(keyword, __location__, name=
"BROYDEN_FORGET_HISTORY", &
801 description=
"Forget history on bad approximation", &
802 usage=
"BROYDEN_FORGET_HISTORY OFF", default_l_val=.false., &
803 lone_keyword_l_val=.true.)
807 CALL keyword_create(keyword, __location__, name=
"BROYDEN_ADAPTIVE_SIGMA", &
808 description=
"Enable adaptive curvature estimation", &
809 usage=
"BROYDEN_ADAPTIVE_SIGMA ON", default_l_val=.true., &
810 lone_keyword_l_val=.true.)
814 CALL keyword_create(keyword, __location__, name=
"BROYDEN_ENABLE_FLIP", &
815 description=
"Ensure positive definite update", &
816 usage=
"BROYDEN_ENABLE_FLIP ON", default_l_val=.true., &
817 lone_keyword_l_val=.true.)
822 variants=[
"LINE_SEARCH"], &
823 description=
"1D line search algorithm to be used with the OT minimizer,"// &
824 " in increasing order of robustness and cost. MINIMIZER CG combined with"// &
825 " LINESEARCH GOLD should always find an electronic minimum."// &
826 " Whereas the 2PNT minimizer is almost always OK, 3PNT might be needed for systems"// &
827 " in which successive OT CG steps do not decrease the total energy.", &
828 usage=
"LINESEARCH GOLD", &
830 enum_c_vals=
s2a(
"ADAPT",
"NONE",
"2PNT",
"3PNT",
"GOLD"), &
831 enum_desc=
s2a(
"extrapolates usually based on 3 points, "// &
832 "uses additional points on demand, very robust.", &
833 "always take steps of fixed length", &
834 "extrapolate based on 2 points", &
835 "extrapolate based on 3 points", &
836 "perform 1D golden section search of the minimum (very expensive)"), &
842 keyword, __location__, name=
"STEPSIZE", &
843 description=
"Initial stepsize used for the line search, sometimes this parameter can be reduced to stabilize DIIS"// &
844 " or to improve the CG behavior in the first few steps."// &
845 " The optimal value depends on the quality of the preconditioner."// &
846 " A negative values leaves the choice to CP2K depending on the preconditioner.", &
847 usage=
"STEPSIZE 0.4", &
848 default_r_val=-1.0_dp)
853 description=
"Target relative uncertainty in the location of the minimum for LINESEARCH GOLD", &
854 usage=
"GOLD_TARGET 0.1", &
855 default_r_val=0.01_dp)
860 keyword, __location__, name=
"PRECONDITIONER", &
861 description=
"Type of preconditioner to be used with all minimization schemes. "// &
862 "They differ in effectiveness, cost of construction, cost of application. "// &
863 "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.", &
864 usage=
"PRECONDITIONER FULL_ALL", &
866 enum_c_vals=
s2a(
"FULL_ALL",
"FERMI_LOW_RANK",
"FULL_ALL_COVARIANT", &
867 "FULL_SINGLE_INVERSE",
"FULL_SINGLE", &
868 "FULL_KINETIC",
"FULL_S_INVERSE",
"NONE"), &
869 enum_desc=
s2a(
"Most effective state selective preconditioner based on diagonalization, "// &
870 "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "// &
871 "This preconditioner is recommended for almost all systems, except very large systems where "// &
872 "make_preconditioner would dominate the total computational cost.", &
873 "Experimental rotationally covariant bounded spectral preconditioner. It applies an "// &
874 "overlap-inverse base plus a configurable number of complementary-state corrections relative to a "// &
875 "common occupied reference level. Construction currently retains a full diagonalization. "// &
876 "Application can be cheaper when the complementary space is larger than the retained rank.", &
877 "Experimental rotation-covariant form of FULL_ALL. It diagonalizes a private copy of the "// &
878 "occupied projected Hamiltonian, applies the complete state-selective Sylvester spectrum "// &
879 "in that canonical copy, and rotates every input and output consistently without changing "// &
880 "the physical orbitals. Complex K-point ROKS canonicalization is restricted to orbital "// &
881 "subspaces with equal alpha/beta occupation signatures. Real Gamma-point use still "// &
882 "requires uniform occupations and excludes ROKS.", &
883 "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
884 "but cheaper to construct, "// &
885 "might be somewhat less robust. Recommended for large systems.", &
886 "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ", &
887 "Cholesky inversion of S and T, fast construction, robust, and relatively good, "// &
888 "use for very large systems.", &
889 "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.", &
890 "skip preconditioning"), &
899 keyword, __location__, name=
"FERMI_LOW_RANK_BASE", &
900 description=
"Base operator used only with PRECONDITIONER FERMI_LOW_RANK. OVERLAP_INVERSE "// &
901 "applies the exact dense inverse overlap. LATTICE_FFT projects the overlap onto translations "// &
902 "of an explicitly replicated SUBSYS multiple unit cell, inverts its small reciprocal-space "// &
903 "blocks, and applies the approximate inverse with lattice FFTs. This choice implies "// &
904 "LATTICE_FFT ON; use the general LATTICE_FFT keyword for AUTO selection. The experimental "// &
905 "FFT path is restricted to real Gamma-point OT calculations.", &
906 usage=
"FERMI_LOW_RANK_BASE LATTICE_FFT", &
908 enum_c_vals=
s2a(
"OVERLAP_INVERSE",
"LATTICE_FFT"), &
909 enum_desc=
s2a(
"Exact dense inverse-overlap base", &
910 "Approximate block-circulant inverse applied by lattice FFT"), &
916 keyword, __location__, name=
"FERMI_LOW_RANK_MAX_RANK", &
917 description=
"Maximum number of complementary eigenstates retained by PRECONDITIONER FERMI_LOW_RANK. "// &
918 "Larger values approach the complete common-reference spectral operator at higher application cost. "// &
919 "A value of -1 retains the entire complementary space. A finite cap never splits a numerically "// &
920 "degenerate boundary manifold.", &
921 usage=
"FERMI_LOW_RANK_MAX_RANK 64", &
927 keyword, __location__, name=
"LATTICE_FFT", &
928 description=
"Apply the inverse of a block-circulant projection of the selected OT "// &
929 "preconditioner with FFTs over explicitly replicated cells. Supported by FULL_S_INVERSE, "// &
930 "FULL_KINETIC, FULL_SINGLE_INVERSE, FULL_ALL_COVARIANT, and FERMI_LOW_RANK in real "// &
931 "Gamma-point calculations. FULL_ALL_COVARIANT projects and inverts one gap-floored "// &
932 "state-dependent Hessian operator per canonical occupied state. "// &
933 "ON requires the projected reciprocal-space blocks to be positive definite. AUTO uses the "// &
934 "FFT operator only for at least eight replicated cells and a relative projection error no "// &
935 "larger than 1.0E-3. It also requires an estimated application-work ratio no larger than "// &
936 "0.8 and limits reciprocal-block storage to four times one dense real operator; otherwise "// &
937 "it retains the conventional solver. The estimates include reference-cell block size, "// &
938 "occupied-column batch size, state-operator count, and message-passing ranks. Construction "// &
939 "of state-independent operators accumulates only the projected reference-cell blocks across "// &
940 "ranks. FULL_ALL_COVARIANT and explicit local corrections still require dense construction "// &
941 "data. Application routes complete orbital columns across ranks and distributes the FFT "// &
942 "batches over those columns.", &
943 usage=
"LATTICE_FFT AUTO", &
945 enum_c_vals=
s2a(
"OFF",
"ON",
"AUTO"), &
946 enum_desc=
s2a(
"Use the conventional OT preconditioner solver", &
947 "Always use the approximate lattice-FFT inverse", &
948 "Use the lattice-FFT inverse only when conservative selection criteria pass"), &
954 keyword, __location__, name=
"LATTICE_FFT_LOCAL_CELLS", &
955 description=
"Number of replicated cell blocks retained in an optional balanced local"// &
956 " correction to LATTICE_FFT ON. Cells are selected from the largest block-row"// &
957 " contributions to the non-circulant residual. The two-level correction is symmetric"// &
958 " positive definite and exactly inverts the selected coordinate subspace. A value of"// &
959 " zero disables the correction. The correction is deliberately unavailable with AUTO,"// &
960 " which continues to reject defective or otherwise non-circulant operators.", &
961 usage=
"LATTICE_FFT_LOCAL_CELLS 1", &
967 description=
"If FULL_ALL the cholesky decomposition of the S matrix is used. "// &
968 "Options on the algorithm to be used.", &
970 enum_c_vals=
s2a(
"OFF",
"REDUCE",
"RESTORE",
"INVERSE",
"INVERSE_DBCSR"), &
971 enum_desc=
s2a(
"The cholesky algorithm is not used",
"Reduce is called", &
972 "Reduce is replaced by two restore", &
973 "Restore uses operator multiply by inverse of the triangular matrix", &
974 "Like inverse, but matrix stored as dbcsr, sparce matrix algebra used when possible"), &
980 keyword, __location__, name=
"PRECOND_SOLVER", &
981 description=
"How the preconditioner is applied to the residual.", &
982 usage=
"PRECOND_SOLVER DIRECT", &
984 enum_c_vals=
s2a(
"DEFAULT",
"DIRECT",
"INVERSE_CHOLESKY",
"INVERSE_UPDATE",
"CHEBYSHEV"), &
985 enum_desc=
s2a(
"the default",
"Cholesky decomposition followed by triangular solve "// &
986 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
987 "Cholesky decomposition followed by explicit inversion "// &
988 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
989 "Performs a Hotelling update of the inverse if a previous preconditioner is present. "// &
990 "Mainly useful for GPU accelerated systems (works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
991 "Applies a bounded Chebyshev approximation to the inverse using matrix products only "// &
992 "(currently requires FULL_KINETIC)."), &
1002 keyword, __location__, name=
"CHEBYSHEV_DEGREE", &
1003 description=
"Polynomial degree of the positive Chebyshev semi-iterative inverse used by "// &
1004 "PRECOND_SOLVER CHEBYSHEV.", &
1005 usage=
"CHEBYSHEV_DEGREE 8", &
1011 keyword, __location__, name=
"ENERGY_GAP", &
1012 description=
"Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
1013 "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
1014 "of the gap (can be a small number, e.g. 0.002)."// &
1015 " FULL_SINGLE_INVERSE takes it as lower bound (values below 0.05 can cause stability issues)."// &
1016 " In general, higher values will tame the preconditioner in case of poor initial guesses."// &
1017 " A negative value will leave the choice to CP2K depending on type of preconditioner.", &
1018 usage=
"ENERGY_GAP 0.001", &
1019 default_r_val=-1.0_dp)
1024 keyword, __location__, name=
"EPS_TAYLOR", &
1025 variants=[
"EPSTAYLOR"], &
1026 description=
"Target accuracy of the taylor expansion for the matrix functions, should normally be kept as is.", &
1027 usage=
"EPS_TAYLOR 1.0E-15", &
1028 default_r_val=1.0e-16_dp)
1033 keyword, __location__, name=
"MAX_TAYLOR", &
1034 description=
"Maximum order of the Taylor expansion before diagonalisation is preferred, for large parallel runs"// &
1035 " a slightly higher order could sometimes result in a small speedup.", &
1036 usage=
"MAX_TAYLOR 5", &
1042 description=
"Introduce additional variables so that rotations of the occupied"// &
1043 " subspace are allowed as well, only needed for cases where the energy is not invariant under"// &
1044 " a rotation of the occupied subspace such as non-singlet restricted calculations"// &
1045 " or fractional occupations. This variable is not used by DIAGONALIZATION%OT, "// &
1046 "which canonicalizes the converged eigenspace explicitly.", &
1047 usage=
"ROTATION", lone_keyword_l_val=.true., &
1048 default_l_val=.false.)
1053 description=
"Optimize auxiliary orbital energies for Mermin smearing in direct SCF%OT "// &
1054 "(requires ROTATION and smearing to be active). DIAGONALIZATION%OT obtains "// &
1055 "orbital energies by canonicalizing its converged eigenspace instead.", &
1056 usage=
"ENERGIES", lone_keyword_l_val=.true., &
1057 default_l_val=.false.)
1061 CALL keyword_create(keyword, __location__, name=
"OCCUPATION_PRECONDITIONER", &
1062 description=
"Augment the direct SCF%OT orbital metric with coupled fixed-N "// &
1063 "occupation response. This augments the independently selected orbital "// &
1064 "preconditioner. It is not used by DIAGONALIZATION%OT, where occupations are "// &
1065 "assigned after the eigensolver has converged.", &
1066 usage=
"OCCUPATION_PRECONDITIONER", lone_keyword_l_val=.true., &
1067 default_l_val=.false.)
1071 CALL keyword_create(keyword, __location__, name=
"NONDIAG_ENERGY", &
1072 description=
"Add a non-diagonal auxiliary-energy penalty in direct SCF%OT. "// &
1073 "It is not used by DIAGONALIZATION%OT.", &
1074 usage=
"NONDIAG_ENERGY", lone_keyword_l_val=.true., &
1075 default_l_val=.false.)
1079 CALL keyword_create(keyword, __location__, name=
"NONDIAG_ENERGY_STRENGTH", &
1080 description=
"The prefactor for the non-diagonal energy penalty (FD smearing)", &
1081 usage=
"NONDIAG_ENERGY_STRENGTH", default_r_val=1.0_dp)
1085 END SUBROUTINE create_ot_section
1091 SUBROUTINE create_adiis_section(section)
1096 cpassert(.NOT.
ASSOCIATED(section))
1098 description=
"Parameters for the ADIIS SCF update method.", &
1099 n_keywords=3, n_subsections=0, repeats=.false.)
1103 description=
"Maximum number of paired density/Fock states retained by ADIIS. "// &
1104 "Histories up to 12 use exact active-face enumeration; larger histories use "// &
1105 "deterministic pairwise simplex minimization.", &
1106 usage=
"MAX_HISTORY 7", default_i_val=16)
1110 CALL keyword_create(keyword, __location__, name=
"ADAPTIVE_LEVEL_SHIFT", &
1111 description=
"Initial occupied-space level shift for experimental ADIIS candidate stabilization. "// &
1112 "Positive values enable adaptation using the energy and gradient of successive "// &
1113 "SCF states, without additional KS builds. Zero disables the shift. "// &
1114 "The shift fades out during CDIIS handover and is omitted in raw-map checks. "// &
1115 "Requires MAX_HISTORY >= 2 and cannot be combined with SCF%LEVEL_SHIFT.", &
1116 unit_str=
"au_e", usage=
"ADAPTIVE_LEVEL_SHIFT 1.0", default_r_val=0.0_dp)
1121 description=
"Print per-iteration ADIIS and candidate shift diagnostic metrics.", &
1122 usage=
"VERBOSE", lone_keyword_l_val=.true., default_l_val=.false.)
1126 END SUBROUTINE create_adiis_section
1134 SUBROUTINE create_diagonalization_section(section)
1140 cpassert(.NOT.
ASSOCIATED(section))
1141 CALL section_create(section, __location__, name=
"DIAGONALIZATION", &
1142 description=
"Set up type and parameters for Kohn-Sham matrix diagonalization.", &
1143 n_keywords=0, n_subsections=1, repeats=.false.)
1147 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
1148 description=
"controls the activation of the diagonalization method", &
1149 usage=
"&DIAGONALIZATION T", &
1150 default_l_val=.false., &
1151 lone_keyword_l_val=.true.)
1155 CALL keyword_create(keyword, __location__, name=
"UPDATE_METHOD", &
1156 description=
"Selects the SCF update method used with diagonalization. MIXING uses "// &
1157 "the existing density-mixing and DIIS workflow; ADIIS uses augmented-DIIS "// &
1158 "Fock-space interpolation and accepts the diagonalized density directly.", &
1160 enum_c_vals=
s2a(
"MIXING",
"ADIIS"), &
1161 enum_desc=
s2a(
"Use the existing density-mixing SCF workflow", &
1162 "Use augmented-DIIS Fock-space interpolation"), &
1169 description=
"Algorithm to be used for diagonalization", &
1170 usage=
"ALGORITHM STANDARD", &
1172 enum_c_vals=
s2a(
"STANDARD",
"OT",
"LANCZOS",
"DAVIDSON",
"FILTER_MATRIX"), &
1173 enum_desc=
s2a(
"AO-basis Kohn-Sham diagonalization using LAPACK-compatible methods"// &
1174 " or a late-SCF Jacobi sweep.", &
1175 "Iterative diagonalization using OT method", &
1176 "Block Krylov-space approach to self-consistent diagonalisation", &
1177 "Preconditioned blocked Davidson", &
1178 "Filter matrix diagonalization"), &
1184 CALL keyword_create(keyword, __location__, name=
"JACOBI_THRESHOLD", &
1185 description=
"Controls the accuracy of the pseudo-diagonalization method using Jacobi rotations", &
1186 usage=
"JACOBI_THRESHOLD 1.0E-6", &
1187 default_r_val=1.0e-7_dp, &
1193 description=
"Below this threshold value for the SCF convergence the pseudo-diagonalization "// &
1194 "method using Jacobi rotations is activated. This method is much faster than a "// &
1195 "real diagonalization and it is even speeding up while achieving full convergence. "// &
1196 "However, it needs a pre-converged wavefunction obtained by at least one real "// &
1197 "diagonalization which is further optimized while keeping the original eigenvalue "// &
1198 "spectrum. The MO eigenvalues are NOT updated. The method might be useful to speed "// &
1199 "up calculations for large systems e.g. using a semi-empirical method.", &
1200 usage=
"EPS_JACOBI 1.0E-5", &
1201 default_r_val=0.0_dp, &
1207 description=
"Tolerance of the iterative diagonalization relative to the current SCF convergence. "// &
1208 "A positive value makes the inner tolerance the looser of EPS_ITER and this factor "// &
1209 "times the SCF error: loose while the density is far from self-consistency, "// &
1210 "tightening as the SCF converges. The value 0 disables the tracking.", &
1211 usage=
"EPS_ADAPT 0.01", &
1212 default_r_val=0._dp)
1217 description=
"Maximum number of iterations in iterative diagonalization", &
1218 usage=
"MAX_ITER 20", &
1224 description=
"Required accuracy in iterative diagonalization", &
1225 usage=
"EPS_ITER 1.e-8", &
1226 default_r_val=1.e-8_dp)
1230 NULLIFY (subsection)
1231 CALL create_ot_section(subsection, diagonalization=.true.)
1235 NULLIFY (subsection)
1236 CALL create_krylov_section(subsection)
1240 NULLIFY (subsection)
1241 CALL create_diag_subspace_section(subsection)
1245 NULLIFY (subsection)
1246 CALL create_davidson_section(subsection)
1250 NULLIFY (subsection)
1255 END SUBROUTINE create_diagonalization_section
1261 SUBROUTINE create_davidson_section(section)
1266 cpassert(.NOT.
ASSOCIATED(section))
1268 description=
"Settings of the blocked Davidson iterative diagonalization. "// &
1269 "Also available at symmetry-reduced complex k points.", &
1270 n_keywords=2, n_subsections=0, repeats=.false., &
1276 keyword, __location__, name=
"PRECONDITIONER", &
1277 description=
"Type of preconditioner to be used with all minimization schemes. "// &
1278 "With k points, all preconditioners except NONE use the complex "// &
1279 "k-point preconditioners.", &
1280 usage=
"PRECONDITIONER FULL_ALL", &
1282 enum_c_vals=
s2a(
"FULL_ALL",
"FULL_SINGLE_INVERSE",
"FULL_KINETIC",
"FULL_S_INVERSE",
"NONE"), &
1283 enum_desc=
s2a(
"Most effective state selective preconditioner based on diagonalization ", &
1284 "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "// &
1285 "but cheaper to construct, might be somewhat less robust. Recommended for large systems.", &
1286 "Preconditioner based on the kinetic energy matrix", &
1287 "Preconditioner based on the overlap matrix", &
1288 "skip preconditioning"), &
1295 CALL keyword_create(keyword, __location__, name=
"PRECOND_SOLVER", &
1296 description=
"How the preconditioner is applied to the residual.", &
1297 usage=
"PRECOND_SOLVER DIRECT", &
1299 enum_c_vals=
s2a(
"DEFAULT",
"DIRECT",
"INVERSE_CHOLESKY"), &
1300 enum_desc=
s2a(
"the default",
"Cholesky decomposition followed by triangular solve "// &
1301 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)", &
1302 "Cholesky decomposition followed by explicit inversion "// &
1303 "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"), &
1311 keyword, __location__, name=
"ENERGY_GAP", &
1312 description=
"Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "// &
1313 "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "// &
1314 "of the gap (0.001 doing normally fine). For the other preconditioners, making this value larger (0.2)"// &
1315 " will tame the preconditioner in case of poor initial guesses.", &
1316 usage=
"ENERGY_GAP 0.001", &
1317 default_r_val=0.2_dp)
1321 CALL keyword_create(keyword, __location__, name=
"NEW_PREC_EACH", &
1322 description=
"Number of SCF iterations after which a new Preconditioner is computed", &
1323 usage=
"NEW_PREC_EACH 10", default_i_val=20)
1328 description=
"First SCF iteration at which a Preconditioner is employed. "// &
1329 "With k points the first build waits until after the cold start, whatever lower value is set. "// &
1330 "The preconditioner makers read the MO coefficients, and only the cold start fills them.", &
1331 usage=
"FIRST_PREC 1", default_i_val=1)
1335 CALL keyword_create(keyword, __location__, name=
"CONV_MOS_PERCENT", &
1336 description=
"Minimal percent of MOS that have to converge within the Davidson loop"// &
1337 " before the SCF iteration is completed and a new Hamiltonian is computed", &
1338 usage=
"CONV_MOS_PERCENT 0.8", default_r_val=0.5_dp)
1343 description=
"Divisor that maps the SCF mixing error onto the adaptive Davidson tolerance. "// &
1344 "The inner tolerance tracks EPS_ADAPT times the mixing error divided by this value. "// &
1345 "The value approximates how much the per-column residuals amplify the density mixing error. "// &
1346 "A measured amplification on a smeared slab is 20. Increase the value for looser tracking. "// &
1347 "Only used with EPS_ADAPT.", &
1348 usage=
"NOISE_SCALE 100", default_r_val=100.0_dp)
1353 description=
"Use MOS as sparse matrix and avoid as much as possible multiplications with full matrices. "// &
1354 "Not used with k points.", &
1355 usage=
"SPARSE_MOS", default_l_val=.true., &
1356 lone_keyword_l_val=.true.)
1360 END SUBROUTINE create_davidson_section
1366 SUBROUTINE create_krylov_section(section)
1371 cpassert(.NOT.
ASSOCIATED(section))
1374 n_keywords=2, n_subsections=0, repeats=.false.)
1379 description=
"Dimension of the Krylov space used for the Lanczos refinement", &
1380 usage=
"NKRYLOV 20", &
1386 description=
"Size of the block of vectors refined simultaneously by the Lanczos procedure", &
1393 description=
"Convergence criterion for the MOs", &
1394 usage=
"EPS_KRYLOV 0.00001", &
1395 default_r_val=0.0000001_dp)
1399 CALL keyword_create(keyword, __location__, name=
"EPS_STD_DIAG", &
1400 description=
"Level of convergence to be reached before starting the Lanczos procedure."// &
1401 " Above this threshold a standard diagonalization method is used."// &
1402 " If negative Lanczos is started at the first iteration", &
1403 usage=
"EPS_STD_DIAG 0.001", &
1404 default_r_val=-1.0_dp)
1408 CALL keyword_create(keyword, __location__, name=
"CHECK_MOS_CONV", &
1409 description=
"This requires to check the convergence of MOS also when standard "// &
1410 "diagonalization steps are performed, if the block krylov approach is active.", &
1411 usage=
"CHECK_MOS_CONV T", &
1412 default_l_val=.false., &
1413 lone_keyword_l_val=.true.)
1417 END SUBROUTINE create_krylov_section
1423 SUBROUTINE create_diag_subspace_section(section)
1429 cpassert(.NOT.
ASSOCIATED(section))
1430 CALL section_create(section, __location__, name=
"DIAG_SUB_SCF", &
1431 description=
"Activation of self-consistenf subspace refinement by diagonalization "// &
1432 "of H by adjusting the occupation but keeping the MOS unchanged.", &
1433 n_keywords=2, n_subsections=1, repeats=.false.)
1435 NULLIFY (keyword, subsection)
1437 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
1438 description=
"controls the activation of inner SCF loop to refine occupations in MOS subspace", &
1439 usage=
"&DIAG_SUB_SCF T", &
1440 default_l_val=.false., &
1441 lone_keyword_l_val=.true.)
1446 description=
"Maximum number of iterations for the SCF inner loop", &
1447 usage=
"MAX_ITER 20", &
1453 description=
"Required energy accuracy for convergence of subspace diagonalization", &
1454 usage=
"EPS_ENE 1.e-8", &
1455 default_r_val=1.e-4_dp)
1459 CALL keyword_create(keyword, __location__, name=
"EPS_ADAPT_SCF", &
1460 description=
"Required density matrix accuracy as compared to current SCF convergence", &
1461 usage=
"EPS_ADAPT_SCF 1.e-1", &
1462 default_r_val=1._dp)
1467 keyword, __location__, name=
"EPS_SKIP_SUB_DIAG", &
1468 description=
"Level of convergence to be reached before starting the internal loop of subspace rotations."// &
1469 " Above this threshold only the outer diagonalization method is used."// &
1470 " If negative the subspace rotation is started at the first iteration", &
1471 usage=
"EPS_SKIP_SUB_DIAG 0.001", &
1472 default_r_val=-1.0_dp)
1479 END SUBROUTINE create_diag_subspace_section
1488 SUBROUTINE create_smear_section(section)
1494 cpassert(.NOT.
ASSOCIATED(section))
1498 description=
"Controls smearing of MO occupation numbers for systems with small or zero gaps.", &
1506 name=
"_SECTION_PARAMETERS_", &
1507 description=
"Controls the activation of smearing", &
1508 usage=
"&SMEAR ON", &
1509 default_l_val=.false., &
1510 lone_keyword_l_val=.true.)
1516 description=
"Selects the smearing method to apply.", &
1517 usage=
"METHOD Fermi_Dirac", &
1519 enum_c_vals=
s2a(
"FERMI_DIRAC",
"ENERGY_WINDOW",
"LIST",
"GAUSSIAN", &
1520 "METHFESSEL_PAXTON",
"MARZARI_VANDERBILT"), &
1523 enum_desc=
s2a(
"Fermi-Dirac distribution defined by the keyword ELECTRONIC_TEMPERATURE. "// &
1524 "Use this method if the temperature equivalence is important for you, "// &
1525 "e.g. if you want to compute some properties based on the occupations. "// &
1526 "If you use this method without interest in electronic temperature, "// &
1527 "it's suggested to use extrapolated result from finite ELECTRONIC_TEMPERATURE "// &
1528 "to ELECTRONIC_TEMPERATURE = 0. Note the forces and stress are consistent "// &
1529 "with the free energy and not with the extrapolated energy.", &
1530 "Energy window defined by the keyword WINDOW_SIZE.", &
1531 "Use a fixed list of occupations.", &
1532 "Gaussian broadening with width SIGMA; should work well in most cases. "// &
1533 "With this method you have to use extrapolated results from finite "// &
1534 "SIGMA results to SIGMA = 0, but usually this value would not be quite "// &
1535 "accurate without systematically reducing SIGMA. Note the forces and stress "// &
1536 "are consistent with the free energy and not with the extrapolated energy.", &
1537 "First-order Methfessel-Paxton distribution with width SIGMA. Don't "// &
1538 "use it for semiconductors and insulators because the partial "// &
1539 "occupancies can be unphysical and thus lead to wrong results.", &
1540 "Marzari-Vanderbilt cold smearing with width SIGMA."))
1546 description=
"A list of fractional occupations to use. Must match the number of states "// &
1547 "and sum up to the correct number of electrons", &
1551 usage=
"LIST 2.0 0.6666 0.6666 0.66666 0.0 0.0")
1556 name=
"ELECTRONIC_TEMPERATURE", &
1557 variants=
s2a(
"ELEC_TEMP",
"TELEC"), &
1558 description=
"Electronic temperature used for Fermi-Dirac smearing.", &
1564 usage=
"ELECTRONIC_TEMPERATURE [K] 300")
1569 name=
"EPS_FERMI_DIRAC", &
1570 description=
"Accuracy checks on occupation numbers use this as a tolerance", &
1574 default_r_val=1.0e-10_dp, &
1575 usage=
"EPS_FERMI_DIRAC 1.0E-6")
1581 description=
"Smearing width sigma (in energy units) in the case of "// &
1582 "Gaussian, Methfessel-Paxton or Marzari-Vanderbilt smearing.", &
1586 default_r_val=0.002_dp, &
1588 usage=
"SIGMA [eV] 0.2")
1593 name=
"WINDOW_SIZE", &
1594 description=
"Size of the energy window centred at the Fermi level", &
1598 default_r_val=0.0_dp, &
1600 usage=
"WINDOW_SIZE [eV] 0.3")
1604 CALL keyword_create(keyword, __location__, name=
"FIXED_MAGNETIC_MOMENT", &
1605 description=
"Imposed difference between the numbers of electrons of spin up "// &
1606 "and spin down: m = n(up) - n(down). A negative value (default) allows "// &
1607 "for a change of the magnetic moment. -1 specifically keeps an integer "// &
1608 "number of spin up and spin down electrons.", &
1612 default_r_val=-100.0_dp, &
1613 usage=
"FIXED_MAGNETIC_MOMENT 1.5")
1617 END SUBROUTINE create_smear_section
1627 TYPE(
section_type),
POINTER :: group_section, print_key, subsection
1629 NULLIFY (keyword, subsection, group_section, print_key)
1631 cpassert(.NOT.
ASSOCIATED(section))
1633 description=
"Parameters needed to set up a constrained DFT calculation."// &
1634 " Each repetition of the ATOM_GROUP section defines a new constraint."// &
1635 " The constraint(s) is (are) converged in a separate external SCF loop with settings"// &
1636 " read from the OUTER_SCF section. Supported constraints: Becke and Gaussian"// &
1637 " Hirshfeld (partial).", n_keywords=8, n_subsections=2, &
1640 NULLIFY (subsection, keyword)
1641 CALL create_outer_scf_section(subsection)
1645 CALL create_becke_constraint_section(subsection)
1649 CALL create_hirshfeld_constraint_section(subsection)
1653 CALL keyword_create(keyword, __location__, name=
"TYPE_OF_CONSTRAINT", &
1654 description=
"Specifies the type of constraint used.", &
1655 usage=
"TYPE_OF_CONSTRAINT (NONE|HIRSHFELD|BECKE)", &
1656 enum_c_vals=
s2a(
"NONE",
"HIRSHFELD",
"BECKE"), &
1659 enum_desc=
s2a(
"No constraint (disables section).", &
1660 "Gaussian Hirshfeld constraint. Partial implementation: no forces. "// &
1661 "Requires corresponding section. Not as extensively tested.", &
1662 "Becke constraint. Requires corresponding section."), &
1669 description=
"Constraint force constants (Lagrange multipliers). "// &
1670 "Give one value per constraint group.", &
1671 type_of_var=
real_t, n_var=-1, &
1672 default_r_val=0.0_dp)
1677 description=
"Constraint target values. Give one value per constraint group. "// &
1678 "The target value is the desired number of valence electrons, spin moment, or the number of "// &
1679 "alpha or beta electrons on the atoms that define the constraint, suitably multiplied by "// &
1680 "atomic coefficients in case a relative constraint between two sets of atoms is employed. "// &
1681 "Note that core charges are not subtracted from the target value.", &
1682 usage=
"TARGET {real}", repeats=.false., &
1683 type_of_var=
real_t, n_var=-1, &
1684 default_r_val=0.0_dp)
1688 CALL keyword_create(keyword, __location__, name=
"ATOMIC_CHARGES", &
1689 description=
"Calculate atomic CDFT charges with selected weight function"// &
1690 " (Z = Z_core - Z_CDFT). With fragment based constraints, charges are"// &
1691 " relative to the fragment reference state i.e. Z = Z_CDFT -"// &
1692 " Z_frag_reference. Note: if the number of atoms is greater than the"// &
1693 " default pw_pool max cache, calculation of atomic CDFT charges"// &
1694 " will prompt harmless warnings during deallocation of atomic grids.", &
1695 usage=
"ATOMIC_CHARGES", &
1696 default_l_val=.false., lone_keyword_l_val=.true.)
1700 CALL keyword_create(keyword, __location__, name=
"FRAGMENT_A_FILE_NAME", variants=[
"FRAGMENT_A_FILE"], &
1701 description=
"Name of the reference total electron density cube file for fragment A."// &
1702 " May include a path. The reference electron density needs to be outputted"// &
1703 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1704 " For GAPW, generate the cube with E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY;"// &
1705 " a regular GAPW electron-density cube contains only the soft density and is rejected.", &
1706 usage=
"FRAGMENT_A_FILE_NAME <FILENAME>", &
1707 default_lc_val=
"fragment_a.cube")
1711 CALL keyword_create(keyword, __location__, name=
"FRAGMENT_B_FILE_NAME", variants=[
"FRAGMENT_B_FILE"], &
1712 description=
"Name of the reference total electron density cube file for fragment B."// &
1713 " May include a path. The reference electron density needs to be outputted"// &
1714 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1715 " For GAPW, generate the cube with E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY;"// &
1716 " a regular GAPW electron-density cube contains only the soft density and is rejected.", &
1717 usage=
"FRAGMENT_B_FILE_NAME <FILENAME>", &
1718 default_lc_val=
"fragment_b.cube")
1722 CALL keyword_create(keyword, __location__, name=
"FRAGMENT_A_SPIN_FILE", &
1723 variants=[
"FRAGMENT_A_SPIN_FILE_NAME"], &
1724 description=
"Name of the reference spin density cube file for fragment A."// &
1725 " May include a path. The reference spin density needs to be outputted"// &
1726 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1727 " For GAPW, use the TOTAL_SPIN_DENSITY cube generated together with"// &
1728 " E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY.", &
1729 usage=
"FRAGMENT_A_SPIN_FILE <FILENAME>", &
1730 default_lc_val=
"fragment_a_spin.cube")
1734 CALL keyword_create(keyword, __location__, name=
"FRAGMENT_B_SPIN_FILE", &
1735 variants=[
"FRAGMENT_B_SPIN_FILE_NAME"], &
1736 description=
"Name of the reference spin density cube file for fragment B."// &
1737 " May include a path. The reference spin density needs to be outputted"// &
1738 " on the same grid as the full system (same cutoff and cell, output stride 1)."// &
1739 " For GAPW, use the TOTAL_SPIN_DENSITY cube generated together with"// &
1740 " E_DENSITY_CUBE% DENSITY_INCLUDE TOTAL_DENSITY.", &
1741 usage=
"FRAGMENT_B_SPIN_FILE <FILENAME>", &
1742 default_lc_val=
"fragment_b_spin.cube")
1746 CALL keyword_create(keyword, __location__, name=
"FLIP_FRAGMENT_A", &
1747 description=
"Logical which determines if the reference spin difference density "// &
1748 "(rho_alpha-rho_beta) for fragment A should be flipped. With default (off) "// &
1749 "value, the fragment is constrained to have more alpha than beta electrons "// &
1750 "if the isolated fragment has unpaired electrons. Useful in conjunction with "// &
1751 "FLIP_FRAGMENT_B.", &
1752 usage=
"FLIP_FRAGMENT_A", &
1753 default_l_val=.false., lone_keyword_l_val=.true.)
1757 CALL keyword_create(keyword, __location__, name=
"FLIP_FRAGMENT_B", &
1758 description=
"Logical which determines if the reference spin difference density "// &
1759 "(rho_alpha-rho_beta) for fragment B should be flipped. With default (off) "// &
1760 "value, the fragment is constrained to have more alpha than beta electrons "// &
1761 "if the isolated fragment has unpaired electrons. Useful in conjunction with "// &
1762 "FLIP_FRAGMENT_A.", &
1763 usage=
"FLIP_FRAGMENT_B", &
1764 default_l_val=.false., lone_keyword_l_val=.true.)
1769 description=
"Controls the printing of basic info about the method.", &
1772 CALL section_create(subsection, __location__, name=
"WEIGHT_FUNCTION", &
1773 description=
"Controls the printing of cube files with "// &
1774 "the CDFT weight function(s). Intended for single-point testing. "// &
1775 "In multistep simulations, generated cube files are overwritten each step.", &
1776 n_keywords=1, n_subsections=0, repeats=.false.)
1779 description=
"The stride (X,Y,Z) used to write the cube file "// &
1780 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
1781 " 1 number valid for all components.", &
1782 usage=
"STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=
integer_t)
1792 CALL section_create(group_section, __location__, name=
"ATOM_GROUP", &
1793 description=
"Define a group of atoms for use in a CDFT constraint. Each repetition of "// &
1794 "this section creates a new constraint.", &
1795 n_keywords=4, n_subsections=0, repeats=.true.)
1798 description=
"Specifies the list of atoms that are included in the constraint group.", &
1799 usage=
"ATOMS {integer} {integer} .. {integer}", &
1805 description=
"Defines coefficients for the atoms in the list of atoms. Accepts values +/-1.0.", &
1806 usage=
"COEFF 1.0 -1.0", repeats=.true., &
1807 type_of_var=
real_t, n_var=-1)
1811 CALL keyword_create(keyword, __location__, name=
"CONSTRAINT_TYPE ", &
1812 description=
"Determines what type of constraint to apply. ", &
1813 usage=
"CONSTRAINT_TYPE (CHARGE|MAGNETIZATION|ALPHA|BETA)", &
1814 enum_c_vals=
s2a(
"CHARGE",
"MAGNETIZATION",
"ALPHA",
"BETA"), &
1817 enum_desc=
s2a(
"Total charge density constraint (rho_alpha + rho_beta).", &
1818 "Magnetization density constraint (rho_alpha - rho_beta).", &
1819 "Alpha spin density constraint.", &
1820 "Beta spin density constraint."), &
1825 CALL keyword_create(keyword, __location__, name=
"FRAGMENT_CONSTRAINT", &
1826 description=
"Use a fragment based constraint. "// &
1827 "Takes as input the electron densities of two isolated fragments in the "// &
1828 "same geometry that they have in the full system. "// &
1829 "The isolated fragment densities are read from cube files defined in FRAGMENT_{A,B}_FILE. "// &
1830 "For magnetization density constraints, additional files containing the spin difference "// &
1831 "densities must be defined with the keywords FRAGMENT_{A,B}_SPIN_FILE. "// &
1832 "With this keyword active, the target value of the constraint is calculated from the "// &
1833 "the superposition of the isolated fragment densities. Supports only static calculations.", &
1834 usage=
"FRAGMENT_CONSTRAINT", &
1835 default_l_val=.false., lone_keyword_l_val=.true.)
1842 CALL section_create(group_section, __location__, name=
"DUMMY_ATOMS", &
1843 description=
"Define an extra group of atoms for which only atomic CDFT charges "// &
1844 "should be computed. The section cannot contain any constraint "// &
1845 "atoms that were included in section ATOM_GROUP.", &
1846 n_keywords=1, n_subsections=0, repeats=.true.)
1849 description=
"Specifies the list of atoms that are included in the DUMMY_ATOMS group.", &
1850 usage=
"ATOMS {integer} {integer} .. {integer}", &
1858 CALL keyword_create(keyword, __location__, name=
"REUSE_PRECOND", &
1859 description=
"Reuse a previously built OT preconditioner between subsequent CDFT SCF iterations "// &
1860 "if the inner OT SCF loop converged in PRECOND_FREQ steps or less. Intended mainly for MD "// &
1861 "simulations with the FULL_ALL preconditioner to speed up the final iterations of the CDFT SCF loop.", &
1862 usage=
"REUSE_PRECOND yes", repeats=.false., n_var=1, &
1863 default_l_val=.false., lone_keyword_l_val=.true.)
1867 CALL keyword_create(keyword, __location__, name=
"PRECOND_FREQ", &
1868 description=
"See REUSE_PRECOND.", &
1869 usage=
"PRECOND_FREQ {int}", default_i_val=0)
1874 description=
"Determines how many times a previously built preconditioner can be reused.", &
1875 usage=
"MAX_REUSE {int}", default_i_val=0)
1879 CALL keyword_create(keyword, __location__, name=
"PURGE_HISTORY", &
1880 description=
"Purge wavefunction and constraint history to improve SCF convergence during MD."// &
1881 " Counts how often the convergence of the first CDFT SCF iteration takes 2 or more outer SCF"// &
1882 " iterations and purges the history if the counter exceeds PURGE_FREQ, and PURGE_OFFSET"// &
1883 " MD steps have passed since the last purge."// &
1884 " The counter is zeroed after each purge.", &
1885 usage=
"PURGE_HISTORY yes", repeats=.false., n_var=1, &
1886 default_l_val=.false., lone_keyword_l_val=.true.)
1891 description=
"See PURGE_HISTORY.", &
1892 usage=
"PURGE_FREQ {int} ", default_i_val=1)
1896 CALL keyword_create(keyword, __location__, name=
"PURGE_OFFSET", &
1897 description=
"See PURGE_HISTORY.", &
1898 usage=
"PURGE_OFFSET {int} ", default_i_val=1)
1903 description=
"A counter to track the total number of energy evaluations. Needed by"// &
1904 " some optimizers to print information. Useful mainly for restarts.", &
1905 usage=
"COUNTER {int} ", default_i_val=0)
1910 description=
"Precompute gradients due to constraint during"// &
1911 " initial formation of constraint and store them in memory. Does"// &
1912 " nothing if forces are not calculated.", &
1913 usage=
"IN_MEMORY", &
1914 default_l_val=.false., lone_keyword_l_val=.true.)
1924 SUBROUTINE create_hirshfeld_constraint_section(section)
1931 cpassert(.NOT.
ASSOCIATED(section))
1932 CALL section_create(section, __location__, name=
"HIRSHFELD_CONSTRAINT", &
1933 description=
"Parameters for CDFT with a Gaussian Hirshfeld constraint.", &
1934 n_keywords=11, n_subsections=0, repeats=.false.)
1936 CALL keyword_create(keyword, __location__, name=
"SHAPE_FUNCTION", &
1937 description=
"Type of shape function used for Hirshfeld partitioning.", &
1938 usage=
"SHAPE_FUNCTION {Gaussian,Density}", repeats=.false., n_var=1, &
1940 enum_c_vals=
s2a(
"GAUSSIAN",
"DENSITY"), &
1941 enum_desc=
s2a(
"One Gaussian per atom with radius determined by the keyword GAUSSIAN_SHAPE.", &
1942 "Atomic density expanded in terms of multiple Gaussians."), &
1947 CALL keyword_create(keyword, __location__, name=
"GAUSSIAN_SHAPE", &
1948 description=
"Specifies the type of Gaussian used for SHAPE_FUNCTION GAUSSIAN.", &
1949 usage=
"GAUSSIAN_SHAPE (SINGLE|VDW|COVALENT|USER)", &
1950 enum_c_vals=
s2a(
"DEFAULT",
"SINGLE",
"VDW",
"COVALENT",
"USER"), &
1952 enum_desc=
s2a(
"Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
1953 " 1.0_dp radius for elements with a radius larger than this value.", &
1954 "Single Gaussian for all atom types with radius given by GAUSSIAN_RADIUS.", &
1955 "Use van der Waals radii to construct Gaussians.", &
1956 "Use covalent radii to construct Gaussians.", &
1957 "Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians."), &
1962 CALL keyword_create(keyword, __location__, name=
"GAUSSIAN_RADIUS", &
1963 description=
"Radius parameter controlling the creation of Gaussians.", &
1964 usage=
"GAUSSIAN_RADIUS <REAL>", &
1965 unit_str=
"angstrom", &
1967 type_of_var=
real_t, n_var=1)
1971 CALL keyword_create(keyword, __location__, name=
"ATOMIC_RADII", &
1972 description=
"Defines custom radii to setup the spherical Gaussians. "// &
1973 "Give one value per element in the same order as they "// &
1974 "appear in the input coordinates.", &
1975 usage=
"ATOMIC_RADII {real} {real} {real}", repeats=.false., &
1976 unit_str=
"angstrom", &
1977 type_of_var=
real_t, n_var=-1)
1982 description=
"Convert the Gaussian radius from angstrom to bohr. This results in a larger "// &
1983 "Gaussian than without unit conversion.", &
1984 usage=
"USE_BOHR .TRUE.", &
1985 default_l_val=.false., lone_keyword_l_val=.true.)
1989 CALL keyword_create(keyword, __location__, name=
"PRINT_DENSITY", &
1990 description=
"Logical to control printing of Hirshfeld densities to .cube file.", &
1991 usage=
"PRINT_DENSITY TRUE", &
1992 default_l_val=.false., lone_keyword_l_val=.true.)
1996 CALL keyword_create(keyword, __location__, name=
"ATOMS_MEMORY", &
1997 description=
"Number of atomic gradients to store in memory.", &
1998 usage=
"ATOMS_MEMORY", &
2004 CALL keyword_create(keyword, __location__, name=
"USE_ATOMIC_CUTOFF", &
2005 description=
"Logical to control use of ATOMIC_CUTOFF.", &
2006 usage=
"USE_ATOMIC_CUTOFF TRUE", &
2007 default_l_val=.true., lone_keyword_l_val=.true.)
2012 description=
"Numerical cutoff for calculation of weight function.", &
2013 usage=
"EPS_CUTOFF {real} ", default_r_val=1.0e-12_dp)
2017 CALL keyword_create(keyword, __location__, name=
"ATOMIC_CUTOFF", &
2018 description=
"Numerical cutoff for calculation of Hirshfeld densities.", &
2019 usage=
"ATOMIC_CUTOFF {real} ", default_r_val=1.0e-12_dp)
2023 END SUBROUTINE create_hirshfeld_constraint_section
2029 SUBROUTINE create_becke_constraint_section(section)
2035 cpassert(.NOT.
ASSOCIATED(section))
2036 CALL section_create(section, __location__, name=
"BECKE_CONSTRAINT", &
2037 description=
"Define settings influencing the construction of the Becke weight function.", &
2038 n_keywords=13, repeats=.false., citations=[
becke1988b])
2041 description=
"Adjust Becke cell boundaries with atomic"// &
2042 " radii to generate a heteronuclear cutoff profile. These"// &
2043 " radii are defined with the keyword ATOMIC_RADII.", &
2044 usage=
"ADJUST_SIZE", &
2045 default_l_val=.false., lone_keyword_l_val=.true.)
2049 CALL keyword_create(keyword, __location__, name=
"ATOMIC_RADII", &
2050 description=
"Defines atomic radii to generate a heteronuclear cutoff profile."// &
2051 " Give one value per element in the same order as they"// &
2052 " appear in the input coordinates.", &
2053 usage=
"ATOMIC_RADII {real} {real} {real}", repeats=.false., &
2054 unit_str=
"angstrom", &
2055 type_of_var=
real_t, n_var=-1)
2060 description=
"If grid point is farther than GLOBAL_CUTOFF from all constraint atoms, "// &
2061 "move directly to next grid point, thus saving computational resources.", &
2062 usage=
"SHOULD_SKIP", &
2063 default_l_val=.false., lone_keyword_l_val=.true.)
2067 CALL keyword_create(keyword, __location__, name=
"CAVITY_CONFINE", &
2068 description=
"Activates Gaussian cavity confinement. The constraint is evaluated only inside "// &
2069 "the cavity. The cavity is formed by summing spherical Gaussians centered on the constraint atoms.", &
2070 usage=
"CAVITY_CONFINE", &
2071 default_l_val=.false., lone_keyword_l_val=.true.)
2075 CALL keyword_create(keyword, __location__, name=
"CAVITY_SHAPE", &
2076 description=
"Specifies the type of Gaussian cavity used.", &
2077 usage=
"CAVITY_SHAPE (SINGLE|VDW|COVALENT|USER)", &
2078 enum_c_vals=
s2a(
"DEFAULT",
"SINGLE",
"VDW",
"COVALENT",
"USER"), &
2080 enum_desc=
s2a(
"Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
2081 " 1.0_dp radius for elements with a radius larger than this value.", &
2082 "Single Gaussian for all atom types with radius given by CAVITY_RADIUS.", &
2083 "Use van der Waals radii to construct Gaussians.", &
2084 "Use covalent radii to construct Gaussians.", &
2085 "Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians."), &
2090 CALL keyword_create(keyword, __location__, name=
"CAVITY_USE_BOHR", &
2091 description=
"Convert the cavity radius from angstrom to bohr. This results in a larger"// &
2092 " confinement cavity than without unit conversion.", &
2093 usage=
"CAVITY_USE_BOHR TRUE", &
2094 default_l_val=.false., lone_keyword_l_val=.true.)
2098 CALL keyword_create(keyword, __location__, name=
"CAVITY_PRINT", &
2099 description=
"Print cavity in Gaussian cube file format. Currently, printing options"// &
2100 " are hardcoded.", &
2101 usage=
"CAVITY_PRINT", &
2102 default_l_val=.false., lone_keyword_l_val=.true.)
2106 CALL keyword_create(keyword, __location__, name=
"CAVITY_RADIUS", &
2107 description=
"Radius parameter controlling the creation of Gaussian cavity confinement.", &
2108 usage=
"CAVITY_RADIUS <REAL>", &
2109 unit_str=
"angstrom", &
2111 type_of_var=
real_t, n_var=1)
2116 description=
"Density threshold for cavity creation. Grid points where the Gaussian"// &
2117 " density falls below the threshold are ignored.", &
2118 usage=
"EPS_CAVITY {real} ", default_r_val=1.0e-6_dp)
2123 description=
"Specifies the type of cutoff used when building the Becke weight function.", &
2124 usage=
"CUTOFF_TYPE (GLOBAL|ELEMENT)", &
2125 enum_c_vals=
s2a(
"GLOBAL",
"ELEMENT"), &
2127 enum_desc=
s2a(
"Use a single value for all elements. Read from GLOBAL_CUTOFF.", &
2128 "Use a different value for all elements. Values read from ELEMENT_CUTOFF."), &
2133 CALL keyword_create(keyword, __location__, name=
"GLOBAL_CUTOFF", &
2134 description=
"Parameter used to select which atoms contribute to the"// &
2135 " weight function at each real space grid point.", &
2136 usage=
"GLOBAL_CUTOFF <REAL>", &
2137 unit_str=
"angstrom", &
2139 type_of_var=
real_t, n_var=1)
2143 CALL keyword_create(keyword, __location__, name=
"ELEMENT_CUTOFF", &
2144 description=
"Defines element specific cutoffs to decide which atoms contribute to the"// &
2145 " weight function at each real space grid point. Give one value per element in the same"// &
2146 " order as they appear in the coordinates.", &
2147 usage=
"ELEMENT_CUTOFF {real} {real} {real}", repeats=.false., &
2148 unit_str=
"angstrom", &
2149 type_of_var=
real_t, n_var=-1)
2154 description=
"Precompute gradients due to Becke constraint during"// &
2155 " initial formation of constraint and store them in memory. Useful"// &
2156 " in combination with confinement, memory intensive otherwise. Does"// &
2157 " nothing if forces are not calculated.", &
2158 usage=
"IN_MEMORY", &
2159 default_l_val=.false., lone_keyword_l_val=.true.)
2163 END SUBROUTINE create_becke_constraint_section
2172 SUBROUTINE create_cdft_opt_section(section)
2177 cpassert(.NOT.
ASSOCIATED(section))
2179 description=
"Parameters controlling optimization methods that are compatible "// &
2180 "only with CDFT based constraints (i.e. CDFT SCF is active). Specifically, "// &
2181 "the control parameters for the Broyden and Newton optimizers are defined in this "// &
2183 n_keywords=10, n_subsections=0, repeats=.false.)
2187 CALL keyword_create(keyword, __location__, name=
"BROYDEN_TYPE", &
2188 description=
"Specifies the Broyden optimizer variant to use.", &
2189 usage=
"BROYDEN_TYPE BT1", &
2191 enum_c_vals=
s2a(
"BT1",
"BT1_EXPLICIT",
"BT2",
"BT2_EXPLICIT", &
2192 "BT1_LS",
"BT1_EXPLICIT_LS",
"BT2_LS",
"BT2_EXPLICIT_LS"), &
2193 enum_desc=
s2a(
"Broyden's first method, also known as the good method. The initial Jacobian"// &
2194 " is built from MD history if available. Otherwise switches to SD for one"// &
2195 " SCF iteration until a Jacobian can be built from the SCF history.", &
2196 "Same as BT1, but computes the explicit Jacobian with finite differences. "// &
2197 "Requires a CDFT SCF procedure to be active.", &
2198 "Same as BT1, but uses Broyden's second method, also known as the bad method.", &
2199 "Same as BT1_EXPLICIT, but using Broyden's second method.", &
2200 "Same as BT1, but uses backtracking line search for optimizing the step size "// &
2201 "(see optimizer NEWTON_LS).", &
2202 "Same as BT1_EXPLICIT, but uses backtracking line search for optimizing the step size.", &
2203 "Same as BT2, but uses backtracking line search for optimizing the step size.", &
2204 "Same as BT2_EXPLICIT, but uses backtracking line search for optimizing the step size."), &
2211 CALL keyword_create(keyword, __location__, name=
"JACOBIAN_TYPE", &
2212 description=
"Finite difference method used to calculate the inverse Jacobian "// &
2213 "needed by some optimizers. Compatible only with CDFT constraints.", &
2214 usage=
"JACOBIAN_TYPE FD1", &
2216 enum_c_vals=
s2a(
"FD1",
"FD1_BACKWARD",
"FD2",
"FD2_BACKWARD",
"FD1_CENTRAL"), &
2217 enum_desc=
s2a(
"First order forward difference (one extra energy evaluation per constraint).", &
2218 "First order backward difference (one extra energy evaluation per constraint).", &
2219 "Second order forward difference (two extra energy evaluations per constraint).", &
2220 "Second order backward difference (two extra energy evaluations per constraint).", &
2221 "First order central difference (two extra energy evaluations per constraint)."), &
2227 CALL keyword_create(keyword, __location__, name=
"JACOBIAN_STEP", &
2228 description=
"Step size to use in the calculation of the inverse Jacobian with finite differences. "// &
2229 "Expects one value for all constraints, or one value per constraint.", &
2230 usage=
"JACOBIAN_STEP 5.0E-3 ", n_var=-1, default_r_val=5.0e-3_dp)
2234 CALL keyword_create(keyword, __location__, name=
"JACOBIAN_FREQ", &
2235 description=
"Defines parameters that control how often the explicit Jacobian is built,"// &
2236 " which is needed by some optimizers. Expects two values. The first value"// &
2237 " determines how many consecutive CDFT SCF iterations should skip a rebuild,"// &
2238 " whereas the latter how many MD steps. The values can be zero (meaning never"// &
2239 " rebuild) or positive. Both values cannot be zero.", &
2240 usage=
"JACOBIAN_FREQ 1 1", n_var=2, &
2241 default_i_vals=[1, 1], type_of_var=
integer_t)
2245 CALL keyword_create(keyword, __location__, name=
"JACOBIAN_RESTART", &
2246 description=
"Restart the inverse Jacobian using the vector defined with keyword JACOBIAN_VECTOR.", &
2247 usage=
"JACOBIAN_RESTART TRUE", &
2248 default_l_val=.false., lone_keyword_l_val=.true.)
2252 CALL keyword_create(keyword, __location__, name=
"JACOBIAN_VECTOR", &
2253 description=
"Defines the inverse Jacobian matrix. Useful for restarting calculations. "// &
2254 "Expects n^2 values where n is the total number of constraints. "// &
2255 "The matrix should be given in row major order.", &
2256 usage=
"JACOBIAN_VECTOR 1.0 0.0", n_var=-1, type_of_var=
real_t)
2261 description=
"The maximum number of backtracking line search steps to perform.", &
2262 usage=
"MAX_LS 5", default_i_val=5)
2267 description=
"Control parameter for backtracking line search. The step size is reduced by "// &
2268 "this factor on every line search iteration. Value must be between 0 and 1 (exclusive).", &
2269 usage=
"FACTOR_LS 0.5", default_r_val=0.5_dp)
2274 description=
"Continue backtracking line search until MAX_LS steps are reached or the "// &
2275 "norm of the CDFT gradient no longer decreases. Default (false) behavior exits the "// &
2276 "line search procedure on the first step that the gradient decreases.", &
2277 usage=
"CONTINUE_LS TRUE", &
2278 default_l_val=.false., lone_keyword_l_val=.true.)
2282 END SUBROUTINE create_cdft_opt_section
2291 SUBROUTINE create_gce_section(section)
2297 cpassert(.NOT.
ASSOCIATED(section))
2301 description=
"Enables grand canonical SCF calculations for "// &
2302 "slab models with a target work function specified by the "// &
2303 "user. The current implementation is intended for three "// &
2304 "dimensional periodic calculations and should be used "// &
2305 "together with the planar counter charge model. The planar "// &
2306 "counter charge screens the net charge of the DFT slab, so "// &
2307 "that the work function can be obtained from the planar "// &
2308 "averaged Hartree potential in the implicit solvent region "// &
2309 "or vacuum region. During the SCF iterations, the work "// &
2310 "function is mixed toward the target value. "// &
2311 "The reported GCE charges during SCF iterations are the "// &
2312 "current net charge of the DFT system excluding the planar "// &
2313 "counter charge. A positive value means electron deficiency. "// &
2314 "The input CHARGE value in the DFT section defines the "// &
2315 "reference charge state. The quantity N_e^(abs,alpha) is "// &
2316 "evaluated as the input CHARGE value minus the reported GCE "// &
2317 "charge. The reported GCE free energy is the sum of the DFT "// &
2318 "total energy and the product of the target work function "// &
2319 "and N_e^(abs,alpha).", &
2328 name=
"_SECTION_PARAMETERS_", &
2329 description=
"Controls the activation of grand canonical SCF", &
2331 default_l_val=.false., &
2332 lone_keyword_l_val=.true.)
2337 name=
"TARGET_WORKFUNCTION", &
2338 description=
"The user input target work function of the symmetric slab model", &
2342 default_r_val=0.16_dp, &
2344 usage=
"TARGET_WORKFUNCTION [eV] 0.16")
2349 name=
"MIXING_COEF", &
2350 description=
"The proportion of the target work function mixed with the "// &
2351 "work function of the previous SCF iteration", &
2355 default_r_val=0.3_dp, &
2356 usage=
"MIXING_COEF 0.3")
2360 END SUBROUTINE create_gce_section
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public vandevondele2003
integer, save, public blaha2010
integer, save, public holmberg2017
integer, save, public vandevondele2005a
integer, save, public schiffmann2015
integer, save, public hu2010
integer, save, public weber2008
integer, save, public kressefurthmueller1996
integer, save, public holmberg2018
integer, save, public becke1988b
integer, save, public stewart1982
integer, save, public chai2024a
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str, do_backup)
creates a print_key section
integer, parameter, public low_print_level
integer, parameter, public high_print_level
integer, parameter, public add_last_numeric
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Defines the basic variable types.
integer, parameter, public dp
module that contains the definitions of the scf types
subroutine, public create_mixing_section(section, ls_scf, active_space)
Create CP2K input section for SCF or active-space density mixing.
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