(git:c641773)
Loading...
Searching...
No Matches
qs_scf_lanczos_c Module Reference

Complex block-Lanczos refinement kernel for k-point SCF diagonalization. Processes unconverged columns in blocks of NBLOCK with two-pass DGKS reorthogonalization against the working basis and deflation prefix, BLAS-3 CholeskyQR2 batch orthonormalization (with CGS2 fallback on rank-deficient batches), and an explicit Hermitian Rayleigh-Ritz projection T = V^dag(A V). Scratch matrices and local LAPACK buffers live in a caller-owned workspace reused across sweeps. More...

Data Types

type  lanczos_workspace_type
 Caller-owned scratch of the refinement kernel: every matrix and array that the sweeps of one channel reuse. The driver creates the workspace once per diagonalization call and hands it to every kernel call. The widths follow the worst case of the run. The basis budget holds the larger of the NKRYLOV block budget and four times the widest single block, and every per-call clamp stays below it. The small Rayleigh-Ritz pair keeps its per-block right-sized allocation, because the solver stack diagonalizes whole matrices and knows no leading-block argument. More...

Functions/Subroutines

subroutine, public lanczos_refinement_2v_c (ks, c0, eval, eps_col, nkrylov, nblock, ws, max_res_norm, min_res_norm, nmo_conv, nmo_nc, check_moconv_only)
 Refine the non-converged columns of c0 on the standardized operator ks. The entry Rayleigh-Ritz pass updates the convergence statistics. Every non-converged column block then runs a single-pass Lanczos refinement. A full Cholesky sweep closes the call.
subroutine, public lanczos_channel_begin (ks, c0, eval, eps_col, ws, max_res_norm, min_res_norm, nmo_conv, nmo_nc, check_moconv_only)
 Entry preparation of one (k-point, spin) channel before its inner Lanczos sweeps: orthonormalizes the input MOS (skipped for a read-only convergence probe), runs the full-width entry Rayleigh-Ritz pass, and computes the initial leading converged prefix and residual bounds.
subroutine, public lanczos_sweep_suffix (ks, c0, eval, eps_col, nkrylov, nblock, first_sweep, need_suffix_rr, ws, max_res_norm, min_res_norm, nmo_conv, nmo_nc, step_refined, next_need_suffix_rr)
 Run one inner Lanczos sweep on the unconverged suffix of c0. When the previous sweep ran in multi-block mode or had a truncated block, a local suffix Rayleigh-Ritz pass first decouples the unconverged tail of width nmo_nc without touching the locked prefix 1..nmo_conv.
subroutine, public lanczos_channel_end (c0, ws)
 Defensive full-width Cholesky orthonormalization at the end of a channel's refinement sweeps, executed at most once per channel.
subroutine, public lanczos_workspace_create (ws, mo_struct, ao_struct, nkrylov, nblock)
 Create the kernel workspace at the worst-case widths of the run. The basis budget holds the larger of the NKRYLOV block budget and four times the widest single block, and every per-call clamp of the kernel stays below it. A single block covers every pending column only when NBLOCK spans them, so four times MIN(NBLOCK, nmo) bounds that regime. The candidate and Ritz widths hold the widest block a run can form.
subroutine, public lanczos_workspace_release (ws)
 Release the kernel workspace. Safe on a workspace that was never created: the matrix components default to disassociated and the arrays to unallocated.

Detailed Description

Complex block-Lanczos refinement kernel for k-point SCF diagonalization. Processes unconverged columns in blocks of NBLOCK with two-pass DGKS reorthogonalization against the working basis and deflation prefix, BLAS-3 CholeskyQR2 batch orthonormalization (with CGS2 fallback on rank-deficient batches), and an explicit Hermitian Rayleigh-Ritz projection T = V^dag(A V). Scratch matrices and local LAPACK buffers live in a caller-owned workspace reused across sweeps.

Function/Subroutine Documentation

◆ lanczos_refinement_2v_c()

subroutine, public qs_scf_lanczos_c::lanczos_refinement_2v_c ( type(cp_cfm_type), intent(in) ks,
type(cp_cfm_type), intent(inout) c0,
real(dp), dimension(:), pointer eval,
real(dp), dimension(:), intent(in) eps_col,
integer, intent(in) nkrylov,
integer, intent(in) nblock,
type(lanczos_workspace_type), intent(inout) ws,
real(dp), intent(out) max_res_norm,
real(dp), intent(out) min_res_norm,
integer, intent(out) nmo_conv,
integer, intent(out) nmo_nc,
logical, intent(in), optional check_moconv_only )

Refine the non-converged columns of c0 on the standardized operator ks. The entry Rayleigh-Ritz pass updates the convergence statistics. Every non-converged column block then runs a single-pass Lanczos refinement. A full Cholesky sweep closes the call.

Parameters
ksstandardized operator A = U^-dag H U^-1, nao x nao
c0current MOS in the standardized basis, refined in place. The matrix dimensions of the call follow c0
evaleigenvalues of c0, updated in place by the entry Rayleigh-Ritz
eps_colper-column convergence thresholds on the residual norms: the driver assigns the relaxed empty threshold to the unoccupied columns. The occupation decides, not the column index. This mirrors the Davidson k-point driver
nkrylovnumber of block expansion steps in the block regime. The kernel uses it as a floor on the budget only when NBLOCK covers every pending column
nblocknumber of columns refined jointly, one or more
wscaller-owned scratch of the call, created by the driver at the worst-case widths of the run
max_res_normlargest residual column norm on exit: the entry Rayleigh-Ritz values, or the wanted-pair residuals of the refinement blocks when a refinement ran
min_res_normsmallest residual column norm on exit (same basis)
nmo_convnumber of leading converged columns on exit
nmo_nccolumns outside the leading converged prefix: every still-unconverged column, plus converged columns beyond a gap. The count stays conservative for the not-converged reporting
check_moconv_onlyonly run the entry Rayleigh-Ritz and the convergence count, skip the refinement

