79 fm_mat_Q_static_bse_gemm, &
80 Eigenval, Eigenval_scf, &
81 homo, virtual, dimen_RI, dimen_RI_red, bse_lev_virt, &
82 gd_array, color_sub, mp2_env, qs_env, mo_coeff, unit_nr)
84 TYPE(
cp_fm_type),
INTENT(IN) :: fm_mat_s_ia_bse, fm_mat_s_ij_bse, &
86 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_mat_q_static_bse_gemm
87 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
88 INTENT(IN) :: eigenval, eigenval_scf
89 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
90 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red, bse_lev_virt
92 INTEGER,
INTENT(IN) :: color_sub
95 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
96 INTEGER,
INTENT(IN) :: unit_nr
98 CHARACTER(LEN=*),
PARAMETER :: routinen =
'start_bse_calculation'
100 INTEGER :: handle, homo_red, virtual_red
101 LOGICAL :: my_do_abba, my_do_fulldiag, &
102 my_do_iterat_diag, my_do_tda
103 REAL(kind=
dp) :: diag_runtime_est
104 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigenval_reduced
105 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: b_abq_bse_local, b_bar_iaq_bse_local, &
106 b_bar_ijq_bse_local, b_iaq_bse_local
107 TYPE(
cp_fm_type) :: fm_a_bse, fm_b_bse, fm_c_bse, fm_inv_sqrt_a_minus_b, fm_mat_s_ab_trunc, &
108 fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, &
113 CALL timeset(routinen, handle)
115 para_env => fm_mat_s_ia_bse%matrix_struct%para_env
117 my_do_fulldiag = .false.
118 my_do_iterat_diag = .false.
122 SELECT CASE (mp2_env%bse%bse_diag_method)
124 my_do_iterat_diag = .true.
126 cpabort(
"Iterative BSE not yet implemented")
128 my_do_fulldiag = .true.
131 SELECT CASE (mp2_env%bse%flag_tda)
146 mp2_env%bse%bse_debug_print = .true.
149 CALL fm_mat_s_ia_bse%matrix_struct%para_env%sync()
153 fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, &
154 eigenval_scf(:, 1, 1), eigenval(:, 1, 1), eigenval_reduced, &
155 homo(1), virtual(1), dimen_ri, unit_nr, &
157 homo_red, virtual_red, &
162 CALL mult_b_with_w(fm_mat_s_ij_trunc, fm_mat_s_ia_trunc, fm_mat_s_bar_ia_bse, &
163 fm_mat_s_bar_ij_bse, fm_mat_q_static_bse_gemm, &
164 dimen_ri_red, homo_red, virtual_red)
166 IF (my_do_iterat_diag)
THEN
168 fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, &
169 b_bar_ijq_bse_local, b_abq_bse_local, b_bar_iaq_bse_local, &
170 b_iaq_bse_local, dimen_ri_red, homo_red, virtual_red, &
171 gd_array, color_sub, para_env)
176 IF (my_do_fulldiag)
THEN
179 para_env, diag_runtime_est)
190 CALL create_a(fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, &
191 fm_a_bse, eigenval_reduced, unit_nr, &
192 homo_red, virtual_red, dimen_ri, mp2_env, &
195 CALL create_a(fm_mat_s_ia_trunc, fm_mat_s_bar_ij_bse, fm_mat_s_ab_trunc, &
196 fm_a_bse, eigenval_reduced, unit_nr, &
197 homo_red, virtual_red, dimen_ri, mp2_env, &
210 CALL create_b(fm_mat_s_ia_trunc, fm_mat_s_ia_trunc, fm_b_bse, &
211 homo_red, virtual_red, dimen_ri, unit_nr, mp2_env)
213 CALL create_b(fm_mat_s_ia_trunc, fm_mat_s_bar_ia_bse, fm_b_bse, &
214 homo_red, virtual_red, dimen_ri, unit_nr, mp2_env)
221 fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, &
222 homo_red, virtual_red, unit_nr, mp2_env, diag_runtime_est)
227 CALL diagonalize_a(fm_a_bse, homo_red, virtual_red, homo(1), &
228 unit_nr, diag_runtime_est, mp2_env, qs_env, mo_coeff)
236 CALL diagonalize_c(fm_c_bse, homo_red, virtual_red, homo(1), &
237 fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, &
238 unit_nr, diag_runtime_est, mp2_env, qs_env, mo_coeff)
245 fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, &
246 fm_mat_q_static_bse_gemm, mp2_env)
247 DEALLOCATE (eigenval_reduced)
248 IF (my_do_iterat_diag)
THEN
251 b_iaq_bse_local, homo(1), virtual(1), mp2_env%bse%bse_spin_config, unit_nr, &
252 eigenval(:, 1, 1), para_env, mp2_env)
254 DEALLOCATE (b_bar_ijq_bse_local, b_abq_bse_local, b_bar_iaq_bse_local, b_iaq_bse_local)
257 IF (unit_nr > 0)
THEN
258 WRITE (unit_nr,
'(T2,A4,T7,A53)')
'BSE|',
'The BSE was successfully calculated. Have a nice day!'
261 CALL timestop(handle)
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.