118#if defined (__GREENX)
119 USE gx_minimax,
ONLY: gx_minimax_grid
122#include "./base/base_uses.f90"
128 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rpa_main'
184 SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, &
185 para_env, para_env_sub, color_sub, &
186 gd_array, gd_B_virtual, gd_B_all, gd_B_occ_bse, gd_B_virt_bse, &
187 mo_coeff, fm_matrix_PQ, fm_matrix_L_kpoints, fm_matrix_Minv_L_kpoints, &
188 fm_matrix_Minv, fm_matrix_Minv_Vtrunc_Minv, kpoints, &
189 Eigenval, nmo, homo, dimen_RI, dimen_RI_red, gw_corr_lev_occ, gw_corr_lev_virt, &
191 unit_nr, do_ri_sos_laplace_mp2, my_do_gw, do_im_time, do_bse, matrix_s, &
192 mat_munu, mat_P_global, t_3c_M, t_3c_O, t_3c_O_compressed, t_3c_O_ind, &
193 starts_array_mc, ends_array_mc, &
194 starts_array_mc_block, ends_array_mc_block, calc_forces)
197 REAL(kind=
dp),
INTENT(OUT) :: erpa
198 TYPE(
mp2_type),
INTENT(INOUT) :: mp2_env
200 INTENT(INOUT) :: bib_c, bib_c_gw
201 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
202 INTENT(INOUT) :: bib_c_bse_ij, bib_c_bse_ab
204 INTEGER,
INTENT(INOUT) :: color_sub
207 INTENT(INOUT) :: gd_b_virtual
209 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
211 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_l_kpoints, &
212 fm_matrix_minv_l_kpoints, &
214 fm_matrix_minv_vtrunc_minv
216 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
217 INTENT(INOUT) :: eigenval
218 INTEGER,
INTENT(IN) :: nmo
219 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
220 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red
221 INTEGER,
DIMENSION(:),
INTENT(IN) :: gw_corr_lev_occ, gw_corr_lev_virt
222 INTEGER,
INTENT(IN) :: bse_lev_virt, unit_nr
223 LOGICAL,
INTENT(IN) :: do_ri_sos_laplace_mp2, my_do_gw, &
228 TYPE(dbt_type) :: t_3c_m
229 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_3c_o
231 DIMENSION(:, :, :),
INTENT(INOUT) :: t_3c_o_compressed
233 DIMENSION(:, :, :),
INTENT(INOUT) :: t_3c_o_ind
234 INTEGER,
ALLOCATABLE,
DIMENSION(:),
INTENT(IN) :: starts_array_mc, ends_array_mc, &
235 starts_array_mc_block, &
237 LOGICAL,
INTENT(IN) :: calc_forces
239 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rpa_ri_compute_en'
241 INTEGER :: best_integ_group_size, best_num_integ_point, color_rpa_group, dimen_homo_square, &
242 dimen_nm_gw, dimen_virt_square, handle, handle2, handle3, ierr, iib, &
243 input_num_integ_groups, integ_group_size, ispin, jjb, min_integ_group_size, &
244 my_ab_comb_bse_end, my_ab_comb_bse_size, my_ab_comb_bse_start, my_group_l_end, &
245 my_group_l_size, my_group_l_start, my_ij_comb_bse_end, my_ij_comb_bse_size, &
246 my_ij_comb_bse_start, my_nm_gw_end, my_nm_gw_size, my_nm_gw_start, ncol_block_mat, &
247 ngroup, nrow_block_mat, nspins, num_integ_group, num_integ_points, pos_integ_group
248 INTEGER(KIND=int_8) :: mem
249 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: dimen_ia, my_ia_end, my_ia_size, &
251 LOGICAL :: do_kpoints_from_gamma, do_minimax_quad, &
252 my_open_shell, skip_integ_group_opt
253 REAL(kind=
dp) :: allowed_memory, avail_mem, e_range, emax, emin, mem_for_iak, mem_for_qk, &
254 mem_min, mem_per_group, mem_per_rank, mem_per_repl, mem_real
255 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: eigenval_kp
256 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: fm_mat_q, fm_mat_q_gemm, fm_mat_s, &
258 TYPE(
cp_fm_type),
DIMENSION(1) :: fm_mat_r_gw, fm_mat_s_ab_bse, &
262 DIMENSION(:) :: bib_c_2d, bib_c_2d_gw
265 CALL timeset(routinen, handle)
276 IF (mp2_env%ri_rpa%do_rse)
THEN
292 my_open_shell = (nspins == 2)
293 ALLOCATE (virtual(nspins), dimen_ia(nspins), my_ia_end(nspins), my_ia_start(nspins), my_ia_size(nspins))
294 virtual(:) = nmo - homo(:)
295 dimen_ia(:) = virtual(:)*homo(:)
297 ALLOCATE (eigenval_kp(nmo, 1, nspins))
298 eigenval_kp(:, 1, :) = eigenval(:, :)
300 IF (do_im_time) mp2_env%ri_rpa%minimax_quad = .true.
301 do_minimax_quad = mp2_env%ri_rpa%minimax_quad
303 IF (do_ri_sos_laplace_mp2)
THEN
304 num_integ_points = mp2_env%ri_laplace%n_quadrature
305 input_num_integ_groups = mp2_env%ri_laplace%num_integ_groups
308 e_range = mp2_env%e_range
309 IF (mp2_env%e_range <= 1.0_dp .OR. mp2_env%e_gap <= 0.0_dp)
THEN
313 IF (homo(ispin) > 0)
THEN
314 emin = min(emin, 2.0_dp*(eigenval(homo(ispin) + 1, ispin) - eigenval(homo(ispin), ispin)))
315 emax = max(emax, 2.0_dp*(maxval(eigenval(:, ispin)) - minval(eigenval(:, ispin))))
320 IF (e_range < 2.0_dp) e_range = 2.0_dp
324 jjb = num_integ_points - 1
326 num_integ_points = num_integ_points - 1
332 cpassert(num_integ_points >= 1)
334 num_integ_points = mp2_env%ri_rpa%rpa_num_quad_points
335 input_num_integ_groups = mp2_env%ri_rpa%rpa_num_integ_groups
336 IF (my_do_gw .AND. do_minimax_quad)
THEN
337 IF (num_integ_points > 34)
THEN
339 CALL cp_warn(__location__, &
340 "The required number of quadrature point exceeds the maximum possible in the "// &
341 "Minimax quadrature scheme. The number of quadrature point has been reset to 30.")
342 num_integ_points = 30
345 IF (do_minimax_quad .AND. num_integ_points > 20)
THEN
347 CALL cp_warn(__location__, &
348 "The required number of quadrature point exceeds the maximum possible in the "// &
349 "Minimax quadrature scheme. The number of quadrature point has been reset to 20.")
350 num_integ_points = 20
354 allowed_memory = mp2_env%mp2_memory
356 CALL get_group_dist(gd_array, color_sub, my_group_l_start, my_group_l_end, my_group_l_size)
358 ngroup = para_env%num_pe/para_env_sub%num_pe
361 IF (do_im_time .OR. mp2_env%ri_g0w0%do_periodic .OR. do_bse)
THEN
363 integ_group_size = ngroup
364 best_num_integ_point = num_integ_points
370 mem_for_iak = real(sum(dimen_ia), kind=
dp)*dimen_ri_red*8.0_dp/(1024_dp**2)
371 mem_for_qk = real(dimen_ri_red, kind=
dp)*nspins*dimen_ri_red*8.0_dp/(1024_dp**2)
374 mem_real = (mem + 1024*1024 - 1)/(1024*1024)
375 CALL para_env%min(mem_real)
377 mem_per_rank = 0.0_dp
380 mem_per_repl = mem_for_iak
382 mem_per_repl = mem_per_repl + 2.0_dp*mem_for_qk
384 IF (calc_forces)
CALL rpa_grad_needed_mem(homo, virtual, dimen_ri_red, mem_per_rank, mem_per_repl, do_ri_sos_laplace_mp2)
387 mem_min = mem_per_repl/para_env%num_pe + mem_per_rank
389 IF (unit_nr > 0)
THEN
390 WRITE (unit_nr,
'(T3,A,T68,F9.2,A4)')
'RI_INFO| Minimum required memory per MPI process:', mem_min,
' MiB'
391 WRITE (unit_nr,
'(T3,A,T68,F9.2,A4)')
'RI_INFO| Available memory per MPI process:', mem_real,
' MiB'
395 mem_real = min(mem_real, allowed_memory)
397 mem_real = mem_real - mem_per_rank
399 mem_per_group = mem_real*para_env_sub%num_pe
402 skip_integ_group_opt = .false.
405 IF (input_num_integ_groups > 0)
THEN
406 IF (mod(num_integ_points, input_num_integ_groups) == 0)
THEN
407 IF (mod(ngroup, input_num_integ_groups) == 0)
THEN
408 best_integ_group_size = ngroup/input_num_integ_groups
409 best_num_integ_point = num_integ_points/input_num_integ_groups
410 skip_integ_group_opt = .true.
412 IF (unit_nr > 0)
WRITE (unit_nr,
'(T3,A)')
'Total number of groups not multiple of NUM_INTEG_GROUPS'
415 IF (unit_nr > 0)
WRITE (unit_nr,
'(T3,A)')
'NUM_QUAD_POINTS not multiple of NUM_INTEG_GROUPS'
419 IF (.NOT. skip_integ_group_opt)
THEN
420 best_integ_group_size = ngroup
421 best_num_integ_point = num_integ_points
423 min_integ_group_size = max(1, ngroup/num_integ_points)
425 integ_group_size = min_integ_group_size - 1
426 DO iib = min_integ_group_size + 1, ngroup
427 integ_group_size = integ_group_size + 1
430 IF (mod(ngroup, integ_group_size) /= 0) cycle
433 avail_mem = integ_group_size*mem_per_group
434 IF (avail_mem < mem_per_repl) cycle
437 num_integ_group = ngroup/integ_group_size
438 IF (mod(num_integ_points, num_integ_group) /= 0) cycle
440 best_num_integ_point = num_integ_points/num_integ_group
441 best_integ_group_size = integ_group_size
448 integ_group_size = best_integ_group_size
452 IF (unit_nr > 0 .AND. .NOT. do_im_time)
THEN
453 IF (do_ri_sos_laplace_mp2)
THEN
454 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
455 "RI_INFO| Group size for laplace numerical integration:", integ_group_size*para_env_sub%num_pe
456 WRITE (unit=unit_nr, fmt=
"(T3,A)") &
457 "INTEG_INFO| MINIMAX approximation"
458 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
459 "INTEG_INFO| Number of integration points:", num_integ_points
460 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
461 "INTEG_INFO| Number of integration points per Laplace group:", best_num_integ_point
463 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
464 "RI_INFO| Group size for frequency integration:", integ_group_size*para_env_sub%num_pe
465 IF (do_minimax_quad)
THEN
466 WRITE (unit=unit_nr, fmt=
"(T3,A)") &
467 "INTEG_INFO| MINIMAX quadrature"
469 WRITE (unit=unit_nr, fmt=
"(T3,A)") &
470 "INTEG_INFO| Clenshaw-Curtius quadrature"
472 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
473 "INTEG_INFO| Number of integration points:", num_integ_points
474 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
475 "INTEG_INFO| Number of integration points per RPA group:", best_num_integ_point
480 num_integ_group = ngroup/integ_group_size
482 pos_integ_group = mod(color_sub, integ_group_size)
483 color_rpa_group = color_sub/integ_group_size
485 CALL timeset(routinen//
"_reorder", handle2)
489 ALLOCATE (bib_c_2d(nspins))
491 IF (.NOT. do_im_time)
THEN
496 CALL calculate_bib_c_2d(bib_c_2d(ispin)%array, bib_c(ispin)%array, para_env_sub, dimen_ia(ispin), &
497 homo(ispin), virtual(ispin), gd_b_virtual(ispin), &
498 my_ia_size(ispin), my_ia_start(ispin), my_ia_end(ispin), my_group_l_size)
500 DEALLOCATE (bib_c(ispin)%array)
507 ALLOCATE (bib_c_2d_gw(nspins))
509 CALL timeset(routinen//
"_reorder_gw", handle3)
511 dimen_nm_gw = nmo*(gw_corr_lev_occ(1) + gw_corr_lev_virt(1))
515 CALL calculate_bib_c_2d(bib_c_2d_gw(ispin)%array, bib_c_gw(ispin)%array, para_env_sub, dimen_nm_gw, &
516 gw_corr_lev_occ(ispin) + gw_corr_lev_virt(ispin), nmo, gd_b_all, &
517 my_nm_gw_size, my_nm_gw_start, my_nm_gw_end, my_group_l_size)
518 DEALLOCATE (bib_c_gw(ispin)%array)
523 CALL timestop(handle3)
530 CALL timeset(routinen//
"_reorder_bse1", handle3)
532 dimen_homo_square = homo(1)**2
535 CALL calculate_bib_c_2d(bib_c_2d_bse_ij(1)%array, bib_c_bse_ij, para_env_sub, dimen_homo_square, &
536 homo(1), homo(1), gd_b_occ_bse, &
537 my_ij_comb_bse_size, my_ij_comb_bse_start, my_ij_comb_bse_end, my_group_l_size)
539 DEALLOCATE (bib_c_bse_ij)
542 CALL timestop(handle3)
544 CALL timeset(routinen//
"_reorder_bse2", handle3)
546 dimen_virt_square = bse_lev_virt**2
548 CALL calculate_bib_c_2d(bib_c_2d_bse_ab(1)%array, bib_c_bse_ab, para_env_sub, dimen_virt_square, &
549 bse_lev_virt, bse_lev_virt, gd_b_virt_bse, &
550 my_ab_comb_bse_size, my_ab_comb_bse_start, my_ab_comb_bse_end, my_group_l_size)
552 DEALLOCATE (bib_c_bse_ab)
555 CALL timestop(handle3)
559 CALL timestop(handle2)
561 IF (num_integ_group > 1)
THEN
562 ALLOCATE (para_env_rpa)
563 CALL para_env_rpa%from_split(para_env, color_rpa_group)
565 para_env_rpa => para_env
572 ALLOCATE (fm_mat_q(nspins), fm_mat_q_gemm(1), fm_mat_s(1))
574 ALLOCATE (fm_mat_q(nspins), fm_mat_q_gemm(nspins), fm_mat_s(nspins))
577 CALL create_integ_mat(bib_c_2d, para_env, para_env_sub, color_sub, ngroup, integ_group_size, &
578 dimen_ri_red, dimen_ia, color_rpa_group, &
579 mp2_env%block_size_row, mp2_env%block_size_col, unit_nr, &
580 my_ia_size, my_ia_start, my_ia_end, &
581 my_group_l_size, my_group_l_start, my_group_l_end, &
582 para_env_rpa, fm_mat_s, nrow_block_mat, ncol_block_mat, &
583 dimen_ia_for_block_size=dimen_ia(1), &
584 do_im_time=do_im_time, fm_mat_q_gemm=fm_mat_q_gemm, fm_mat_q=fm_mat_q, qs_env=qs_env)
586 DEALLOCATE (bib_c_2d, my_ia_end, my_ia_size, my_ia_start)
589 ALLOCATE (fm_mat_s_gw(nspins))
590 IF (my_do_gw .AND. .NOT. do_im_time)
THEN
592 CALL create_integ_mat(bib_c_2d_gw, para_env, para_env_sub, color_sub, ngroup, integ_group_size, &
593 dimen_ri_red, [dimen_nm_gw, dimen_nm_gw], color_rpa_group, &
594 mp2_env%block_size_row, mp2_env%block_size_col, unit_nr, &
595 [my_nm_gw_size, my_nm_gw_size], [my_nm_gw_start, my_nm_gw_start], [my_nm_gw_end, my_nm_gw_end], &
596 my_group_l_size, my_group_l_start, my_group_l_end, &
597 para_env_rpa, fm_mat_s_gw, nrow_block_mat, ncol_block_mat, &
598 fm_mat_q(1)%matrix_struct%context, fm_mat_q(1)%matrix_struct%context, &
599 fm_mat_q=fm_mat_r_gw)
600 DEALLOCATE (bib_c_2d_gw)
606 CALL create_integ_mat(bib_c_2d_bse_ij, para_env, para_env_sub, color_sub, ngroup, integ_group_size, &
607 dimen_ri_red, [dimen_homo_square], color_rpa_group, &
608 mp2_env%block_size_row, mp2_env%block_size_col, unit_nr, &
609 [my_ij_comb_bse_size], [my_ij_comb_bse_start], [my_ij_comb_bse_end], &
610 my_group_l_size, my_group_l_start, my_group_l_end, &
611 para_env_rpa, fm_mat_s_ij_bse, nrow_block_mat, ncol_block_mat, &
612 fm_mat_q(1)%matrix_struct%context, fm_mat_q(1)%matrix_struct%context)
614 CALL create_integ_mat(bib_c_2d_bse_ab, para_env, para_env_sub, color_sub, ngroup, integ_group_size, &
615 dimen_ri_red, [dimen_virt_square], color_rpa_group, &
616 mp2_env%block_size_row, mp2_env%block_size_col, unit_nr, &
617 [my_ab_comb_bse_size], [my_ab_comb_bse_start], [my_ab_comb_bse_end], &
618 my_group_l_size, my_group_l_start, my_group_l_end, &
619 para_env_rpa, fm_mat_s_ab_bse, nrow_block_mat, ncol_block_mat, &
620 fm_mat_q(1)%matrix_struct%context, fm_mat_q(1)%matrix_struct%context)
624 do_kpoints_from_gamma = qs_env%mp2_env%ri_rpa_im_time%do_kpoints_from_Gamma
625 IF (do_kpoints_from_gamma)
THEN
631 CALL rpa_num_int(qs_env, erpa, mp2_env, para_env, para_env_rpa, para_env_sub, unit_nr, &
632 homo, virtual, dimen_ri, dimen_ri_red, dimen_ia, dimen_nm_gw, &
633 eigenval_kp, num_integ_points, num_integ_group, color_rpa_group, &
634 fm_matrix_pq, fm_mat_s, fm_mat_q_gemm, fm_mat_q, fm_mat_s_gw, fm_mat_r_gw(1), &
635 fm_mat_s_ij_bse(1), fm_mat_s_ab_bse(1), &
636 my_do_gw, do_bse, gw_corr_lev_occ, gw_corr_lev_virt, &
639 do_im_time, mo_coeff, &
640 fm_matrix_l_kpoints, fm_matrix_minv_l_kpoints, &
641 fm_matrix_minv, fm_matrix_minv_vtrunc_minv, mat_munu, mat_p_global, &
642 t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, &
643 starts_array_mc, ends_array_mc, &
644 starts_array_mc_block, ends_array_mc_block, &
645 matrix_s, do_kpoints_from_gamma, kpoints, gd_array, color_sub, &
646 do_ri_sos_laplace_mp2=do_ri_sos_laplace_mp2, calc_forces=calc_forces)
652 IF (.NOT. do_im_time)
THEN
658 IF (my_do_gw .AND. .NOT. do_im_time)
THEN
668 CALL timestop(handle)
689 SUBROUTINE calculate_bib_c_2d(BIb_C_2D, BIb_C, para_env_sub, dimen_ia, homo, virtual, &
691 my_ia_size, my_ia_start, my_ia_end, my_group_L_size)
693 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
694 INTENT(OUT) :: bib_c_2d
695 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
698 INTEGER,
INTENT(IN) :: dimen_ia, homo, virtual
700 INTEGER :: my_ia_size, my_ia_start, my_ia_end, &
703 INTEGER,
PARAMETER :: occ_chunk = 128
705 INTEGER :: ia_global, iib, itmp(2), jjb, my_b_size, my_b_virtual_start, occ_high, occ_low, &
706 proc_receive, proc_send, proc_shift, rec_b_size, rec_b_virtual_end, rec_b_virtual_start
707 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: bib_c_rec_1d
708 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: bib_c_rec
710 itmp =
get_limit(dimen_ia, para_env_sub%num_pe, para_env_sub%mepos)
711 my_ia_start = itmp(1)
713 my_ia_size = my_ia_end - my_ia_start + 1
715 CALL get_group_dist(gd_b_virtual, para_env_sub%mepos, sizes=my_b_size, starts=my_b_virtual_start)
718 ALLOCATE (bib_c_2d(my_group_l_size, my_ia_size))
724 DO jjb = 1, my_b_size
725 ia_global = (iib - 1)*virtual + my_b_virtual_start + jjb - 1
726 IF (ia_global >= my_ia_start .AND. ia_global <= my_ia_end)
THEN
727 bib_c_2d(1:my_group_l_size, ia_global - my_ia_start + 1) = bib_c(1:my_group_l_size, jjb, iib)
732 IF (para_env_sub%num_pe > 1)
THEN
733 ALLOCATE (bib_c_rec_1d(int(my_group_l_size,
int_8)*
maxsize(gd_b_virtual)*min(homo, occ_chunk)))
734 DO proc_shift = 1, para_env_sub%num_pe - 1
735 proc_send =
modulo(para_env_sub%mepos + proc_shift, para_env_sub%num_pe)
736 proc_receive =
modulo(para_env_sub%mepos - proc_shift, para_env_sub%num_pe)
738 CALL get_group_dist(gd_b_virtual, proc_receive, rec_b_virtual_start, rec_b_virtual_end, rec_b_size)
741 DO occ_low = 1, homo, occ_chunk
742 occ_high = min(homo, occ_low + occ_chunk - 1)
743 bib_c_rec(1:my_group_l_size, 1:rec_b_size, 1:occ_high - occ_low + 1) => &
744 bib_c_rec_1d(1:int(my_group_l_size,
int_8)*rec_b_size*(occ_high - occ_low + 1))
745 CALL para_env_sub%sendrecv(bib_c(:, :, occ_low:occ_high), proc_send, &
746 bib_c_rec(:, :, 1:occ_high - occ_low + 1), proc_receive)
750 DO iib = occ_low, occ_high
751 DO jjb = 1, rec_b_size
752 ia_global = (iib - 1)*virtual + rec_b_virtual_start + jjb - 1
753 IF (ia_global >= my_ia_start .AND. ia_global <= my_ia_end)
THEN
754 bib_c_2d(1:my_group_l_size, ia_global - my_ia_start + 1) = bib_c_rec(1:my_group_l_size, jjb, iib - occ_low + 1)
761 DEALLOCATE (bib_c_rec_1d)
764 END SUBROUTINE calculate_bib_c_2d
798 SUBROUTINE create_integ_mat(BIb_C_2D, para_env, para_env_sub, color_sub, ngroup, integ_group_size, &
799 dimen_RI, dimen_ia, color_rpa_group, &
800 ext_row_block_size, ext_col_block_size, unit_nr, &
801 my_ia_size, my_ia_start, my_ia_end, &
802 my_group_L_size, my_group_L_start, my_group_L_end, &
803 para_env_RPA, fm_mat_S, nrow_block_mat, ncol_block_mat, &
804 blacs_env_ext, blacs_env_ext_S, dimen_ia_for_block_size, &
805 do_im_time, fm_mat_Q_gemm, fm_mat_Q, qs_env)
808 INTENT(INOUT) :: bib_c_2d
810 INTEGER,
INTENT(IN) :: color_sub, ngroup, integ_group_size, &
812 INTEGER,
DIMENSION(:),
INTENT(IN) :: dimen_ia
813 INTEGER,
INTENT(IN) :: color_rpa_group, ext_row_block_size, &
814 ext_col_block_size, unit_nr
815 INTEGER,
DIMENSION(:),
INTENT(IN) :: my_ia_size, my_ia_start, my_ia_end
816 INTEGER,
INTENT(IN) :: my_group_l_size, my_group_l_start, &
819 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(INOUT) :: fm_mat_s
820 INTEGER,
INTENT(INOUT) :: nrow_block_mat, ncol_block_mat
822 INTEGER,
INTENT(IN),
OPTIONAL :: dimen_ia_for_block_size
823 LOGICAL,
INTENT(IN),
OPTIONAL :: do_im_time
824 TYPE(
cp_fm_type),
DIMENSION(:),
OPTIONAL :: fm_mat_q_gemm, fm_mat_q
828 CHARACTER(LEN=*),
PARAMETER :: routinen =
'create_integ_mat'
830 INTEGER :: col_row_proc_ratio, grid_2d(2), handle, &
831 iproc, iproc_col, iproc_row, ispin, &
833 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: group_grid_2_mepos
834 LOGICAL :: my_blacs_ext, my_blacs_s_ext, &
840 CALL timeset(routinen, handle)
842 cpassert(
PRESENT(blacs_env_ext) .OR.
PRESENT(dimen_ia_for_block_size))
844 my_blacs_ext = .false.
845 IF (
PRESENT(blacs_env_ext)) my_blacs_ext = .true.
847 my_blacs_s_ext = .false.
848 IF (
PRESENT(blacs_env_ext_s)) my_blacs_s_ext = .true.
850 my_do_im_time = .false.
851 IF (
PRESENT(do_im_time)) my_do_im_time = do_im_time
855 IF (my_blacs_s_ext)
THEN
856 blacs_env => blacs_env_ext_s
858 IF (para_env_rpa%num_pe > 1)
THEN
859 col_row_proc_ratio = max(1, dimen_ia_for_block_size/dimen_ri)
861 iproc_col = min(max(int(sqrt(real(para_env_rpa%num_pe*col_row_proc_ratio, kind=
dp))), 1), para_env_rpa%num_pe) + 1
862 DO iproc = 1, para_env_rpa%num_pe
863 iproc_col = iproc_col - 1
864 IF (mod(para_env_rpa%num_pe, iproc_col) == 0)
EXIT
867 iproc_row = para_env_rpa%num_pe/iproc_col
868 grid_2d(1) = iproc_row
869 grid_2d(2) = iproc_col
875 IF (unit_nr > 0 .AND. .NOT. my_do_im_time)
THEN
876 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
877 "MATRIX_INFO| Number row processes:", grid_2d(1)
878 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
879 "MATRIX_INFO| Number column processes:", grid_2d(2)
883 IF (ext_row_block_size > 0)
THEN
884 nrow_block_mat = ext_row_block_size
886 nrow_block_mat = max(1, dimen_ri/grid_2d(1)/2)
890 IF (ext_col_block_size > 0)
THEN
891 ncol_block_mat = ext_col_block_size
893 ncol_block_mat = max(1, dimen_ia_for_block_size/grid_2d(2)/2)
896 IF (unit_nr > 0 .AND. .NOT. my_do_im_time)
THEN
897 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
898 "MATRIX_INFO| Row block size:", nrow_block_mat
899 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
900 "MATRIX_INFO| Column block size:", ncol_block_mat
904 IF (.NOT. my_do_im_time)
THEN
905 DO ispin = 1,
SIZE(bib_c_2d)
907 IF (my_blacs_ext)
THEN
909 ncol_global=dimen_ia(ispin), para_env=para_env_rpa)
912 ncol_global=dimen_ia(ispin), para_env=para_env_rpa, &
913 nrow_block=nrow_block_mat, ncol_block=ncol_block_mat, force_block=.true.)
917 CALL create_group_dist(gd_ia, my_ia_start(ispin), my_ia_end(ispin), my_ia_size(ispin), para_env_rpa)
918 CALL create_group_dist(gd_l, my_group_l_start, my_group_l_end, my_group_l_size, para_env_rpa)
922 mepos_in_rpa_group = mod(color_sub, integ_group_size)
923 ALLOCATE (group_grid_2_mepos(0:integ_group_size - 1, 0:para_env_sub%num_pe - 1))
924 group_grid_2_mepos = 0
925 group_grid_2_mepos(mepos_in_rpa_group, para_env_sub%mepos) = para_env_rpa%mepos
926 CALL para_env_rpa%sum(group_grid_2_mepos)
928 CALL array2fm(bib_c_2d(ispin)%array, fm_struct, my_group_l_start, my_group_l_end, &
929 my_ia_start(ispin), my_ia_end(ispin), gd_l, gd_ia, &
930 group_grid_2_mepos, ngroup, para_env_sub%num_pe, fm_mat_s(ispin), &
931 integ_group_size, color_rpa_group)
933 DEALLOCATE (group_grid_2_mepos)
941 IF (para_env_rpa%num_pe /= para_env%num_pe)
THEN
944 comm_exchange = fm_mat_s(ispin)%matrix_struct%context%interconnect(para_env)
945 CALL comm_exchange%sum(fm_mat_s(ispin)%local_data)
946 CALL comm_exchange%free()
952 IF (
PRESENT(fm_mat_q_gemm) .AND. .NOT. my_do_im_time)
THEN
956 ncol_global=dimen_ri, para_env=para_env_rpa, &
957 nrow_block=nrow_block_mat, ncol_block=ncol_block_mat, force_block=.true.)
958 DO ispin = 1,
SIZE(fm_mat_q_gemm)
959 CALL cp_fm_create(fm_mat_q_gemm(ispin), fm_struct, name=
"fm_mat_Q_gemm")
964 IF (
PRESENT(fm_mat_q))
THEN
965 NULLIFY (blacs_env_q)
966 IF (my_blacs_ext)
THEN
967 blacs_env_q => blacs_env_ext
968 ELSE IF (para_env_rpa%num_pe == para_env%num_pe .AND.
PRESENT(qs_env))
THEN
969 CALL get_qs_env(qs_env, blacs_env=blacs_env_q)
975 ncol_global=dimen_ri, para_env=para_env_rpa)
976 DO ispin = 1,
SIZE(fm_mat_q)
977 CALL cp_fm_create(fm_mat_q(ispin), fm_struct, name=
"fm_mat_Q")
982 IF (.NOT. (my_blacs_ext .OR. (para_env_rpa%num_pe == para_env%num_pe .AND.
PRESENT(qs_env)))) &
987 IF (.NOT. my_blacs_s_ext)
THEN
993 CALL timestop(handle)
995 END SUBROUTINE create_integ_mat
1054 SUBROUTINE rpa_num_int(qs_env, Erpa, mp2_env, para_env, para_env_RPA, para_env_sub, unit_nr, &
1055 homo, virtual, dimen_RI, dimen_RI_red, dimen_ia, dimen_nm_gw, &
1056 Eigenval, num_integ_points, num_integ_group, color_rpa_group, &
1057 fm_matrix_PQ, fm_mat_S, fm_mat_Q_gemm, fm_mat_Q, fm_mat_S_gw, fm_mat_R_gw, &
1058 fm_mat_S_ij_bse, fm_mat_S_ab_bse, &
1059 my_do_gw, do_bse, gw_corr_lev_occ, gw_corr_lev_virt, &
1061 do_minimax_quad, do_im_time, mo_coeff, &
1062 fm_matrix_L_kpoints, fm_matrix_Minv_L_kpoints, &
1063 fm_matrix_Minv, fm_matrix_Minv_Vtrunc_Minv, mat_munu, mat_P_global, &
1064 t_3c_M, t_3c_O, t_3c_O_compressed, t_3c_O_ind, &
1065 starts_array_mc, ends_array_mc, &
1066 starts_array_mc_block, ends_array_mc_block, &
1067 matrix_s, do_kpoints_from_Gamma, kpoints, gd_array, color_sub, &
1068 do_ri_sos_laplace_mp2, calc_forces)
1070 TYPE(qs_environment_type),
POINTER :: qs_env
1071 REAL(kind=dp),
INTENT(OUT) :: erpa
1072 TYPE(mp2_type) :: mp2_env
1073 TYPE(mp_para_env_type),
POINTER :: para_env, para_env_rpa, para_env_sub
1074 INTEGER,
INTENT(IN) :: unit_nr
1075 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
1076 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red
1077 INTEGER,
DIMENSION(:),
INTENT(IN) :: dimen_ia
1078 INTEGER,
INTENT(IN) :: dimen_nm_gw
1079 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
1080 INTENT(INOUT) :: eigenval
1081 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
1083 TYPE(cp_fm_type),
INTENT(IN) :: fm_matrix_pq
1084 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(INOUT) :: fm_mat_s
1085 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_q_gemm, fm_mat_q, fm_mat_s_gw
1086 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_r_gw, fm_mat_s_ij_bse, &
1088 LOGICAL,
INTENT(IN) :: my_do_gw, do_bse
1089 INTEGER,
DIMENSION(:),
INTENT(IN) :: gw_corr_lev_occ, gw_corr_lev_virt
1090 INTEGER,
INTENT(IN) :: bse_lev_virt
1091 LOGICAL,
INTENT(IN) :: do_minimax_quad, do_im_time
1092 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
1093 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_l_kpoints, &
1094 fm_matrix_minv_l_kpoints, &
1096 fm_matrix_minv_vtrunc_minv
1097 TYPE(dbcsr_p_type),
INTENT(IN) :: mat_munu
1098 TYPE(dbcsr_p_type),
INTENT(INOUT) :: mat_p_global
1099 TYPE(dbt_type),
INTENT(INOUT) :: t_3c_m
1100 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :), &
1101 INTENT(INOUT) :: t_3c_o
1102 TYPE(hfx_compression_type),
ALLOCATABLE, &
1103 DIMENSION(:, :, :),
INTENT(INOUT) :: t_3c_o_compressed
1104 TYPE(block_ind_type),
ALLOCATABLE, &
1105 DIMENSION(:, :, :),
INTENT(INOUT) :: t_3c_o_ind
1106 INTEGER,
ALLOCATABLE,
DIMENSION(:),
INTENT(IN) :: starts_array_mc, ends_array_mc, &
1107 starts_array_mc_block, &
1109 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s
1110 LOGICAL :: do_kpoints_from_gamma
1111 TYPE(kpoint_type),
POINTER :: kpoints
1112 TYPE(group_dist_d1_type),
INTENT(IN) :: gd_array
1113 INTEGER,
INTENT(IN) :: color_sub
1114 LOGICAL,
INTENT(IN) :: do_ri_sos_laplace_mp2, calc_forces
1116 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rpa_num_int'
1118 COMPLEX(KIND=dp),
ALLOCATABLE, &
1119 DIMENSION(:, :, :, :) :: vec_sigma_c_gw
1120 INTEGER :: count_ev_sc_gw, cut_memory, group_size_p, gw_corr_lev_tot, handle, handle3, &
1121 i, ikp_local, ispin, iter_evgw, iter_sc_gw0, j, jquad, min_bsize, mm_style, nkp, &
1122 nkp_self_energy, nmo, nspins, num_3c_repl, num_cells_dm, num_fit_points, pspin, qspin, &
1124#if defined (__GREENX)
1127 INTEGER(int_8) :: dbcsr_nflop
1128 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: index_to_cell_3c
1129 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :) :: cell_to_index_3c
1130 INTEGER,
DIMENSION(:),
POINTER :: col_blk_size, prim_blk_sizes, &
1132 LOGICAL :: do_apply_ic_corr_to_gw, do_gw_im_time, do_ic_model, do_kpoints_cubic_rpa, &
1133 do_periodic, do_print, do_ri_sigma_x, exit_ev_gw, first_cycle, &
1134 first_cycle_periodic_correction, my_open_shell, print_ic_values
1135 LOGICAL,
ALLOCATABLE,
DIMENSION(:, :, :, :, :) :: has_mat_p_blocks
1136 REAL(kind=dp) :: a_scaling, alpha, dbcsr_time, e_exchange, e_exchange_corr, &
1137 eps_filter, eps_filter_im_time, ext_scaling, fermi_level_offset, fermi_level_offset_input, &
1138 my_flop_rate, omega, omega_max_fit, omega_old, tau, tau_old
1139#if defined (__GREENX)
1140 REAL(kind=dp) :: cosft_duality_error_greenx, emax, emin, &
1141 max_errors_greenx(3)
1143 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:) :: delta_corr, e_fermi, tau_tj, tau_wj, tj, &
1144 trace_qomega, vec_omega_fit_gw, wj, &
1146 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: vec_w_gw, weights_cos_tf_t_to_w, &
1147 weights_cos_tf_w_to_t, &
1148 weights_sin_tf_t_to_w
1149 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: eigenval_last, eigenval_scf, &
1151 TYPE(cp_cfm_type) :: cfm_mat_q
1152 TYPE(cp_fm_type) :: fm_mat_q_static_bse_gemm, fm_mat_ri_global_work, fm_mat_s_ia_bse, &
1153 fm_mat_work, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, fm_scaled_dm_occ_tau, &
1154 fm_scaled_dm_virt_tau
1155 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:) :: fm_mat_s_gw_work, fm_mat_w, &
1156 fm_mo_coeff_occ, fm_mo_coeff_virt
1157 TYPE(cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_mat_l_kpoints, fm_mat_minv_l_kpoints
1158 TYPE(dbcsr_p_type) :: mat_dm, mat_l, mat_m_p_munu_occ, &
1159 mat_m_p_munu_virt, mat_minvvminv
1160 TYPE(dbcsr_p_type),
ALLOCATABLE, &
1161 DIMENSION(:, :, :) :: mat_p_omega
1162 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_berry_im_mo_mo, &
1163 matrix_berry_re_mo_mo
1164 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_p_omega_kp
1165 TYPE(dbcsr_type),
POINTER :: mat_w, mat_work
1166 TYPE(dbt_type) :: t_3c_overl_int_ao_mo
1167 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_3c_overl_int_gw_ao, &
1168 t_3c_overl_int_gw_ri, &
1169 t_3c_overl_nnp_ic, &
1170 t_3c_overl_nnp_ic_reflected
1171 TYPE(dgemm_counter_type) :: dgemm_counter
1172 TYPE(hfx_compression_type),
ALLOCATABLE, &
1173 DIMENSION(:) :: t_3c_o_mo_compressed
1174 TYPE(im_time_force_type) :: force_data
1175 TYPE(rpa_exchange_work_type) :: exchange_work
1177 TYPE(rpa_sigma_type) :: rpa_sigma
1178 TYPE(two_dim_int_array),
ALLOCATABLE,
DIMENSION(:) :: t_3c_o_mo_ind
1180 CALL timeset(routinen, handle)
1183 nmo = homo(1) + virtual(1)
1185 my_open_shell = (nspins == 2)
1187 do_gw_im_time = my_do_gw .AND. do_im_time
1188 do_ri_sigma_x = mp2_env%ri_g0w0%do_ri_Sigma_x
1189 do_ic_model = mp2_env%ri_g0w0%do_ic_model
1190 print_ic_values = mp2_env%ri_g0w0%print_ic_values
1191 do_periodic = mp2_env%ri_g0w0%do_periodic
1192 do_kpoints_cubic_rpa = mp2_env%ri_rpa_im_time%do_im_time_kpoints
1195 mm_style = wfc_mm_style_gemm
1196 IF (.NOT. do_ri_sos_laplace_mp2) mm_style = mp2_env%ri_rpa%mm_style
1199 ext_scaling = 0.2_dp
1200 omega_max_fit = mp2_env%ri_g0w0%omega_max_fit
1201 fermi_level_offset_input = mp2_env%ri_g0w0%fermi_level_offset
1202 iter_evgw = mp2_env%ri_g0w0%iter_evGW
1203 iter_sc_gw0 = mp2_env%ri_g0w0%iter_sc_GW0
1204 IF ((.NOT. do_im_time))
THEN
1205 IF (iter_sc_gw0 .NE. 1 .AND. iter_evgw .NE. 1) cpabort(
"Mixed scGW0/evGW not implemented.")
1207 IF (iter_sc_gw0 .NE. 1) iter_evgw = iter_sc_gw0
1210 ext_scaling = 0.0_dp
1215 IF (do_kpoints_cubic_rpa .AND. do_ri_sos_laplace_mp2)
THEN
1216 cpabort(
"RI-SOS-Laplace-MP2 with k-point-sampling is not implemented.")
1219 do_apply_ic_corr_to_gw = .false.
1220 IF (mp2_env%ri_g0w0%ic_corr_list(1)%array(1) > 0.0_dp) do_apply_ic_corr_to_gw = .true.
1222 IF (do_im_time)
THEN
1223 cpassert(do_minimax_quad .OR. do_ri_sos_laplace_mp2)
1225 group_size_p = mp2_env%ri_rpa_im_time%group_size_P
1226 cut_memory = mp2_env%ri_rpa_im_time%cut_memory
1227 eps_filter = mp2_env%ri_rpa_im_time%eps_filter
1228 eps_filter_im_time = mp2_env%ri_rpa_im_time%eps_filter* &
1229 mp2_env%ri_rpa_im_time%eps_filter_factor
1231 min_bsize = mp2_env%ri_rpa_im_time%min_bsize
1233 CALL alloc_im_time(qs_env, para_env, dimen_ri, dimen_ri_red, &
1234 num_integ_points, nspins, fm_mat_q(1), fm_mo_coeff_occ, fm_mo_coeff_virt, &
1235 fm_matrix_minv_l_kpoints, fm_matrix_l_kpoints, mat_p_global, &
1236 t_3c_o, matrix_s, kpoints, eps_filter_im_time, &
1237 cut_memory, nkp, num_cells_dm, num_3c_repl, &
1238 size_p, ikp_local, &
1242 do_ic_model, do_kpoints_cubic_rpa, &
1243 do_kpoints_from_gamma, do_ri_sigma_x, my_open_shell, &
1244 has_mat_p_blocks, wkp_w, &
1245 cfm_mat_q, fm_mat_minv_l_kpoints, fm_mat_l_kpoints, &
1246 fm_mat_ri_global_work, fm_mat_work, fm_mo_coeff_occ_scaled, &
1247 fm_mo_coeff_virt_scaled, mat_dm, mat_l, mat_m_p_munu_occ, mat_m_p_munu_virt, &
1248 mat_minvvminv, mat_p_omega, mat_p_omega_kp, mat_work, mo_coeff, &
1249 fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, homo, nmo)
1251 IF (calc_forces)
CALL init_im_time_forces(force_data, fm_matrix_pq, t_3c_m, unit_nr, mp2_env, qs_env)
1255 CALL dbcsr_get_info(mat_p_global%matrix, &
1256 row_blk_size=ri_blk_sizes)
1258 CALL dbcsr_get_info(matrix_s(1)%matrix, &
1259 row_blk_size=prim_blk_sizes)
1261 gw_corr_lev_tot = gw_corr_lev_occ(1) + gw_corr_lev_virt(1)
1263 IF (.NOT. do_kpoints_cubic_rpa)
THEN
1264 CALL allocate_matrices_gw_im_time(gw_corr_lev_occ, gw_corr_lev_virt, homo, nmo, &
1265 num_integ_points, unit_nr, &
1266 ri_blk_sizes, do_ic_model, &
1267 para_env, fm_mat_w, fm_mat_q(1), &
1269 t_3c_overl_int_ao_mo, t_3c_o_mo_compressed, t_3c_o_mo_ind, &
1270 t_3c_overl_int_gw_ri, t_3c_overl_int_gw_ao, &
1271 starts_array_mc, ends_array_mc, &
1272 t_3c_overl_nnp_ic, t_3c_overl_nnp_ic_reflected, &
1273 matrix_s, mat_w, t_3c_o, &
1274 t_3c_o_compressed, t_3c_o_ind, &
1281 IF (do_ic_model)
THEN
1283 cpassert(do_gw_im_time)
1284 cpassert(.NOT. do_periodic)
1285 IF (cut_memory .NE. 1) cpabort(
"For IC, use MEMORY_CUT 1 in the LOW_SCALING section.")
1288 ALLOCATE (e_fermi(nspins))
1289 IF (do_minimax_quad .OR. do_ri_sos_laplace_mp2)
THEN
1290 do_print = .NOT. do_ic_model
1291#if defined (__GREENX)
1292 CALL init_greenx_grids(qs_env, para_env, homo, eigenval, do_ri_sos_laplace_mp2, &
1293 do_kpoints_cubic_rpa, emin, emax, e_fermi(1))
1294 CALL gx_minimax_grid(num_integ_points, emin, emax, tau_tj, tau_wj, tj, wj, &
1295 weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, &
1296 max_errors_greenx, cosft_duality_error_greenx, ierr, &
1297 bare_cos_sin_weights=.true., &
1298 regularization=qs_env%mp2_env%ri_g0w0%regularization_minimax)
1300 wj(:) = wj(:)*4.0_dp
1302 IF (unit_nr > 0)
THEN
1303 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
1304 "GREENX MINIMAX_INFO| Number of integration points:", num_integ_points
1305 WRITE (unit=unit_nr, fmt=
"(T3,A,T61,3F20.7)") &
1306 "GREENX MINIMAX_INFO| Gap (Emin):", emin
1307 WRITE (unit=unit_nr, fmt=
"(T3,A,T61,3F20.7)") &
1308 "GREENX MINIMAX_INFO| Maximum eigenvalue difference (Emax):", emax
1309 WRITE (unit=unit_nr, fmt=
"(T3,A,T61,3F20.4)") &
1310 "GREENX MINIMAX_INFO| Energy range (Emax/Emin):", emax/emin
1311 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)") &
1312 "GREENX MINIMAX_INFO| Frequency grid (scaled):",
"Weights",
"Abscissas"
1313 DO gi = 1, num_integ_points
1314 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") wj(gi), tj(gi)
1316 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)") &
1317 "GREENX MINIMAX_INFO| Time grid (scaled):",
"Weights",
"Abscissas"
1318 DO gi = 1, num_integ_points
1319 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") tau_wj(gi), tau_tj(gi)
1321 CALL m_flush(unit_nr)
1324 IF (unit_nr > 0)
THEN
1325 WRITE (unit=unit_nr, fmt=
"(T3,A,T75)") &
1326 "GREENX MINIMAX_INFO| Grid not available, use internal CP2K grids"
1327 CALL m_flush(unit_nr)
1329 IF (
ALLOCATED(tau_tj))
THEN
1332 IF (
ALLOCATED(tau_wj))
THEN
1335 IF (
ALLOCATED(tj))
THEN
1338 IF (
ALLOCATED(wj))
THEN
1341 IF (
ALLOCATED(weights_cos_tf_t_to_w))
THEN
1342 DEALLOCATE (weights_cos_tf_t_to_w)
1344 IF (
ALLOCATED(weights_cos_tf_w_to_t))
THEN
1345 DEALLOCATE (weights_cos_tf_w_to_t)
1347 IF (
ALLOCATED(weights_sin_tf_t_to_w))
THEN
1348 DEALLOCATE (weights_sin_tf_t_to_w)
1350 CALL get_minimax_grid(para_env, unit_nr, homo, eigenval, num_integ_points, do_im_time, &
1351 do_ri_sos_laplace_mp2, do_print, &
1352 tau_tj, tau_wj, qs_env, do_gw_im_time, &
1353 do_kpoints_cubic_rpa, e_fermi(1), tj, wj, &
1354 weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, &
1355 qs_env%mp2_env%ri_g0w0%regularization_minimax)
1358 CALL get_minimax_grid(para_env, unit_nr, homo, eigenval, num_integ_points, do_im_time, &
1359 do_ri_sos_laplace_mp2, do_print, &
1360 tau_tj, tau_wj, qs_env, do_gw_im_time, &
1361 do_kpoints_cubic_rpa, e_fermi(1), tj, wj, &
1362 weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, &
1363 qs_env%mp2_env%ri_g0w0%regularization_minimax)
1367 IF (qs_env%mp2_env%ri_rpa_im_time%keep_quad)
THEN
1368 CALL keep_initial_quad(tj, wj, tau_tj, tau_wj, weights_cos_tf_t_to_w, &
1369 weights_cos_tf_w_to_t, do_ri_sos_laplace_mp2, do_im_time, &
1370 num_integ_points, unit_nr, qs_env)
1373 IF (calc_forces) cpabort(
"Forces with Clenshaw-Curtis grid not implemented.")
1374 CALL get_clenshaw_grid(para_env, para_env_rpa, unit_nr, homo, virtual, eigenval, num_integ_points, &
1375 num_integ_group, color_rpa_group, fm_mat_s, my_do_gw, &
1376 ext_scaling, a_scaling, tj, wj)
1380 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1381 ALLOCATE (trace_qomega(dimen_ri_red))
1384 IF (do_ri_sos_laplace_mp2 .AND. .NOT. do_im_time)
THEN
1386 ELSE IF (my_open_shell .OR. do_ri_sos_laplace_mp2)
THEN
1392 CALL allocate_matrices_gw(vec_sigma_c_gw, color_rpa_group, dimen_nm_gw, &
1393 gw_corr_lev_occ, gw_corr_lev_virt, homo, &
1394 nmo, num_integ_group, num_integ_points, unit_nr, &
1395 gw_corr_lev_tot, num_fit_points, omega_max_fit, &
1396 do_minimax_quad, do_periodic, do_ri_sigma_x,.NOT. do_im_time, &
1397 first_cycle_periodic_correction, &
1398 a_scaling, eigenval, tj, vec_omega_fit_gw, vec_sigma_x_gw, &
1399 delta_corr, eigenval_last, eigenval_scf, vec_w_gw, &
1400 fm_mat_s_gw, fm_mat_s_gw_work, &
1401 para_env, mp2_env, kpoints, nkp, nkp_self_energy, &
1402 do_kpoints_cubic_rpa, do_kpoints_from_gamma)
1406 CALL cp_fm_create(fm_mat_q_static_bse_gemm, fm_mat_q_gemm(1)%matrix_struct)
1407 CALL cp_fm_to_fm(fm_mat_q_gemm(1), fm_mat_q_static_bse_gemm)
1408 CALL cp_fm_set_all(fm_mat_q_static_bse_gemm, 0.0_dp)
1414 IF (calc_forces .AND. .NOT. do_im_time)
CALL rpa_grad_create(
rpa_grad, fm_mat_q(1), &
1415 fm_mat_s, homo, virtual, mp2_env, eigenval(:, 1, :), &
1416 unit_nr, do_ri_sos_laplace_mp2)
1418 IF (.NOT. do_im_time .AND. .NOT. do_ri_sos_laplace_mp2) &
1419 CALL exchange_work%create(qs_env, para_env_sub, mat_munu, dimen_ri_red, &
1420 fm_mat_s, fm_mat_q(1), fm_mat_q_gemm(1), homo, virtual)
1422 IF (mp2_env%ri_rpa%exchange_correction /= rpa_exchange_none) e_exchange = 0.0_dp
1423 first_cycle = .true.
1425 CALL dgemm_counter_init(dgemm_counter, unit_nr, mp2_env%ri_rpa%print_dgemm_info)
1427 DO count_ev_sc_gw = 1, iter_evgw
1431 IF (do_ic_model) cycle
1436 vec_sigma_c_gw = z_zero
1437 first_cycle = .true.
1441 IF (do_im_time)
THEN
1443 IF (.NOT. do_kpoints_cubic_rpa)
THEN
1444 DO ispin = 1, nspins
1445 e_fermi(ispin) = (eigenval(homo(ispin), 1, ispin) + eigenval(homo(ispin) + 1, 1, ispin))*0.5_dp
1452 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(/T3,A,T66,i15)") &
1453 "MEMORY_INFO| Memory cut:", cut_memory
1454 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T3,A,T66,ES15.2)") &
1455 "SPARSITY_INFO| Eps filter for M virt/occ tensors:", eps_filter
1456 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T3,A,T66,ES15.2)") &
1457 "SPARSITY_INFO| Eps filter for P matrix:", eps_filter_im_time
1458 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T3,A,T66,i15)") &
1459 "SPARSITY_INFO| Minimum tensor block size:", min_bsize
1462 CALL zero_mat_p_omega(mat_p_omega(:, :, 1))
1465 CALL compute_mat_p_omega(mat_p_omega(:, :, 1), fm_scaled_dm_occ_tau, &
1466 fm_scaled_dm_virt_tau, fm_mo_coeff_occ(1), fm_mo_coeff_virt(1), &
1467 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, &
1468 mat_p_global, matrix_s, 1, &
1469 t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, &
1470 starts_array_mc, ends_array_mc, &
1471 starts_array_mc_block, ends_array_mc_block, &
1472 weights_cos_tf_t_to_w, tj, tau_tj, e_fermi(1), eps_filter, alpha, &
1473 eps_filter_im_time, eigenval(:, 1, 1), nmo, &
1474 num_integ_points, cut_memory, &
1475 unit_nr, mp2_env, para_env, &
1476 qs_env, do_kpoints_from_gamma, &
1477 index_to_cell_3c, cell_to_index_3c, &
1478 has_mat_p_blocks, do_ri_sos_laplace_mp2, &
1479 dbcsr_time, dbcsr_nflop)
1482 IF (my_open_shell)
THEN
1483 CALL zero_mat_p_omega(mat_p_omega(:, :, 2))
1484 CALL compute_mat_p_omega(mat_p_omega(:, :, 2), fm_scaled_dm_occ_tau, &
1485 fm_scaled_dm_virt_tau, fm_mo_coeff_occ(2), &
1486 fm_mo_coeff_virt(2), &
1487 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, &
1488 mat_p_global, matrix_s, 2, &
1489 t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, &
1490 starts_array_mc, ends_array_mc, &
1491 starts_array_mc_block, ends_array_mc_block, &
1492 weights_cos_tf_t_to_w, tj, tau_tj, e_fermi(2), eps_filter, alpha, &
1493 eps_filter_im_time, eigenval(:, 1, 2), nmo, &
1494 num_integ_points, cut_memory, &
1495 unit_nr, mp2_env, para_env, &
1496 qs_env, do_kpoints_from_gamma, &
1497 index_to_cell_3c, cell_to_index_3c, &
1498 has_mat_p_blocks, do_ri_sos_laplace_mp2, &
1499 dbcsr_time, dbcsr_nflop)
1502 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1503 DO j = 1,
SIZE(mat_p_omega, 2)
1504 DO i = 1,
SIZE(mat_p_omega, 1)
1505 CALL dbcsr_add(mat_p_omega(i, j, 1)%matrix, mat_p_omega(i, j, 2)%matrix, 1.0_dp, 1.0_dp)
1506 IF (.NOT. calc_forces)
CALL dbcsr_clear(mat_p_omega(i, j, 2)%matrix)
1514 IF (mp2_env%ri_rpa%sigma_param /= sigma_none)
THEN
1515 CALL rpa_sigma_create(rpa_sigma, mp2_env%ri_rpa%sigma_param, fm_mat_q(1), unit_nr, para_env)
1518 DO jquad = 1, num_integ_points
1519 IF (
modulo(jquad, num_integ_group) /= color_rpa_group) cycle
1521 CALL timeset(routinen//
"_RPA_matrix_operations", handle3)
1523 IF (do_ri_sos_laplace_mp2)
THEN
1524 omega = tau_tj(jquad)
1526 IF (do_minimax_quad)
THEN
1529 omega = a_scaling/tan(tj(jquad))
1533 IF (do_im_time)
THEN
1536 IF (.NOT. (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma))
THEN
1538 DO ispin = 1,
SIZE(mat_p_omega, 3)
1539 CALL contract_p_omega_with_mat_l(mat_p_omega(jquad, 1, ispin)%matrix, mat_l%matrix, mat_work, &
1540 eps_filter_im_time, fm_mat_work, dimen_ri, dimen_ri_red, &
1541 fm_mat_minv_l_kpoints(1, 1), fm_mat_q(ispin))
1546 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T3, A, 1X, I3, 1X, A, 1X, I3)") &
1547 "INTEG_INFO| Started with Integration point", jquad,
"of", num_integ_points
1549 IF (first_cycle .AND. count_ev_sc_gw > 1)
THEN
1550 IF (iter_sc_gw0 == 1)
THEN
1551 DO ispin = 1, nspins
1552 CALL remove_scaling_factor_rpa(fm_mat_s(ispin), virtual(ispin), &
1553 eigenval_last(:, 1, ispin), homo(ispin), omega_old)
1556 DO ispin = 1, nspins
1557 CALL remove_scaling_factor_rpa(fm_mat_s(ispin), virtual(ispin), &
1558 eigenval_scf(:, 1, ispin), homo(ispin), omega_old)
1563 IF (iter_sc_gw0 > 1)
THEN
1564 DO ispin = 1, nspins
1565 CALL calc_mat_q(fm_mat_s(ispin), do_ri_sos_laplace_mp2, first_cycle, virtual(ispin), &
1566 eigenval_scf(:, 1, ispin), homo(ispin), omega, omega_old, jquad, mm_style, &
1567 dimen_ri_red, dimen_ia(ispin), alpha, fm_mat_q(ispin), &
1568 fm_mat_q_gemm(ispin), do_bse, fm_mat_q_static_bse_gemm, dgemm_counter, &
1569 num_integ_points, count_ev_sc_gw)
1573 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1574 DO ispin = 2, nspins
1575 CALL cp_fm_scale_and_add(alpha=1.0_dp, matrix_a=fm_mat_q(1), beta=1.0_dp, matrix_b=fm_mat_q(ispin))
1579 DO ispin = 1, nspins
1580 CALL calc_mat_q(fm_mat_s(ispin), do_ri_sos_laplace_mp2, first_cycle, virtual(ispin), &
1581 eigenval(:, 1, ispin), homo(ispin), omega, omega_old, jquad, mm_style, &
1582 dimen_ri_red, dimen_ia(ispin), alpha, fm_mat_q(ispin), &
1583 fm_mat_q_gemm(ispin), do_bse, fm_mat_q_static_bse_gemm, dgemm_counter, &
1584 num_integ_points, count_ev_sc_gw)
1588 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1589 DO ispin = 2, nspins
1590 CALL cp_fm_scale_and_add(alpha=1.0_dp, matrix_a=fm_mat_q(1), beta=1.0_dp, matrix_b=fm_mat_q(ispin))
1599 IF (mp2_env%ri_rpa%exchange_correction /= rpa_exchange_none)
THEN
1600 e_exchange_corr = 0.0_dp
1601 CALL exchange_work%compute(fm_mat_q(1), eigenval(:, 1, :), fm_mat_s, omega, e_exchange_corr, mp2_env)
1604 e_exchange = e_exchange + e_exchange_corr*wj(jquad)
1608 IF (mp2_env%ri_rpa%sigma_param /= sigma_none)
THEN
1609 CALL rpa_sigma_matrix_spectral(rpa_sigma, fm_mat_q(1), wj(jquad), para_env_rpa)
1612 IF (do_ri_sos_laplace_mp2)
THEN
1614 CALL sos_mp2_postprocessing(fm_mat_q, erpa, tau_wj(jquad))
1616 IF (calc_forces .AND. .NOT. do_im_time)
CALL rpa_grad_matrix_operations(mp2_env,
rpa_grad, do_ri_sos_laplace_mp2, &
1617 fm_mat_q, fm_mat_q_gemm, dgemm_counter, fm_mat_s, omega, homo, virtual, &
1618 eigenval(:, 1, :), tau_wj(jquad), unit_nr)
1620 IF (calc_forces .AND. .NOT. do_im_time)
CALL rpa_grad_copy_q(fm_mat_q(1),
rpa_grad)
1622 CALL q_trace_and_add_unit_matrix(dimen_ri_red, trace_qomega, fm_mat_q(1))
1624 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma)
THEN
1625 CALL invert_eps_compute_w_and_erpa_kp(dimen_ri, num_integ_points, jquad, nkp, count_ev_sc_gw, para_env, &
1626 erpa, tau_tj, tj, wj, weights_cos_tf_w_to_t, &
1627 wkp_w, do_gw_im_time, do_ri_sigma_x, do_kpoints_from_gamma, &
1628 cfm_mat_q, ikp_local, &
1629 mat_p_omega(:, :, 1), mat_p_omega_kp, qs_env, eps_filter_im_time, unit_nr, &
1630 kpoints, fm_mat_minv_l_kpoints, fm_mat_l_kpoints, &
1631 fm_mat_w, fm_mat_ri_global_work, mat_minvvminv, &
1632 fm_matrix_minv, fm_matrix_minv_vtrunc_minv)
1634 CALL compute_erpa_by_freq_int(dimen_ri_red, trace_qomega, fm_mat_q(1), para_env_rpa, erpa, wj(jquad))
1637 IF (calc_forces .AND. .NOT. do_im_time)
CALL rpa_grad_matrix_operations(mp2_env,
rpa_grad, do_ri_sos_laplace_mp2, &
1638 fm_mat_q, fm_mat_q_gemm, dgemm_counter, fm_mat_s, omega, homo, virtual, &
1639 eigenval(:, 1, :), wj(jquad), unit_nr)
1643 first_cycle = .false.
1646 CALL timestop(handle3)
1650 CALL get_fermi_level_offset(fermi_level_offset, fermi_level_offset_input, eigenval(:, 1, :), homo)
1653 IF (do_im_time)
THEN
1655 IF (.NOT. (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma))
THEN
1656 CALL compute_w_cubic_gw(fm_mat_w, fm_mat_q(1), fm_mat_work, dimen_ri, fm_mat_minv_l_kpoints, num_integ_points, &
1657 tj, tau_tj, weights_cos_tf_w_to_t, jquad, omega)
1660 CALL compute_gw_self_energy(vec_sigma_c_gw, dimen_nm_gw, dimen_ri_red, gw_corr_lev_occ, &
1661 gw_corr_lev_virt, homo, jquad, nmo, num_fit_points, &
1662 do_im_time, do_periodic, first_cycle_periodic_correction, &
1663 fermi_level_offset, &
1664 omega, eigenval(:, 1, :), delta_corr, vec_omega_fit_gw, vec_w_gw, wj, &
1665 fm_mat_q(1), fm_mat_r_gw, fm_mat_s_gw, &
1666 fm_mat_s_gw_work, mo_coeff(1), para_env, &
1667 para_env_rpa, matrix_berry_im_mo_mo, matrix_berry_re_mo_mo, &
1668 kpoints, qs_env, mp2_env)
1672 IF (unit_nr > 0)
CALL m_flush(unit_nr)
1673 CALL para_env%sync()
1677 IF (mp2_env%ri_rpa%sigma_param /= sigma_none)
THEN
1678 CALL finalize_rpa_sigma(rpa_sigma, unit_nr, mp2_env%ri_rpa%e_sigma_corr, para_env, do_minimax_quad)
1679 IF (do_minimax_quad) mp2_env%ri_rpa%e_sigma_corr = mp2_env%ri_rpa%e_sigma_corr/2.0_dp
1680 CALL para_env%sum(mp2_env%ri_rpa%e_sigma_corr)
1683 CALL para_env%sum(erpa)
1685 IF (.NOT. (do_ri_sos_laplace_mp2))
THEN
1686 erpa = erpa/(pi*2.0_dp)
1687 IF (do_minimax_quad) erpa = erpa/2.0_dp
1690 IF (mp2_env%ri_rpa%exchange_correction /= rpa_exchange_none)
THEN
1691 CALL para_env%sum(e_exchange)
1692 e_exchange = e_exchange/(pi*2.0_dp)
1693 IF (do_minimax_quad) e_exchange = e_exchange/2.0_dp
1694 mp2_env%ri_rpa%ener_exchange = e_exchange
1697 IF (calc_forces .AND. do_ri_sos_laplace_mp2 .AND. do_im_time)
THEN
1698 IF (my_open_shell)
THEN
1701 CALL calc_laplace_loop_forces(force_data, mat_p_omega(:, 1, :), t_3c_m, t_3c_o(1, 1), &
1702 t_3c_o_compressed(1, 1, :), t_3c_o_ind(1, 1, :), fm_scaled_dm_occ_tau, &
1703 fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, &
1704 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, &
1705 starts_array_mc, ends_array_mc, starts_array_mc_block, &
1706 ends_array_mc_block, num_integ_points, nmo, eigenval(:, 1, :), &
1707 tau_tj, tau_wj, cut_memory, pspin, qspin, my_open_shell, &
1708 unit_nr, dbcsr_time, dbcsr_nflop, mp2_env, qs_env)
1711 CALL calc_laplace_loop_forces(force_data, mat_p_omega(:, 1, :), t_3c_m, t_3c_o(1, 1), &
1712 t_3c_o_compressed(1, 1, :), t_3c_o_ind(1, 1, :), fm_scaled_dm_occ_tau, &
1713 fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, &
1714 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, &
1715 starts_array_mc, ends_array_mc, starts_array_mc_block, &
1716 ends_array_mc_block, num_integ_points, nmo, eigenval(:, 1, :), &
1717 tau_tj, tau_wj, cut_memory, pspin, qspin, my_open_shell, &
1718 unit_nr, dbcsr_time, dbcsr_nflop, mp2_env, qs_env)
1723 CALL calc_laplace_loop_forces(force_data, mat_p_omega(:, 1, :), t_3c_m, t_3c_o(1, 1), &
1724 t_3c_o_compressed(1, 1, :), t_3c_o_ind(1, 1, :), fm_scaled_dm_occ_tau, &
1725 fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, &
1726 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, &
1727 starts_array_mc, ends_array_mc, starts_array_mc_block, &
1728 ends_array_mc_block, num_integ_points, nmo, eigenval(:, 1, :), &
1729 tau_tj, tau_wj, cut_memory, pspin, qspin, my_open_shell, &
1730 unit_nr, dbcsr_time, dbcsr_nflop, mp2_env, qs_env)
1732 CALL calc_post_loop_forces(force_data, unit_nr, qs_env)
1735 IF (calc_forces .AND. do_im_time .AND. .NOT. do_ri_sos_laplace_mp2)
THEN
1736 DO ispin = 1, nspins
1737 CALL calc_rpa_loop_forces(force_data, mat_p_omega(:, 1, :), t_3c_m, t_3c_o(1, 1), &
1738 t_3c_o_compressed(1, 1, :), t_3c_o_ind(1, 1, :), fm_scaled_dm_occ_tau, &
1739 fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, &
1740 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, &
1741 starts_array_mc, ends_array_mc, starts_array_mc_block, &
1742 ends_array_mc_block, num_integ_points, nmo, eigenval(:, 1, :), &
1743 e_fermi(ispin), weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, tj, &
1744 wj, tau_tj, cut_memory, ispin, my_open_shell, unit_nr, dbcsr_time, &
1745 dbcsr_nflop, mp2_env, qs_env)
1747 CALL calc_post_loop_forces(force_data, unit_nr, qs_env)
1750 IF (do_im_time)
THEN
1752 my_flop_rate = real(dbcsr_nflop, dp)/(1.0e09_dp*dbcsr_time)
1753 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(/T3,A,T73,ES8.2)") &
1754 "PERFORMANCE| DBCSR total number of flops:", real(dbcsr_nflop*para_env%num_pe, dp)
1755 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.2)") &
1756 "PERFORMANCE| DBCSR total execution time:", dbcsr_time
1757 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.2)") &
1758 "PERFORMANCE| DBCSR flop rate (Gflops / MPI rank):", my_flop_rate
1762 CALL dgemm_counter_write(dgemm_counter, para_env)
1771 CALL compute_qp_energies(vec_sigma_c_gw, count_ev_sc_gw, gw_corr_lev_occ, &
1772 gw_corr_lev_tot, gw_corr_lev_virt, homo, &
1773 nmo, num_fit_points, num_integ_points, &
1774 unit_nr, do_apply_ic_corr_to_gw, do_im_time, &
1775 do_periodic, do_ri_sigma_x, first_cycle_periodic_correction, &
1776 e_fermi, eps_filter, fermi_level_offset, &
1777 delta_corr, eigenval, &
1778 eigenval_last, eigenval_scf, iter_sc_gw0, exit_ev_gw, tau_tj, tj, &
1779 vec_omega_fit_gw, vec_sigma_x_gw, mp2_env%ri_g0w0%ic_corr_list, &
1780 weights_cos_tf_t_to_w, weights_sin_tf_t_to_w, &
1781 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, fm_mo_coeff_occ, &
1782 fm_mo_coeff_virt, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, &
1783 mo_coeff(1), fm_mat_w, para_env, para_env_rpa, mat_dm, mat_minvvminv, &
1784 t_3c_o, t_3c_m, t_3c_overl_int_ao_mo, t_3c_o_compressed, t_3c_o_mo_compressed, &
1785 t_3c_o_ind, t_3c_o_mo_ind, &
1786 t_3c_overl_int_gw_ri, t_3c_overl_int_gw_ao, &
1787 matrix_berry_im_mo_mo, matrix_berry_re_mo_mo, mat_w, matrix_s, &
1788 kpoints, mp2_env, qs_env, nkp_self_energy, do_kpoints_cubic_rpa, &
1789 starts_array_mc, ends_array_mc)
1792 IF (exit_ev_gw)
EXIT
1798 IF (do_ic_model)
THEN
1800 IF (my_open_shell)
THEN
1802 CALL calculate_ic_correction(eigenval(:, 1, 1), mat_minvvminv%matrix, &
1803 t_3c_overl_nnp_ic(1), t_3c_overl_nnp_ic_reflected(1), &
1805 gw_corr_lev_occ(1), gw_corr_lev_virt(1), homo(1), unit_nr, &
1806 print_ic_values, para_env, do_alpha=.true.)
1808 CALL calculate_ic_correction(eigenval(:, 1, 2), mat_minvvminv%matrix, &
1809 t_3c_overl_nnp_ic(2), t_3c_overl_nnp_ic_reflected(2), &
1811 gw_corr_lev_occ(2), gw_corr_lev_virt(2), homo(2), unit_nr, &
1812 print_ic_values, para_env, do_beta=.true.)
1816 CALL calculate_ic_correction(eigenval(:, 1, 1), mat_minvvminv%matrix, &
1817 t_3c_overl_nnp_ic(1), t_3c_overl_nnp_ic_reflected(1), &
1819 gw_corr_lev_occ(1), gw_corr_lev_virt(1), homo(1), unit_nr, &
1820 print_ic_values, para_env)
1830 IF (mp2_env%ri_g0w0%iter_evGW > 1)
THEN
1831 IF (unit_nr > 0)
THEN
1832 CALL cp_warn(__location__, &
1833 "BSE@evGW applies W0, i.e. screening with DFT energies to the BSE!")
1837 CALL cp_fm_create(fm_mat_s_ia_bse, fm_mat_s(1)%matrix_struct)
1838 CALL cp_fm_to_fm(fm_mat_s(1), fm_mat_s_ia_bse)
1840 IF (iter_sc_gw0 == 1)
THEN
1841 CALL remove_scaling_factor_rpa(fm_mat_s_ia_bse, virtual(1), &
1842 eigenval_last(:, 1, 1), homo(1), omega)
1844 CALL remove_scaling_factor_rpa(fm_mat_s_ia_bse, virtual(1), &
1845 eigenval_scf(:, 1, 1), homo(1), omega)
1848 CALL start_bse_calculation(fm_mat_s_ia_bse, fm_mat_s_ij_bse, fm_mat_s_ab_bse, &
1849 fm_mat_q_static_bse_gemm, &
1850 eigenval, eigenval_scf, &
1851 homo, virtual, dimen_ri, dimen_ri_red, bse_lev_virt, &
1852 gd_array, color_sub, mp2_env, qs_env, mo_coeff, unit_nr)
1854 CALL cp_fm_release(fm_mat_s_ia_bse)
1858 CALL deallocate_matrices_gw(fm_mat_s_gw_work, vec_w_gw, vec_sigma_c_gw, vec_omega_fit_gw, &
1859 mp2_env%ri_g0w0%vec_Sigma_x_minus_vxc_gw, &
1860 eigenval_last, eigenval_scf, do_periodic, matrix_berry_re_mo_mo, matrix_berry_im_mo_mo, &
1861 kpoints, vec_sigma_x_gw,.NOT. do_im_time)
1864 IF (do_im_time)
THEN
1866 CALL dealloc_im_time(fm_mo_coeff_occ, fm_mo_coeff_virt, &
1867 fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, index_to_cell_3c, &
1868 cell_to_index_3c, do_ic_model, &
1869 do_kpoints_cubic_rpa, do_kpoints_from_gamma, do_ri_sigma_x, &
1871 wkp_w, cfm_mat_q, fm_mat_minv_l_kpoints, fm_mat_l_kpoints, &
1872 fm_matrix_minv, fm_matrix_minv_vtrunc_minv, fm_mat_ri_global_work, fm_mat_work, &
1873 fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, mat_dm, mat_l, &
1874 mat_minvvminv, mat_p_omega, mat_p_omega_kp, &
1875 t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, mat_work, qs_env)
1878 CALL deallocate_matrices_gw_im_time(weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, do_ic_model, &
1879 do_kpoints_cubic_rpa, fm_mat_w, &
1880 t_3c_overl_int_ao_mo, t_3c_o_mo_compressed, t_3c_o_mo_ind, &
1881 t_3c_overl_int_gw_ri, t_3c_overl_int_gw_ao, &
1882 t_3c_overl_nnp_ic, t_3c_overl_nnp_ic_reflected, &
1888 IF (.NOT. do_im_time .AND. .NOT. do_ri_sos_laplace_mp2)
CALL exchange_work%release()
1890 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1893 DEALLOCATE (trace_qomega)
1896 IF (do_im_time .OR. do_ri_sos_laplace_mp2)
THEN
1901 IF (do_im_time .AND. calc_forces)
THEN
1902 CALL im_time_force_release(force_data)
1905 IF (calc_forces .AND. .NOT. do_im_time)
CALL rpa_grad_finalize(
rpa_grad, mp2_env, para_env_sub, para_env, &
1906 qs_env, gd_array, color_sub, do_ri_sos_laplace_mp2, &
1909 CALL timestop(handle)
1911 END SUBROUTINE rpa_num_int
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public wilhelm2016b
integer, save, public delben2015
integer, save, public wilhelm2016a
integer, save, public wilhelm2018
integer, save, public delben2013
integer, save, public ren2013
integer, save, public wilhelm2017
integer, save, public ren2011
integer, save, public gruneis2009
integer, save, public freeman1977
integer, save, public bates2013
Main routines for GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public start_bse_calculation(fm_mat_s_ia_bse, fm_mat_s_ij_bse, fm_mat_s_ab_bse, fm_mat_q_static_bse_gemm, eigenval, eigenval_scf, homo, virtual, dimen_ri, dimen_ri_red, bse_lev_virt, gd_array, color_sub, mp2_env, qs_env, mo_coeff, unit_nr)
Main subroutine managing BSE calculations.
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 dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_clear(matrix)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
basic linear algebra operations for full matrices
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
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_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_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.
elemental subroutine, public dgemm_counter_init(dgemm_counter, unit_nr, print_info)
Initialize a dgemm_counter.
subroutine, public dgemm_counter_write(dgemm_counter, para_env)
calculate and print flop rates
Types to describe group distributions.
elemental integer function, public maxsize(this)
...
Types and set/get functions for HFX.
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
Types and basic routines needed for a kpoint calculation.
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_memory(mem)
Returns the total amount of memory [bytes] in use, if known, zero otherwise.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
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 the minimax coefficients in order to approximate 1/x as a sum over exponential ...
subroutine, public check_exp_minimax_range(k, rc, ierr)
Check that a minimax approximation is available for given input k, Rc. ierr == 0: everything ok ierr ...
Routines to calculate frequency and time grids (integration points and weights) for correlation metho...
subroutine, public init_greenx_grids(qs_env, para_env, homo, eigenval, do_ri_sos_laplace_mp2, do_kpoints_cubic_rpa, emin, emax, e_fermi)
returns minimal and maximal energy values for the E_range for the minimax grid selection
subroutine, public get_minimax_grid(para_env, unit_nr, homo, eigenval, num_integ_points, do_im_time, do_ri_sos_laplace_mp2, do_print, tau_tj, tau_wj, qs_env, do_gw_im_time, do_kpoints_cubic_rpa, e_fermi, tj, wj, weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, regularization)
...
subroutine, public get_clenshaw_grid(para_env, para_env_rpa, unit_nr, homo, virtual, eigenval, num_integ_points, num_integ_group, color_rpa_group, fm_mat_s, my_do_gw, ext_scaling, a_scaling, tj, wj)
...
Routines to calculate MP2 energy with laplace approach.
subroutine, public sos_mp2_postprocessing(fm_mat_q, erpa, tau_wjquad)
...
Routines for calculating RI-MP2 gradients.
subroutine, public array2fm(mat2d, fm_struct, my_start_row, my_end_row, my_start_col, my_end_col, gd_row, gd_col, group_grid_2_mepos, ngroup_row, ngroup_col, fm_mat, integ_group_size, color_group, do_release_mat)
redistribute local part of array to fm
Types needed for MP2 calculations.
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_pp, 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, harris_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, eeq, rhs)
Get the QUICKSTEP environment.
Auxiliary routines needed for RPA-exchange given blacs_env to another.
subroutine, public rpa_exchange_needed_mem(mp2_env, homo, virtual, dimen_ri, para_env, mem_per_rank, mem_per_repl)
...
Routines to calculate RI-RPA and SOS-MP2 gradients.
subroutine, public rpa_grad_finalize(rpa_grad, mp2_env, para_env_sub, para_env, qs_env, gd_array, color_sub, do_ri_sos_laplace_mp2, homo, virtual)
...
subroutine, public rpa_grad_copy_q(fm_mat_q, rpa_grad)
...
pure subroutine, public rpa_grad_needed_mem(homo, virtual, dimen_ri, mem_per_rank, mem_per_repl, do_ri_sos_laplace_mp2)
Calculates the necessary minimum memory for the Gradient code ion MiB.
subroutine, public rpa_grad_create(rpa_grad, fm_mat_q, fm_mat_s, homo, virtual, mp2_env, eigenval, unit_nr, do_ri_sos_laplace_mp2)
Creates the arrays of a rpa_grad_type.
subroutine, public rpa_grad_matrix_operations(mp2_env, rpa_grad, do_ri_sos_laplace_mp2, fm_mat_q, fm_mat_q_gemm, dgemm_counter, fm_mat_s, omega, homo, virtual, eigenval, weight, unit_nr)
...
Routines to calculate image charge corrections.
subroutine, public calculate_ic_correction(eigenval, mat_sinvvsinv, t_3c_overl_nnp_ic, t_3c_overl_nnp_ic_reflected, gw_corr_lev_tot, gw_corr_lev_occ, gw_corr_lev_virt, homo, unit_nr, print_ic_values, para_env, do_alpha, do_beta)
...
Routines treating GW and RPA calculations with kpoints.
subroutine, public invert_eps_compute_w_and_erpa_kp(dimen_ri, num_integ_points, jquad, nkp, count_ev_sc_gw, para_env, erpa, tau_tj, tj, wj, weights_cos_tf_w_to_t, wkp_w, do_gw_im_time, do_ri_sigma_x, do_kpoints_from_gamma, cfm_mat_q, ikp_local, mat_p_omega, mat_p_omega_kp, qs_env, eps_filter_im_time, unit_nr, kpoints, fm_mat_minv_l_kpoints, fm_matrix_l_kpoints, fm_mat_w, fm_mat_ri_global_work, mat_minvvminv, fm_matrix_minv, fm_matrix_minv_vtrunc_minv)
...
subroutine, public get_bandstruc_and_k_dependent_mos(qs_env, eigenval_kp)
...
Routines for GW, continuous development [Jan Wilhelm].
subroutine, public deallocate_matrices_gw(fm_mat_s_gw_work, vec_w_gw, vec_sigma_c_gw, vec_omega_fit_gw, vec_sigma_x_minus_vxc_gw, eigenval_last, eigenval_scf, do_periodic, matrix_berry_re_mo_mo, matrix_berry_im_mo_mo, kpoints, vec_sigma_x_gw, my_do_gw)
...
subroutine, public allocate_matrices_gw(vec_sigma_c_gw, color_rpa_group, dimen_nm_gw, gw_corr_lev_occ, gw_corr_lev_virt, homo, nmo, num_integ_group, num_integ_points, unit_nr, gw_corr_lev_tot, num_fit_points, omega_max_fit, do_minimax_quad, do_periodic, do_ri_sigma_x, my_do_gw, first_cycle_periodic_correction, a_scaling, eigenval, tj, vec_omega_fit_gw, vec_sigma_x_gw, delta_corr, eigenval_last, eigenval_scf, vec_w_gw, fm_mat_s_gw, fm_mat_s_gw_work, para_env, mp2_env, kpoints, nkp, nkp_self_energy, do_kpoints_cubic_rpa, do_kpoints_from_gamma)
...
subroutine, public compute_gw_self_energy(vec_sigma_c_gw, dimen_nm_gw, dimen_ri, gw_corr_lev_occ, gw_corr_lev_virt, homo, jquad, nmo, num_fit_points, do_im_time, do_periodic, first_cycle_periodic_correction, fermi_level_offset, omega, eigenval, delta_corr, vec_omega_fit_gw, vec_w_gw, wj, fm_mat_q, fm_mat_r_gw, fm_mat_s_gw, fm_mat_s_gw_work, mo_coeff, para_env, para_env_rpa, matrix_berry_im_mo_mo, matrix_berry_re_mo_mo, kpoints, qs_env, mp2_env)
...
subroutine, public get_fermi_level_offset(fermi_level_offset, fermi_level_offset_input, eigenval, homo)
...
subroutine, public allocate_matrices_gw_im_time(gw_corr_lev_occ, gw_corr_lev_virt, homo, nmo, num_integ_points, unit_nr, ri_blk_sizes, do_ic_model, para_env, fm_mat_w, fm_mat_q, mo_coeff, t_3c_overl_int_ao_mo, t_3c_o_mo_compressed, t_3c_o_mo_ind, t_3c_overl_int_gw_ri, t_3c_overl_int_gw_ao, starts_array_mc, ends_array_mc, t_3c_overl_nnp_ic, t_3c_overl_nnp_ic_reflected, matrix_s, mat_w, t_3c_overl_int, t_3c_o_compressed, t_3c_o_ind, qs_env)
...
subroutine, public deallocate_matrices_gw_im_time(weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, do_ic_model, do_kpoints_cubic_rpa, fm_mat_w, t_3c_overl_int_ao_mo, t_3c_o_mo_compressed, t_3c_o_mo_ind, t_3c_overl_int_gw_ri, t_3c_overl_int_gw_ao, t_3c_overl_nnp_ic, t_3c_overl_nnp_ic_reflected, mat_w, qs_env)
...
subroutine, public compute_qp_energies(vec_sigma_c_gw, count_ev_sc_gw, gw_corr_lev_occ, gw_corr_lev_tot, gw_corr_lev_virt, homo, nmo, num_fit_points, num_integ_points, unit_nr, do_apply_ic_corr_to_gw, do_im_time, do_periodic, do_ri_sigma_x, first_cycle_periodic_correction, e_fermi, eps_filter, fermi_level_offset, delta_corr, eigenval, eigenval_last, eigenval_scf, iter_sc_gw0, exit_ev_gw, tau_tj, tj, vec_omega_fit_gw, vec_sigma_x_gw, ic_corr_list, weights_cos_tf_t_to_w, weights_sin_tf_t_to_w, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, fm_mo_coeff_occ, fm_mo_coeff_virt, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, mo_coeff, fm_mat_w, para_env, para_env_rpa, mat_dm, mat_minvvminv, t_3c_o, t_3c_m, t_3c_overl_int_ao_mo, t_3c_o_compressed, t_3c_o_mo_compressed, t_3c_o_ind, t_3c_o_mo_ind, t_3c_overl_int_gw_ri, t_3c_overl_int_gw_ao, matrix_berry_im_mo_mo, matrix_berry_re_mo_mo, mat_w, matrix_s, kpoints, mp2_env, qs_env, nkp_self_energy, do_kpoints_cubic_rpa, starts_array_mc, ends_array_mc)
...
subroutine, public compute_w_cubic_gw(fm_mat_w, fm_mat_q, fm_mat_work, dimen_ri, fm_mat_l, num_integ_points, tj, tau_tj, weights_cos_tf_w_to_t, jquad, omega)
...
Routines needed for cubic-scaling RPA and SOS-Laplace-MP2 forces.
subroutine, public calc_laplace_loop_forces(force_data, mat_p_omega, t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, starts_array_mc, ends_array_mc, starts_array_mc_block, ends_array_mc_block, num_integ_points, nmo, eigenval, tau_tj, tau_wj, cut_memory, pspin, qspin, open_shell, unit_nr, dbcsr_time, dbcsr_nflop, mp2_env, qs_env)
Updates the cubic-scaling SOS-Laplace-MP2 contribution to the forces at each quadrature point.
subroutine, public calc_post_loop_forces(force_data, unit_nr, qs_env)
All the forces that can be calculated after the loop on the Laplace quaradture, using terms collected...
subroutine, public calc_rpa_loop_forces(force_data, mat_p_omega, t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, starts_array_mc, ends_array_mc, starts_array_mc_block, ends_array_mc_block, num_integ_points, nmo, eigenval, e_fermi, weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, tj, wj, tau_tj, cut_memory, ispin, open_shell, unit_nr, dbcsr_time, dbcsr_nflop, mp2_env, qs_env)
Updates the cubic-scaling RPA contribution to the forces at each quadrature point....
subroutine, public keep_initial_quad(tj, wj, tau_tj, tau_wj, weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, do_laplace, do_im_time, num_integ_points, unit_nr, qs_env)
Overwrites the "optimal" Laplace quadrature with that of the first step.
subroutine, public init_im_time_forces(force_data, fm_matrix_pq, t_3c_m, unit_nr, mp2_env, qs_env)
Initializes and pre-calculates all needed tensors for the forces.
Types needed for cubic-scaling RPA and SOS-Laplace-MP2 forces.
subroutine, public im_time_force_release(force_data)
Cleans everything up.
Routines for low-scaling RPA/GW with imaginary time.
subroutine, public zero_mat_p_omega(mat_p_omega)
...
subroutine, public compute_mat_p_omega(mat_p_omega, fm_scaled_dm_occ_tau, fm_scaled_dm_virt_tau, fm_mo_coeff_occ, fm_mo_coeff_virt, fm_mo_coeff_occ_scaled, fm_mo_coeff_virt_scaled, mat_p_global, matrix_s, ispin, t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, starts_array_mc, ends_array_mc, starts_array_mc_block, ends_array_mc_block, weights_cos_tf_t_to_w, tj, tau_tj, e_fermi, eps_filter, alpha, eps_filter_im_time, eigenval, nmo, num_integ_points, cut_memory, unit_nr, mp2_env, para_env, qs_env, do_kpoints_from_gamma, index_to_cell_3c, cell_to_index_3c, has_mat_p_blocks, do_ri_sos_laplace_mp2, dbcsr_time, dbcsr_nflop)
...
Routines to calculate RI-RPA energy.
subroutine, public rpa_ri_compute_en(qs_env, erpa, mp2_env, bib_c, bib_c_gw, bib_c_bse_ij, bib_c_bse_ab, para_env, para_env_sub, color_sub, gd_array, gd_b_virtual, gd_b_all, gd_b_occ_bse, gd_b_virt_bse, mo_coeff, fm_matrix_pq, fm_matrix_l_kpoints, fm_matrix_minv_l_kpoints, fm_matrix_minv, fm_matrix_minv_vtrunc_minv, kpoints, eigenval, nmo, homo, dimen_ri, dimen_ri_red, gw_corr_lev_occ, gw_corr_lev_virt, bse_lev_virt, unit_nr, do_ri_sos_laplace_mp2, my_do_gw, do_im_time, do_bse, matrix_s, mat_munu, mat_p_global, t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, starts_array_mc, ends_array_mc, starts_array_mc_block, ends_array_mc_block, calc_forces)
...
Routines to calculate RI-RPA energy and Sigma correction to the RPA energies using the cubic spline b...
subroutine, public rpa_sigma_create(rpa_sigma, sigma_param, fm_mat_q, unit_nr, para_env)
... Collect the Q(w) (fm_mat_Q) matrix to create rpa_sigma a derived type variable....
subroutine, public finalize_rpa_sigma(rpa_sigma, unit_nr, e_sigma_corr, para_env, do_minimax_quad)
... Save the calculated value of E_c correction to the global variable and memory clean.
subroutine, public rpa_sigma_matrix_spectral(rpa_sigma, fm_mat_q, wj, para_env_rpa)
... Diagonalize and store the eigenvalues of fm_mat_Q in rpa_sigmasigma_eigenvalue.
Utility functions for RPA calculations.
subroutine, public compute_erpa_by_freq_int(dimen_ri, trace_qomega, fm_mat_q, para_env_rpa, erpa, wjquad)
...
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 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)
...
subroutine, public calc_mat_q(fm_mat_s, do_ri_sos_laplace_mp2, first_cycle, virtual, eigenval, 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, count_ev_sc_gw)
...
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 remove_scaling_factor_rpa(fm_mat_s, virtual, eigenval_last, homo, omega_old)
...
All kind of helpful little routines.
pure integer function, dimension(2), public get_limit(m, n, me)
divide m entries into n parts, return size of part me
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Represent a complex full matrix.
keeps the information about the structure of a full matrix
Contains information about kpoints.
stores all the informations relevant to an mpi environment