28#include "./base/base_uses.f90"
34 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'almo_scf_types'
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.
61 INTEGER :: fragment_parameters = 0, charge = 0, multiplicity = 1
63 END TYPE fragment_type
66 TYPE almo_analysis_type
69 LOGICAL :: do_analysis = .false.
71 INTEGER :: frozen_mo_energy_term = 0
73 END TYPE almo_analysis_type
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
87 INTEGER :: optimizer_type = 0
88 TYPE(penalty_type) :: opt_penalty = penalty_type()
94 max_iter_outer_loop = 0, &
95 trustr_algorithm = 0, &
98 LOGICAL :: early_stopping_on = .false.
103 INTEGER :: istore = 0, nstore = 0
104 TYPE(
dbcsr_type),
DIMENSION(:, :),
ALLOCATABLE :: matrix_p_up_down
115 INTEGER :: nspins = 0, nelectrons_total = 0, naos = 0
116 INTEGER :: natoms = 0, nmolecules = 0
117 INTEGER,
DIMENSION(2) :: nelectrons_spin = 0
132 INTEGER :: ndomains = 0
146 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: nocc_of_domain
148 INTEGER,
DIMENSION(:),
ALLOCATABLE :: nbasis_of_domain
150 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: nvirt_full_of_domain
152 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: nvirt_of_domain
154 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: nvirt_disc_of_domain
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
161 INTEGER,
DIMENSION(:),
ALLOCATABLE :: domain_index_of_ao
162 INTEGER,
DIMENSION(:),
ALLOCATABLE :: domain_index_of_atom
165 INTEGER,
DIMENSION(:),
ALLOCATABLE :: charge_of_domain
167 INTEGER,
DIMENSION(:),
ALLOCATABLE :: multiplicity_of_domain
168 INTEGER,
DIMENSION(:),
ALLOCATABLE :: activate
186 INTEGER :: domain_layout_mos = 0, domain_layout_aos = 0
188 INTEGER :: constraint_type = 0
210 INTEGER :: mat_distr_aos = 0, mat_distr_mos = 0
212 INTEGER,
DIMENSION(:),
ALLOCATABLE :: domain_index_of_ao_block
213 INTEGER,
DIMENSION(:),
ALLOCATABLE :: domain_index_of_mo_block
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.
226 LOGICAL :: smear = .false.
228 REAL(kind=
dp) :: smear_e_temp = 0.0_dp
229 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: kts
231 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: mo_energies
234 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: real_ne_of_domain
237 REAL(kind=
dp) :: eps_filter = 0.0_dp
238 INTEGER :: xalmo_trial_wf = 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
248 INTEGER :: almo_update_algorithm = 0
250 INTEGER :: xalmo_update_algorithm = 0
252 INTEGER :: sigma_inv_algorithm = 0
255 REAL(kind=
dp) :: overlap_determinant = 0.0_dp
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, &
264 quencher_s0 = 0.0_dp, &
265 quencher_s1 = 0.0_dp, &
266 envelope_amplitude = 0.0_dp
272 INTEGER :: almo_extrapolation_order = 0
273 INTEGER :: xalmo_extrapolation_order = 0
276 LOGICAL :: calc_forces = .false.
299 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_sigma, &
302 matrix_sigma_sqrt_inv, &
304 matrix_sigma_inv_0deloc
307 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_err_blk
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
317 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_vv_full_blk, &
318 matrix_vv_disc_blk, &
322 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_vo, matrix_ov
323 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_ov_full, &
331 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_k_blk_ones
334 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_v_blk, &
345 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_ks_0deloc
351 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: matrix_evv_full
369 INTEGER,
DIMENSION(:),
ALLOCATABLE :: cpu_of_domain
372 TYPE(almo_analysis_type) :: almo_analysis = almo_analysis_type()
386 TYPE(fragment_type) :: fragment = fragment_type()
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.
405 INTEGER :: opt_k_conjugator = 0
406 REAL(kind=
dp) :: opt_k_eps_convergence = 0.0_dp
407 REAL(kind=
dp) :: opt_k_trial_step_size = 0.0_dp
408 INTEGER :: opt_k_max_iter = 0
409 INTEGER :: opt_k_outer_max_iter = 0
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
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.
448 INTEGER,
INTENT(IN) :: unit_nr
450 CHARACTER(33) :: conj_string, prec_string, type_string
452 IF (unit_nr > 0)
THEN
454 SELECT CASE (optimizer%optimizer_type)
460 type_string =
"TRUST REGION"
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
469 WRITE (unit_nr,
'(T4,A,T48,I33)')
"maximum DIIS history:", optimizer%ndiis
476 WRITE (unit_nr,
'(T4,A,T48,I33)')
"maximum outer loop iterations:", &
477 optimizer%max_iter_outer_loop
479 SELECT CASE (optimizer%preconditioner)
483 prec_string =
"0.5 KS + 0.5 S, DOMAINS"
485 prec_string =
"0.5 KS + 0.5 S, FULL"
487 WRITE (unit_nr,
'(T4,A,T48,A33)')
"preconditioner:", trim(prec_string)
489 SELECT CASE (optimizer%conjugator)
491 conj_string =
"Steepest descent"
493 conj_string =
"Polak-Ribiere"
495 conj_string =
"Fletcher-Reeves"
497 conj_string =
"Hestenes-Stiefel"
499 conj_string =
"Fletcher"
501 conj_string =
"Liu-Storey"
503 conj_string =
"Dai-Yuan"
505 conj_string =
"Hager-Zhang"
507 WRITE (unit_nr,
'(T4,A,T48,A33)')
"conjugator:", trim(conj_string)
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
526 SELECT CASE (optimizer%trustr_algorithm)
528 conj_string =
"Steihaug's CG"
530 conj_string =
"Cauchy point"
532 conj_string =
"Dogleg"
534 WRITE (unit_nr,
'(T4,A,T48,A33)')
"Subproblem algorithm:", trim(conj_string)
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
561 CHARACTER(len=*),
PARAMETER :: routinen =
'almo_scf_env_release'
563 INTEGER :: handle, ispin, istore
565 CALL timeset(routinen, handle)
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))
572 IF (almo_scf_env%almo_history%istore > 0) &
573 CALL dbcsr_release(almo_scf_env%almo_history%matrix_t(ispin))
575 DEALLOCATE (almo_scf_env%almo_history%matrix_p_up_down)
576 DEALLOCATE (almo_scf_env%almo_history%matrix_t)
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))
583 IF (almo_scf_env%xalmo_history%istore > 0) &
584 CALL dbcsr_release(almo_scf_env%xalmo_history%matrix_t(ispin))
586 DEALLOCATE (almo_scf_env%xalmo_history%matrix_p_up_down)
588 DEALLOCATE (almo_scf_env%xalmo_history%matrix_t)
590 DEALLOCATE (almo_scf_env)
592 CALL timestop(handle)
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.
Defines the basic variable types.
integer, parameter, public dp
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