Definition at line 107 of file qs_scf_lanczos_c.F.

Here is the call graph for this function:

◆ lanczos_channel_begin()

subroutine, public qs_scf_lanczos_c::lanczos_channel_begin ( type(cp_cfm_type), intent(in) ks,
type(cp_cfm_type), intent(inout) c0,
real(dp), dimension(:), pointer eval,
real(dp), dimension(:), intent(in) eps_col,
type(lanczos_workspace_type), intent(inout) ws,
real(dp), intent(out) max_res_norm,
real(dp), intent(out) min_res_norm,
integer, intent(out) nmo_conv,
integer, intent(out) nmo_nc,
logical, intent(in), optional check_moconv_only )

Entry preparation of one (k-point, spin) channel before its inner Lanczos sweeps: orthonormalizes the input MOS (skipped for a read-only convergence probe), runs the full-width entry Rayleigh-Ritz pass, and computes the initial leading converged prefix and residual bounds.

Parameters
ksstandardized operator A = U^-dag H U^-1, nao x nao
c0current MOS in the standardized basis, rotated in place
evaleigenvalues of c0, updated in place
eps_colper-column convergence thresholds
wscaller-owned channel workspace
max_res_normlargest entry residual norm
min_res_normsmallest entry residual norm
nmo_convnumber of leading converged columns on entry
nmo_ncnumber of columns outside the leading converged prefix
check_moconv_onlyskip the entry Cholesky orthonormalization for a read-only probe

Definition at line 167 of file qs_scf_lanczos_c.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lanczos_sweep_suffix()

subroutine, public qs_scf_lanczos_c::lanczos_sweep_suffix ( type(cp_cfm_type), intent(in) ks,
type(cp_cfm_type), intent(inout) c0,
real(dp), dimension(:), pointer eval,
real(dp), dimension(:), intent(in) eps_col,
integer, intent(in) nkrylov,
integer, intent(in) nblock,
logical, intent(in) first_sweep,
logical, intent(in) need_suffix_rr,
type(lanczos_workspace_type), intent(inout) ws,
real(dp), intent(inout) max_res_norm,
real(dp), intent(inout) min_res_norm,
integer, intent(inout) nmo_conv,
integer, intent(inout) nmo_nc,
logical, intent(out) step_refined,
logical, intent(out) next_need_suffix_rr )

Run one inner Lanczos sweep on the unconverged suffix of c0. When the previous sweep ran in multi-block mode or had a truncated block, a local suffix Rayleigh-Ritz pass first decouples the unconverged tail of width nmo_nc without touching the locked prefix 1..nmo_conv.

Parameters
ksstandardized operator, nao x nao
c0MOS, refined in place on columns nmo_conv+1..nmo
evaleigenvalues, updated in place on the unconverged suffix
eps_colper-column convergence thresholds
nkrylovnumber of block expansion steps in the block regime
nblocknumber of columns refined jointly
first_sweeptrue on the first sweep right after lanczos_channel_begin
need_suffix_rrwhether to run a local suffix Rayleigh-Ritz before refining
wscaller-owned channel workspace
max_res_normlargest residual norm of the active suffix on exit
min_res_normsmallest residual norm of the active suffix on exit
nmo_convleading converged column count, advanced in place
nmo_ncunconverged suffix width, updated in place
step_refinedwhether this sweep modified c0
next_need_suffix_rrwhether the next sweep requires a suffix RR

Definition at line 243 of file qs_scf_lanczos_c.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lanczos_channel_end()

subroutine, public qs_scf_lanczos_c::lanczos_channel_end ( type(cp_cfm_type), intent(inout) c0,
type(lanczos_workspace_type), intent(inout) ws )

Defensive full-width Cholesky orthonormalization at the end of a channel's refinement sweeps, executed at most once per channel.

Parameters
c0refined MOS in the standardized basis
wscaller-owned channel workspace

Definition at line 309 of file qs_scf_lanczos_c.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lanczos_workspace_create()

subroutine, public qs_scf_lanczos_c::lanczos_workspace_create ( type(lanczos_workspace_type), intent(out) ws,
type(cp_fm_struct_type), pointer mo_struct,
type(cp_fm_struct_type), pointer ao_struct,
integer, intent(in) nkrylov,
integer, intent(in) nblock )

Create the kernel workspace at the worst-case widths of the run. The basis budget holds the larger of the NKRYLOV block budget and four times the widest single block, and every per-call clamp of the kernel stays below it. A single block covers every pending column only when NBLOCK spans them, so four times MIN(NBLOCK, nmo) bounds that regime. The candidate and Ritz widths hold the widest block a run can form.

Parameters
wsworkspace to create
mo_structstructure of the channel MOS, nao x nmo
ao_structstructure of the channel operators, nao x nao
nkrylovnumber of block expansion steps of the block regime
nblocknumber of columns refined jointly

Definition at line 819 of file qs_scf_lanczos_c.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lanczos_workspace_release()

subroutine, public qs_scf_lanczos_c::lanczos_workspace_release ( type(lanczos_workspace_type), intent(inout) ws)

Release the kernel workspace. Safe on a workspace that was never created: the matrix components default to disassociated and the arrays to unallocated.

Parameters
wsworkspace to release

Definition at line 896 of file qs_scf_lanczos_c.F.

Here is the call graph for this function:
Here is the caller graph for this function: