37 USE dbcsr_api,
ONLY: &
38 dbcsr_create, dbcsr_deallocate_matrix, dbcsr_filter, dbcsr_get_info, dbcsr_multiply, &
39 dbcsr_p_type, dbcsr_release, dbcsr_set, dbcsr_type
40 USE dbt_api,
ONLY: dbt_destroy,&
62 #include "./base/base_uses.f90"
68 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rpa_util'
130 SUBROUTINE alloc_im_time(qs_env, para_env, dimen_RI, dimen_RI_red, num_integ_points, nspins, &
131 fm_mat_Q, fm_mo_coeff_occ, fm_mo_coeff_virt, &
132 fm_matrix_Minv_L_kpoints, fm_matrix_L_kpoints, mat_P_global, &
133 t_3c_O, matrix_s, kpoints, eps_filter_im_time, &
134 cut_memory, nkp, num_cells_dm, num_3c_repl, &
139 do_ic_model, do_kpoints_cubic_RPA, &
140 do_kpoints_from_Gamma, do_ri_Sigma_x, my_open_shell, &
141 has_mat_P_blocks, wkp_W, &
142 cfm_mat_Q, fm_mat_Minv_L_kpoints, fm_mat_L_kpoints, &
143 fm_mat_RI_global_work, fm_mat_work, fm_mo_coeff_occ_scaled, &
144 fm_mo_coeff_virt_scaled, mat_dm, mat_L, mat_M_P_munu_occ, mat_M_P_munu_virt, &
145 mat_MinvVMinv, mat_P_omega, mat_P_omega_kp, &
146 mat_work, mo_coeff, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, homo, nmo)
148 TYPE(qs_environment_type),
POINTER :: qs_env
149 TYPE(mp_para_env_type),
POINTER :: para_env
150 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red, &
151 num_integ_points, nspins
152 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_q
153 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: fm_mo_coeff_occ, fm_mo_coeff_virt
154 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_minv_l_kpoints, &
156 TYPE(dbcsr_p_type),
INTENT(IN) :: mat_p_global
157 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :), &
158 INTENT(INOUT) :: t_3c_o
159 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
160 TYPE(kpoint_type),
POINTER :: kpoints
161 REAL(kind=
dp),
INTENT(IN) :: eps_filter_im_time
162 INTEGER,
INTENT(IN) :: cut_memory
163 INTEGER,
INTENT(OUT) :: nkp, num_cells_dm, num_3c_repl, size_p, &
165 INTEGER,
ALLOCATABLE,
DIMENSION(:, :),
INTENT(OUT) :: index_to_cell_3c
166 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :), &
167 INTENT(OUT) :: cell_to_index_3c
168 INTEGER,
DIMENSION(:),
POINTER :: col_blk_size
169 LOGICAL,
INTENT(IN) :: do_ic_model, do_kpoints_cubic_rpa, &
170 do_kpoints_from_gamma, do_ri_sigma_x, &
172 LOGICAL,
ALLOCATABLE,
DIMENSION(:, :, :, :, :), &
173 INTENT(OUT) :: has_mat_p_blocks
174 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
176 TYPE(cp_cfm_type),
INTENT(OUT) :: cfm_mat_q
177 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_mat_minv_l_kpoints, fm_mat_l_kpoints
178 TYPE(cp_fm_type),
INTENT(OUT) :: fm_mat_ri_global_work, fm_mat_work, &
179 fm_mo_coeff_occ_scaled, &
180 fm_mo_coeff_virt_scaled
181 TYPE(dbcsr_p_type),
INTENT(OUT) :: mat_dm, mat_l, mat_m_p_munu_occ, &
182 mat_m_p_munu_virt, mat_minvvminv
183 TYPE(dbcsr_p_type),
ALLOCATABLE, &
184 DIMENSION(:, :, :) :: mat_p_omega
185 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_p_omega_kp
186 TYPE(dbcsr_type),
POINTER :: mat_work
187 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
188 TYPE(cp_fm_type),
INTENT(OUT) :: fm_scaled_dm_occ_tau, &
189 fm_scaled_dm_virt_tau
190 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
191 INTEGER,
INTENT(IN) :: nmo
193 CHARACTER(LEN=*),
PARAMETER :: routinen =
'alloc_im_time'
195 INTEGER :: cell_grid_dm(3), first_ikp_local, &
196 handle, i_dim, i_kp, ispin, jquad, &
197 nspins_p_omega, periodic(3)
198 INTEGER,
DIMENSION(:),
POINTER :: row_blk_size
199 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: wkp_v
200 TYPE(cell_type),
POINTER :: cell
201 TYPE(cp_fm_struct_type),
POINTER :: fm_struct, fm_struct_sub_kp
203 CALL timeset(routinen, handle)
205 ALLOCATE (fm_mo_coeff_occ(nspins), fm_mo_coeff_virt(nspins))
207 CALL cp_fm_create(fm_scaled_dm_occ_tau, mo_coeff(1)%matrix_struct)
210 CALL cp_fm_create(fm_scaled_dm_virt_tau, mo_coeff(1)%matrix_struct)
213 DO ispin = 1,
SIZE(mo_coeff)
214 CALL create_occ_virt_mo_coeffs(fm_mo_coeff_occ(ispin), fm_mo_coeff_virt(ispin), mo_coeff(ispin), &
218 num_3c_repl =
SIZE(t_3c_o, 2)
220 IF (do_kpoints_cubic_rpa)
THEN
224 cell_grid_dm(i_dim) = (kpoints%nkp_grid(i_dim)/2)*2 - 1
226 num_cells_dm = cell_grid_dm(1)*cell_grid_dm(2)*cell_grid_dm(3)
227 ALLOCATE (index_to_cell_3c(3,
SIZE(kpoints%index_to_cell, 2)))
228 cpassert(
SIZE(kpoints%index_to_cell, 1) == 3)
229 index_to_cell_3c(:, :) = kpoints%index_to_cell(:, :)
230 ALLOCATE (cell_to_index_3c(lbound(kpoints%cell_to_index, 1):ubound(kpoints%cell_to_index, 1), &
231 lbound(kpoints%cell_to_index, 2):ubound(kpoints%cell_to_index, 2), &
232 lbound(kpoints%cell_to_index, 3):ubound(kpoints%cell_to_index, 3)))
233 cell_to_index_3c(:, :, :) = kpoints%cell_to_index(:, :, :)
236 ALLOCATE (index_to_cell_3c(3, 1))
237 index_to_cell_3c(:, 1) = 0
238 ALLOCATE (cell_to_index_3c(0:0, 0:0, 0:0))
239 cell_to_index_3c(0, 0, 0) = 1
243 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
245 CALL get_sub_para_kp(fm_struct_sub_kp, para_env, dimen_ri, ikp_local, first_ikp_local)
255 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
259 CALL get_cell(cell=cell, periodic=periodic)
264 CALL compute_wkp_w(qs_env, wkp_w, wkp_v, kpoints, cell%h_inv, periodic)
271 IF (do_kpoints_cubic_rpa)
THEN
272 size_p = max(num_cells_dm/2 + 1, nkp)
273 ELSE IF (do_kpoints_from_gamma)
THEN
274 size_p = max(3**(periodic(1) + periodic(2) + periodic(3)), nkp)
280 IF (my_open_shell) nspins_p_omega = 2
282 ALLOCATE (mat_p_omega(num_integ_points, size_p, nspins_p_omega))
283 DO ispin = 1, nspins_p_omega
285 DO jquad = 1, num_integ_points
286 NULLIFY (mat_p_omega(jquad, i_kp, ispin)%matrix)
287 ALLOCATE (mat_p_omega(jquad, i_kp, ispin)%matrix)
288 CALL dbcsr_create(matrix=mat_p_omega(jquad, i_kp, ispin)%matrix, &
289 template=mat_p_global%matrix)
290 CALL dbcsr_set(mat_p_omega(jquad, i_kp, ispin)%matrix, 0.0_dp)
295 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
296 CALL alloc_mat_p_omega(mat_p_omega_kp, 2, size_p, mat_p_global%matrix)
299 CALL cp_fm_create(fm_mo_coeff_occ_scaled, fm_mo_coeff_occ(1)%matrix_struct)
300 CALL cp_fm_to_fm(fm_mo_coeff_occ(1), fm_mo_coeff_occ_scaled)
301 CALL cp_fm_set_all(matrix=fm_mo_coeff_occ_scaled, alpha=0.0_dp)
303 CALL cp_fm_create(fm_mo_coeff_virt_scaled, fm_mo_coeff_virt(1)%matrix_struct)
304 CALL cp_fm_to_fm(fm_mo_coeff_virt(1), fm_mo_coeff_virt_scaled)
305 CALL cp_fm_set_all(matrix=fm_mo_coeff_virt_scaled, alpha=0.0_dp)
307 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
308 CALL cp_fm_create(fm_mat_ri_global_work, fm_matrix_minv_l_kpoints(1, 1)%matrix_struct)
309 CALL cp_fm_to_fm(fm_matrix_minv_l_kpoints(1, 1), fm_mat_ri_global_work)
313 ALLOCATE (has_mat_p_blocks(num_cells_dm/2 + 1, cut_memory, cut_memory, num_3c_repl, num_3c_repl))
314 has_mat_p_blocks = .true.
316 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
317 CALL reorder_mat_l(fm_mat_minv_l_kpoints, fm_matrix_minv_l_kpoints, fm_mat_q%matrix_struct, para_env, mat_l, &
318 mat_p_global%matrix, dimen_ri, dimen_ri_red, first_ikp_local, ikp_local, fm_struct_sub_kp, &
319 allocate_mat_l=.false.)
321 CALL reorder_mat_l(fm_mat_l_kpoints, fm_matrix_l_kpoints, fm_mat_q%matrix_struct, para_env, mat_l, &
322 mat_p_global%matrix, dimen_ri, dimen_ri_red, first_ikp_local, ikp_local, fm_struct_sub_kp)
327 CALL reorder_mat_l(fm_mat_minv_l_kpoints, fm_matrix_minv_l_kpoints, fm_mat_q%matrix_struct, para_env, mat_l, &
328 mat_p_global%matrix, dimen_ri, dimen_ri_red, first_ikp_local)
332 IF (dimen_ri == dimen_ri_red)
THEN
334 CALL cp_fm_to_fm(fm_mat_q, fm_mat_work)
340 ncol_global=dimen_ri_red, nrow_global=dimen_ri)
350 IF (.NOT. (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma))
THEN
351 CALL dbcsr_get_info(mat_l%matrix, col_blk_size=col_blk_size, row_blk_size=row_blk_size)
356 CALL dbcsr_create(mat_work, template=mat_l%matrix, row_blk_size=col_blk_size, col_blk_size=row_blk_size)
359 IF (do_ri_sigma_x .OR. do_ic_model)
THEN
361 NULLIFY (mat_minvvminv%matrix)
362 ALLOCATE (mat_minvvminv%matrix)
363 CALL dbcsr_create(mat_minvvminv%matrix, template=mat_p_global%matrix)
364 CALL dbcsr_set(mat_minvvminv%matrix, 0.0_dp)
367 IF (.NOT. do_kpoints_from_gamma)
THEN
370 CALL dbcsr_multiply(
"T",
"N", 1.0_dp, mat_l%matrix, mat_l%matrix, &
371 0.0_dp, mat_minvvminv%matrix, filter_eps=eps_filter_im_time)
377 IF (do_ri_sigma_x)
THEN
379 NULLIFY (mat_dm%matrix)
380 ALLOCATE (mat_dm%matrix)
381 CALL dbcsr_create(mat_dm%matrix, template=matrix_s(1)%matrix)
385 CALL timestop(handle)
397 SUBROUTINE create_occ_virt_mo_coeffs(fm_mo_coeff_occ, fm_mo_coeff_virt, mo_coeff, &
400 TYPE(cp_fm_type),
INTENT(OUT) :: fm_mo_coeff_occ, fm_mo_coeff_virt
401 TYPE(cp_fm_type),
INTENT(IN) :: mo_coeff
402 INTEGER,
INTENT(IN) :: nmo, homo
404 CHARACTER(LEN=*),
PARAMETER :: routinen =
'create_occ_virt_mo_coeffs'
406 INTEGER :: handle, icol_global, irow_global
408 CALL timeset(routinen, handle)
410 CALL cp_fm_create(fm_mo_coeff_occ, mo_coeff%matrix_struct)
412 CALL cp_fm_to_fm(mo_coeff, fm_mo_coeff_occ)
415 DO irow_global = 1, nmo
416 DO icol_global = homo + 1, nmo
421 CALL cp_fm_create(fm_mo_coeff_virt, mo_coeff%matrix_struct)
423 CALL cp_fm_to_fm(mo_coeff, fm_mo_coeff_virt)
426 DO irow_global = 1, nmo
427 DO icol_global = 1, homo
432 CALL timestop(handle)
434 END SUBROUTINE create_occ_virt_mo_coeffs
443 SUBROUTINE alloc_mat_p_omega(mat_P_omega, num_integ_points, size_P, template)
444 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_p_omega
445 INTEGER,
INTENT(IN) :: num_integ_points, size_p
446 TYPE(dbcsr_type),
POINTER :: template
448 CHARACTER(LEN=*),
PARAMETER :: routinen =
'alloc_mat_P_omega'
450 INTEGER :: handle, i_kp, jquad
452 CALL timeset(routinen, handle)
454 NULLIFY (mat_p_omega)
457 DO jquad = 1, num_integ_points
458 ALLOCATE (mat_p_omega(jquad, i_kp)%matrix)
459 CALL dbcsr_create(matrix=mat_p_omega(jquad, i_kp)%matrix, &
461 CALL dbcsr_set(mat_p_omega(jquad, i_kp)%matrix, 0.0_dp)
465 CALL timestop(handle)
467 END SUBROUTINE alloc_mat_p_omega
484 SUBROUTINE reorder_mat_l(fm_mat_L, fm_matrix_Minv_L_kpoints, fm_struct_template, para_env, mat_L, mat_template, &
485 dimen_RI, dimen_RI_red, first_ikp_local, ikp_local, fm_struct_sub_kp, allocate_mat_L)
486 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_mat_l, fm_matrix_minv_l_kpoints
487 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_template
488 TYPE(mp_para_env_type),
POINTER :: para_env
489 TYPE(dbcsr_p_type),
INTENT(OUT) :: mat_l
490 TYPE(dbcsr_type),
INTENT(IN) :: mat_template
491 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red, first_ikp_local
492 INTEGER,
OPTIONAL :: ikp_local
493 TYPE(cp_fm_struct_type),
OPTIONAL,
POINTER :: fm_struct_sub_kp
494 LOGICAL,
INTENT(IN),
OPTIONAL :: allocate_mat_l
496 CHARACTER(LEN=*),
PARAMETER :: routinen =
'reorder_mat_L'
498 INTEGER :: handle, ikp, j_size, nblk
499 INTEGER,
DIMENSION(:),
POINTER :: col_blk_size, row_blk_size
500 LOGICAL :: do_kpoints, my_allocate_mat_l
501 TYPE(cp_blacs_env_type),
POINTER :: blacs_env
502 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
503 TYPE(cp_fm_type) :: fm_mat_l_transposed, fmdummy
505 CALL timeset(routinen, handle)
508 IF (
PRESENT(ikp_local) .AND.
PRESENT(fm_struct_sub_kp))
THEN
514 IF (dimen_ri == dimen_ri_red)
THEN
515 fm_struct => fm_struct_template
518 CALL cp_fm_struct_create(fm_struct, nrow_global=dimen_ri_red, ncol_global=dimen_ri, template_fmstruct=fm_struct_template)
522 ALLOCATE (fm_mat_l(
SIZE(fm_matrix_minv_l_kpoints, 1),
SIZE(fm_matrix_minv_l_kpoints, 2)))
523 DO ikp = 1,
SIZE(fm_matrix_minv_l_kpoints, 1)
524 DO j_size = 1,
SIZE(fm_matrix_minv_l_kpoints, 2)
526 IF (ikp == first_ikp_local .OR. ikp_local == -1)
THEN
527 CALL cp_fm_create(fm_mat_l(ikp, j_size), fm_struct_sub_kp)
538 IF (dimen_ri == dimen_ri_red)
THEN
539 fm_struct => fm_mat_l(first_ikp_local, 1)%matrix_struct
546 template_fmstruct=fm_mat_l(first_ikp_local, 1)%matrix_struct)
560 DO ikp = 1,
SIZE(fm_matrix_minv_l_kpoints, 1)
561 DO j_size = 1,
SIZE(fm_matrix_minv_l_kpoints, 2)
563 IF (ikp_local == ikp .OR. ikp_local == -1)
THEN
564 CALL cp_fm_copy_general(fm_matrix_minv_l_kpoints(ikp, j_size), fm_mat_l_transposed, para_env)
565 CALL cp_fm_to_fm(fm_mat_l_transposed, fm_mat_l(ikp, j_size))
570 CALL cp_fm_copy_general(fm_matrix_minv_l_kpoints(ikp, j_size), fm_mat_l_transposed, blacs_env%para_env)
577 CALL cp_fm_release(fm_matrix_minv_l_kpoints)
579 CALL cp_fm_release(fm_mat_l_transposed)
581 my_allocate_mat_l = .true.
582 IF (
PRESENT(allocate_mat_l)) my_allocate_mat_l = allocate_mat_l
584 IF (my_allocate_mat_l)
THEN
586 NULLIFY (mat_l%matrix)
587 ALLOCATE (mat_l%matrix)
588 IF (dimen_ri == dimen_ri_red)
THEN
589 CALL dbcsr_create(mat_l%matrix, template=mat_template)
591 CALL dbcsr_get_info(mat_template, nblkrows_total=nblk, col_blk_size=col_blk_size)
593 CALL calculate_equal_blk_size(row_blk_size, dimen_ri_red, nblk)
595 CALL dbcsr_create(mat_l%matrix, template=mat_template, row_blk_size=row_blk_size, col_blk_size=col_blk_size)
597 DEALLOCATE (row_blk_size)
600 IF (.NOT. (do_kpoints))
THEN
606 CALL timestop(handle)
608 END SUBROUTINE reorder_mat_l
616 SUBROUTINE calculate_equal_blk_size(blk_size_new, dimen_RI_red, nblk)
617 INTEGER,
DIMENSION(:),
POINTER :: blk_size_new
618 INTEGER,
INTENT(IN) :: dimen_ri_red, nblk
620 INTEGER :: col_per_blk, remainder
622 NULLIFY (blk_size_new)
623 ALLOCATE (blk_size_new(nblk))
625 remainder = mod(dimen_ri_red, nblk)
626 col_per_blk = dimen_ri_red/nblk
629 IF (remainder > 0) blk_size_new(1:remainder) = col_per_blk + 1
630 blk_size_new(remainder + 1:nblk) = col_per_blk
632 END SUBROUTINE calculate_equal_blk_size
658 SUBROUTINE calc_mat_q(fm_mat_S, do_ri_sos_laplace_mp2, first_cycle, iter_sc_GW0, virtual, &
659 Eigenval, Eigenval_scf, &
660 homo, omega, omega_old, jquad, mm_style, dimen_RI, dimen_ia, alpha, fm_mat_Q, fm_mat_Q_gemm, &
661 do_bse, fm_mat_Q_static_bse_gemm, dgemm_counter, num_integ_points)
662 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_s
663 LOGICAL,
INTENT(IN) :: do_ri_sos_laplace_mp2, first_cycle
664 INTEGER,
INTENT(IN) :: iter_sc_gw0, virtual
665 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval, eigenval_scf
666 INTEGER,
INTENT(IN) :: homo
667 REAL(kind=
dp),
INTENT(IN) :: omega, omega_old
668 INTEGER,
INTENT(IN) :: jquad, mm_style, dimen_ri, dimen_ia
669 REAL(kind=
dp),
INTENT(IN) :: alpha
670 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_q, fm_mat_q_gemm
671 LOGICAL,
INTENT(IN) :: do_bse
672 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_q_static_bse_gemm
673 TYPE(dgemm_counter_type),
INTENT(INOUT) :: dgemm_counter
674 INTEGER,
INTENT(IN) :: num_integ_points
676 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_mat_Q'
680 CALL timeset(routinen, handle)
682 IF (do_ri_sos_laplace_mp2)
THEN
686 IF (iter_sc_gw0 == 1)
THEN
688 homo, omega, omega_old)
691 homo, omega, omega_old)
695 CALL contract_s_to_q(mm_style, dimen_ri, dimen_ia, alpha, fm_mat_s, fm_mat_q_gemm, &
696 fm_mat_q, dgemm_counter)
700 IF (do_bse .AND. jquad == num_integ_points)
THEN
701 CALL cp_fm_to_fm(fm_mat_q_gemm, fm_mat_q_static_bse_gemm)
703 CALL timestop(handle)
716 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_s
717 INTEGER,
INTENT(IN) :: virtual
718 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval_last
719 INTEGER,
INTENT(IN) :: homo
720 REAL(kind=
dp),
INTENT(IN) :: omega_old
722 CHARACTER(LEN=*),
PARAMETER :: routinen =
'remove_scaling_factor_rpa'
724 INTEGER :: avirt, handle, i_global, iib, iocc, &
726 INTEGER,
DIMENSION(:),
POINTER :: col_indices
727 REAL(kind=
dp) :: eigen_diff
729 CALL timeset(routinen, handle)
733 ncol_local=ncol_local, &
734 col_indices=col_indices)
738 DO iib = 1, ncol_local
739 i_global = col_indices(iib)
741 iocc = max(1, i_global - 1)/virtual + 1
742 avirt = i_global - (iocc - 1)*virtual
743 eigen_diff = eigenval_last(avirt + homo) - eigenval_last(iocc)
745 fm_mat_s%local_data(:, iib) = fm_mat_s%local_data(:, iib)/ &
746 sqrt(eigen_diff/(eigen_diff**2 + omega_old**2))
750 CALL timestop(handle)
766 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_s
767 LOGICAL,
INTENT(IN) :: first_cycle
768 INTEGER,
INTENT(IN) :: virtual
769 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval
770 INTEGER,
INTENT(IN) :: homo
771 REAL(kind=
dp),
INTENT(IN) :: omega, omega_old
773 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_fm_mat_S_rpa'
775 INTEGER :: avirt, handle, i_global, iib, iocc, &
777 INTEGER,
DIMENSION(:),
POINTER :: col_indices
778 REAL(kind=
dp) :: eigen_diff
780 CALL timeset(routinen, handle)
784 ncol_local=ncol_local, &
785 col_indices=col_indices)
788 IF (first_cycle)
THEN
793 DO iib = 1, ncol_local
794 i_global = col_indices(iib)
796 iocc = max(1, i_global - 1)/virtual + 1
797 avirt = i_global - (iocc - 1)*virtual
798 eigen_diff = eigenval(avirt + homo) - eigenval(iocc)
800 fm_mat_s%local_data(:, iib) = fm_mat_s%local_data(:, iib)* &
801 sqrt(eigen_diff/(eigen_diff**2 + omega**2))
809 DO iib = 1, ncol_local
810 i_global = col_indices(iib)
812 iocc = max(1, i_global - 1)/virtual + 1
813 avirt = i_global - (iocc - 1)*virtual
814 eigen_diff = eigenval(avirt + homo) - eigenval(iocc)
816 fm_mat_s%local_data(:, iib) = fm_mat_s%local_data(:, iib)* &
817 sqrt((eigen_diff**2 + omega_old**2)/(eigen_diff**2 + omega**2))
822 CALL timestop(handle)
837 SUBROUTINE contract_s_to_q(mm_style, dimen_RI, dimen_ia, alpha, fm_mat_S, fm_mat_Q_gemm, &
838 fm_mat_Q, dgemm_counter)
840 INTEGER,
INTENT(IN) :: mm_style, dimen_ri, dimen_ia
841 REAL(kind=
dp),
INTENT(IN) :: alpha
842 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_s, fm_mat_q_gemm, fm_mat_q
843 TYPE(dgemm_counter_type),
INTENT(INOUT) :: dgemm_counter
845 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_S_to_Q'
849 CALL timeset(routinen, handle)
852 SELECT CASE (mm_style)
855 CALL parallel_gemm(transa=
"N", transb=
"T", m=dimen_ri, n=dimen_ri, k=dimen_ia, alpha=alpha, &
856 matrix_a=fm_mat_s, matrix_b=fm_mat_s, beta=0.0_dp, &
857 matrix_c=fm_mat_q_gemm)
860 CALL cp_fm_syrk(uplo=
'U', trans=
'N', k=dimen_ia, alpha=alpha, matrix_a=fm_mat_s, &
861 ia=1, ja=1, beta=0.0_dp, matrix_c=fm_mat_q_gemm)
870 fm_mat_q_gemm%matrix_struct%context)
872 CALL timestop(handle)
874 END SUBROUTINE contract_s_to_q
885 INTEGER,
INTENT(IN) :: dimen_ri
886 REAL(kind=
dp),
DIMENSION(dimen_RI),
INTENT(OUT) :: trace_qomega
887 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_q
888 TYPE(mp_para_env_type),
INTENT(IN) :: para_env_rpa
890 CHARACTER(LEN=*),
PARAMETER :: routinen =
'Q_trace_and_add_unit_matrix'
892 INTEGER :: handle, i_global, iib, j_global, jjb, &
893 ncol_local, nrow_local
894 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
896 CALL timeset(routinen, handle)
899 nrow_local=nrow_local, &
900 ncol_local=ncol_local, &
901 row_indices=row_indices, &
902 col_indices=col_indices)
905 trace_qomega = 0.0_dp
908 DO jjb = 1, ncol_local
909 j_global = col_indices(jjb)
910 DO iib = 1, nrow_local
911 i_global = row_indices(iib)
912 IF (j_global == i_global .AND. i_global <= dimen_ri)
THEN
913 trace_qomega(i_global) = fm_mat_q%local_data(iib, jjb)
914 fm_mat_q%local_data(iib, jjb) = fm_mat_q%local_data(iib, jjb) + 1.0_dp
918 CALL para_env_rpa%sum(trace_qomega)
920 CALL timestop(handle)
935 INTEGER,
INTENT(IN) :: dimen_ri
936 REAL(kind=
dp),
DIMENSION(dimen_RI),
INTENT(IN) :: trace_qomega
937 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_q
938 TYPE(mp_para_env_type),
INTENT(IN) :: para_env_rpa
939 REAL(kind=
dp),
INTENT(INOUT) :: erpa
940 REAL(kind=
dp),
INTENT(IN) :: wjquad
942 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Erpa_by_freq_int'
944 INTEGER :: handle, i_global, iib, info_chol, &
945 j_global, jjb, ncol_local, nrow_local
946 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
947 REAL(kind=
dp) :: fcomega
948 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: q_log
950 CALL timeset(routinen, handle)
953 nrow_local=nrow_local, &
954 ncol_local=ncol_local, &
955 row_indices=row_indices, &
956 col_indices=col_indices)
960 IF (info_chol .NE. 0)
THEN
961 CALL cp_warn(__location__, &
962 "The Cholesky decomposition before inverting the RPA matrix / dielectric "// &
963 "function failed. "// &
964 "In case of low-scaling RPA/GW, decreasing EPS_FILTER in the &LOW_SCALING "// &
966 "increase the overall accuracy making the matrix positive definite. "// &
970 cpassert(info_chol == 0)
972 ALLOCATE (q_log(dimen_ri))
976 DO jjb = 1, ncol_local
977 j_global = col_indices(jjb)
978 DO iib = 1, nrow_local
979 i_global = row_indices(iib)
980 IF (j_global == i_global .AND. i_global <= dimen_ri)
THEN
981 q_log(i_global) = 2.0_dp*log(fm_mat_q%local_data(iib, jjb))
985 CALL para_env_rpa%sum(q_log)
991 IF (
modulo(iib, para_env_rpa%num_pe) /= para_env_rpa%mepos) cycle
992 fcomega = fcomega + (q_log(iib) - trace_qomega(iib))/2.0_dp
994 erpa = erpa + fcomega*wjquad
998 CALL timestop(handle)
1010 SUBROUTINE get_sub_para_kp(fm_struct_sub_kp, para_env, dimen_RI, &
1011 ikp_local, first_ikp_local)
1012 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_sub_kp
1013 TYPE(mp_para_env_type),
POINTER :: para_env
1014 INTEGER,
INTENT(IN) :: dimen_ri
1015 INTEGER,
INTENT(OUT) :: ikp_local, first_ikp_local
1017 CHARACTER(len=*),
PARAMETER :: routinen =
'get_sub_para_kp'
1019 INTEGER :: color_sub_kp, handle, num_proc_per_kp
1020 TYPE(cp_blacs_env_type),
POINTER :: blacs_env_sub_kp
1021 TYPE(mp_para_env_type),
POINTER :: para_env_sub_kp
1023 CALL timeset(routinen, handle)
1028 num_proc_per_kp = para_env%num_pe
1036 color_sub_kp = para_env%mepos/num_proc_per_kp
1037 ALLOCATE (para_env_sub_kp)
1038 CALL para_env_sub_kp%from_split(para_env, color_sub_kp)
1043 NULLIFY (blacs_env_sub_kp)
1047 NULLIFY (fm_struct_sub_kp)
1048 CALL cp_fm_struct_create(fm_struct_sub_kp, context=blacs_env_sub_kp, nrow_global=dimen_ri, &
1049 ncol_global=dimen_ri, para_env=para_env_sub_kp)
1070 CALL timestop(handle)
1072 END SUBROUTINE get_sub_para_kp
1110 fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, index_to_cell_3c, &
1111 cell_to_index_3c, do_ic_model, &
1112 do_kpoints_cubic_RPA, do_kpoints_from_Gamma, do_ri_Sigma_x, &
1114 wkp_W, cfm_mat_Q, fm_mat_Minv_L_kpoints, fm_mat_L_kpoints, &
1115 fm_matrix_Minv, fm_matrix_Minv_Vtrunc_Minv, &
1116 fm_mat_RI_global_work, fm_mat_work, &
1117 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, mat_dm, mat_L, &
1118 mat_MinvVMinv, mat_P_omega, mat_P_omega_kp, &
1119 t_3c_M, t_3c_O, t_3c_O_compressed, t_3c_O_ind, &
1122 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(INOUT) :: fm_mo_coeff_occ, fm_mo_coeff_virt
1123 TYPE(cp_fm_type),
INTENT(INOUT) :: fm_scaled_dm_occ_tau, &
1124 fm_scaled_dm_virt_tau
1125 INTEGER,
ALLOCATABLE,
DIMENSION(:, :), &
1126 INTENT(INOUT) :: index_to_cell_3c
1127 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :), &
1128 INTENT(INOUT) :: cell_to_index_3c
1129 LOGICAL,
INTENT(IN) :: do_ic_model, do_kpoints_cubic_rpa, &
1130 do_kpoints_from_gamma, do_ri_sigma_x
1131 LOGICAL,
ALLOCATABLE,
DIMENSION(:, :, :, :, :), &
1132 INTENT(INOUT) :: has_mat_p_blocks
1133 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1134 INTENT(INOUT) :: wkp_w
1135 TYPE(cp_cfm_type),
INTENT(INOUT) :: cfm_mat_q
1136 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_mat_minv_l_kpoints, fm_mat_l_kpoints, &
1138 fm_matrix_minv_vtrunc_minv
1139 TYPE(cp_fm_type),
INTENT(INOUT) :: fm_mat_ri_global_work, fm_mat_work, &
1140 fm_mo_coeff_occ_scaled, &
1141 fm_mo_coeff_virt_scaled
1142 TYPE(dbcsr_p_type),
INTENT(INOUT) :: mat_dm, mat_l, mat_minvvminv
1143 TYPE(dbcsr_p_type),
ALLOCATABLE, &
1144 DIMENSION(:, :, :),
INTENT(INOUT) :: mat_p_omega
1145 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_p_omega_kp
1146 TYPE(dbt_type) :: t_3c_m
1147 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_3c_o
1148 TYPE(hfx_compression_type),
ALLOCATABLE, &
1149 DIMENSION(:, :, :),
INTENT(INOUT) :: t_3c_o_compressed
1150 TYPE(block_ind_type),
ALLOCATABLE, &
1151 DIMENSION(:, :, :),
INTENT(INOUT) :: t_3c_o_ind
1152 TYPE(dbcsr_type),
POINTER :: mat_work
1153 TYPE(qs_environment_type),
POINTER :: qs_env
1155 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dealloc_im_time'
1157 INTEGER :: cut_memory, handle, i_kp, i_mem, i_size, &
1158 ispin, j_size, jquad, nspins, unused
1159 LOGICAL :: my_open_shell
1161 CALL timeset(routinen, handle)
1163 nspins =
SIZE(fm_mo_coeff_occ)
1164 my_open_shell = (nspins == 2)
1166 CALL cp_fm_release(fm_scaled_dm_occ_tau)
1167 CALL cp_fm_release(fm_scaled_dm_virt_tau)
1168 DO ispin = 1,
SIZE(fm_mo_coeff_occ)
1169 CALL cp_fm_release(fm_mo_coeff_occ(ispin))
1170 CALL cp_fm_release(fm_mo_coeff_virt(ispin))
1172 CALL cp_fm_release(fm_mo_coeff_occ_scaled)
1173 CALL cp_fm_release(fm_mo_coeff_virt_scaled)
1175 CALL cp_fm_release(fm_mat_minv_l_kpoints)
1176 CALL cp_fm_release(fm_mat_l_kpoints)
1178 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
1179 CALL cp_fm_release(fm_matrix_minv_vtrunc_minv)
1180 CALL cp_fm_release(fm_matrix_minv)
1183 CALL cp_fm_release(fm_mat_work)
1185 IF (.NOT. (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma))
THEN
1186 CALL dbcsr_release(mat_work)
1187 DEALLOCATE (mat_work)
1190 CALL dbcsr_release(mat_l%matrix)
1191 DEALLOCATE (mat_l%matrix)
1193 IF (do_ri_sigma_x .OR. do_ic_model)
THEN
1194 CALL dbcsr_release(mat_minvvminv%matrix)
1195 DEALLOCATE (mat_minvvminv%matrix)
1197 IF (do_ri_sigma_x)
THEN
1198 CALL dbcsr_release(mat_dm%matrix)
1199 DEALLOCATE (mat_dm%matrix)
1202 DEALLOCATE (index_to_cell_3c, cell_to_index_3c)
1204 IF (
ALLOCATED(mat_p_omega))
THEN
1205 DO ispin = 1,
SIZE(mat_p_omega, 3)
1206 DO i_kp = 1,
SIZE(mat_p_omega, 2)
1207 DO jquad = 1,
SIZE(mat_p_omega, 1)
1208 CALL dbcsr_deallocate_matrix(mat_p_omega(jquad, i_kp, ispin)%matrix)
1212 DEALLOCATE (mat_p_omega)
1215 DO i_size = 1,
SIZE(t_3c_o, 1)
1216 DO j_size = 1,
SIZE(t_3c_o, 2)
1217 CALL dbt_destroy(t_3c_o(i_size, j_size))
1222 CALL dbt_destroy(t_3c_m)
1224 DEALLOCATE (has_mat_p_blocks)
1226 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
1228 CALL cp_fm_release(fm_mat_ri_global_work)
1233 cut_memory =
SIZE(t_3c_o_compressed, 3)
1235 DEALLOCATE (t_3c_o_ind)
1236 DO i_size = 1,
SIZE(t_3c_o_compressed, 1)
1237 DO j_size = 1,
SIZE(t_3c_o_compressed, 2)
1238 DO i_mem = 1, cut_memory
1243 DEALLOCATE (t_3c_o_compressed)
1245 IF (do_kpoints_from_gamma)
THEN
1247 IF (qs_env%mp2_env%ri_g0w0%do_kpoints_Sigma)
THEN
1249 CALL kpoint_release(qs_env%mp2_env%ri_rpa_im_time%kpoints_Sigma_no_xc)
1253 CALL timestop(handle)
1270 dimen_RI_red, fm_mat_L, fm_mat_Q)
1272 TYPE(dbcsr_type),
POINTER :: mat_p_omega, mat_l, mat_work
1273 REAL(kind=
dp),
INTENT(IN) :: eps_filter_im_time
1274 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_work
1275 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red
1276 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_l, fm_mat_q
1278 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_P_omega_with_mat_L'
1282 CALL timeset(routinen, handle)
1285 CALL dbcsr_multiply(
"N",
"T", 1.0_dp, mat_p_omega, mat_l, &
1286 0.0_dp, mat_work, filter_eps=eps_filter_im_time)
1290 CALL parallel_gemm(
'N',
'N', dimen_ri_red, dimen_ri_red, dimen_ri, 1.0_dp, fm_mat_l, fm_mat_work, &
1294 CALL dbcsr_set(mat_work, 0.0_dp)
1295 CALL dbcsr_filter(mat_work, 1.0_dp)
1297 CALL timestop(handle)
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Handles all functions related to the CELL.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
subroutine, public cp_blacs_env_create(blacs_env, para_env, blacs_grid_layout, blacs_repeatable, row_major, grid_2d)
allocates and initializes a type that represent a blacs context
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_cfm_set_all(matrix, alpha, beta)
Set all elements of the full matrix to alpha. Besides, set all diagonal matrix elements to beta (if g...
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
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.
basic linear algebra operations for full matrices
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
subroutine, public cp_fm_syrk(uplo, trans, k, alpha, matrix_a, ia, ja, beta, matrix_c)
performs a rank-k update of a symmetric matrix_c matrix_c = beta * matrix_c + alpha * matrix_a * tran...
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_decompose(matrix, n, info_out)
used to replace a symmetric positive def. matrix M with its cholesky decomposition U: M = U^T * U,...
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
subroutine, public cp_fm_copy_general(source, destination, para_env)
General copy of a fm matrix to another fm matrix. Uses non-blocking MPI rather than ScaLAPACK.
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_to_fm_submat_general(source, destination, nrows, ncols, s_firstrow, s_firstcol, d_firstrow, d_firstcol, global_context)
General copy of a submatrix of fm matrix to a submatrix of another fm matrix. The two matrices can ha...
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_set_element(matrix, irow_global, icol_global, alpha)
sets an element of a matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
This is the start of a dbt_api, all publically needed functions are exported here....
Counters to determine the performance of parallel DGEMMs.
subroutine, public dgemm_counter_start(dgemm_counter)
start timer of the counter
subroutine, public dgemm_counter_stop(dgemm_counter, size1, size2, size3)
stop timer of the counter and provide matrix sizes
Types and set/get functions for HFX.
subroutine, public dealloc_containers(DATA, memory_usage)
...
Defines the basic variable types.
integer, parameter, public dp
Types and basic routines needed for a kpoint calculation.
subroutine, public kpoint_release(kpoint)
Release a kpoint environment, deallocate all data.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym)
Retrieve information from a kpoint environment.
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_zero
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
Routines to calculate MP2 energy with laplace approach.
subroutine, public calc_fm_mat_s_laplace(fm_mat_S, homo, virtual, Eigenval, dajquad)
...
basic linear algebra operations for full matrixes
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
Routines treating GW and RPA calculations with kpoints.
subroutine, public compute_wkp_w(qs_env, wkp_W, wkp_V, kpoints, h_inv, periodic)
...
Utility functions for RPA calculations.
subroutine, public calc_fm_mat_s_rpa(fm_mat_S, first_cycle, virtual, Eigenval, homo, omega, omega_old)
...
subroutine, public compute_erpa_by_freq_int(dimen_RI, trace_Qomega, fm_mat_Q, para_env_RPA, Erpa, wjquad)
...
subroutine, public contract_p_omega_with_mat_l(mat_P_omega, mat_L, mat_work, eps_filter_im_time, fm_mat_work, dimen_RI, dimen_RI_red, fm_mat_L, fm_mat_Q)
...
subroutine, public calc_mat_q(fm_mat_S, do_ri_sos_laplace_mp2, first_cycle, iter_sc_GW0, virtual, Eigenval, Eigenval_scf, homo, omega, omega_old, jquad, mm_style, dimen_RI, dimen_ia, alpha, fm_mat_Q, fm_mat_Q_gemm, do_bse, fm_mat_Q_static_bse_gemm, dgemm_counter, num_integ_points)
...
subroutine, public dealloc_im_time(fm_mo_coeff_occ, fm_mo_coeff_virt, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, index_to_cell_3c, cell_to_index_3c, do_ic_model, do_kpoints_cubic_RPA, do_kpoints_from_Gamma, do_ri_Sigma_x, has_mat_P_blocks, wkp_W, cfm_mat_Q, fm_mat_Minv_L_kpoints, fm_mat_L_kpoints, fm_matrix_Minv, fm_matrix_Minv_Vtrunc_Minv, fm_mat_RI_global_work, fm_mat_work, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, mat_dm, mat_L, mat_MinvVMinv, mat_P_omega, mat_P_omega_kp, t_3c_M, t_3c_O, t_3c_O_compressed, t_3c_O_ind, mat_work, qs_env)
...
subroutine, public q_trace_and_add_unit_matrix(dimen_RI, trace_Qomega, fm_mat_Q, para_env_RPA)
...
subroutine, public alloc_im_time(qs_env, para_env, dimen_RI, dimen_RI_red, num_integ_points, nspins, fm_mat_Q, fm_mo_coeff_occ, fm_mo_coeff_virt, fm_matrix_Minv_L_kpoints, fm_matrix_L_kpoints, mat_P_global, t_3c_O, matrix_s, kpoints, eps_filter_im_time, cut_memory, nkp, num_cells_dm, num_3c_repl, size_P, ikp_local, index_to_cell_3c, cell_to_index_3c, col_blk_size, do_ic_model, do_kpoints_cubic_RPA, do_kpoints_from_Gamma, do_ri_Sigma_x, my_open_shell, has_mat_P_blocks, wkp_W, cfm_mat_Q, fm_mat_Minv_L_kpoints, fm_mat_L_kpoints, fm_mat_RI_global_work, fm_mat_work, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, mat_dm, mat_L, mat_M_P_munu_occ, mat_M_P_munu_virt, mat_MinvVMinv, mat_P_omega, mat_P_omega_kp, mat_work, mo_coeff, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, homo, nmo)
...
subroutine, public remove_scaling_factor_rpa(fm_mat_S, virtual, Eigenval_last, homo, omega_old)
...