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.", &
274 usage=
"READ_EMBED_POT_CUBE .FALSE.", default_l_val=.false.)
278 CALL keyword_create(keyword, __location__, name=
"EMBED_RESTART_FILE_NAME", &
279 description=
"Root of the file name where to read the embedding "// &
280 "potential guess.", &
281 usage=
"EMBED_RESTART_FILE_NAME <FILENAME>", &
286 CALL keyword_create(keyword, __location__, name=
"EMBED_CUBE_FILE_NAME", &
287 description=
"Root of the file name where to read the embedding "// &
288 "potential (guess) as a cube.", &
289 usage=
"EMBED_CUBE_FILE_NAME <FILENAME>", &
294 CALL keyword_create(keyword, __location__, name=
"EMBED_SPIN_CUBE_FILE_NAME", &
295 description=
"Root of the file name where to read the spin part "// &
296 "of the embedding potential (guess) as a cube.", &
297 usage=
"EMBED_SPIN_CUBE_FILE_NAME <FILENAME>", &
302 CALL create_print_embed_diff(section)
304 CALL create_print_embed_pot_cube(section)
306 CALL create_print_embed_restart_vec(section)
308 CALL create_print_simple_grid(section)
322 cpassert(.NOT.
ASSOCIATED(section))
324 description=
"This section specifies optional parameters for DMFET matrix potential optimization.", &
325 n_keywords=8, n_subsections=4, repeats=.false.)
330 description=
"Maximum number of iterations "// &
331 "in the optimization procedure.", &
332 usage=
"N_ITER 75", default_i_val=50)
337 description=
"Step length "// &
338 "in the optimization procedure.", &
339 usage=
"TRUST_RAD 0.5", default_r_val=0.5_dp)
344 description=
"Convergence criterion for "// &
345 "the maximum element of density matrix difference.", &
346 usage=
"DM_CONV_MAX 0.01", default_r_val=0.01_dp)
351 description=
"Convergence criterion for "// &
352 "the total density matrix difference.", &
353 usage=
"DM_CONV_INT 0.1", default_r_val=0.1_dp)
357 CALL keyword_create(keyword, __location__, name=
"BETA_DM_CONV_MAX", &
358 description=
"Convergence criterion for "// &
359 "the maximum element of the beta-spin density "// &
360 "matrix difference.", &
361 usage=
"BETA_DM_CONV_MAX 0.01", default_r_val=0.01_dp)
365 CALL keyword_create(keyword, __location__, name=
"BETA_DM_CONV_INT", &
366 description=
"Convergence criterion for "// &
367 "the total beta-spin density matrix difference.", &
368 usage=
"BETA_DM_CONV_INT 0.1", default_r_val=0.1_dp)
372 CALL keyword_create(keyword, __location__, name=
"READ_DMFET_POT", &
373 description=
"Read the matrix embedding potential "// &
374 "(restart) from the cube file.", &
375 usage=
"READ_DMFET_POT .FALSE.", default_l_val=.false.)
379 CALL keyword_create(keyword, __location__, name=
"DMFET_RESTART_FILE_NAME", &
380 description=
"Root of the file name where to read the matrix "// &
381 "potential guess.", &
382 usage=
"DMFET_RESTART_FILE_NAME <FILENAME>", &
393 SUBROUTINE create_print_embed_diff(section)
399 NULLIFY (print_key, keyword)
401 description=
"Controls the printing of cube files with "// &
402 "embedding densisty differences", &
405 description=
"The stride (X,Y,Z) used to write the cube file "// &
406 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
407 " 1 number valid for all components.", &
408 usage=
"STRIDE 2 2 2", n_var=-1, default_i_vals=(/2, 2, 2/), type_of_var=
integer_t)
415 END SUBROUTINE create_print_embed_diff
421 SUBROUTINE create_print_embed_pot_cube(section)
427 NULLIFY (print_key, keyword)
429 description=
"Controls the printing of cube files with "// &
430 "with embedding potential", &
433 description=
"The stride (X,Y,Z) used to write the cube file "// &
434 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
435 " 1 number valid for all components.", &
436 usage=
"STRIDE 1 1 1", n_var=-1, default_i_vals=(/1, 1, 1/), type_of_var=
integer_t)
443 END SUBROUTINE create_print_embed_pot_cube
449 SUBROUTINE create_print_embed_restart_vec(section)
456 description=
"Controls the printing of cube files with "// &
457 "with embedding potential", &
462 END SUBROUTINE create_print_embed_restart_vec
468 SUBROUTINE create_print_simple_grid(section)
474 NULLIFY (print_key, keyword)
476 description=
"Controls the printing of simple grid "// &
477 "files with embedding potential: X Y Z value", &
481 description=
"The stride (X,Y,Z) used to write the cube file "// &
482 "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"// &
483 " 1 number valid for all components.", &
484 usage=
"STRIDE 1 1 1", n_var=-1, default_i_vals=(/1, 1, 1/), type_of_var=
integer_t)
489 description=
"Units of the volumetric file: Angstrom or Bohr.", &
490 usage=
"UNITS BOHR", &
492 enum_c_vals=
s2a(
"BOHR",
"ANGSTROM"), &
493 enum_desc=
s2a(
"Atomic units: Bohr",
"Metric units: Angstrom."), &
499 description=
"Activates printing folded coordinates corresponding "// &
500 "to the simple grid. Used as input for external programs.", &
501 usage=
"FOLD_COORD .TRUE.", n_var=1, type_of_var=
logical_t, &
502 default_l_val=.true., lone_keyword_l_val=.true.)
509 END SUBROUTINE create_print_simple_grid
516 SUBROUTINE create_constrain_exponents_section(section)
521 CALL section_create(section, __location__, name=
"CONSTRAIN_EXPONENTS", &
522 description=
"specifies constraints for the exponents of the "// &
523 "lri auxiliary basis sets in the optimization.", &
524 n_keywords=1, n_subsections=0, repeats=.false.)
529 description=
"Defines the upper and lower boundaries as "// &
530 "(1+scale)*exp and (1-scale)*exp. Fermi-like constraint "// &
532 usage=
"SCALE 0.3", default_r_val=0.3_dp)
537 description=
"Exponent in the fermi-like constraint function. ", &
538 usage=
"FERMI_EXP 2.63", default_r_val=2.63391_dp)
542 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.