33#include "./base/base_uses.f90"
38 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_optimize_basis'
54 cpassert(.NOT.
ASSOCIATED(section))
55 CALL section_create(section, __location__, name=
"OPTIMIZE_BASIS", &
56 description=
"describes a basis optimization job, in which an ADMM like approach is used to"// &
57 " find the best exponents and/or coefficients to match a given training set.", &
59 NULLIFY (keyword, subsection)
61 CALL keyword_create(keyword, __location__, name=
"BASIS_TEMPLATE_FILE", &
62 description=
"Name of the basis set file, containing the structure of the new basis set", &
63 usage=
"BASIS_TEMPLATE_FILE <FILENAME>", &
64 type_of_var=
char_t, repeats=.false., &
65 default_c_val=
"BASIS_SET", n_var=-1)
69 CALL keyword_create(keyword, __location__, name=
"BASIS_WORK_FILE", &
70 description=
"Name of the basis set file which is created to be read as initial guess", &
71 usage=
"BASIS_WORK_FILE <FILENAME>", &
72 type_of_var=
char_t, repeats=.false., &
73 default_c_val=
"BASIS_WORK_FILE", n_var=-1)
77 CALL keyword_create(keyword, __location__, name=
"BASIS_OUTPUT_FILE", &
78 description=
"Name of the basis set file containing the optimized basis", &
79 usage=
"BASIS_OUTPUT_FILE <FILENAME>", &
80 type_of_var=
char_t, repeats=.false., &
81 default_c_val=
"BASIS_OUTPUT_FILE", n_var=-1)
85 CALL keyword_create(keyword, __location__, name=
"WRITE_FREQUENCY", &
86 description=
"Frequency at which the intermediate results should be written", &
87 usage=
"WRITE_FREQUENCY 1000", &
92 CALL keyword_create(keyword, __location__, name=
"USE_CONDITION_NUMBER", &
93 description=
"Determines whether condition number should be part of optimization or not", &
94 usage=
"USE_CONDITION_NUMBER", &
95 default_l_val=.false., lone_keyword_l_val=.true.)
100 keyword, __location__, name=
"BASIS_COMBINATIONS", &
101 description=
"If multiple atomic kinds are fitted at the same time, this keyword "// &
102 "allows to specify which basis sets should be used together in optimization (underived set ID=0). "// &
103 "If skipped all combinations are used. The order is taken as the kinds and sets are specified in the input", &
105 usage=
"BASIS_COMBINATIONS SET_ID(KIND1) SET_ID(KIND2) ... ", type_of_var=
integer_t, n_var=-1)
110 keyword, __location__, name=
"RESIDUUM_WEIGHT", &
111 description=
"This keyword allows to give different weight factors to the "// &
112 "residuum of the different basis combinations. "// &
113 "The first entry corresponds to the original basis sets. Every further value is assigned to the combinations "// &
114 "in the order given for BASIS_COMBINATIONS.", &
116 usage=
"RESIDUUM_WEIGHT REAL ", default_r_val=1.0_dp)
121 keyword, __location__, name=
"CONDITION_WEIGHT", &
122 description=
"This keyword allows to give different weight factors to the "// &
123 "condition number of different basis combinations (LOG(cond) is used). "// &
124 "The first entry corresponds to the original basis sets. Every further value is assigned to the combinations "// &
125 "in the order given for BASIS_COMBINATIONS.", &
127 usage=
"CONDITION_WEIGHT REAL ", default_r_val=1.0_dp)
131 CALL keyword_create(keyword, __location__, name=
"GROUP_PARTITION", &
132 description=
"Allows the specification of the group mpi group sizes in parallel "// &
133 "runs. If less Groups than tasks are speciefied, consecutive calculations "// &
134 "Will be assigned to one group (derived basis sets and then training sets) "// &
135 "If keyword is skipped, equal group sizes will be generated trying to fit all calculations.", &
137 usage=
"GROUP_PARTITION INT INT ... ", type_of_var=
integer_t, n_var=-1)
141 CALL create_fit_kinds_section(subsection)
145 CALL create_training_section(subsection)
149 CALL create_powell_section(subsection)
159 SUBROUTINE create_fit_kinds_section(section)
165 NULLIFY (keyword, subsection)
166 cpassert(.NOT.
ASSOCIATED(section))
168 description=
"specicifies the atomic kinds to be fitted and the basis"// &
169 " sets associated with the kind.", &
172 CALL keyword_create(keyword, __location__, name=
"_SECTION_PARAMETERS_", &
173 description=
"The name of the kind described in this section.", &
174 usage=
"H", default_c_val=
"DEFAULT")
179 description=
"The name of the basis set for the kind. Has to be specified in BASIS_TEMPLATE_FILE.", &
180 usage=
"BASIS_SET H", default_c_val=
"DEFAULT")
184 CALL keyword_create(keyword, __location__, name=
"INITIAL_DEGREES_OF_FREEDOM", &
185 description=
"Specifies the initial degrees of freedom in the basis optimization. "// &
186 "This can be used to make further specifications easier", &
187 usage=
"INITIAL_DEGREES_OF_FREEDOM ALL", &
188 enum_c_vals=
s2a(
"ALL",
"NONE",
"COEFFICIENTS",
"EXPONENTS"), &
189 enum_desc=
s2a(
"Set all parameters in the basis to be variable.", &
190 "Set all parameters in the basis to be fixed.", &
191 "Set all coefficients in the basis set to be variable.", &
192 "Set all exponents in the basis to be variable."), &
198 CALL keyword_create(keyword, __location__, name=
"SWITCH_COEFF_STATE", &
199 description=
"Allows to switch the state of a given coefficient from current state "// &
200 "(varibale/fixed)) to the opposite state. The three integers indicate "// &
201 "the set number, the angular momentum i'th contraction and i'th coefficient", repeats=.true., &
202 usage=
"SWITCH_COEFF_STATE SET L CONTRACTION IPGF", type_of_var=
integer_t, n_var=4)
206 CALL keyword_create(keyword, __location__, name=
"SWITCH_CONTRACTION_STATE", &
207 description=
"Allows to switch the state of a given contraction from current state "// &
208 "(varibale/fixed)) to the opposite state. The three integers indicate "// &
209 "the set number, the angular momentum and i'th contraction ", repeats=.true., &
210 usage=
"SWITCH_CONTRACTION_STATE SET L CONTRACTION ", type_of_var=
integer_t, n_var=3)
214 CALL keyword_create(keyword, __location__, name=
"SWITCH_EXP_STATE", &
215 description=
"Allows to switch the state of a given exponent from current state "// &
216 "(varibale/fixed)) to the opposite state. The two integers indicate "// &
217 "the set number and i'th exponent", repeats=.true., &
218 usage=
"SWITCH_EXP_STATE SET IEXP", type_of_var=
integer_t, n_var=2)
222 CALL keyword_create(keyword, __location__, name=
"SWITCH_SET_STATE", &
223 description=
"Allows to switch the states of in a set from current state "// &
224 "(varibale/fixed)) to the opposite state. The two integers indicate "// &
225 "the affected part (0=ALL,1=EXPS,2=COEFF) and i'th set", repeats=.true., &
226 usage=
"SWITCH_SET_STATE SET IEXP", type_of_var=
integer_t, n_var=2)
230 CALL create_constrain_exp_section(subsection)
234 CALL create_derived_sets_section(subsection)
238 END SUBROUTINE create_fit_kinds_section
244 SUBROUTINE create_derived_sets_section(section)
250 cpassert(.NOT.
ASSOCIATED(section))
251 CALL section_create(section, __location__, name=
"DERIVED_BASIS_SETS", &
252 description=
"This section can be used to create subsets of a basis"// &
253 " which will be fitted at the same time. This is especially useful if connected"// &
254 " bsis sets e.g. TZVP, DZVP, SZV should be fitted.", &
257 CALL keyword_create(keyword, __location__, name=
"BASIS_SET_NAME", &
258 description=
"Defines the name of the derived basis set, which will be "// &
259 "automatically generated otherwise.", &
260 usage=
"BASIS_SET_NAME {word}", &
267 CALL keyword_create(keyword, __location__, name=
"REFERENCE_SET", &
268 description=
"Specifies the reference basis ID which is used as template to create the new set. "// &
269 "The original basis has ID 0. All following sets are counted in order as specified in the Input."// &
270 " The descriptors always assume the structure of the input basis set.", &
271 repeats=.false., usage=
"REFERENCE_SET INTEGER", default_i_val=0)
275 CALL keyword_create(keyword, __location__, name=
"REMOVE_CONTRACTION", &
276 description=
"Can be used to remove a contraction from the reference basis set. "// &
277 "The contraction is speciefied by set number, angular momentum and number of contraction."// &
278 " The descriptors always assume the structure of the input basis set.", &
279 repeats=.true., usage=
"REMOVE_CONTRACTION SET L ICONTRACTION", type_of_var=
integer_t, n_var=3)
284 description=
"Can be used to remove a set from the reference basis set. ", &
285 repeats=.true., usage=
"REMOVE_SET SET", type_of_var=
integer_t, n_var=1)
289 END SUBROUTINE create_derived_sets_section
295 SUBROUTINE create_constrain_exp_section(section)
301 cpassert(.NOT.
ASSOCIATED(section))
302 CALL section_create(section, __location__, name=
"CONSTRAIN_EXPONENTS", &
303 description=
"specicifies constraints for the exponents to be fitted."// &
304 " Only a single constraint can be applied to an exponent", &
308 description=
"Defines the exponent to be constraint. The two integers indicate "// &
309 "the set number and i'th exponent. The value -1 can be used to mark all sets/exponents in a set.", &
310 repeats=.false., usage=
"USE_EXP SET IEXP", type_of_var=
integer_t, n_var=2)
315 description=
"Defines the boundaries to which the optimization is restricted."// &
316 " First value is the lower bound, second value is the upper bound.", &
317 repeats=.false., usage=
"BOUNDARIES LOWER UPPER", type_of_var=
real_t, n_var=2)
321 CALL keyword_create(keyword, __location__, name=
"MAX_VAR_FRACTION", &
322 description=
"Defines the maximum fractionr by which the exponent is allowed to vary."// &
323 " e.g. 0.5 allows the exp to vary by 0.5*exp in both directions.", &
324 repeats=.false., usage=
"MAX_VAR_FRACTION REAL", type_of_var=
real_t, n_var=1)
328 END SUBROUTINE create_constrain_exp_section
334 SUBROUTINE create_training_section(section)
340 cpassert(.NOT.
ASSOCIATED(section))
341 CALL section_create(section, __location__, name=
"TRAINING_FILES", &
342 description=
"specicifies the location in which the files necessary for"// &
343 " fitting procedure are located. Each Training set needs a repetition of this section.", &
347 description=
"the directory in which the files are placed", &
348 usage=
"DIRECTORY /my/path", &
353 CALL keyword_create(keyword, __location__, name=
"INPUT_FILE_NAME", &
354 description=
"the filename of the input file used to run the original calculation", &
355 usage=
"INPUT_FILE_NAME my_input.inp", &
356 default_lc_val=
"input.inp")
360 END SUBROUTINE create_training_section
366 SUBROUTINE create_powell_section(section)
372 cpassert(.NOT.
ASSOCIATED(section))
374 description=
"sets the parameters for optimizition, output frequency and restarts", &
378 description=
"Final accuracy requested in optimization (RHOEND)", &
379 usage=
"ACCURACY 0.00001", &
380 default_r_val=1.e-5_dp)
385 description=
"Initial step size for search algorithm (RHOBEG)", &
386 usage=
"STEP_SIZE 0.005", &
387 default_r_val=0.1_dp)
392 description=
"Maximum number of function evaluations", &
393 usage=
"MAX_FUN 1000", &
398 END SUBROUTINE create_powell_section
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.