21 USE ieee_arithmetic,
ONLY: ieee_is_finite
59 para_env, flattened, gap, metric_ratio, residuals, status)
61 REAL(
dp),
INTENT(IN) :: energy, scale, tolerance, &
62 metric_tolerance, gap_tolerance
65 REAL(
dp),
INTENT(OUT) :: gap(2), metric_ratio, residuals(4)
66 INTEGER,
INTENT(OUT) :: status
68 COMPLEX(dp),
ALLOCATABLE :: dense(:, :), dense_metric(:, :)
69 INTEGER :: invariant, n, ns
76 residuals = huge(1.0_dp)
77 IF (.NOT. all(ieee_is_finite([energy, scale, tolerance, metric_tolerance, gap_tolerance])))
RETURN
78 IF (scale <= 0.0_dp .OR. tolerance <= 0.0_dp .OR. tolerance >= 1.0_dp)
RETURN
79 IF (metric_tolerance <= 0.0_dp .OR. metric_tolerance >= 1.0_dp .OR. gap_tolerance < 0.0_dp)
RETURN
82 IF (n < 1 .OR. n /= ns)
RETURN
84 IF (.NOT. valid)
RETURN
86 IF (.NOT. valid)
RETURN
90 IF (para_env%is_source())
THEN
92 gap_tolerance, invariant, gap(1), metric_ratio, status)
93 IF (status > 1) status = -4
98 CALL para_env%bcast(status, para_env%source)
99 CALL para_env%bcast(gap, para_env%source)
100 CALL para_env%bcast(metric_ratio, para_env%source)
101 IF (status /= 0)
RETURN
102 CALL para_env%bcast(invariant, para_env%source)
103 IF (invariant /= 0)
THEN
108 IF (status /= 0) status = -6
127 REAL(
dp),
INTENT(IN) :: energy, scale, tolerance
130 REAL(
dp),
INTENT(OUT) :: residuals(4)
131 INTEGER,
INTENT(OUT) :: status
135 REAL(
dp) :: filter, norm
136 TYPE(
dbcsr_type) :: a, b, inverse, sign_matrix, trial, work
139 residuals = huge(1.0_dp)
140 IF (.NOT. all(ieee_is_finite([energy, scale, tolerance])))
RETURN
141 IF (scale <= 0.0_dp .OR. tolerance <= 0.0_dp .OR. tolerance >= 1.0_dp)
RETURN
144 IF (n < 1 .OR. n /= ns)
RETURN
146 IF (.NOT. valid)
RETURN
148 IF (.NOT. valid)
RETURN
156 filter = min(1.e-16_dp, 0.01_dp*tolerance**2)
160 IF (.NOT. ieee_is_finite(norm) .OR. norm == 0.0_dp)
EXIT
162 accelerator_order=0, silent=.true.)
166 IF (.NOT. ieee_is_finite(residuals(1)) .OR. residuals(1) > tolerance)
EXIT
169 CALL dbcsr_multiply(
'N',
'N', 1.0_dp, sign_matrix, sign_matrix, 0.0_dp, work)
172 IF (.NOT. ieee_is_finite(residuals(2)) .OR. residuals(2) > tolerance)
EXIT
173 CALL dbcsr_multiply(
'N',
'N', scale, b, sign_matrix, 0.0_dp, trial)
178 CALL dbcsr_add(work, trial, 1.0_dp, -1.0_dp)
182 IF (.NOT. valid .OR. .NOT. all(ieee_is_finite(residuals)) .OR. maxval(residuals) > tolerance)
THEN
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.
real(dp) function, public dbcsr_frobenius_norm(matrix)
Compute the frobenius norm of a dbcsr matrix.
Routines useful for iterative matrix calculations.
subroutine, public matrix_sign_newton_schulz(matrix_sign, matrix, threshold, sign_order, iounit)
compute the sign a matrix using Newton-Schulz iterations
subroutine, public invert_hotelling(matrix_inverse, matrix, threshold, use_inv_as_guess, norm_convergence, filter_eps, accelerator_order, max_iter_lanczos, eps_lanczos, silent)
invert a symmetric positive definite matrix by Hotelling's method explicit symmetrization makes this ...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
Distributed block-sparse finite localizers, retaining the covariant AO metric.
subroutine, public localizer_dbcsr_from_real(realified, template, matrix)
Extract the two left quadrants of R(A); does not average away structure errors.
subroutine, public localizer_dbcsr_dense(matrix, para_env, dense)
Collect the size-limited dense oracle; sparse solvers must not call this routine.
subroutine, public localizer_dbcsr_gap_pencil(h, s, energy, pencil, metric)
Pair H-E*S with its negative to reuse the metric-aware localizer gap solvers.
subroutine, public localizer_dbcsr_release(matrix)
Release both real components of a complex sparse operator.
subroutine, public localizer_dbcsr_check(matrix, para_env, tolerance, valid, relative_error)
Check both components before a sparse solver discards the upper triangle.
subroutine, public localizer_dbcsr_realify(matrix, realified)
Distributed real matrix R(A)=[Re(A),-Im(A);Im(A),Re(A)].
Metric-covariant spectral flattening with existing distributed matrix iterations.
subroutine, public localizer_flatten_checked(h, s, energy, scale, tolerance, metric_tolerance, gap_tolerance, para_env, flattened, gap, metric_ratio, residuals, status)
Establish a positive AO metric and electronic gap before iterating the matrix sign.
subroutine, public localizer_flatten_dbcsr(h, s, energy, scale, tolerance, para_env, flattened, residuals, status)
Form scale*S*sign(S^-1*(H-energy*S)) without dense AO matrices or S^-1/2.
Dense reference spectral localizers in a nonorthogonal finite basis.
subroutine, public localizer_matrix_evaluate(localizer, s, aii, matrix_tol, metric_tol, gap_tol, invariant, gap, metric_ratio, status)
Dense reference evaluation of an assembled localizer with metric diag(S,S).
stores all the informations relevant to an mpi environment