58#include "./base/base_uses.f90"
64 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'gw_tensor_small_cell_full_kp'
81 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gw_calc_tensor_small_cell_full_kp'
85 CALL timeset(routinen, handle)
94 CALL compute_chi(bs_env)
98 CALL compute_w_real_space(bs_env, qs_env)
105 CALL compute_sigma_x(bs_env, qs_env)
109 CALL compute_sigma_c(bs_env)
112 CALL compute_qp_energies(bs_env)
116 CALL timestop(handle)
124 SUBROUTINE compute_chi(bs_env)
127 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_chi'
129 INTEGER :: cell_dr(3), cell_r1(3), cell_r2(3), &
130 handle, i_cell_delta_r, i_cell_r1, &
131 i_cell_r2, i_t, i_task_delta_r_local, &
133 LOGICAL :: cell_found
134 REAL(kind=
dp) :: t1, tau
135 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: gocc_s, gvir_s, t_chi_r
136 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_gocc, t_gvir
138 CALL timeset(routinen, handle)
140 DO i_t = 1, bs_env%num_time_freq_points
142 CALL dbt_create_2c_r(gocc_s, bs_env%t_G, bs_env%nimages_scf_desymm)
143 CALL dbt_create_2c_r(gvir_s, bs_env%t_G, bs_env%nimages_scf_desymm)
144 CALL dbt_create_2c_r(t_chi_r, bs_env%t_chi, bs_env%nimages_scf_desymm)
145 CALL dbt_create_3c_r1_r2(t_gocc, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
146 CALL dbt_create_3c_r1_r2(t_gvir, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
149 tau = bs_env%time_frequency_grid%imaginary_time(i_t)
151 DO ispin = 1, bs_env%n_spin
158 CALL g_occ_vir(bs_env, tau, gocc_s, ispin, occ=.true., vir=.false.)
159 CALL g_occ_vir(bs_env, tau, gvir_s, ispin, occ=.false., vir=.true.)
162 DO i_task_delta_r_local = 1, bs_env%n_tasks_Delta_R_local
164 IF (bs_env%skip_DR_chi(i_task_delta_r_local)) cycle
166 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
168 DO i_cell_r2 = 1, bs_env%nimages_3c
170 cell_r2(1:3) = bs_env%index_to_cell_3c(1:3, i_cell_r2)
171 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(1:3, i_cell_delta_r)
174 CALL add_r(cell_r2, cell_dr, bs_env%index_to_cell_3c, cell_r1, &
175 cell_found, bs_env%cell_to_index_3c, i_cell_r1)
178 IF (.NOT. cell_found) cycle
180 CALL g_times_3c(gocc_s, t_gocc, bs_env, i_cell_r1, i_cell_r2, &
181 i_task_delta_r_local, bs_env%skip_DR_R12_S_Goccx3c_chi)
182 CALL g_times_3c(gvir_s, t_gvir, bs_env, i_cell_r2, i_cell_r1, &
183 i_task_delta_r_local, bs_env%skip_DR_R12_S_Gvirx3c_chi)
188 CALL contract_m_occ_vir_to_chi(t_gocc, t_gvir, t_chi_r, bs_env, &
189 i_task_delta_r_local)
195 CALL bs_env%para_env%sync()
198 bs_env%mat_RI_RI_tensor, bs_env)
200 CALL destroy_t_1d(gocc_s)
201 CALL destroy_t_1d(gvir_s)
202 CALL destroy_t_1d(t_chi_r)
203 CALL destroy_t_2d(t_gocc)
204 CALL destroy_t_2d(t_gvir)
206 IF (bs_env%unit_nr > 0)
THEN
207 WRITE (bs_env%unit_nr,
'(T2,A,I13,A,I3,A,F7.1,A)') &
208 'Computed χ^R(iτ) for time point', i_t,
' /', bs_env%num_time_freq_points, &
214 CALL timestop(handle)
216 END SUBROUTINE compute_chi
224 SUBROUTINE dbt_create_2c_r(R, template, nimages)
226 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: r
227 TYPE(dbt_type) :: template
230 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dbt_create_2c_R'
232 INTEGER :: handle, i_cell_s
234 CALL timeset(routinen, handle)
236 ALLOCATE (r(nimages))
237 DO i_cell_s = 1, nimages
238 CALL dbt_create(template, r(i_cell_s))
241 CALL timestop(handle)
243 END SUBROUTINE dbt_create_2c_r
252 SUBROUTINE dbt_create_3c_r1_r2(t_3c_R1_R2, t_3c_template, nimages_1, nimages_2)
254 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_3c_r1_r2
255 TYPE(dbt_type) :: t_3c_template
256 INTEGER :: nimages_1, nimages_2
258 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dbt_create_3c_R1_R2'
260 INTEGER :: handle, i_cell, j_cell
262 CALL timeset(routinen, handle)
264 ALLOCATE (t_3c_r1_r2(nimages_1, nimages_2))
265 DO i_cell = 1, nimages_1
266 DO j_cell = 1, nimages_2
267 CALL dbt_create(t_3c_template, t_3c_r1_r2(i_cell, j_cell))
271 CALL timestop(handle)
273 END SUBROUTINE dbt_create_3c_r1_r2
285 SUBROUTINE g_times_3c(t_G_S, t_M, bs_env, i_cell_R1, i_cell_R2, i_task_Delta_R_local, &
287 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_g_s
288 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_m
290 INTEGER :: i_cell_r1, i_cell_r2, &
292 LOGICAL,
ALLOCATABLE,
DIMENSION(:, :, :) :: skip_dr_r1_s_gx3c
294 CHARACTER(LEN=*),
PARAMETER :: routinen =
'G_times_3c'
296 INTEGER :: handle, i_cell_r1_p_s, i_cell_s
297 INTEGER(KIND=int_8) :: flop
298 INTEGER,
DIMENSION(3) :: cell_r1, cell_r1_plus_cell_s, cell_r2, &
300 LOGICAL :: cell_found
301 TYPE(dbt_type) :: t_3c_int
303 CALL timeset(routinen, handle)
305 CALL dbt_create(bs_env%t_RI_AO__AO, t_3c_int)
307 cell_r1(1:3) = bs_env%index_to_cell_3c(1:3, i_cell_r1)
308 cell_r2(1:3) = bs_env%index_to_cell_3c(1:3, i_cell_r2)
310 DO i_cell_s = 1, bs_env%nimages_scf_desymm
312 IF (skip_dr_r1_s_gx3c(i_task_delta_r_local, i_cell_r1, i_cell_s)) cycle
314 cell_s(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(1:3, i_cell_s)
315 cell_r1_plus_cell_s(1:3) = cell_r1(1:3) + cell_s(1:3)
319 IF (.NOT. cell_found) cycle
321 i_cell_r1_p_s = bs_env%cell_to_index_3c(cell_r1_plus_cell_s(1), cell_r1_plus_cell_s(2), &
322 cell_r1_plus_cell_s(3))
324 IF (bs_env%nblocks_3c(i_cell_r2, i_cell_r1_p_s) == 0) cycle
326 CALL get_t_3c_int(t_3c_int, bs_env, i_cell_r2, i_cell_r1_p_s)
328 CALL dbt_contract(alpha=1.0_dp, &
330 tensor_2=t_g_s(i_cell_s), &
332 tensor_3=t_m(i_cell_r1, i_cell_r2), &
333 contract_1=[3], notcontract_1=[1, 2], map_1=[1, 2], &
334 contract_2=[2], notcontract_2=[1], map_2=[3], &
335 filter_eps=bs_env%eps_filter, flop=flop)
337 IF (flop == 0_int_8) skip_dr_r1_s_gx3c(i_task_delta_r_local, i_cell_r1, i_cell_s) = .true.
341 CALL dbt_destroy(t_3c_int)
343 CALL timestop(handle)
345 END SUBROUTINE g_times_3c
354 SUBROUTINE get_t_3c_int(t_3c_int, bs_env, j_cell, k_cell)
356 TYPE(dbt_type) :: t_3c_int
358 INTEGER :: j_cell, k_cell
360 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_t_3c_int'
364 CALL timeset(routinen, handle)
366 CALL dbt_clear(t_3c_int)
367 IF (j_cell < k_cell)
THEN
368 CALL dbt_copy(bs_env%t_3c_int(k_cell, j_cell), t_3c_int, order=[1, 3, 2])
370 CALL dbt_copy(bs_env%t_3c_int(j_cell, k_cell), t_3c_int)
373 CALL timestop(handle)
375 END SUBROUTINE get_t_3c_int
386 SUBROUTINE g_occ_vir(bs_env, tau, G_S, ispin, occ, vir)
389 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: g_s
393 CHARACTER(LEN=*),
PARAMETER :: routinen =
'G_occ_vir'
395 INTEGER :: handle, homo, i_cell_s, ikp, j, &
396 j_col_local, n_mo, ncol_local, &
398 INTEGER,
DIMENSION(:),
POINTER :: col_indices
399 REAL(kind=
dp) :: tau_e
401 CALL timeset(routinen, handle)
403 cpassert(occ .NEQV. vir)
406 ncol_local=ncol_local, &
407 col_indices=col_indices)
409 nkp = bs_env%nkp_scf_desymm
410 nimages = bs_env%nimages_scf_desymm
412 homo = bs_env%n_occ(ispin)
414 DO i_cell_s = 1, bs_env%nimages_scf_desymm
421 CALL cp_cfm_to_cfm(bs_env%cfm_mo_coeff_kp(ikp, ispin), bs_env%cfm_work_mo)
424 DO j_col_local = 1, ncol_local
426 j = col_indices(j_col_local)
429 tau_e = abs(tau*0.5_dp*(bs_env%eigenval_scf(j, ikp, ispin) - bs_env%e_fermi(ispin)))
431 IF (tau_e < bs_env%stabilize_exp)
THEN
432 bs_env%cfm_work_mo%local_data(:, j_col_local) = &
433 bs_env%cfm_work_mo%local_data(:, j_col_local)*exp(-tau_e)
435 bs_env%cfm_work_mo%local_data(:, j_col_local) =
z_zero
438 IF ((occ .AND. j > homo) .OR. (vir .AND. j <= homo))
THEN
439 bs_env%cfm_work_mo%local_data(:, j_col_local) =
z_zero
445 matrix_a=bs_env%cfm_work_mo, matrix_b=bs_env%cfm_work_mo, &
446 beta=
z_zero, matrix_c=bs_env%cfm_work_mo_2)
450 bs_env%kpoints_scf_desymm, ikp)
455 DO i_cell_s = 1, bs_env%nimages_scf_desymm
457 bs_env%mat_ao_ao_tensor%matrix, g_s(i_cell_s), bs_env)
460 CALL timestop(handle)
462 END SUBROUTINE g_occ_vir
472 SUBROUTINE contract_m_occ_vir_to_chi(t_Gocc, t_Gvir, t_chi_R, bs_env, i_task_Delta_R_local)
473 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_gocc, t_gvir
474 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_chi_r
476 INTEGER :: i_task_delta_r_local
478 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_M_occ_vir_to_chi'
480 INTEGER :: handle, i_cell_delta_r, i_cell_r, &
481 i_cell_r1, i_cell_r1_minus_r, &
482 i_cell_r2, i_cell_r2_minus_r
483 INTEGER(KIND=int_8) :: flop, flop_tmp
484 INTEGER,
DIMENSION(3) :: cell_dr, cell_r, cell_r1, &
485 cell_r1_minus_r, cell_r2, &
487 LOGICAL :: cell_found
488 TYPE(dbt_type) :: t_gocc_2, t_gvir_2
490 CALL timeset(routinen, handle)
492 CALL dbt_create(bs_env%t_RI__AO_AO, t_gocc_2)
493 CALL dbt_create(bs_env%t_RI__AO_AO, t_gvir_2)
498 DO i_cell_r = 1, bs_env%nimages_scf_desymm
500 DO i_cell_r2 = 1, bs_env%nimages_3c
502 IF (bs_env%skip_DR_R_R2_MxM_chi(i_task_delta_r_local, i_cell_r2, i_cell_r)) cycle
504 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
506 cell_r(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(1:3, i_cell_r)
507 cell_r2(1:3) = bs_env%index_to_cell_3c(1:3, i_cell_r2)
508 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(1:3, i_cell_delta_r)
511 CALL add_r(cell_r2, cell_dr, bs_env%index_to_cell_3c, cell_r1, &
512 cell_found, bs_env%cell_to_index_3c, i_cell_r1)
513 IF (.NOT. cell_found) cycle
516 CALL add_r(cell_r1, -cell_r, bs_env%index_to_cell_3c, cell_r1_minus_r, &
517 cell_found, bs_env%cell_to_index_3c, i_cell_r1_minus_r)
518 IF (.NOT. cell_found) cycle
521 CALL add_r(cell_r2, -cell_r, bs_env%index_to_cell_3c, cell_r2_minus_r, &
522 cell_found, bs_env%cell_to_index_3c, i_cell_r2_minus_r)
523 IF (.NOT. cell_found) cycle
526 CALL dbt_copy(t_gocc(i_cell_r1, i_cell_r2), t_gocc_2, order=[1, 3, 2])
527 CALL dbt_copy(t_gvir(i_cell_r2_minus_r, i_cell_r1_minus_r), t_gvir_2)
530 CALL dbt_contract(alpha=bs_env%spin_degeneracy, &
531 tensor_1=t_gocc_2, tensor_2=t_gvir_2, &
532 beta=1.0_dp, tensor_3=t_chi_r(i_cell_r), &
533 contract_1=[2, 3], notcontract_1=[1], map_1=[1], &
534 contract_2=[2, 3], notcontract_2=[1], map_2=[2], &
535 filter_eps=bs_env%eps_filter, move_data=.true., flop=flop_tmp)
537 IF (flop_tmp == 0_int_8) bs_env%skip_DR_R_R2_MxM_chi(i_task_delta_r_local, &
538 i_cell_r2, i_cell_r) = .true.
540 flop = flop + flop_tmp
546 IF (flop == 0_int_8) bs_env%skip_DR_chi(i_task_delta_r_local) = .true.
549 DO i_cell_r1 = 1, bs_env%nimages_3c
550 DO i_cell_r2 = 1, bs_env%nimages_3c
551 CALL dbt_clear(t_gocc(i_cell_r1, i_cell_r2))
552 CALL dbt_clear(t_gvir(i_cell_r1, i_cell_r2))
556 CALL dbt_destroy(t_gocc_2)
557 CALL dbt_destroy(t_gvir_2)
559 CALL timestop(handle)
561 END SUBROUTINE contract_m_occ_vir_to_chi
568 SUBROUTINE compute_w_real_space(bs_env, qs_env)
572 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_W_real_space'
574 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: chi_k_w, eps_k_w, w_k_w
575 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_inv, m_inv_v_sqrt, v_sqrt
576 INTEGER :: handle, i_t, ikp, ikp_local, j_w, n_ri, &
578 REAL(kind=
dp) :: freq_j, t1, time_i, weight_ij
579 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: chi_r, mwm_r, w_r
581 CALL timeset(routinen, handle)
584 nimages_scf_desymm = bs_env%nimages_scf_desymm
586 ALLOCATE (chi_k_w(n_ri, n_ri), eps_k_w(n_ri, n_ri), w_k_w(n_ri, n_ri))
587 ALLOCATE (chi_r(n_ri, n_ri, nimages_scf_desymm), w_r(n_ri, n_ri, nimages_scf_desymm), &
588 mwm_r(n_ri, n_ri, nimages_scf_desymm))
592 CALL compute_minv_and_vsqrt(bs_env, qs_env, m_inv_v_sqrt, m_inv, v_sqrt)
594 IF (bs_env%unit_nr > 0)
THEN
595 WRITE (bs_env%unit_nr,
'(T2,A,T58,A,F7.1,A)') &
596 'Computed V_PQ(k),',
'Execution time',
m_walltime() - t1,
' s'
597 WRITE (bs_env%unit_nr,
'(A)')
' '
602 DO j_w = 1, bs_env%num_time_freq_points
605 chi_r(:, :, :) = 0.0_dp
606 DO i_t = 1, bs_env%num_time_freq_points
607 freq_j = bs_env%time_frequency_grid%frequency(j_w)
608 time_i = bs_env%time_frequency_grid%imaginary_time(i_t)
609 weight_ij = bs_env%time_frequency_grid%cosine_time_to_frequency_weights(j_w, i_t)*cos(time_i*freq_j)
615 w_r(:, :, :) = 0.0_dp
616 DO ikp = 1, bs_env%nkp_chi_eps_W_orig_plus_extra
619 IF (
modulo(ikp, bs_env%para_env%num_pe) /= bs_env%para_env%mepos) cycle
621 ikp_local = ikp_local + 1
624 CALL rs_to_kp(chi_r, chi_k_w, bs_env%kpoints_scf_desymm%index_to_cell, &
625 bs_env%kpoints_chi_eps_W%xkp(1:3, ikp))
632 CALL gemm_square(m_inv_v_sqrt(:, :, ikp_local),
'C', chi_k_w,
'N', &
633 m_inv_v_sqrt(:, :, ikp_local),
'N', eps_k_w)
646 CALL gemm_square(v_sqrt(:, :, ikp_local),
'N', eps_k_w,
'N', &
647 v_sqrt(:, :, ikp_local),
'C', w_k_w)
651 index_to_cell_ext=bs_env%kpoints_scf_desymm%index_to_cell)
655 CALL bs_env%para_env%sync()
656 CALL bs_env%para_env%sum(w_r)
660 CALL mult_w_with_minv(w_r, mwm_r, bs_env, qs_env)
663 DO i_t = 1, bs_env%num_time_freq_points
664 freq_j = bs_env%time_frequency_grid%frequency(j_w)
665 time_i = bs_env%time_frequency_grid%imaginary_time(i_t)
666 weight_ij = bs_env%time_frequency_grid%cosine_frequency_to_time_weights(i_t, j_w)*cos(time_i*freq_j)
672 IF (bs_env%unit_nr > 0)
THEN
673 WRITE (bs_env%unit_nr,
'(T2,A,T60,A,F7.1,A)') &
674 'Computed W_PQ(k,iω) for all k and τ,',
'Execution time',
m_walltime() - t1,
' s'
675 WRITE (bs_env%unit_nr,
'(A)')
' '
678 CALL timestop(handle)
680 END SUBROUTINE compute_w_real_space
690 SUBROUTINE compute_minv_and_vsqrt(bs_env, qs_env, M_inv_V_sqrt, M_inv, V_sqrt)
693 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_inv_v_sqrt, m_inv, v_sqrt
695 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Minv_and_Vsqrt'
697 INTEGER :: handle, ikp, ikp_local, n_ri, nkp, &
699 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_r
701 CALL timeset(routinen, handle)
703 nkp = bs_env%nkp_chi_eps_W_orig_plus_extra
704 nkp_orig = bs_env%nkp_chi_eps_W_orig
710 IF (
modulo(ikp, bs_env%para_env%num_pe) /= bs_env%para_env%mepos) cycle
711 nkp_local = nkp_local + 1
714 ALLOCATE (m_inv_v_sqrt(n_ri, n_ri, nkp_local), m_inv(n_ri, n_ri, nkp_local), &
715 v_sqrt(n_ri, n_ri, nkp_local))
717 m_inv_v_sqrt(:, :, :) =
z_zero
722 bs_env%kpoints_chi_eps_W%nkp_grid = bs_env%nkp_grid_chi_eps_W_orig
724 bs_env%size_lattice_sum_V, basis_type=
"RI_AUX", &
725 ikp_start=1, ikp_end=nkp_orig)
728 bs_env%kpoints_chi_eps_W%nkp_grid = bs_env%nkp_grid_chi_eps_W_extra
730 bs_env%size_lattice_sum_V, basis_type=
"RI_AUX", &
731 ikp_start=nkp_orig + 1, ikp_end=nkp)
736 CALL get_v_tr_r(m_r, bs_env%ri_metric, bs_env%regularization_RI, bs_env, qs_env)
742 IF (
modulo(ikp, bs_env%para_env%num_pe) /= bs_env%para_env%mepos) cycle
744 ikp_local = ikp_local + 1
747 CALL rs_to_kp(m_r, m_inv(:, :, ikp_local), &
748 bs_env%kpoints_scf_desymm%index_to_cell, &
749 bs_env%kpoints_chi_eps_W%xkp(1:3, ikp))
758 CALL gemm_square(m_inv(:, :, ikp_local),
'N', v_sqrt(:, :, ikp_local),
'C', m_inv_v_sqrt(:, :, ikp_local))
762 CALL timestop(handle)
764 END SUBROUTINE compute_minv_and_vsqrt
773 SUBROUTINE mult_w_with_minv(W_R, MWM_R, bs_env, qs_env)
774 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: w_r, mwm_r
778 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mult_W_with_Minv'
780 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: m_inv, w_k, work
781 INTEGER :: handle, ikp, n_ri
782 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_r
784 CALL timeset(routinen, handle)
787 CALL get_v_tr_r(m_r, bs_env%ri_metric, bs_env%regularization_RI, bs_env, qs_env)
790 ALLOCATE (m_inv(n_ri, n_ri), w_k(n_ri, n_ri), work(n_ri, n_ri))
791 mwm_r(:, :, :) = 0.0_dp
793 DO ikp = 1, bs_env%nkp_scf_desymm
796 IF (
modulo(ikp, bs_env%para_env%num_pe) /= bs_env%para_env%mepos) cycle
800 bs_env%kpoints_scf_desymm%index_to_cell, &
801 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
808 bs_env%kpoints_scf_desymm%index_to_cell, &
809 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
812 CALL gemm_square(m_inv,
'N', w_k,
'N', m_inv,
'N', work)
813 w_k(:, :) = work(:, :)
820 CALL bs_env%para_env%sync()
821 CALL bs_env%para_env%sum(mwm_r)
823 CALL timestop(handle)
825 END SUBROUTINE mult_w_with_minv
832 SUBROUTINE compute_sigma_x(bs_env, qs_env)
836 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_x'
838 INTEGER :: handle, i_task_delta_r_local, ispin
840 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: d_s, mi_vtr_mi_r, sigma_x_r
841 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_v
843 CALL timeset(routinen, handle)
845 CALL dbt_create_2c_r(mi_vtr_mi_r, bs_env%t_W, bs_env%nimages_scf_desymm)
846 CALL dbt_create_2c_r(d_s, bs_env%t_G, bs_env%nimages_scf_desymm)
847 CALL dbt_create_2c_r(sigma_x_r, bs_env%t_G, bs_env%nimages_scf_desymm)
848 CALL dbt_create_3c_r1_r2(t_v, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
855 CALL get_minv_vtr_minv_r(mi_vtr_mi_r, bs_env, qs_env)
859 DO ispin = 1, bs_env%n_spin
863 CALL g_occ_vir(bs_env, 0.0_dp, d_s, ispin, occ=.true., vir=.false.)
866 DO i_task_delta_r_local = 1, bs_env%n_tasks_Delta_R_local
869 CALL contract_w(t_v, mi_vtr_mi_r, bs_env, i_task_delta_r_local)
874 CALL contract_to_sigma(sigma_x_r, t_v, d_s, i_task_delta_r_local, bs_env, &
875 occ=.true., vir=.false., clear_t_w=.true., fill_skip=.false.)
879 CALL bs_env%para_env%sync()
882 bs_env%mat_ao_ao_tensor, bs_env)
886 IF (bs_env%unit_nr > 0)
THEN
887 WRITE (bs_env%unit_nr,
'(T2,A,T58,A,F7.1,A)') &
888 'Computed Σ^x,',
' Execution time',
m_walltime() - t1,
' s'
889 WRITE (bs_env%unit_nr,
'(A)')
' '
892 CALL destroy_t_1d(mi_vtr_mi_r)
893 CALL destroy_t_1d(d_s)
894 CALL destroy_t_1d(sigma_x_r)
895 CALL destroy_t_2d(t_v)
897 CALL timestop(handle)
899 END SUBROUTINE compute_sigma_x
905 SUBROUTINE compute_sigma_c(bs_env)
908 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Sigma_c'
910 INTEGER :: handle, i_t, i_task_delta_r_local, ispin
911 REAL(kind=
dp) :: t1, tau
912 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: gocc_s, gvir_s, sigma_c_r_neg_tau, &
913 sigma_c_r_pos_tau, w_r
914 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_w
916 CALL timeset(routinen, handle)
918 CALL dbt_create_2c_r(gocc_s, bs_env%t_G, bs_env%nimages_scf_desymm)
919 CALL dbt_create_2c_r(gvir_s, bs_env%t_G, bs_env%nimages_scf_desymm)
920 CALL dbt_create_2c_r(w_r, bs_env%t_W, bs_env%nimages_scf_desymm)
921 CALL dbt_create_3c_r1_r2(t_w, bs_env%t_RI_AO__AO, bs_env%nimages_3c, bs_env%nimages_3c)
922 CALL dbt_create_2c_r(sigma_c_r_neg_tau, bs_env%t_G, bs_env%nimages_scf_desymm)
923 CALL dbt_create_2c_r(sigma_c_r_pos_tau, bs_env%t_G, bs_env%nimages_scf_desymm)
927 DO i_t = 1, bs_env%num_time_freq_points
929 DO ispin = 1, bs_env%n_spin
933 tau = bs_env%time_frequency_grid%imaginary_time(i_t)
938 CALL g_occ_vir(bs_env, tau, gocc_s, ispin, occ=.true., vir=.false.)
939 CALL g_occ_vir(bs_env, tau, gvir_s, ispin, occ=.false., vir=.true.)
942 CALL fm_mwm_r_t_to_local_tensor_w_r(bs_env%fm_MWM_R_t(:, i_t), w_r, bs_env)
945 DO i_task_delta_r_local = 1, bs_env%n_tasks_Delta_R_local
947 IF (bs_env%skip_DR_Sigma(i_task_delta_r_local)) cycle
951 CALL contract_w(t_w, w_r, bs_env, i_task_delta_r_local)
957 CALL contract_to_sigma(sigma_c_r_neg_tau, t_w, gocc_s, i_task_delta_r_local, bs_env, &
958 occ=.true., vir=.false., clear_t_w=.false., fill_skip=.false.)
961 CALL contract_to_sigma(sigma_c_r_pos_tau, t_w, gvir_s, i_task_delta_r_local, bs_env, &
962 occ=.false., vir=.true., clear_t_w=.true., fill_skip=.true.)
966 CALL bs_env%para_env%sync()
969 bs_env%fm_Sigma_c_R_pos_tau(:, i_t, ispin), &
970 bs_env%mat_ao_ao, bs_env%mat_ao_ao_tensor, bs_env)
973 bs_env%fm_Sigma_c_R_neg_tau(:, i_t, ispin), &
974 bs_env%mat_ao_ao, bs_env%mat_ao_ao_tensor, bs_env)
976 IF (bs_env%unit_nr > 0)
THEN
977 WRITE (bs_env%unit_nr,
'(T2,A,I10,A,I3,A,F7.1,A)') &
978 'Computed Σ^c(iτ) for time point ', i_t,
' /', bs_env%num_time_freq_points, &
986 CALL destroy_t_1d(gocc_s)
987 CALL destroy_t_1d(gvir_s)
988 CALL destroy_t_1d(w_r)
989 CALL destroy_t_1d(sigma_c_r_neg_tau)
990 CALL destroy_t_1d(sigma_c_r_pos_tau)
991 CALL destroy_t_2d(t_w)
993 CALL timestop(handle)
995 END SUBROUTINE compute_sigma_c
1003 SUBROUTINE get_minv_vtr_minv_r(Mi_Vtr_Mi_R, bs_env, qs_env)
1004 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: mi_vtr_mi_r
1008 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_Minv_Vtr_Minv_R'
1010 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: m_kp, mi_vtr_mi_kp, v_tr_kp
1011 INTEGER :: handle, i_cell_r, ikp, n_ri, &
1012 nimages_scf, nkp_scf
1013 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: m_r, mi_vtr_mi_r_arr, v_tr_r
1015 CALL timeset(routinen, handle)
1017 nimages_scf = bs_env%nimages_scf_desymm
1018 nkp_scf = bs_env%kpoints_scf_desymm%nkp
1021 CALL get_v_tr_r(v_tr_r, bs_env%trunc_coulomb, 0.0_dp, bs_env, qs_env)
1022 CALL get_v_tr_r(m_r, bs_env%ri_metric, bs_env%regularization_RI, bs_env, qs_env)
1024 ALLOCATE (v_tr_kp(n_ri, n_ri), m_kp(n_ri, n_ri), &
1025 mi_vtr_mi_kp(n_ri, n_ri), mi_vtr_mi_r_arr(n_ri, n_ri, nimages_scf))
1026 mi_vtr_mi_r_arr(:, :, :) = 0.0_dp
1030 IF (
modulo(ikp, bs_env%para_env%num_pe) /= bs_env%para_env%mepos) cycle
1032 CALL rs_to_kp(v_tr_r, v_tr_kp, bs_env%kpoints_scf_desymm%index_to_cell, &
1033 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
1035 CALL rs_to_kp(m_r, m_kp, bs_env%kpoints_scf_desymm%index_to_cell, &
1036 bs_env%kpoints_scf_desymm%xkp(1:3, ikp))
1040 CALL gemm_square(m_kp,
'N', v_tr_kp,
'N', m_kp,
'N', mi_vtr_mi_kp)
1042 CALL add_kp_to_all_rs(mi_vtr_mi_kp, mi_vtr_mi_r_arr, bs_env%kpoints_scf_desymm, ikp)
1044 CALL bs_env%para_env%sync()
1045 CALL bs_env%para_env%sum(mi_vtr_mi_r_arr)
1051 DO i_cell_r = 1, nimages_scf
1053 bs_env%mat_RI_RI_tensor%matrix, mi_vtr_mi_r(i_cell_r), bs_env)
1056 CALL timestop(handle)
1058 END SUBROUTINE get_minv_vtr_minv_r
1064 SUBROUTINE destroy_t_1d(t_1d)
1065 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: t_1d
1067 CHARACTER(LEN=*),
PARAMETER :: routinen =
'destroy_t_1d'
1069 INTEGER :: handle, i
1071 CALL timeset(routinen, handle)
1073 DO i = 1,
SIZE(t_1d)
1074 CALL dbt_destroy(t_1d(i))
1078 CALL timestop(handle)
1080 END SUBROUTINE destroy_t_1d
1086 SUBROUTINE destroy_t_2d(t_2d)
1087 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_2d
1089 CHARACTER(LEN=*),
PARAMETER :: routinen =
'destroy_t_2d'
1091 INTEGER :: handle, i, j
1093 CALL timeset(routinen, handle)
1095 DO i = 1,
SIZE(t_2d, 1)
1096 DO j = 1,
SIZE(t_2d, 2)
1097 CALL dbt_destroy(t_2d(i, j))
1102 CALL timestop(handle)
1104 END SUBROUTINE destroy_t_2d
1113 SUBROUTINE contract_w(t_W, W_R, bs_env, i_task_Delta_R_local)
1114 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_w
1115 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: w_r
1117 INTEGER :: i_task_delta_r_local
1119 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_W'
1121 INTEGER :: handle, i_cell_delta_r, i_cell_r1, &
1122 i_cell_r2, i_cell_r2_m_r1, i_cell_s1, &
1124 INTEGER,
DIMENSION(3) :: cell_dr, cell_r1, cell_r2, cell_r2_m_r1, &
1125 cell_s1, cell_s1_m_r2_p_r1
1126 LOGICAL :: cell_found
1127 TYPE(dbt_type) :: t_3c_int, t_w_tmp
1129 CALL timeset(routinen, handle)
1131 CALL dbt_create(bs_env%t_RI__AO_AO, t_w_tmp)
1132 CALL dbt_create(bs_env%t_RI_AO__AO, t_3c_int)
1134 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
1136 DO i_cell_r1 = 1, bs_env%nimages_3c
1138 cell_r1(1:3) = bs_env%index_to_cell_3c(1:3, i_cell_r1)
1139 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(1:3, i_cell_delta_r)
1142 CALL add_r(cell_r1, cell_dr, bs_env%index_to_cell_3c, cell_s1, &
1143 cell_found, bs_env%cell_to_index_3c, i_cell_s1)
1144 IF (.NOT. cell_found) cycle
1146 DO i_cell_r2 = 1, bs_env%nimages_scf_desymm
1148 cell_r2(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(1:3, i_cell_r2)
1151 CALL add_r(cell_r2, -cell_r1, bs_env%index_to_cell_3c, cell_r2_m_r1, &
1152 cell_found, bs_env%cell_to_index_3c, i_cell_r2_m_r1)
1153 IF (.NOT. cell_found) cycle
1156 CALL add_r(cell_s1, cell_r2_m_r1, bs_env%index_to_cell_3c, cell_s1_m_r2_p_r1, &
1157 cell_found, bs_env%cell_to_index_3c, i_cell_s1_m_r1_p_r2)
1158 IF (.NOT. cell_found) cycle
1160 CALL get_t_3c_int(t_3c_int, bs_env, i_cell_s1_m_r1_p_r2, i_cell_r2_m_r1)
1165 CALL dbt_contract(alpha=1.0_dp, &
1166 tensor_1=w_r(i_cell_r2), &
1167 tensor_2=t_3c_int, &
1170 contract_1=[1], notcontract_1=[2], map_1=[1], &
1171 contract_2=[1], notcontract_2=[2, 3], map_2=[2, 3], &
1172 filter_eps=bs_env%eps_filter)
1175 CALL dbt_copy(t_w_tmp, t_w(i_cell_s1, i_cell_r1), order=[1, 2, 3], &
1176 move_data=.true., summation=.true.)
1182 CALL dbt_destroy(t_w_tmp)
1183 CALL dbt_destroy(t_3c_int)
1185 CALL timestop(handle)
1187 END SUBROUTINE contract_w
1201 SUBROUTINE contract_to_sigma(Sigma_R, t_W, G_S, i_task_Delta_R_local, bs_env, occ, vir, &
1202 clear_t_W, fill_skip)
1203 TYPE(dbt_type),
DIMENSION(:) :: sigma_r
1204 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:, :) :: t_w
1205 TYPE(dbt_type),
DIMENSION(:) :: g_s
1206 INTEGER :: i_task_delta_r_local
1208 LOGICAL :: occ, vir, clear_t_w, fill_skip
1210 CHARACTER(LEN=*),
PARAMETER :: routinen =
'contract_to_Sigma'
1212 INTEGER :: handle, handle2, i_cell_delta_r, i_cell_m_r1, i_cell_r, i_cell_r1, &
1213 i_cell_r1_minus_r, i_cell_s1, i_cell_s1_minus_r, i_cell_s1_p_s2_m_r1, i_cell_s2
1214 INTEGER(KIND=int_8) :: flop, flop_tmp
1215 INTEGER,
DIMENSION(3) :: cell_dr, cell_m_r1, cell_r, cell_r1, &
1216 cell_r1_minus_r, cell_s1, &
1217 cell_s1_minus_r, cell_s1_p_s2_m_r1, &
1219 LOGICAL :: cell_found
1220 REAL(kind=
dp) :: sign_sigma
1221 TYPE(dbt_type) :: t_3c_int, t_g, t_g_2
1223 CALL timeset(routinen, handle)
1225 cpassert(occ .EQV. (.NOT. vir))
1226 IF (occ) sign_sigma = -1.0_dp
1227 IF (vir) sign_sigma = 1.0_dp
1229 CALL dbt_create(bs_env%t_RI_AO__AO, t_g)
1230 CALL dbt_create(bs_env%t_RI_AO__AO, t_g_2)
1231 CALL dbt_create(bs_env%t_RI_AO__AO, t_3c_int)
1233 i_cell_delta_r = bs_env%task_Delta_R(i_task_delta_r_local)
1237 DO i_cell_r1 = 1, bs_env%nimages_3c
1239 cell_r1(1:3) = bs_env%index_to_cell_3c(1:3, i_cell_r1)
1240 cell_dr(1:3) = bs_env%index_to_cell_Delta_R(1:3, i_cell_delta_r)
1243 CALL add_r(cell_r1, cell_dr, bs_env%index_to_cell_3c, cell_s1, cell_found, &
1244 bs_env%cell_to_index_3c, i_cell_s1)
1245 IF (.NOT. cell_found) cycle
1247 DO i_cell_s2 = 1, bs_env%nimages_scf_desymm
1249 IF (bs_env%skip_DR_R1_S2_Gx3c_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_s2)) cycle
1251 cell_s2(1:3) = bs_env%kpoints_scf_desymm%index_to_cell(1:3, i_cell_s2)
1252 cell_m_r1(1:3) = -cell_r1(1:3)
1253 cell_s1_p_s2_m_r1(1:3) = cell_s1(1:3) + cell_s2(1:3) - cell_r1(1:3)
1256 IF (.NOT. cell_found) cycle
1259 IF (.NOT. cell_found) cycle
1261 i_cell_m_r1 = bs_env%cell_to_index_3c(cell_m_r1(1), cell_m_r1(2), cell_m_r1(3))
1262 i_cell_s1_p_s2_m_r1 = bs_env%cell_to_index_3c(cell_s1_p_s2_m_r1(1), &
1263 cell_s1_p_s2_m_r1(2), &
1264 cell_s1_p_s2_m_r1(3))
1266 CALL timeset(routinen//
"_3c_x_G", handle2)
1268 CALL get_t_3c_int(t_3c_int, bs_env, i_cell_m_r1, i_cell_s1_p_s2_m_r1)
1273 CALL dbt_contract(alpha=1.0_dp, &
1274 tensor_1=g_s(i_cell_s2), &
1275 tensor_2=t_3c_int, &
1278 contract_1=[2], notcontract_1=[1], map_1=[3], &
1279 contract_2=[3], notcontract_2=[1, 2], map_2=[1, 2], &
1280 filter_eps=bs_env%eps_filter, flop=flop_tmp)
1282 IF (flop_tmp == 0_int_8 .AND. fill_skip)
THEN
1283 bs_env%skip_DR_R1_S2_Gx3c_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_s2) = .true.
1286 CALL timestop(handle2)
1290 CALL dbt_copy(t_g, t_g_2, order=[1, 3, 2], move_data=.true.)
1292 CALL timeset(routinen//
"_contract", handle2)
1294 DO i_cell_r = 1, bs_env%nimages_scf_desymm
1296 IF (bs_env%skip_DR_R1_R_MxM_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_r)) cycle
1298 cell_r = bs_env%kpoints_scf_desymm%index_to_cell(1:3, i_cell_r)
1301 CALL add_r(cell_r1, -cell_r, bs_env%index_to_cell_3c, cell_r1_minus_r, &
1302 cell_found, bs_env%cell_to_index_3c, i_cell_r1_minus_r)
1303 IF (.NOT. cell_found) cycle
1306 CALL add_r(cell_s1, -cell_r, bs_env%index_to_cell_3c, cell_s1_minus_r, &
1307 cell_found, bs_env%cell_to_index_3c, i_cell_s1_minus_r)
1308 IF (.NOT. cell_found) cycle
1313 CALL dbt_contract(alpha=sign_sigma, &
1315 tensor_2=t_w(i_cell_s1_minus_r, i_cell_r1_minus_r), &
1317 tensor_3=sigma_r(i_cell_r), &
1318 contract_1=[1, 2], notcontract_1=[3], map_1=[1], &
1319 contract_2=[1, 2], notcontract_2=[3], map_2=[2], &
1320 filter_eps=bs_env%eps_filter, flop=flop_tmp)
1322 flop = flop + flop_tmp
1324 IF (flop_tmp == 0_int_8 .AND. fill_skip)
THEN
1325 bs_env%skip_DR_R1_R_MxM_Sigma(i_task_delta_r_local, i_cell_r1, i_cell_r) = .true.
1330 CALL dbt_clear(t_g_2)
1332 CALL timestop(handle2)
1336 IF (vir .AND. flop == 0_int_8) bs_env%skip_DR_Sigma(i_task_delta_r_local) = .true.
1340 DO i_cell_s1 = 1, bs_env%nimages_3c
1341 DO i_cell_r1 = 1, bs_env%nimages_3c
1342 CALL dbt_clear(t_w(i_cell_s1, i_cell_r1))
1347 CALL dbt_destroy(t_g)
1348 CALL dbt_destroy(t_g_2)
1349 CALL dbt_destroy(t_3c_int)
1351 CALL timestop(handle)
1353 END SUBROUTINE contract_to_sigma
1361 SUBROUTINE fm_mwm_r_t_to_local_tensor_w_r(fm_W_R, W_R, bs_env)
1363 TYPE(dbt_type),
ALLOCATABLE,
DIMENSION(:) :: w_r
1366 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fm_MWM_R_t_to_local_tensor_W_R'
1368 INTEGER :: handle, i_cell_r
1370 CALL timeset(routinen, handle)
1373 DO i_cell_r = 1, bs_env%nimages_scf_desymm
1375 bs_env%mat_RI_RI_tensor%matrix, w_r(i_cell_r), bs_env)
1378 CALL timestop(handle)
1380 END SUBROUTINE fm_mwm_r_t_to_local_tensor_w_r
1386 SUBROUTINE compute_qp_energies(bs_env)
1389 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_QP_energies'
1391 INTEGER :: handle, ikp, ispin, j_t
1392 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sigma_x_ikp_n
1393 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: sigma_c_ikp_n_freq, sigma_c_ikp_n_time
1396 CALL timeset(routinen, handle)
1398 CALL cp_cfm_create(cfm_mo_coeff, bs_env%fm_s_Gamma%matrix_struct)
1399 ALLOCATE (sigma_x_ikp_n(bs_env%n_ao))
1400 ALLOCATE (sigma_c_ikp_n_time(bs_env%n_ao, bs_env%num_time_freq_points, 2))
1401 ALLOCATE (sigma_c_ikp_n_freq(bs_env%n_ao, bs_env%num_time_freq_points, 2))
1403 DO ispin = 1, bs_env%n_spin
1405 DO ikp = 1, bs_env%nkp_bs_and_DOS
1408 CALL cp_cfm_to_cfm(bs_env%cfm_mo_coeff_kp(ikp, ispin), cfm_mo_coeff)
1412 CALL trafo_to_k_and_nn(bs_env%fm_Sigma_x_R, sigma_x_ikp_n, cfm_mo_coeff, bs_env, ikp)
1416 DO j_t = 1, bs_env%num_time_freq_points
1417 CALL trafo_to_k_and_nn(bs_env%fm_Sigma_c_R_pos_tau(:, j_t, ispin), &
1418 sigma_c_ikp_n_time(:, j_t, 1), cfm_mo_coeff, bs_env, ikp)
1419 CALL trafo_to_k_and_nn(bs_env%fm_Sigma_c_R_neg_tau(:, j_t, ispin), &
1420 sigma_c_ikp_n_time(:, j_t, 2), cfm_mo_coeff, bs_env, ikp)
1424 CALL time_to_freq(bs_env, sigma_c_ikp_n_time, sigma_c_ikp_n_freq, ispin)
1429 bs_env%v_xc_n(:, ikp, ispin), &
1430 bs_env%eigenval_scf(:, ikp, ispin), ikp, ispin)
1440 CALL timestop(handle)
1442 END SUBROUTINE compute_qp_energies
1452 SUBROUTINE trafo_to_k_and_nn(fm_rs, array_ikp_n, cfm_mo_coeff, bs_env, ikp)
1454 REAL(kind=
dp),
DIMENSION(:) :: array_ikp_n
1459 CHARACTER(LEN=*),
PARAMETER :: routinen =
'trafo_to_k_and_nn'
1461 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:) :: cdiag
1465 CALL timeset(routinen, handle)
1470 CALL fm_rs_to_kp(cfm_ikp, fm_rs, bs_env%kpoints_DOS, ikp)
1476 ALLOCATE (cdiag(
SIZE(array_ikp_n)))
1478 array_ikp_n = real(cdiag, kind=
dp)
1483 CALL timestop(handle)
1485 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....
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public pasquier2025
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_get_diag(matrix, diag)
returns the diagonal of a complex full matrix: diag(i)= A_{ii}. Each diagonal entry is owned by one p...
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_cfm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
Creates a new full matrix with the given structure.
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.
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
This is the start of a dbt_api, all publically needed functions are exported here....
subroutine, public gw_calc_tensor_small_cell_full_kp(qs_env, bs_env)
Perform GW band structure calculation.
subroutine, public fm_to_local_array(fm_s, array_s, weight, add)
...
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)
...
Full-matrix operations not provided by the CP2K FM packages.
subroutine, public local_add_on_diag(matrix, alpha)
Add a scalar to the diagonal of a local complex matrix.
subroutine, public cfm_contract_aba(matrix_a, matrix_b, matrix_c)
Computes A^H B A for complex full matrices.
subroutine, public local_complex_power(matrix, exponent, eps, cond_nr, min_ev, max_ev)
Compute a spectral power of a local complex Hermitian matrix. Eigenvalues not larger than eps are dis...
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 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 de_init_bs_env(qs_env, bs_env)
Releases the memory-heavy GW intermediates that cannot be freed in bs_env_release,...
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)
...
Implements transformations from k-space to R-space for Fortran array matrices.
subroutine, public rs_to_kp(rs_real, ks_complex, index_to_cell, xkp, deriv_direction, hmat)
Integrate RS matrices (stored as Fortran array) into a kpoint matrix at given kp.
subroutine, public fm_add_kp_to_all_rs(cfm_kp, fm_rs, kpoints, ikp)
Adds given kpoint matrix to a single rs matrix.
subroutine, public add_kp_to_all_rs(array_kp, array_rs, kpoints, ikp, index_to_cell_ext)
Adds given kpoint matrix to all rs matrices.
subroutine, public fm_rs_to_kp(cfm_kp, fm_rs, kpoints, ikp)
Transforms array of fm RS matrices into cfm k-space matrix, at given kpoint index.
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
Collection of simple mathematical functions and subroutines.
basic linear algebra operations for full matrixes
subroutine, public get_all_vbm_cbm_bandgaps(bs_env)
...
Represent a complex full matrix.