56#include "./base/base_uses.f90"
62 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'gw_small_cell_full_kp'
79 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gw_calc_small_cell_full_kp'
83 CALL timeset(routinen, handle)
90 CALL compute_chi(bs_env)
94 CALL compute_w_real_space(bs_env, qs_env)
101 CALL compute_sigma_x(bs_env, qs_env)
105 CALL compute_sigma_c(bs_env)
108 CALL compute_qp_energies(bs_env)
112 CALL timestop(handle)
120 SUBROUTINE compute_chi(bs_env)
123 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_chi'
125 INTEGER :: cell_dr(3), cell_r1(3), cell_r2(3), &
126 handle, i_cell_delta_r, i_cell_r1, &
127 i_cell_r2, i_t, i_task_delta_r_local, &
129 LOGICAL :: cell_found
130 REAL(kind=
dp) :: t1, tau
131 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: gocc_s, gvir_s, t_chi_r
132 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_gocc, t_gvir
134 CALL timeset(routinen, handle)
136 DO i_t = 1, bs_env%num_time_freq_points
138 CALL dbt_create_2c_r(gocc_s, bs_env%t_G, bs_env%nimages_scf_desymm)
139 CALL dbt_create_2c_r(gvir_s, bs_env%t_G, bs_env%nimages_scf_desymm)
140 CALL dbt_create_2c_r(t_chi_r, bs_env%t_chi, bs_env%nimages_scf_desymm)
141 CALL dbt_create_3c_r1_r2(t_gocc, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
142 CALL dbt_create_3c_r1_r2(t_gvir, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
145 tau = bs_env%imag_time_points(i_t)
147 DO ispin = 1, bs_env%n_spin
154 CALL g_occ_vir(bs_env, tau, gocc_s, ispin, occ=.true., vir=.false.)
155 CALL g_occ_vir(bs_env, tau, gvir_s, ispin, occ=.false., vir=.true.)
158 DO i_task_delta_r_local = 1, bs_env%n_tasks_Delta_R_local
160 IF (bs_env%skip_DR_chi(i_task_delta_r_local)) cycle
162 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
164 DO i_cell_r2 = 1, bs_env%nimages_3c
166 cell_r2(1:3) = bs_env%index_to_cell_3c(i_cell_r2, 1:3)
167 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(i_cell_delta_r, 1:3)
170 CALL add_r(cell_r2, cell_dr, bs_env%index_to_cell_3c, cell_r1, &
171 cell_found, bs_env%cell_to_index_3c, i_cell_r1)
174 IF (.NOT. cell_found) cycle
176 CALL g_times_3c(gocc_s, t_gocc, bs_env, i_cell_r1, i_cell_r2, &
177 i_task_delta_r_local, bs_env%skip_DR_R12_S_Goccx3c_chi)
178 CALL g_times_3c(gvir_s, t_gvir, bs_env, i_cell_r2, i_cell_r1, &
179 i_task_delta_r_local, bs_env%skip_DR_R12_S_Gvirx3c_chi)
184 CALL contract_m_occ_vir_to_chi(t_gocc, t_gvir, t_chi_r, bs_env, &
185 i_task_delta_r_local)
191 CALL bs_env%para_env%sync()
194 bs_env%mat_RI_RI_tensor, bs_env)
196 CALL destroy_t_1d(gocc_s)
197 CALL destroy_t_1d(gvir_s)
198 CALL destroy_t_1d(t_chi_r)
199 CALL destroy_t_2d(t_gocc)
200 CALL destroy_t_2d(t_gvir)
202 IF (bs_env%unit_nr > 0)
THEN
203 WRITE (bs_env%unit_nr,
'(T2,A,I13,A,I3,A,F7.1,A)') &
204 χτ
'Computed ^R(i) for time point', i_t,
' /', bs_env%num_time_freq_points, &
210 CALL timestop(handle)
212 END SUBROUTINE compute_chi
220 SUBROUTINE dbt_create_2c_r(R, template, nimages)
222 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: r
223 TYPE(dbt_type) :: template
226 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dbt_create_2c_R'
228 INTEGER :: handle, i_cell_s
230 CALL timeset(routinen, handle)
232 ALLOCATE (r(nimages))
233 DO i_cell_s = 1, nimages
234 CALL dbt_create(template, r(i_cell_s))
237 CALL timestop(handle)
239 END SUBROUTINE dbt_create_2c_r
248 SUBROUTINE dbt_create_3c_r1_r2(t_3c_R1_R2, t_3c_template, nimages_1, nimages_2)
250 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_3c_r1_r2
251 TYPE(dbt_type) :: t_3c_template
252 INTEGER :: nimages_1, nimages_2
254 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dbt_create_3c_R1_R2'
256 INTEGER :: handle, i_cell, j_cell
258 CALL timeset(routinen, handle)
260 ALLOCATE (t_3c_r1_r2(nimages_1, nimages_2))
261 DO i_cell = 1, nimages_1
262 DO j_cell = 1, nimages_2
263 CALL dbt_create(t_3c_template, t_3c_r1_r2(i_cell, j_cell))
267 CALL timestop(handle)
269 END SUBROUTINE dbt_create_3c_r1_r2
281 SUBROUTINE g_times_3c(t_G_S, t_M, bs_env, i_cell_R1, i_cell_R2, i_task_Delta_R_local, &
283 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_g_s
284 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_m
286 INTEGER :: i_cell_r1, i_cell_r2, &
288 LOGICAL,
ALLOCATABLE,
DIMENSION(:, :, :) :: skip_dr_r1_s_gx3c
290 CHARACTER(LEN=*),
PARAMETER :: routinen =
'G_times_3c'
292 INTEGER :: handle, i_cell_r1_p_s, i_cell_s
293 INTEGER(KIND=int_8) :: flop
294 INTEGER,
DIMENSION(3) :: cell_r1, cell_r1_plus_cell_s, cell_r2, &
296 LOGICAL :: cell_found
297 TYPE(dbt_type) :: t_3c_int
299 CALL timeset(routinen, handle)
301 CALL dbt_create(bs_env%t_RI_AO__AO, t_3c_int)
303 cell_r1(1:3) = bs_env%index_to_cell_3c(i_cell_r1, 1:3)
304 cell_r2(1:3) = bs_env%index_to_cell_3c(i_cell_r2, 1:3)
306 DO i_cell_s = 1, bs_env%nimages_scf_desymm
308 IF (skip_dr_r1_s_gx3c(i_task_delta_r_local, i_cell_r1, i_cell_s)) cycle
310 cell_s(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(i_cell_s, 1:3)
311 cell_r1_plus_cell_s(1:3) = cell_r1(1:3) + cell_s(1:3)
315 IF (.NOT. cell_found) cycle
317 i_cell_r1_p_s = bs_env%cell_to_index_3c(cell_r1_plus_cell_s(1), cell_r1_plus_cell_s(2), &
318 cell_r1_plus_cell_s(3))
320 IF (bs_env%nblocks_3c(i_cell_r2, i_cell_r1_p_s) == 0) cycle
322 CALL get_t_3c_int(t_3c_int, bs_env, i_cell_r2, i_cell_r1_p_s)
324 CALL dbt_contract(alpha=1.0_dp, &
326 tensor_2=t_g_s(i_cell_s), &
328 tensor_3=t_m(i_cell_r1, i_cell_r2), &
329 contract_1=[3], notcontract_1=[1, 2], map_1=[1, 2], &
330 contract_2=[2], notcontract_2=[1], map_2=[3], &
331 filter_eps=bs_env%eps_filter, flop=flop)
333 IF (flop == 0_int_8) skip_dr_r1_s_gx3c(i_task_delta_r_local, i_cell_r1, i_cell_s) = .true.
337 CALL dbt_destroy(t_3c_int)
339 CALL timestop(handle)
341 END SUBROUTINE g_times_3c
350 SUBROUTINE get_t_3c_int(t_3c_int, bs_env, j_cell, k_cell)
352 TYPE(dbt_type) :: t_3c_int
354 INTEGER :: j_cell, k_cell
356 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_t_3c_int'
360 CALL timeset(routinen, handle)
362 CALL dbt_clear(t_3c_int)
363 IF (j_cell < k_cell)
THEN
364 CALL dbt_copy(bs_env%t_3c_int(k_cell, j_cell), t_3c_int, order=[1, 3, 2])
366 CALL dbt_copy(bs_env%t_3c_int(j_cell, k_cell), t_3c_int)
369 CALL timestop(handle)
371 END SUBROUTINE get_t_3c_int
382 SUBROUTINE g_occ_vir(bs_env, tau, G_S, ispin, occ, vir)
385 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: g_s
389 CHARACTER(LEN=*),
PARAMETER :: routinen =
'G_occ_vir'
391 INTEGER :: handle, homo, i_cell_s, ikp, j, &
392 j_col_local, n_mo, ncol_local, &
394 INTEGER,
DIMENSION(:),
POINTER :: col_indices
395 REAL(kind=
dp) :: tau_e
397 CALL timeset(routinen, handle)
399 cpassert(occ .NEQV. vir)
402 ncol_local=ncol_local, &
403 col_indices=col_indices)
405 nkp = bs_env%nkp_scf_desymm
406 nimages = bs_env%nimages_scf_desymm
408 homo = bs_env%n_occ(ispin)
410 DO i_cell_s = 1, bs_env%nimages_scf_desymm
417 CALL cp_cfm_to_cfm(bs_env%cfm_mo_coeff_kp(ikp, ispin), bs_env%cfm_work_mo)
420 DO j_col_local = 1, ncol_local
422 j = col_indices(j_col_local)
425 tau_e = abs(tau*0.5_dp*(bs_env%eigenval_scf(j, ikp, ispin) - bs_env%e_fermi(ispin)))
427 IF (tau_e < bs_env%stabilize_exp)
THEN
428 bs_env%cfm_work_mo%local_data(:, j_col_local) = &
429 bs_env%cfm_work_mo%local_data(:, j_col_local)*exp(-tau_e)
431 bs_env%cfm_work_mo%local_data(:, j_col_local) =
z_zero
434 IF ((occ .AND. j > homo) .OR. (vir .AND. j <= homo))
THEN
435 bs_env%cfm_work_mo%local_data(:, j_col_local) =
z_zero
441 matrix_a=bs_env%cfm_work_mo, matrix_b=bs_env%cfm_work_mo, &
442 beta=
z_zero, matrix_c=bs_env%cfm_work_mo_2)
446 bs_env%kpoints_scf_desymm, ikp)
451 DO i_cell_s = 1, bs_env%nimages_scf_desymm
453 bs_env%mat_ao_ao_tensor%matrix, g_s(i_cell_s), bs_env)
456 CALL timestop(handle)
458 END SUBROUTINE g_occ_vir
468 SUBROUTINE contract_m_occ_vir_to_chi(t_Gocc, t_Gvir, t_chi_R, bs_env, i_task_Delta_R_local)
469 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_gocc, t_gvir
470 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_chi_r
472 INTEGER :: i_task_delta_r_local
474 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_M_occ_vir_to_chi'
476 INTEGER :: handle, i_cell_delta_r, i_cell_r, &
477 i_cell_r1, i_cell_r1_minus_r, &
478 i_cell_r2, i_cell_r2_minus_r
479 INTEGER(KIND=int_8) :: flop, flop_tmp
480 INTEGER,
DIMENSION(3) :: cell_dr, cell_r, cell_r1, &
481 cell_r1_minus_r, cell_r2, &
483 LOGICAL :: cell_found
484 TYPE(dbt_type) :: t_gocc_2, t_gvir_2
486 CALL timeset(routinen, handle)
488 CALL dbt_create(bs_env%t_RI__AO_AO, t_gocc_2)
489 CALL dbt_create(bs_env%t_RI__AO_AO, t_gvir_2)
494 DO i_cell_r = 1, bs_env%nimages_scf_desymm
496 DO i_cell_r2 = 1, bs_env%nimages_3c
498 IF (bs_env%skip_DR_R_R2_MxM_chi(i_task_delta_r_local, i_cell_r2, i_cell_r)) cycle
500 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
502 cell_r(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(i_cell_r, 1:3)
503 cell_r2(1:3) = bs_env%index_to_cell_3c(i_cell_r2, 1:3)
504 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(i_cell_delta_r, 1:3)
507 CALL add_r(cell_r2, cell_dr, bs_env%index_to_cell_3c, cell_r1, &
508 cell_found, bs_env%cell_to_index_3c, i_cell_r1)
509 IF (.NOT. cell_found) cycle
512 CALL add_r(cell_r1, -cell_r, bs_env%index_to_cell_3c, cell_r1_minus_r, &
513 cell_found, bs_env%cell_to_index_3c, i_cell_r1_minus_r)
514 IF (.NOT. cell_found) cycle
517 CALL add_r(cell_r2, -cell_r, bs_env%index_to_cell_3c, cell_r2_minus_r, &
518 cell_found, bs_env%cell_to_index_3c, i_cell_r2_minus_r)
519 IF (.NOT. cell_found) cycle
522 CALL dbt_copy(t_gocc(i_cell_r1, i_cell_r2), t_gocc_2, order=[1, 3, 2])
523 CALL dbt_copy(t_gvir(i_cell_r2_minus_r, i_cell_r1_minus_r), t_gvir_2)
526 CALL dbt_contract(alpha=bs_env%spin_degeneracy, &
527 tensor_1=t_gocc_2, tensor_2=t_gvir_2, &
528 beta=1.0_dp, tensor_3=t_chi_r(i_cell_r), &
529 contract_1=[2, 3], notcontract_1=[1], map_1=[1], &
530 contract_2=[2, 3], notcontract_2=[1], map_2=[2], &
531 filter_eps=bs_env%eps_filter, move_data=.true., flop=flop_tmp)
533 IF (flop_tmp == 0_int_8) bs_env%skip_DR_R_R2_MxM_chi(i_task_delta_r_local, &
534 i_cell_r2, i_cell_r) = .true.
536 flop = flop + flop_tmp
542 IF (flop == 0_int_8) bs_env%skip_DR_chi(i_task_delta_r_local) = .true.
545 DO i_cell_r1 = 1, bs_env%nimages_3c
546 DO i_cell_r2 = 1, bs_env%nimages_3c
547 CALL dbt_clear(t_gocc(i_cell_r1, i_cell_r2))
548 CALL dbt_clear(t_gvir(i_cell_r1, i_cell_r2))
552 CALL dbt_destroy(t_gocc_2)
553 CALL dbt_destroy(t_gvir_2)
555 CALL timestop(handle)
557 END SUBROUTINE contract_m_occ_vir_to_chi
564 SUBROUTINE compute_w_real_space(bs_env, qs_env)
568 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_W_real_space'
570 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: chi_k_w, eps_k_w, w_k_w, work
571 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_inv, m_inv_v_sqrt, v_sqrt
572 INTEGER :: handle, i_t, ikp, ikp_local, j_w, n_ri, &
574 REAL(kind=
dp) :: freq_j, t1, time_i, weight_ij
575 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: chi_r, mwm_r, w_r
577 CALL timeset(routinen, handle)
580 nimages_scf_desymm = bs_env%nimages_scf_desymm
582 ALLOCATE (chi_k_w(n_ri, n_ri), work(n_ri, n_ri), eps_k_w(n_ri, n_ri), w_k_w(n_ri, n_ri))
583 ALLOCATE (chi_r(n_ri, n_ri, nimages_scf_desymm), w_r(n_ri, n_ri, nimages_scf_desymm), &
584 mwm_r(n_ri, n_ri, nimages_scf_desymm))
588 CALL compute_minv_and_vsqrt(bs_env, qs_env, m_inv_v_sqrt, m_inv, v_sqrt)
590 IF (bs_env%unit_nr > 0)
THEN
591 WRITE (bs_env%unit_nr,
'(T2,A,T58,A,F7.1,A)') &
592 'Computed V_PQ(k),',
'Execution time',
m_walltime() - t1,
' s'
593 WRITE (bs_env%unit_nr,
'(A)')
' '
598 DO j_w = 1, bs_env%num_time_freq_points
601 chi_r(:, :, :) = 0.0_dp
602 DO i_t = 1, bs_env%num_time_freq_points
603 freq_j = bs_env%imag_freq_points(j_w)
604 time_i = bs_env%imag_time_points(i_t)
605 weight_ij = bs_env%weights_cos_t_to_w(j_w, i_t)*cos(time_i*freq_j)
611 w_r(:, :, :) = 0.0_dp
612 DO ikp = 1, bs_env%nkp_chi_eps_W_orig_plus_extra
615 IF (
modulo(ikp, bs_env%para_env%num_pe) .NE. bs_env%para_env%mepos) cycle
617 ikp_local = ikp_local + 1
620 CALL trafo_rs_to_ikp(chi_r, chi_k_w, bs_env%kpoints_scf_desymm%index_to_cell, &
621 bs_env%kpoints_chi_eps_W%xkp(1:3, ikp))
624 CALL power(chi_k_w, 1.0_dp, bs_env%eps_eigval_mat_RI)
629 CALL zgemm(
'N',
'N', n_ri, n_ri, n_ri,
z_one, chi_k_w, n_ri, &
630 m_inv_v_sqrt(:, :, ikp_local), n_ri,
z_zero, work, n_ri)
633 CALL zgemm(
'C',
'N', n_ri, n_ri, n_ri,
z_one, m_inv_v_sqrt(:, :, ikp_local), n_ri, &
634 work, n_ri,
z_zero, eps_k_w, n_ri)
637 CALL add_on_diag(eps_k_w,
z_one)
642 CALL power(eps_k_w, -1.0_dp, 0.0_dp)
645 CALL add_on_diag(eps_k_w, -
z_one)
648 CALL zgemm(
'N',
'C', n_ri, n_ri, n_ri,
z_one, eps_k_w, n_ri, &
649 v_sqrt(:, :, ikp_local), n_ri,
z_zero, work, n_ri)
652 CALL zgemm(
'N',
'N', n_ri, n_ri, n_ri,
z_one, v_sqrt(:, :, ikp_local), n_ri, &
653 work, n_ri,
z_zero, w_k_w, n_ri)
657 index_to_cell_ext=bs_env%kpoints_scf_desymm%index_to_cell)
661 CALL bs_env%para_env%sync()
662 CALL bs_env%para_env%sum(w_r)
666 CALL mult_w_with_minv(w_r, mwm_r, bs_env, qs_env)
669 DO i_t = 1, bs_env%num_time_freq_points
670 freq_j = bs_env%imag_freq_points(j_w)
671 time_i = bs_env%imag_time_points(i_t)
672 weight_ij = bs_env%weights_cos_w_to_t(i_t, j_w)*cos(time_i*freq_j)
678 IF (bs_env%unit_nr > 0)
THEN
679 WRITE (bs_env%unit_nr,
'(T2,A,T60,A,F7.1,A)') &
680 ωτ
'Computed W_PQ(k,i) for all k and ,',
'Execution time',
m_walltime() - t1,
' s'
681 WRITE (bs_env%unit_nr,
'(A)')
' '
684 CALL timestop(handle)
686 END SUBROUTINE compute_w_real_space
696 SUBROUTINE compute_minv_and_vsqrt(bs_env, qs_env, M_inv_V_sqrt, M_inv, V_sqrt)
699 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_inv_v_sqrt, m_inv, v_sqrt
701 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Minv_and_Vsqrt'
703 INTEGER :: handle, ikp, ikp_local, n_ri, nkp, &
705 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_r
707 CALL timeset(routinen, handle)
709 nkp = bs_env%nkp_chi_eps_W_orig_plus_extra
710 nkp_orig = bs_env%nkp_chi_eps_W_orig
716 IF (
modulo(ikp, bs_env%para_env%num_pe) .NE. bs_env%para_env%mepos) cycle
717 nkp_local = nkp_local + 1
720 ALLOCATE (m_inv_v_sqrt(n_ri, n_ri, nkp_local), m_inv(n_ri, n_ri, nkp_local), &
721 v_sqrt(n_ri, n_ri, nkp_local))
723 m_inv_v_sqrt(:, :, :) =
z_zero
728 bs_env%kpoints_chi_eps_W%nkp_grid = bs_env%nkp_grid_chi_eps_W_orig
730 bs_env%size_lattice_sum_V, basis_type=
"RI_AUX", &
731 ikp_start=1, ikp_end=nkp_orig)
734 bs_env%kpoints_chi_eps_W%nkp_grid = bs_env%nkp_grid_chi_eps_W_extra
736 bs_env%size_lattice_sum_V, basis_type=
"RI_AUX", &
737 ikp_start=nkp_orig + 1, ikp_end=nkp)
742 CALL get_v_tr_r(m_r, bs_env%ri_metric, bs_env%regularization_RI, bs_env, qs_env)
748 IF (
modulo(ikp, bs_env%para_env%num_pe) .NE. bs_env%para_env%mepos) cycle
750 ikp_local = ikp_local + 1
754 bs_env%kpoints_scf_desymm%index_to_cell, &
755 bs_env%kpoints_chi_eps_W%xkp(1:3, ikp))
758 CALL power(m_inv(:, :, ikp_local), -1.0_dp, 0.0_dp)
761 CALL power(v_sqrt(:, :, ikp_local), 0.5_dp, 0.0_dp)
764 CALL zgemm(
"N",
"C", n_ri, n_ri, n_ri,
z_one, m_inv(:, :, ikp_local), n_ri, &
765 v_sqrt(:, :, ikp_local), n_ri,
z_zero, m_inv_v_sqrt(:, :, ikp_local), n_ri)
769 CALL timestop(handle)
771 END SUBROUTINE compute_minv_and_vsqrt
778 SUBROUTINE add_on_diag(matrix, alpha)
779 COMPLEX(KIND=dp),
DIMENSION(:, :) :: matrix
780 COMPLEX(KIND=dp) :: alpha
782 CHARACTER(len=*),
PARAMETER :: routinen =
'add_on_diag'
784 INTEGER :: handle, i, n
786 CALL timeset(routinen, handle)
789 cpassert(n ==
SIZE(matrix, 2))
792 matrix(i, i) = matrix(i, i) + alpha
795 CALL timestop(handle)
797 END SUBROUTINE add_on_diag
806 SUBROUTINE mult_w_with_minv(W_R, MWM_R, bs_env, qs_env)
807 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: w_r, mwm_r
811 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mult_W_with_Minv'
813 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: m_inv, w_k, work
814 INTEGER :: handle, ikp, n_ri
815 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_r
817 CALL timeset(routinen, handle)
820 CALL get_v_tr_r(m_r, bs_env%ri_metric, bs_env%regularization_RI, bs_env, qs_env)
823 ALLOCATE (m_inv(n_ri, n_ri), w_k(n_ri, n_ri), work(n_ri, n_ri))
824 mwm_r(:, :, :) = 0.0_dp
826 DO ikp = 1, bs_env%nkp_scf_desymm
829 IF (
modulo(ikp, bs_env%para_env%num_pe) .NE. bs_env%para_env%mepos) cycle
833 bs_env%kpoints_scf_desymm%index_to_cell, &
834 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
837 CALL power(m_inv, -1.0_dp, 0.0_dp)
841 bs_env%kpoints_scf_desymm%index_to_cell, &
842 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
845 CALL zgemm(
"N",
"N", n_ri, n_ri, n_ri,
z_one, m_inv, n_ri, w_k, n_ri,
z_zero, work, n_ri)
848 CALL zgemm(
"N",
"N", n_ri, n_ri, n_ri,
z_one, work, n_ri, m_inv, n_ri,
z_zero, w_k, n_ri)
855 CALL bs_env%para_env%sync()
856 CALL bs_env%para_env%sum(mwm_r)
858 CALL timestop(handle)
860 END SUBROUTINE mult_w_with_minv
867 SUBROUTINE compute_sigma_x(bs_env, qs_env)
871 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_x'
873 INTEGER :: handle, i_task_delta_r_local, ispin
875 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: d_s, mi_vtr_mi_r, sigma_x_r
876 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_v
878 CALL timeset(routinen, handle)
880 CALL dbt_create_2c_r(mi_vtr_mi_r, bs_env%t_W, bs_env%nimages_scf_desymm)
881 CALL dbt_create_2c_r(d_s, bs_env%t_G, bs_env%nimages_scf_desymm)
882 CALL dbt_create_2c_r(sigma_x_r, bs_env%t_G, bs_env%nimages_scf_desymm)
883 CALL dbt_create_3c_r1_r2(t_v, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
890 CALL get_minv_vtr_minv_r(mi_vtr_mi_r, bs_env, qs_env)
894 DO ispin = 1, bs_env%n_spin
898 CALL g_occ_vir(bs_env, 0.0_dp, d_s, ispin, occ=.true., vir=.false.)
901 DO i_task_delta_r_local = 1, bs_env%n_tasks_Delta_R_local
904 CALL contract_w(t_v, mi_vtr_mi_r, bs_env, i_task_delta_r_local)
909 CALL contract_to_sigma(sigma_x_r, t_v, d_s, i_task_delta_r_local, bs_env, &
910 occ=.true., vir=.false., clear_t_w=.true., fill_skip=.false.)
914 CALL bs_env%para_env%sync()
917 bs_env%mat_ao_ao_tensor, bs_env)
921 IF (bs_env%unit_nr > 0)
THEN
922 WRITE (bs_env%unit_nr,
'(T2,A,T58,A,F7.1,A)') &
923 Σ
'Computed ^x,',
' Execution time',
m_walltime() - t1,
' s'
924 WRITE (bs_env%unit_nr,
'(A)')
' '
927 CALL destroy_t_1d(mi_vtr_mi_r)
928 CALL destroy_t_1d(d_s)
929 CALL destroy_t_1d(sigma_x_r)
930 CALL destroy_t_2d(t_v)
932 CALL timestop(handle)
934 END SUBROUTINE compute_sigma_x
940 SUBROUTINE compute_sigma_c(bs_env)
943 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_c'
945 INTEGER :: handle, i_t, i_task_delta_r_local, ispin
946 REAL(kind=
dp) :: t1, tau
947 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: gocc_s, gvir_s, sigma_c_r_neg_tau, &
948 sigma_c_r_pos_tau, w_r
949 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_w
951 CALL timeset(routinen, handle)
953 CALL dbt_create_2c_r(gocc_s, bs_env%t_G, bs_env%nimages_scf_desymm)
954 CALL dbt_create_2c_r(gvir_s, bs_env%t_G, bs_env%nimages_scf_desymm)
955 CALL dbt_create_2c_r(w_r, bs_env%t_W, bs_env%nimages_scf_desymm)
956 CALL dbt_create_3c_r1_r2(t_w, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
957 CALL dbt_create_2c_r(sigma_c_r_neg_tau, bs_env%t_G, bs_env%nimages_scf_desymm)
958 CALL dbt_create_2c_r(sigma_c_r_pos_tau, bs_env%t_G, bs_env%nimages_scf_desymm)
962 DO i_t = 1, bs_env%num_time_freq_points
964 DO ispin = 1, bs_env%n_spin
968 tau = bs_env%imag_time_points(i_t)
973 CALL g_occ_vir(bs_env, tau, gocc_s, ispin, occ=.true., vir=.false.)
974 CALL g_occ_vir(bs_env, tau, gvir_s, ispin, occ=.false., vir=.true.)
977 CALL fm_mwm_r_t_to_local_tensor_w_r(bs_env%fm_MWM_R_t(:, i_t), w_r, bs_env)
980 DO i_task_delta_r_local = 1, bs_env%n_tasks_Delta_R_local
982 IF (bs_env%skip_DR_Sigma(i_task_delta_r_local)) cycle
986 CALL contract_w(t_w, w_r, bs_env, i_task_delta_r_local)
992 CALL contract_to_sigma(sigma_c_r_neg_tau, t_w, gocc_s, i_task_delta_r_local, bs_env, &
993 occ=.true., vir=.false., clear_t_w=.false., fill_skip=.false.)
996 CALL contract_to_sigma(sigma_c_r_pos_tau, t_w, gvir_s, i_task_delta_r_local, bs_env, &
997 occ=.false., vir=.true., clear_t_w=.true., fill_skip=.true.)
1001 CALL bs_env%para_env%sync()
1004 bs_env%fm_Sigma_c_R_pos_tau(:, i_t, ispin), &
1005 bs_env%mat_ao_ao, bs_env%mat_ao_ao_tensor, bs_env)
1008 bs_env%fm_Sigma_c_R_neg_tau(:, i_t, ispin), &
1009 bs_env%mat_ao_ao, bs_env%mat_ao_ao_tensor, bs_env)
1011 IF (bs_env%unit_nr > 0)
THEN
1012 WRITE (bs_env%unit_nr,
'(T2,A,I10,A,I3,A,F7.1,A)') &
1013 Στ
'Computed ^c(i) for time point ', i_t,
' /', bs_env%num_time_freq_points, &
1021 CALL destroy_t_1d(gocc_s)
1022 CALL destroy_t_1d(gvir_s)
1023 CALL destroy_t_1d(w_r)
1024 CALL destroy_t_1d(sigma_c_r_neg_tau)
1025 CALL destroy_t_1d(sigma_c_r_pos_tau)
1026 CALL destroy_t_2d(t_w)
1028 CALL timestop(handle)
1030 END SUBROUTINE compute_sigma_c
1038 SUBROUTINE get_minv_vtr_minv_r(Mi_Vtr_Mi_R, bs_env, qs_env)
1039 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: mi_vtr_mi_r
1043 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_Minv_Vtr_Minv_R'
1045 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: m_inv_v_tr_kp, m_kp, mi_vtr_mi_kp, &
1047 INTEGER :: handle, i_cell_r, ikp, n_ri, &
1048 nimages_scf, nkp_scf
1049 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_r, mi_vtr_mi_r_arr, v_tr_r
1051 CALL timeset(routinen, handle)
1053 nimages_scf = bs_env%nimages_scf_desymm
1054 nkp_scf = bs_env%kpoints_scf_desymm%nkp
1057 CALL get_v_tr_r(v_tr_r, bs_env%trunc_coulomb, 0.0_dp, bs_env, qs_env)
1058 CALL get_v_tr_r(m_r, bs_env%ri_metric, bs_env%regularization_RI, bs_env, qs_env)
1060 ALLOCATE (v_tr_kp(n_ri, n_ri), m_kp(n_ri, n_ri), m_inv_v_tr_kp(n_ri, n_ri), &
1061 mi_vtr_mi_kp(n_ri, n_ri), mi_vtr_mi_r_arr(n_ri, n_ri, nimages_scf))
1062 mi_vtr_mi_r_arr(:, :, :) = 0.0_dp
1066 IF (
modulo(ikp, bs_env%para_env%num_pe) .NE. bs_env%para_env%mepos) cycle
1068 CALL trafo_rs_to_ikp(v_tr_r, v_tr_kp, bs_env%kpoints_scf_desymm%index_to_cell, &
1069 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
1071 CALL trafo_rs_to_ikp(m_r, m_kp, bs_env%kpoints_scf_desymm%index_to_cell, &
1072 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
1074 CALL power(m_kp, -1.0_dp, 0.0_dp)
1076 CALL zgemm(
'N',
'N', n_ri, n_ri, n_ri,
z_one, m_kp, n_ri, &
1077 v_tr_kp, n_ri,
z_zero, m_inv_v_tr_kp, n_ri)
1079 CALL zgemm(
'N',
'N', n_ri, n_ri, n_ri,
z_one, m_inv_v_tr_kp, n_ri, &
1080 m_kp, n_ri,
z_zero, mi_vtr_mi_kp, n_ri)
1082 CALL add_ikp_to_all_rs(mi_vtr_mi_kp, mi_vtr_mi_r_arr, bs_env%kpoints_scf_desymm, ikp)
1084 CALL bs_env%para_env%sync()
1085 CALL bs_env%para_env%sum(mi_vtr_mi_r_arr)
1091 DO i_cell_r = 1, nimages_scf
1093 bs_env%mat_RI_RI_tensor%matrix, mi_vtr_mi_r(i_cell_r), bs_env)
1096 CALL timestop(handle)
1098 END SUBROUTINE get_minv_vtr_minv_r
1104 SUBROUTINE destroy_t_1d(t_1d)
1105 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_1d
1107 CHARACTER(LEN=*),
PARAMETER :: routinen =
'destroy_t_1d'
1109 INTEGER :: handle, i
1111 CALL timeset(routinen, handle)
1113 DO i = 1,
SIZE(t_1d)
1114 CALL dbt_destroy(t_1d(i))
1118 CALL timestop(handle)
1120 END SUBROUTINE destroy_t_1d
1126 SUBROUTINE destroy_t_2d(t_2d)
1127 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_2d
1129 CHARACTER(LEN=*),
PARAMETER :: routinen =
'destroy_t_2d'
1131 INTEGER :: handle, i, j
1133 CALL timeset(routinen, handle)
1135 DO i = 1,
SIZE(t_2d, 1)
1136 DO j = 1,
SIZE(t_2d, 2)
1137 CALL dbt_destroy(t_2d(i, j))
1142 CALL timestop(handle)
1144 END SUBROUTINE destroy_t_2d
1153 SUBROUTINE contract_w(t_W, W_R, bs_env, i_task_Delta_R_local)
1154 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_w
1155 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: w_r
1157 INTEGER :: i_task_delta_r_local
1159 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_W'
1161 INTEGER :: handle, i_cell_delta_r, i_cell_r1, &
1162 i_cell_r2, i_cell_r2_m_r1, i_cell_s1, &
1164 INTEGER,
DIMENSION(3) :: cell_dr, cell_r1, cell_r2, cell_r2_m_r1, &
1165 cell_s1, cell_s1_m_r2_p_r1
1166 LOGICAL :: cell_found
1167 TYPE(dbt_type) :: t_3c_int, t_w_tmp
1169 CALL timeset(routinen, handle)
1171 CALL dbt_create(bs_env%t_RI__AO_AO, t_w_tmp)
1172 CALL dbt_create(bs_env%t_RI_AO__AO, t_3c_int)
1174 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
1176 DO i_cell_r1 = 1, bs_env%nimages_3c
1178 cell_r1(1:3) = bs_env%index_to_cell_3c(i_cell_r1, 1:3)
1179 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(i_cell_delta_r, 1:3)
1182 CALL add_r(cell_r1, cell_dr, bs_env%index_to_cell_3c, cell_s1, &
1183 cell_found, bs_env%cell_to_index_3c, i_cell_s1)
1184 IF (.NOT. cell_found) cycle
1186 DO i_cell_r2 = 1, bs_env%nimages_scf_desymm
1188 cell_r2(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(i_cell_r2, 1:3)
1191 CALL add_r(cell_r2, -cell_r1, bs_env%index_to_cell_3c, cell_r2_m_r1, &
1192 cell_found, bs_env%cell_to_index_3c, i_cell_r2_m_r1)
1193 IF (.NOT. cell_found) cycle
1196 CALL add_r(cell_s1, cell_r2_m_r1, bs_env%index_to_cell_3c, cell_s1_m_r2_p_r1, &
1197 cell_found, bs_env%cell_to_index_3c, i_cell_s1_m_r1_p_r2)
1198 IF (.NOT. cell_found) cycle
1200 CALL get_t_3c_int(t_3c_int, bs_env, i_cell_s1_m_r1_p_r2, i_cell_r2_m_r1)
1205 CALL dbt_contract(alpha=1.0_dp, &
1206 tensor_1=w_r(i_cell_r2), &
1207 tensor_2=t_3c_int, &
1210 contract_1=[1], notcontract_1=[2], map_1=[1], &
1211 contract_2=[1], notcontract_2=[2, 3], map_2=[2, 3], &
1212 filter_eps=bs_env%eps_filter)
1215 CALL dbt_copy(t_w_tmp, t_w(i_cell_s1, i_cell_r1), order=[1, 2, 3], &
1216 move_data=.true., summation=.true.)
1222 CALL dbt_destroy(t_w_tmp)
1223 CALL dbt_destroy(t_3c_int)
1225 CALL timestop(handle)
1227 END SUBROUTINE contract_w
1241 SUBROUTINE contract_to_sigma(Sigma_R, t_W, G_S, i_task_Delta_R_local, bs_env, occ, vir, &
1242 clear_t_W, fill_skip)
1243 TYPE(dbt_type),
DIMENSION(:) :: sigma_r
1244 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_w
1245 TYPE(dbt_type),
DIMENSION(:) :: g_s
1246 INTEGER :: i_task_delta_r_local
1248 LOGICAL :: occ, vir, clear_t_w, fill_skip
1250 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_to_Sigma'
1252 INTEGER :: handle, handle2, i_cell_delta_r, i_cell_m_r1, i_cell_r, i_cell_r1, &
1253 i_cell_r1_minus_r, i_cell_s1, i_cell_s1_minus_r, i_cell_s1_p_s2_m_r1, i_cell_s2
1254 INTEGER(KIND=int_8) :: flop, flop_tmp
1255 INTEGER,
DIMENSION(3) :: cell_dr, cell_m_r1, cell_r, cell_r1, &
1256 cell_r1_minus_r, cell_s1, &
1257 cell_s1_minus_r, cell_s1_p_s2_m_r1, &
1259 LOGICAL :: cell_found
1260 REAL(kind=
dp) :: sign_sigma
1261 TYPE(dbt_type) :: t_3c_int, t_g, t_g_2
1263 CALL timeset(routinen, handle)
1265 cpassert(occ .EQV. (.NOT. vir))
1266 IF (occ) sign_sigma = -1.0_dp
1267 IF (vir) sign_sigma = 1.0_dp
1269 CALL dbt_create(bs_env%t_RI_AO__AO, t_g)
1270 CALL dbt_create(bs_env%t_RI_AO__AO, t_g_2)
1271 CALL dbt_create(bs_env%t_RI_AO__AO, t_3c_int)
1273 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
1277 DO i_cell_r1 = 1, bs_env%nimages_3c
1279 cell_r1(1:3) = bs_env%index_to_cell_3c(i_cell_r1, 1:3)
1280 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(i_cell_delta_r, 1:3)
1283 CALL add_r(cell_r1, cell_dr, bs_env%index_to_cell_3c, cell_s1, cell_found, &
1284 bs_env%cell_to_index_3c, i_cell_s1)
1285 IF (.NOT. cell_found) cycle
1287 DO i_cell_s2 = 1, bs_env%nimages_scf_desymm
1289 IF (bs_env%skip_DR_R1_S2_Gx3c_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_s2)) cycle
1291 cell_s2(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(i_cell_s2, 1:3)
1292 cell_m_r1(1:3) = -cell_r1(1:3)
1293 cell_s1_p_s2_m_r1(1:3) = cell_s1(1:3) + cell_s2(1:3) - cell_r1(1:3)
1296 IF (.NOT. cell_found) cycle
1299 IF (.NOT. cell_found) cycle
1301 i_cell_m_r1 = bs_env%cell_to_index_3c(cell_m_r1(1), cell_m_r1(2), cell_m_r1(3))
1302 i_cell_s1_p_s2_m_r1 = bs_env%cell_to_index_3c(cell_s1_p_s2_m_r1(1), &
1303 cell_s1_p_s2_m_r1(2), &
1304 cell_s1_p_s2_m_r1(3))
1306 CALL timeset(routinen//
"_3c_x_G", handle2)
1308 CALL get_t_3c_int(t_3c_int, bs_env, i_cell_m_r1, i_cell_s1_p_s2_m_r1)
1313 CALL dbt_contract(alpha=1.0_dp, &
1314 tensor_1=g_s(i_cell_s2), &
1315 tensor_2=t_3c_int, &
1318 contract_1=[2], notcontract_1=[1], map_1=[3], &
1319 contract_2=[3], notcontract_2=[1, 2], map_2=[1, 2], &
1320 filter_eps=bs_env%eps_filter, flop=flop_tmp)
1322 IF (flop_tmp == 0_int_8 .AND. fill_skip)
THEN
1323 bs_env%skip_DR_R1_S2_Gx3c_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_s2) = .true.
1326 CALL timestop(handle2)
1330 CALL dbt_copy(t_g, t_g_2, order=[1, 3, 2], move_data=.true.)
1332 CALL timeset(routinen//
"_contract", handle2)
1334 DO i_cell_r = 1, bs_env%nimages_scf_desymm
1336 IF (bs_env%skip_DR_R1_R_MxM_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_r)) cycle
1338 cell_r = bs_env%kpoints_scf_desymm%index_to_cell(i_cell_r, 1:3)
1341 CALL add_r(cell_r1, -cell_r, bs_env%index_to_cell_3c, cell_r1_minus_r, &
1342 cell_found, bs_env%cell_to_index_3c, i_cell_r1_minus_r)
1343 IF (.NOT. cell_found) cycle
1346 CALL add_r(cell_s1, -cell_r, bs_env%index_to_cell_3c, cell_s1_minus_r, &
1347 cell_found, bs_env%cell_to_index_3c, i_cell_s1_minus_r)
1348 IF (.NOT. cell_found) cycle
1353 CALL dbt_contract(alpha=sign_sigma, &
1355 tensor_2=t_w(i_cell_s1_minus_r, i_cell_r1_minus_r), &
1357 tensor_3=sigma_r(i_cell_r), &
1358 contract_1=[1, 2], notcontract_1=[3], map_1=[1], &
1359 contract_2=[1, 2], notcontract_2=[3], map_2=[2], &
1360 filter_eps=bs_env%eps_filter, flop=flop_tmp)
1362 flop = flop + flop_tmp
1364 IF (flop_tmp == 0_int_8 .AND. fill_skip)
THEN
1365 bs_env%skip_DR_R1_R_MxM_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_r) = .true.
1370 CALL dbt_clear(t_g_2)
1372 CALL timestop(handle2)
1376 IF (vir .AND. flop == 0_int_8) bs_env%skip_DR_Sigma(i_task_delta_r_local) = .true.
1380 DO i_cell_s1 = 1, bs_env%nimages_3c
1381 DO i_cell_r1 = 1, bs_env%nimages_3c
1382 CALL dbt_clear(t_w(i_cell_s1, i_cell_r1))
1387 CALL dbt_destroy(t_g)
1388 CALL dbt_destroy(t_g_2)
1389 CALL dbt_destroy(t_3c_int)
1391 CALL timestop(handle)
1393 END SUBROUTINE contract_to_sigma
1401 SUBROUTINE fm_mwm_r_t_to_local_tensor_w_r(fm_W_R, W_R, bs_env)
1403 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: w_r
1406 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fm_MWM_R_t_to_local_tensor_W_R'
1408 INTEGER :: handle, i_cell_r
1410 CALL timeset(routinen, handle)
1413 DO i_cell_r = 1, bs_env%nimages_scf_desymm
1415 bs_env%mat_RI_RI_tensor%matrix, w_r(i_cell_r), bs_env)
1418 CALL timestop(handle)
1420 END SUBROUTINE fm_mwm_r_t_to_local_tensor_w_r
1426 SUBROUTINE compute_qp_energies(bs_env)
1429 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_QP_energies'
1431 INTEGER :: handle, ikp, ispin, j_t
1432 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sigma_x_ikp_n
1433 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: sigma_c_ikp_n_freq, sigma_c_ikp_n_time
1436 CALL timeset(routinen, handle)
1438 CALL cp_cfm_create(cfm_mo_coeff, bs_env%fm_s_Gamma%matrix_struct)
1439 ALLOCATE (sigma_x_ikp_n(bs_env%n_ao))
1440 ALLOCATE (sigma_c_ikp_n_time(bs_env%n_ao, bs_env%num_time_freq_points, 2))
1441 ALLOCATE (sigma_c_ikp_n_freq(bs_env%n_ao, bs_env%num_time_freq_points, 2))
1443 DO ispin = 1, bs_env%n_spin
1445 DO ikp = 1, bs_env%nkp_bs_and_DOS
1448 CALL cp_cfm_to_cfm(bs_env%cfm_mo_coeff_kp(ikp, ispin), cfm_mo_coeff)
1452 CALL trafo_to_k_and_nn(bs_env%fm_Sigma_x_R, sigma_x_ikp_n, cfm_mo_coeff, bs_env, ikp)
1456 DO j_t = 1, bs_env%num_time_freq_points
1457 CALL trafo_to_k_and_nn(bs_env%fm_Sigma_c_R_pos_tau(:, j_t, ispin), &
1458 sigma_c_ikp_n_time(:, j_t, 1), cfm_mo_coeff, bs_env, ikp)
1459 CALL trafo_to_k_and_nn(bs_env%fm_Sigma_c_R_neg_tau(:, j_t, ispin), &
1460 sigma_c_ikp_n_time(:, j_t, 2), cfm_mo_coeff, bs_env, ikp)
1464 CALL time_to_freq(bs_env, sigma_c_ikp_n_time, sigma_c_ikp_n_freq, ispin)
1469 bs_env%v_xc_n(:, ikp, ispin), &
1470 bs_env%eigenval_scf(:, ikp, ispin), ikp, ispin)
1480 CALL timestop(handle)
1482 END SUBROUTINE compute_qp_energies
1492 SUBROUTINE trafo_to_k_and_nn(fm_rs, array_ikp_n, cfm_mo_coeff, bs_env, ikp)
1494 REAL(kind=
dp),
DIMENSION(:) :: array_ikp_n
1499 CHARACTER(LEN=*),
PARAMETER :: routinen =
'trafo_to_k_and_nn'
1501 INTEGER :: handle, n_ao
1505 CALL timeset(routinen, handle)
1509 CALL cp_fm_create(fm_ikp_re, cfm_mo_coeff%matrix_struct)
1528 CALL timestop(handle)
1530 END SUBROUTINE trafo_to_k_and_nn
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
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_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
subroutine, public cp_cfm_to_fm(msource, mtargetr, mtargeti)
Copy real and imaginary parts of a complex full matrix into separate real-value full matrices.
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_diag(matrix, diag)
returns the diagonal elements of a fm
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....
subroutine, public fm_to_local_tensor(fm_global, mat_global, mat_local, tensor, bs_env, atom_ranges)
...
subroutine, public local_dbt_to_global_fm(t_r, fm_r, mat_global, mat_local, bs_env)
...
subroutine, public local_array_to_fm(array_s, fm_s, weight, add)
...
subroutine, public fm_to_local_array(fm_s, array_s, weight, add)
...
subroutine, public add_ikp_to_all_rs(array_kp, array_rs, kpoints, ikp, index_to_cell_ext)
...
subroutine, public fm_trafo_rs_to_ikp(cfm_ikp, fm_rs, kpoints, ikp)
...
subroutine, public fm_add_ikp_to_rs(cfm_ikp, fm_rs, kpoints, ikp)
...
subroutine, public trafo_rs_to_ikp(array_rs, array_kp, index_to_cell, xkp)
...
subroutine, public gw_calc_small_cell_full_kp(qs_env, bs_env)
Perform GW band structure calculation.
subroutine, public get_v_tr_r(v_tr_r, pot_type, regularization_ri, bs_env, qs_env)
...
subroutine, public time_to_freq(bs_env, sigma_c_n_time, sigma_c_n_freq, ispin)
...
subroutine, public de_init_bs_env(bs_env)
...
subroutine, public analyt_conti_and_print(bs_env, sigma_c_ikp_n_freq, sigma_x_ikp_n, v_xc_ikp_n, eigenval_scf, ikp, ispin)
...
subroutine, public add_r(cell_1, cell_2, index_to_cell, cell_1_plus_2, cell_found, cell_to_index, i_cell_1_plus_2)
...
subroutine, public power(matrix, exponent, eps, cond_nr, min_ev, max_ev)
...
subroutine, public is_cell_in_index_to_cell(cell, index_to_cell, cell_found)
...
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
Routines to compute the Coulomb integral V_(alpha beta)(k) for a k-point k using lattice summation in...
subroutine, public build_2c_coulomb_matrix_kp_small_cell(v_k, qs_env, kpoints, size_lattice_sum, basis_type, ikp_start, ikp_end)
...
Machine interface based on Fortran 2003 and POSIX.
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_one
complex(kind=dp), parameter, public z_zero
basic linear algebra operations for full matrixes
subroutine, public get_all_vbm_cbm_bandgaps(bs_env)
...
Represent a complex full matrix.