(git:c28f603)
Loading...
Searching...
No Matches
almo_scf_types.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 Types for all ALMO-based methods
10!> \par History
11!> 2011.05 created [Rustam Z Khaliullin]
12!> 2018.09 smearing support [Ruben Staub]
13!> \author Rustam Z Khaliullin
14! **************************************************************************************************
17 USE cp_dbcsr_api, ONLY: dbcsr_release,&
21 USE input_constants, ONLY: &
26 USE kinds, ONLY: dp
28#include "./base/base_uses.f90"
29
30 IMPLICIT NONE
31
32 PRIVATE
33
34 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'almo_scf_types'
35
36 INTEGER, PARAMETER, PUBLIC :: almo_mat_dim_aobasis = 1, &
37 almo_mat_dim_occ = 2, &
42 REAL(kind=dp), PARAMETER, PUBLIC :: almo_max_cutoff_multiplier = 2.2_dp
43
47
48 ! methods that add penalty terms to the energy functional
49 TYPE penalty_type
50
51 REAL(kind=dp) :: final_determinant = 0.0_dp, penalty_strength = 0.0_dp, &
52 determinant_tolerance = 0.0_dp, penalty_strength_dec_factor = 0.0_dp, &
53 compactification_filter_start = 0.0_dp
54 INTEGER :: operator_type = 0
55 LOGICAL :: virtual_nlmos = .false.
56
57 END TYPE penalty_type
58
59 TYPE fragment_type
60
61 INTEGER :: fragment_parameters = 0, charge = 0, multiplicity = 1
62
63 END TYPE fragment_type
64
65 ! almo-based electronic structure analysis
66 TYPE almo_analysis_type
67
68 ! switch analysis on/off
69 LOGICAL :: do_analysis = .false.
70
71 INTEGER :: frozen_mo_energy_term = 0
72
73 END TYPE almo_analysis_type
74
76
77 REAL(kind=dp) :: eps_error = 0.0_dp, &
78 eps_error_early = 0.0_dp, &
79 lin_search_eps_error = 0.0_dp, &
80 lin_search_step_size_guess = 0.0_dp, &
81 rho_do_not_update = 0.0_dp, &
82 model_grad_norm_ratio = 0.0_dp, &
83 initial_trust_radius = 0.0_dp, &
84 max_trust_radius = 0.0_dp, &
85 neglect_threshold = 0.0_dp
86
87 INTEGER :: optimizer_type = 0 ! diis, pcg, etc.
88 TYPE(penalty_type) :: opt_penalty = penalty_type()
89
90 INTEGER :: preconditioner = 0, & ! preconditioner type
91 conjugator = 0, & ! conjugator type
92 max_iter = 0, &
93 max_iter_early = 0, &
94 max_iter_outer_loop = 0, &
95 trustr_algorithm = 0, &
96 ndiis = 0 ! diis history length
97
98 LOGICAL :: early_stopping_on = .false.
99
101
103 INTEGER :: istore = 0, nstore = 0
104 TYPE(dbcsr_type), DIMENSION(:, :), ALLOCATABLE :: matrix_p_up_down
105 !TYPE(dbcsr_type), DIMENSION(:, :), ALLOCATABLE :: matrix_x
106 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_t
107 END TYPE almo_scf_history_type
108
109 ! the structure contains general info about the system
111
112 TYPE(mp_para_env_type), POINTER :: para_env => null()
113 TYPE(cp_blacs_env_type), POINTER :: blacs_env => null()
114
115 INTEGER :: nspins = 0, nelectrons_total = 0, naos = 0
116 INTEGER :: natoms = 0, nmolecules = 0
117 INTEGER, DIMENSION(2) :: nelectrons_spin = 0
118
119 ! Definitions:
120 ! I. Domain - a subset of basis functions (e.g. AOs),
121 ! II. Group - a subset of electrons delocalized within a domain.
122 !
123 ! The following variables specify the group-domain structure
124 ! of the system. Several rules must be obeyed:
125 ! 1. There should be no zero domains (i.e. domain contains at least one AO).
126 ! 2. There should be no empty domains (i.e. all domains must be populated
127 ! by at least one electron).
128 ! 3. If two groups are localized within the same domain they are combined
129 ! It follows that the number of domains is equal to the number of groups
130 !
131 ! Number of domains
132 INTEGER :: ndomains = 0
133
134 ! List of atoms, whose basis functions are included into the domain.
135 ! It is assumed that:
136 ! (a) basis functions are localized and atom-labeled,
137 ! (b) basis functions are grouped into atomic sets (i.e. if a basis
138 ! function on an atom is in domain A then all basis functions on
139 ! this atom are in domain A)
140 !TYPE(domain_list_type), DIMENSION(:), ALLOCATABLE :: atom_list_of_domain
141 ! List of basis functions included into the domain
142 !TYPE(domain_list_type), DIMENSION(:), ALLOCATABLE :: basis_list_of_domain
143
144 ! Number of electrons of each spin for a given domain (second dim is spin).
145 ! Note that some domains can be populated only with alpha or beta electrons.
146 INTEGER, DIMENSION(:, :), ALLOCATABLE :: nocc_of_domain
147 ! Number of basis functions for a given domain
148 INTEGER, DIMENSION(:), ALLOCATABLE :: nbasis_of_domain
149 ! Define number of virtuals for a given domain: nvirt = nbasis - nocc
150 INTEGER, DIMENSION(:, :), ALLOCATABLE :: nvirt_full_of_domain
151 ! Define the dimension of truncated virtual subspace for a given domain:
152 INTEGER, DIMENSION(:, :), ALLOCATABLE :: nvirt_of_domain
153 ! Define the dimension of discarded virtual subspace for a given domain:
154 INTEGER, DIMENSION(:, :), ALLOCATABLE :: nvirt_disc_of_domain
155 ! Each domain has its own mu - "fermi" level
156 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: mu_of_domain
157 INTEGER, DIMENSION(:), ALLOCATABLE :: first_atom_of_domain
158 INTEGER, DIMENSION(:), ALLOCATABLE :: last_atom_of_domain
159 ! The following arrays are useful only with non-overlapping domains
160 ! RZK-warning generalization is required
161 INTEGER, DIMENSION(:), ALLOCATABLE :: domain_index_of_ao
162 INTEGER, DIMENSION(:), ALLOCATABLE :: domain_index_of_atom
163
164 ! Charge of domains
165 INTEGER, DIMENSION(:), ALLOCATABLE :: charge_of_domain
166 ! Charge of domains
167 INTEGER, DIMENSION(:), ALLOCATABLE :: multiplicity_of_domain
168 INTEGER, DIMENSION(:), ALLOCATABLE :: activate
169 ! The matrix contains information about the delocalization of
170 ! alpha and beta electrons.
171 ! Rows denote basis function, columns denote electrons.
172 ! Non-zero (j,i) entry means that electron j can delocalize over
173 ! basis function i. 0.0 means no delocalization
174 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: quench_t
175 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: quench_t_blk
176 ! Local array for a compact description of quench_t
177 TYPE(domain_map_type), DIMENSION(:), ALLOCATABLE :: domain_map
178
179 ! Several special cases for the structure of the group-domain matrix:
180 ! 1. The basis functions can be grouped into:
181 ! a. molecular sets
182 ! b. atomic sets
183 ! 2. Electrons can be grouped into:
184 ! a. molecular sets
185 ! b. atomic sets
186 INTEGER :: domain_layout_mos = 0, domain_layout_aos = 0
187 ! ALMO constraint type.
188 INTEGER :: constraint_type = 0
189
190 ! Desciptors of molecules
191 !INTEGER, DIMENSION(:), ALLOCATABLE :: molecule_index_of_atom
192 !INTEGER, DIMENSION(:), ALLOCATABLE :: first_atom_of_molecule
193 !INTEGER, DIMENSION(:), ALLOCATABLE :: nbasis_of_molecule
194 !INTEGER, DIMENSION(:,:), ALLOCATABLE :: nocc_of_molecule
195 !INTEGER, DIMENSION(:,:), ALLOCATABLE :: nvirt_of_molecule
196 !REAL(KIND=dp),DIMENSION(:,:), ALLOCATABLE :: mu_of_molecule
197
198 ! Descriptors of atoms
199 !INTEGER, DIMENSION(:), ALLOCATABLE :: nbasis_of_atom
200 !INTEGER, DIMENSION(:,:), ALLOCATABLE :: nocc_of_atom
201 !INTEGER, DIMENSION(:,:), ALLOCATABLE :: nvirt_of_atom
202 !REAL(KIND=dp),DIMENSION(:,:), ALLOCATABLE :: mu_of_atom
203
204 ! All AO and MO matrices are distributed for parallel computations.
205 ! The following flags specify what constitues a block for a parallel
206 ! distribution. Both AOs and MOs can be divided into atomic or
207 ! molecular blocks. Domain blocks should be equal or larger than
208 ! the distribution blocks (otherwise retain_sparsity does not work).
209 ! Possible values: almo_mat_distr_atomic, almo_mat_distr_molecular
210 INTEGER :: mat_distr_aos = 0, mat_distr_mos = 0
211 ! Define mappping from a distribution block to a domain
212 INTEGER, DIMENSION(:), ALLOCATABLE :: domain_index_of_ao_block
213 INTEGER, DIMENSION(:), ALLOCATABLE :: domain_index_of_mo_block
214
215 LOGICAL :: need_previous_ks = .false.
216 LOGICAL :: need_virtuals = .false.
217 LOGICAL :: need_orbital_energies = .false.
218 LOGICAL :: s_inv_done = .false.
219 LOGICAL :: s_sqrt_done = .false.
220 REAL(kind=dp) :: almo_scf_energy = 0.0_dp
221 LOGICAL :: orthogonal_basis = .false., fixed_mu = .false.
222 LOGICAL :: return_orthogonalized_mos = .false., construct_nlmos = .false.
223
224 !! Smearing control
225 !! smear flag allow to retrieve eigenvalues in almo_scf with diag algorithm and create occupation-scaled ALMO orbitals
226 LOGICAL :: smear = .false.
227 !! store relevant smearing parameters
228 REAL(kind=dp) :: smear_e_temp = 0.0_dp !! electronic temperature, required for Fermi-Dirac
229 REAL(kind=dp), DIMENSION(:), ALLOCATABLE :: kts !! electronic entropy contribution of each spin system
230 !! mo_energies(imo, ispin) stores the eigenvalue corresponding to the orbital imo with spin ispin
231 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: mo_energies
232 !! since S-ALMO creates partially occupied orbitals, there is a need to store the real number of electron-pairs
233 !! of each spin and for each fragment
234 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: real_ne_of_domain
235
236 ! Controls for the SCF procedure
237 REAL(kind=dp) :: eps_filter = 0.0_dp
238 INTEGER :: xalmo_trial_wf = 0
239 INTEGER :: almo_scf_guess = 0
240 REAL(kind=dp) :: eps_prev_guess = 0.0_dp
241 INTEGER :: order_lanczos = 0
242 REAL(kind=dp) :: matrix_iter_eps_error_factor = 0.0_dp
243 REAL(kind=dp) :: eps_lanczos = 0.0_dp
244 INTEGER :: max_iter_lanczos = 0
245 REAL(kind=dp) :: mixing_fraction = 0.0_dp
246 REAL(kind=dp) :: mu = 0.0_dp
247 ! SCF procedure for the block-diagonal ALMOs
248 INTEGER :: almo_update_algorithm = 0
249 ! SCF procedure for the quenched ALMOs (xALMOs)
250 INTEGER :: xalmo_update_algorithm = 0
251 ! mo overlap inversion algorithm
252 INTEGER :: sigma_inv_algorithm = 0
253
254 ! Determinant of the ALMO overlap matrix
255 REAL(kind=dp) :: overlap_determinant = 0.0_dp
256
257 ! ALMO SCF delocalization control
258 LOGICAL :: perturbative_delocalization = .false.
259 INTEGER :: quencher_radius_type = 0
260 REAL(kind=dp) :: quencher_r0_factor = 0.0_dp, &
261 quencher_r1_factor = 0.0_dp, &
262 !quencher_r0_shift,&
263 !quencher_r1_shift,&
264 quencher_s0 = 0.0_dp, &
265 quencher_s1 = 0.0_dp, &
266 envelope_amplitude = 0.0_dp
267
268 ! guess options
269 ! This prevents a bug in GCC 8/9
270 TYPE(almo_scf_history_type) :: almo_history = almo_scf_history_type(matrix_p_up_down=null(), matrix_t=null())
271 TYPE(almo_scf_history_type) :: xalmo_history = almo_scf_history_type(matrix_p_up_down=null(), matrix_t=null())
272 INTEGER :: almo_extrapolation_order = 0
273 INTEGER :: xalmo_extrapolation_order = 0
274
275 ! forces
276 LOGICAL :: calc_forces = .false.
277
278 !!!!!!!!!!!!!!!!!!!!!!!
279 !!!!!! MATRICES !!!!!!!
280 !!!!!!!!!!!!!!!!!!!!!!!
281
282 ! AO overlap NxN
283 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s
284 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_inv
285 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_sqrt
286 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_sqrt_inv
287 ! block-diagonal AO overlap NxN
288 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_blk
289 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_blk_inv
290 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_blk_sqrt
291 TYPE(dbcsr_type), DIMENSION(1) :: matrix_s_blk_sqrt_inv
292
293 ! occupied ALMO coeff NxOCC (alpha,beta - if necessary)
294 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_t_blk
295 ! occupied MO coeff NxOCC (alpha,beta - if necessary)
296 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_t
297 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_t_tr
298 ! MO overlap OCCxOCC and its inverse (alpha, beta - if necessary)
299 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_sigma, &
300 matrix_sigma_inv, &
301 matrix_sigma_sqrt, &
302 matrix_sigma_sqrt_inv, &
303 matrix_sigma_blk, &
304 matrix_sigma_inv_0deloc
305
306 ! error vector (alpha,beta - if necessary)
307 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_err_blk
308 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_err_xx
309
310 ! MO overlap VIRTxVIRT and its derivatives
311 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_sigma_vv, &
312 matrix_sigma_vv_blk, &
313 matrix_sigma_vv_sqrt, &
314 matrix_sigma_vv_sqrt_inv
315
316 ! template of various VIRT x VIR matrices
317 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_vv_full_blk, &
318 matrix_vv_disc_blk, &
319 matrix_vv_disc
320
321 ! VIRT-OCC MO overlap
322 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_vo, matrix_ov
323 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_ov_full, &
324 matrix_ov_disc
325 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_x
326
327 ! VIRT_DISC x VIRT_RETAINED
328 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_k_blk
329 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_k_tr
330 ! matrix_k_blk_ones is blocked with all elements equal to 1.0
331 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_k_blk_ones
332
333 ! virtual ALMO coeff NxV
334 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_v_blk, &
335 matrix_v, &
336 matrix_v_full_blk, &
337 matrix_v_disc, &
338 matrix_v_disc_blk
339
340 ! kohn-sham matrix (alpha,beta - if necessary)
341 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_ks
342 ! the diff between ks_blk and ks_0deloc is that blk is a blocked matrix
343 ! 0deloc stores the matrix that correponds to zero-delocalization state
344 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_ks_blk
345 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_ks_0deloc
346 ! density NxN (alpha,beta - if necessary)
347 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_p
348 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_p_blk
349
350 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_eoo
351 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: matrix_evv_full
352
353 ! preconditioner for k-optimization
354 ! RZK-warning: do they have to be stored?
355 TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE :: opt_k_t_rr, &
356 opt_k_t_dd, &
357 opt_k_denom
358
359 ! second dimension is spin
360 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_preconditioner
361 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_s_inv
362 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_s_sqrt
363 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_s_sqrt_inv
364 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_ks_xx
365 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_t
366 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_err
367 TYPE(domain_submatrix_type), DIMENSION(:, :), ALLOCATABLE :: domain_r_down_up
368
369 INTEGER, DIMENSION(:), ALLOCATABLE :: cpu_of_domain
370
371 ! Options for various subsection options collected neatly
372 TYPE(almo_analysis_type) :: almo_analysis = almo_analysis_type()
373
374 ! Options for various optimizers collected neatly
375 TYPE(optimizer_options_type) :: opt_block_diag_diis = optimizer_options_type()
376 TYPE(optimizer_options_type) :: opt_block_diag_pcg = optimizer_options_type()
379 TYPE(optimizer_options_type) :: opt_xalmo_trustr = optimizer_options_type()
381 TYPE(optimizer_options_type) :: opt_block_diag_trustr = optimizer_options_type()
382 TYPE(optimizer_options_type) :: opt_xalmo_newton_pcg_solver = optimizer_options_type()
384
385 ! Option for fragment section
386 TYPE(fragment_type) :: fragment = fragment_type()
387
388 ! keywords that control electron delocalization treatment
389 ! RZK-warning: many of these varibles should be collected
390 ! into an optimizer_options_type variable
391 INTEGER :: deloc_method = 0
392 LOGICAL :: deloc_use_occ_orbs = .false.
393 LOGICAL :: deloc_cayley_use_virt_orbs = .false.
394 INTEGER :: deloc_cayley_tensor_type = 0
395 LOGICAL :: deloc_cayley_linear = .false.
396 INTEGER :: deloc_cayley_conjugator = 0
397 REAL(kind=dp) :: deloc_cayley_eps_convergence = 0.0_dp
398 INTEGER :: deloc_cayley_max_iter = 0
399 INTEGER :: deloc_truncate_virt = 0
400 INTEGER :: deloc_virt_per_domain = 0
401 LOGICAL :: deloc_cayley_occ_precond = .false.
402 LOGICAL :: deloc_cayley_vir_precond = .false.
403
404 !! keywords that control optimization of retained orbitals
405 INTEGER :: opt_k_conjugator = 0 !-> conjugartor
406 REAL(kind=dp) :: opt_k_eps_convergence = 0.0_dp !-> eps_error
407 REAL(kind=dp) :: opt_k_trial_step_size = 0.0_dp !-> lin_search_step_size_guess
408 INTEGER :: opt_k_max_iter = 0 !-> max_iter
409 INTEGER :: opt_k_outer_max_iter = 0 !-> max_iter for a separate 'outer' optimizer
410 REAL(kind=dp) :: opt_k_trial_step_size_multiplier = 0.0_dp !-> ?
411 INTEGER :: opt_k_conj_iter_start = 0 !-> ?
412 INTEGER :: opt_k_prec_iter_start = 0 !-> ?
413 INTEGER :: opt_k_conj_iter_freq = 0 !-> ?
414 INTEGER :: opt_k_prec_iter_freq = 0 !-> ?
415
416 ! development keywords
417 INTEGER :: integer01 = 0
418 INTEGER :: integer02 = 0
419 INTEGER :: integer03 = 0
420 INTEGER :: integer04 = 0
421 INTEGER :: integer05 = 0
422 REAL(kind=dp) :: real01 = 0.0_dp
423 REAL(kind=dp) :: real02 = 0.0_dp
424 REAL(kind=dp) :: real03 = 0.0_dp
425 REAL(kind=dp) :: real04 = 0.0_dp
426 REAL(kind=dp) :: real05 = 0.0_dp
427 LOGICAL :: logical01 = .false.
428 LOGICAL :: logical02 = .false.
429 LOGICAL :: logical03 = .false.
430 LOGICAL :: logical04 = .false.
431 LOGICAL :: logical05 = .false.
432
433 END TYPE almo_scf_env_type
434
435CONTAINS
436
437! **************************************************************************************************
438!> \brief Prints out the options of an optimizer
439!> \param optimizer options to print
440!> \param unit_nr output stream
441!> \par History
442!> 2014.10 created [Rustam Z Khaliullin]
443!> \author Rustam Z Khaliullin
444! **************************************************************************************************
445 SUBROUTINE print_optimizer_options(optimizer, unit_nr)
446
447 TYPE(optimizer_options_type), INTENT(IN) :: optimizer
448 INTEGER, INTENT(IN) :: unit_nr
449
450 CHARACTER(33) :: conj_string, prec_string, type_string
451
452 IF (unit_nr > 0) THEN
453
454 SELECT CASE (optimizer%optimizer_type)
455 CASE (optimizer_diis)
456 type_string = "DIIS"
457 CASE (optimizer_pcg)
458 type_string = "PCG"
459 CASE (optimizer_trustr)
460 type_string = "TRUST REGION"
461 END SELECT
462
463 WRITE (unit_nr, '(T4,A,T48,A33)') "optimizer type:", trim(type_string)
464 WRITE (unit_nr, '(T4,A,T48,I33)') "maximum iterations:", optimizer%max_iter
465 WRITE (unit_nr, '(T4,A,T48,E33.3)') "target error:", optimizer%eps_error
466
467 IF (optimizer%optimizer_type == optimizer_diis) THEN
468
469 WRITE (unit_nr, '(T4,A,T48,I33)') "maximum DIIS history:", optimizer%ndiis
470
471 END IF
472
473 IF (optimizer%optimizer_type == optimizer_trustr .OR. &
474 optimizer%optimizer_type == optimizer_pcg) THEN
475
476 WRITE (unit_nr, '(T4,A,T48,I33)') "maximum outer loop iterations:", &
477 optimizer%max_iter_outer_loop
478
479 SELECT CASE (optimizer%preconditioner)
480 CASE (xalmo_prec_zero)
481 prec_string = "NONE"
482 CASE (xalmo_prec_domain)
483 prec_string = "0.5 KS + 0.5 S, DOMAINS"
484 CASE (xalmo_prec_full)
485 prec_string = "0.5 KS + 0.5 S, FULL"
486 END SELECT
487 WRITE (unit_nr, '(T4,A,T48,A33)') "preconditioner:", trim(prec_string)
488
489 SELECT CASE (optimizer%conjugator)
490 CASE (cg_zero)
491 conj_string = "Steepest descent"
492 CASE (cg_polak_ribiere)
493 conj_string = "Polak-Ribiere"
494 CASE (cg_fletcher_reeves)
495 conj_string = "Fletcher-Reeves"
497 conj_string = "Hestenes-Stiefel"
498 CASE (cg_fletcher)
499 conj_string = "Fletcher"
500 CASE (cg_liu_storey)
501 conj_string = "Liu-Storey"
502 CASE (cg_dai_yuan)
503 conj_string = "Dai-Yuan"
504 CASE (cg_hager_zhang)
505 conj_string = "Hager-Zhang"
506 END SELECT
507 WRITE (unit_nr, '(T4,A,T48,A33)') "conjugator:", trim(conj_string)
508
509 END IF
510
511 IF (optimizer%optimizer_type == optimizer_pcg) THEN
512
513 WRITE (unit_nr, '(T4,A,T48,E33.3)') "line search step size guess:", &
514 optimizer%lin_search_step_size_guess
515 WRITE (unit_nr, '(T4,A,T48,E33.3)') "line search target error:", &
516 optimizer%lin_search_eps_error
517 IF (optimizer%neglect_threshold > 0.0_dp) THEN
518 WRITE (unit_nr, '(T4,A,T48,E33.3)') "low-curvature threshold:", &
519 optimizer%neglect_threshold
520 END IF
521
522 END IF
523
524 IF (optimizer%optimizer_type == optimizer_trustr) THEN
525
526 SELECT CASE (optimizer%trustr_algorithm)
527 CASE (trustr_steihaug)
528 conj_string = "Steihaug's CG"
529 CASE (trustr_cauchy)
530 conj_string = "Cauchy point"
531 CASE (trustr_dogleg)
532 conj_string = "Dogleg"
533 END SELECT
534 WRITE (unit_nr, '(T4,A,T48,A33)') "Subproblem algorithm:", trim(conj_string)
535
536 WRITE (unit_nr, '(T4,A,T48,E33.3)') "gradient decrease accepted:", &
537 optimizer%model_grad_norm_ratio
538 WRITE (unit_nr, '(T4,A,T48,E33.3)') "initial trust radius:", &
539 optimizer%initial_trust_radius
540 WRITE (unit_nr, '(T4,A,T48,E33.3)') "max trust radius:", &
541 optimizer%max_trust_radius
542 WRITE (unit_nr, '(T4,A,T48,E33.3)') "rho of no update lies between .0 and .25:", &
543 optimizer%rho_do_not_update
544
545 END IF
546
547 END IF
548
549 END SUBROUTINE print_optimizer_options
550
551! **************************************************************************************************
552!> \brief release the almo scf envirnoment
553!> \param almo_scf_env ...
554!> \par History
555!> 2016.11 created [Rustam Z Khaliullin]
556!> \author Rustam Z Khaliullin
557! **************************************************************************************************
558 SUBROUTINE almo_scf_env_release(almo_scf_env)
559 TYPE(almo_scf_env_type), POINTER :: almo_scf_env
560
561 CHARACTER(len=*), PARAMETER :: routinen = 'almo_scf_env_release'
562
563 INTEGER :: handle, ispin, istore
564
565 CALL timeset(routinen, handle)
566
567 ! delete history
568 DO ispin = 1, SIZE(almo_scf_env%almo_history%matrix_t)
569 DO istore = 1, min(almo_scf_env%almo_history%istore, almo_scf_env%almo_history%nstore)
570 CALL dbcsr_release(almo_scf_env%almo_history%matrix_p_up_down(ispin, istore))
571 END DO
572 IF (almo_scf_env%almo_history%istore > 0) &
573 CALL dbcsr_release(almo_scf_env%almo_history%matrix_t(ispin))
574 END DO
575 DEALLOCATE (almo_scf_env%almo_history%matrix_p_up_down)
576 DEALLOCATE (almo_scf_env%almo_history%matrix_t)
577 ! delete xalmo history
578 DO ispin = 1, SIZE(almo_scf_env%xalmo_history%matrix_t)
579 DO istore = 1, min(almo_scf_env%xalmo_history%istore, almo_scf_env%xalmo_history%nstore)
580 CALL dbcsr_release(almo_scf_env%xalmo_history%matrix_p_up_down(ispin, istore))
581 !CALL dbcsr_release(almo_scf_env%xalmo_history%matrix_x(ispin, istore))
582 END DO
583 IF (almo_scf_env%xalmo_history%istore > 0) &
584 CALL dbcsr_release(almo_scf_env%xalmo_history%matrix_t(ispin))
585 END DO
586 DEALLOCATE (almo_scf_env%xalmo_history%matrix_p_up_down)
587 !DEALLOCATE (almo_scf_env%xalmo_history%matrix_x)
588 DEALLOCATE (almo_scf_env%xalmo_history%matrix_t)
589
590 DEALLOCATE (almo_scf_env)
591
592 CALL timestop(handle)
593
594 END SUBROUTINE almo_scf_env_release
595
596END MODULE almo_scf_types
597
Types for all ALMO-based methods.
real(kind=dp), parameter, public almo_max_cutoff_multiplier
integer, parameter, public almo_mat_dim_domains
integer, parameter, public almo_mat_dim_occ
integer, parameter, public almo_mat_dim_virt_full
integer, parameter, public almo_mat_dim_aobasis
subroutine, public print_optimizer_options(optimizer, unit_nr)
Prints out the options of an optimizer.
integer, parameter, public almo_mat_dim_virt
integer, parameter, public almo_mat_dim_virt_disc
subroutine, public almo_scf_env_release(almo_scf_env)
release the almo scf envirnoment
methods related to the blacs parallel environment
subroutine, public dbcsr_release(matrix)
...
Types to handle submatrices.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public cg_hestenes_stiefel
integer, parameter, public trustr_dogleg
integer, parameter, public optimizer_diis
integer, parameter, public almo_scf_guess
integer, parameter, public cg_fletcher
integer, parameter, public cg_fletcher_reeves
integer, parameter, public xalmo_prec_domain
integer, parameter, public trustr_cauchy
integer, parameter, public cg_dai_yuan
integer, parameter, public cg_liu_storey
integer, parameter, public trustr_steihaug
integer, parameter, public xalmo_prec_zero
integer, parameter, public cg_hager_zhang
integer, parameter, public optimizer_trustr
integer, parameter, public optimizer_pcg
integer, parameter, public cg_zero
integer, parameter, public cg_polak_ribiere
integer, parameter, public xalmo_prec_full
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
computes preconditioners, and implements methods to apply them currently used in qs_ot
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
stores all the informations relevant to an mpi environment