49#include "./base/base_uses.f90"
55 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'bse_main'
82 fm_mat_Q_static_bse_gemm, &
83 Eigenval, Eigenval_scf, &
84 homo, virtual, dimen_RI, dimen_RI_red, bse_lev_virt, &
85 gd_array, color_sub, mp2_env, qs_env, mo_coeff, unit_nr)
87 TYPE(
cp_fm_type),
INTENT(IN) :: fm_mat_s_ia_bse, fm_mat_s_ij_bse, &
89 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_mat_q_static_bse_gemm
90 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
91 INTENT(IN) :: eigenval, eigenval_scf
92 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
93 INTEGER,
INTENT(IN) :: dimen_ri, dimen_ri_red, bse_lev_virt
95 INTEGER,
INTENT(IN) :: color_sub
98 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
99 INTEGER,
INTENT(IN) :: unit_nr
101 CHARACTER(LEN=*),
PARAMETER :: routinen =
'start_bse_calculation'
103 INTEGER :: handle, homo_red, virtual_red
104 LOGICAL :: my_do_abba, my_do_fulldiag, &
105 my_do_iterat_diag, my_do_tda
106 REAL(kind=
dp) :: diag_runtime_est
107 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigenval_reduced
108 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: b_abq_bse_local, b_bar_iaq_bse_local, &
109 b_bar_ijq_bse_local, b_iaq_bse_local
110 TYPE(
cp_fm_type) :: fm_a_bse, fm_b_bse, fm_c_bse, fm_inv_sqrt_a_minus_b, fm_mat_s_ab_trunc, &
111 fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, &
118 CALL timeset(routinen, handle)
120 para_env => fm_mat_s_ia_bse%matrix_struct%para_env
122 my_do_fulldiag = .false.
123 my_do_iterat_diag = .false.
127 SELECT CASE (mp2_env%bse%bse_diag_method)
129 my_do_iterat_diag = .true.
131 cpabort(
"Iterative BSE not yet implemented")
133 my_do_fulldiag = .true.
136 SELECT CASE (mp2_env%bse%flag_tda)
151 mp2_env%bse%bse_debug_print = .true.
154 CALL fm_mat_s_ia_bse%matrix_struct%para_env%sync()
158 fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, &
159 eigenval_scf(:, 1, 1), eigenval(:, 1, 1), eigenval_reduced, &
160 homo(1), virtual(1), dimen_ri, unit_nr, &
162 homo_red, virtual_red, &
167 CALL mult_b_with_w(fm_mat_s_ij_trunc, fm_mat_s_ia_trunc, fm_mat_s_bar_ia_bse, &
168 fm_mat_s_bar_ij_bse, fm_mat_q_static_bse_gemm, &
169 dimen_ri_red, homo_red, virtual_red)
171 IF (my_do_iterat_diag)
THEN
173 fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, &
174 b_bar_ijq_bse_local, b_abq_bse_local, b_bar_iaq_bse_local, &
175 b_iaq_bse_local, dimen_ri_red, homo_red, virtual_red, &
176 gd_array, color_sub, para_env)
181 IF (my_do_fulldiag)
THEN
184 para_env, diag_runtime_est)
195 CALL create_a(fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, &
196 fm_a_bse, eigenval_reduced, unit_nr, &
197 homo_red, virtual_red, dimen_ri, mp2_env, &
200 CALL create_a(fm_mat_s_ia_trunc, fm_mat_s_bar_ij_bse, fm_mat_s_ab_trunc, &
201 fm_a_bse, eigenval_reduced, unit_nr, &
202 homo_red, virtual_red, dimen_ri, mp2_env, &
215 CALL create_b(fm_mat_s_ia_trunc, fm_mat_s_ia_trunc, fm_b_bse, &
216 homo_red, virtual_red, dimen_ri, unit_nr, mp2_env)
218 CALL create_b(fm_mat_s_ia_trunc, fm_mat_s_bar_ia_bse, fm_b_bse, &
219 homo_red, virtual_red, dimen_ri, unit_nr, mp2_env)
226 fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, &
227 homo_red, virtual_red, unit_nr, mp2_env, diag_runtime_est)
231 NULLIFY (dft_control, tddfpt_control)
232 CALL get_qs_env(qs_env, dft_control=dft_control)
233 tddfpt_control => dft_control%tddfpt2_control
234 IF ((my_do_tda) .AND. (.NOT. tddfpt_control%do_bse))
THEN
236 CALL diagonalize_a(fm_a_bse, homo_red, virtual_red, homo(1), &
237 unit_nr, diag_runtime_est, mp2_env, qs_env, mo_coeff)
245 CALL diagonalize_c(fm_c_bse, homo_red, virtual_red, homo(1), &
246 fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, &
247 unit_nr, diag_runtime_est, mp2_env, qs_env, mo_coeff)
254 fm_mat_s_ia_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, &
255 fm_mat_q_static_bse_gemm, mp2_env)
256 DEALLOCATE (eigenval_reduced)
257 IF (my_do_iterat_diag)
THEN
260 b_iaq_bse_local, homo(1), virtual(1), mp2_env%bse%bse_spin_config, unit_nr, &
261 eigenval(:, 1, 1), para_env, mp2_env)
263 DEALLOCATE (b_bar_ijq_bse_local, b_abq_bse_local, b_bar_iaq_bse_local, b_iaq_bse_local)
266 IF (unit_nr > 0)
THEN
267 WRITE (unit_nr,
'(T2,A4,T7,A53)')
'BSE|',
'The BSE was successfully calculated. Have a nice day!'
270 CALL timestop(handle)
Routines for the full diagonalization of GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public diagonalize_a(fm_a, homo, virtual, homo_irred, unit_nr, diag_est, mp2_env, qs_env, mo_coeff)
Solving hermitian eigenvalue equation A X^n = Ω^n X^n.
subroutine, public diagonalize_c(fm_c, homo, virtual, homo_irred, fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, unit_nr, diag_est, mp2_env, qs_env, mo_coeff)
Solving eigenvalue equation C Z^n = (Ω^n)^2 Z^n . Here, the eigenvectors Z^n relate to X^n via Eq....
subroutine, public create_b(fm_mat_s_ia_bse, fm_mat_s_bar_ia_bse, fm_b, homo, virtual, dimen_ri, unit_nr, mp2_env)
Matrix B constructed from 3c-B-matrices (cf. subroutine mult_B_with_W) B_ia,jb = α * v_ia,...
subroutine, public create_hermitian_form_of_abba(fm_a, fm_b, fm_c, fm_sqrt_a_minus_b, fm_inv_sqrt_a_minus_b, homo, virtual, unit_nr, mp2_env, diag_est)
Construct Matrix C=(A-B)^0.5 (A+B) (A-B)^0.5 to solve full BSE matrix as a hermitian problem (cf....
subroutine, public create_a(fm_mat_s_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_ab_bse, fm_a, eigenval, unit_nr, homo, virtual, dimen_ri, mp2_env, para_env, qs_env)
Matrix A constructed from GW energies and 3c-B-matrices (cf. subroutine mult_B_with_W) A_ia,...
Iterative routines for GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public do_subspace_iterations(b_bar_ijq_bse_local, b_abq_bse_local, b_bar_iaq_bse_local, b_iaq_bse_local, homo, virtual, bse_spin_config, unit_nr, eigenval, para_env, mp2_env)
...
subroutine, public fill_local_3c_arrays(fm_mat_s_ab_bse, fm_mat_s, fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, b_bar_ijq_bse_local, b_abq_bse_local, b_bar_iaq_bse_local, b_iaq_bse_local, dimen_ri, homo, virtual, gd_array, color_sub, para_env)
...
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.
Routines for printing information in context of the BSE calculation.
subroutine, public print_bse_start_flag(bse_tda, bse_abba, unit_nr)
...
Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public estimate_bse_resources(homo_red, virtual_red, unit_nr, bse_abba, para_env, diag_runtime_est)
Roughly estimates the needed runtime and memory during the BSE run.
subroutine, public deallocate_matrices_bse(fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_s_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, fm_mat_q_static_bse_gemm, mp2_env)
...
subroutine, public mult_b_with_w(fm_mat_s_ij_bse, fm_mat_s_ia_bse, fm_mat_s_bar_ia_bse, fm_mat_s_bar_ij_bse, fm_mat_q_static_bse_gemm, dimen_ri, homo, virtual)
Multiplies B-matrix (RI-3c-Integrals) with W (screening) to obtain \bar{B}.
subroutine, public adapt_bse_input_params(homo, virtual, unit_nr, mp2_env, qs_env)
Checks BSE input section and adapts them if necessary.
subroutine, public truncate_bse_matrices(fm_mat_s_ia_bse, fm_mat_s_ij_bse, fm_mat_s_ab_bse, fm_mat_s_trunc, fm_mat_s_ij_trunc, fm_mat_s_ab_trunc, eigenval_scf, eigenval, eigenval_reduced, homo, virtual, dimen_ri, unit_nr, bse_lev_virt, homo_red, virt_red, mp2_env)
Determines indices within the given energy cutoffs and truncates Eigenvalues and matrices.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
represent a full matrix distributed on many processors
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public debug_print_level
Types to describe group distributions.
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
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, mimic, 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, sab_cneo, 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, xcint_weights, 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, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_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, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment