(git:cd2a8c4)
Loading...
Searching...
No Matches
bse_matvec Module Reference

Matrix-free application of the BSE matrices A and B to trial vectors from RI slabs that are sliced along the RI index over all MPI ranks. More...

Data Types

type  bse_matvec_env_type
 RI slabs of one spin channel, every rank holding n_ri_loc whole RI slices. More...

Functions/Subroutines

subroutine, public bse_matvec_create (mv_env, fm_s_ia, fm_s_bar_ij, fm_s_ab, fm_s_bar_ia, eps_reduced, homo, virt, alpha, w_fac, do_abba, unit_nr, block_cols)
 Moves the RI slabs onto an npe x 1 process grid, such that every rank owns whole RI slices, and stores them as local 3-index arrays: the contraction over each P in bse_matvec_apply is then a local DGEMM and only the final sum over P crosses the ranks.
subroutine, public bse_matvec_release (mv_env)
 Frees the sliced slabs, the transition energies and the process grid of mv_env.
subroutine, public bse_matvec_vector_struct (mv_env, ncol_global, fm_struct)
 Matrix structure of a block of trial vectors: rows ia distributed, all columns local.
subroutine, public bse_matvec_apply (mv_env, fm_z, first_col, ncol, fm_az, fm_bz, first_col_bz)
 Applies A (and B) to ncol trial vectors without forming an N_ov x N_ov object, (A Z)_ia = (ε_a-ε_i) Z_ia + α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ij B^P_ab Z_jb (B Z)_ia = α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ib B^P_ja Z_jb α: exchange prefactor (2 singlet, 0 triplet), w: prefactor of the screened term, \bar{B}: slab bound by the caller of bse_matvec_create (B itself for TDHF and ALPHA screening, sum_Q [1+Q(0)]^-1_PQ B^Q otherwise); the sums over P run over the local RI slices and are completed by a sum over the ranks.
subroutine, public bse_matvec_diagonal (mv_env, precond_kind, diag)
 Diagonal used by the Davidson correction, either ε_a-ε_i or the full diagonal A_ia,ia = ε_a-ε_i + α sum_P (B^P_ia)^2 - w sum_P \bar{B}^P_ii B^P_aa with α, w and \bar{B} as in bse_matvec_apply.
subroutine, public bse_matvec_subblock (mv_env, ia_list, a_sub, b_sub)
 Exact A (and B) on a list of transitions, replicated on every rank, A_kl = δ_kl (ε_a-ε_i) + α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ij B^P_ab B_kl = α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ib B^P_ja with k = (i,a), l = (j,b) and α, w, \bar{B} as in bse_matvec_apply.
subroutine, public bse_matvec_selfcheck (mv_env, fm_a_explicit, unit_nr, fm_b_explicit)
 Debug check of the matrix-free application against the explicit matrices A (and B), dev = max_ia,k |(A Z)_ia,k - sum_jb A_ia,jb Z_jb,k| over up to eight unit vectors Z_ia,k = δ_ia,k and one dense vector Z_ia = sin(ia), the same for B, and max_ia |d_ia - A_ia,ia| for the diagonal.

Variables

real(kind=dp), parameter, public mem_fraction = 0.5_dp

Detailed Description

Matrix-free application of the BSE matrices A and B to trial vectors from RI slabs that are sliced along the RI index over all MPI ranks.

History
09.2026 created [Maximilian Graml]

Function/Subroutine Documentation

◆ bse_matvec_create()

subroutine, public bse_matvec::bse_matvec_create ( type(bse_matvec_env_type), intent(out) mv_env,
type(cp_fm_type), intent(in) fm_s_ia,
type(cp_fm_type), intent(in) fm_s_bar_ij,
type(cp_fm_type), intent(in) fm_s_ab,
type(cp_fm_type), intent(in) fm_s_bar_ia,
real(kind=dp), dimension(:), intent(in) eps_reduced,
integer, intent(in) homo,
integer, intent(in) virt,
real(kind=dp), intent(in) alpha,
real(kind=dp), intent(in) w_fac,
logical, intent(in) do_abba,
integer, intent(in) unit_nr,
integer, intent(in), optional block_cols )

Moves the RI slabs onto an npe x 1 process grid, such that every rank owns whole RI slices, and stores them as local 3-index arrays: the contraction over each P in bse_matvec_apply is then a local DGEMM and only the final sum over P crosses the ranks.

Parameters
mv_envthe environment created here
fm_S_iaB^P_ia, N_RI x homo*virt
fm_S_bar_ij\bar{B}^P_ij, the slab that enters W_ij,ab, N_RI x homo*homo
fm_S_abB^P_ab, N_RI x virt*virt
fm_S_bar_ia\bar{B}^P_ia, the slab that enters W_ib,aj, N_RI x homo*virt
eps_reducedquasiparticle energies of the homo+virt active levels
homooccupied levels of the active window
virtvirtual levels of the active window
alphaprefactor of the exchange term, 2 singlet, 0 triplet
w_facprefactor of the screened term, 0 switches it off
do_abbaslice \bar{B}^P_ia as well, for the application of B
unit_nroutput unit, positive on the writing rank only
block_colstrial vectors per pass of bse_matvec_apply; absent or -1 sizes it from the free memory

