42#include "./base/base_uses.f90"
48 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'bse_properties'
58 REAL(kind=
dp),
DIMENSION(3) :: r_e = 0.0_dp, &
65 sigma_e_dir = 0.0_dp, &
66 sigma_h_dir = 0.0_dp, &
68 REAL(kind=
dp),
DIMENSION(3, 3) :: r_e_h = 0.0_dp, &
70 corr_e_h_matrix = 0.0_dp
71 REAL(kind=
dp) :: sigma_e = 0.0_dp, &
73 cov_e_h_sum = 0.0_dp, &
75 diff_r_abs = 0.0_dp, &
76 diff_r_sqr = 0.0_dp, &
78 LOGICAL :: flag_tda = .false.
100 trans_mom_bse, oscill_str, polarizability_residues, &
101 homo_red, virtual_red, fm_eigvec_Y)
104 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
105 INTENT(IN) :: exc_ens
106 TYPE(
cp_fm_type),
DIMENSION(3) :: fm_dipole_ai_trunc
107 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
108 INTENT(OUT) :: trans_mom_bse
109 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
110 INTENT(OUT) :: oscill_str
111 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
112 INTENT(OUT) :: polarizability_residues
113 INTEGER,
INTENT(IN) :: homo_red, virtual_red
114 TYPE(
cp_fm_type),
INTENT(IN),
OPTIONAL :: fm_eigvec_y
116 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_oscillator_strengths'
118 INTEGER :: handle, idir, jdir, n, n_exc
120 fm_struct_trans_mom_bse
122 TYPE(
cp_fm_type),
DIMENSION(3) :: fm_dipole_mo_trunc_reordered, &
123 fm_dipole_per_dir, fm_trans_mom_bse
125 CALL timeset(routinen, handle)
130 CALL cp_fm_struct_create(fm_struct_dipole_mo_trunc_reordered, fm_eigvec_x%matrix_struct%para_env, &
131 fm_eigvec_x%matrix_struct%context, 1, homo_red*virtual_red)
133 fm_eigvec_x%matrix_struct%context, 1, n_exc)
140 CALL cp_fm_create(fm_dipole_mo_trunc_reordered(idir), matrix_struct=fm_struct_dipole_mo_trunc_reordered, &
141 name=
"dipoles_mo_reordered")
142 CALL cp_fm_set_all(fm_dipole_mo_trunc_reordered(idir), 0.0_dp)
143 CALL cp_fm_permute(fm_dipole_mo_trunc_reordered(idir), fm_dipole_ai_trunc(idir), 1.0_dp, 1, 1, 1, &
144 virtual_red, [2, 4, 3, 1])
149 CALL cp_fm_create(fm_trans_mom_bse(idir), matrix_struct=fm_struct_trans_mom_bse, &
150 name=
"excitonic_dipoles")
155 CALL cp_fm_create(fm_eigvec_xysum, matrix_struct=fm_eigvec_x%matrix_struct, name=
"excit_amplitude_sum")
158 IF (
PRESENT(fm_eigvec_y))
THEN
162 CALL parallel_gemm(
'N',
'N', 1, n_exc, homo_red*virtual_red, sqrt(2.0_dp), &
163 fm_dipole_mo_trunc_reordered(idir), fm_eigvec_xysum, 0.0_dp, fm_trans_mom_bse(idir))
167 ALLOCATE (oscill_str(n_exc))
170 ALLOCATE (trans_mom_bse(3, 1, n_exc))
171 ALLOCATE (polarizability_residues(3, 3, n_exc))
172 trans_mom_bse(:, :, :) = 0.0_dp
182 polarizability_residues(idir, jdir, n) = 2.0_dp*exc_ens(n)*trans_mom_bse(idir, 1, n)*trans_mom_bse(jdir, 1, n)
185 oscill_str(n) = 2.0_dp/3.0_dp*exc_ens(n)*sum(abs(trans_mom_bse(:, 1, n))**2)
197 CALL timestop(handle)
214 info_approximation, unit_nr, bse_env)
216 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
217 INTENT(IN) :: oscill_str
218 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
219 INTENT(IN) :: polarizability_residues
220 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
221 INTENT(IN) :: exc_ens
222 CHARACTER(LEN=10) :: info_approximation
223 INTEGER,
INTENT(IN) :: unit_nr
226 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_and_print_absorption_spectrum'
228 CHARACTER(LEN=10) :: eta_str, width_eta_format_str
229 CHARACTER(LEN=40) :: file_name_crosssection, &
231 INTEGER :: handle, i, idir, j, jdir, k, num_steps, &
232 unit_nr_file, width_eta
233 REAL(kind=
dp) :: eta, freq_end, freq_start, freq_step, &
235 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: abs_cross_section, abs_spectrum
236 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eta_list
238 CALL timeset(routinen, handle)
240 freq_step = bse_env%bse_spectrum_freq_step_size
241 freq_start = bse_env%bse_spectrum_freq_start
242 freq_end = bse_env%bse_spectrum_freq_end
243 eta_list => bse_env%bse_eta_spectrum_list
246 num_steps = nint((freq_end - freq_start)/freq_step) + 1
248 DO k = 1,
SIZE(eta_list)
252 width_eta = max(1, int(log10(eta)) + 1) + 4
253 WRITE (width_eta_format_str,
"(A2,I0,A3)")
'(F', width_eta,
'.3)'
254 WRITE (eta_str, width_eta_format_str) eta*
evolt
256 file_name_spectrum =
'BSE'//trim(adjustl(info_approximation))//
'eta='//trim(eta_str)//
'.spectrum'
257 file_name_crosssection =
'BSE'//trim(adjustl(info_approximation))//
'eta='//trim(eta_str)//
'.crosssection'
261 ALLOCATE (abs_spectrum(num_steps, 11))
262 abs_spectrum(:, :) = 0.0_dp
265 ALLOCATE (abs_cross_section(num_steps, 11))
266 abs_cross_section(:, :) = 0.0_dp
281 omega = freq_start + (i - 1)*freq_step
282 abs_spectrum(i, 1) = omega
283 DO j = 1,
SIZE(oscill_str)
284 abs_spectrum(i, 2) = abs_spectrum(i, 2) - oscill_str(j)* &
285 aimag(1/((omega + cmplx(0.0, eta, kind=
dp))**2 - exc_ens(j)**2))
290 abs_spectrum(i, 2 + (idir - 1)*3 + jdir) = abs_spectrum(i, 2 + (idir - 1)*3 + jdir) &
291 - polarizability_residues(idir, jdir, j)* &
292 aimag(1/((omega + cmplx(0.0, eta, kind=
dp))**2 - exc_ens(j)**2))
300 omega = abs_spectrum(i, 1)
301 abs_cross_section(i, 1) = omega
302 abs_cross_section(i, 2:) = 4.0_dp*
pi*abs_spectrum(i, 2:)*omega/
c_light_au
306 IF (bse_env%bse_debug_print)
THEN
307 IF (unit_nr > 0)
THEN
308 WRITE (unit_nr,
'(T2,A10,T13,A,T65,F16.4)')
'BSE|DEBUG|', &
309 'Averaged dynamical dipole polarizability at 8.2 eV:', &
311 WRITE (unit_nr,
'(T2,A10,T13,A,T65,F16.4)')
'BSE|DEBUG|', &
312 'Averaged photoabsorption cross section at 8.2 eV:', &
313 abs_cross_section(83, 2)
319 IF (bse_env%para_env%is_source())
THEN
320 CALL open_file(file_name_crosssection, unit_number=unit_nr_file, &
321 file_status=
"UNKNOWN", file_action=
"WRITE")
322 WRITE (unit_nr_file,
'(A,A6)')
"# Photoabsorption cross section σ_{µ µ'}(ω) = -4πω/c * Im[ \sum_n "// &
323 "[2 Ω^n d_µ^n d_µ'^n] / [(ω+iη)²- (Ω^n)²] ] from Bethe Salpeter equation for method ", &
324 trim(adjustl(info_approximation))
325 WRITE (unit_nr_file,
'(A20,1X,10(2X,A20,1X))')
"# Frequency (eV)",
"σ_{avg}(ω)",
"σ_xx(ω)", &
326 "σ_xy(ω)",
"σ_xz(ω)",
"σ_yx(ω)",
"σ_yy(ω)",
"σ_yz(ω)",
"σ_zx(ω)", &
329 WRITE (unit_nr_file,
'(11(F20.8,1X))') abs_cross_section(i, 1)*
evolt, abs_cross_section(i, 2:11)
333 DEALLOCATE (abs_cross_section)
335 IF (bse_env%para_env%is_source())
THEN
336 CALL open_file(file_name_spectrum, unit_number=unit_nr_file, &
337 file_status=
"UNKNOWN", file_action=
"WRITE")
338 WRITE (unit_nr_file,
'(A,A6)')
"# Imaginary part of polarizability α_{µ µ'}(ω) = -\sum_n "// &
339 "[2 Ω^n d_µ^n d_µ'^n] / [(ω+iη)²- (Ω^n)²] from Bethe Salpeter equation for method ", &
340 trim(adjustl(info_approximation))
341 WRITE (unit_nr_file,
'(A20,1X,10(2X,A20,1X))')
"# Frequency (eV)",
"Im{α_{avg}(ω)}",
"Im{α_xx(ω)}", &
342 "Im{α_xy(ω)}",
"Im{α_xz(ω)}",
"Im{α_yx(ω)}",
"Im{α_yy(ω)}",
"Im{α_yz(ω)}",
"Im{α_zx(ω)}", &
343 "Im{α_zy(ω)}",
"Im{α_zz(ω)}"
345 WRITE (unit_nr_file,
'(11(F20.8,1X))') abs_spectrum(i, 1)*
evolt, abs_spectrum(i, 2:11)
349 DEALLOCATE (abs_spectrum)
352 IF (unit_nr > 0)
THEN
353 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
354 WRITE (unit_nr,
'(T2,A4,T7,A,A)') &
355 'BSE|',
"Printed optical absorption spectrum to local files, e.g. "
356 WRITE (unit_nr,
'(T2,A4,T7,A)') &
357 'BSE|', file_name_spectrum
358 WRITE (unit_nr,
'(T2,A4,T7,A,A)') &
359 'BSE|',
"as well as photoabsorption cross section to, e.g. "
360 WRITE (unit_nr,
'(T2,A4,T7,A)') &
361 'BSE|', file_name_crosssection
362 WRITE (unit_nr,
'(T2,A4,T7,A52)') &
363 'BSE|',
"using the Eq. (7.51) from C. Ullrichs Book on TDDFT:"
364 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
365 WRITE (unit_nr,
'(T2,A4,T10,A75)') &
366 'BSE|',
"Im{α_{avg}(ω)} = -Im{\sum_{n=1}^{N_exc} \frac{f_n}{(ω+iη)² - (Ω^n)²}}"
367 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
368 WRITE (unit_nr,
'(T2,A4,T7,A)') &
369 'BSE|',
"or for the full polarizability tensor:"
370 WRITE (unit_nr,
'(T2,A4,T10,A)') &
371 'BSE|',
"α_{µ µ'}(ω) = -\sum_n [2 Ω^n d_µ^n d_µ'^n] / [(ω+iη)²- (Ω^n)²]"
372 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
373 WRITE (unit_nr,
'(T2,A4,T7,A)') &
374 'BSE|',
"as well as Eq. (7.48):"
375 WRITE (unit_nr,
'(T2,A4,T10,A)') &
376 'BSE|',
"σ_{µ µ'}(ω) = 4πω Im{α_{µ µ'}(ω)} / c"
377 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
378 WRITE (unit_nr,
'(T2,A4,T7,A)') &
379 'BSE|',
"with transition moments d_µ^n, oscillator strengths f_n,"
380 WRITE (unit_nr,
'(T2,A4,T7,A)') &
381 'BSE|',
"excitation energies Ω^n and the speed of light c."
382 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
383 WRITE (unit_nr,
'(T2,A4,T7,A)') &
384 'BSE|',
"Please note that we adopt an additional minus sign for both quantities,"
385 WRITE (unit_nr,
'(T2,A4,T7,A)') &
386 'BSE|',
"due to the convention for charge vs particle density as done in MolGW:"
387 WRITE (unit_nr,
'(T2,A4,T7,A)') &
388 'BSE|',
"https://doi.org/10.1016/j.cpc.2016.06.019."
389 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
392 CALL timestop(handle)
409 mo_coeff, homo, virtual, &
410 info_approximation, &
415 TYPE(
cp_fm_type),
INTENT(IN),
OPTIONAL :: fm_y
416 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: mo_coeff
417 INTEGER,
INTENT(IN) :: homo, virtual
418 CHARACTER(LEN=10) :: info_approximation
419 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: oscill_str
421 INTEGER,
INTENT(IN) :: unit_nr
423 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calculate_NTOs'
424 REAL(kind=
dp),
PARAMETER :: coeff_err = 1.0e-5_dp
426 CHARACTER(LEN=20),
DIMENSION(2) :: nto_name
427 INTEGER :: handle, homo_irred, i, i_nto, info_svd, &
428 j, n_exc, n_nto, nao_full, nao_trunc
429 INTEGER,
DIMENSION(:),
POINTER :: stride
430 LOGICAL :: append_cube, cube_file
431 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: eigval_svd_squ
432 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigval_svd
434 fm_struct_nto_holes, &
435 fm_struct_nto_particles, &
437 TYPE(
cp_fm_type) :: fm_eigvl, fm_eigvr_t, fm_m, fm_mo_coeff, fm_nto_coeff_holes, &
438 fm_nto_coeff_particles, fm_nto_set, fm_x_ia, fm_y_ai
439 TYPE(
mo_set_type),
ALLOCATABLE,
DIMENSION(:) :: nto_set
442 CALL timeset(routinen, handle)
443 bse_section => bse_env%bse_section
445 nao_full = bse_env%mos(1)%nao
446 nao_trunc = homo + virtual
448 homo_irred = bse_env%mos(1)%homo
457 fm_x%matrix_struct%para_env, fm_x%matrix_struct%context, &
458 nao_trunc, nao_trunc)
460 fm_x%matrix_struct%para_env, fm_x%matrix_struct%context, &
463 fm_x%matrix_struct%para_env, fm_x%matrix_struct%context, &
466 fm_x%matrix_struct%para_env, fm_x%matrix_struct%context, &
469 CALL cp_fm_create(fm_mo_coeff, matrix_struct=fm_struct_mo_coeff, &
475 nao_full, nao_trunc, &
476 1, homo_irred - homo + 1, &
478 mo_coeff(1)%matrix_struct%context)
481 IF (unit_nr > 0)
THEN
482 WRITE (unit_nr,
'(T2,A4,T7,A)')
'BSE|', &
483 'The Natural Transition Orbital (NTO) pairs φ_I(r_e) and χ_I(r_h) for a fixed'
484 WRITE (unit_nr,
'(T2,A4,T7,A)')
'BSE|', &
485 'excitation index n are obtained by singular value decomposition of T'
486 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
487 WRITE (unit_nr,
'(T2,A4,T15,A)')
'BSE|', &
489 IF (
PRESENT(fm_y))
THEN
490 WRITE (unit_nr,
'(T2,A4,T15,A)')
'BSE|', &
493 WRITE (unit_nr,
'(T2,A4,T15,A)')
'BSE|', &
496 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
497 WRITE (unit_nr,
'(T2,A4,T15,A)')
'BSE|', &
499 WRITE (unit_nr,
'(T2,A4,T15,A)')
'BSE|', &
500 'φ_I(r_e) = \sum_p V_pI ψ_p(r_e)'
501 WRITE (unit_nr,
'(T2,A4,T15,A)')
'BSE|', &
502 'χ_I(r_h) = \sum_p U_pI ψ_p(r_e)'
503 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
504 WRITE (unit_nr,
'(T2,A4,T7,A)')
'BSE|', &
505 'where we have introduced'
506 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
507 WRITE (unit_nr,
'(T2,A4,T7,A,T20,A)') &
508 'BSE|',
"ψ_p:",
"occupied and virtual molecular orbitals,"
509 WRITE (unit_nr,
'(T2,A4,T7,A,T20,A)') &
510 'BSE|',
"φ_I(r_e):",
"NTO state for the electron,"
511 WRITE (unit_nr,
'(T2,A4,T7,A,T20,A)') &
512 'BSE|',
"χ_I(r_h):",
"NTO state for the hole,"
513 WRITE (unit_nr,
'(T2,A4,T7,A,T20,A)') &
514 'BSE|',
"Λ:",
"diagonal matrix of NTO weights λ_I,"
515 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
516 WRITE (unit_nr,
'(T2,A4,T7,A)')
'BSE|', &
517 "The NTOs are calculated with the following settings:"
518 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
519 WRITE (unit_nr,
'(T2,A4,T7,A,T71,I10)')
'BSE|',
'Number of excitations, for which NTOs are computed', &
520 bse_env%num_print_exc_ntos
521 IF (bse_env%eps_nto_osc_str > 0.0_dp)
THEN
522 WRITE (unit_nr,
'(T2,A4,T7,A,T71,F10.3)')
'BSE|',
'Threshold for oscillator strength f^n', &
523 bse_env%eps_nto_osc_str
525 WRITE (unit_nr,
'(T2,A4,T7,A,T71,A10)')
'BSE|',
'Threshold for oscillator strength f^n', &
528 WRITE (unit_nr,
'(T2,A4,T7,A,T72,F10.3)')
'BSE|',
'Threshold for NTO weights (λ_I)^2', &
529 bse_env%eps_nto_eigval
533 IF (unit_nr > 0)
THEN
534 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
535 IF (.NOT.
PRESENT(fm_y))
THEN
536 WRITE (unit_nr,
'(T2,A4,T7,A)')
'BSE|', &
537 'NTOs from solving the BSE within the TDA:'
539 WRITE (unit_nr,
'(T2,A4,T7,A)')
'BSE|', &
540 'NTOs from solving the BSE without the TDA:'
542 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
543 WRITE (unit_nr,
'(T2,A4,T8,A12,T22,A8,T33,A14,T62,A)')
'BSE|', &
544 'Excitation n',
"TDA/ABBA",
"Index of NTO I",
'NTO weights (λ_I)^2'
547 DO j = 1, bse_env%num_print_exc_ntos
548 n_exc = bse_env%bse_nto_state_list_final(j)
550 IF (bse_env%eps_nto_osc_str > 0.0_dp)
THEN
552 IF (oscill_str(n_exc) < bse_env%eps_nto_osc_str)
THEN
554 IF (unit_nr > 0)
THEN
555 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
556 WRITE (unit_nr,
'(T2,A4,T8,I12,T24,A6,T42,A39)')
'BSE|', &
557 n_exc, info_approximation,
"Skipped (Oscillator strength too small)"
564 name=
"single_part_trans_dm")
567 CALL cp_fm_create(fm_nto_coeff_holes, matrix_struct=fm_struct_nto_holes, &
568 name=
"nto_coeffs_holes")
571 CALL cp_fm_create(fm_nto_coeff_particles, matrix_struct=fm_struct_nto_particles, &
572 name=
"nto_coeffs_particles")
585 IF (
PRESENT(fm_y))
THEN
603 matrix_struct=fm_m%matrix_struct, &
604 name=
"LEFT_SINGULAR_MATRIX")
607 matrix_struct=fm_m%matrix_struct, &
608 name=
"RIGHT_SINGULAR_MATRIX")
611 ALLOCATE (eigval_svd(nao_trunc))
612 eigval_svd(:) = 0.0_dp
614 CALL cp_fm_svd(fm_m, fm_eigvl, fm_eigvr_t, eigval_svd, info_svd)
615 IF (info_svd /= 0)
THEN
616 IF (unit_nr > 0)
THEN
617 CALL cp_warn(__location__, &
618 "SVD for computation of NTOs not successful. "// &
619 "Skipping print of NTOs.")
620 IF (info_svd > 0)
THEN
621 CALL cp_warn(__location__, &
622 "PDGESVD detected heterogeneity. "// &
623 "Decreasing number of MPI ranks might solve this issue.")
632 ALLOCATE (eigval_svd_squ(nao_trunc))
633 eigval_svd_squ(:) = eigval_svd(:)**2
635 IF (.NOT.
PRESENT(fm_y))
THEN
636 IF (abs(sum(eigval_svd_squ) - 1) >= coeff_err)
THEN
637 cpwarn(
"Sum of NTO coefficients deviates from 1!")
643 CALL parallel_gemm(
"N",
"N", nao_full, nao_trunc, nao_trunc, 1.0_dp, fm_mo_coeff, fm_eigvl, 0.0_dp, &
647 CALL parallel_gemm(
"N",
"T", nao_full, nao_trunc, nao_trunc, 1.0_dp, fm_mo_coeff, fm_eigvr_t, 0.0_dp, &
648 fm_nto_coeff_particles)
656 nto_name(1) =
'Hole_coord'
657 nto_name(2) =
'Particle_coord'
658 ALLOCATE (nto_set(2))
661 DO i_nto = 1, nao_trunc
662 IF (eigval_svd_squ(i_nto) > bse_env%eps_nto_eigval)
THEN
670 IF (unit_nr > 0)
THEN
671 WRITE (unit_nr,
'(T2,A4)')
'BSE|'
673 WRITE (unit_nr,
'(T2,A4,T8,I12,T24,A6,T41,I6,T71,F10.5)')
'BSE|', &
674 n_exc, info_approximation, i_nto, eigval_svd_squ(i_nto)
682 CALL allocate_mo_set(nto_set(i), nao_trunc, n_nto, 0, 0.0_dp, 2.0_dp, 0.0_dp)
683 CALL init_mo_set(nto_set(i), fm_ref=fm_nto_set, name=nto_name(i))
689 CALL cp_fm_to_fm(fm_nto_coeff_holes, nto_set(1)%mo_coeff, ncol=n_nto)
690 CALL cp_fm_to_fm(fm_nto_coeff_particles, nto_set(2)%mo_coeff, ncol=n_nto)
699 stride, append_cube, nto_section)
704 DEALLOCATE (eigval_svd)
705 DEALLOCATE (eigval_svd_squ)
719 CALL timestop(handle)
736 fm_multipole_ij_trunc, fm_multipole_ab_trunc, &
737 fm_multipole_ai_trunc, &
738 i_exc, homo, virtual, &
742 DIMENSION(:) :: exc_descr
744 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:), &
745 INTENT(IN) :: fm_multipole_ij_trunc, &
746 fm_multipole_ab_trunc, &
747 fm_multipole_ai_trunc
748 INTEGER,
INTENT(IN) :: i_exc, homo, virtual
749 TYPE(
cp_fm_type),
INTENT(IN),
OPTIONAL :: fm_y_ia
751 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_exciton_descriptors'
753 INTEGER :: handle, i_dir, j_dir
754 INTEGER,
DIMENSION(3) :: mask_quadrupole
756 REAL(kind=
dp) :: norm_x, norm_xpy, norm_y
757 REAL(kind=
dp),
DIMENSION(3) :: r_e_sq_x, r_e_sq_y, r_e_x, r_e_y, &
758 r_h_sq_x, r_h_sq_y, r_h_x, r_h_y
759 REAL(kind=
dp),
DIMENSION(3, 3) :: r_e_h_xx, r_e_h_xy, r_e_h_yy
761 TYPE(
cp_fm_type) :: fm_work_ba, fm_work_ia, fm_work_ia_2
763 CALL timeset(routinen, handle)
764 IF (
PRESENT(fm_y_ia))
THEN
772 mask_quadrupole = [4, 7, 9]
775 context=fm_x_ia%matrix_struct%context, nrow_global=homo, ncol_global=virtual)
777 context=fm_x_ia%matrix_struct%context, nrow_global=virtual, ncol_global=virtual)
787 r_e_h_xx(:, :) = 0.0_dp
788 r_e_h_xy(:, :) = 0.0_dp
789 r_e_h_yy(:, :) = 0.0_dp
796 exc_descr(i_exc)%r_e(:) = 0.0_dp
797 exc_descr(i_exc)%r_h(:) = 0.0_dp
798 exc_descr(i_exc)%r_e_sq(:) = 0.0_dp
799 exc_descr(i_exc)%r_h_sq(:) = 0.0_dp
800 exc_descr(i_exc)%r_e_h(:, :) = 0.0_dp
802 exc_descr(i_exc)%flag_TDA = flag_tda
803 exc_descr(i_exc)%norm_XpY = 0.0_dp
809 IF (.NOT. flag_tda)
THEN
811 norm_xpy = norm_xpy + norm_y
814 exc_descr(i_exc)%norm_XpY = norm_xpy
820 r_h_x(i_dir) = r_h_x(i_dir)/norm_xpy
821 IF (.NOT. flag_tda)
THEN
824 r_h_y(i_dir) = r_h_y(i_dir)/norm_xpy
827 exc_descr(i_exc)%r_h(:) = r_h_x(:) + r_h_y(:)
833 r_e_x(i_dir) = r_e_x(i_dir)/norm_xpy
834 IF (.NOT. flag_tda)
THEN
837 r_e_y(i_dir) = r_e_y(i_dir)/norm_xpy
840 exc_descr(i_exc)%r_e(:) = r_e_x(:) + r_e_y(:)
846 fm_x_ia, r_h_sq_x(i_dir))
847 r_h_sq_x(i_dir) = r_h_sq_x(i_dir)/norm_xpy
848 IF (.NOT. flag_tda)
THEN
851 fm_multipole_ab_trunc(mask_quadrupole(i_dir)), r_h_sq_y(i_dir))
852 r_h_sq_y(i_dir) = r_h_sq_y(i_dir)/norm_xpy
855 exc_descr(i_exc)%r_h_sq(:) = r_h_sq_x(:) + r_h_sq_y(:)
861 fm_multipole_ab_trunc(mask_quadrupole(i_dir)), r_e_sq_x(i_dir))
862 r_e_sq_x(i_dir) = r_e_sq_x(i_dir)/norm_xpy
863 IF (.NOT. flag_tda)
THEN
866 fm_y_ia, r_e_sq_y(i_dir))
867 r_e_sq_y(i_dir) = r_e_sq_y(i_dir)/norm_xpy
870 exc_descr(i_exc)%r_e_sq(:) = r_e_sq_x(:) + r_e_sq_y(:)
886 CALL parallel_gemm(
"N",
"N", homo, virtual, virtual, 1.0_dp, &
887 fm_x_ia, fm_multipole_ab_trunc(i_dir), 0.0_dp, fm_work_ia)
890 fm_multipole_ij_trunc(j_dir), fm_work_ia, 0.0_dp, fm_work_ia_2)
892 CALL cp_fm_trace(fm_x_ia, fm_work_ia_2, r_e_h_xx(i_dir, j_dir))
893 r_e_h_xx(i_dir, j_dir) = r_e_h_xx(i_dir, j_dir)/norm_xpy
894 IF (.NOT. flag_tda)
THEN
899 CALL parallel_gemm(
"N",
"N", homo, virtual, virtual, 1.0_dp, &
900 fm_y_ia, fm_multipole_ab_trunc(j_dir), 0.0_dp, fm_work_ia)
903 fm_multipole_ij_trunc(i_dir), fm_work_ia, 0.0_dp, fm_work_ia_2)
905 CALL cp_fm_trace(fm_y_ia, fm_work_ia_2, r_e_h_yy(i_dir, j_dir))
906 r_e_h_yy(i_dir, j_dir) = r_e_h_yy(i_dir, j_dir)/norm_xpy
920 CALL parallel_gemm(
"T",
"T", virtual, virtual, homo, 1.0_dp, &
921 fm_y_ia, fm_multipole_ai_trunc(i_dir), 0.0_dp, fm_work_ba)
923 CALL parallel_gemm(
"T",
"N", homo, virtual, virtual, 1.0_dp, &
924 fm_multipole_ai_trunc(j_dir), fm_work_ba, 0.0_dp, fm_work_ia)
926 CALL cp_fm_trace(fm_work_ia, fm_x_ia, r_e_h_xy(i_dir, j_dir))
927 r_e_h_xy(i_dir, j_dir) = 2.0_dp*r_e_h_xy(i_dir, j_dir)/norm_xpy
931 exc_descr(i_exc)%r_e_h(:, :) = r_e_h_xx(:, :) + r_e_h_xy(:, :) + r_e_h_yy(:, :)
941 exc_descr(i_exc)%diff_r_abs = sqrt(sum((exc_descr(i_exc)%r_h(:) - exc_descr(i_exc)%r_e(:))**2))
944 exc_descr(i_exc)%sigma_e = sqrt(sum(exc_descr(i_exc)%r_e_sq(:)) - sum(exc_descr(i_exc)%r_e(:)**2))
947 exc_descr(i_exc)%sigma_h = sqrt(sum(exc_descr(i_exc)%r_h_sq(:)) - sum(exc_descr(i_exc)%r_h(:)**2))
951 exc_descr(i_exc)%d_eh_dir(i_dir) = abs(exc_descr(i_exc)%r_h(i_dir) - exc_descr(i_exc)%r_e(i_dir))
952 exc_descr(i_exc)%sigma_e_dir(i_dir) = sqrt(exc_descr(i_exc)%r_e_sq(i_dir) - exc_descr(i_exc)%r_e(i_dir)**2)
953 exc_descr(i_exc)%sigma_h_dir(i_dir) = sqrt(exc_descr(i_exc)%r_h_sq(i_dir) - exc_descr(i_exc)%r_h(i_dir)**2)
958 exc_descr(i_exc)%cov_e_h_sum = 0.0_dp
959 exc_descr(i_exc)%cov_e_h(:, :) = 0.0_dp
960 exc_descr(i_exc)%corr_e_h_matrix(:, :) = 0.0_dp
963 exc_descr(i_exc)%cov_e_h(i_dir, j_dir) = exc_descr(i_exc)%r_e_h(i_dir, j_dir) &
964 - exc_descr(i_exc)%r_e(i_dir)*exc_descr(i_exc)%r_h(j_dir)
965 exc_descr(i_exc)%corr_e_h_matrix(i_dir, j_dir) = &
966 exc_descr(i_exc)%cov_e_h(i_dir, j_dir)/ &
967 (exc_descr(i_exc)%sigma_e_dir(i_dir)*exc_descr(i_exc)%sigma_h_dir(j_dir))
969 exc_descr(i_exc)%cov_e_h_sum = exc_descr(i_exc)%cov_e_h_sum + &
970 exc_descr(i_exc)%r_e_h(i_dir, i_dir) - &
971 exc_descr(i_exc)%r_e(i_dir)*exc_descr(i_exc)%r_h(i_dir)
975 exc_descr(i_exc)%corr_e_h = exc_descr(i_exc)%cov_e_h_sum/(exc_descr(i_exc)%sigma_e*exc_descr(i_exc)%sigma_h)
978 exc_descr(i_exc)%diff_r_sqr = sqrt(exc_descr(i_exc)%diff_r_abs**2 + &
979 exc_descr(i_exc)%sigma_e**2 + exc_descr(i_exc)%sigma_h**2 &
980 - 2*exc_descr(i_exc)%cov_e_h_sum)
983 exc_descr(i_exc)%d_exc_dir(i_dir) = sqrt(exc_descr(i_exc)%d_eh_dir(i_dir)**2 + &
984 exc_descr(i_exc)%sigma_e_dir(i_dir)**2 + &
985 exc_descr(i_exc)%sigma_h_dir(i_dir)**2 - &
986 2*exc_descr(i_exc)%cov_e_h(i_dir, i_dir))
990 exc_descr(i_exc)%r_e_shift(:) = exc_descr(i_exc)%r_e(:)
991 exc_descr(i_exc)%r_h_shift(:) = exc_descr(i_exc)%r_h(:)
996 CALL timestop(handle)
Routines for computing excitonic properties, e.g. exciton diameter, from the BSE.
subroutine, public compute_and_print_absorption_spectrum(oscill_str, polarizability_residues, exc_ens, info_approximation, unit_nr, bse_env)
Computes and returns absorption spectrum for the frequency range and broadening provided by the user....
subroutine, public get_oscillator_strengths(fm_eigvec_x, exc_ens, fm_dipole_ai_trunc, trans_mom_bse, oscill_str, polarizability_residues, homo_red, virtual_red, fm_eigvec_y)
Compute and return BSE dipoles d_r^n = sqrt(2) sum_ia < ψ_i | r | ψ_a > ( X_ia^n + Y_ia^n ) and oscil...
subroutine, public get_exciton_descriptors(exc_descr, fm_x_ia, fm_multipole_ij_trunc, fm_multipole_ab_trunc, fm_multipole_ai_trunc, i_exc, homo, virtual, fm_y_ia)
...
subroutine, public calculate_ntos(fm_x, fm_y, mo_coeff, homo, virtual, info_approximation, oscill_str, bse_env, unit_nr)
...
The BSE environment: the settings of the &BSE section and the state a GW path prepares for the solver...
Auxiliary routines for GW + Bethe-Salpeter for computing electronic excitations.
subroutine, public trace_exciton_descr(fm_a, fm_b, fm_c, alpha)
Computes trace of form Tr{A^T B C} for exciton descriptors.
subroutine, public reshuffle_eigvec(fm_eigvec, fm_eigvec_reshuffled, homo, virtual, n_exc, do_transpose)
...
subroutine, public print_bse_nto_cubes(bse_env, mos, istate, info_approximation, stride, append_cube, print_section)
Borrowed from the tddfpt module with slight adaptions.
Utility routines to open and close files.
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
subroutine, public close_file(unit_number, file_status)
Closes an open file given by its logical unit number.
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....
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_svd(matrix_a, matrix_eigvl, matrix_eigvr_t, eigval, info)
decomposes a quadratic matrix into its singular value decomposition
Redistribution of full matrices and distributed arrays.
subroutine, public cp_fm_permute(fm_out, fm_in, beta, nrow_secidx_in, ncol_secidx_in, nrow_secidx_out, ncol_secidx_out, reordering, row_offset, col_offset, first_index, last_index)
Add a permuted or restricted four-index tensor stored as a full matrix.
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_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_to_fm_submat_general(source, destination, nrows, ncols, s_firstrow, s_firstcol, d_firstrow, d_firstcol, global_context)
General copy of a submatrix of fm matrix to a submatrix of another fm matrix. The two matrices can ha...
subroutine, public cp_fm_to_fm_submat(msource, mtarget, nrow, ncol, s_firstrow, s_firstcol, t_firstrow, t_firstcol)
copy just a part ot the matrix
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, nrow, ncol, set_zero)
creates a new full matrix with the given structure
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
basic linear algebra operations for full matrixes
Definition of physical constants:
real(kind=dp), parameter, public c_light_au
real(kind=dp), parameter, public evolt
Definition and initialisation of the mo data type.
subroutine, public init_mo_set(mo_set, fm_pool, fm_ref, fm_struct, name, counter, complex_coeff)
initializes an allocated mo_set. eigenvalues, mo_coeff, occupation_numbers are valid only after this ...
subroutine, public allocate_mo_set(mo_set, nao, nmo, nelectron, n_el_f, maxocc, flexible_electron_count)
Allocates a mo set and partially initializes it (nao,nmo,nelectron, and flexible_electron_count are v...
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
Settings of the &BSE section (read_bse_section, re-read before every BSE run, normalised in place by ...
keeps the information about the structure of a full matrix