55#include "../base/base_uses.f90"
61 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
"rt_bse_io"
90 WRITE (rtbse_env%unit_nr, *)
''
91 WRITE (rtbse_env%unit_nr,
'(A)')
' /-----------------------------------------------'// &
92 '------------------------------\'
93 WRITE (rtbse_env%unit_nr,
'(A)')
' | '// &
95 WRITE (rtbse_env%unit_nr,
'(A)')
' | Real Time Bethe-Salpeter Propagation'// &
97 WRITE (rtbse_env%unit_nr,
'(A)')
' | '// &
99 WRITE (rtbse_env%unit_nr,
'(A)')
' \-----------------------------------------------'// &
100 '------------------------------/'
101 WRITE (rtbse_env%unit_nr, *)
''
104 WRITE (rtbse_env%unit_nr,
'(A19)', advance=
"no")
' Exponential method'
105 SELECT CASE (rtbse_env%mat_exp_method)
107 WRITE (rtbse_env%unit_nr,
'(A61)')
'BCH'
109 WRITE (rtbse_env%unit_nr,
'(A61)')
'EXACT'
112 WRITE (rtbse_env%unit_nr,
'(A22)', advance=
"no")
' Reference Hamiltonian'
113 SELECT CASE (rtbse_env%ham_reference_type)
115 WRITE (rtbse_env%unit_nr,
'(A58)')
'G0W0'
117 WRITE (rtbse_env%unit_nr,
'(A58)')
'Kohn-Sham'
120 WRITE (rtbse_env%unit_nr,
'(A18,L62)')
' Apply delta pulse', &
121 rtbse_env%dft_control%rtp_control%apply_delta_pulse
123 WRITE (rtbse_env%unit_nr,
'(A)')
''
134 REAL(kind=
dp) :: metric
139 IF (logger%iter_info%print_level >
medium_print_level .AND. rtbse_env%unit_nr > 0)
THEN
140 WRITE (rtbse_env%unit_nr,
'(A7,I5, E20.8E3)')
' RTBSE|', step, metric
154 IF (logger%iter_info%print_level >
medium_print_level .AND. rtbse_env%unit_nr > 0)
THEN
155 WRITE (rtbse_env%unit_nr,
'(A13, A20)')
' RTBSE| Iter.',
'Convergence'
166 REAL(kind=
dp) :: convergence
167 REAL(kind=
dp) :: electron_num_re
173 IF (logger%iter_info%print_level >
low_print_level .AND. rtbse_env%unit_nr > 0)
THEN
174 WRITE (rtbse_env%unit_nr,
'(A23,A20,A20,A17)')
" RTBSE| Simulation step",
"Convergence", &
175 "Electron number",
"ETRS Iterations"
176 WRITE (rtbse_env%unit_nr,
'(A7,I16,E20.8E3,E20.8E3,I17)')
' RTBSE|', step, convergence, &
177 electron_num_re, etrs_num
194 INTEGER :: j, rho_unit_re, rho_unit_im
195 CHARACTER(len=14),
DIMENSION(4) :: file_labels
197 file_labels(1) =
"_SPIN_A_RE.dat"
198 file_labels(2) =
"_SPIN_A_IM.dat"
199 file_labels(3) =
"_SPIN_B_RE.dat"
200 file_labels(4) =
"_SPIN_B_IM.dat"
203 DO j = 1, rtbse_env%n_spin
208 CALL multiply_fm_cfm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
209 1.0_dp, rtbse_env%S_fm, rho(j), &
210 0.0_dp, rtbse_env%rho_workspace(1))
212 CALL multiply_fm_cfm(
"T",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
213 1.0_dp, rtbse_env%bs_env%fm_mo_coeff_Gamma(j), rtbse_env%rho_workspace(1), &
214 0.0_dp, rtbse_env%rho_workspace(2))
216 CALL multiply_cfm_fm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
217 1.0_dp, rtbse_env%rho_workspace(2), rtbse_env%S_fm, &
218 0.0_dp, rtbse_env%rho_workspace(1))
220 CALL multiply_cfm_fm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
221 1.0_dp, rtbse_env%rho_workspace(1), rtbse_env%bs_env%fm_mo_coeff_Gamma(j), &
222 0.0_dp, rtbse_env%rho_workspace(2))
225 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
244 INTEGER :: j, rho_unit_re, rho_unit_im
245 CHARACTER(len=21),
DIMENSION(4) :: file_labels
247 file_labels(1) =
"_SPIN_A_RE.dat"
248 file_labels(2) =
"_SPIN_A_IM.dat"
249 file_labels(3) =
"_SPIN_B_RE.dat"
250 file_labels(4) =
"_SPIN_B_IM.dat"
252 DO j = 1, rtbse_env%n_spin
256 CALL multiply_fm_cfm(
"T",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
257 1.0_dp, rtbse_env%bs_env%fm_mo_coeff_Gamma(j), ham(j), &
258 0.0_dp, rtbse_env%rho_workspace(1))
260 CALL multiply_cfm_fm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
261 1.0_dp, rtbse_env%rho_workspace(1), rtbse_env%bs_env%fm_mo_coeff_Gamma(j), &
262 0.0_dp, rtbse_env%rho_workspace(2))
265 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
280 INTEGER :: field_unit, n, i
288 IF (field_unit /= -1)
THEN
289 WRITE (field_unit,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') rtbse_env%sim_time*
femtoseconds, &
290 rtbse_env%field(1), rtbse_env%field(2), rtbse_env%field(3)
294 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
296 rtbse_env%field_trace(i)%series(n) = rtbse_env%field(i)
298 rtbse_env%time_trace%series(n) = rtbse_env%sim_time
310 CHARACTER(len=default_path_length) :: save_name
311 INTEGER :: k, n, field_unit
318 CALL open_file(save_name, file_status=
"OLD", file_form=
"FORMATTED", file_action=
"READ", &
319 unit_number=field_unit)
320 DO k = rtbse_env%sim_start_orig, rtbse_env%sim_start
321 n = k - rtbse_env%sim_start_orig + 1
322 READ (field_unit,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') rtbse_env%time_trace%series(n), &
323 rtbse_env%field_trace(1)%series(n), rtbse_env%field_trace(2)%series(n), rtbse_env%field_trace(3)%series(n)
325 rtbse_env%time_trace%series(n) = rtbse_env%time_trace%series(n)/
femtoseconds
328 ELSE IF (.NOT. rtbse_env%dft_control%rtp_control%apply_delta_pulse .AND. &
329 rtbse_env%dft_control%rtp_control%initial_wfn ==
use_rt_restart)
THEN
330 cpwarn(
"Restart without RT field file - unknown field trace set to zero.")
345 INTEGER :: i, j, n, moments_unit_re, moments_unit_im
346 CHARACTER(len=14),
DIMENSION(4) :: file_labels
347 REAL(kind=
dp),
DIMENSION(3) :: moments
350 file_labels(1) =
"_SPIN_A_RE.dat"
351 file_labels(2) =
"_SPIN_A_IM.dat"
352 file_labels(3) =
"_SPIN_B_RE.dat"
353 file_labels(4) =
"_SPIN_B_IM.dat"
355 DO j = 1, rtbse_env%n_spin
356 moments_unit_re =
cp_print_key_unit_nr(logger, rtbse_env%moments_section, extension=file_labels(2*j - 1))
357 moments_unit_im =
cp_print_key_unit_nr(logger, rtbse_env%moments_section, extension=file_labels(2*j))
361 CALL cp_cfm_to_fm(msource=rho(j), mtargetr=rtbse_env%real_workspace(2))
364 CALL cp_fm_transpose(rtbse_env%moments(i), rtbse_env%real_workspace(1))
365 CALL cp_fm_trace(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), moments(i))
367 moments(i) = -moments(i)*rtbse_env%spin_degeneracy
370 IF (moments_unit_re > 0)
THEN
372 IF (rtbse_env%unit_nr == moments_unit_re)
THEN
373 WRITE (moments_unit_re,
'(A18,E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
374 " MOMENTS_TRACE_RE|", rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
376 WRITE (moments_unit_re,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
377 rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
382 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
384 rtbse_env%moments_trace(i)%series(n) = cmplx(moments(i), 0.0, kind=
dp)
387 CALL cp_cfm_to_fm(msource=rho(j), mtargeti=rtbse_env%real_workspace(2))
389 CALL cp_fm_transpose(rtbse_env%moments(i), rtbse_env%real_workspace(1))
390 CALL cp_fm_trace(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), moments(i))
392 moments(i) = -moments(i)*rtbse_env%spin_degeneracy
395 IF (moments_unit_im > 0)
THEN
397 IF (rtbse_env%unit_nr == moments_unit_im)
THEN
398 WRITE (moments_unit_im,
'(A18,E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
399 " MOMENTS_TRACE_IM|", rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
401 WRITE (moments_unit_im,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
402 rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
409 rtbse_env%moments_trace(i)%series(n) = rtbse_env%moments_trace(i)%series(n) + cmplx(0.0, moments(i), kind=
dp)
422 INTEGER :: time_index
423 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: workspace
424 CHARACTER(len=17),
DIMENSION(4) :: file_labels
426 INTEGER :: rho_unit_nr, i
429 file_labels(1) =
"_SPIN_A_RE.matrix"
430 file_labels(2) =
"_SPIN_A_IM.matrix"
431 file_labels(3) =
"_SPIN_B_RE.matrix"
432 file_labels(4) =
"_SPIN_B_IM.matrix"
436 workspace => rtbse_env%real_workspace
438 DO i = 1, rtbse_env%n_spin
441 rho_unit_nr =
cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=file_labels(2*i - 1), &
442 file_form=
"UNFORMATTED", file_position=
"REWIND")
446 rho_unit_nr =
cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=file_labels(2*i), &
447 file_form=
"UNFORMATTED", file_position=
"REWIND")
452 file_form=
"UNFORMATTED", file_position=
"REWIND")
453 IF (rho_unit_nr > 0)
WRITE (rho_unit_nr) time_index
466 CHARACTER(len=default_path_length) :: save_name, save_name_2
467 INTEGER :: rho_unit_nr, j
468 CHARACTER(len=17),
DIMENSION(4) :: file_labels
472 rtbse_env%restart_extracted = .false.
477 CALL open_file(save_name, file_status=
"OLD", file_form=
"UNFORMATTED", file_action=
"READ", &
478 unit_number=rho_unit_nr)
479 READ (rho_unit_nr) rtbse_env%sim_start
481 IF (rtbse_env%unit_nr > 0)
WRITE (rtbse_env%unit_nr,
'(A31,I25,A24)')
" RTBSE| Starting from timestep ", &
482 rtbse_env%sim_start,
", delta kick NOT applied"
484 cpwarn(
"Restart required but no info file found - starting from sim_step given in input")
488 file_labels(1) =
"_SPIN_A_RE.matrix"
489 file_labels(2) =
"_SPIN_A_IM.matrix"
490 file_labels(3) =
"_SPIN_B_RE.matrix"
491 file_labels(4) =
"_SPIN_B_IM.matrix"
492 DO j = 1, rtbse_env%n_spin
494 extension=file_labels(2*j - 1), my_local=.false.)
496 extension=file_labels(2*j), my_local=.false.)
498 CALL open_file(save_name, file_status=
"OLD", file_form=
"UNFORMATTED", file_action=
"READ", &
499 unit_number=rho_unit_nr)
502 CALL open_file(save_name_2, file_status=
"OLD", file_form=
"UNFORMATTED", file_action=
"READ", &
503 unit_number=rho_unit_nr)
506 CALL cp_fm_to_cfm(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), &
508 rtbse_env%restart_extracted = .true.
510 cpwarn(
"Restart without some restart matrices - starting from SCF density.")
522 CHARACTER(len=default_path_length) :: save_name, save_name_2
523 INTEGER :: i, j, k, moments_unit_re, moments_unit_im, n
524 CHARACTER(len=17),
DIMENSION(4) :: file_labels
525 REAL(kind=
dp),
DIMENSION(3) :: moments_re, moments_im
526 REAL(kind=
dp) :: timestamp
532 file_labels(1) =
"_SPIN_A_RE.dat"
533 file_labels(2) =
"_SPIN_A_IM.dat"
534 file_labels(3) =
"_SPIN_B_RE.dat"
535 file_labels(4) =
"_SPIN_B_IM.dat"
536 DO j = 1, rtbse_env%n_spin
538 extension=file_labels(2*j - 1), my_local=.false.)
540 extension=file_labels(2*j), my_local=.false.)
542 CALL open_file(save_name, file_status=
"OLD", file_form=
"FORMATTED", file_action=
"READ", &
543 unit_number=moments_unit_re)
544 CALL open_file(save_name_2, file_status=
"OLD", file_form=
"FORMATTED", file_action=
"READ", &
545 unit_number=moments_unit_im)
547 DO k = rtbse_env%sim_start_orig, rtbse_env%sim_start
549 n = k - rtbse_env%sim_start_orig + 1
550 READ (moments_unit_re,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') timestamp, &
551 moments_re(1), moments_re(2), moments_re(3)
552 READ (moments_unit_im,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') timestamp, &
553 moments_im(1), moments_im(2), moments_im(3)
555 rtbse_env%moments_trace(i)%series(n) = cmplx(moments_re(i), moments_im(i), kind=
dp)
557 rtbse_env%time_trace%series(n) = timestamp
560 rtbse_env%time_trace%series(:) = rtbse_env%time_trace%series(:)/
femtoseconds
563 ELSE IF (rtbse_env%dft_control%rtp_control%initial_wfn ==
use_rt_restart)
THEN
564 cpwarn(
"Restart without previous moments - unknown moments trace set to zero.")
575 REAL(kind=
dp),
DIMENSION(:),
POINTER :: omega_series, &
581 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: ft_full_series
582 INTEGER :: i, n, ft_unit
586 n = rtbse_env%sim_nsteps + 2
587 NULLIFY (omega_series)
588 ALLOCATE (omega_series(n), source=0.0_dp)
589 NULLIFY (ft_real_series)
590 ALLOCATE (ft_real_series(n), source=0.0_dp)
591 NULLIFY (ft_imag_series)
592 ALLOCATE (ft_imag_series(n), source=0.0_dp)
593 NULLIFY (value_series)
594 ALLOCATE (value_series(n), source=0.0_dp)
595 ALLOCATE (ft_full_series(6, n))
599 value_series(:) = real(rtbse_env%moments_trace(i)%series(:))
600 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, &
601 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
602 ft_full_series(2*i - 1, :) = ft_real_series(:)
603 ft_full_series(2*i, :) = ft_imag_series(:)
605 value_series(:) = aimag(rtbse_env%moments_trace(i)%series(:))
606 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, omega_series, &
607 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
608 ft_full_series(2*i - 1, :) = ft_full_series(2*i - 1, :) - ft_imag_series
609 ft_full_series(2*i, :) = ft_full_series(2*i, :) + ft_real_series
611 DEALLOCATE (value_series)
614 file_form=
"FORMATTED", file_position=
"REWIND")
615 IF (ft_unit > 0)
THEN
617 WRITE (ft_unit,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
618 omega_series(i), ft_full_series(1, i), ft_full_series(2, i), &
619 ft_full_series(3, i), ft_full_series(4, i), &
620 ft_full_series(5, i), ft_full_series(6, i)
624 DEALLOCATE (ft_real_series)
625 DEALLOCATE (ft_imag_series)
626 IF (rtbse_env%pade_requested)
THEN
627 CALL greenx_refine_pade(rtbse_env%pade_e_min, rtbse_env%pade_e_max, rtbse_env%pade_x_eval, &
628 n, rtbse_env%pade_npoints, logger, rtbse_env%ft_section, &
629 rtbse_env%unit_nr, omega_series, ft_full_series)
631 DEALLOCATE (omega_series)
632 DEALLOCATE (ft_full_series)
644 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: omega_series, &
648 COMPLEX(kind=dp),
DIMENSION(:),
ALLOCATABLE :: moment_series, &
653 COMPLEX(kind=dp),
DIMENSION(:, :),
ALLOCATABLE :: polarizability_series, &
654 polarizability_refined
655 INTEGER :: pol_unit, &
660 n = rtbse_env%sim_nsteps + 2
661 n_elems =
SIZE(rtbse_env%pol_elements, 1)
663 ALLOCATE (omega_series(n), source=0.0_dp)
664 ALLOCATE (ft_real_series(n), source=0.0_dp)
665 ALLOCATE (ft_imag_series(n), source=0.0_dp)
666 ALLOCATE (value_series(n), source=0.0_dp)
667 ALLOCATE (moment_series(n), source=cmplx(0.0, 0.0, kind=
dp))
668 ALLOCATE (field_series(n), source=cmplx(0.0, 0.0, kind=
dp))
669 ALLOCATE (polarizability_series(n_elems, n), source=cmplx(0.0, 0.0, kind=
dp))
672 IF (rtbse_env%pade_requested)
THEN
673 ALLOCATE (omega_complex(n), source=cmplx(0.0, 0.0, kind=
dp))
674 ALLOCATE (field_refined(rtbse_env%pade_npoints), source=cmplx(0.0, 0.0, kind=
dp))
675 ALLOCATE (moment_refined(rtbse_env%pade_npoints), source=cmplx(0.0, 0.0, kind=
dp))
676 ALLOCATE (polarizability_refined(n_elems, rtbse_env%pade_npoints), source=cmplx(0.0, 0.0, kind=
dp))
678 ALLOCATE (omega_complex(0), source=cmplx(0.0, 0.0, kind=
dp))
679 ALLOCATE (field_refined(0), source=cmplx(0.0, 0.0, kind=
dp))
680 ALLOCATE (moment_refined(0), source=cmplx(0.0, 0.0, kind=
dp))
681 ALLOCATE (polarizability_refined(0, 0), source=cmplx(0.0, 0.0, kind=
dp))
687 value_series(:) = real(rtbse_env%moments_trace(rtbse_env%pol_elements(k, 1))%series(:))
688 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, &
689 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
690 moment_series(:) = cmplx(ft_real_series(:), ft_imag_series(:), kind=
dp)
692 value_series(:) = aimag(rtbse_env%moments_trace(rtbse_env%pol_elements(k, 1))%series(:))
693 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, omega_series, &
694 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
695 moment_series(:) = moment_series(:) + cmplx(-ft_imag_series(:), ft_real_series(:), kind=
dp)
698 IF (rtbse_env%dft_control%rtp_control%apply_delta_pulse)
THEN
701 field_series(:) = cmplx( &
702 rtbse_env%dft_control%rtp_control%delta_pulse_direction(rtbse_env%pol_elements(k, 2))* &
703 rtbse_env%dft_control%rtp_control%delta_pulse_scale, 0.0, kind=
dp)
708 CALL ft_simple(rtbse_env%time_trace%series, rtbse_env%field_trace(rtbse_env%pol_elements(k, 2))%series, &
709 ft_real_series, ft_imag_series, omega_series, &
710 0.0_dp, rtbse_env%ft_start, .false.)
712 field_series(:) = cmplx(ft_real_series(:), ft_imag_series(:) + 1.0e-20, kind=
dp)
716 polarizability_series(k, :) = moment_series(:)/field_series(:)
719 IF (rtbse_env%pade_requested)
THEN
720 omega_complex(:) = cmplx(omega_series(:), 0.0, kind=
dp)
723 IF (rtbse_env%dft_control%rtp_control%apply_delta_pulse)
THEN
724 field_refined(:) = cmplx( &
725 rtbse_env%dft_control%rtp_control%delta_pulse_direction(rtbse_env%pol_elements(k, 2))* &
726 rtbse_env%dft_control%rtp_control%delta_pulse_scale, 0.0, kind=
dp)
728 CALL greenx_refine_ft(rtbse_env%pade_fit_e_min, rtbse_env%pade_fit_e_max, omega_complex, field_series, &
729 rtbse_env%pade_x_eval, field_refined)
731 CALL greenx_refine_ft(rtbse_env%pade_fit_e_min, rtbse_env%pade_fit_e_max, omega_complex, moment_series, &
732 rtbse_env%pade_x_eval, moment_refined)
733 polarizability_refined(k, :) = moment_refined(:)/field_refined(:)
739 value_series(:) = omega_series(:)*
evolt
742 file_form=
"FORMATTED", file_position=
"REWIND")
744 IF (pol_unit > 0)
THEN
745 IF (pol_unit == rtbse_env%unit_nr)
THEN
747 WRITE (pol_unit,
'(A16)', advance=
"no")
" POLARIZABILITY|"
750 WRITE (pol_unit,
'(A1,A19)', advance=
"no")
"#",
"omega [a.u.]"
753 WRITE (pol_unit,
'(A20)', advance=
"no")
"Energy [eV]"
755 DO k = 1, n_elems - 1
756 WRITE (pol_unit,
'(A16,I2,I2,A16,I2,I2)', advance=
"no") &
757 "Real pol.", rtbse_env%pol_elements(k, 1), rtbse_env%pol_elements(k, 2), &
758 "Imag pol.", rtbse_env%pol_elements(k, 1), rtbse_env%pol_elements(k, 2)
760 WRITE (pol_unit,
'(A16,I2,I2,A16,I2,I2)') &
761 "Real pol.", rtbse_env%pol_elements(n_elems, 1), rtbse_env%pol_elements(n_elems, 2), &
762 "Imag pol.", rtbse_env%pol_elements(n_elems, 1), rtbse_env%pol_elements(n_elems, 2)
764 IF (pol_unit == rtbse_env%unit_nr)
THEN
766 WRITE (pol_unit,
'(A16)', advance=
"no")
" POLARIZABILITY|"
769 WRITE (pol_unit,
'(E20.8E3)', advance=
"no") omega_series(i)
772 WRITE (pol_unit,
'(E20.8E3)', advance=
"no") value_series(i)
773 DO k = 1, n_elems - 1
774 WRITE (pol_unit,
'(E20.8E3,E20.8E3)', advance=
"no") &
775 REAL(polarizability_series(k, i)), aimag(polarizability_series(k, i))
778 WRITE (pol_unit,
'(E20.8E3,E20.8E3)') &
779 REAL(polarizability_series(n_elems, i)), aimag(polarizability_series(n_elems, i))
784 IF (rtbse_env%pade_requested)
THEN
786 rtbse_env%pol_elements, rtbse_env%pade_x_eval, polarizability_refined)
789 DEALLOCATE (value_series)
790 DEALLOCATE (ft_real_series)
791 DEALLOCATE (ft_imag_series)
793 DEALLOCATE (field_series)
794 DEALLOCATE (moment_series)
796 DEALLOCATE (omega_series)
797 DEALLOCATE (polarizability_series)
799 DEALLOCATE (omega_complex)
800 DEALLOCATE (field_refined)
801 DEALLOCATE (moment_refined)
802 DEALLOCATE (polarizability_refined)
819 SUBROUTINE ft_simple(time_series, value_series, result_series, iresult_series, omega_series, &
820 damping_opt, t0_opt, subtract_initial_opt)
821 REAL(kind=
dp),
DIMENSION(:) :: time_series
822 REAL(kind=
dp),
DIMENSION(:) :: value_series
823 REAL(kind=
dp),
DIMENSION(:) :: result_series
824 REAL(kind=
dp),
DIMENSION(:) :: iresult_series
825 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: omega_series
826 REAL(kind=
dp),
OPTIONAL :: damping_opt
827 REAL(kind=
dp),
OPTIONAL :: t0_opt
828 LOGICAL,
OPTIONAL :: subtract_initial_opt
829 CHARACTER(len=*),
PARAMETER :: routinen =
"ft_simple"
830 INTEGER :: n, i, j, t0_i, j_wrap, handle
831 REAL(kind=
dp) :: t0, delta_t, delta_omega, damping, &
833 LOGICAL :: subtract_initial
835 CALL timeset(routinen, handle)
837 n =
SIZE(time_series)
840 IF (
PRESENT(t0_opt))
THEN
846 IF (time_series(i) >= t0_opt)
THEN
852 t0 = time_series(t0_i)
855 damping = 4.0_dp/(time_series(n) - time_series(t0_i))
856 IF (
PRESENT(damping_opt))
THEN
858 IF (damping_opt > 0.0_dp) damping = 1.0_dp/damping_opt
860 IF (damping_opt == 0.0_dp) damping = 0.0_dp
863 IF (
PRESENT(subtract_initial_opt))
THEN
864 subtract_initial = subtract_initial_opt
866 subtract_initial = .true.
871 delta_t = time_series(2) - time_series(1)
872 delta_omega =
twopi/(time_series(n) - time_series(1))
874 value_subtract = 0.0_dp
875 IF (subtract_initial) value_subtract = value_series(1)
877 result_series(i) = 0.0_dp
878 iresult_series(i) = 0.0_dp
879 IF (
PRESENT(omega_series)) omega_series(i) = delta_omega*(i - 1)
881 j_wrap =
modulo(j + t0_i - 2, n) + 1
882 result_series(i) = result_series(i) + cos(
twopi*(i - 1)*(j - 1)/n)* &
883 exp(-damping*delta_t*(j - 1))*(value_series(j_wrap) - value_subtract)
884 iresult_series(i) = iresult_series(i) + sin(
twopi*(i - 1)*(j - 1)/n)* &
885 exp(-damping*delta_t*(j - 1))*(value_series(j_wrap) - value_subtract)
888 result_series(:) = delta_t*result_series(:)
889 iresult_series(:) = delta_t*iresult_series(:)
891 CALL timestop(handle)
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_fm_to_cfm(msourcer, msourcei, mtarget)
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value f...
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.
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
real(kind=dp) function, public cp_fm_norm(matrix, mode)
norm of matrix using (p)dlange
represent a full matrix distributed on many processors
subroutine, public cp_fm_write_unformatted(fm, unit)
...
subroutine, public cp_fm_read_unformatted(fm, unit)
...
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
subroutine, public cp_fm_write_formatted(fm, unit, header, value_format)
Write out a full matrix in plain text.
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 function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
integer, parameter, public low_print_level
integer, parameter, public medium_print_level
character(len=default_path_length) function, public cp_print_key_generate_filename(logger, print_key, middle_name, extension, my_local)
Utility function that returns a unit number to write the print key. Might open a file with a unique f...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Interface to the Greenx library.
subroutine, public greenx_refine_ft(fit_e_min, fit_e_max, x_fit, y_fit, x_eval, y_eval, n_pade_opt)
Refines the FT grid using Padé approximants.
subroutine, public greenx_refine_pade(e_min, e_max, x_eval, number_of_simulation_steps, number_of_pade_points, logger, ft_section, bse_unit, omega_series, ft_full_series)
Refines Pade approximants using GreenX, skips this step if GreenX is not available.
subroutine, public greenx_output_polarizability(logger, pol_section, bse_unit, pol_elements, x_eval, polarizability_refined)
Outputs the isotropic polarizability tensor element alpha _ ij = mu_i(omega)/E_j(omega),...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
basic linear algebra operations for full matrixes
Definition of physical constants:
real(kind=dp), parameter, public femtoseconds
real(kind=dp), parameter, public evolt
Input/output from the propagation via RT-BSE method.
subroutine, public print_rtbse_header_info(rtbse_env)
Writes the header and basic info to the standard output.
subroutine, public output_mos_covariant(rtbse_env, ham, print_key_section)
Outputs the matrix in MO basis for matrix components corresponding to covariant representation,...
subroutine, public output_restart(rtbse_env, rho, time_index)
Outputs the restart info (last finished iteration step) + restard density matrix.
subroutine, public print_etrs_info(rtbse_env, step, metric)
Writes the update after single etrs iteration - only for log level > medium.
subroutine, public read_field(rtbse_env)
Reads the field from the files provided by input - useful for the continuation run.
subroutine, public output_field(rtbse_env)
Prints the current field components into a file provided by input.
subroutine, public print_etrs_info_header(rtbse_env)
Writes the header for the etrs iteration updates - only for log level > medium.
subroutine, public output_mos_contravariant(rtbse_env, rho, print_key_section)
Outputs the matrix in MO basis for matrix coefficients corresponding to contravariant operator,...
subroutine, public read_moments(rtbse_env)
Reads the moments and time traces from the save files.
subroutine, public output_moments_ft(rtbse_env)
Outputs the Fourier transform of moments stored in the environment memory to the configured file.
subroutine, public read_restart(rtbse_env)
Reads the density matrix from restart files and updates the starting time.
subroutine, public print_timestep_info(rtbse_env, step, convergence, electron_num_re, etrs_num)
Writes the header for the etrs iteration updates - only for log level > medium.
subroutine, public output_polarizability(rtbse_env)
Outputs the isotropic polarizability tensor element alpha _ ij = mu_i(omega)/E_j(omega),...
subroutine, public output_moments(rtbse_env, rho)
Outputs the expectation value of moments from a given density matrix.
Data storage and other types for propagation via RT-BSE method.
subroutine, public multiply_cfm_fm(trans_c, trans_r, na, nb, nc, alpha, matrix_c, matrix_r, beta, res)
Multiplies complex matrix by a real matrix from the right.
subroutine, public multiply_fm_cfm(trans_r, trans_c, na, nb, nc, alpha, matrix_r, matrix_c, beta, res)
Multiplies real matrix by a complex matrix from the right.
Just to build arrays of pointers to matrices.
Represent a complex full matrix.
just to build arrays of pointers to matrices
type of a logger, at the moment it contains just a print level starting at which level it should be l...