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