36#include "./base/base_uses.f90"
41 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_opt'
60 cpassert(.NOT.
ASSOCIATED(section))
61 CALL section_create(section, __location__, name=
"OPTIMIZE_LRI_BASIS", &
62 description=
"This section specifies the parameters for optimizing "// &
63 "the lri auxiliary basis sets for LRIGPW. The Powell optimizer is used.", &
64 n_keywords=1, n_subsections=0, repeats=.false.)
66 NULLIFY (keyword, subsection)
69 description=
"Target accuracy for the objective function (RHOEND)", &
70 usage=
"ACCURACY 5.0E-4", default_r_val=1.0e-5_dp)
75 description=
"Maximum number of function evaluations", &
76 usage=
"MAX_FUN 200", default_i_val=4000)
81 description=
"Initial step size for search algorithm (RHOBEG)", &
82 usage=
"STEP_SIZE 1.0E-1", default_r_val=5.0e-2_dp)
86 CALL keyword_create(keyword, __location__, name=
"CONDITION_WEIGHT", &
87 description=
"This keyword allows to give different weight "// &
88 "factors to the condition number (LOG(cond) is used).", &
89 usage=
"CONDITION_WEIGHT 1.0E-4", default_r_val=1.0e-6_dp)
93 CALL keyword_create(keyword, __location__, name=
"USE_CONDITION_NUMBER", &
94 description=
"Determines whether condition number should be part "// &
95 "of optimization or not", &
96 usage=
"USE_CONDITION_NUMBER", &
97 default_l_val=.false., lone_keyword_l_val=.true.)
101 CALL keyword_create(keyword, __location__, name=
"GEOMETRIC_SEQUENCE", &
102 description=
"Exponents are assumed to be a geometric sequence. "// &
103 "Only the minimal and maximal exponents of one set are optimized and "// &
104 "the other exponents are obtained by geometric progression.", &
105 usage=
"GEOMETRIC_SEQUENCE", &
106 default_l_val=.false., lone_keyword_l_val=.true.)
110 CALL keyword_create(keyword, __location__, name=
"DEGREES_OF_FREEDOM", &
111 description=
"Specifies the degrees of freedom in the basis "// &
113 usage=
"DEGREES_OF_FREEDOM ALL", &
114 enum_c_vals=
s2a(
"ALL",
"COEFFICIENTS",
"EXPONENTS"), &
115 enum_desc=
s2a(
"Set all parameters in the basis to be variable.", &
116 "Set all coefficients in the basis set to be variable.", &
117 "Set all exponents in the basis to be variable."), &
123 CALL create_constrain_exponents_section(subsection)
139 cpassert(.NOT.
ASSOCIATED(section))
141 description=
"This section specifies optional parameters for DFT embedding potential optimization.", &
142 n_keywords=19, n_subsections=4, repeats=.false.)
147 description=
"Parameter for Yang's regularization "// &
148 "involving kinetic matrix.", &
149 usage=
"REG_LAMBDA 0.0001", default_r_val=0.0001_dp)
154 description=
"Maximum number of iterations "// &
155 "in the optimization procedure.", &
156 usage=
"N_ITER 75", default_i_val=50)
161 description=
"Maximum number of iterations "// &
162 "in the optimization procedure.", &
163 usage=
"TRUST_RAD 0.5", default_r_val=0.5_dp)
167 CALL keyword_create(keyword, __location__, name=
"DENS_CONV_MAX", &
168 description=
"Convergence criterion for "// &
169 "the maximum electron density difference.", &
170 usage=
"DENS_CONV_MAX 0.01", default_r_val=0.01_dp)
174 CALL keyword_create(keyword, __location__, name=
"DENS_CONV_INT", &
175 description=
"Convergence criterion for "// &
176 "the integrated electron density difference.", &
177 usage=
"DENS_CONV_INT 0.1", default_r_val=0.1_dp)
181 CALL keyword_create(keyword, __location__, name=
"SPIN_DENS_CONV_MAX", &
182 description=
"Convergence criterion for "// &
183 "the maximum electron density difference.", &
184 usage=
"SPIN_DENS_CONV_MAX 0.01", default_r_val=0.01_dp)
188 CALL keyword_create(keyword, __location__, name=
"SPIN_DENS_CONV_INT", &
189 description=
"Convergence criterion for "// &
190 "the integrated electron density difference.", &
191 usage=
"SPIN_DENS_CONV_INT 0.1", default_r_val=0.1_dp)
196 description=
"Optimize embedding potential.", &
197 usage=
"OPTIMIZER LEVEL_SHIFT", &
199 enum_c_vals=
s2a(
"STEEPEST_DESCENT",
"QUASI_NEWTON",
"LEVEL_SHIFT"), &
200 enum_desc=
s2a(
"Steepest descent.",
"Quasi-Newton.",
"Level shift."), &
206 description=
"Optimize embedding potential on the grid. ", &
207 usage=
"GRID_OPT .TRUE.", &
208 default_l_val=.true.)
212 CALL keyword_create(keyword, __location__, name=
"LEEUWEN-BAERENDS", &
213 description=
"Van Leeuwen-Baerends iterative update. Alternative to Wu-Yang "// &
214 "optimizer. Use only with ADD_CONTST_POT.", &
215 usage=
"LEEUWEN-BAERENDS .TRUE.", &
216 default_l_val=.false.)
221 description=
"Finzel-Ayers-Bultinck iterative update. Generally, not reliable. ", &
222 usage=
"FAB .TRUE.", &
223 default_l_val=.false.)
228 description=
"Cutoff for von Weizsacker potential in "// &
229 "the FAB optimization procedure.", &
230 usage=
"VW_CUTOFF 0.01", default_r_val=0.01_dp)
234 CALL keyword_create(keyword, __location__, name=
"VW_SMOOTH_CUT_RANGE", &
235 description=
"Smooth cutoff range for von Weizsacker potential in "// &
236 "the FAB optimization procedure.", &
237 usage=
"VW_SMOOTH_CUT_RANGE 1.0", default_r_val=1.0_dp)
242 description=
"Specifies the guess of the embedding "// &
243 "potential. For optimization in finite basis (not grid optimization) "// &
244 "in is a constant part to be added to the one in finite basis. ", &
245 usage=
"POT_GUESS NONE", &
246 enum_c_vals=
s2a(
"NONE",
"DIFF",
"Fermi_Amaldi",
"RESP"), &
247 enum_desc=
s2a(
"Initial guess is zero grid.", &
248 "Initial density difference. A euristic but working approach.", &
249 "Fermi-Amaldi potential. More rigorous than DIFF, although less efficient.", &
250 "Coulomb interaction between the subsystem using RESP charges)"// &
251 " on the total system."), &
257 CALL keyword_create(keyword, __location__, name=
"CHARGE_DISTR_WIDTH", &
258 description=
"Width of the Gaussian representing "// &
259 "point charges. To be used with ADD_COULOMB_POT.", &
260 usage=
"CHARGE_DISTR_WIDTH 3.000", default_r_val=1.12490_dp)
264 CALL keyword_create(keyword, __location__, name=
"READ_EMBED_POT", &
265 description=
"Read the embedding potential "// &
266 "restart vector as a guess.", &
267 usage=
"READ_EMBED_POT .FALSE.", default_l_val=.false.)
271 CALL keyword_create(keyword, __location__, name=
"READ_EMBED_POT_CUBE", &
272 description=
"Read the embedding potential "// &
273 "(restart) from the cube file. Whitespace-separated cube values are accepted. If "// &
274 "adjacent values are written without whitespace, each value must occupy a "// &
275 "13-character E13.5 field, as in CP2K-generated cube files.", &
276 usage=
"READ_EMBED_POT_CUBE .FALSE.", default_l_val=.false.)
280 CALL keyword_create(keyword, __location__, name=
"EMBED_RESTART_FILE_NAME", &
281 description=
"Root of the file name where to read the embedding "// &
282 "potential guess.", &
283 usage=
"EMBED_RESTART_FILE_NAME <FILENAME>", &
288 CALL keyword_create(keyword, __location__, name=
"EMBED_CUBE_FILE_NAME", &
289 description=
"Root of the file name where to read the embedding "// &
290 "potential (guess) as a cube. Whitespace-separated cube values are accepted. If "// &
291 "adjacent values are written without whitespace, each value must occupy a "// &
292 "13-character E13.5 field, as in CP2K-generated cube files.", &
293 usage=
"EMBED_CUBE_FILE_NAME <FILENAME>", &
298 CALL keyword_create(keyword, __location__, name=
"EMBED_SPIN_CUBE_FILE_NAME", &
299 description=
"Root of the file name where to read the spin part "// &
300 "of the embedding potential (guess) as a cube. Whitespace-separated cube values are "// &
301 "accepted. If adjacent values are written without whitespace, each value must occupy "// &
302 "a 13-character E13.5 field, as in CP2K-generated cube files.", &
303 usage=
"EMBED_SPIN_CUBE_FILE_NAME <FILENAME>", &
308 CALL create_print_embed_diff(section)
310 CALL create_print_embed_pot_cube(section)
312 CALL create_print_embed_restart_vec(section)
314 CALL create_print_simple_grid(section)
328 cpassert(.NOT.
ASSOCIATED(section))
330 description=
"This section specifies optional parameters for DMFET matrix potential optimization.", &
331 n_keywords=8, n_subsections=4, repeats=.false.)
336 description=
"Maximum number of iterations "// &
337 "in the optimization procedure.", &
338 usage=
"N_ITER 75", default_i_val=50)
343 description=
"Step length "// &
344 "in the optimization procedure.", &
345 usage=
"TRUST_RAD 0.5", default_r_val=0.5_dp)
350 description=
"Convergence criterion for "// &
351 "the maximum element of density matrix difference.", &
352 usage=
"DM_CONV_MAX 0.01", default_r_val=0.01_dp)
357 description=
"Convergence criterion for "// &
358 "the total density matrix difference.", &
359 usage=
"DM_CONV_INT 0.1", default_r_val=0.1_dp)
363 CALL keyword_create(keyword, __location__, name=
"BETA_DM_CONV_MAX", &
364 description=
"Convergence criterion for "// &
365 "the maximum element of the beta-spin density "// &
366 "matrix difference.", &
367 usage=
"BETA_DM_CONV_MAX 0.01", default_r_val=0.01_dp)
371 CALL keyword_create(keyword, __location__, name=
"BETA_DM_CONV_INT", &
372 description=
"Convergence criterion for "// &
373 "the total beta-spin density matrix difference.", &
374 usage=
"BETA_DM_CONV_INT 0.1", default_r_val=0.1_dp)
378 CALL keyword_create(keyword, __location__, name=
"READ_DMFET_POT", &
379 description=
"Read the matrix embedding potential "// &
380 "(restart) from the cube file.", &
381 usage=
"READ_DMFET_POT .FALSE.", default_l_val=.false.)
385 CALL keyword_create(keyword, __location__, name=
"DMFET_RESTART_FILE_NAME", &
386 description=
"Root of the file name where to read the matrix "// &
387 "potential guess.", &
388 usage=
"DMFET_RESTART_FILE_NAME <FILENAME>", &
399 SUBROUTINE create_print_embed_diff(section)
405 NULLIFY (print_key, keyword)
407 description=
"Controls the printing of cube files with "// &
408 "embedding densisty differences", &
411 description=
"The stride (X,Y,Z) used to write the cube file "// &
412 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
413 " 1 number valid for all components.", &
414 usage=
"STRIDE 2 2 2", n_var=-1, default_i_vals=[2, 2, 2], type_of_var=
integer_t)
421 END SUBROUTINE create_print_embed_diff
427 SUBROUTINE create_print_embed_pot_cube(section)
433 NULLIFY (print_key, keyword)
435 description=
"Controls the printing of cube files with "// &
436 "with embedding potential", &
439 description=
"The stride (X,Y,Z) used to write the cube file "// &
440 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
441 " 1 number valid for all components.", &
442 usage=
"STRIDE 1 1 1", n_var=-1, default_i_vals=[1, 1, 1], type_of_var=
integer_t)
449 END SUBROUTINE create_print_embed_pot_cube
455 SUBROUTINE create_print_embed_restart_vec(section)
462 description=
"Controls the printing of cube files with "// &
463 "with embedding potential", &
468 END SUBROUTINE create_print_embed_restart_vec
474 SUBROUTINE create_print_simple_grid(section)
480 NULLIFY (print_key, keyword)
482 description=
"Controls the printing of simple grid "// &
483 "files with embedding potential: X Y Z value", &
487 description=
"The stride (X,Y,Z) used to write the cube file "// &
488 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
489 " 1 number valid for all components.", &
490 usage=
"STRIDE 1 1 1", n_var=-1, default_i_vals=[1, 1, 1], type_of_var=
integer_t)
495 description=
"Units of the volumetric file: Angstrom or Bohr.", &
496 usage=
"UNITS BOHR", &
498 enum_c_vals=
s2a(
"BOHR",
"ANGSTROM"), &
499 enum_desc=
s2a(
"Atomic units: Bohr",
"Metric units: Angstrom."), &
505 description=
"Activates printing folded coordinates corresponding "// &
506 "to the simple grid. Used as input for external programs.", &
507 usage=
"FOLD_COORD .TRUE.", n_var=1, type_of_var=
logical_t, &
508 default_l_val=.true., lone_keyword_l_val=.true.)
515 END SUBROUTINE create_print_simple_grid
522 SUBROUTINE create_constrain_exponents_section(section)
527 CALL section_create(section, __location__, name=
"CONSTRAIN_EXPONENTS", &
528 description=
"specifies constraints for the exponents of the "// &
529 "lri auxiliary basis sets in the optimization.", &
530 n_keywords=1, n_subsections=0, repeats=.false.)
535 description=
"Defines the upper and lower boundaries as "// &
536 "(1+scale)*exp and (1-scale)*exp. Fermi-like constraint "// &
538 usage=
"SCALE 0.3", default_r_val=0.3_dp)
543 description=
"Exponent in the fermi-like constraint function. ", &
544 usage=
"FERMI_EXP 2.63", default_r_val=2.63391_dp)
548 END SUBROUTINE create_constrain_exponents_section
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public high_print_level
integer, parameter, public add_last_numeric
integer, parameter, public silent_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
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.