18 deallocate_arnoldi_env,&
19 get_selected_ritz_val,&
20 get_selected_ritz_vector,&
21 set_arnoldi_initial_vector,&
75#include "./base/base_uses.f90"
81 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'preconditioner_makes'
103 c0_evals, energy_gap)
106 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix_c0, matrix_h, matrix_s
107 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: c0_evals
108 REAL(kind=
dp),
INTENT(IN) :: energy_gap
110 CHARACTER(len=*),
PARAMETER :: routinen =
'make_complex_full_all'
111 REAL(kind=
dp),
PARAMETER :: fudge_factor = 0.25_dp, &
112 lambda_base = 10.0_dp
114 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:) :: shifted_evals
115 COMPLEX(KIND=dp),
CONTIGUOUS,
DIMENSION(:, :), &
116 POINTER :: local_data
117 INTEGER :: handle, j, k, n, ncol_local, nrow_local
118 INTEGER,
DIMENSION(:),
POINTER :: col_indices
119 REAL(kind=
dp) :: error_estimate, lambda
120 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: residual_norm_sq
121 TYPE(
cp_cfm_type) :: matrix_chc, matrix_diag_work, matrix_hc0, matrix_s_copy, matrix_sc0, &
122 matrix_sc_chc, matrix_shifted_sc, matrix_tmp
124 CALL timeset(routinen, handle)
128 cpassert(k > 0 .AND. k <= n)
129 cpassert(
SIZE(c0_evals) >= k)
130 cpassert(energy_gap > 0.0_dp)
132 IF (
ASSOCIATED(preconditioner_env%complex_fm))
THEN
134 DEALLOCATE (preconditioner_env%complex_fm)
136 IF (
ASSOCIATED(preconditioner_env%occ_evals))
DEALLOCATE (preconditioner_env%occ_evals)
137 IF (
ASSOCIATED(preconditioner_env%full_evals))
DEALLOCATE (preconditioner_env%full_evals)
139 ALLOCATE (preconditioner_env%complex_fm)
140 CALL cp_cfm_create(preconditioner_env%complex_fm, matrix_h%matrix_struct, &
141 name=
'complex FULL_ALL eigenvectors')
142 ALLOCATE (preconditioner_env%full_evals(n), preconditioner_env%occ_evals(k))
144 CALL cp_cfm_create(matrix_hc0, matrix_c0%matrix_struct, name=
'complex FULL_ALL HC')
145 CALL cp_cfm_create(matrix_sc0, matrix_c0%matrix_struct, name=
'complex FULL_ALL SC')
146 CALL cp_cfm_create(matrix_chc, matrix_c0%matrix_struct, nrow=k, ncol=k, &
147 name=
'complex FULL_ALL CHC')
149 name=
'complex FULL_ALL SC CHC')
150 CALL cp_cfm_create(matrix_shifted_sc, matrix_c0%matrix_struct, &
151 name=
'complex FULL_ALL shifted SC')
152 CALL cp_cfm_create(matrix_tmp, matrix_h%matrix_struct, name=
'complex FULL_ALL projected H')
153 CALL cp_cfm_create(matrix_s_copy, matrix_s%matrix_struct, name=
'complex FULL_ALL S copy')
154 CALL cp_cfm_create(matrix_diag_work, matrix_h%matrix_struct, &
155 name=
'complex FULL_ALL diagonalization work')
164 ALLOCATE (shifted_evals(k), residual_norm_sq(k))
165 shifted_evals(:) = cmplx(c0_evals(1:k), 0.0_dp, kind=
dp)
173 transa_tr=
'C', invert_tr=.true., uplo_tr=
'U')
175 residual_norm_sq(:) = 0.0_dp
176 CALL cp_cfm_get_info(matrix_shifted_sc, nrow_local=nrow_local, ncol_local=ncol_local, &
177 col_indices=col_indices, local_data=local_data)
179 residual_norm_sq(col_indices(j)) = residual_norm_sq(col_indices(j)) + &
180 sum(abs(local_data(1:nrow_local, j))**2)
182 CALL preconditioner_env%para_env%sum(residual_norm_sq)
183 error_estimate = sqrt(maxval(residual_norm_sq))
184 preconditioner_env%energy_gap = max(energy_gap, error_estimate*fudge_factor)
185 lambda = lambda_base + error_estimate
197 shifted_evals(:) = cmplx(c0_evals(1:k) - lambda, 0.0_dp, kind=
dp)
203 CALL cp_cfm_geeig(matrix_tmp, matrix_s_copy, preconditioner_env%complex_fm, &
204 preconditioner_env%full_evals, matrix_diag_work)
206 preconditioner_env%occ_evals(:) = c0_evals(1:k)
207 preconditioner_env%full_evals(1:k) = c0_evals(1:k)
208 CALL cp_cfm_to_cfm(matrix_c0, preconditioner_env%complex_fm, k)
212 DEALLOCATE (residual_norm_sq, shifted_evals)
222 CALL timestop(handle)
235 energy_homo, energy_gap)
238 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix_h, matrix_s
239 REAL(kind=
dp),
INTENT(IN) :: energy_homo, energy_gap
241 CHARACTER(len=*),
PARAMETER :: routinen =
'make_complex_full_single'
243 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:) :: scaling
244 INTEGER :: handle, i, n
245 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigenvalues
246 TYPE(
cp_cfm_type) :: matrix_diag_a, matrix_diag_b, &
247 matrix_eigenvectors, &
248 matrix_scaled_eigenvectors, matrix_work
250 CALL timeset(routinen, handle)
254 cpassert(energy_gap > 0.0_dp)
256 IF (
ASSOCIATED(preconditioner_env%complex_fm))
THEN
258 DEALLOCATE (preconditioner_env%complex_fm)
260 IF (
ASSOCIATED(preconditioner_env%occ_evals))
DEALLOCATE (preconditioner_env%occ_evals)
261 IF (
ASSOCIATED(preconditioner_env%full_evals))
DEALLOCATE (preconditioner_env%full_evals)
263 ALLOCATE (preconditioner_env%complex_fm)
264 CALL cp_cfm_create(preconditioner_env%complex_fm, matrix_h%matrix_struct, &
265 name=
'complex FULL_SINGLE preconditioner')
267 name=
'complex FULL_SINGLE diagonalization A')
269 name=
'complex FULL_SINGLE diagonalization B')
270 CALL cp_cfm_create(matrix_eigenvectors, matrix_h%matrix_struct, &
271 name=
'complex FULL_SINGLE eigenvectors')
272 CALL cp_cfm_create(matrix_scaled_eigenvectors, matrix_h%matrix_struct, &
273 name=
'complex FULL_SINGLE scaled eigenvectors')
275 name=
'complex FULL_SINGLE diagonalization work')
277 ALLOCATE (eigenvalues(n), scaling(n))
280 CALL cp_cfm_geeig(matrix_diag_a, matrix_diag_b, matrix_eigenvectors, &
281 eigenvalues, matrix_work)
283 scaling(i) = cmplx(1.0_dp/max(eigenvalues(i) - energy_homo, energy_gap), &
286 CALL cp_cfm_to_cfm(matrix_eigenvectors, matrix_scaled_eigenvectors)
289 matrix_eigenvectors,
z_zero, preconditioner_env%complex_fm)
291 preconditioner_env%energy_gap = energy_gap
295 DEALLOCATE (scaling, eigenvalues)
302 CALL timestop(handle)
318 preconditioner_env, matrix_c0, matrix_h, matrix_s, energy_gap, max_rank, &
319 spectral_window, degeneracy_tolerance)
322 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix_c0, matrix_h, matrix_s
323 REAL(kind=
dp),
INTENT(IN) :: energy_gap
324 INTEGER,
INTENT(IN) :: max_rank
325 REAL(kind=
dp),
INTENT(IN) :: spectral_window, degeneracy_tolerance
327 INTEGER :: k, max_rank_eff, n
328 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: active_evals, common_evals
329 TYPE(
cp_cfm_type) :: matrix_chc, matrix_hc0, matrix_vectors
332 cpassert(k > 0 .AND. k <= n)
333 cpassert(max_rank == -1 .OR. max_rank > 0)
334 cpassert(spectral_window > 0.0_dp)
335 cpassert(degeneracy_tolerance >= 0.0_dp)
337 CALL cp_cfm_create(matrix_hc0, matrix_c0%matrix_struct, name=
'complex FERMI_LOW_RANK HC')
338 CALL cp_cfm_create(matrix_chc, matrix_c0%matrix_struct, nrow=k, ncol=k, &
339 name=
'complex FERMI_LOW_RANK CHC')
340 CALL cp_cfm_create(matrix_vectors, matrix_chc%matrix_struct, &
341 name=
'complex FERMI_LOW_RANK active vectors')
342 ALLOCATE (active_evals(k), common_evals(k))
345 CALL cp_cfm_heevd(matrix_chc, matrix_vectors, active_evals)
346 preconditioner_env%spectral_reference = maxval(active_evals)
347 common_evals(:) = preconditioner_env%spectral_reference
350 common_evals, energy_gap)
351 preconditioner_env%spectral_window = spectral_window
352 preconditioner_env%spectral_base_scale = 1.0_dp/spectral_window
353 preconditioner_env%spectral_max_rank = max_rank
354 max_rank_eff = max_rank
355 IF (max_rank_eff == -1) max_rank_eff = n - k
357 preconditioner_env%full_evals, k, max_rank_eff, degeneracy_tolerance)
359 preconditioner_env%lattice_fft_active = .false.
363 DEALLOCATE (common_evals, active_evals)
384 preconditioner_env, matrix_c0, matrix_h, matrix_s, energy_gap, occupation_signature)
387 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix_c0, matrix_h, matrix_s
388 REAL(kind=
dp),
INTENT(IN) :: energy_gap
389 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
390 OPTIONAL :: occupation_signature
392 COMPLEX(KIND=dp),
CONTIGUOUS,
DIMENSION(:, :), &
394 INTEGER :: group, i, j, k, n, ncol_local, ngroup, &
395 nrow_local, output_column
396 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: group_representative, occupation_group
397 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
398 REAL(kind=
dp) :: occupation_tolerance, rayleigh_bound, &
400 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: group_shift, occupied_evals
401 TYPE(
cp_cfm_type) :: matrix_c_canonical, matrix_chc, &
402 matrix_hc0, matrix_occ_vectors
405 cpassert(k > 0 .AND. k <= n)
408 name=
'complex covariant FULL_ALL HC')
409 CALL cp_cfm_create(matrix_chc, matrix_c0%matrix_struct, nrow=k, ncol=k, &
410 name=
'complex covariant FULL_ALL CHC')
411 CALL cp_cfm_create(matrix_occ_vectors, matrix_chc%matrix_struct, &
412 name=
'complex covariant FULL_ALL occupied rotation')
413 CALL cp_cfm_create(matrix_c_canonical, matrix_c0%matrix_struct, &
414 name=
'complex covariant FULL_ALL canonical C')
415 ALLOCATE (occupied_evals(k))
420 IF (
PRESENT(occupation_signature))
THEN
421 cpassert(
SIZE(occupation_signature, 1) == k)
422 cpassert(
SIZE(occupation_signature, 2) > 0)
423 ALLOCATE (group_representative(k), occupation_group(k))
424 occupation_tolerance = 64.0_dp*epsilon(1.0_dp)* &
425 max(1.0_dp, maxval(abs(occupation_signature)))
428 occupation_group(i) = 0
430 IF (maxval(abs(occupation_signature(i, :) - &
431 occupation_signature(group_representative(group), :))) <= &
432 occupation_tolerance)
THEN
433 occupation_group(i) = group
437 IF (occupation_group(i) == 0)
THEN
439 group_representative(ngroup) = i
440 occupation_group(i) = ngroup
443 DEALLOCATE (group_representative)
447 shift_stride = 4.0_dp*max(1.0_dp, rayleigh_bound)
448 ALLOCATE (group_shift(ngroup))
450 group_shift(group) = shift_stride* &
451 (real(group, kind=
dp) - 0.5_dp*real(ngroup + 1, kind=
dp))
453 CALL cp_cfm_get_info(matrix_chc, nrow_local=nrow_local, ncol_local=ncol_local, &
454 row_indices=row_indices, col_indices=col_indices, &
455 local_data=chc_local)
458 IF (occupation_group(row_indices(i)) /= occupation_group(col_indices(j)))
THEN
460 ELSE IF (row_indices(i) == col_indices(j))
THEN
461 group = occupation_group(row_indices(i))
462 chc_local(i, j) = chc_local(i, j) + &
463 cmplx(group_shift(group), 0.0_dp, kind=
dp)
470 CALL cp_cfm_heevd(matrix_chc, matrix_occ_vectors, occupied_evals)
471 IF (
PRESENT(occupation_signature))
THEN
475 DO i = 1, count(occupation_group == group)
476 output_column = output_column + 1
477 occupied_evals(output_column) = occupied_evals(output_column) - group_shift(group)
480 cpassert(output_column == k)
481 DEALLOCATE (group_shift)
483 DEALLOCATE (occupation_group)
486 z_zero, matrix_c_canonical)
489 occupied_evals, energy_gap)
490 IF (
ASSOCIATED(preconditioner_env%occ_rotation_complex))
THEN
492 DEALLOCATE (preconditioner_env%occ_rotation_complex)
494 ALLOCATE (preconditioner_env%occ_rotation_complex)
495 CALL cp_cfm_create(preconditioner_env%occ_rotation_complex, matrix_occ_vectors%matrix_struct, &
496 name=
'complex covariant FULL_ALL occupied rotation')
497 CALL cp_cfm_to_cfm(matrix_occ_vectors, preconditioner_env%occ_rotation_complex)
500 DEALLOCATE (occupied_evals)
521 energy_homo, eigenvalues_ot, energy_gap, &
525 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: matrix_s, matrix_t
527 REAL(kind=
dp) :: energy_homo
528 REAL(kind=
dp),
DIMENSION(:) :: eigenvalues_ot
529 REAL(kind=
dp) :: energy_gap
530 INTEGER :: my_solver_type
532 INTEGER :: precon_type
534 precon_type = preconditioner_env%in_use
535 SELECT CASE (precon_type)
538 cpabort(
"Only PRECOND_SOLVER DEFAULT for the moment")
540 IF (
PRESENT(matrix_s))
THEN
541 CALL make_full_single(preconditioner_env, preconditioner_env%fm, &
542 matrix_h, matrix_s, energy_homo, energy_gap)
544 CALL make_full_single_ortho(preconditioner_env, preconditioner_env%fm, &
545 matrix_h, energy_homo, energy_gap)
550 IF (.NOT.
PRESENT(matrix_s))
THEN
551 cpabort(
"Type for S=1 not implemented")
553 CALL make_full_s_inverse(preconditioner_env, matrix_s)
557 IF (.NOT. (
PRESENT(matrix_s) .AND.
PRESENT(matrix_t)))
THEN
558 cpabort(
"Type for S=1 not implemented")
560 CALL make_full_kinetic(preconditioner_env, matrix_t, matrix_s, energy_gap)
563 CALL make_full_single_inverse(preconditioner_env, mo_coeff, matrix_h, energy_gap, &
567 cpabort(
"Only PRECOND_SOLVER DEFAULT for the moment")
569 IF (
PRESENT(matrix_s))
THEN
570 CALL make_full_all(preconditioner_env, mo_coeff, matrix_h, matrix_s, &
571 eigenvalues_ot, energy_gap)
573 CALL make_full_all_ortho(preconditioner_env, mo_coeff, matrix_h, &
574 eigenvalues_ot, energy_gap)
579 cpabort(
"Only PRECOND_SOLVER DEFAULT for the moment")
581 IF (
PRESENT(matrix_s))
THEN
582 CALL make_full_all(preconditioner_env, mo_coeff, matrix_h, matrix_s, &
583 eigenvalues_ot, energy_gap, common_reference=energy_homo)
585 CALL make_full_all_ortho(preconditioner_env, mo_coeff, matrix_h, &
586 eigenvalues_ot, energy_gap, common_reference=energy_homo)
590 cpabort(
"Type not implemented")
600 SUBROUTINE make_full_s_inverse(preconditioner_env, matrix_s)
604 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_s_inverse'
608 CALL timeset(routinen, handle)
610 cpassert(
ASSOCIATED(matrix_s))
612 IF (.NOT.
ASSOCIATED(preconditioner_env%sparse_matrix))
THEN
613 ALLOCATE (preconditioner_env%sparse_matrix)
615 CALL dbcsr_copy(preconditioner_env%sparse_matrix, matrix_s, name=
"full_kinetic")
617 CALL timestop(handle)
619 END SUBROUTINE make_full_s_inverse
629 SUBROUTINE make_full_kinetic(preconditioner_env, matrix_t, matrix_s, &
632 TYPE(
dbcsr_type),
POINTER :: matrix_t, matrix_s
633 REAL(kind=
dp) :: energy_gap
635 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_kinetic'
638 REAL(kind=
dp) :: shift
640 CALL timeset(routinen, handle)
642 cpassert(
ASSOCIATED(matrix_t))
643 cpassert(
ASSOCIATED(matrix_s))
645 IF (.NOT.
ASSOCIATED(preconditioner_env%sparse_matrix))
THEN
646 ALLOCATE (preconditioner_env%sparse_matrix)
648 CALL dbcsr_copy(preconditioner_env%sparse_matrix, matrix_t, name=
"full_kinetic")
650 shift = max(0.0_dp, energy_gap)
652 CALL dbcsr_add(preconditioner_env%sparse_matrix, matrix_s, &
653 alpha_scalar=1.0_dp, beta_scalar=shift)
655 CALL timestop(handle)
657 END SUBROUTINE make_full_kinetic
668 SUBROUTINE make_full_single(preconditioner_env, fm, matrix_h, matrix_s, &
669 energy_homo, energy_gap)
672 TYPE(
dbcsr_type),
POINTER :: matrix_h, matrix_s
673 REAL(kind=
dp) :: energy_homo, energy_gap
675 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_single'
677 INTEGER :: handle, i, n
678 REAL(kind=
dp),
DIMENSION(:),
POINTER :: evals
682 CALL timeset(routinen, handle)
684 NULLIFY (fm_struct_tmp, evals)
686 IF (
ASSOCIATED(fm))
THEN
695 context=preconditioner_env%ctxt, &
696 para_env=preconditioner_env%para_env)
698 CALL cp_fm_create(fm, fm_struct_tmp, name=
"preconditioner")
707 SELECT CASE (preconditioner_env%cholesky_use)
714 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=n, alpha=1.0_dp)
716 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=n, alpha=1.0_dp)
720 cpabort(
"cholesky type not implemented")
725 SELECT CASE (preconditioner_env%cholesky_use)
728 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=n, alpha=1.0_dp)
730 evals(i) = 1.0_dp/max(evals(i) - energy_homo, energy_gap)
736 evals(i) = 1.0_dp/max(evals(i) - energy_homo, energy_gap)
742 CALL parallel_gemm(
'N',
'T', n, n, n, 1.0_dp, fm, fm_h, 0.0_dp, fm_s)
749 CALL timestop(handle)
751 END SUBROUTINE make_full_single
761 SUBROUTINE make_full_single_ortho(preconditioner_env, fm, matrix_h, &
762 energy_homo, energy_gap)
766 REAL(kind=
dp) :: energy_homo, energy_gap
768 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_single_ortho'
770 INTEGER :: handle, i, n
771 REAL(kind=
dp),
DIMENSION(:),
POINTER :: evals
775 CALL timeset(routinen, handle)
776 NULLIFY (fm_struct_tmp, evals)
778 IF (
ASSOCIATED(fm))
THEN
787 context=preconditioner_env%ctxt, &
788 para_env=preconditioner_env%para_env)
790 CALL cp_fm_create(fm, fm_struct_tmp, name=
"preconditioner")
799 evals(i) = 1.0_dp/max(evals(i) - energy_homo, energy_gap)
803 CALL parallel_gemm(
'N',
'T', n, n, n, 1.0_dp, fm, fm_h, 0.0_dp, fm_s)
810 CALL timestop(handle)
812 END SUBROUTINE make_full_single_ortho
834 SUBROUTINE make_full_all(preconditioner_env, matrix_c0, matrix_h, matrix_s, c0_evals, energy_gap, &
838 TYPE(
dbcsr_type),
POINTER :: matrix_h, matrix_s
839 REAL(kind=
dp),
DIMENSION(:) :: c0_evals
840 REAL(kind=
dp) :: energy_gap
841 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: common_reference
843 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_all'
844 REAL(kind=
dp),
PARAMETER :: fudge_factor = 0.25_dp, &
845 lambda_base = 10.0_dp
847 INTEGER :: handle, k, n
848 REAL(kind=
dp) :: error_estimate, lambda
849 REAL(kind=
dp),
DIMENSION(:),
POINTER :: diag, norms, shifted_evals
851 TYPE(
cp_fm_type) :: matrix_hc0, matrix_left, matrix_s1, &
852 matrix_s2, matrix_sc0, matrix_shc0, &
856 CALL timeset(routinen, handle)
858 IF (
ASSOCIATED(preconditioner_env%fm))
THEN
860 DEALLOCATE (preconditioner_env%fm)
861 NULLIFY (preconditioner_env%fm)
865 context=preconditioner_env%ctxt, &
866 para_env=preconditioner_env%para_env)
867 ALLOCATE (preconditioner_env%fm)
868 CALL cp_fm_create(preconditioner_env%fm, fm_struct_tmp, name=
"preconditioner_env%fm")
870 CALL cp_fm_create(matrix_tmp, fm_struct_tmp, name=
"matrix_tmp")
872 ALLOCATE (preconditioner_env%full_evals(n))
873 ALLOCATE (preconditioner_env%occ_evals(k))
889 CALL cp_fm_create(matrix_sc0, matrix_c0%matrix_struct, name=
"sc0")
891 CALL cp_fm_create(matrix_hc0, matrix_c0%matrix_struct, name=
"hc0")
895 CALL cp_fm_create(matrix_shc0, matrix_c0%matrix_struct, name=
"shc0")
897 SELECT CASE (preconditioner_env%cholesky_use)
902 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=k, alpha=1.0_dp)
906 cpabort(
"cholesky type not implemented")
909 context=preconditioner_env%ctxt, &
910 para_env=preconditioner_env%para_env)
911 CALL cp_fm_create(matrix_s1, fm_struct_tmp, name=
"matrix_s1")
914 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, matrix_shc0, matrix_shc0, 0.0_dp, matrix_s1)
917 IF (
PRESENT(common_reference))
THEN
919 error_estimate = sqrt(max(0.0_dp, sum(diag) - sum(c0_evals**2)))
921 error_estimate = maxval(sqrt(abs(diag - c0_evals**2)))
930 preconditioner_env%energy_gap = max(energy_gap, error_estimate*fudge_factor)
932 matrix_pre => preconditioner_env%fm
935 CALL parallel_gemm(
'N',
'T', n, n, k, -1.0_dp, matrix_hc0, matrix_sc0, 1.0_dp, matrix_tmp)
938 context=preconditioner_env%ctxt, &
939 para_env=preconditioner_env%para_env)
940 CALL cp_fm_create(matrix_left, fm_struct_tmp, name=
"matrix_left")
942 CALL parallel_gemm(
'T',
'N', k, n, n, 1.0_dp, matrix_c0, matrix_tmp, 0.0_dp, matrix_left)
944 CALL parallel_gemm(
'N',
'N', n, n, k, -1.0_dp, matrix_sc0, matrix_left, 1.0_dp, matrix_tmp)
947 ALLOCATE (shifted_evals(k))
948 lambda = lambda_base + error_estimate
949 IF (
PRESENT(common_reference))
THEN
950 shifted_evals = common_reference - lambda
952 shifted_evals = c0_evals - lambda
956 CALL parallel_gemm(
'N',
'T', n, n, k, 1.0_dp, matrix_hc0, matrix_sc0, 1.0_dp, matrix_tmp)
959 SELECT CASE (preconditioner_env%cholesky_use)
962 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=n, alpha=1.0_dp)
964 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=n, alpha=1.0_dp)
969 SELECT CASE (preconditioner_env%cholesky_use)
972 invert_tr=.false., uplo_tr=
"U", n_rows=n, n_cols=n, alpha=1.0_dp)
982 context=preconditioner_env%ctxt, &
983 para_env=preconditioner_env%para_env)
984 CALL cp_fm_create(matrix_s1, fm_struct_tmp, name=
"matrix_s1")
985 CALL cp_fm_create(matrix_s2, fm_struct_tmp, name=
"matrix_s2")
988 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, matrix_sc0, matrix_tmp, 0.0_dp, matrix_s1)
990 WRITE (*, *)
"matrix norm deviation (should be close to zero): ", maxval(abs(abs(norms) - 1.0_dp))
997 IF (
PRESENT(common_reference))
THEN
998 preconditioner_env%occ_evals = common_reference
999 preconditioner_env%full_evals(1:k) = common_reference
1001 preconditioner_env%occ_evals = c0_evals
1003 preconditioner_env%full_evals(1:k) = c0_evals
1011 DEALLOCATE (shifted_evals)
1012 CALL timestop(handle)
1014 END SUBROUTINE make_full_all
1025 SUBROUTINE make_full_all_ortho(preconditioner_env, matrix_c0, matrix_h, c0_evals, energy_gap, &
1031 REAL(kind=
dp),
DIMENSION(:) :: c0_evals
1032 REAL(kind=
dp) :: energy_gap
1033 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: common_reference
1035 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_all_ortho'
1036 REAL(kind=
dp),
PARAMETER :: fudge_factor = 0.25_dp, &
1037 lambda_base = 10.0_dp
1039 INTEGER :: handle, k, n
1040 REAL(kind=
dp) :: error_estimate, lambda
1041 REAL(kind=
dp),
DIMENSION(:),
POINTER :: diag, norms, shifted_evals
1043 TYPE(
cp_fm_type) :: matrix_hc0, matrix_left, matrix_s1, &
1044 matrix_s2, matrix_sc0, matrix_tmp
1047 CALL timeset(routinen, handle)
1049 IF (
ASSOCIATED(preconditioner_env%fm))
THEN
1051 DEALLOCATE (preconditioner_env%fm)
1052 NULLIFY (preconditioner_env%fm)
1056 context=preconditioner_env%ctxt, &
1057 para_env=preconditioner_env%para_env)
1058 ALLOCATE (preconditioner_env%fm)
1059 CALL cp_fm_create(preconditioner_env%fm, fm_struct_tmp, name=
"preconditioner_env%fm")
1060 CALL cp_fm_create(matrix_tmp, fm_struct_tmp, name=
"matrix_tmp")
1062 ALLOCATE (preconditioner_env%full_evals(n))
1063 ALLOCATE (preconditioner_env%occ_evals(k))
1071 CALL cp_fm_create(matrix_sc0, matrix_c0%matrix_struct, name=
"sc0")
1073 CALL cp_fm_create(matrix_hc0, matrix_c0%matrix_struct, name=
"hc0")
1078 context=preconditioner_env%ctxt, &
1079 para_env=preconditioner_env%para_env)
1080 CALL cp_fm_create(matrix_s1, fm_struct_tmp, name=
"matrix_s1")
1083 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, matrix_hc0, matrix_hc0, 0.0_dp, matrix_s1)
1086 IF (
PRESENT(common_reference))
THEN
1088 error_estimate = sqrt(max(0.0_dp, sum(diag) - sum(c0_evals**2)))
1090 error_estimate = maxval(sqrt(abs(diag - c0_evals**2)))
1098 preconditioner_env%energy_gap = max(energy_gap, error_estimate*fudge_factor)
1100 matrix_pre => preconditioner_env%fm
1104 CALL parallel_gemm(
'N',
'T', n, n, k, -1.0_dp, matrix_hc0, matrix_sc0, 1.0_dp, matrix_tmp)
1107 context=preconditioner_env%ctxt, &
1108 para_env=preconditioner_env%para_env)
1109 CALL cp_fm_create(matrix_left, fm_struct_tmp, name=
"matrix_left")
1111 CALL parallel_gemm(
'T',
'N', k, n, n, 1.0_dp, matrix_c0, matrix_tmp, 0.0_dp, matrix_left)
1113 CALL parallel_gemm(
'N',
'N', n, n, k, -1.0_dp, matrix_sc0, matrix_left, 1.0_dp, matrix_tmp)
1116 ALLOCATE (shifted_evals(k))
1117 lambda = lambda_base + error_estimate
1118 IF (
PRESENT(common_reference))
THEN
1119 shifted_evals = common_reference - lambda
1121 shifted_evals = c0_evals - lambda
1125 CALL parallel_gemm(
'N',
'T', n, n, k, 1.0_dp, matrix_hc0, matrix_sc0, 1.0_dp, matrix_tmp)
1134 context=preconditioner_env%ctxt, &
1135 para_env=preconditioner_env%para_env)
1136 CALL cp_fm_create(matrix_s1, fm_struct_tmp, name=
"matrix_s1")
1137 CALL cp_fm_create(matrix_s2, fm_struct_tmp, name=
"matrix_s2")
1140 CALL parallel_gemm(
'T',
'N', k, k, n, 1.0_dp, matrix_sc0, matrix_tmp, 0.0_dp, matrix_s1)
1143 WRITE (*, *)
"matrix norm deviation (should be close to zero): ", maxval(abs(abs(norms) - 1.0_dp))
1150 IF (
PRESENT(common_reference))
THEN
1151 preconditioner_env%occ_evals = common_reference
1152 preconditioner_env%full_evals(1:k) = common_reference
1154 preconditioner_env%occ_evals = c0_evals
1156 preconditioner_env%full_evals(1:k) = c0_evals
1163 DEALLOCATE (shifted_evals)
1165 CALL timestop(handle)
1167 END SUBROUTINE make_full_all_ortho
1186 SUBROUTINE make_full_single_inverse(preconditioner_env, matrix_c0, matrix_h, energy_gap, matrix_s)
1190 REAL(kind=
dp) :: energy_gap
1191 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: matrix_s
1193 CHARACTER(len=*),
PARAMETER :: routinen =
'make_full_single_inverse'
1195 INTEGER :: handle, k, n
1196 REAL(kind=
dp) :: max_ev, min_ev, pre_shift
1197 TYPE(arnoldi_env_type) :: arnoldi_env
1199 TYPE(
dbcsr_type),
TARGET :: dbcsr_cthc, dbcsr_hc, dbcsr_sc, mo_dbcsr
1201 CALL timeset(routinen, handle)
1213 IF (.NOT.
ASSOCIATED(preconditioner_env%sparse_matrix))
THEN
1214 ALLOCATE (preconditioner_env%sparse_matrix)
1218 CALL dbcsr_copy(preconditioner_env%sparse_matrix, matrix_h)
1222 IF (
PRESENT(matrix_s))
THEN
1223 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_s, mo_dbcsr, 0.0_dp, dbcsr_sc)
1230 CALL dbcsr_multiply(
"N",
"N", 1.0_dp, matrix_h, mo_dbcsr, 0.0_dp, dbcsr_hc)
1231 CALL dbcsr_multiply(
"T",
"N", 1.0_dp, mo_dbcsr, dbcsr_hc, 0.0_dp, dbcsr_cthc)
1234 ALLOCATE (matrices(1))
1235 matrices(1)%matrix => dbcsr_cthc
1236 CALL setup_arnoldi_env(arnoldi_env, matrices, max_iter=20, threshold=1.0e-3_dp, selection_crit=2, &
1237 nval_request=1, nrestarts=8, generalized_ev=.false., iram=.false.)
1238 IF (
ASSOCIATED(preconditioner_env%max_ev_vector))
THEN
1239 CALL set_arnoldi_initial_vector(arnoldi_env, preconditioner_env%max_ev_vector)
1242 max_ev = real(get_selected_ritz_val(arnoldi_env, 1),
dp)
1245 IF (.NOT.
ASSOCIATED(preconditioner_env%max_ev_vector))
ALLOCATE (preconditioner_env%max_ev_vector)
1246 CALL get_selected_ritz_vector(arnoldi_env, 1, matrices(1)%matrix, preconditioner_env%max_ev_vector)
1247 CALL deallocate_arnoldi_env(arnoldi_env)
1248 DEALLOCATE (matrices)
1253 CALL dbcsr_multiply(
"N",
"N", 2.0_dp, dbcsr_sc, dbcsr_cthc, 0.0_dp, dbcsr_hc)
1254 CALL dbcsr_multiply(
"N",
"T", -1.0_dp, dbcsr_hc, dbcsr_sc, 1.0_dp, preconditioner_env%sparse_matrix)
1258 IF (
PRESENT(matrix_s))
THEN
1259 ALLOCATE (matrices(2))
1260 matrices(1)%matrix => preconditioner_env%sparse_matrix
1261 matrices(2)%matrix => matrix_s
1262 CALL setup_arnoldi_env(arnoldi_env, matrices, max_iter=20, threshold=2.0e-2_dp, selection_crit=3, &
1263 nval_request=1, nrestarts=21, generalized_ev=.true., iram=.false.)
1265 ALLOCATE (matrices(1))
1266 matrices(1)%matrix => preconditioner_env%sparse_matrix
1267 CALL setup_arnoldi_env(arnoldi_env, matrices, max_iter=20, threshold=2.0e-2_dp, selection_crit=3, &
1268 nval_request=1, nrestarts=8, generalized_ev=.false., iram=.false.)
1270 IF (
ASSOCIATED(preconditioner_env%min_ev_vector))
THEN
1271 CALL set_arnoldi_initial_vector(arnoldi_env, preconditioner_env%min_ev_vector)
1276 min_ev = real(get_selected_ritz_val(arnoldi_env, 1),
dp)
1279 IF (.NOT.
ASSOCIATED(preconditioner_env%min_ev_vector))
ALLOCATE (preconditioner_env%min_ev_vector)
1280 CALL get_selected_ritz_vector(arnoldi_env, 1, matrices(1)%matrix, preconditioner_env%min_ev_vector)
1281 CALL deallocate_arnoldi_env(arnoldi_env)
1282 DEALLOCATE (matrices)
1287 pre_shift = max(1.5_dp*(min_ev - max_ev), energy_gap)
1288 IF (min_ev < pre_shift)
THEN
1289 pre_shift = pre_shift - min_ev
1293 IF (
PRESENT(matrix_s))
THEN
1294 CALL dbcsr_add(preconditioner_env%sparse_matrix, matrix_s, 1.0_dp, pre_shift)
1304 CALL timestop(handle)
1306 END SUBROUTINE make_full_single_inverse
1320 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix_c0, matrix_h, matrix_s
1321 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1323 CHARACTER(len=*),
PARAMETER :: routinen =
'make_complex_full_single_inverse'
1325 INTEGER :: handle, i, k, n
1326 REAL(kind=
dp) :: max_ev, min_ev, pre_shift, target_edge
1327 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: occupied_evals, operator_evals
1328 TYPE(
cp_cfm_type) :: matrix_chc, matrix_diag_a, matrix_diag_b, matrix_diag_evec, &
1329 matrix_diag_work, matrix_hc0, matrix_occ_diag_a, matrix_occ_diag_b, matrix_occ_diag_evec, &
1330 matrix_occ_diag_work, matrix_operator, matrix_sc0, matrix_sc_chc
1332 CALL timeset(routinen, handle)
1336 cpassert(k > 0 .AND. k <= n)
1337 cpassert(energy_gap > 0.0_dp)
1339 CALL cp_cfm_create(matrix_hc0, matrix_c0%matrix_struct, name=
'complex FULL_SINGLE HC')
1340 CALL cp_cfm_create(matrix_sc0, matrix_c0%matrix_struct, name=
'complex FULL_SINGLE SC')
1341 CALL cp_cfm_create(matrix_chc, matrix_c0%matrix_struct, nrow=k, ncol=k, &
1342 name=
'complex FULL_SINGLE CHC')
1343 CALL cp_cfm_create(matrix_sc_chc, matrix_c0%matrix_struct, &
1344 name=
'complex FULL_SINGLE SC CHC')
1345 CALL cp_cfm_create(matrix_operator, matrix_h%matrix_struct, &
1346 name=
'complex FULL_SINGLE operator')
1348 name=
'complex FULL_SINGLE diagonalization A')
1350 name=
'complex FULL_SINGLE diagonalization B')
1351 CALL cp_cfm_create(matrix_diag_evec, matrix_h%matrix_struct, nrow=n, ncol=1, &
1352 name=
'complex FULL_SINGLE eigenvectors')
1353 CALL cp_cfm_create(matrix_diag_work, matrix_h%matrix_struct, &
1354 name=
'complex FULL_SINGLE diagonalization work')
1355 CALL cp_cfm_create(matrix_occ_diag_a, matrix_c0%matrix_struct, nrow=k, ncol=k, &
1356 name=
'complex FULL_SINGLE occupied diagonalization A')
1357 CALL cp_cfm_create(matrix_occ_diag_b, matrix_c0%matrix_struct, nrow=k, ncol=k, &
1358 name=
'complex FULL_SINGLE occupied diagonalization B', set_zero=.true.)
1359 CALL cp_cfm_create(matrix_occ_diag_evec, matrix_c0%matrix_struct, nrow=k, ncol=k, &
1360 name=
'complex FULL_SINGLE occupied eigenvectors')
1361 CALL cp_cfm_create(matrix_occ_diag_work, matrix_c0%matrix_struct, nrow=k, ncol=k, &
1362 name=
'complex FULL_SINGLE occupied diagonalization work')
1372 CALL cp_cfm_gemm(
'N',
'C', n, n, k, -2.0_dp*
z_one, matrix_sc_chc, matrix_sc0, &
1373 z_one, matrix_operator)
1375 z_one, matrix_operator)
1377 ALLOCATE (occupied_evals(k), operator_evals(1))
1382 CALL cp_cfm_geeig(matrix_occ_diag_a, matrix_occ_diag_b, matrix_occ_diag_evec, &
1383 occupied_evals, matrix_occ_diag_work)
1384 max_ev = maxval(occupied_evals)
1387 CALL cp_cfm_geeig(matrix_diag_a, matrix_diag_b, matrix_diag_evec, &
1388 operator_evals, matrix_diag_work, lowest_subset=.true.)
1389 min_ev = operator_evals(1)
1390 target_edge = max(1.5_dp*(min_ev - max_ev), energy_gap)
1391 pre_shift = max(0.0_dp, target_edge - min_ev)
1392 IF (pre_shift > 0.0_dp)
THEN
1394 cmplx(pre_shift, 0.0_dp, kind=
dp), matrix_s)
1397 CALL store_complex_inverse(preconditioner_env, matrix_operator, &
1400 DEALLOCATE (operator_evals, occupied_evals)
1415 CALL timestop(handle)
1443 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix_t, matrix_s
1444 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1446 REAL(kind=
dp) :: shift
1449 shift = max(0.0_dp, energy_gap)
1450 CALL cp_cfm_create(matrix_operator, matrix_t%matrix_struct, &
1451 name=
'complex FULL_KINETIC operator')
1454 CALL store_complex_inverse(preconditioner_env, matrix_operator, &
1467 SUBROUTINE store_complex_inverse(preconditioner_env, matrix_operator, &
1468 preconditioner_kind, energy_gap)
1472 INTEGER,
INTENT(IN) :: preconditioner_kind
1473 REAL(kind=
dp),
INTENT(IN) :: energy_gap
1477 IF (
ASSOCIATED(preconditioner_env%complex_fm))
THEN
1479 DEALLOCATE (preconditioner_env%complex_fm)
1481 ALLOCATE (preconditioner_env%complex_fm)
1482 CALL cp_cfm_create(preconditioner_env%complex_fm, matrix_operator%matrix_struct, &
1483 name=
'complex inverse preconditioner')
1484 CALL cp_cfm_to_cfm(matrix_operator, preconditioner_env%complex_fm)
1491 preconditioner_env%energy_gap = energy_gap
1492 preconditioner_env%in_use = preconditioner_kind
1495 END SUBROUTINE store_complex_inverse
arnoldi iteration using dbcsr
subroutine, public arnoldi_ev(matrix, arnoldi_env)
Driver routine for different arnoldi eigenvalue methods the selection which one is to be taken is mad...
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_scale_and_add(alpha, matrix_a, beta, matrix_b)
Scale and add two BLACS matrices (a = alpha*a + beta*b).
real(kind=dp) function, public cp_cfm_norm(matrix, mode)
Norm of matrix using (p)zlange.
subroutine, public cp_cfm_gemm(transa, transb, m, n, k, alpha, matrix_a, matrix_b, beta, matrix_c, a_first_col, a_first_row, b_first_col, b_first_row, c_first_col, c_first_row)
Performs one of the matrix-matrix operations: matrix_c = alpha * op1( matrix_a ) * op2( matrix_b ) + ...
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_uplo_to_full(matrix, workspace, uplo)
...
subroutine, public cp_cfm_column_scale(matrix_a, scaling)
Scales columns of the full matrix by corresponding factors.
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...
subroutine, public cp_cfm_cholesky_invert(matrix, n, info_out)
Used to replace Cholesky decomposition by the inverse.
used for collecting diagonalization schemes available for cp_cfm_type
subroutine, public cp_cfm_heevd(matrix, eigenvectors, eigenvalues)
Perform a diagonalisation of a complex matrix.
subroutine, public cp_cfm_geeig(amatrix, bmatrix, eigenvectors, eigenvalues, work, lowest_subset)
General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_cfm_set_element(matrix, irow_global, icol_global, alpha)
Set the matrix element (irow_global,icol_global) of the full matrix to alpha.
subroutine, public cp_cfm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
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)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_add_on_diag(matrix, alpha)
Adds the given scalar to the diagonal of the matrix. Reserves any missing diagonal blocks.
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)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public cp_fm_to_dbcsr_row_template(matrix, fm_in, template)
Utility function to copy a specially shaped fm to dbcsr_matrix The result matrix will be the matrix i...
subroutine, public cp_dbcsr_m_by_n_from_template(matrix, template, m, n, sym)
Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the templ...
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
subroutine, public cp_fm_uplo_to_full(matrix, work, uplo)
given a triangular matrix according to uplo, computes the corresponding full matrix
subroutine, public cp_fm_triangular_invert(matrix_a, uplo_tr)
inverts a triangular matrix
subroutine, public cp_fm_triangular_multiply(triangular_matrix, matrix_b, side, transpose_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...
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_restore(fm_matrix, neig, fm_matrixb, fm_matrixout, op, pos, transa)
apply Cholesky decomposition op can be "SOLVE" (out = U^-1 * in) or "MULTIPLY" (out = U * in) pos can...
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,...
subroutine, public cp_fm_cholesky_reduce(matrix, matrixb, itype)
reduce a matrix pencil A,B to normal form B has to be cholesky decomposed with cp_fm_cholesky_decompo...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
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...
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_diag(matrix, diag)
returns the diagonal elements of a fm
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_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
Defines the basic variable types.
integer, parameter, public dp
Small algebraic helpers for the rotationally covariant low-rank OT preconditioner.
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.
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_one
complex(kind=dp), parameter, public z_zero
basic linear algebra operations for full matrixes
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 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...
Represent a complex full matrix.
keeps the information about the structure of a full matrix