(git:9aade48)
Loading...
Searching...
No Matches
input_cp2k_almo.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief input for the ALMO SCF section
10!> \author Rustam Khaliullin
11! **************************************************************************************************
13 USE bibliography, ONLY: khaliullin2007,&
19 USE input_constants, ONLY: &
37 USE kinds, ONLY: dp
38 USE string_utilities, ONLY: s2a
39#include "./base/base_uses.f90"
40
41 IMPLICIT NONE
42 PRIVATE
43
44 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_almo'
45
46 INTEGER, PARAMETER, PRIVATE :: optimizer_block_diagonal_diis = 1
47 INTEGER, PARAMETER, PRIVATE :: optimizer_block_diagonal_pcg = 2
48 INTEGER, PARAMETER, PRIVATE :: optimizer_xalmo_pcg = 3
49 INTEGER, PARAMETER, PRIVATE :: optimizer_xalmo_trustr = 4
50 INTEGER, PARAMETER, PRIVATE :: optimizer_newton_pcg_solver = 5
51 INTEGER, PARAMETER, PRIVATE :: optimizer_nlmo_pcg = 6
52 INTEGER, PARAMETER, PRIVATE :: optimizer_block_diagonal_trustr = 7
53
55
56CONTAINS
57
58! **************************************************************************************************
59!> \brief create the almo scf section
60!> \param section ...
61!> \par History
62!> 2011.05 created [Rustam Z Khaliullin]
63!> \author Rustam Z Khaliullin
64! **************************************************************************************************
65 SUBROUTINE create_almo_scf_section(section)
66 TYPE(section_type), POINTER :: section
67
68 TYPE(keyword_type), POINTER :: keyword
69 TYPE(section_type), POINTER :: subsection
70
71 cpassert(.NOT. ASSOCIATED(section))
72 CALL section_create(section, __location__, name="ALMO_SCF", &
73 description="Settings for a class of efficient linear scaling methods based "// &
74 "on absolutely localized orbitals"// &
75 " (ALMOs). ALMO methods are currently restricted to closed-shell molecular systems.", &
76 n_keywords=10, n_subsections=6, repeats=.false., &
77 citations=[khaliullin2013, scheiber2018])
78
79 NULLIFY (keyword)
80
81 CALL keyword_create(keyword, __location__, name="EPS_FILTER", &
82 description="Threshold for the matrix sparsity filter", &
83 usage="EPS_FILTER 1.e-6", default_r_val=1.e-7_dp)
84 CALL section_add_keyword(section, keyword)
85 CALL keyword_release(keyword)
86
87 CALL keyword_create(keyword, __location__, name="ALMO_SCF_GUESS", &
88 description="The method to generate initial ALMOs.", &
89 usage="ALMO_SCF_GUESS MOLECULAR", &
90 default_i_val=atomic_guess, &
91 enum_c_vals=s2a("MOLECULAR", "ATOMIC"), &
92 enum_desc=s2a("SCF calculations on single molecules controlled by the regular SCF "// &
93 "keywords outside ALMO options. This kind of calculation is expensive "// &
94 "and only recommended if ALMO SCF does not converge from the ATOMIC guess.", &
95 "Superposition of atomic densities."), &
96 enum_i_vals=[molecular_guess, atomic_guess])
97 CALL section_add_keyword(section, keyword)
98 CALL keyword_release(keyword)
99
100 CALL keyword_create(keyword, __location__, name="MO_OVERLAP_INV_ALG", &
101 description="Algorithm to invert MO overlap matrix.", &
102 usage="MO_OVERLAP_INV_ALG LS_HOTELLING", &
103 default_i_val=spd_inversion_ls_hotelling, &
104 enum_c_vals=s2a("LS_HOTELLING", "LS_TAYLOR", "DENSE_CHOLESKY"), &
105 enum_desc=s2a("Linear scaling iterative Hotelling algorithm. Fast for large sparse matrices.", &
106 "Linear scaling algorithm based on Taylor expansion of (A+B)^(-1).", &
107 "Stable but dense Cholesky algorithm. Cubically scaling."), &
109 CALL section_add_keyword(section, keyword)
110 CALL keyword_release(keyword)
111
112 !CALL keyword_create(keyword, __LOCATION__, name="STOP_SCF_EARLY",&
113 ! description="Stops SCF using EPS_ERROR_EARLY or MAX_ITER_EARLY", &
114 ! usage="STOP_SCF_EARLY .TRUE.", default_l_val=.FALSE.,&
115 ! lone_keyword_l_val=.TRUE.)
116 !CALL section_add_keyword(section,keyword)
117 !CALL keyword_release(keyword)
118
119 CALL keyword_create(keyword, __location__, name="ALMO_EXTRAPOLATION_ORDER", &
120 description="Number of previous states used for the ASPC extrapolation of the ALMO "// &
121 "initial guess. 0 implies that the guess is given by ALMO_SCF_GUESS at each step.", &
122 usage="ALMO_EXTRAPOLATION_ORDER 3", default_i_val=3)
123 CALL section_add_keyword(section, keyword)
124 CALL keyword_release(keyword)
125
126 CALL keyword_create(keyword, __location__, name="XALMO_EXTRAPOLATION_ORDER", &
127 description="Number of previous states used for the ASPC extrapolation of the initial guess "// &
128 "for the delocalization correction.", &
129 usage="XALMO_EXTRAPOLATION_ORDER 1", default_i_val=0)
130 CALL section_add_keyword(section, keyword)
131 CALL keyword_release(keyword)
132
133 CALL keyword_create(keyword, __location__, name="ALMO_ALGORITHM", &
134 description="Specifies the algorithm to update block-diagonal ALMOs during the SCF procedure.", &
135 usage="ALMO_ALGORITHM DIAG", &
136 default_i_val=almo_scf_diag, &
137 !enum_c_vals=s2a("DIAG", "DM_SIGN","PCG"),&
138 enum_c_vals=s2a("DIAG", "PCG", "TRUST_REGION", "SKIP"), &
139 enum_desc=s2a("DIIS-accelerated diagonalization controlled by ALMO_OPTIMIZER_DIIS. "// &
140 "Recommended for large systems containing small fragments.", &
141 !"Update the density matrix using linear scaling routines. "//&
142 !"Recommended if large fragments are present.",&
143 "Energy minimization with a PCG algorithm controlled by ALMO_OPTIMIZER_PCG.", &
144 "Trust-region optimizer is recommended if PCG has difficulty converging. "// &
145 "It is controlled by ALMO_OPTIMIZER_TRUSTR", &
146 "Skip optimization of block-diagonal ALMOs."), &
147 !enum_i_vals=(/almo_scf_diag,almo_scf_dm_sign,almo_scf_pcg/),&
149 CALL section_add_keyword(section, keyword)
150 CALL keyword_release(keyword)
151
152 CALL keyword_create(keyword, __location__, name="XALMO_ALGORITHM", &
153 description="Specifies the algorithm to update ALMOs on eXtended domains (XALMOs).", &
154 usage="XALMO_ALGORITHM TRUST_REGION", &
155 default_i_val=almo_scf_pcg, &
156 enum_c_vals=s2a("DIAG", "PCG", "TRUST_REGION"), &
157 enum_desc=s2a("DIIS-accelerated diagonalization.", &
158 "PCG algorithm controlled by XALMO_OPTIMIZER_PCG.", &
159 "Trust-region optimizer controlled by XALMO_OPTIMIZER_TRUSTR"), &
161 CALL section_add_keyword(section, keyword)
162 CALL keyword_release(keyword)
163
164 CALL keyword_create(keyword, __location__, name="XALMO_TRIAL_WF", &
165 description="Determines the form of the trial XALMOs.", &
166 usage="XALMO_TRIAL_WF SIMPLE", &
167 default_i_val=xalmo_trial_r0_out, &
168 enum_c_vals=s2a("SIMPLE", "PROJECT_R0_OUT"), &
169 enum_desc=s2a("Straightforward AO-basis expansion.", &
170 "Block-diagonal ALMOs plus the XALMO term projected onto the unoccupied "// &
171 "ALMO-subspace."), &
173 CALL section_add_keyword(section, keyword)
174 CALL keyword_release(keyword)
175
176 CALL keyword_create( &
177 keyword, __location__, name="DELOCALIZE_METHOD", &
178 description="Methods to reintroduce electron delocalization, which is excluded "// &
179 "with the block-diagonal ALMO reference. Electron delocalization can "// &
180 "be computed using either fully delocalized MOs or spatially restricted "// &
181 "ALMOs (called eXtended ALMOs or XALMOs). All methods below use either a PCG or trust-region "// &
182 "optimizers controlled by XALMO_OPTIMIZER_* subsections. The only exception is "// &
183 "the non-iterative XALMO_1DIAG.", &
184 usage="DELOCALIZE_METHOD XALMO_X", &
185 default_i_val=almo_deloc_xalmo_x, &
186 enum_c_vals=s2a("NONE", "XALMO_1DIAG", "XALMO_X", "XALMO_SCF", "FULL_X", "FULL_SCF", "FULL_X_THEN_SCF"), &
187 enum_desc=s2a("Neglect electron delocalization", &
188 "Correction based on one diagonalization of the spatially projected Hamiltonian (XALMO)", &
189 "Single excitation correction (no Hamiltonian re-build) with spatial restrictions (XALMO)", &
190 "Self-consistent treatment of delocalization with spatial restrictions (XALMO)", &
191 "Single excitation correction (no Hamiltonian re-build) without spatial restrictions", &
192 "Self-consistent treatment of delocalization without spatial restrictions", &
193 "Single excitation correction followed by full SCF procedure, both without spatial restrictions"), &
196 CALL section_add_keyword(section, keyword)
197 CALL keyword_release(keyword)
198
199 CALL keyword_create(keyword, __location__, name="XALMO_R_CUTOFF_FACTOR", &
200 description="Controls the localization radius of XALMOs: "// &
201 !"r0 = r0_factor*(radius(at1)+radius(at2)) + r0_shift",&
202 "R_cutoff = XALMO_R_CUTOFF_FACTOR*(radius(at1)+radius(at2))", &
203 usage="XALMO_R_CUTOFF_FACTOR 1.6", default_r_val=1.50_dp)
204 CALL section_add_keyword(section, keyword)
205 CALL keyword_release(keyword)
206
207 CALL keyword_create(keyword, __location__, name="RETURN_ORTHOGONALIZED_MOS", &
208 description="Orthogonalize final ALMOs before they are returned "// &
209 "to Quickstep (i.e. for calculation of properties)", &
210 usage="RETURN_ORTHOGONALIZED_MOS .TRUE.", default_l_val=.true., &
211 lone_keyword_l_val=.true.)
212 CALL section_add_keyword(section, keyword)
213 CALL keyword_release(keyword)
214
215 CALL keyword_create(keyword, __location__, name="CONSTRUCT_NLMOS", &
216 description="Turns on post-SCF construction of NLMOs", &
217 usage="CONSTRUCT_NLMOS .TRUE.", default_l_val=.false.)
218 CALL section_add_keyword(section, keyword)
219 CALL keyword_release(keyword)
220
221 !CALL keyword_create(keyword, __LOCATION__, name="DOMAIN_LAYOUT_MOS",&
222 ! description="Each electron in the system is constrained to its own delocalization domain."//&
223 ! " This keyword creates groups of electrons that share the same domain.",&
224 ! usage="DOMAIN_LAYOUT_MOS MOLECULAR",&
225 ! default_i_val=almo_domain_layout_molecular,&
226 ! enum_c_vals=s2a( "ORBITAL", "ATOMIC", "MOLECULAR"),&
227 ! enum_desc=s2a("Each electron can have its own delocalization domain",&
228 ! "All electrons of an atom are delocalized over the same domain",&
229 ! "All electrons of a molecule are delocalized over the same domain."//&
230 ! " This is the only implemented option"),&
231 ! enum_i_vals=(/almo_domain_layout_orbital,almo_domain_layout_atomic,almo_domain_layout_molecular/))
232 !CALL section_add_keyword(section,keyword)
233 !CALL keyword_release(keyword)
234
235 !CALL keyword_create(keyword, __LOCATION__, name="DOMAIN_LAYOUT_AOS",&
236 ! description="Atomic orbitals or groups of atomic orbitals represent domains over which electrons "//&
237 ! "can be delocalized. This keyword imposes constraints on the structure of domains",&
238 ! usage="DOMAIN_LAYOUT_MOS MOLECULAR",&
239 ! default_i_val=almo_domain_layout_molecular,&
240 ! enum_c_vals=s2a("ATOMIC", "MOLECULAR"),&
241 ! enum_desc=s2a("Atomic blocks represent domains. That is, if a basis function on an atom is in"//&
242 ! " domain A then all basis functions on this atom are in domain A.",&
243 ! "Molecular subsets represent domains. That is, if a basis function on a molecule is"//&
244 ! " in domain A then all basis functions on this molecule are in domain A. "//&
245 ! "This is the only implemented option"),&
246 ! enum_i_vals=(/almo_domain_layout_atomic,almo_domain_layout_molecular/))
247 !CALL section_add_keyword(section,keyword)
248 !CALL keyword_release(keyword)
249
250 !CALL keyword_create(keyword, __LOCATION__, name="MATRIX_CLUSTERING_MOS",&
251 ! description="Blocks of matrices in the MO basis set are distributed for parallel computations. "//&
252 ! "This keywords specifies the type of matrix blocks.",&
253 ! usage="MATRIX_CLUSTERING_MOS MOLECULAR",&
254 ! default_i_val=almo_mat_distr_molecular,&
255 ! enum_c_vals=s2a("ATOMIC", "MOLECULAR"),&
256 ! enum_desc=s2a("Not recommended. ZZZ Maybe used for the PAO-based methods in the future",&
257 ! "All molecular orbitals of a molecule belong to the same block."),&
258 ! enum_i_vals=(/almo_mat_distr_atomic,almo_mat_distr_molecular/))
259 !CALL section_add_keyword(section,keyword)
260 !CALL keyword_release(keyword)
261
262 !CALL keyword_create(keyword, __LOCATION__, name="MATRIX_CLUSTERING_AOS",&
263 ! description="Blocks of matrices in the AO basis set are distributed for parallel computations."//&
264 ! " This keywords specifies the type of matrix blocks.",&
265 ! usage="MATRIX_CLUSTERING_AOS MOLECULAR",&
266 ! default_i_val=almo_mat_distr_molecular,&
267 ! enum_c_vals=s2a("ATOMIC", "MOLECULAR"),&
268 ! enum_desc=s2a("All atomic orbitals of an atom belong to the "//&
269 ! "same block. Use only if there are very large molecules in the system. "//&
270 ! "ZZZ Maybe used for the PAO-based methods in the future",&
271 ! "All atomic orbitals of a molecule belong to the same block."),&
272 ! enum_i_vals=(/almo_mat_distr_atomic,almo_mat_distr_molecular/))
273 !CALL section_add_keyword(section,keyword)
274 !CALL keyword_release(keyword)
275
276 !CALL keyword_create(keyword, __LOCATION__, name="CONSTRAINT_TYPE",&
277 ! description="Determines the type of ALMO constraints",&
278 ! usage="CONSTRAINT_TYPE BLOCK_DIAGONAL",&
279 ! default_i_val=almo_constraint_block_diagonal,&
280 ! enum_c_vals=s2a("BLOCK_DIAGONAL", "DISTANCE", "AO_OVERLAP"),&
281 ! enum_desc=s2a("MO coefficient matrix is block-diagonal",&
282 ! "MO coefficients are quenched according to the distance criterion",&
283 ! "MO coefficients are quenched according to the AO overlap criterion"),&
284 ! enum_i_vals=(/almo_constraint_block_diagonal,almo_constraint_distance,&
285 ! almo_constraint_ao_overlap/))
286 !CALL section_add_keyword(section,keyword)
287 !CALL keyword_release(keyword)
288
289 !CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_RADIUS_TYPE",&
290 ! description="Determines the type of atomic radii used for imposing the ALMO constraints",&
291 ! usage="QUENCHER_RADIUS_TYPE VDW",&
292 ! default_i_val=do_bondparm_vdw,&
293 ! enum_c_vals=s2a("COVALENT", "VDW"),&
294 ! enum_desc=s2a("Covalent atomic radii",&
295 ! "Van der Waals atomic radii"),&
296 ! enum_i_vals=(/do_bondparm_covalent,do_bondparm_vdw/))
297 !CALL section_add_keyword(section,keyword)
298 !CALL keyword_release(keyword)
299
300 !CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_R0_FACTOR",&
301 ! description="Parameter to calculate the inner soft cutoff radius: "//&
302 ! !"r0 = r0_factor*(radius(at1)+radius(at2)) + r0_shift",&
303 ! "r0 = r0_factor*(radius(at1)+radius(at2))",&
304 ! usage="QUENCHER_R0_FACTOR 1.05", default_r_val=1.05_dp)
305 !CALL section_add_keyword(section,keyword)
306 !CALL keyword_release(keyword)
307
308 !!CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_R0_SHIFT",&
309 !! description="Parameter to calculate the inner soft cutoff radius (in Angstrom): "//&
310 !! "r0 = r0_factor*(radius(at1)+radius(at2)) + r0_shift",&
311 !! usage="QUENCHER_R0_SHIFT 0.0", default_r_val=0.0_dp)
312 !!
313 !!CALL section_add_keyword(section,keyword)
314 !!CALL keyword_release(keyword)
315
316 !CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_R1_FACTOR",&
317 ! description="Parameter to calculate the outer soft cutoff radius: "//&
318 ! !"r1 = r1_factor*(radius(at1)+radius(at2)) + r1_shift",&
319 ! "r1 = r1_factor*(radius(at1)+radius(at2))",&
320 ! usage="QUENCHER_R1_FACTOR 1.55", default_r_val=1.55_dp)
321 !CALL section_add_keyword(section,keyword)
322 !CALL keyword_release(keyword)
323
324 !!CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_R1_SHIFT",&
325 !! description="Parameter to calculate the outer soft cutoff radius (in Angstrom): "//&
326 !! "r1 = r1_factor*(radius(at1)+radius(at2)) + r1_shift",&
327 !! usage="QUENCHER_R1_SHIFT 0.0", default_r_val=0.0_dp)
328 !!
329 !!CALL section_add_keyword(section,keyword)
330 !!CALL keyword_release(keyword)
331
332 !CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_AO_OVERLAP_0",&
333 ! description="Overlap value of the inner soft cutoff",&
334 ! usage="QUENCHER_AO_OVERLAP_0 1.0E-4", default_r_val=1.0E-4_dp)
335 !CALL section_add_keyword(section,keyword)
336 !CALL keyword_release(keyword)
337
338 !CALL keyword_create(keyword, __LOCATION__, name="QUENCHER_AO_OVERLAP_1",&
339 ! description="Overlap value of the outer soft cutoff",&
340 ! usage="QUENCHER_AO_OVERLAP_1 1.0E-6", default_r_val=1.0E-6_dp)
341 !CALL section_add_keyword(section,keyword)
342 !CALL keyword_release(keyword)
343
344 !CALL keyword_create(keyword, __LOCATION__, name="ENVELOPE_AMPLITUDE",&
345 ! description="Defines an upper bound on the maximum norm of the MO coefficients",&
346 ! usage="ENVELOPE_AMPLITUDE 1.0", default_r_val=1.0_dp)
347 !CALL section_add_keyword(section,keyword)
348 !CALL keyword_release(keyword)
349
350 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_TENSOR_TYPE",&
351 ! description="Tensor properties of occupied and virtual indices",&
352 ! usage="DELOC_CAYLEY_TENSOR_TYPE ORTHOGONAL",&
353 ! default_i_val=tensor_orthogonal,&
354 ! enum_c_vals=s2a("ORTHOGONAL", "BIORTHOGONAL"),&
355 ! enum_desc=s2a("Orthogonalize both occupied and virtual orbitals",&
356 ! "Contravariant virtual (MOs or AOs) and covariant occupied orbitals"),&
357 ! enum_i_vals=(/tensor_orthogonal,tensor_up_down/))
358 !CALL section_add_keyword(section,keyword)
359 !CALL keyword_release(keyword)
360
361 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_CONJUGATOR",&
362 ! description="Various methods to compute step directions in the CG algorithm",&
363 ! usage="DELOC_CAYLEY_CONJUGATOR POLAK_RIBIERE",&
364 ! default_i_val=cg_hager_zhang,&
365 ! enum_c_vals=s2a("ZERO", "POLAK_RIBIERE", "FLETCHER_REEVES",&
366 ! "HESTENES_STIEFEL", "FLETCHER", "LIU_STOREY", "DAI_YUAN","HAGER_ZHANG"),&
367 ! enum_desc=s2a("Steepest descent","Polak and Ribiere",&
368 ! "Fletcher and Reeves","Hestenes and Stiefel",&
369 ! "Fletcher (Conjugate descent)","Liu and Storey",&
370 ! "Dai and Yuan","Hager and Zhang"),&
371 ! enum_i_vals=(/cg_zero,cg_polak_ribiere,cg_fletcher_reeves,&
372 ! cg_hestenes_stiefel,cg_fletcher,cg_liu_storey,&
373 ! cg_dai_yuan,cg_hager_zhang/))
374 !CALL section_add_keyword(section,keyword)
375 !CALL keyword_release(keyword)
376
377 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_MAX_ITER",&
378 ! description="Maximum number of CG iterations to solve Ricatti equations",&
379 ! usage="DELOC_CAYLEY_MAX_ITER 100",default_i_val=50)
380 !CALL section_add_keyword(section,keyword)
381 !CALL keyword_release(keyword)
382
383 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_EPS_CONVERGENCE",&
384 ! description="Convergence criterion of the CG algorithm",&
385 ! usage="DELOC_CAYLEY_EPS_CONVERGENCE 1.e-6", default_r_val=1.e-7_dp)
386 !CALL section_add_keyword(section,keyword)
387 !CALL keyword_release(keyword)
388
389 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_VIR_PRECOND",&
390 ! description="Use preconditioner for the virtual subspace",&
391 ! usage="DELOC_CAYLEY_VIR_PRECOND .TRUE.", default_l_val=.TRUE.,&
392 ! lone_keyword_l_val=.TRUE.)
393 !CALL section_add_keyword(section,keyword)
394 !CALL keyword_release(keyword)
395
396 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_OCC_PRECOND",&
397 ! description="Use preconditioner for the occupied subspace",&
398 ! usage="DELOC_CAYLEY_OCC_PRECOND .TRUE.", default_l_val=.TRUE.,&
399 ! lone_keyword_l_val=.TRUE.)
400 !CALL section_add_keyword(section,keyword)
401 !CALL keyword_release(keyword)
402
403 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_TRUNCATE_VIRTUALS",&
404 ! description="Truncation of the virtual subspace",&
405 ! usage="DELOC_TRUNCATE_VIRTUALS MINIMAL",&
406 ! default_i_val=virt_full,&
407 ! enum_c_vals=s2a("FULL", "MINIMAL","OCC_SIZE", "EXACT_NUMBER_PER_DOMAIN"),&
408 ! enum_desc=s2a("Keep all virtual orbitals","Retained virtuals "//&
409 ! "complement occupied orbitals to form the minimal basis set",&
410 ! "Number of virtuals is equal to the number of occupied orbitals",&
411 ! "Specify exact number of virtuals per domain with DELOC_VIRT_PER_DOMAIN"),&
412 ! enum_i_vals=(/virt_full,virt_minimal,virt_occ_size,&
413 ! virt_number/))
414 !CALL section_add_keyword(section,keyword)
415 !CALL keyword_release(keyword)
416
417 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_VIRT_PER_DOMAIN",&
418 ! description="Number of virtual orbitals (per domain, atom or molecule) "//&
419 ! "retained to obtain the delocalization correction",&
420 ! usage="DELOC_VIRT_PER_DOMAIN",default_i_val=-1)
421 !CALL section_add_keyword(section,keyword)
422 !CALL keyword_release(keyword)
423
424 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_USE_OCC_ORBS",&
425 ! description="Use occupied orbitals (as opposed to density matrix) "//&
426 ! "to calculate correction for electron delocalization",&
427 ! usage="DELOC_USE_OCC_ORBS .TRUE.", default_l_val=.TRUE.,&
428 ! lone_keyword_l_val=.TRUE.)
429 !CALL section_add_keyword(section,keyword)
430 !CALL keyword_release(keyword)
431
432 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_USE_VIRT_ORBS",&
433 ! description="Use virtual orbitals (as opposed to the 1-P projector) "//&
434 ! "to calculate correction for electron delocalization. Works only if "//&
435 ! "DELOC_USE_OCC_ORBS is set to TRUE",&
436 ! usage="DELOC_CAYLEY_USE_VIRT_ORBS .TRUE.", default_l_val=.FALSE.,&
437 ! lone_keyword_l_val=.TRUE.)
438 !CALL section_add_keyword(section,keyword)
439 !CALL keyword_release(keyword)
440
441 !CALL keyword_create(keyword, __LOCATION__, name="DELOC_CAYLEY_LINEAR",&
442 ! description="Neglect the quadratic term in the Riccati equations. "//&
443 ! "Equivalent to the first order correction to the occupied orbitals "//&
444 ! "(second order correction to the energy)",&
445 ! usage="DELOC_CAYLEY_LINEAR .FALSE.", default_l_val=.FALSE.,&
446 ! lone_keyword_l_val=.TRUE.)
447 !CALL section_add_keyword(section,keyword)
448 !CALL keyword_release(keyword)
449
450 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_OUTER_MAX_ITER",&
451 ! description="Maximum number of outer loop iterations to optimize retained virtual orbitals",&
452 ! usage="OPT_K_OUTER_MAX_ITER 10",default_i_val=1)
453 !CALL section_add_keyword(section,keyword)
454 !CALL keyword_release(keyword)
455
456 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_MAX_ITER",&
457 ! description="Maximum number of iterations to optimize retained virtual orbitals",&
458 ! usage="OPT_K_MAX_ITER 100",default_i_val=100)
459 !CALL section_add_keyword(section,keyword)
460 !CALL keyword_release(keyword)
461
462 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_EPS_CONVERGENCE",&
463 ! description="Convergence criterion of the optimization algorithm",&
464 ! usage="OPT_K_EPS_CONVERGENCE 1.e-5", default_r_val=1.e-5_dp)
465 !CALL section_add_keyword(section,keyword)
466 !CALL keyword_release(keyword)
467
468 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_TRIAL_STEP_SIZE",&
469 ! description="Size of the trial step along the gradient",&
470 ! usage="OPT_K_TRIAL_STEP_SIZE 0.05", default_r_val=0.05_dp)
471 !CALL section_add_keyword(section,keyword)
472 !CALL keyword_release(keyword)
473
474 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_TRIAL_STEP_SIZE_MULTIPLIER",&
475 ! description="The trial step size is obtained by multiplying the optimal step size "//&
476 ! "from the previous iteration",&
477 ! usage="OPT_K_TRIAL_STEP_SIZE_multiplier 1.0", default_r_val=1.4_dp)
478 !CALL section_add_keyword(section,keyword)
479 !CALL keyword_release(keyword)
480
481 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_CONJ_ITER_START",&
482 ! description="Iteration for switching from the steepest descent algorithm "//&
483 ! "to conjugate gradient",&
484 ! usage="OPT_K_CONJ_ITER_START 5",default_i_val=0)
485 !CALL section_add_keyword(section,keyword)
486 !CALL keyword_release(keyword)
487
488 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_CONJ_ITER_FREQ_RESET",&
489 ! description="Reset frequency of the conjugate gradient direction",&
490 ! usage="OPT_K_CONJ_ITER_FREQ_RESET 20",default_i_val=1000000)
491 !CALL section_add_keyword(section,keyword)
492 !CALL keyword_release(keyword)
493
494 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_CONJUGATOR",&
495 ! description="Various methods to compute step directions in the CG algorithm",&
496 ! usage="OPT_K_CONJUGATOR POLAK_RIBIERE",&
497 ! default_i_val=cg_hager_zhang,&
498 ! enum_c_vals=s2a("ZERO", "POLAK_RIBIERE", "FLETCHER_REEVES",&
499 ! "HESTENES_STIEFEL", "FLETCHER", "LIU_STOREY", "DAI_YUAN","HAGER_ZHANG"),&
500 ! enum_desc=s2a("Steepest descent","Polak and Ribiere",&
501 ! "Fletcher and Reeves","Hestenes and Stiefel",&
502 ! "Fletcher (Conjugate descent)","Liu and Storey",&
503 ! "Dai and Yuan","Hager and Zhang"),&
504 ! enum_i_vals=(/cg_zero,cg_polak_ribiere,cg_fletcher_reeves,&
505 ! cg_hestenes_stiefel,cg_fletcher,cg_liu_storey,&
506 ! cg_dai_yuan,cg_hager_zhang/))
507 !CALL section_add_keyword(section,keyword)
508 !CALL keyword_release(keyword)
509
510 !CALL keyword_create(keyword, __LOCATION__, name="OPT_K_PREC_ITER_START",&
511 ! description="Start using the preconditioner (approximate preconditioners "//&
512 ! "might not be valid on early iterations)",&
513 ! usage="OPT_K_PREC_ITER_START 2",default_i_val=0)
514 !CALL section_add_keyword(section,keyword)
515 !CALL keyword_release(keyword)
516
517 NULLIFY (subsection)
518 CALL create_almo_fragment_section(subsection)
519 CALL section_add_subsection(section, subsection)
520 CALL section_release(subsection)
521
522 NULLIFY (subsection)
523 CALL create_optimizer_section(subsection, optimizer_block_diagonal_diis)
524 CALL section_add_subsection(section, subsection)
525 CALL section_release(subsection)
526
527 NULLIFY (subsection)
528 CALL create_optimizer_section(subsection, optimizer_block_diagonal_pcg)
529 CALL section_add_subsection(section, subsection)
530 CALL section_release(subsection)
531
532 NULLIFY (subsection)
533 CALL create_optimizer_section(subsection, optimizer_block_diagonal_trustr)
534 CALL section_add_subsection(section, subsection)
535 CALL section_release(subsection)
536
537 NULLIFY (subsection)
538 CALL create_optimizer_section(subsection, optimizer_xalmo_pcg)
539 CALL section_add_subsection(section, subsection)
540 CALL section_release(subsection)
541
542 NULLIFY (subsection)
543 CALL create_optimizer_section(subsection, optimizer_xalmo_trustr)
544 CALL section_add_subsection(section, subsection)
545 CALL section_release(subsection)
546
547 NULLIFY (subsection)
548 CALL create_optimizer_section(subsection, optimizer_nlmo_pcg)
549 CALL section_add_subsection(section, subsection)
550 CALL section_release(subsection)
551
552 NULLIFY (subsection)
553 CALL create_matrix_iterate_section(subsection)
554 CALL section_add_subsection(section, subsection)
555 CALL section_release(subsection)
556
557 NULLIFY (subsection)
558 CALL create_almo_analysis_section(subsection)
559 CALL section_add_subsection(section, subsection)
560 CALL section_release(subsection)
561
562 END SUBROUTINE create_almo_scf_section
563
564! **************************************************************************************************
565!> \brief The optimizer section is a collection of keywords that are similar
566!> to all optimization methods (e.g. target error, number of iterations)
567!> \param section ...
568!> \param optimizer_id allows to adapt the standard section for specific needs
569!> \par History
570!> 2012.03 created [Rustam Z Khaliullin]
571!> 2014.10 fully integrated [Rustam Z Khaliullin]
572!> \author Rustam Z Khaliullin
573! **************************************************************************************************
574 RECURSIVE SUBROUTINE create_optimizer_section(section, optimizer_id)
575
576 TYPE(section_type), POINTER :: section
577 INTEGER, INTENT(IN) :: optimizer_id
578
579 INTEGER :: optimizer_type
580 TYPE(keyword_type), POINTER :: keyword
581 TYPE(section_type), POINTER :: subsection
582
583 cpassert(.NOT. ASSOCIATED(section))
584 NULLIFY (section)
585
586 ! choose the name of the section
587 SELECT CASE (optimizer_id)
588 CASE (optimizer_block_diagonal_diis)
589 CALL section_create(section, __location__, name="ALMO_OPTIMIZER_DIIS", &
590 description="Controls the iterative DIIS-accelerated optimization of block-diagonal ALMOs.", &
591 n_keywords=5, n_subsections=0, repeats=.false.)
592 optimizer_type = optimizer_diis
593 CASE (optimizer_block_diagonal_pcg)
594 CALL section_create(section, __location__, name="ALMO_OPTIMIZER_PCG", &
595 description="Controls the PCG optimization of block-diagonal ALMOs.", &
596 n_keywords=9, n_subsections=1, repeats=.false.)
597 optimizer_type = optimizer_pcg
598 CASE (optimizer_nlmo_pcg)
599 CALL section_create(section, __location__, name="NLMO_OPTIMIZER_PCG", &
600 description="Controls the PCG optimization of nonorthogonal localized MOs.", &
601 n_keywords=9, n_subsections=1, repeats=.false.)
602 optimizer_type = optimizer_pcg
603 NULLIFY (subsection)
604 CALL create_penalty_section(subsection)
605 CALL section_add_subsection(section, subsection)
606 CALL section_release(subsection)
607 CASE (optimizer_xalmo_pcg)
608 CALL section_create(section, __location__, name="XALMO_OPTIMIZER_PCG", &
609 description="Controls the PCG optimization of extended ALMOs.", &
610 n_keywords=10, n_subsections=2, repeats=.false.)
611 NULLIFY (subsection)
612 CALL create_optimizer_section(subsection, optimizer_newton_pcg_solver)
613 CALL section_add_subsection(section, subsection)
614 CALL section_release(subsection)
615 optimizer_type = optimizer_pcg
616 CASE (optimizer_xalmo_trustr)
617 CALL section_create(section, __location__, name="XALMO_OPTIMIZER_TRUSTR", &
618 description="Controls the trust-region optimization of extended ALMOs. "// &
619 "Trust radius is varied in the outer loop. Once the trust radius is "// &
620 "chosen (and fixed) the model function can be minized using various "// &
621 "approaches. Currently, an iterative conjugate-gradient approach is "// &
622 "used and controlled by the inner loop", &
623 n_keywords=10, n_subsections=0, repeats=.false.)
624 optimizer_type = optimizer_trustr
625 CASE (optimizer_block_diagonal_trustr)
626 CALL section_create(section, __location__, name="ALMO_OPTIMIZER_TRUSTR", &
627 description="Controls the trust-region optimization of block-diagonal ALMOs. "// &
628 "See XALMO_OPTIMIZER_TRUSTR section for brief explanations.", &
629 n_keywords=10, n_subsections=0, repeats=.false.)
630 optimizer_type = optimizer_trustr
631 CASE (optimizer_newton_pcg_solver)
632 CALL section_create(section, __location__, name="XALMO_NEWTON_PCG_SOLVER", &
633 description="Controls an iterative solver of the Newton-Raphson linear equation.", &
634 n_keywords=4, n_subsections=0, repeats=.false.)
635 optimizer_type = optimizer_lin_eq_pcg
636 CASE DEFAULT
637 cpabort("No default values allowed")
638 END SELECT
639
640 NULLIFY (keyword)
641
642 ! add common keywords
643 CALL keyword_create(keyword, __location__, name="MAX_ITER", &
644 description="Maximum number of iterations", &
645 usage="MAX_ITER 100", default_i_val=20)
646 CALL section_add_keyword(section, keyword)
647 CALL keyword_release(keyword)
648
649 CALL keyword_create(keyword, __location__, name="EPS_ERROR", &
650 description="Target value of the MAX norm of the error", &
651 usage="EPS_ERROR 1.E-6", default_r_val=1.0e-5_dp)
652 CALL section_add_keyword(section, keyword)
653 CALL keyword_release(keyword)
654
655 ! add common keywords
656 CALL keyword_create(keyword, __location__, name="MAX_ITER_EARLY", &
657 description="Maximum number of iterations for truncated SCF "// &
658 "(e.g. Langevin-corrected MD). Negative values mean that this keyword is not used.", &
659 usage="MAX_ITER_EARLY 5", default_i_val=-1)
660 CALL section_add_keyword(section, keyword)
661 CALL keyword_release(keyword)
662
663 CALL keyword_create(keyword, __location__, name="EPS_ERROR_EARLY", &
664 description="Target value of the MAX norm of the error for truncated SCF "// &
665 "(e.g. Langevin-corrected MD). Negative values mean that this keyword is not used.", &
666 usage="EPS_ERROR_EARLY 1.E-2", default_r_val=-1.0_dp)
667 CALL section_add_keyword(section, keyword)
668 CALL keyword_release(keyword)
669
670 ! add keywords specific to each type
671 IF (optimizer_type == optimizer_diis) THEN
672
673 CALL keyword_create(keyword, __location__, name="N_DIIS", &
674 description="Number of error vectors to be used in the DIIS "// &
675 "optimization procedure", &
676 usage="N_DIIS 5", default_i_val=6)
677 CALL section_add_keyword(section, keyword)
678 CALL keyword_release(keyword)
679
680 END IF
681
682 IF (optimizer_type == optimizer_pcg .OR. &
683 optimizer_type == optimizer_lin_eq_pcg .OR. &
684 optimizer_type == optimizer_trustr) THEN
685
686 CALL keyword_create(keyword, __location__, name="MAX_ITER_OUTER_LOOP", &
687 description="Maximum number of iterations in the outer loop. "// &
688 "Use the outer loop to update the preconditioner and reset the conjugator. "// &
689 "This can speed up convergence significantly.", &
690 usage="MAX_ITER_OUTER_LOOP 10", default_i_val=0)
691 CALL section_add_keyword(section, keyword)
692 CALL keyword_release(keyword)
693
694 CALL keyword_create(keyword, __location__, name="PRECONDITIONER", &
695 description="Select a preconditioner for the conjugate gradient optimization", &
696 usage="PRECONDITIONER DOMAIN", &
697 default_i_val=xalmo_prec_domain, &
698 enum_c_vals=s2a("NONE", "DEFAULT", "DOMAIN", "FULL"), &
699 enum_desc=s2a("Do not use preconditioner", &
700 "Same as DOMAIN preconditioner", &
701 "Invert preconditioner domain-by-domain."// &
702 " The main component of the linear scaling algorithm", &
703 "Solve linear equations step=-H.grad on the entire space"), &
704 enum_i_vals=[xalmo_prec_zero, xalmo_prec_domain, &
706 CALL section_add_keyword(section, keyword)
707 CALL keyword_release(keyword)
708
709 END IF
710
711 IF (optimizer_type == optimizer_pcg) THEN
712
713 CALL keyword_create(keyword, __location__, name="LIN_SEARCH_EPS_ERROR", &
714 description="Target value of the gradient norm during the linear search", &
715 usage="LIN_SEARCH_EPS_ERROR 1.E-2", default_r_val=1.0e-3_dp)
716 CALL section_add_keyword(section, keyword)
717 CALL keyword_release(keyword)
718
719 CALL keyword_create(keyword, __location__, name="LIN_SEARCH_STEP_SIZE_GUESS", &
720 description="The size of the first step in the linear search", &
721 usage="LIN_SEARCH_STEP_SIZE_GUESS 0.1", default_r_val=1.0_dp)
722 CALL section_add_keyword(section, keyword)
723 CALL keyword_release(keyword)
724
725 CALL keyword_create(keyword, __location__, name="PRECOND_FILTER_THRESHOLD", &
726 description="Select eigenvalues of the preconditioner "// &
727 "that are smaller than the threshold and project out the "// &
728 "corresponding eigenvectors from the gradient. No matter "// &
729 "how large the threshold is the maximum number of projected "// &
730 "eienvectors for a fragment equals to the number of occupied "// &
731 "orbitals of fragment's neighbors.", &
732 usage="PRECOND_FILTER_THRESHOLD 0.1", default_r_val=-1.0_dp)
733 CALL section_add_keyword(section, keyword)
734 CALL keyword_release(keyword)
735
736 END IF
737
738 IF (optimizer_type == optimizer_pcg .OR. &
739 optimizer_type == optimizer_trustr) THEN
740
741 CALL keyword_create(keyword, __location__, name="CONJUGATOR", &
742 description="Various methods to compute step directions in the PCG optimization", &
743 usage="CONJUGATOR POLAK_RIBIERE", &
744 default_i_val=cg_hager_zhang, &
745 enum_c_vals=s2a("ZERO", "POLAK_RIBIERE", "FLETCHER_REEVES", &
746 "HESTENES_STIEFEL", "FLETCHER", "LIU_STOREY", "DAI_YUAN", "HAGER_ZHANG"), &
747 enum_desc=s2a("Steepest descent", "Polak and Ribiere", &
748 "Fletcher and Reeves", "Hestenes and Stiefel", &
749 "Fletcher (Conjugate descent)", "Liu and Storey", &
750 "Dai and Yuan", "Hager and Zhang"), &
754 CALL section_add_keyword(section, keyword)
755 CALL keyword_release(keyword)
756
757 END IF
758
759 IF (optimizer_type == optimizer_trustr) THEN
760
761 CALL keyword_create(keyword, __location__, name="ALGORITHM", &
762 description="Selects an algorithm to solve the fixed-radius subproblem", &
763 usage="ALGORITHM CG", &
764 default_i_val=trustr_cauchy, &
765 enum_c_vals=s2a("CG", "CAUCHY", "DOGLEG"), &
766 enum_desc=s2a("Steihaug's iterative CG algorithm that does not invert model Hessian", &
767 "Compute simple Cauchy point", &
768 "Dogleg optimizer"), &
770 CALL section_add_keyword(section, keyword)
771 CALL keyword_release(keyword)
772
773 CALL keyword_create(keyword, __location__, name="ETA", &
774 description="Must be between 0.0 and 0.25. Rho value below which the "// &
775 "optimization of the model function is not accepted and the "// &
776 "optimization is restarted from the same point but decreased "// &
777 "trust radius. Rho is the ratio of the actual over predicted "// &
778 "change in the objective function", &
779 usage="ETA 0.1", default_r_val=0.25_dp)
780 CALL section_add_keyword(section, keyword)
781 CALL keyword_release(keyword)
782
783 CALL keyword_create(keyword, __location__, name="MODEL_GRAD_NORM_RATIO", &
784 description="Stop the fixed-trust-radius (inner) loop optimization "// &
785 "once the ratio of the current norm of the model gradient over the "// &
786 "initial norm drops below this threshold", &
787 usage="MODEL_GRAD_NORM_RATIO 1.E-2", default_r_val=0.01_dp)
788 CALL section_add_keyword(section, keyword)
789 CALL keyword_release(keyword)
790
791 CALL keyword_create(keyword, __location__, name="INITIAL_TRUST_RADIUS", &
792 description="Initial trust radius", &
793 usage="INITIAL_TRUST_RADIUS 0.1", default_r_val=0.1_dp)
794 CALL section_add_keyword(section, keyword)
795 CALL keyword_release(keyword)
796
797 CALL keyword_create(keyword, __location__, name="MAX_TRUST_RADIUS", &
798 description="Maximum allowed trust radius", &
799 usage="MAX_TRUST_RADIUS 1.0", default_r_val=2.0_dp)
800 CALL section_add_keyword(section, keyword)
801 CALL keyword_release(keyword)
802
803 END IF
804
805 END SUBROUTINE create_optimizer_section
806
807! **************************************************************************************************
808!> \brief The section controls iterative matrix operations like SQRT or inverse
809!> \param section ...
810!> \par History
811!> 2017.05 created [Rustam Z Khaliullin]
812!> \author Rustam Z Khaliullin
813! **************************************************************************************************
814 SUBROUTINE create_matrix_iterate_section(section)
815
816 TYPE(section_type), POINTER :: section
817
818 TYPE(keyword_type), POINTER :: keyword
819
820 cpassert(.NOT. ASSOCIATED(section))
821 NULLIFY (section)
822
823 CALL section_create(section, __location__, name="MATRIX_ITERATE", &
824 description="Controls linear scaling iterative procedure on matrices: inversion, sqrti, etc. "// &
825 "High-order Lanczos accelerates convergence provided it can estimate the eigenspectrum correctly.", &
826 n_keywords=4, n_subsections=0, repeats=.false.)
827
828 NULLIFY (keyword)
829
830 CALL keyword_create(keyword, __location__, name="EPS_TARGET_FACTOR", &
831 description="Multiplication factor that determines acceptable error in the iterative procedure. "// &
832 "Acceptable error = EPS_TARGET_FACTOR * EPS_FILTER", &
833 usage="EPS_TARGET_FACTOR 100.0", default_r_val=10.0_dp)
834 CALL section_add_keyword(section, keyword)
835 CALL keyword_release(keyword)
836
837 CALL keyword_create(keyword, __location__, name="EPS_LANCZOS", &
838 description="Threshold for Lanczos eigenvalue estimation.", &
839 usage="EPS_LANCZOS 1.0E-4", default_r_val=1.0e-3_dp)
840 CALL section_add_keyword(section, keyword)
841 CALL keyword_release(keyword)
842
843 CALL keyword_create(keyword, __location__, name="ORDER_LANCZOS", &
844 description="Order of the Lanczos estimator. Use 0 to turn off. Do not use 1.", &
845 usage="ORDER_LANCZOS 5", default_i_val=3)
846 CALL section_add_keyword(section, keyword)
847 CALL keyword_release(keyword)
848
849 CALL keyword_create(keyword, __location__, name="MAX_ITER_LANCZOS", &
850 description="Maximum number of Lanczos iterations.", &
851 usage="MAX_ITER_LANCZOS 64", default_i_val=128)
852 CALL section_add_keyword(section, keyword)
853 CALL keyword_release(keyword)
854
855 END SUBROUTINE create_matrix_iterate_section
856
857! **************************************************************************************************
858!> \brief The section controls penalty methods
859!> \param section ...
860!> \par History
861!> 2018.01 created [Rustam Z Khaliullin]
862!> \author Rustam Z Khaliullin
863! **************************************************************************************************
864 SUBROUTINE create_penalty_section(section)
865
866 TYPE(section_type), POINTER :: section
867
868 TYPE(keyword_type), POINTER :: keyword
869
870 cpassert(.NOT. ASSOCIATED(section))
871 NULLIFY (section)
872
873 CALL section_create(section, __location__, name="PENALTY", &
874 description="Add penalty terms to the energy functional.", &
875 n_keywords=3, n_subsections=0, repeats=.false.)
876
877 NULLIFY (keyword)
878
879 CALL keyword_create( &
880 keyword, __location__, name="OPERATOR", &
881 description="Type of opertator which defines the spread functional", &
882 usage="OPERATOR PIPEK", &
883 enum_c_vals=s2a("BERRY", "PIPEK"), &
884 enum_i_vals=[op_loc_berry, op_loc_pipek], &
885 default_i_val=op_loc_berry)
886 CALL section_add_keyword(section, keyword)
887 CALL keyword_release(keyword)
888
889 CALL keyword_create(keyword, __location__, name="PENALTY_STRENGTH", &
890 description="Strength of the orthogonalization penalty", &
891 usage="PENALTY_STRENGTH 1.1", default_r_val=1.1_dp)
892 CALL section_add_keyword(section, keyword)
893 CALL keyword_release(keyword)
894
895 CALL keyword_create(keyword, __location__, name="PENALTY_STRENGTH_DECREASE_FACTOR", &
896 description="Factor that decreases the strength of the orthogonalization penalty.", &
897 usage="PENALTY_STRENGTH_DECREASE_FACTOR 1.1", default_r_val=1.1_dp)
898 CALL section_add_keyword(section, keyword)
899 CALL keyword_release(keyword)
900
901 CALL keyword_create(keyword, __location__, name="DETERMINANT_TOLERANCE", &
902 description="Stop the optimization of the penalty strength if the determinant of the overlap "// &
903 "changes less than this tolerance threshold.", &
904 usage="DETERMINANT_TOLERANCE 1.0E-4", default_r_val=1.0e-3_dp)
905 CALL section_add_keyword(section, keyword)
906 CALL keyword_release(keyword)
907
908 CALL keyword_create(keyword, __location__, name="FINAL_DETERMINANT", &
909 description="The final determinant that obtained after optimization.", &
910 usage="FINAL_DETERMINANT 0.1", default_r_val=0.1_dp)
911 CALL section_add_keyword(section, keyword)
912 CALL keyword_release(keyword)
913
914 CALL keyword_create(keyword, __location__, name="COMPACTIFICATION_FILTER_START", &
915 description="Set orbital coefficients with absolute value smaller than this value to zero.", &
916 usage="COMPACTIFICATION_FILTER_START 1.e-6", default_r_val=-1.0_dp)
917 CALL section_add_keyword(section, keyword)
918 CALL keyword_release(keyword)
919
920 CALL keyword_create(keyword, __location__, name="VIRTUAL_NLMOS", &
921 description="Localize virtual oribtals", &
922 usage="VIRTUAL_NLMOS .TRUE.", default_l_val=.false.)
923 CALL section_add_keyword(section, keyword)
924 CALL keyword_release(keyword)
925
926 END SUBROUTINE create_penalty_section
927
928! **************************************************************************************************
929!> \brief The section controls electronic structure analysis based on ALMOs
930!> \param section ...
931!> \par History
932!> 2014.10 created [Rustam Z Khaliullin]
933!> \author Rustam Z Khaliullin
934! **************************************************************************************************
935 SUBROUTINE create_almo_analysis_section(section)
936
937 TYPE(section_type), POINTER :: section
938
939 TYPE(keyword_type), POINTER :: keyword
940 TYPE(section_type), POINTER :: subsection
941
942 cpassert(.NOT. ASSOCIATED(section))
943 NULLIFY (section)
944
945 CALL section_create(section, __location__, name="ANALYSIS", &
946 description="Controls electronic structure analysis based on ALMOs and XALMOs.", &
947 n_keywords=2, n_subsections=1, repeats=.false., &
948 citations=[khaliullin2007, khaliullin2008])
949
950 NULLIFY (keyword)
951
952 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
953 description="Activation of ALMO-based electronic structure analysis.", &
954 usage="&ANALYSIS T", &
955 default_l_val=.false., &
956 lone_keyword_l_val=.true.)
957 CALL section_add_keyword(section, keyword)
958 CALL keyword_release(keyword)
959
960 CALL keyword_create(keyword, __location__, name="FROZEN_MO_ENERGY_TERM", &
961 description="Perform calculations on single molecules to compute the frozen density term", &
962 usage="FROZEN_MO_ENERGY_TERM SUBLATTICE", default_i_val=almo_frz_none, &
963 !enum_c_vals=s2a("SKIP", "ISOLATED", "SUBLATTICE"),&
964 enum_c_vals=s2a("SKIP", "SUBLATTICE"), &
965 enum_desc=s2a("Do not compute the frozen MO energy term.", &
966 !"Use isolated gas-phase molecules as the reference.",&
967 "Use energies of single molecules in their positions in the crystal "// &
968 "cell as the reference. "// &
969 "This term does not have an interpretation if fragmetns are charged."), &
970 enum_i_vals=[almo_frz_none, &
971 !almo_frz_isolated,&
973 CALL section_add_keyword(section, keyword)
974 CALL keyword_release(keyword)
975
976 NULLIFY (subsection)
977 CALL create_almo_print_section(subsection)
978 CALL section_add_subsection(section, subsection)
979 CALL section_release(subsection)
980
981 END SUBROUTINE create_almo_analysis_section
982
983! **************************************************************************************************
984!> \brief The section controls electronic structure of the different fragments
985!> \param section ...
986!> \par History
987!> 2024.02 created [Raphael Rullan]
988!> \author Raphael Rullan
989! **************************************************************************************************
990 SUBROUTINE create_almo_fragment_section(section)
991
992 TYPE(section_type), POINTER :: section
993
994 TYPE(keyword_type), POINTER :: keyword
995
996 cpassert(.NOT. ASSOCIATED(section))
997 NULLIFY (section)
998
999 CALL section_create(section, __location__, name="FRAGMENT", &
1000 description="Specifies the caracteristics of "// &
1001 "each fragments.", &
1002 n_keywords=3, n_subsections=0, repeats=.true.)
1003 NULLIFY (keyword)
1004
1005 CALL keyword_create(keyword, __location__, name="_FRAGMENT_PARAMETERS_", &
1006 description="Defines the index of the fragment.", &
1007 usage="_FRAGMENT_PARAMETERS_ <INTEGER>", n_var=1, default_i_val=0)
1008 CALL section_add_keyword(section, keyword)
1009 CALL keyword_release(keyword)
1010
1011 CALL keyword_create(keyword, __location__, name="CHARGE", &
1012 description="Specifies the charge of a fragment.", &
1013 usage="CHARGE 1", default_i_val=0)
1014 CALL section_add_keyword(section, keyword)
1015 CALL keyword_release(keyword)
1016
1017 CALL keyword_create(keyword, __location__, &
1018 name="MULTIPLICITY", &
1019 variants=["MULTIP"], &
1020 description="Specifies for each fragment the multiplicity. Two times the total spin plus one. "// &
1021 "Specify 3 for a triplet, 4 for a quartet,and so on. Default is 1 (singlet) for an "// &
1022 "even number and 2 (doublet) for an odd number of electrons.", &
1023 usage="MULTIPLICITY 3", &
1024 default_i_val=1) ! this default value is just a flag to get the above
1025 CALL section_add_keyword(section, keyword)
1026 CALL keyword_release(keyword)
1027
1028 END SUBROUTINE create_almo_fragment_section
1029
1030! *****************************************************************************
1031!> \brief Create a section with all print keys for ALMO methods
1032!> \param section ...
1033!> \par History
1034!> 2016.05 created [Rustam Z Khaliullin]
1035!> \author Rustam Z Khaliullin
1036! **************************************************************************************************
1037 SUBROUTINE create_almo_print_section(section)
1038
1039 TYPE(section_type), POINTER :: section
1040
1041 TYPE(section_type), POINTER :: print_key
1042
1043 cpassert(.NOT. ASSOCIATED(section))
1044 NULLIFY (section, print_key)
1045
1046 CALL section_create(section, __location__, name="PRINT", &
1047 description="Controls printing of detailed ALMO decomosition analysis results", &
1048 n_keywords=0, n_subsections=2, repeats=.true.)
1049
1050 ! create print keys within this subsection
1051 CALL cp_print_key_section_create(print_key, __location__, "ALMO_EDA_CT", &
1052 description="Controls printing of the electron transfer terms in "// &
1053 "ALMO energy decomposition analysis. "// &
1054 "File format: first column is the index of the electron acceptor "// &
1055 "fragment, second -- is the index of the electron donor fragment, "// &
1056 "third - the energy change (a.u.) associated with the electron transfer.", &
1057 print_level=low_print_level, common_iter_levels=1, &
1058 filename="EDA")
1059 CALL section_add_subsection(section, print_key)
1060 CALL section_release(print_key)
1061
1062 CALL cp_print_key_section_create(print_key, __location__, "ALMO_CTA", &
1063 description="Controls printing of the electron transfer terms in "// &
1064 "ALMO charge transfer analysis. "// &
1065 "File format: first column is the index of the electron acceptor "// &
1066 "fragment, second -- is the index of the electron donor fragment, "// &
1067 "third - the change (a.u.) transferred between the two fragments.", &
1068 print_level=low_print_level, common_iter_levels=1, &
1069 filename="CTA")
1070 CALL section_add_subsection(section, print_key)
1071 CALL section_release(print_key)
1072
1073 END SUBROUTINE create_almo_print_section
1074
1075END MODULE input_cp2k_almo
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public scheiber2018
integer, save, public khaliullin2008
integer, save, public khaliullin2007
integer, save, public khaliullin2013
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public low_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
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public op_loc_pipek
integer, parameter, public xalmo_trial_r0_out
integer, parameter, public molecular_guess
integer, parameter, public almo_deloc_scf
integer, parameter, public spd_inversion_dense_cholesky
integer, parameter, public cg_hestenes_stiefel
integer, parameter, public op_loc_berry
integer, parameter, public atomic_guess
integer, parameter, public trustr_dogleg
integer, parameter, public almo_scf_diag
integer, parameter, public optimizer_diis
integer, parameter, public almo_frz_crystal
integer, parameter, public almo_scf_skip
integer, parameter, public xalmo_trial_simplex
integer, parameter, public cg_fletcher
integer, parameter, public cg_fletcher_reeves
integer, parameter, public xalmo_prec_domain
integer, parameter, public optimizer_lin_eq_pcg
integer, parameter, public almo_deloc_xalmo_x
integer, parameter, public almo_frz_none
integer, parameter, public almo_scf_trustr
integer, parameter, public almo_deloc_x
integer, parameter, public almo_scf_pcg
integer, parameter, public trustr_cauchy
integer, parameter, public almo_deloc_xalmo_scf
integer, parameter, public spd_inversion_ls_taylor
integer, parameter, public cg_dai_yuan
integer, parameter, public cg_liu_storey
integer, parameter, public almo_deloc_xalmo_1diag
integer, parameter, public trustr_steihaug
integer, parameter, public xalmo_prec_zero
integer, parameter, public almo_deloc_none
integer, parameter, public spd_inversion_ls_hotelling
integer, parameter, public cg_hager_zhang
integer, parameter, public optimizer_trustr
integer, parameter, public almo_deloc_x_then_scf
integer, parameter, public optimizer_pcg
integer, parameter, public cg_zero
integer, parameter, public cg_polak_ribiere
integer, parameter, public xalmo_prec_full
input for the ALMO SCF section
subroutine, public create_almo_scf_section(section)
create the almo scf section
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations, deprecation_notice)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
subroutine, public section_add_subsection(section, subsection)
adds a subsection to the given section
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file