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

Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations. More...

Functions/Subroutines

pure integer function, public ia_of_occ_virt (i_occ, a_virt, virt)
 Compound transition index ia = (i-1)*virt + a of the pair (i, a): a is the fast index.
pure integer function, public occ_of_ia (ia, virt)
 Occupied level of the compound transition index ia = (i-1)*virt + a.
pure integer function, public virt_of_ia (ia, virt)
 Virtual level of the compound transition index ia = (i-1)*virt + a.
subroutine, public screen_slabs (fm_eps_inv, fm_s_ij, fm_s_ia, dimen_ri_red, homo, virtual, fm_s_bar_ij, fm_s_bar_ia, do_abba)
 The screened slabs \bar{B}^P_ij = sum_Q [1+Q(0)]^-1_PQ B^Q_ij and \bar{B}^P_ia = sum_Q [1+Q(0)]^-1_PQ B^Q_ia, P, Q ≤ dimen_RI_red.
subroutine, public comp_eigvec_coeff_bse (fm_work, eig_vals, beta, gamma, do_transpose)
 Routine for computing the coefficients of the eigenvectors of the BSE matrix from a multiplication with the eigenvalues.
subroutine, public sort_excitations (idx_prim, idx_sec, eigvec_entries, idx_spin)
 Sorts excitation entries by ascending primary index, reordering the secondary index, the eigenvector coefficients and - open shell - the spin index alongside.
subroutine, public estimate_bse_resources (n_ov_joint, unit_nr, bse_abba, para_env, diag_runtime_est)
 Roughly estimates the needed runtime and memory during the BSE run.
pure real(kind=dp) function, public fulldiag_memory_estimate_gb (n_ov_joint, do_abba)
 Peak memory of the full diagonalization in GB, all ranks together: n_ov^2 doubles times the matrices held at once, 2 for TDA (A and W_ijab), 10 for ABBA (B, C and the six that build C added).
subroutine, public filter_eigvec_contrib (fm_eigvec, idx_homo, idx_virt, eigvec_entries, i_exc, virtual, num_entries, bse_env, offsets, virtual_per_spin, idx_spin)
 Filters eigenvector entries above a given threshold to describe excitations in the singleparticle basis.
subroutine, public get_bse_spin_block_layout (homo_red, virt_red, n_ov, offsets, n_ov_joint)
 Spin-block layout for the open-shell (joint) BSE matrix: per-spin OV-pair counts and the block offsets into the joint matrix of dimension n_ov_joint = sum_sigma homo*virtual.
subroutine, public bse_window_from_dft (eigenval_scf, n_mo, homo, cutoff_occ, cutoff_empty, window, warn)
 The active MO window on the DFT axis: one absolute MO range for every spin; when the spin windows differ, the smallest range covering all of them.
subroutine, public bse_window_from_mos (mos, cutoff_occ, cutoff_empty, window, warn)
 The active MO window of bse_window_from_dft, from the DFT eigenvalues of the MO sets.
subroutine, public truncate_bse_matrices (fm_s_ia_full, fm_s_ij_full, fm_s_ab_full, eigenval_scf, eigenval, eigenval_reduced_scf, eigenval_reduced_qp, homo, virtual, dimen_ri, unit_nr, ispin, bse_env, window, print_window)
 Determines indices within the given energy cutoffs and truncates Eigenvalues and matrices.
subroutine, public reshuffle_eigvec (fm_eigvec, fm_eigvec_reshuffled, homo, virtual, n_exc, do_transpose)
 ...
subroutine, public print_bse_nto_cubes (bse_env, mos, istate, info_approximation, stride, append_cube, print_section)
 Borrowed from the tddfpt module with slight adaptions.
subroutine, public adapt_bse_input_params (homo, virtual, unit_nr, bse_env)
 Checks BSE input section and adapts them if necessary.
subroutine, public adapt_bse_screening (bse_env, unit_nr)
 Resolve SCREENING_IN_W and its factor before constructing the dielectric matrix or slabs.
subroutine, public get_multipoles_mo (fm_multipole_ai_trunc, fm_multipole_ij_trunc, fm_multipole_ab_trunc, matrix_multipole, mos, mo_coeff, homo_red, virtual_red, context_bse, ispin)
 The multipoles in the MO window, D^k_pq = sum_µν C_µp M^k_µν C_νq, cut to the ai, ij and ab blocks of the window; M^k_µν are the AO multipoles of get_multipoles_ao.
subroutine, public trace_exciton_descr (fm_a, fm_b, fm_c, alpha)
 Computes trace of form Tr{A^T B C} for exciton descriptors.
subroutine, public assemble_joint_ov_slab (fm_s_ia, offsets, n_ov, dimen_ri, fm_s_joint)
 Column-concatenate per-spin ia-slabs into the joint dimen_RI x n_ov_joint slab. Sigma-block of spin isp occupies columns offsets(isp)+1 .. offsets(isp)+n_ov(isp). fm_S_joint must be pre-created and zeroed by the caller.

Detailed Description

Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations.

History
11.2023 created [Maximilian Graml]

Function/Subroutine Documentation

◆ ia_of_occ_virt()

pure integer function, public bse_util::ia_of_occ_virt ( integer, intent(in) i_occ,
integer, intent(in) a_virt,
integer, intent(in) virt )

Compound transition index ia = (i-1)*virt + a of the pair (i, a): a is the fast index.

Parameters
i_occoccupied level
a_virtvirtual level
virtnumber of virtual levels
Returns
ia

Definition at line 94 of file bse_util.F.

Here is the caller graph for this function:

◆ occ_of_ia()

pure integer function, public bse_util::occ_of_ia ( integer, intent(in) ia,
integer, intent(in) virt )

Occupied level of the compound transition index ia = (i-1)*virt + a.

Parameters
iacompound transition index
virtnumber of virtual levels
Returns
i

Definition at line 109 of file bse_util.F.

Here is the caller graph for this function:

◆ virt_of_ia()

pure integer function, public bse_util::virt_of_ia ( integer, intent(in) ia,
integer, intent(in) virt )

Virtual level of the compound transition index ia = (i-1)*virt + a.

Parameters
iacompound transition index
virtnumber of virtual levels
Returns
a

Definition at line 124 of file bse_util.F.

Here is the caller graph for this function:

◆ screen_slabs()

subroutine, public bse_util::screen_slabs ( type(cp_fm_type), intent(in) fm_eps_inv,
type(cp_fm_type), intent(in) fm_s_ij,
type(cp_fm_type), intent(in) fm_s_ia,
integer, intent(in) dimen_ri_red,
integer, intent(in) homo,
integer, intent(in) virtual,
type(cp_fm_type), intent(out) fm_s_bar_ij,
type(cp_fm_type), intent(out) fm_s_bar_ia,
logical, intent(in) do_abba )

The screened slabs \bar{B}^P_ij = sum_Q [1+Q(0)]^-1_PQ B^Q_ij and \bar{B}^P_ia = sum_Q [1+Q(0)]^-1_PQ B^Q_ia, P, Q ≤ dimen_RI_red.

Parameters
fm_eps_inv[1+Q(0)]^-1_PQ
fm_S_ijB^P_ij of the window, dimen_RI x homo^2
fm_S_iaB^P_ia of the window, dimen_RI x homo*virtual
dimen_RI_redreduced RI dimension, the contraction length
homooccupied levels in the window
virtualvirtual levels in the window
fm_S_bar_ij\bar{B}^P_ij, created here on fm_S_ij's structure
fm_S_bar_ia\bar{B}^P_ia, created here on fm_S_ia's structure for ABBA only
do_abbawhether the coupling matrix B needs the screened ia slab

Definition at line 146 of file bse_util.F.

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

◆ comp_eigvec_coeff_bse()

subroutine, public bse_util::comp_eigvec_coeff_bse ( type(cp_fm_type), intent(inout) fm_work,
real(kind=dp), dimension(:), intent(in), allocatable eig_vals,
real(kind=dp), intent(in) beta,
real(kind=dp), intent(in), optional gamma,
logical, intent(in), optional do_transpose )

Routine for computing the coefficients of the eigenvectors of the BSE matrix from a multiplication with the eigenvalues.

Parameters
fm_work...
eig_vals...
beta...
gamma...
do_transpose...

Definition at line 189 of file bse_util.F.

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

◆ sort_excitations()

subroutine, public bse_util::sort_excitations ( integer, dimension(:), allocatable idx_prim,
integer, dimension(:), allocatable idx_sec,
real(kind=dp), dimension(:), allocatable eigvec_entries,
integer, dimension(:), optional, allocatable idx_spin )

Sorts excitation entries by ascending primary index, reordering the secondary index, the eigenvector coefficients and - open shell - the spin index alongside.

Parameters
idx_primPrimary index of each entry; sorted in place and used as the sort key
idx_secSecondary index of each entry, reordered to follow idx_prim
eigvec_entriesEigenvector coefficients of each entry, reordered to follow idx_prim
idx_spinOptional spin index of each entry (open shell), reordered to follow idx_prim

Definition at line 256 of file bse_util.F.

Here is the caller graph for this function:

◆ estimate_bse_resources()

subroutine, public bse_util::estimate_bse_resources ( integer, intent(in) n_ov_joint,
integer, intent(in) unit_nr,
logical bse_abba,
type(mp_para_env_type), pointer para_env,
real(kind=dp) diag_runtime_est )

Roughly estimates the needed runtime and memory during the BSE run.

Parameters
n_ov_joint...
unit_nr...
bse_abba...
para_env...
diag_runtime_est...

Definition at line 352 of file bse_util.F.

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

◆ fulldiag_memory_estimate_gb()

pure real(kind=dp) function, public bse_util::fulldiag_memory_estimate_gb ( integer, intent(in) n_ov_joint,
logical, intent(in) do_abba )

Peak memory of the full diagonalization in GB, all ranks together: n_ov^2 doubles times the matrices held at once, 2 for TDA (A and W_ijab), 10 for ABBA (B, C and the six that build C added).

Parameters
n_ov_jointtransition pairs in the active window, summed over spins
do_abbafull problem, not TDA
Returns
the estimate in GB

Definition at line 396 of file bse_util.F.

Here is the caller graph for this function:

◆ filter_eigvec_contrib()

subroutine, public bse_util::filter_eigvec_contrib ( type(cp_fm_type), intent(in) fm_eigvec,
integer, dimension(:), allocatable idx_homo,
integer, dimension(:), allocatable idx_virt,
real(kind=dp), dimension(:), allocatable eigvec_entries,
integer i_exc,
integer virtual,
integer num_entries,
type(bse_env_type), intent(in) bse_env,
integer, dimension(:), intent(in), optional offsets,
integer, dimension(:), intent(in), optional virtual_per_spin,
integer, dimension(:), optional, allocatable idx_spin )

Filters eigenvector entries above a given threshold to describe excitations in the singleparticle basis.

Parameters
fm_eigvec...
idx_homo...
idx_virt...
eigvec_entries...
i_exc...
virtual...
num_entries...
bse_envthe BSE environment (settings)
offsets...
virtual_per_spin...
idx_spin...

Definition at line 428 of file bse_util.F.

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

◆ get_bse_spin_block_layout()

subroutine, public bse_util::get_bse_spin_block_layout ( integer, dimension(:), intent(in) homo_red,
integer, dimension(:), intent(in) virt_red,
integer, dimension(:), intent(out) n_ov,
integer, dimension(:), intent(out) offsets,
integer, intent(out) n_ov_joint )

Spin-block layout for the open-shell (joint) BSE matrix: per-spin OV-pair counts and the block offsets into the joint matrix of dimension n_ov_joint = sum_sigma homo*virtual.

Parameters
homo_redper-spin (reduced) number of occupied levels
virt_redper-spin (reduced) number of virtual levels
n_ovper-spin OV-pair count (OUT)
offsetsper-spin block offset into the joint matrix (OUT)
n_ov_jointtotal joint dimension (OUT)

Definition at line 548 of file bse_util.F.

Here is the caller graph for this function:

◆ bse_window_from_dft()

subroutine, public bse_util::bse_window_from_dft ( real(kind=dp), dimension(:, :), intent(in) eigenval_scf,
integer, dimension(:), intent(in) n_mo,
integer, dimension(:), intent(in) homo,
real(kind=dp), intent(in) cutoff_occ,
real(kind=dp), intent(in) cutoff_empty,
type(mo_window_type), intent(out) window,
logical, intent(in) warn )

The active MO window on the DFT axis: one absolute MO range for every spin; when the spin windows differ, the smallest range covering all of them.

Parameters
eigenval_scfDFT eigenvalues (level, spin)
n_monumber of MOs per spin
homooccupied MOs per spin
cutoff_occENERGY_CUTOFF_OCC in Hartree, zero or negative for no cutoff
cutoff_emptyENERGY_CUTOFF_EMPTY in Hartree, zero or negative for no cutoff
windowfirst and last MO to keep
warnwarn when the spin windows differ; false for a second call in the same run

Definition at line 575 of file bse_util.F.

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

◆ bse_window_from_mos()

subroutine, public bse_util::bse_window_from_mos ( type(mo_set_type), dimension(:), intent(in) mos,
real(kind=dp), intent(in) cutoff_occ,
real(kind=dp), intent(in) cutoff_empty,
type(mo_window_type), intent(out) window,
logical, intent(in) warn )

The active MO window of bse_window_from_dft, from the DFT eigenvalues of the MO sets.

Parameters
mosMO sets per spin
cutoff_occENERGY_CUTOFF_OCC in Hartree, zero or negative for no cutoff
cutoff_emptyENERGY_CUTOFF_EMPTY in Hartree, zero or negative for no cutoff
windowfirst and last MO to keep, one absolute range for every spin
warnwarn when the spin windows differ

Definition at line 613 of file bse_util.F.

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

◆ truncate_bse_matrices()

subroutine, public bse_util::truncate_bse_matrices ( type(cp_fm_type), intent(in) fm_s_ia_full,
type(cp_fm_type), intent(in) fm_s_ij_full,
type(cp_fm_type), intent(in) fm_s_ab_full,
real(kind=dp), dimension(:) eigenval_scf,
real(kind=dp), dimension(:) eigenval,
real(kind=dp), dimension(:), allocatable eigenval_reduced_scf,
real(kind=dp), dimension(:), allocatable eigenval_reduced_qp,
integer, intent(in) homo,
integer, intent(in) virtual,
integer, intent(in) dimen_ri,
integer, intent(in) unit_nr,
integer, intent(in) ispin,
type(bse_env_type), intent(inout) bse_env,
type(mo_window_type), intent(in) window,
logical, intent(in) print_window )

Determines indices within the given energy cutoffs and truncates Eigenvalues and matrices.

Parameters
fm_S_ia_full...
fm_S_ij_full...
fm_S_ab_full...
Eigenval_scf...
Eigenval...
Eigenval_reduced_scfDFT energies of the window, allocated here
Eigenval_reduced_qpquasiparticle energies of the window, allocated here
homo...
virtual...
dimen_RI...
unit_nr...
ispinspin of the slabs, selects the GW-corrected virtual count
bse_envthe BSE environment (settings; the GW-corrected level counts); receives the window's slabs fm_S_ia, fm_S_ij, fm_S_ab and its level counts homo_red, virt_red of spin ispin
windowAbsolute MO window to retain.
print_windowWhether to print the cutoff summary.

Definition at line 656 of file bse_util.F.

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

◆ reshuffle_eigvec()

subroutine, public bse_util::reshuffle_eigvec ( type(cp_fm_type), intent(in) fm_eigvec,
type(cp_fm_type), intent(inout) fm_eigvec_reshuffled,
integer, intent(in) homo,
integer, intent(in) virtual,
integer, intent(in) n_exc,
logical, intent(in) do_transpose )

...

Parameters
fm_eigvec...
fm_eigvec_reshuffled...
homo...
virtual...
n_exc...
do_transpose...

Definition at line 794 of file bse_util.F.

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

◆ print_bse_nto_cubes()

subroutine, public bse_util::print_bse_nto_cubes ( type(bse_env_type), intent(in) bse_env,
type(mo_set_type), dimension(:), intent(in) mos,
integer, intent(in) istate,
character(len=10) info_approximation,
integer, dimension(:), pointer stride,
logical, intent(in) append_cube,
type(section_vals_type), pointer print_section )

Borrowed from the tddfpt module with slight adaptions.

Parameters
bse_envthe BSE environment (the QS objects the cube writer reads)
mos...
istate...
info_approximation...
stride...
append_cube...
print_section...

Definition at line 862 of file bse_util.F.

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

◆ adapt_bse_input_params()

subroutine, public bse_util::adapt_bse_input_params ( integer, intent(in) homo,
integer, intent(in) virtual,
integer, intent(in) unit_nr,
type(bse_env_type), intent(inout) bse_env )

Checks BSE input section and adapts them if necessary.

Parameters
homo...
virtual...
unit_nr...
bse_envthe BSE environment; the settings are normalised in place

Definition at line 959 of file bse_util.F.

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

◆ adapt_bse_screening()

subroutine, public bse_util::adapt_bse_screening ( type(bse_env_type), intent(inout) bse_env,
integer, intent(in) unit_nr )

Resolve SCREENING_IN_W and its factor before constructing the dielectric matrix or slabs.

Parameters
bse_envscreening method and factor, normalised in place
unit_nroutput unit, positive on the writing rank only

Definition at line 1120 of file bse_util.F.

Here is the caller graph for this function:

◆ get_multipoles_mo()

subroutine, public bse_util::get_multipoles_mo ( type(cp_fm_type), dimension(:), intent(inout), allocatable fm_multipole_ai_trunc,
type(cp_fm_type), dimension(:), intent(inout), allocatable fm_multipole_ij_trunc,
type(cp_fm_type), dimension(:), intent(inout), allocatable fm_multipole_ab_trunc,
type(dbcsr_p_type), dimension(:), intent(in) matrix_multipole,
type(mo_set_type), dimension(:), intent(in) mos,
type(cp_fm_type), dimension(:), intent(in) mo_coeff,
integer, intent(in) homo_red,
integer, intent(in) virtual_red,
type(cp_blacs_env_type), pointer context_bse,
integer, intent(in), optional ispin )

The multipoles in the MO window, D^k_pq = sum_µν C_µp M^k_µν C_νq, cut to the ai, ij and ab blocks of the window; M^k_µν are the AO multipoles of get_multipoles_ao.

Parameters
fm_multipole_ai_truncD^k_ai, one entry per component k
fm_multipole_ij_truncD^k_ij
fm_multipole_ab_truncD^k_ab
matrix_multipoleM^k_µν, one entry per component k (x, y, z, then xx, xy, xz, yy, yz, zz)
mosMO sets of the reference, for the AO layout and the occupied count
mo_coeffC_µp of the spin
homo_redoccupied levels in the window
virtual_redvirtual levels in the window
context_BSE...
ispinspin channel whose mo_set supplies homo/nao (default 1); open-shell beta needs 2

Definition at line 1178 of file bse_util.F.

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

◆ trace_exciton_descr()

subroutine, public bse_util::trace_exciton_descr ( type(cp_fm_type), intent(in) fm_a,
type(cp_fm_type), intent(in) fm_b,
type(cp_fm_type), intent(in) fm_c,
real(kind=dp), intent(out) alpha )

Computes trace of form Tr{A^T B C} for exciton descriptors.

Parameters
fm_AFull Matrix, typically X or Y, in format homo x virtual
fm_B...
fm_C...
alpha...

Definition at line 1333 of file bse_util.F.

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

◆ assemble_joint_ov_slab()

subroutine, public bse_util::assemble_joint_ov_slab ( type(cp_fm_type), dimension(:), intent(in) fm_s_ia,
integer, dimension(:), intent(in) offsets,
integer, dimension(:), intent(in) n_ov,
integer, intent(in) dimen_ri,
type(cp_fm_type), intent(inout) fm_s_joint )

Column-concatenate per-spin ia-slabs into the joint dimen_RI x n_ov_joint slab. Sigma-block of spin isp occupies columns offsets(isp)+1 .. offsets(isp)+n_ov(isp). fm_S_joint must be pre-created and zeroed by the caller.

Parameters
fm_S_iaper-spin ia-slabs, shape (dimen_RI, n_ov(isp)) per spin
offsetsper-spin column offsets into fm_S_joint (0-based)
n_ovper-spin OV-pair counts
dimen_RIRI auxiliary basis dimension (row count)
fm_S_jointpre-created output slab (dimen_RI x n_ov_joint)

Definition at line 1377 of file bse_util.F.

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