Definition at line 99 of file bse_matvec.F.

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

◆ bse_matvec_release()

subroutine, public bse_matvec::bse_matvec_release ( type(bse_matvec_env_type), intent(inout) mv_env)

Frees the sliced slabs, the transition energies and the process grid of mv_env.

Parameters
mv_envthe environment released

Definition at line 265 of file bse_matvec.F.

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

◆ bse_matvec_vector_struct()

subroutine, public bse_matvec::bse_matvec_vector_struct ( type(bse_matvec_env_type), intent(in) mv_env,
integer, intent(in) ncol_global,
type(cp_fm_struct_type), pointer fm_struct )

Matrix structure of a block of trial vectors: rows ia distributed, all columns local.

Parameters
mv_envprocess grid and communicator of the trial vectors
ncol_globalnumber of trial vectors
fm_structcreated here, released by the caller

Definition at line 287 of file bse_matvec.F.

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

◆ bse_matvec_apply()

subroutine, public bse_matvec::bse_matvec_apply ( type(bse_matvec_env_type), intent(in), target mv_env,
type(cp_fm_type), intent(in) fm_z,
integer, intent(in) first_col,
integer, intent(in) ncol,
type(cp_fm_type), intent(in) fm_az,
type(cp_fm_type), intent(in), optional fm_bz,
integer, intent(in), optional first_col_bz )

Applies A (and B) to ncol trial vectors without forming an N_ov x N_ov object, (A Z)_ia = (ε_a-ε_i) Z_ia + α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ij B^P_ab Z_jb (B Z)_ia = α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ib B^P_ja Z_jb α: exchange prefactor (2 singlet, 0 triplet), w: prefactor of the screened term, \bar{B}: slab bound by the caller of bse_matvec_create (B itself for TDHF and ALPHA screening, sum_Q [1+Q(0)]^-1_PQ B^Q otherwise); the sums over P run over the local RI slices and are completed by a sum over the ranks.

Parameters
mv_envslabs, prefactors and transition energies
fm_Ztrial vectors, columns first_col .. first_col+ncol-1 are read
first_colfirst trial vector read, and first column written
ncolnumber of trial vectors
fm_AZreceives A Z in the same columns
fm_BZreceives B Z in the same columns, or from first_col_BZ on
first_col_BZfirst column of fm_BZ written, first_col by default

Definition at line 318 of file bse_matvec.F.

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

◆ bse_matvec_diagonal()

subroutine, public bse_matvec::bse_matvec_diagonal ( type(bse_matvec_env_type), intent(in) mv_env,
integer, intent(in) precond_kind,
real(kind=dp), dimension(:), intent(out) diag )

Diagonal used by the Davidson correction, either ε_a-ε_i or the full diagonal A_ia,ia = ε_a-ε_i + α sum_P (B^P_ia)^2 - w sum_P \bar{B}^P_ii B^P_aa with α, w and \bar{B} as in bse_matvec_apply.

Parameters
mv_envslabs, prefactors and transition energies
precond_kindbse_precond_full_diag or bse_precond_qp_diff
diagreplicated, size N_ov

Definition at line 480 of file bse_matvec.F.

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

◆ bse_matvec_subblock()

subroutine, public bse_matvec::bse_matvec_subblock ( type(bse_matvec_env_type), intent(in) mv_env,
integer, dimension(:), intent(in) ia_list,
real(kind=dp), dimension(:, :), intent(out) a_sub,
real(kind=dp), dimension(:, :), intent(out), optional b_sub )

Exact A (and B) on a list of transitions, replicated on every rank, A_kl = δ_kl (ε_a-ε_i) + α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ij B^P_ab B_kl = α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ib B^P_ja with k = (i,a), l = (j,b) and α, w, \bar{B} as in bse_matvec_apply.

Parameters
mv_envslabs, prefactors and transition energies
ia_listglobal transition indices ia = (i-1)*virt + a of the block
A_subSIZE(ia_list) x SIZE(ia_list)
B_subsame, only formed when present

Definition at line 523 of file bse_matvec.F.

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

◆ bse_matvec_selfcheck()

subroutine, public bse_matvec::bse_matvec_selfcheck ( type(bse_matvec_env_type), intent(in) mv_env,
type(cp_fm_type), intent(in) fm_a_explicit,
integer, intent(in) unit_nr,
type(cp_fm_type), intent(in), optional fm_b_explicit )

Debug check of the matrix-free application against the explicit matrices A (and B), dev = max_ia,k |(A Z)_ia,k - sum_jb A_ia,jb Z_jb,k| over up to eight unit vectors Z_ia,k = δ_ia,k and one dense vector Z_ia = sin(ia), the same for B, and max_ia |d_ia - A_ia,ia| for the diagonal.

Parameters
mv_envthe environment under test
fm_A_explicitA from create_A_and_B, N_ov x N_ov on the grid of the caller
unit_nroutput unit, positive on the writing rank only
fm_B_explicitB, present for an ABBA run

Definition at line 598 of file bse_matvec.F.

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

Variable Documentation

◆ mem_fraction

real(kind=dp), parameter, public bse_matvec::mem_fraction = 0.5_dp

Definition at line 47 of file bse_matvec.F.