(git:6344619)
Loading...
Searching...
No Matches
ri_rs_matrices Module Reference

DBCSR collocation, layouts and panel contractions for real-space resolution of the identity. More...

Functions/Subroutines

subroutine, public atomic_basis_at_grid_point (ri_rs, basis_set_ao, matrix_template, para_env, eps_filter, msg_elem_limit, unit_nr, periodic_images)
 Builds the grid-by-AO collocation matrix with bounded dense evaluation panels. The molecular path uses atom-aligned row blocks and minimum-image AO values. The Gamma path uses uniform row blocks and sums neighbouring periodic images.
subroutine, public setup_square_topology (matrix_template, dim_type, square_dist, blk_sizes, mapped_dist)
 Creates a square topology from a selected row or column layout.
subroutine, public release_dbcsr_topology_and_matrices (dist, mapped_dist, m1, m2, m3, m4)
 Releases RI-RS topology mappings and temporary DBCSR matrices.
subroutine, public reserve_blocks_within_radius (matrix, centers, radius)
 Reserves grid blocks with block-centre distances within a fixed radius.
subroutine, public print_matrix_occupation (matrix, label, para_env, unit_nr, msg_elem_limit, suffix)
 Prints the percentage of non-zero elements in a distributed RI-RS matrix.
subroutine, public mask_grid_blocks_near_panel (centroids, blk0, blk1, cutoff, used)
 Marks the grid blocks whose centroid lies within cutoff of the bounding box of the panel [blk0, blk1]'s chunk centroids.
subroutine, public panel_template_elems (r_blk_sizes, centroids, used, blk0, blk1, cutoff, nze_tmpl)
 Exact allocated-element count of the geo template of panel [blk0, blk1]: the very same per-block-pair centroid test as build_geo_template_panel, so this is the true DBCSR data size of A_pan/B_pan (DBCSR stores whole blocks).
subroutine, public panel_mem_estimate_gb (nze_tmpl, pan_rows, width, n_grid_total, n_ri, n_ao, n_procs, mem_gb)
 Per-rank peak memory (GB) of one panel step of the neighborhood-restricted contractions: up to three grid x grid panels (two A operands and the shared B operand) plus the grid x RI intermediates (tmp2 and the accumulation operand) and the grid x AO intermediate (tmpA), whose column support is the panel's geometric neighborhood fraction f_near = width/n_grid. Used by planning and memory reporting.
subroutine, public contract_grid_panels (l_a, m_a, l_b, m_b, l_out, mat_out, scale, eps, para_env, pan_first, pan_last, lb_eq_la, lout_eq_la, zero_out, centroids, cutoff, grid_occupation)
 Projects two operators onto grid panels, takes their Hadamard product, and back-projects it: out += scale * L_out^T (A_grid ∘ B_grid) L_out, where A_grid = L_A M_A L_A^T and B_grid = L_B M_B L_B^T. Each L has shape (grid, basis), and its M has shape (basis, basis). The three L matrices must share the ordered grid rows, row blocking and process grid. Only panel x grid slabs are formed; contributions are accumulated over all panels. The sequence of EPS_FILTER screening and floating-point reductions may differ from a full-grid evaluation.
subroutine, public build_ri_rs_bare_aux_interaction (qs_env, metric_inverse, trunc_coulomb, auto_ri, mat_z_lp, matrix_v_aux)
 Build the unfiltered auxiliary interaction M^-1 V^tr M^-1 in the Z-column layout. AUTO_RI uses its already transformed Coulomb matrix in the optimized auxiliary basis. Filtering and cache lifetime are owned by the caller.
subroutine, public resolve_grid_panels (ri_rs, para_env, msg_elem_limit, pan_first, pan_last, cutoff)
 Resolve and cache grid-panel boundaries for RI-RS streaming contractions.

Detailed Description

DBCSR collocation, layouts and panel contractions for real-space resolution of the identity.

Function/Subroutine Documentation

◆ atomic_basis_at_grid_point()

subroutine, public ri_rs_matrices::atomic_basis_at_grid_point ( type(ri_rs_env), intent(inout) ri_rs,
type(gto_basis_set_p_type), dimension(:), intent(in) basis_set_ao,
type(dbcsr_type), intent(in) matrix_template,
type(mp_para_env_type), pointer para_env,
real(kind=dp), intent(in) eps_filter,
integer(kind=int_8), intent(in) msg_elem_limit,
integer, intent(in) unit_nr,
logical, intent(in) periodic_images )

Builds the grid-by-AO collocation matrix with bounded dense evaluation panels. The molecular path uses atom-aligned row blocks and minimum-image AO values. The Gamma path uses uniform row blocks and sums neighbouring periodic images.

Parameters
ri_rsgrid, borrowed geometry references and output collocation matrix
basis_set_AOAO basis sets, one per atomic kind
matrix_templatetemplate for the process grid and AO column block sizes
para_envparallel environment
eps_filterblock screening threshold
msg_elem_limitmaximum number of elements per DBCSR message
unit_nroutput unit
periodic_imagesselect neighbouring-image summation for Gamma

Definition at line 69 of file ri_rs_matrices.F.

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

◆ setup_square_topology()

subroutine, public ri_rs_matrices::setup_square_topology ( type(dbcsr_type), intent(in) matrix_template,
character(len=*), intent(in) dim_type,
type(dbcsr_distribution_type), intent(out) square_dist,
integer, dimension(:), intent(out), pointer blk_sizes,
integer, dimension(:), intent(out), pointer mapped_dist )

Creates a square topology from a selected row or column layout.

Parameters
matrix_templatesource matrix
dim_typeROW or COL
square_distoutput distribution
blk_sizesborrowed block sizes
mapped_distowned mapping in the other process-grid direction

Definition at line 212 of file ri_rs_matrices.F.

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

◆ release_dbcsr_topology_and_matrices()

subroutine, public ri_rs_matrices::release_dbcsr_topology_and_matrices ( type(dbcsr_distribution_type), intent(inout), optional dist,
integer, dimension(:), intent(inout), optional, pointer mapped_dist,
type(dbcsr_type), intent(inout), optional m1,
type(dbcsr_type), intent(inout), optional m2,
type(dbcsr_type), intent(inout), optional m3,
type(dbcsr_type), intent(inout), optional m4 )

Releases RI-RS topology mappings and temporary DBCSR matrices.

Parameters
distdistribution to release
mapped_distowned mapping to deallocate
m1optional matrix
m2optional matrix
m3optional matrix
m4optional matrix

Definition at line 268 of file ri_rs_matrices.F.

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

◆ reserve_blocks_within_radius()

subroutine, public ri_rs_matrices::reserve_blocks_within_radius ( type(dbcsr_type), intent(inout) matrix,
real(kind=dp), dimension(:, :), intent(in) centers,
real(kind=dp), intent(in) radius )

Reserves grid blocks with block-centre distances within a fixed radius.

Parameters
matrixtarget matrix
centersblock-centre coordinates
radiustruncation radius

Definition at line 304 of file ri_rs_matrices.F.

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

◆ print_matrix_occupation()

subroutine, public ri_rs_matrices::print_matrix_occupation ( type(dbcsr_type), intent(in) matrix,
character(len=*), intent(in) label,
type(mp_para_env_type), intent(in) para_env,
integer, intent(in) unit_nr,
integer(kind=int_8), intent(in) msg_elem_limit,
character(len=*), intent(in), optional suffix )

Prints the percentage of non-zero elements in a distributed RI-RS matrix.

Parameters
matrixDistributed matrix whose occupation is reported
labelMathematical matrix label used in the output
para_envcommunicator shared by all matrix ranks
unit_nroutput unit; nonpositive values suppress printing
msg_elem_limitmaximum number of elements per DBCSR message
suffixOptional text appended to the matrix label

Definition at line 357 of file ri_rs_matrices.F.

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

◆ mask_grid_blocks_near_panel()

subroutine, public ri_rs_matrices::mask_grid_blocks_near_panel ( real(kind=dp), dimension(:, :), intent(in) centroids,
integer, intent(in) blk0,
integer, intent(in) blk1,
real(kind=dp), intent(in) cutoff,
logical, dimension(:), intent(out), allocatable used )

Marks the grid blocks whose centroid lies within cutoff of the bounding box of the panel [blk0, blk1]'s chunk centroids.

Parameters
centroids...
blk0...
blk1...
cutoff...
used...

Definition at line 415 of file ri_rs_matrices.F.

Here is the caller graph for this function:

◆ panel_template_elems()

subroutine, public ri_rs_matrices::panel_template_elems ( integer, dimension(:), intent(in) r_blk_sizes,
real(kind=dp), dimension(:, :), intent(in) centroids,
logical, dimension(:), intent(in) used,
integer, intent(in) blk0,
integer, intent(in) blk1,
real(kind=dp), intent(in) cutoff,
integer(kind=int_8), intent(out) nze_tmpl )

Exact allocated-element count of the geo template of panel [blk0, blk1]: the very same per-block-pair centroid test as build_geo_template_panel, so this is the true DBCSR data size of A_pan/B_pan (DBCSR stores whole blocks).

Parameters
r_blk_sizes...
centroids...
used...
blk0...
blk1...
cutoff...
nze_tmpl...

Definition at line 460 of file ri_rs_matrices.F.

Here is the caller graph for this function:

◆ panel_mem_estimate_gb()

subroutine, public ri_rs_matrices::panel_mem_estimate_gb ( integer(kind=int_8), intent(in) nze_tmpl,
integer, intent(in) pan_rows,
integer, intent(in) width,
integer, intent(in) n_grid_total,
integer, intent(in) n_ri,
integer, intent(in) n_ao,
integer, intent(in) n_procs,
real(kind=dp), intent(out) mem_gb )

Per-rank peak memory (GB) of one panel step of the neighborhood-restricted contractions: up to three grid x grid panels (two A operands and the shared B operand) plus the grid x RI intermediates (tmp2 and the accumulation operand) and the grid x AO intermediate (tmpA), whose column support is the panel's geometric neighborhood fraction f_near = width/n_grid. Used by planning and memory reporting.

Parameters
nze_tmpl...
pan_rows...
width...
n_grid_total...
n_RI...
n_ao...
n_procs...
mem_GB...

Definition at line 520 of file ri_rs_matrices.F.

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

◆ contract_grid_panels()

subroutine, public ri_rs_matrices::contract_grid_panels ( type(dbcsr_type), intent(inout), target l_a,
type(dbcsr_type), dimension(:), intent(inout) m_a,
type(dbcsr_type), intent(inout), target l_b,
type(dbcsr_type), intent(inout) m_b,
type(dbcsr_type), intent(inout), target l_out,
type(dbcsr_p_type), dimension(:), intent(in) mat_out,
real(kind=dp), intent(in) scale,
real(kind=dp), intent(in) eps,
type(mp_para_env_type), intent(in), pointer para_env,
integer, dimension(:), intent(in) pan_first,
integer, dimension(:), intent(in) pan_last,
logical, intent(in) lb_eq_la,
logical, intent(in) lout_eq_la,
logical, intent(in) zero_out,
real(kind=dp), dimension(:, :), intent(in), optional centroids,
real(kind=dp), intent(in), optional cutoff,
real(kind=dp), intent(out), optional grid_occupation )

Projects two operators onto grid panels, takes their Hadamard product, and back-projects it: out += scale * L_out^T (A_grid ∘ B_grid) L_out, where A_grid = L_A M_A L_A^T and B_grid = L_B M_B L_B^T. Each L has shape (grid, basis), and its M has shape (basis, basis). The three L matrices must share the ordered grid rows, row blocking and process grid. Only panel x grid slabs are formed; contributions are accumulated over all panels. The sequence of EPS_FILTER screening and floating-point reductions may differ from a full-grid evaluation.

The physical contractions and their signs/spin factors are specified in gw_ri_rs_kernels: χ: L_A=L_B=ϕ, M_A=G_occ, M_B=G_vir, L_out=Z -> RI x RI Σx: L_A=ϕ, M_A=D, L_B=Z, M_B=M^-1 V^tr M^-1, L_out=ϕ -> AO x AO Σc: L_A=ϕ, M_A=[G_occ,G_vir], L_B=Z, M_B=W, L_out=ϕ -> two AO x AO outputs. The second Σc output reuses the same W grid panel; its projection and back-projection otherwise follow the same operations as the first output.

Parameters
L_Agrid-by-basis collocation or fitting matrix for the first operand
M_Aone or two square operators, with row/column blocking matching the columns of L_A
L_Bgrid-by-basis collocation or fitting matrix for the second operand
M_Bsecond square operator, with row/column blocking matching the columns of L_B
L_outgrid-by-output-basis matrix for back-projection
mat_outborrowed pointers to pre-created outputs, one per M_A, with the column blocking of L_out
scaleprefactor of the Hadamard product, including the caller's sign/spin convention
epsDBCSR multiplication screening threshold
para_envcommunicator containing all matrix ranks
pan_firstfirst global grid row-block of each ordered, nonoverlapping panel
pan_lastlast global grid row-block of each panel; panels together cover the grid
lb_eq_laL_B equals L_A in values and layout, allowing their grid/AO slices to be shared
lout_eq_laL_out equals L_A in values and layout, allowing back-projection slices to be shared
zero_outclear the output matrices before accumulating, otherwise add to their existing values
centroidsoptional global grid-block centres, paired with a positive cutoff for truncation
cutoffretain grid-block pairs within this centroid distance; nonpositive disables truncation
grid_occupationallocated-element fraction of the first grid operand before the Hadamard product

Definition at line 1006 of file ri_rs_matrices.F.

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

◆ build_ri_rs_bare_aux_interaction()

subroutine, public ri_rs_matrices::build_ri_rs_bare_aux_interaction ( type(qs_environment_type), pointer qs_env,
type(cp_fm_type), intent(in) metric_inverse,
type(libint_potential_type), intent(in) trunc_coulomb,
type(auto_ri_type), intent(in) auto_ri,
type(dbcsr_type), intent(in) mat_z_lp,
type(dbcsr_type), intent(out) matrix_v_aux )

Build the unfiltered auxiliary interaction M^-1 V^tr M^-1 in the Z-column layout. AUTO_RI uses its already transformed Coulomb matrix in the optimized auxiliary basis. Filtering and cache lifetime are owned by the caller.

Parameters
qs_envelectronic-structure environment for ordinary RI integrals
metric_inverseinverse auxiliary metric
trunc_coulombCoulomb operator for ordinary RI integrals
auto_rioptimized auxiliary basis and its Coulomb matrix
mat_Z_lPtemplate defining the auxiliary blocking and process grid
matrix_V_auxoutput bare interaction in the auxiliary basis

Definition at line 1206 of file ri_rs_matrices.F.

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

◆ resolve_grid_panels()

subroutine, public ri_rs_matrices::resolve_grid_panels ( type(ri_rs_env), intent(inout) ri_rs,
type(mp_para_env_type), pointer para_env,
integer(kind=int_8), intent(in) msg_elem_limit,
integer, dimension(:), intent(out), allocatable pan_first,
integer, dimension(:), intent(out), allocatable pan_last,
real(kind=dp), intent(in) cutoff )

Resolve and cache grid-panel boundaries for RI-RS streaming contractions.

Parameters
ri_rscollocation and fitting matrices, grid geometry and owned panel cache
para_envparallel environment
msg_elem_limitmaximum number of elements per DBCSR message
pan_first...
pan_last...
cutoffgrid-centroid distance cutoff; zero disables geometric truncation

Definition at line 1250 of file ri_rs_matrices.F.

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