34 dbcsr_type_no_symmetry
106#include "./base/base_uses.f90"
112 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'preconditioner'
113 REAL(KIND=
dp),
PARAMETER,
PRIVATE :: fermi_low_rank_gap_factor = 4.0_dp, &
114 fermi_low_rank_degeneracy_tolerance = 1.0e-8_dp, &
115 fermi_low_rank_min_window = 1.0_dp
127 TYPE full_all_work_type
129 TYPE(cp_cfm_type) :: c, h, s, a, b
130 TYPE(cp_cfm_diag_workspace_type) :: solver
131 END TYPE full_all_work_type
154 SUBROUTINE prepare_lattice_operator(preconditioner_env, operator_matrix, operator_name, rhs_count)
156 TYPE(preconditioner_type) :: preconditioner_env
157 TYPE(dbcsr_type),
POINTER :: operator_matrix
158 CHARACTER(LEN=*),
INTENT(IN) :: operator_name
159 INTEGER,
INTENT(IN) :: rhs_count
161 INTEGER :: alpha, beta, block_size, col_cell, delta_index, i, info, j, local_info, n, ncell, &
162 ncol_local, nrow_local, output_unit, row_cell
163 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: index_to_cell
164 INTEGER,
DIMENSION(3) :: delta
165 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
167 REAL(KIND=
dp) :: denominator, difference, numerator,
value
168 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dense_operator, xkp
169 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: blocks
170 REAL(KIND=
dp),
CONTIGUOUS,
DIMENSION(:, :), &
171 POINTER :: local_data
172 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
173 TYPE(cp_fm_type) :: operator_fm, work
174 TYPE(cp_logger_type),
POINTER :: logger
176 cpassert(
ASSOCIATED(operator_matrix))
178 preconditioner_env%lattice_fft_active = .false.
179 preconditioner_env%lattice_projection_error = 0.0_dp
180 preconditioner_env%lattice_corrected_projection_error = 0.0_dp
181 preconditioner_env%lattice_cost_ratio = 0.0_dp
182 preconditioner_env%lattice_storage_ratio = 0.0_dp
184 IF (any(preconditioner_env%lattice_dims <= 0)) cpabort(
"Lattice dimensions must be positive")
188 IF (preconditioner_env%para_env%is_source())
THEN
191 IF (output_unit > 0)
THEN
192 WRITE (output_unit,
'(T2,A,A,A,I0,A,I0)') &
193 "OT| Lattice FFT AUTO kept the conventional ", trim(operator_name), &
194 " solver: ", product(preconditioner_env%lattice_dims), &
203 ncell = product(preconditioner_env%lattice_dims)
204 IF (
modulo(n, ncell) /= 0) cpabort(
"AO dimension does not match replicated cells")
206 preconditioner_env%lattice_block_size = block_size
208 preconditioner_env%lattice_dims, block_size, rhs_count, &
209 preconditioner_env%para_env%num_pe) + &
211 preconditioner_env%lattice_dims, &
212 preconditioner_env%lattice_local_cells)
214 preconditioner_env%lattice_dims, 1) + &
216 preconditioner_env%lattice_dims, 1, &
217 preconditioner_env%lattice_local_cells)
221 IF (preconditioner_env%para_env%is_source())
THEN
224 IF (output_unit > 0)
THEN
225 WRITE (output_unit,
'(T2,A,A,A,F8.3,A,F8.3,A)') &
226 "OT| Lattice FFT AUTO kept the conventional ", trim(operator_name), &
227 " solver: estimated work ratio ", preconditioner_env%lattice_cost_ratio, &
228 " storage ratio ", preconditioner_env%lattice_storage_ratio,
" selected: F"
234 context=preconditioner_env%ctxt, &
235 para_env=preconditioner_env%para_env)
236 CALL cp_fm_create(operator_fm, fm_struct, name=
"lattice preconditioner operator")
240 CALL cp_fm_create(work, operator_fm%matrix_struct, name=
"lattice operator work")
243 CALL cp_fm_get_info(operator_fm, nrow_local=nrow_local, ncol_local=ncol_local, &
244 row_indices=row_indices, col_indices=col_indices, local_data=local_data)
245 ALLOCATE (blocks(block_size, block_size, ncell), source=0.0_dp)
246 ALLOCATE (index_to_cell(3, ncell), xkp(3, ncell))
247 CALL lattice_grid(preconditioner_env%lattice_dims, index_to_cell, xkp)
248 IF (preconditioner_env%lattice_local_cells > 0)
THEN
249 ALLOCATE (dense_operator(n, n), source=0.0_dp)
254 IF (row_indices(i) <= col_indices(j))
THEN
255 value = local_data(i, j)
256 row_cell = (row_indices(i) - 1)/block_size + 1
257 col_cell = (col_indices(j) - 1)/block_size + 1
258 alpha =
modulo(row_indices(i) - 1, block_size) + 1
259 beta =
modulo(col_indices(j) - 1, block_size) + 1
260 delta =
modulo(index_to_cell(:, row_cell) - index_to_cell(:, col_cell), &
261 preconditioner_env%lattice_dims)
262 delta_index = delta(1) + preconditioner_env%lattice_dims(1)*(delta(2) + &
263 preconditioner_env%lattice_dims(2)*delta(3)) + 1
264 blocks(alpha, beta, delta_index) = blocks(alpha, beta, delta_index) + &
265 value/real(ncell, kind=
dp)
266 denominator = denominator +
value*
value
267 IF (
ALLOCATED(dense_operator))
THEN
268 dense_operator(row_indices(i), col_indices(j)) =
value
270 IF (row_indices(i) < col_indices(j))
THEN
271 delta =
modulo(index_to_cell(:, col_cell) - index_to_cell(:, row_cell), &
272 preconditioner_env%lattice_dims)
273 delta_index = delta(1) + preconditioner_env%lattice_dims(1)*(delta(2) + &
274 preconditioner_env%lattice_dims(2)*delta(3)) + 1
275 blocks(beta, alpha, delta_index) = blocks(beta, alpha, delta_index) + &
276 value/real(ncell, kind=
dp)
277 denominator = denominator +
value*
value
282 CALL preconditioner_env%para_env%sum(blocks)
286 IF (row_indices(i) <= col_indices(j))
THEN
287 value = local_data(i, j)
288 row_cell = (row_indices(i) - 1)/block_size + 1
289 col_cell = (col_indices(j) - 1)/block_size + 1
290 alpha =
modulo(row_indices(i) - 1, block_size) + 1
291 beta =
modulo(col_indices(j) - 1, block_size) + 1
292 delta =
modulo(index_to_cell(:, row_cell) - index_to_cell(:, col_cell), &
293 preconditioner_env%lattice_dims)
294 delta_index = delta(1) + preconditioner_env%lattice_dims(1)*(delta(2) + &
295 preconditioner_env%lattice_dims(2)*delta(3)) + 1
296 difference =
value - blocks(alpha, beta, delta_index)
297 numerator = numerator + difference*difference
298 IF (row_indices(i) < col_indices(j))
THEN
299 delta =
modulo(index_to_cell(:, col_cell) - index_to_cell(:, row_cell), &
300 preconditioner_env%lattice_dims)
301 delta_index = delta(1) + preconditioner_env%lattice_dims(1)*(delta(2) + &
302 preconditioner_env%lattice_dims(2)*delta(3)) + 1
303 difference =
value - blocks(beta, alpha, delta_index)
304 numerator = numerator + difference*difference
309 CALL preconditioner_env%para_env%sum(numerator)
310 CALL preconditioner_env%para_env%sum(denominator)
311 preconditioner_env%lattice_projection_error = &
312 sqrt(numerator/max(denominator, tiny(denominator)))
314 blocks, preconditioner_env%lattice_dims, preconditioner_env%lattice_inverse_k, used_fft, info)
315 preconditioner_env%lattice_corrected_projection_error = &
316 preconditioner_env%lattice_projection_error
317 IF (
ALLOCATED(dense_operator))
THEN
318 CALL preconditioner_env%para_env%sum(dense_operator)
321 dense_operator(i, j) = dense_operator(j, i)
325 dense_operator, preconditioner_env%lattice_dims, &
326 preconditioner_env%lattice_local_cells, &
327 preconditioner_env%lattice_local_indices, &
328 preconditioner_env%lattice_local_operator, &
329 preconditioner_env%lattice_local_coarse_inverse, &
330 preconditioner_env%lattice_corrected_projection_error, local_info)
331 IF (local_info /= 0)
THEN
332 cpabort(
"LATTICE_FFT local correction found a non-positive coarse operator")
334 DEALLOCATE (dense_operator)
337 DEALLOCATE (blocks, index_to_cell, xkp)
338 SELECT CASE (preconditioner_env%lattice_fft_mode)
341 cpabort(
"LATTICE_FFT found a non-positive Fourier block for "//trim(operator_name))
343 IF (.NOT. used_fft)
THEN
344 cpabort(
"LATTICE_FFT could not initialize its FFT for "//trim(operator_name))
346 preconditioner_env%lattice_fft_active = .true.
349 preconditioner_env%lattice_dims, &
350 preconditioner_env%lattice_block_size, rhs_count, 1, &
351 preconditioner_env%para_env%num_pe, &
352 preconditioner_env%lattice_projection_error, used_fft, info)
354 cpabort(
"Unknown LATTICE_FFT mode")
357 IF (.NOT. preconditioner_env%lattice_fft_active .AND. &
358 ALLOCATED(preconditioner_env%lattice_inverse_k))
THEN
359 DEALLOCATE (preconditioner_env%lattice_inverse_k)
361 IF (preconditioner_env%para_env%is_source())
THEN
364 IF (output_unit > 0)
THEN
365 WRITE (output_unit,
'(T2,A,A,A,3(I0,1X),A,I0)') &
366 "OT| Lattice FFT ", trim(operator_name),
" cells: ", &
367 preconditioner_env%lattice_dims,
"AO block: ", preconditioner_env%lattice_block_size
368 WRITE (output_unit,
'(T2,A,ES12.4,A,L1)') &
369 "OT| Block-circulant projection error: ", &
370 preconditioner_env%lattice_projection_error, &
371 " selected: ", preconditioner_env%lattice_fft_active
372 IF (preconditioner_env%lattice_local_cells > 0)
THEN
373 WRITE (output_unit,
'(T2,A,I0,A,ES12.4)') &
374 "OT| Balanced local correction cells: ", &
375 preconditioner_env%lattice_local_cells,
" residual error: ", &
376 preconditioner_env%lattice_corrected_projection_error
378 WRITE (output_unit,
'(T2,A,F8.3,A,F8.3)') &
379 "OT| Estimated lattice/dense work ratio: ", &
380 preconditioner_env%lattice_cost_ratio,
" storage ratio: ", &
381 preconditioner_env%lattice_storage_ratio
385 END SUBROUTINE prepare_lattice_operator
393 SUBROUTINE prepare_lattice_state_operator(preconditioner_env, matrix_s, operator_name)
395 TYPE(preconditioner_type) :: preconditioner_env
396 TYPE(dbcsr_type),
POINTER :: matrix_s
397 CHARACTER(LEN=*),
INTENT(IN) :: operator_name
399 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: inverse_k
400 INTEGER :: i, info, istate, j, local_info, &
401 local_rank, n, ncell, ncol_local, &
402 nrow_local, nstate, output_unit
403 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: local_indices
404 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
405 LOGICAL :: all_selected, selected, used_fft
406 REAL(KIND=
dp) :: corrected_projection_error, &
408 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dense_operator, dense_sv, dense_vectors, &
409 local_coarse_inverse, local_operator, &
411 REAL(KIND=
dp),
CONTIGUOUS,
DIMENSION(:, :), &
412 POINTER :: local_data
413 TYPE(cp_fm_type) :: sv_fm
414 TYPE(cp_logger_type),
POINTER :: logger
416 cpassert(
ASSOCIATED(matrix_s))
417 cpassert(
ASSOCIATED(preconditioner_env%fm))
418 cpassert(
ASSOCIATED(preconditioner_env%full_evals))
419 cpassert(
ASSOCIATED(preconditioner_env%occ_evals))
422 preconditioner_env%lattice_fft_active = .false.
423 preconditioner_env%lattice_projection_error = 0.0_dp
424 preconditioner_env%lattice_corrected_projection_error = 0.0_dp
425 preconditioner_env%lattice_cost_ratio = 0.0_dp
426 preconditioner_env%lattice_storage_ratio = 0.0_dp
427 IF (
ALLOCATED(preconditioner_env%lattice_state_inverse_k))
THEN
428 DEALLOCATE (preconditioner_env%lattice_state_inverse_k)
430 IF (
ALLOCATED(preconditioner_env%lattice_occ_vectors))
THEN
431 DEALLOCATE (preconditioner_env%lattice_occ_vectors)
433 IF (
ALLOCATED(preconditioner_env%lattice_occ_dual))
THEN
434 DEALLOCATE (preconditioner_env%lattice_occ_dual)
436 IF (
ALLOCATED(preconditioner_env%lattice_local_indices))
THEN
437 DEALLOCATE (preconditioner_env%lattice_local_indices)
439 IF (
ALLOCATED(preconditioner_env%lattice_local_operator))
THEN
440 DEALLOCATE (preconditioner_env%lattice_local_operator)
442 IF (
ALLOCATED(preconditioner_env%lattice_local_coarse_inverse))
THEN
443 DEALLOCATE (preconditioner_env%lattice_local_coarse_inverse)
445 IF (
ALLOCATED(preconditioner_env%lattice_state_local_indices))
THEN
446 DEALLOCATE (preconditioner_env%lattice_state_local_indices)
448 IF (
ALLOCATED(preconditioner_env%lattice_state_local_operator))
THEN
449 DEALLOCATE (preconditioner_env%lattice_state_local_operator)
451 IF (
ALLOCATED(preconditioner_env%lattice_state_local_coarse_inverse))
THEN
452 DEALLOCATE (preconditioner_env%lattice_state_local_coarse_inverse)
454 IF (any(preconditioner_env%lattice_dims <= 0)) cpabort(
"Lattice dimensions must be positive")
457 IF (preconditioner_env%para_env%is_source())
THEN
460 IF (output_unit > 0)
THEN
461 WRITE (output_unit,
'(T2,A,A,A,I0,A,I0)') &
462 "OT| Lattice FFT AUTO kept the conventional ", trim(operator_name), &
463 " solver: ", product(preconditioner_env%lattice_dims), &
470 CALL cp_fm_get_info(preconditioner_env%fm, nrow_global=n, ncol_global=j)
471 cpassert(j == n .AND.
SIZE(preconditioner_env%full_evals) == n)
472 nstate =
SIZE(preconditioner_env%occ_evals)
474 ncell = product(preconditioner_env%lattice_dims)
475 IF (
modulo(n, ncell) /= 0) cpabort(
"AO dimension does not match replicated cells")
476 preconditioner_env%lattice_block_size = n/ncell
478 preconditioner_env%lattice_dims, &
479 preconditioner_env%lattice_block_size, nstate, &
480 preconditioner_env%para_env%num_pe)
482 preconditioner_env%lattice_dims, nstate)
483 preconditioner_env%lattice_cost_ratio = preconditioner_env%lattice_cost_ratio + &
485 preconditioner_env%lattice_dims, &
486 preconditioner_env%lattice_local_cells)
487 preconditioner_env%lattice_storage_ratio = preconditioner_env%lattice_storage_ratio + &
489 preconditioner_env%lattice_dims, nstate, &
490 preconditioner_env%lattice_local_cells)
494 IF (preconditioner_env%para_env%is_source())
THEN
497 IF (output_unit > 0)
THEN
498 WRITE (output_unit,
'(T2,A,A,A,F8.3,A,F8.3,A)') &
499 "OT| Lattice FFT AUTO kept the conventional ", trim(operator_name), &
500 " solver: estimated work ratio ", preconditioner_env%lattice_cost_ratio, &
501 " storage ratio ", preconditioner_env%lattice_storage_ratio,
" selected: F"
506 IF (preconditioner_env%lattice_local_cells > 0)
THEN
507 local_rank = preconditioner_env%lattice_local_cells* &
508 preconditioner_env%lattice_block_size
509 ALLOCATE (preconditioner_env%lattice_state_local_indices(local_rank, nstate), &
510 preconditioner_env%lattice_state_local_operator(n, local_rank, nstate), &
511 preconditioner_env%lattice_state_local_coarse_inverse(local_rank, local_rank, nstate))
513 CALL cp_fm_create(sv_fm, preconditioner_env%fm%matrix_struct, name=
"lattice FULL_ALL S V")
515 CALL cp_fm_get_info(sv_fm, nrow_local=nrow_local, ncol_local=ncol_local, &
516 row_indices=row_indices, col_indices=col_indices, local_data=local_data)
517 ALLOCATE (dense_sv(n, n), dense_vectors(n, nstate), source=0.0_dp)
520 dense_sv(row_indices(i), col_indices(j)) = local_data(i, j)
523 CALL preconditioner_env%para_env%sum(dense_sv)
526 CALL cp_fm_get_info(preconditioner_env%fm, nrow_local=nrow_local, ncol_local=ncol_local, &
527 row_indices=row_indices, col_indices=col_indices, local_data=local_data)
529 IF (col_indices(j) > nstate) cycle
531 dense_vectors(row_indices(i), col_indices(j)) = local_data(i, j)
534 CALL preconditioner_env%para_env%sum(dense_vectors)
535 ALLOCATE (preconditioner_env%lattice_occ_vectors(n, nstate), &
536 preconditioner_env%lattice_occ_dual(n, nstate))
537 preconditioner_env%lattice_occ_vectors(:, :) = dense_vectors
538 preconditioner_env%lattice_occ_dual(:, :) = dense_sv(:, 1:nstate)
540 ALLOCATE (dense_operator(n, n), scaled_sv(n, n))
541 all_selected = .true.
542 DO istate = 1, nstate
543 scaled_sv(:, :) = dense_sv
545 scaled_sv(:, j) = scaled_sv(:, j)*max( &
546 preconditioner_env%energy_gap, &
547 preconditioner_env%full_evals(j) - preconditioner_env%occ_evals(istate))
549 dense_operator(:, :) = matmul(scaled_sv, transpose(dense_sv))
551 projection_error, used_fft, info)
552 preconditioner_env%lattice_projection_error = &
553 max(preconditioner_env%lattice_projection_error, projection_error)
554 corrected_projection_error = projection_error
555 IF (preconditioner_env%lattice_local_cells > 0)
THEN
557 dense_operator, preconditioner_env%lattice_dims, &
558 preconditioner_env%lattice_local_cells, local_indices, &
559 local_operator, local_coarse_inverse, corrected_projection_error, local_info)
560 IF (local_info /= 0)
THEN
561 cpabort(
"LATTICE_FFT local correction found a non-positive coarse operator")
563 preconditioner_env%lattice_state_local_indices(:, istate) = local_indices
564 preconditioner_env%lattice_state_local_operator(:, :, istate) = local_operator
565 preconditioner_env%lattice_state_local_coarse_inverse(:, :, istate) = local_coarse_inverse
566 DEALLOCATE (local_coarse_inverse, local_indices, local_operator)
568 preconditioner_env%lattice_corrected_projection_error = &
569 max(preconditioner_env%lattice_corrected_projection_error, corrected_projection_error)
571 preconditioner_env%lattice_block_size, nstate, nstate, &
572 preconditioner_env%para_env%num_pe, projection_error, used_fft, info)
575 cpabort(
"LATTICE_FFT found a non-positive Fourier block for "//trim(operator_name))
577 IF (.NOT. used_fft)
THEN
578 cpabort(
"LATTICE_FFT could not initialize its FFT for "//trim(operator_name))
581 all_selected = all_selected .AND. selected
583 IF (.NOT.
ALLOCATED(preconditioner_env%lattice_state_inverse_k))
THEN
584 ALLOCATE (preconditioner_env%lattice_state_inverse_k( &
585 SIZE(inverse_k, 1),
SIZE(inverse_k, 2),
SIZE(inverse_k, 3), nstate))
587 IF (info == 0 .AND. used_fft)
THEN
588 preconditioner_env%lattice_state_inverse_k(:, :, :, istate) = inverse_k
590 DEALLOCATE (inverse_k)
593 preconditioner_env%lattice_fft_active = &
595 IF (.NOT. preconditioner_env%lattice_fft_active .AND. &
596 ALLOCATED(preconditioner_env%lattice_state_inverse_k))
THEN
597 DEALLOCATE (preconditioner_env%lattice_state_inverse_k)
599 IF (.NOT. preconditioner_env%lattice_fft_active)
THEN
600 DEALLOCATE (preconditioner_env%lattice_occ_vectors, &
601 preconditioner_env%lattice_occ_dual)
602 IF (
ALLOCATED(preconditioner_env%lattice_state_local_indices))
THEN
603 DEALLOCATE (preconditioner_env%lattice_state_local_indices, &
604 preconditioner_env%lattice_state_local_operator, &
605 preconditioner_env%lattice_state_local_coarse_inverse)
608 IF (preconditioner_env%para_env%is_source())
THEN
611 IF (output_unit > 0)
THEN
612 WRITE (output_unit,
'(T2,A,A,A,3(I0,1X),A,I0,A,I0)') &
613 "OT| Lattice FFT ", trim(operator_name),
" cells: ", &
614 preconditioner_env%lattice_dims,
"AO block: ", &
615 preconditioner_env%lattice_block_size,
" states: ", nstate
616 WRITE (output_unit,
'(T2,A,ES12.4,A,L1)') &
617 "OT| Maximum block-circulant projection error: ", &
618 preconditioner_env%lattice_projection_error, &
619 " selected: ", preconditioner_env%lattice_fft_active
620 IF (preconditioner_env%lattice_local_cells > 0)
THEN
621 WRITE (output_unit,
'(T2,A,I0,A,ES12.4)') &
622 "OT| Balanced local correction cells/state: ", &
623 preconditioner_env%lattice_local_cells,
" maximum residual error: ", &
624 preconditioner_env%lattice_corrected_projection_error
626 WRITE (output_unit,
'(T2,A,F8.3,A,F8.3)') &
627 "OT| Estimated lattice/dense work ratio: ", &
628 preconditioner_env%lattice_cost_ratio,
" storage ratio: ", &
629 preconditioner_env%lattice_storage_ratio
633 DEALLOCATE (dense_operator, dense_sv, dense_vectors, scaled_sv)
635 END SUBROUTINE prepare_lattice_state_operator
642 SUBROUTINE prepare_low_rank_base(preconditioner_env, matrix_s)
644 TYPE(preconditioner_type) :: preconditioner_env
645 TYPE(dbcsr_type),
OPTIONAL,
POINTER :: matrix_s
648 TYPE(cp_fm_type) :: work
650 cpassert(
ASSOCIATED(preconditioner_env%fm))
651 cpassert(.NOT.
ASSOCIATED(preconditioner_env%base_fm))
654 IF (.NOT.
PRESENT(matrix_s))
THEN
655 cpabort(
"LATTICE_FFT requires a non-unit overlap metric for FERMI_LOW_RANK")
657 cpassert(
ASSOCIATED(matrix_s))
658 CALL prepare_lattice_operator(preconditioner_env, matrix_s,
"FERMI_LOW_RANK overlap", &
659 SIZE(preconditioner_env%occ_evals))
660 IF (preconditioner_env%lattice_fft_active)
THEN
668 cpabort(
"Unknown FERMI_LOW_RANK base operator")
670 ALLOCATE (preconditioner_env%base_fm)
671 CALL cp_fm_create(preconditioner_env%base_fm, preconditioner_env%fm%matrix_struct, &
672 name=
"FERMI_LOW_RANK overlap inverse")
674 IF (
PRESENT(matrix_s))
THEN
675 cpassert(
ASSOCIATED(matrix_s))
678 IF (info /= 0) cpabort(
"FERMI_LOW_RANK requires a positive-definite overlap matrix")
680 CALL cp_fm_create(work, preconditioner_env%base_fm%matrix_struct, name=
"low-rank base work")
684 CALL cp_fm_set_all(preconditioner_env%base_fm, alpha=0.0_dp, beta=1.0_dp)
687 END SUBROUTINE prepare_low_rank_base
715 matrix_t, mo_set, energy_gap, convert_precond_to_dbcsr, chol_type)
718 INTEGER,
INTENT(IN) :: precon_type, solver_type
720 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: matrix_s, matrix_t
722 REAL(kind=
dp) :: energy_gap
723 LOGICAL,
INTENT(IN),
OPTIONAL :: convert_precond_to_dbcsr
724 INTEGER,
INTENT(IN),
OPTIONAL :: chol_type
726 CHARACTER(len=*),
PARAMETER :: routinen =
'make_preconditioner'
728 INTEGER :: handle, k, max_rank, my_solver_type, &
729 nao, nhomo, output_unit
730 LOGICAL :: my_convert_precond_to_dbcsr, &
731 needs_full_spectrum, needs_homo, &
733 REAL(kind=
dp) :: energy_homo
734 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigenvalues_ot
741 CALL timeset(routinen, handle)
743 CALL get_mo_set(mo_set=mo_set, mo_coeff=mo_coeff, mo_coeff_b=mo_coeff_b, homo=nhomo)
744 use_mo_coeff_b = mo_set%use_mo_coeff_b
748 my_convert_precond_to_dbcsr = .false.
749 IF (
PRESENT(convert_precond_to_dbcsr)) my_convert_precond_to_dbcsr = convert_precond_to_dbcsr
754 my_convert_precond_to_dbcsr = .false.
764 needs_full_spectrum = .false.
767 SELECT CASE (precon_type)
769 needs_full_spectrum = .true.
771 IF (use_mo_coeff_b)
THEN
777 needs_full_spectrum = .true.
782 cpabort(
"The preconditioner is unknown ...")
785 ALLOCATE (eigenvalues_ot(k))
787 IF (needs_full_spectrum)
THEN
794 IF (use_mo_coeff_b)
THEN
796 eigenvalues_ot, do_rotation=.false., &
797 para_env=mo_coeff%matrix_struct%para_env, &
798 blacs_env=mo_coeff%matrix_struct%context)
801 eigenvalues_ot, do_rotation=.false.)
804 cpassert(nhomo > 0 .AND. nhomo <= k)
805 energy_homo = eigenvalues_ot(nhomo)
809 cpabort(
"Not yet implemented")
816 my_solver_type = solver_type
817 preconditioner_env%in_use = precon_type
819 IF (
PRESENT(chol_type)) preconditioner_env%cholesky_use = chol_type
820 preconditioner_env%in_use = precon_type
821 preconditioner_env%lattice_fft_active = .false.
822 preconditioner_env%lattice_corrected_projection_error = 0.0_dp
823 IF (
ALLOCATED(preconditioner_env%lattice_inverse_k))
THEN
824 DEALLOCATE (preconditioner_env%lattice_inverse_k)
826 IF (
ALLOCATED(preconditioner_env%lattice_state_inverse_k))
THEN
827 DEALLOCATE (preconditioner_env%lattice_state_inverse_k)
829 IF (
ALLOCATED(preconditioner_env%lattice_occ_vectors))
THEN
830 DEALLOCATE (preconditioner_env%lattice_occ_vectors)
832 IF (
ALLOCATED(preconditioner_env%lattice_occ_dual))
THEN
833 DEALLOCATE (preconditioner_env%lattice_occ_dual)
835 IF (
ALLOCATED(preconditioner_env%lattice_local_indices))
THEN
836 DEALLOCATE (preconditioner_env%lattice_local_indices)
838 IF (
ALLOCATED(preconditioner_env%lattice_local_operator))
THEN
839 DEALLOCATE (preconditioner_env%lattice_local_operator)
841 IF (
ALLOCATED(preconditioner_env%lattice_local_coarse_inverse))
THEN
842 DEALLOCATE (preconditioner_env%lattice_local_coarse_inverse)
844 IF (
ALLOCATED(preconditioner_env%lattice_state_local_indices))
THEN
845 DEALLOCATE (preconditioner_env%lattice_state_local_indices)
847 IF (
ALLOCATED(preconditioner_env%lattice_state_local_operator))
THEN
848 DEALLOCATE (preconditioner_env%lattice_state_local_operator)
850 IF (
ALLOCATED(preconditioner_env%lattice_state_local_coarse_inverse))
THEN
851 DEALLOCATE (preconditioner_env%lattice_state_local_coarse_inverse)
855 energy_homo, eigenvalues_ot, energy_gap, my_solver_type)
858 context=preconditioner_env%ctxt, &
859 para_env=preconditioner_env%para_env)
865 energy_homo, eigenvalues_ot(1:nhomo), energy_gap, my_solver_type)
871 SELECT CASE (precon_type)
873 cpassert(
ASSOCIATED(preconditioner_env%sparse_matrix))
874 CALL prepare_lattice_operator(preconditioner_env, preconditioner_env%sparse_matrix, &
875 "FULL_KINETIC", nhomo)
877 cpassert(
ASSOCIATED(preconditioner_env%sparse_matrix))
878 CALL prepare_lattice_operator(preconditioner_env, preconditioner_env%sparse_matrix, &
879 "FULL_SINGLE_INVERSE", nhomo)
881 cpassert(
ASSOCIATED(preconditioner_env%sparse_matrix))
882 CALL prepare_lattice_operator(preconditioner_env, preconditioner_env%sparse_matrix, &
883 "FULL_S_INVERSE", nhomo)
885 cpassert(
PRESENT(matrix_s))
886 cpassert(
ASSOCIATED(matrix_s))
887 CALL prepare_lattice_state_operator(preconditioner_env, matrix_s, &
888 "FULL_ALL_COVARIANT")
892 IF (.NOT. preconditioner_env%lattice_fft_active)
THEN
899 preconditioner_env%spectral_reference = energy_homo
900 preconditioner_env%spectral_window = &
901 max(fermi_low_rank_min_window, fermi_low_rank_gap_factor*preconditioner_env%energy_gap)
902 preconditioner_env%spectral_base_scale = 1.0_dp/preconditioner_env%spectral_window
903 max_rank = preconditioner_env%spectral_max_rank
904 IF (max_rank == -1) max_rank =
SIZE(preconditioner_env%full_evals) - nhomo
906 preconditioner_env%full_evals, nhomo, max_rank, &
907 fermi_low_rank_degeneracy_tolerance)
908 CALL prepare_low_rank_base(preconditioner_env, matrix_s)
909 IF (preconditioner_env%lattice_fft_active)
THEN
912 DO WHILE (preconditioner_env%spectral_rank > 0)
914 preconditioner_env%full_evals(nhomo + preconditioner_env%spectral_rank), &
915 preconditioner_env%spectral_reference, preconditioner_env%energy_gap) >= &
916 preconditioner_env%spectral_base_scale)
EXIT
917 preconditioner_env%spectral_rank = preconditioner_env%spectral_rank - 1
920 IF (preconditioner_env%para_env%is_source())
THEN
923 IF (output_unit > 0)
THEN
924 WRITE (output_unit,
'(T2,A,F14.8,A,I0)') &
925 "OT| FERMI_LOW_RANK common reference [hartree]: ", &
926 preconditioner_env%spectral_reference,
" retained rank: ", &
927 preconditioner_env%spectral_rank
935 IF (.NOT. preconditioner_env%lattice_fft_active)
THEN
936 IF (my_convert_precond_to_dbcsr)
THEN
941 preconditioner_env%base_dbcsr_matrix, matrix_h)
945 preconditioner_env%para_env, preconditioner_env%ctxt)
949 DEALLOCATE (eigenvalues_ot)
951 CALL timestop(handle)
968 matrix_c_re, matrix_c_im, &
969 matrix_h_re, matrix_h_im, &
970 matrix_s_re, matrix_s_im, &
971 energy_gap, solver_type)
974 TYPE(
dbcsr_type),
POINTER :: matrix_c_re, matrix_c_im, matrix_h_re, &
975 matrix_h_im, matrix_s_re, matrix_s_im
976 REAL(kind=
dp),
INTENT(IN) :: energy_gap
977 INTEGER,
INTENT(IN) :: solver_type
979 CHARACTER(len=*),
PARAMETER :: routinen =
'make_preconditioner_complex_full_all'
984 CALL timeset(routinen, handle)
986 cpassert(
ASSOCIATED(matrix_c_re))
987 cpassert(
ASSOCIATED(matrix_c_im))
988 cpassert(
ASSOCIATED(matrix_h_re))
989 cpassert(
ASSOCIATED(matrix_h_im))
990 cpassert(
ASSOCIATED(matrix_s_re))
991 cpassert(
ASSOCIATED(matrix_s_im))
993 cpabort(
'Complex FULL_ALL supports only PRECOND_SOLVER DEFAULT')
996 'complex FULL_ALL C', matrix_c)
998 'complex FULL_ALL H', matrix_h)
1000 'complex FULL_ALL S', matrix_s)
1002 energy_gap=energy_gap)
1008 CALL timestop(handle)
1024 energy_gap, solver_type, handled)
1027 TYPE(
cp_fm_p_type),
INTENT(IN) :: matrix_h(:, :), matrix_s(:, :)
1028 REAL(
dp),
INTENT(IN) :: energy_gap
1029 INTEGER,
INTENT(IN) :: solver_type
1030 LOGICAL,
INTENT(OUT) :: handled
1032 CHARACTER(len=*),
PARAMETER :: routinen =
'make_preconditioner_complex_full_all_batch'
1034 INTEGER :: first, handle, i, j, k, n, nbatch, &
1036 TYPE(full_all_work_type),
ALLOCATABLE :: work(:)
1040 nchannels =
SIZE(preconditioners)
1044 IF (preconditioners(i)%preconditioner%para_env%num_pe /= 1)
RETURN
1046 CALL timeset(routinen, handle)
1049 ALLOCATE (work(nworkers))
1050 DO first = 1, nchannels, nworkers
1051 nbatch = min(nworkers, nchannels - first + 1)
1054 p => preconditioners(i)%preconditioner
1055 CALL dbcsr_pair_to_cfm(matrix_c(1, i)%matrix, matrix_c(2, i)%matrix, p,
'FULL_ALL C', work(j)%c)
1056 CALL cp_cfm_create(work(j)%h, matrix_h(1, i)%matrix%matrix_struct, name=
'FULL_ALL H')
1057 CALL cp_cfm_create(work(j)%s, matrix_s(1, i)%matrix%matrix_struct, name=
'FULL_ALL S')
1058 CALL cp_fm_to_cfm(matrix_h(1, i)%matrix, matrix_h(2, i)%matrix, work(j)%h)
1059 CALL cp_fm_to_cfm(matrix_s(1, i)%matrix, matrix_s(2, i)%matrix, work(j)%s)
1061 energy_gap=energy_gap)
1062 n =
SIZE(p%full_evals)
1078 IF (work(j)%info /= 0) cpabort(
'Local FULL_ALL generalized diagonalization failed')
1080 p => preconditioners(i)%preconditioner
1081 p%full_evals(:) = work(j)%solver%evals(:)
1084 k =
SIZE(p%occ_evals)
1085 p%full_evals(1:k) = p%occ_evals(:)
1093 CALL timestop(handle)
1108 matrix_h_re, matrix_h_im, &
1109 matrix_s_re, matrix_s_im, &
1110 mo_set, energy_gap, solver_type)
1113 TYPE(
dbcsr_type),
POINTER :: matrix_h_re, matrix_h_im, matrix_s_re, &
1116 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1117 INTEGER,
INTENT(IN) :: solver_type
1120 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1123 NULLIFY (eigenvalues)
1124 cpassert(
ASSOCIATED(matrix_h_re))
1125 cpassert(
ASSOCIATED(matrix_h_im))
1126 cpassert(
ASSOCIATED(matrix_s_re))
1127 cpassert(
ASSOCIATED(matrix_s_im))
1129 cpabort(
'Complex FULL_SINGLE supports only PRECOND_SOLVER DEFAULT')
1131 CALL get_mo_set(mo_set, homo=homo, eigenvalues=eigenvalues)
1132 cpassert(
ASSOCIATED(eigenvalues))
1133 cpassert(homo > 0 .AND. homo <=
SIZE(eigenvalues))
1136 'complex FULL_SINGLE H', matrix_h)
1138 'complex FULL_SINGLE S', matrix_s)
1140 eigenvalues(homo), energy_gap)
1160 preconditioner_env, matrix_c_re, matrix_c_im, matrix_h_re, matrix_h_im, &
1161 matrix_s_re, matrix_s_im, energy_gap, max_rank, solver_type)
1164 TYPE(
dbcsr_type),
POINTER :: matrix_c_re, matrix_c_im, matrix_h_re, &
1165 matrix_h_im, matrix_s_re, matrix_s_im
1166 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1167 INTEGER,
INTENT(IN) :: max_rank, solver_type
1172 cpabort(
'Complex FERMI_LOW_RANK supports only PRECOND_SOLVER DEFAULT')
1176 'complex FERMI_LOW_RANK C', matrix_c)
1178 'complex FERMI_LOW_RANK H', matrix_h)
1180 'complex FERMI_LOW_RANK S', matrix_s)
1182 preconditioner_env, matrix_c, matrix_h, matrix_s, energy_gap, &
1183 max_rank, max(fermi_low_rank_min_window, fermi_low_rank_gap_factor*energy_gap), &
1184 fermi_low_rank_degeneracy_tolerance)
1206 preconditioner_env, matrix_c_re, matrix_c_im, matrix_h_re, matrix_h_im, &
1207 matrix_s_re, matrix_s_im, energy_gap, solver_type, occupation_signature)
1210 TYPE(
dbcsr_type),
POINTER :: matrix_c_re, matrix_c_im, matrix_h_re, &
1211 matrix_h_im, matrix_s_re, matrix_s_im
1212 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1213 INTEGER,
INTENT(IN) :: solver_type
1214 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
1215 OPTIONAL :: occupation_signature
1220 cpabort(
'Complex FULL_ALL_COVARIANT supports only PRECOND_SOLVER DEFAULT')
1223 'complex FULL_ALL_COVARIANT C', matrix_c)
1225 'complex FULL_ALL_COVARIANT H', matrix_h)
1227 'complex FULL_ALL_COVARIANT S', matrix_s)
1229 energy_gap, occupation_signature)
1250 matrix_c_re, matrix_c_im, &
1251 matrix_h_re, matrix_h_im, &
1252 matrix_s_re, matrix_s_im, &
1253 energy_gap, solver_type)
1256 TYPE(
dbcsr_type),
POINTER :: matrix_c_re, matrix_c_im, matrix_h_re, &
1257 matrix_h_im, matrix_s_re, matrix_s_im
1258 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1259 INTEGER,
INTENT(IN) :: solver_type
1264 TYPE(
cp_fm_type) :: matrix_c_im_fm, matrix_c_re_fm, &
1265 matrix_h_im_fm, matrix_h_re_fm, &
1266 matrix_s_im_fm, matrix_s_re_fm
1268 NULLIFY (fm_struct_mo, fm_struct_square)
1269 cpassert(
ASSOCIATED(matrix_c_re))
1270 cpassert(
ASSOCIATED(matrix_c_im))
1271 cpassert(
ASSOCIATED(matrix_h_re))
1272 cpassert(
ASSOCIATED(matrix_h_im))
1273 cpassert(
ASSOCIATED(matrix_s_re))
1274 cpassert(
ASSOCIATED(matrix_s_im))
1277 cpabort(
"Complex FULL_SINGLE_INVERSE supports only PRECOND_SOLVER DEFAULT/INVERSE_CHOLESKY")
1279 CALL dbcsr_get_info(matrix_c_re, nfullrows_total=n, nfullcols_total=k)
1280 cpassert(n > 0 .AND. k > 0 .AND. k <= n)
1283 context=preconditioner_env%ctxt, &
1284 para_env=preconditioner_env%para_env)
1286 context=preconditioner_env%ctxt, &
1287 para_env=preconditioner_env%para_env)
1288 CALL cp_fm_create(matrix_c_re_fm, fm_struct_mo, name=
'complex preconditioner C real')
1289 CALL cp_fm_create(matrix_c_im_fm, fm_struct_mo, name=
'complex preconditioner C imaginary')
1290 CALL cp_fm_create(matrix_h_re_fm, fm_struct_square, name=
'complex preconditioner H real')
1291 CALL cp_fm_create(matrix_h_im_fm, fm_struct_square, name=
'complex preconditioner H imaginary')
1292 CALL cp_fm_create(matrix_s_re_fm, fm_struct_square, name=
'complex preconditioner S real')
1293 CALL cp_fm_create(matrix_s_im_fm, fm_struct_square, name=
'complex preconditioner S imaginary')
1303 CALL cp_cfm_create(matrix_c, matrix_c_re_fm%matrix_struct, name=
'complex preconditioner C')
1304 CALL cp_cfm_create(matrix_h, matrix_h_re_fm%matrix_struct, name=
'complex preconditioner H')
1305 CALL cp_cfm_create(matrix_s, matrix_s_re_fm%matrix_struct, name=
'complex preconditioner S')
1306 CALL cp_fm_to_cfm(matrix_c_re_fm, matrix_c_im_fm, matrix_c)
1307 CALL cp_fm_to_cfm(matrix_h_re_fm, matrix_h_im_fm, matrix_h)
1308 CALL cp_fm_to_cfm(matrix_s_re_fm, matrix_s_im_fm, matrix_s)
1311 preconditioner_env%solver = solver_type
1333 matrix_s_re, matrix_s_im, solver_type)
1336 TYPE(
dbcsr_type),
POINTER :: matrix_s_re, matrix_s_im
1337 INTEGER,
INTENT(IN) :: solver_type
1343 cpabort(
"Complex FULL_S_INVERSE supports only PRECOND_SOLVER DEFAULT/INVERSE_CHOLESKY")
1346 'complex preconditioner S', matrix_s)
1348 preconditioner_env%solver = solver_type
1364 matrix_t_re, matrix_t_im, &
1365 matrix_s_re, matrix_s_im, &
1366 energy_gap, solver_type)
1369 TYPE(
dbcsr_type),
POINTER :: matrix_t_re, matrix_t_im, matrix_s_re, &
1371 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1372 INTEGER,
INTENT(IN) :: solver_type
1378 cpabort(
"Complex FULL_KINETIC supports only PRECOND_SOLVER DEFAULT/INVERSE_CHOLESKY")
1381 'complex preconditioner T', matrix_t)
1383 'complex preconditioner S', matrix_s)
1385 preconditioner_env%solver = solver_type
1401 TYPE(
dbcsr_type),
POINTER :: matrix_re, matrix_im
1403 CHARACTER(LEN=*),
INTENT(IN) :: matrix_name
1406 INTEGER :: ncol, nrow
1407 REAL(
dp),
ALLOCATABLE :: buffer(:, :)
1409 TYPE(
cp_fm_type) :: matrix_im_fm, matrix_re_fm
1412 cpassert(
ASSOCIATED(matrix_re))
1413 cpassert(
ASSOCIATED(matrix_im))
1414 CALL dbcsr_get_info(matrix_re, nfullrows_total=nrow, nfullcols_total=ncol)
1416 context=preconditioner_env%ctxt, &
1417 para_env=preconditioner_env%para_env)
1419 IF (preconditioner_env%para_env%num_pe == 1 .AND. &
1422 ALLOCATE (buffer(nrow, ncol))
1424 matrix%local_data(1:nrow, 1:ncol) = cmplx(buffer, 0.0_dp, kind=
dp)
1426 matrix%local_data(1:nrow, 1:ncol) = &
1427 matrix%local_data(1:nrow, 1:ncol) + cmplx(0.0_dp, buffer, kind=
dp)
1429 CALL cp_fm_create(matrix_re_fm, fm_struct, name=trim(matrix_name)//
' real')
1430 CALL cp_fm_create(matrix_im_fm, fm_struct, name=trim(matrix_name)//
' imaginary')
1453 INTEGER,
INTENT(IN) :: prec_type, nspins
1459 NULLIFY (para_env, blacs_env)
1460 CALL get_qs_env(qs_env, para_env=para_env, blacs_env=blacs_env)
1463 SELECT CASE (prec_type)
1476 cpabort(
"Unknown preconditioner type")
1482 SELECT CASE (prec_type)
1492 para_env=para_env, &
1493 blacs_env=blacs_env)
1521 ot_preconditioner, prec_type, solver_type, &
1522 energy_gap, nspins, has_unit_metric, &
1523 convert_to_dbcsr, chol_type, full_mo_set, chebyshev_degree, &
1524 low_rank_base, fermi_low_rank_max_rank, lattice_fft, &
1525 lattice_fft_local_cells)
1528 TYPE(
mo_set_type),
DIMENSION(:),
INTENT(INOUT) :: mos
1529 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, matrix_s
1531 INTEGER,
INTENT(IN) :: prec_type, solver_type
1532 REAL(
dp),
INTENT(IN) :: energy_gap
1533 INTEGER,
INTENT(IN) :: nspins
1534 LOGICAL,
INTENT(IN),
OPTIONAL :: has_unit_metric, convert_to_dbcsr
1535 INTEGER,
INTENT(IN),
OPTIONAL :: chol_type
1536 LOGICAL,
INTENT(IN),
OPTIONAL :: full_mo_set
1537 INTEGER,
INTENT(IN),
OPTIONAL :: chebyshev_degree, low_rank_base, &
1538 fermi_low_rank_max_rank, lattice_fft, &
1539 lattice_fft_local_cells
1541 CHARACTER(LEN=*),
PARAMETER :: routinen =
'prepare_preconditioner'
1543 CHARACTER(LEN=default_string_length) :: msg
1544 INTEGER :: handle, icall, ispin, my_chebyshev_degree, my_fermi_low_rank_max_rank, &
1545 my_lattice_fft, my_lattice_fft_local_cells, my_low_rank_base, n_loops
1546 INTEGER,
DIMENSION(5) :: nocc, norb
1547 INTEGER,
DIMENSION(:),
POINTER :: multiple_unit_cell
1548 LOGICAL :: do_co_rotate, do_kpoints, my_convert_to_dbcsr, my_full_mo_set, &
1549 my_has_unit_metric, use_covariant_full_all, use_mo_coeff_b
1553 TYPE(
dbcsr_type),
POINTER :: matrix_t, mo_coeff_b
1555 TYPE(
mo_set_type),
ALLOCATABLE,
DIMENSION(:) :: canonical_mos
1559 CALL timeset(routinen, handle)
1560 NULLIFY (matrix_t, mo_coeff_b, mo_coeff, kinetic, dft_control, para_env, blacs_env, &
1561 input, subsys_section, multiple_unit_cell)
1562 my_has_unit_metric = .false.
1563 IF (
PRESENT(has_unit_metric)) my_has_unit_metric = has_unit_metric
1564 my_convert_to_dbcsr = .true.
1565 IF (
PRESENT(convert_to_dbcsr)) my_convert_to_dbcsr = convert_to_dbcsr
1566 my_full_mo_set = .false.
1567 IF (
PRESENT(full_mo_set)) my_full_mo_set = full_mo_set
1568 my_chebyshev_degree = 8
1569 IF (
PRESENT(chebyshev_degree)) my_chebyshev_degree = chebyshev_degree
1571 IF (
PRESENT(low_rank_base)) my_low_rank_base = low_rank_base
1572 my_fermi_low_rank_max_rank = 48
1573 IF (
PRESENT(fermi_low_rank_max_rank)) my_fermi_low_rank_max_rank = fermi_low_rank_max_rank
1575 IF (
PRESENT(lattice_fft)) my_lattice_fft = lattice_fft
1576 my_lattice_fft_local_cells = 0
1577 IF (
PRESENT(lattice_fft_local_cells)) my_lattice_fft_local_cells = lattice_fft_local_cells
1578 IF (my_lattice_fft_local_cells < 0) cpabort(
"LATTICE_FFT_LOCAL_CELLS must not be negative")
1579 do_kpoints = .false.
1583 dft_control=dft_control, &
1584 do_kpoints=do_kpoints, &
1586 para_env=para_env, &
1587 blacs_env=blacs_env)
1591 cpabort(
"FERMI_LOW_RANK_BASE LATTICE_FFT requires PRECONDITIONER FERMI_LOW_RANK")
1595 cpabort(
"Unknown FERMI_LOW_RANK_BASE setting")
1601 cpabort(
"Unknown LATTICE_FFT setting")
1603 IF (my_lattice_fft_local_cells > 0 .AND. my_lattice_fft /=
ot_lattice_fft_on)
THEN
1604 cpabort(
"LATTICE_FFT_LOCAL_CELLS requires LATTICE_FFT ON")
1607 SELECT CASE (prec_type)
1611 cpabort(
"LATTICE_FFT does not support the selected OT preconditioner")
1615 cpabort(
"LATTICE_FFT requires PRECOND_SOLVER DEFAULT or INVERSE_CHOLESKY")
1617 IF (my_has_unit_metric .OR. do_kpoints .OR. .NOT.
ASSOCIATED(input))
THEN
1619 cpabort(
"LATTICE_FFT ON requires a non-unit metric in a real Gamma-point calculation")
1626 IF (.NOT.
ASSOCIATED(subsys_section))
THEN
1627 IF (my_lattice_fft ==
ot_lattice_fft_on) cpabort(
"LATTICE_FFT ON requires a SUBSYS section")
1632 i_vals=multiple_unit_cell)
1633 IF (.NOT.
ASSOCIATED(multiple_unit_cell))
THEN
1635 cpabort(
"LATTICE_FFT ON requires a valid CELL%MULTIPLE_UNIT_CELL")
1639 IF (
SIZE(multiple_unit_cell) /= 3 .OR. any(multiple_unit_cell <= 0))
THEN
1641 cpabort(
"LATTICE_FFT ON requires a valid CELL%MULTIPLE_UNIT_CELL")
1644 ELSE IF (product(multiple_unit_cell) <= 1 .AND. my_lattice_fft ==
ot_lattice_fft_on)
THEN
1645 cpabort(
"LATTICE_FFT ON requires an explicitly replicated multiple unit cell")
1647 IF (my_lattice_fft_local_cells >= product(multiple_unit_cell))
THEN
1648 cpabort(
"LATTICE_FFT_LOCAL_CELLS must be smaller than the replicated cell count")
1654 IF (dft_control%qs_control%semi_empirical .OR. dft_control%qs_control%dftb .OR. &
1655 dft_control%qs_control%xtb)
THEN
1657 msg =
"Full_kinetic not available for semi-empirical methods"
1660 matrix_t => matrix_s(1)%matrix
1662 cpassert(.NOT. my_has_unit_metric)
1664 matrix_t => kinetic(1)%matrix
1670 IF (my_full_mo_set)
THEN
1671 DO ispin = 1, nspins
1672 CALL get_mo_set(mo_set=mos(ispin), homo=nocc(ispin), nmo=norb(ispin))
1673 CALL set_mo_set(mo_set=mos(ispin), homo=norb(ispin))
1680 SELECT CASE (prec_type)
1685 do_co_rotate =
ASSOCIATED(qs_env%mo_derivs)
1686 DO ispin = 1, nspins
1687 CALL get_mo_set(mo_set=mos(ispin), mo_coeff_b=mo_coeff_b, mo_coeff=mo_coeff)
1688 use_mo_coeff_b = mos(ispin)%use_mo_coeff_b
1689 IF (use_mo_coeff_b .AND. do_co_rotate)
THEN
1691 do_rotation=.true., &
1692 co_rotate=qs_env%mo_derivs(ispin)%matrix, &
1693 para_env=para_env, &
1694 blacs_env=blacs_env)
1695 ELSE IF (use_mo_coeff_b)
THEN
1697 do_rotation=.true., &
1698 para_env=para_env, &
1699 blacs_env=blacs_env)
1713 ALLOCATE (canonical_mos(nspins))
1714 DO ispin = 1, nspins
1716 CALL get_mo_set(mo_set=canonical_mos(ispin), mo_coeff_b=mo_coeff_b, mo_coeff=mo_coeff)
1717 IF (canonical_mos(ispin)%use_mo_coeff_b)
THEN
1719 canonical_mos(ispin)%use_mo_coeff_b = .false.
1721 CALL canonicalize_full_all_copy(ot_preconditioner(ispin)%preconditioner, &
1722 mo_coeff, matrix_ks(ispin)%matrix, &
1723 canonical_mos(ispin)%homo)
1730 SELECT CASE (prec_type)
1732 DO ispin = 1,
SIZE(ot_preconditioner)
1733 ot_preconditioner(ispin)%preconditioner%in_use = 0
1736 DO icall = 1, n_loops
1737 ot_preconditioner(icall)%preconditioner%polynomial_degree = my_chebyshev_degree
1738 ot_preconditioner(icall)%preconditioner%low_rank_base = my_low_rank_base
1739 ot_preconditioner(icall)%preconditioner%lattice_fft_mode = my_lattice_fft
1740 ot_preconditioner(icall)%preconditioner%lattice_local_cells = my_lattice_fft_local_cells
1741 ot_preconditioner(icall)%preconditioner%lattice_dims = [1, 1, 1]
1743 cpassert(
ASSOCIATED(multiple_unit_cell))
1744 ot_preconditioner(icall)%preconditioner%lattice_dims = multiple_unit_cell
1746 ot_preconditioner(icall)%preconditioner%spectral_max_rank = my_fermi_low_rank_max_rank
1747 IF (my_has_unit_metric)
THEN
1748 IF (use_covariant_full_all)
THEN
1750 prec_type, solver_type, &
1751 matrix_h=matrix_ks(icall)%matrix, &
1752 mo_set=canonical_mos(icall), &
1753 energy_gap=energy_gap, &
1754 convert_precond_to_dbcsr=my_convert_to_dbcsr)
1757 prec_type, solver_type, &
1758 matrix_h=matrix_ks(icall)%matrix, &
1759 mo_set=mos(icall), &
1760 energy_gap=energy_gap, &
1761 convert_precond_to_dbcsr=my_convert_to_dbcsr)
1764 IF (use_covariant_full_all)
THEN
1766 prec_type, solver_type, &
1767 matrix_h=matrix_ks(icall)%matrix, &
1768 matrix_s=matrix_s(1)%matrix, matrix_t=matrix_t, &
1769 mo_set=canonical_mos(icall), &
1770 energy_gap=energy_gap, &
1771 convert_precond_to_dbcsr=my_convert_to_dbcsr, chol_type=chol_type)
1774 prec_type, solver_type, &
1775 matrix_h=matrix_ks(icall)%matrix, &
1776 matrix_s=matrix_s(1)%matrix, matrix_t=matrix_t, &
1777 mo_set=mos(icall), energy_gap=energy_gap, &
1778 convert_precond_to_dbcsr=my_convert_to_dbcsr, chol_type=chol_type)
1784 IF (
ALLOCATED(canonical_mos))
THEN
1785 DO ispin = 1,
SIZE(canonical_mos)
1788 DEALLOCATE (canonical_mos)
1792 IF (my_full_mo_set)
THEN
1793 DO ispin = 1, nspins
1794 CALL set_mo_set(mo_set=mos(ispin), homo=nocc(ispin))
1798 CALL timestop(handle)
1809 SUBROUTINE canonicalize_full_all_copy(preconditioner_env, mo_coeff, matrix_h, nocc)
1814 INTEGER,
INTENT(IN) :: nocc
1816 CHARACTER(LEN=*),
PARAMETER :: routinen =
'canonicalize_full_all_copy'
1818 INTEGER :: handle, nao
1819 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: occupied_evals
1821 TYPE(
cp_fm_type) :: canonical_coeff, h_block, weighted_coeff
1823 CALL timeset(routinen, handle)
1828 context=preconditioner_env%ctxt, &
1829 para_env=preconditioner_env%para_env)
1830 CALL cp_fm_create(canonical_coeff, fm_struct, name=routinen)
1831 CALL cp_fm_create(weighted_coeff, fm_struct, name=routinen)
1836 context=preconditioner_env%ctxt, &
1837 para_env=preconditioner_env%para_env)
1839 IF (
ASSOCIATED(preconditioner_env%occ_rotation_dbcsr))
THEN
1842 IF (
ASSOCIATED(preconditioner_env%occ_rotation))
THEN
1844 DEALLOCATE (preconditioner_env%occ_rotation)
1846 ALLOCATE (preconditioner_env%occ_rotation)
1847 CALL cp_fm_create(preconditioner_env%occ_rotation, fm_struct, name=
"occupied rotation")
1851 CALL parallel_gemm(
'T',
'N', nocc, nocc, nao, 1.0_dp, canonical_coeff, &
1852 weighted_coeff, 0.0_dp, h_block)
1853 ALLOCATE (occupied_evals(nocc))
1856 CALL parallel_gemm(
'N',
'N', nao, nocc, nocc, 1.0_dp, canonical_coeff, &
1857 preconditioner_env%occ_rotation, 0.0_dp, weighted_coeff)
1858 CALL cp_fm_to_fm(weighted_coeff, mo_coeff, nocc, 1, 1)
1860 DEALLOCATE (occupied_evals)
1864 CALL timestop(handle)
1866 END SUBROUTINE canonicalize_full_all_copy
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
methods related to the blacs parallel environment
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_triangular_multiply(triangular_matrix, matrix_b, side, transa_tr, invert_tr, uplo_tr, unit_diag_tr, n_rows, n_cols, alpha)
Multiplies in place by a triangular matrix: matrix_b = alpha op(triangular_matrix) matrix_b or (if si...
subroutine, public cp_cfm_triangular_invert(matrix_a, uplo, info_out)
Inverts a triangular matrix.
various cholesky decomposition related routines
subroutine, public cp_cfm_cholesky_decompose(matrix, n, info_out)
Used to replace a symmetric positive definite matrix M with its Cholesky decomposition U: M = U^T * U...
used for collecting diagonalization schemes available for cp_cfm_type
subroutine, public cp_cfm_heevd_local(matrix, vectors, info, ws)
Local LAPACK ZHEEVD with prepared scratch, without allocation or communication.
subroutine, public cp_cfm_local_workspace_prepare(ws, n, a, b)
Query LAPACK once per matrix order/solver and retain private scratch across k points.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_fm_to_cfm(msourcer, msourcei, mtarget)
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value f...
subroutine, public cp_cfm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
Creates a new full matrix with the given structure.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release_p(matrix)
...
character function, public dbcsr_get_matrix_type(matrix)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
subroutine, public copy_dbcsr_to_fm(matrix, fm, plan, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_dbcsr_to_local(matrix, dense)
Load a single-rank, nonsymmetric matrix without redistribution.
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_uplo_to_full(matrix, work, uplo)
given a triangular matrix according to uplo, computes the corresponding full matrix
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_invert(matrix, n, info_out, work)
Replace the upper Cholesky factor by the upper triangle of the inverse. When work is provided,...
subroutine, public cp_fm_cholesky_decompose(matrix, n, info_out)
used to replace a symmetric positive def. matrix M with its cholesky decomposition U: M = U^T * U,...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
logical, save, public direct_generalized_diagonalization
subroutine, public choose_eigv_solver(matrix, eigenvectors, eigenvalues, info)
Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small sy...
logical function, public diag_check_requested()
Return whether diagonalization checks should be performed.
logical, save, public diag_lib_explicit
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Block-circulant inverse operators for replicated-cell OT preconditioners.
real(kind=dp), parameter, public lattice_fft_auto_max_cost_ratio
subroutine, public build_lattice_local_correction(operator_matrix, lattice_dims, local_cell_count, correction_indices, operator_columns, coarse_inverse, corrected_projection_error, info)
Build a balanced local correction for selected non-circulant cell blocks.
subroutine, public build_lattice_inverse(operator_matrix, lattice_dims, inverse_k, projection_error, used_fft, info)
Project a cell-major SPD operator onto lattice translations and invert its Fourier blocks.
pure real(kind=dp) function, public lattice_local_storage_ratio(lattice_dims, operator_count, local_cell_count)
Estimate balanced-local-correction storage relative to one dense real operator.
pure real(kind=dp) function, public lattice_fft_storage_ratio(lattice_dims, operator_count)
Estimate reciprocal-block storage relative to one dense real operator.
pure logical function, public lattice_fft_auto_select(lattice_dims, block_size, rhs_count, operator_count, num_pe, projection_error, used_fft, info)
Conservative error-, work-, and storage-aware AUTO selector.
subroutine, public lattice_grid(lattice_dims, index_to_cell, xkp)
Enumerate a regular direct/reciprocal lattice with the first direction varying fastest.
integer, parameter, public lattice_fft_auto_min_cells
subroutine, public build_lattice_inverse_from_blocks(blocks, lattice_dims, inverse_k, used_fft, info)
Transform and invert already projected real-space lattice blocks.
pure real(kind=dp) function, public lattice_local_cost_ratio(lattice_dims, local_cell_count)
Estimate balanced-local-correction work relative to a dense inverse application.
pure real(kind=dp) function, public lattice_fft_cost_ratio(lattice_dims, block_size, rhs_count, num_pe)
Estimate lattice-FFT application work relative to a dense inverse application.
real(kind=dp), parameter, public lattice_fft_auto_max_storage_ratio
Small algebraic helpers for the rotationally covariant low-rank OT preconditioner.
pure elemental real(kind=dp) function, public low_rank_inverse_weight(eigenvalue, reference, energy_gap)
Spectral inverse weight relative to a common occupied reference level.
pure integer function, public low_rank_select_rank(eigenvalues, nocc, max_rank, degeneracy_tolerance)
Select a bounded spectral rank without cutting a degenerate boundary manifold.
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
computes preconditioners, and implements methods to apply them currently used in qs_ot
subroutine, public apply_preconditioner_dbcsr_complex(preconditioner_env, matrix_in_re, matrix_in_im, matrix_out_re, matrix_out_im)
Apply a complex orbital preconditioner to paired real/imaginary DBCSR matrices.
subroutine, public apply_preconditioner_fm(preconditioner_env, matrix_in, matrix_out)
applies a previously created preconditioner to a full matrix
subroutine, public apply_preconditioner_cfm_complex(preconditioner_env, matrix_in, matrix_out)
Apply a complex k-point orbital preconditioner.
subroutine, public apply_preconditioner_dbcsr(preconditioner_env, matrix_in, matrix_out)
...
subroutine, public apply_preconditioner_complex_batch(preconditioners, matrix_in, matrix_out, handled, output_scale)
Apply single-rank complex preconditioners in bounded OpenMP batches. Packing and DBCSR writeback stay...
computes preconditioners, and implements methods to apply them currently used in qs_ot
subroutine, public make_complex_full_single_inverse(preconditioner_env, matrix_c0, matrix_h, matrix_s, energy_gap)
Build a gauge-covariant FULL_SINGLE_INVERSE operator for a complex k-point channel.
subroutine, public make_complex_full_kinetic(preconditioner_env, matrix_t, matrix_s, energy_gap)
Build the inverse complex kinetic-plus-overlap preconditioner.
subroutine, public make_complex_full_s_inverse(preconditioner_env, matrix_s)
Build the inverse complex overlap preconditioner.
subroutine, public make_complex_full_all_covariant(preconditioner_env, matrix_c0, matrix_h, matrix_s, energy_gap, occupation_signature)
Build the gauge-covariant FULL_ALL inverse for a complex k-point channel.
subroutine, public make_complex_full_single(preconditioner_env, matrix_h, matrix_s, energy_homo, energy_gap)
Build the complex spectral FULL_SINGLE preconditioner.
subroutine, public prepare_complex_full_all(preconditioner_env, matrix_c0, matrix_h, matrix_s, matrix_tmp, matrix_s_copy, c0_evals, energy_gap)
Prepare the FULL_ALL eigenproblem using the same construction for every solver.
subroutine, public make_complex_fermi_low_rank(preconditioner_env, matrix_c0, matrix_h, matrix_s, energy_gap, max_rank, spectral_window, degeneracy_tolerance)
Build the bounded low-rank spectral inverse for a complex k-point channel.
subroutine, public make_preconditioner_matrix(preconditioner_env, matrix_h, matrix_s, matrix_t, mo_coeff, energy_homo, eigenvalues_ot, energy_gap, my_solver_type)
...
subroutine, public make_complex_full_all(preconditioner_env, matrix_c0, matrix_h, matrix_s, c0_evals, energy_gap)
Build the state-selective FULL_ALL operator for a complex k-point channel. The occupied/reference sub...
solves the preconditioner, contains to utility function for fm<->dbcsr transfers, should be moved soo...
subroutine, public transfer_dbcsr_to_fm(dbcsr_matrix, fm_matrix, para_env, context)
transfers a dbcsr to a full matrix
subroutine, public solve_preconditioner(my_solver_type, preconditioner_env, matrix_s, matrix_h)
...
subroutine, public transfer_fm_to_dbcsr(fm_matrix, dbcsr_matrix, template_mat)
transfers a full matrix to a dbcsr
subroutine, public init_preconditioner(preconditioner_env, para_env, blacs_env)
...
subroutine, public destroy_preconditioner(preconditioner_env)
...
computes preconditioners, and implements methods to apply them currently used in qs_ot
subroutine, public make_preconditioner_complex_full_s_inverse(preconditioner_env, matrix_s_re, matrix_s_im, solver_type)
Construct a complex FULL_S_INVERSE preconditioner.
subroutine, public make_preconditioner_complex_full_single(preconditioner_env, matrix_h_re, matrix_h_im, matrix_s_re, matrix_s_im, mo_set, energy_gap, solver_type)
Construct a complex FULL_SINGLE preconditioner from H(k) and S(k).
subroutine, public dbcsr_pair_to_cfm(matrix_re, matrix_im, preconditioner_env, matrix_name, matrix)
Copy a real/imaginary DBCSR pair to one distributed complex full matrix.
subroutine, public make_preconditioner_complex_full_single_inverse(preconditioner_env, matrix_c_re, matrix_c_im, matrix_h_re, matrix_h_im, matrix_s_re, matrix_s_im, energy_gap, solver_type)
Construct a complex FULL_SINGLE_INVERSE preconditioner without discarding Im(H,S,C).
subroutine, public make_preconditioner_complex_full_all_batch(preconditioners, matrix_c, matrix_h, matrix_s, energy_gap, solver_type, handled)
Build local FULL_ALL preconditioners from cached operators in bounded batches. Only the independent e...
subroutine, public make_preconditioner_complex_full_all_covariant(preconditioner_env, matrix_c_re, matrix_c_im, matrix_h_re, matrix_h_im, matrix_s_re, matrix_s_im, energy_gap, solver_type, occupation_signature)
Construct rotation-covariant FULL_ALL for one complex k-point channel.
subroutine, public restart_preconditioner(qs_env, preconditioner, prec_type, nspins)
Allows for a restart of the preconditioner depending on the method it purges all arrays or keeps them...
subroutine, public prepare_preconditioner(qs_env, mos, matrix_ks, matrix_s, ot_preconditioner, prec_type, solver_type, energy_gap, nspins, has_unit_metric, convert_to_dbcsr, chol_type, full_mo_set, chebyshev_degree, low_rank_base, fermi_low_rank_max_rank, lattice_fft, lattice_fft_local_cells)
...
subroutine, public make_preconditioner_complex_full_all(preconditioner_env, matrix_c_re, matrix_c_im, matrix_h_re, matrix_h_im, matrix_s_re, matrix_s_im, energy_gap, solver_type)
Construct FULL_ALL directly from one complex H(k), S(k), and C(k) channel.
subroutine, public make_preconditioner_complex_fermi_low_rank(preconditioner_env, matrix_c_re, matrix_c_im, matrix_h_re, matrix_h_im, matrix_s_re, matrix_s_im, energy_gap, max_rank, solver_type)
Construct FERMI_LOW_RANK directly for one complex k-point channel.
subroutine, public make_preconditioner_complex_full_kinetic(preconditioner_env, matrix_t_re, matrix_t_im, matrix_s_re, matrix_s_im, energy_gap, solver_type)
Construct a complex FULL_KINETIC preconditioner.
subroutine, public make_preconditioner(preconditioner_env, precon_type, solver_type, matrix_h, matrix_s, matrix_t, mo_set, energy_gap, convert_precond_to_dbcsr, chol_type)
...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
collects routines that perform operations directly related to MOs
Definition and initialisation of the mo data type.
subroutine, public duplicate_mo_set(mo_set_new, mo_set_old)
allocate a new mo_set, and copy the old data
subroutine, public set_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, uniform_occupation, kts, mu, flexible_electron_count)
Set the components of a MO set data structure.
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count, cmo_coeff)
Get the components of a MO set data structure.
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Represent a complex full matrix.
keeps the information about the structure of a full matrix
just to build arrays of pointers to matrices
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment