19 dbcsr_type_no_symmetry
38#include "./base/base_uses.f90"
42 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'gw_ri_rs_chi_sigma_kernels'
55 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: mat_chi_gamma_tau
56 REAL(kind=
dp),
INTENT(IN) :: cutoff
58 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_mat_chi_Gamma_tau'
60 INTEGER :: handle, i_t, ispin, n_panels
61 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: pan_first, pan_last
62 REAL(kind=
dp) :: first_grid_occ, t1, tau
63 TYPE(
dbcsr_type) :: matrix_g_occ_ao(1), matrix_g_vir_ao
65 CALL timeset(routinen, handle)
71 pan_first, pan_last, cutoff)
73 n_panels =
SIZE(pan_first)
74 IF (bs_env%unit_nr > 0)
THEN
75 WRITE (bs_env%unit_nr,
'(T2,A,T74,I9)') &
76 'Number of batches for χ, Σ matrices', n_panels
77 WRITE (bs_env%unit_nr,
'(A)')
' '
86 DO i_t = 1, bs_env%num_time_freq_points
88 tau = bs_env%time_frequency_grid%imaginary_time(i_t)
90 DO ispin = 1, bs_env%n_spin
93 CALL build_g_ao(bs_env, tau, ispin, .true., .false., &
94 bs_env%ri_rs%mat_phi_mu_l, matrix_g_occ_ao(1))
95 CALL build_g_ao(bs_env, tau, ispin, .false., .true., &
96 bs_env%ri_rs%mat_phi_mu_l, matrix_g_vir_ao)
101 l_b=bs_env%ri_rs%mat_phi_mu_l, m_b=matrix_g_vir_ao, &
102 l_out=bs_env%ri_rs%mat_Z_lP, mat_out=mat_chi_gamma_tau(i_t:i_t), &
103 scale=bs_env%spin_degeneracy, eps=bs_env%eps_filter, &
104 para_env=bs_env%para_env, &
105 pan_first=pan_first, pan_last=pan_last, &
106 lb_eq_la=.true., lout_eq_la=.false., &
107 zero_out=(ispin == 1), &
108 centroids=bs_env%ri_rs%chunk_centroids, &
109 cutoff=cutoff, grid_occupation=first_grid_occ)
112 l_b=bs_env%ri_rs%mat_phi_mu_l, m_b=matrix_g_vir_ao, &
113 l_out=bs_env%ri_rs%mat_Z_lP, mat_out=mat_chi_gamma_tau(i_t:i_t), &
114 scale=bs_env%spin_degeneracy, eps=bs_env%eps_filter, &
115 para_env=bs_env%para_env, &
116 pan_first=pan_first, pan_last=pan_last, &
117 lb_eq_la=.true., lout_eq_la=.false., &
118 zero_out=(ispin == 1), &
119 centroids=bs_env%ri_rs%chunk_centroids, &
131 bs_env%dbcsr_msg_elem_limit)
132 IF (bs_env%unit_nr > 0)
THEN
133 WRITE (bs_env%unit_nr,
'(T2,A,T73,F7.2,A)') &
134 'Percentage of non-zero matrix elements in G_ll'', χ_ll'', W_ll''', &
135 first_grid_occ*100.0_dp,
' %'
139 bs_env%para_env, bs_env%unit_nr, bs_env%dbcsr_msg_elem_limit, &
140 suffix=
' for time point 1')
141 IF (bs_env%unit_nr > 0)
WRITE (bs_env%unit_nr,
'(A)')
' '
144 IF (bs_env%unit_nr > 0)
THEN
145 WRITE (bs_env%unit_nr,
'(T2,A,I13,A,I3,A,F7.1,A)') &
146 'Computed χ(iτ,k=0) for time point', i_t,
' /', bs_env%num_time_freq_points, &
152 IF (bs_env%unit_nr > 0)
WRITE (bs_env%unit_nr,
'(A)')
' '
154 CALL timestop(handle)
172 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: fm_sigma_x_gamma
173 REAL(kind=
dp),
INTENT(IN) :: cutoff
175 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_x'
177 INTEGER :: handle, ispin
178 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: pan_first, pan_last
181 TYPE(
dbcsr_type) :: matrix_d_ao(1), matrix_v_aux
184 CALL timeset(routinen, handle)
188 ALLOCATE (fm_sigma_x_gamma(bs_env%n_spin))
189 DO ispin = 1, bs_env%n_spin
190 CALL cp_fm_create(fm_sigma_x_gamma(ispin), bs_env%fm_s_Gamma%matrix_struct)
193 mat_sigma_x_gamma(1)%matrix => matrix_sigma_x
194 CALL dbcsr_create(matrix_sigma_x, template=bs_env%mat_ao_ao%matrix)
197 pan_first, pan_last, cutoff)
203 bs_env%auto_ri, bs_env%ri_rs%mat_Z_lP, matrix_v_aux)
211 DO ispin = 1, bs_env%n_spin
214 CALL build_g_ao(bs_env, 0.0_dp, ispin, .true., .false., &
215 bs_env%ri_rs%mat_phi_mu_l, matrix_d_ao(1))
218 l_b=bs_env%ri_rs%mat_Z_lP, m_b=matrix_v_aux, &
219 l_out=bs_env%ri_rs%mat_phi_mu_l, mat_out=mat_sigma_x_gamma, &
220 scale=1.0_dp, eps=bs_env%eps_filter, &
221 para_env=bs_env%para_env, &
222 pan_first=pan_first, pan_last=pan_last, &
223 lb_eq_la=.false., lout_eq_la=.true., zero_out=.true., &
224 centroids=bs_env%ri_rs%chunk_centroids, &
235 IF (bs_env%unit_nr > 0)
THEN
236 WRITE (bs_env%unit_nr,
'(T2,A,T58,A,F7.1,A)') &
237 'Computed Σ^x(k=0),',
' Execution time',
m_walltime() - t1,
' s'
238 WRITE (bs_env%unit_nr,
'(A)')
' '
247 CALL timestop(handle)
261 SUBROUTINE compute_sigma_c(bs_env, fm_W_time, fm_Sigma_c_Gamma_time, cutoff, keep_w_and_files)
264 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: fm_w_time
265 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :, :) :: fm_sigma_c_gamma_time
266 REAL(kind=
dp),
INTENT(IN) :: cutoff
267 LOGICAL,
INTENT(IN),
OPTIONAL :: keep_w_and_files
269 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_c'
271 CHARACTER(LEN=32) :: sigma_label
272 INTEGER :: handle, i_sector, i_t, ispin
273 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: pan_first, pan_last
274 INTEGER,
DIMENSION(:),
POINTER :: blk_aux, dist_row_aux
275 LOGICAL :: retain_work
276 REAL(kind=
dp) :: t1, tau
279 TYPE(
dbcsr_type) :: matrix_g_ao(2), matrix_w_aux
280 TYPE(
dbcsr_type),
TARGET :: matrix_sigma_tau(2)
282 CALL timeset(routinen, handle)
284 retain_work = .false.
285 IF (
PRESENT(keep_w_and_files)) retain_work = keep_w_and_files
293 pan_first, pan_last, cutoff)
296 ALLOCATE (fm_sigma_c_gamma_time(bs_env%num_time_freq_points, 2, bs_env%n_spin))
298 mat_sigma_tau(i_sector)%matrix => matrix_sigma_tau(i_sector)
306 DO i_t = 1, bs_env%num_time_freq_points
307 tau = bs_env%time_frequency_grid%imaginary_time(i_t)
309 CALL dbcsr_create(matrix_w_aux,
"W_aux", dist_aux_aux, dbcsr_type_no_symmetry, &
314 DO ispin = 1, bs_env%n_spin
318 CALL build_g_ao(bs_env, tau, ispin, .true., .false., &
319 bs_env%ri_rs%mat_phi_mu_l, matrix_g_ao(1))
320 CALL build_g_ao(bs_env, tau, ispin, .false., .true., &
321 bs_env%ri_rs%mat_phi_mu_l, matrix_g_ao(2))
324 CALL dbcsr_create(matrix_sigma_tau(i_sector), template=bs_env%mat_ao_ao%matrix)
329 l_b=bs_env%ri_rs%mat_Z_lP, m_b=matrix_w_aux, &
330 l_out=bs_env%ri_rs%mat_phi_mu_l, &
331 mat_out=mat_sigma_tau, &
332 scale=1.0_dp, eps=bs_env%eps_filter, para_env=bs_env%para_env, &
333 pan_first=pan_first, pan_last=pan_last, &
334 lb_eq_la=.false., lout_eq_la=.true., zero_out=.true., &
335 centroids=bs_env%ri_rs%chunk_centroids, cutoff=cutoff)
341 CALL cp_fm_create(fm_sigma_c_gamma_time(i_t, 3 - i_sector, ispin), &
342 bs_env%fm_s_Gamma%matrix_struct)
344 fm_sigma_c_gamma_time(i_t, 3 - i_sector, ispin))
350 IF (bs_env%n_spin == 2 .AND. ispin == 1) sigma_label =
'Σ^c_α'
351 IF (bs_env%n_spin == 2 .AND. ispin == 2) sigma_label =
'Σ^c_β'
353 trim(sigma_label)//
'(iτ)', bs_env%para_env, bs_env%unit_nr, &
354 bs_env%dbcsr_msg_elem_limit, suffix=
' for time point 1')
356 trim(sigma_label)//
'(-iτ)', bs_env%para_env, bs_env%unit_nr, &
357 bs_env%dbcsr_msg_elem_limit, suffix=
' for time point 1')
363 IF (bs_env%unit_nr > 0)
THEN
364 WRITE (bs_env%unit_nr,
'(T2,A,I15,A,I3,A,F7.1,A)') &
365 'Computed Σ^c(iτ) for time point', i_t,
' /', bs_env%num_time_freq_points, &
379 IF (.NOT. retain_work)
THEN
384 CALL timestop(handle)
398 SUBROUTINE build_g_ao(bs_env, tau, ispin, occ, vir, template, matrix_G_ao)
401 REAL(kind=
dp),
INTENT(IN) :: tau
402 INTEGER,
INTENT(IN) :: ispin
403 LOGICAL,
INTENT(IN) :: occ, vir
407 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_G_ao'
410 INTEGER,
DIMENSION(:),
POINTER :: blk_ao, dist_row_ao
414 CALL timeset(routinen, handle)
417 fm_g => bs_env%fm_Gocc
419 fm_g => bs_env%fm_Gvir
422 CALL g_occ_vir(bs_env, tau, fm_g, ispin, occ=occ, vir=vir)
425 CALL dbcsr_create(matrix_g_ao, name=
"G_ao", dist=dist_ao_ao, &
426 matrix_type=dbcsr_type_no_symmetry, &
427 row_blk_size=blk_ao, col_blk_size=blk_ao)
435 CALL timestop(handle)
437 END SUBROUTINE build_g_ao
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_filter(matrix, eps)
...
subroutine, public dbcsr_release(matrix)
...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm, plan, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
represent a full matrix distributed on many processors
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
Shared RI-RS polarizability and self-energy assembly.
subroutine, public compute_sigma_c(bs_env, fm_w_time, fm_sigma_c_gamma_time, cutoff, keep_w_and_files)
Computes the correlation part of the GW self-energy on the imaginary-time grid: Σ^c_λσ(iτ<0) = -Σ_ll'...
subroutine, public get_mat_chi_gamma_tau(bs_env, mat_chi_gamma_tau, cutoff)
Computes χ_PQ(iτ) from the occupied and virtual Green's functions.
subroutine, public compute_sigma_x(bs_env, qs_env, fm_sigma_x_gamma, cutoff)
Computes the exact-exchange part of the GW self-energy: D_μν = Σ_n^occ C_μn C_νn (density matrix = G^...
Routines from paper [Graml2024].
subroutine, public delete_unnecessary_files(bs_env)
...
subroutine, public g_occ_vir(bs_env, tau, fm_g_gamma, ispin, occ, vir)
Build the real Gamma occupied or virtual one-particle propagator.
Defines the basic variable types.
integer, parameter, public dp
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
DBCSR collocation, layouts and panel contractions for real-space resolution of the identity.
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 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.
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 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 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 al...
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 += s...