54#include "../base/base_uses.f90"
60 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
"rt_bse_io"
89 WRITE (rtbse_env%unit_nr, *)
''
90 WRITE (rtbse_env%unit_nr,
'(A)')
' /-----------------------------------------------'// &
91 '------------------------------\'
92 WRITE (rtbse_env%unit_nr,
'(A)')
' | '// &
94 WRITE (rtbse_env%unit_nr,
'(A)')
' | Real Time Bethe-Salpeter Propagation'// &
96 WRITE (rtbse_env%unit_nr,
'(A)')
' | '// &
98 WRITE (rtbse_env%unit_nr,
'(A)')
' \-----------------------------------------------'// &
99 '------------------------------/'
100 WRITE (rtbse_env%unit_nr, *)
''
103 WRITE (rtbse_env%unit_nr,
'(A19)', advance=
"no")
' Exponential method'
104 SELECT CASE (rtbse_env%mat_exp_method)
106 WRITE (rtbse_env%unit_nr,
'(A61)')
'BCH'
108 WRITE (rtbse_env%unit_nr,
'(A61)')
'EXACT'
111 WRITE (rtbse_env%unit_nr,
'(A22)', advance=
"no")
' Reference Hamiltonian'
112 SELECT CASE (rtbse_env%ham_reference_type)
114 WRITE (rtbse_env%unit_nr,
'(A58)')
'G0W0'
116 WRITE (rtbse_env%unit_nr,
'(A58)')
'Kohn-Sham'
119 WRITE (rtbse_env%unit_nr,
'(A18,L62)')
' Apply delta pulse', &
120 rtbse_env%dft_control%rtp_control%apply_delta_pulse
122 WRITE (rtbse_env%unit_nr,
'(A)')
''
133 REAL(kind=
dp) :: metric
138 IF (logger%iter_info%print_level >
medium_print_level .AND. rtbse_env%unit_nr > 0)
THEN
139 WRITE (rtbse_env%unit_nr,
'(A7,I5, E20.8E3)')
' RTBSE|', step, metric
153 IF (logger%iter_info%print_level >
medium_print_level .AND. rtbse_env%unit_nr > 0)
THEN
154 WRITE (rtbse_env%unit_nr,
'(A13, A20)')
' RTBSE| Iter.',
'Convergence'
165 REAL(kind=
dp) :: convergence
166 REAL(kind=
dp) :: electron_num_re
172 IF (logger%iter_info%print_level >
low_print_level .AND. rtbse_env%unit_nr > 0)
THEN
173 WRITE (rtbse_env%unit_nr,
'(A23,A20,A20,A17)')
" RTBSE| Simulation step",
"Convergence", &
174 "Electron number",
"ETRS Iterations"
175 WRITE (rtbse_env%unit_nr,
'(A7,I16,E20.8E3,E20.8E3,I17)')
' RTBSE|', step, convergence, &
176 electron_num_re, etrs_num
193 INTEGER :: j, rho_unit_re, rho_unit_im
194 CHARACTER(len=14),
DIMENSION(4) :: file_labels
196 file_labels(1) =
"_SPIN_A_RE.dat"
197 file_labels(2) =
"_SPIN_A_IM.dat"
198 file_labels(3) =
"_SPIN_B_RE.dat"
199 file_labels(4) =
"_SPIN_B_IM.dat"
202 DO j = 1, rtbse_env%n_spin
207 CALL multiply_fm_cfm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
208 1.0_dp, rtbse_env%S_fm, rho(j), &
209 0.0_dp, rtbse_env%rho_workspace(1))
211 CALL multiply_fm_cfm(
"T",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
212 1.0_dp, rtbse_env%bs_env%fm_mo_coeff_Gamma(j), rtbse_env%rho_workspace(1), &
213 0.0_dp, rtbse_env%rho_workspace(2))
215 CALL multiply_cfm_fm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
216 1.0_dp, rtbse_env%rho_workspace(2), rtbse_env%S_fm, &
217 0.0_dp, rtbse_env%rho_workspace(1))
219 CALL multiply_cfm_fm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
220 1.0_dp, rtbse_env%rho_workspace(1), rtbse_env%bs_env%fm_mo_coeff_Gamma(j), &
221 0.0_dp, rtbse_env%rho_workspace(2))
224 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
243 INTEGER :: j, rho_unit_re, rho_unit_im
244 CHARACTER(len=21),
DIMENSION(4) :: file_labels
246 file_labels(1) =
"_SPIN_A_RE.dat"
247 file_labels(2) =
"_SPIN_A_IM.dat"
248 file_labels(3) =
"_SPIN_B_RE.dat"
249 file_labels(4) =
"_SPIN_B_IM.dat"
251 DO j = 1, rtbse_env%n_spin
255 CALL multiply_fm_cfm(
"T",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
256 1.0_dp, rtbse_env%bs_env%fm_mo_coeff_Gamma(j), ham(j), &
257 0.0_dp, rtbse_env%rho_workspace(1))
259 CALL multiply_cfm_fm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
260 1.0_dp, rtbse_env%rho_workspace(1), rtbse_env%bs_env%fm_mo_coeff_Gamma(j), &
261 0.0_dp, rtbse_env%rho_workspace(2))
264 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
279 INTEGER :: field_unit, n, i
287 IF (field_unit /= -1)
THEN
288 WRITE (field_unit,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') rtbse_env%sim_time*
femtoseconds, &
289 rtbse_env%field(1), rtbse_env%field(2), rtbse_env%field(3)
293 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
295 rtbse_env%field_trace(i)%series(n) = rtbse_env%field(i)
297 rtbse_env%time_trace%series(n) = rtbse_env%sim_time
309 CHARACTER(len=default_path_length) :: save_name
310 INTEGER :: k, n, field_unit
317 CALL open_file(save_name, file_status=
"OLD", file_form=
"FORMATTED", file_action=
"READ", &
318 unit_number=field_unit)
319 DO k = rtbse_env%sim_start_orig, rtbse_env%sim_start
320 n = k - rtbse_env%sim_start_orig + 1
321 READ (field_unit,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') rtbse_env%time_trace%series(n), &
322 rtbse_env%field_trace(1)%series(n), rtbse_env%field_trace(2)%series(n), rtbse_env%field_trace(3)%series(n)
324 rtbse_env%time_trace%series(n) = rtbse_env%time_trace%series(n)/
femtoseconds
327 ELSE IF (.NOT. rtbse_env%dft_control%rtp_control%apply_delta_pulse .AND. &
328 rtbse_env%dft_control%rtp_control%initial_wfn ==
use_rt_restart)
THEN
329 cpwarn(
"Restart without RT field file - unknown field trace set to zero.")
344 INTEGER :: i, j, n, moments_unit_re, moments_unit_im
345 CHARACTER(len=14),
DIMENSION(4) :: file_labels
346 REAL(kind=
dp),
DIMENSION(3) :: moments
349 file_labels(1) =
"_SPIN_A_RE.dat"
350 file_labels(2) =
"_SPIN_A_IM.dat"
351 file_labels(3) =
"_SPIN_B_RE.dat"
352 file_labels(4) =
"_SPIN_B_IM.dat"
354 DO j = 1, rtbse_env%n_spin
355 moments_unit_re =
cp_print_key_unit_nr(logger, rtbse_env%moments_section, extension=file_labels(2*j - 1))
356 moments_unit_im =
cp_print_key_unit_nr(logger, rtbse_env%moments_section, extension=file_labels(2*j))
360 CALL cp_cfm_to_fm(msource=rho(j), mtargetr=rtbse_env%real_workspace(2))
363 CALL cp_fm_transpose(rtbse_env%moments(i), rtbse_env%real_workspace(1))
364 CALL cp_fm_trace(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), moments(i))
366 moments(i) = -moments(i)*rtbse_env%spin_degeneracy
369 IF (moments_unit_re > 0)
THEN
371 IF (rtbse_env%unit_nr == moments_unit_re)
THEN
372 WRITE (moments_unit_re,
'(A18,E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
373 " MOMENTS_TRACE_RE|", rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
375 WRITE (moments_unit_re,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
376 rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
381 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
383 rtbse_env%moments_trace(i)%series(n) = cmplx(moments(i), 0.0, kind=
dp)
386 CALL cp_cfm_to_fm(msource=rho(j), mtargeti=rtbse_env%real_workspace(2))
388 CALL cp_fm_transpose(rtbse_env%moments(i), rtbse_env%real_workspace(1))
389 CALL cp_fm_trace(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), moments(i))
391 moments(i) = -moments(i)*rtbse_env%spin_degeneracy
394 IF (moments_unit_im > 0)
THEN
396 IF (rtbse_env%unit_nr == moments_unit_im)
THEN
397 WRITE (moments_unit_im,
'(A18,E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
398 " MOMENTS_TRACE_IM|", rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
400 WRITE (moments_unit_im,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
401 rtbse_env%sim_time*
femtoseconds, moments(1), moments(2), moments(3)
408 rtbse_env%moments_trace(i)%series(n) = rtbse_env%moments_trace(i)%series(n) + cmplx(0.0, moments(i), kind=
dp)
421 INTEGER :: time_index
422 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: workspace
423 CHARACTER(len=17),
DIMENSION(4) :: file_labels
425 INTEGER :: rho_unit_nr, i
428 file_labels(1) =
"_SPIN_A_RE.matrix"
429 file_labels(2) =
"_SPIN_A_IM.matrix"
430 file_labels(3) =
"_SPIN_B_RE.matrix"
431 file_labels(4) =
"_SPIN_B_IM.matrix"
435 workspace => rtbse_env%real_workspace
437 DO i = 1, rtbse_env%n_spin
440 rho_unit_nr =
cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=file_labels(2*i - 1), &
441 file_form=
"UNFORMATTED", file_position=
"REWIND")
445 rho_unit_nr =
cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=file_labels(2*i), &
446 file_form=
"UNFORMATTED", file_position=
"REWIND")
451 file_form=
"UNFORMATTED", file_position=
"REWIND")
452 IF (rho_unit_nr > 0)
WRITE (rho_unit_nr) time_index
465 CHARACTER(len=default_path_length) :: save_name, save_name_2
466 INTEGER :: rho_unit_nr, j
467 CHARACTER(len=17),
DIMENSION(4) :: file_labels
471 rtbse_env%restart_extracted = .false.
476 CALL open_file(save_name, file_status=
"OLD", file_form=
"UNFORMATTED", file_action=
"READ", &
477 unit_number=rho_unit_nr)
478 READ (rho_unit_nr) rtbse_env%sim_start
480 IF (rtbse_env%unit_nr > 0)
WRITE (rtbse_env%unit_nr,
'(A31,I25,A24)')
" RTBSE| Starting from timestep ", &
481 rtbse_env%sim_start,
", delta kick NOT applied"
483 cpwarn(
"Restart required but no info file found - starting from sim_step given in input")
487 file_labels(1) =
"_SPIN_A_RE.matrix"
488 file_labels(2) =
"_SPIN_A_IM.matrix"
489 file_labels(3) =
"_SPIN_B_RE.matrix"
490 file_labels(4) =
"_SPIN_B_IM.matrix"
491 DO j = 1, rtbse_env%n_spin
493 extension=file_labels(2*j - 1), my_local=.false.)
495 extension=file_labels(2*j), my_local=.false.)
497 CALL open_file(save_name, file_status=
"OLD", file_form=
"UNFORMATTED", file_action=
"READ", &
498 unit_number=rho_unit_nr)
501 CALL open_file(save_name_2, file_status=
"OLD", file_form=
"UNFORMATTED", file_action=
"READ", &
502 unit_number=rho_unit_nr)
505 CALL cp_fm_to_cfm(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), &
507 rtbse_env%restart_extracted = .true.
509 cpwarn(
"Restart without some restart matrices - starting from SCF density.")
521 CHARACTER(len=default_path_length) :: save_name, save_name_2
522 INTEGER :: i, j, k, moments_unit_re, moments_unit_im, n
523 CHARACTER(len=17),
DIMENSION(4) :: file_labels
524 REAL(kind=
dp),
DIMENSION(3) :: moments_re, moments_im
525 REAL(kind=
dp) :: timestamp
531 file_labels(1) =
"_SPIN_A_RE.dat"
532 file_labels(2) =
"_SPIN_A_IM.dat"
533 file_labels(3) =
"_SPIN_B_RE.dat"
534 file_labels(4) =
"_SPIN_B_IM.dat"
535 DO j = 1, rtbse_env%n_spin
537 extension=file_labels(2*j - 1), my_local=.false.)
539 extension=file_labels(2*j), my_local=.false.)
541 CALL open_file(save_name, file_status=
"OLD", file_form=
"FORMATTED", file_action=
"READ", &
542 unit_number=moments_unit_re)
543 CALL open_file(save_name_2, file_status=
"OLD", file_form=
"FORMATTED", file_action=
"READ", &
544 unit_number=moments_unit_im)
546 DO k = rtbse_env%sim_start_orig, rtbse_env%sim_start
548 n = k - rtbse_env%sim_start_orig + 1
549 READ (moments_unit_re,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') timestamp, &
550 moments_re(1), moments_re(2), moments_re(3)
551 READ (moments_unit_im,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') timestamp, &
552 moments_im(1), moments_im(2), moments_im(3)
554 rtbse_env%moments_trace(i)%series(n) = cmplx(moments_re(i), moments_im(i), kind=
dp)
556 rtbse_env%time_trace%series(n) = timestamp
559 rtbse_env%time_trace%series(:) = rtbse_env%time_trace%series(:)/
femtoseconds
562 ELSE IF (rtbse_env%dft_control%rtp_control%initial_wfn ==
use_rt_restart)
THEN
563 cpwarn(
"Restart without previous moments - unknown moments trace set to zero.")
574 REAL(kind=
dp),
DIMENSION(:),
POINTER :: omega_series, &
580 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: ft_full_series
581 INTEGER :: i, n, ft_unit
585 n = rtbse_env%sim_nsteps + 2
586 NULLIFY (omega_series)
587 ALLOCATE (omega_series(n), source=0.0_dp)
588 NULLIFY (ft_real_series)
589 ALLOCATE (ft_real_series(n), source=0.0_dp)
590 NULLIFY (ft_imag_series)
591 ALLOCATE (ft_imag_series(n), source=0.0_dp)
592 NULLIFY (value_series)
593 ALLOCATE (value_series(n), source=0.0_dp)
594 ALLOCATE (ft_full_series(6, n))
598 value_series(:) = real(rtbse_env%moments_trace(i)%series(:))
599 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, &
600 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
601 ft_full_series(2*i - 1, :) = ft_real_series(:)
602 ft_full_series(2*i, :) = ft_imag_series(:)
604 value_series(:) = aimag(rtbse_env%moments_trace(i)%series(:))
605 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, omega_series, &
606 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
607 ft_full_series(2*i - 1, :) = ft_full_series(2*i - 1, :) - ft_imag_series
608 ft_full_series(2*i, :) = ft_full_series(2*i, :) + ft_real_series
610 DEALLOCATE (value_series)
613 file_form=
"FORMATTED", file_position=
"REWIND")
614 IF (ft_unit > 0)
THEN
616 WRITE (ft_unit,
'(E20.8E3,E20.8E3,E20.8E3,E20.8E3,E20.8E3,E20.8E3,E20.8E3)') &
617 omega_series(i), ft_full_series(1, i), ft_full_series(2, i), &
618 ft_full_series(3, i), ft_full_series(4, i), &
619 ft_full_series(5, i), ft_full_series(6, i)
623 DEALLOCATE (ft_real_series)
624 DEALLOCATE (ft_imag_series)
625 DEALLOCATE (omega_series)
626 DEALLOCATE (ft_full_series)
637 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: omega_series, &
641 COMPLEX(kind=dp),
DIMENSION(:),
ALLOCATABLE :: moment_series, &
643 COMPLEX(kind=dp),
DIMENSION(:, :),
ALLOCATABLE :: polarizability_series
644 INTEGER :: pol_unit, &
649 n = rtbse_env%sim_nsteps + 2
650 n_elems =
SIZE(rtbse_env%pol_elements, 1)
652 ALLOCATE (omega_series(n), source=0.0_dp)
653 ALLOCATE (ft_real_series(n), source=0.0_dp)
654 ALLOCATE (ft_imag_series(n), source=0.0_dp)
655 ALLOCATE (value_series(n), source=0.0_dp)
656 ALLOCATE (moment_series(n), source=cmplx(0.0, 0.0, kind=
dp))
657 ALLOCATE (field_series(n), source=cmplx(0.0, 0.0, kind=
dp))
658 ALLOCATE (polarizability_series(n_elems, n), source=cmplx(0.0, 0.0, kind=
dp))
663 value_series(:) = real(rtbse_env%moments_trace(rtbse_env%pol_elements(k, 1))%series(:))
664 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, &
665 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
666 moment_series(:) = cmplx(ft_real_series(:), ft_imag_series(:), kind=
dp)
668 value_series(:) = aimag(rtbse_env%moments_trace(rtbse_env%pol_elements(k, 1))%series(:))
669 CALL ft_simple(rtbse_env%time_trace%series, value_series, ft_real_series, ft_imag_series, omega_series, &
670 damping_opt=rtbse_env%ft_damping, t0_opt=rtbse_env%ft_start, subtract_initial_opt=.true.)
671 moment_series(:) = moment_series(:) + cmplx(-ft_imag_series(:), ft_real_series(:), kind=
dp)
674 IF (rtbse_env%dft_control%rtp_control%apply_delta_pulse)
THEN
677 field_series(:) = cmplx( &
678 rtbse_env%dft_control%rtp_control%delta_pulse_direction(rtbse_env%pol_elements(k, 2))* &
679 rtbse_env%dft_control%rtp_control%delta_pulse_scale, 0.0, kind=
dp)
684 CALL ft_simple(rtbse_env%time_trace%series, rtbse_env%field_trace(rtbse_env%pol_elements(k, 2))%series, &
685 ft_real_series, ft_imag_series, omega_series, &
686 0.0_dp, rtbse_env%ft_start, .false.)
688 field_series(:) = cmplx(ft_real_series(:), ft_imag_series(:) + 1.0e-20, kind=
dp)
691 polarizability_series(k, :) = moment_series(:)/field_series(:)
696 value_series(:) = omega_series(:)*
evolt
699 file_form=
"FORMATTED", file_position=
"REWIND")
701 IF (pol_unit > 0)
THEN
702 IF (pol_unit == rtbse_env%unit_nr)
THEN
704 WRITE (pol_unit,
'(A16)', advance=
"no")
" POLARIZABILITY|"
707 WRITE (pol_unit,
'(A1,A19)', advance=
"no")
"#",
"omega [a.u.]"
710 WRITE (pol_unit,
'(A20)', advance=
"no")
"Energy [eV]"
712 DO k = 1, n_elems - 1
713 WRITE (pol_unit,
'(A16,I2,I2,A16,I2,I2)', advance=
"no") &
714 "Real pol.", rtbse_env%pol_elements(k, 1), rtbse_env%pol_elements(k, 2), &
715 "Imag pol.", rtbse_env%pol_elements(k, 1), rtbse_env%pol_elements(k, 2)
717 WRITE (pol_unit,
'(A16,I2,I2,A16,I2,I2)') &
718 "Real pol.", rtbse_env%pol_elements(n_elems, 1), rtbse_env%pol_elements(n_elems, 2), &
719 "Imag pol.", rtbse_env%pol_elements(n_elems, 1), rtbse_env%pol_elements(n_elems, 2)
721 IF (pol_unit == rtbse_env%unit_nr)
THEN
723 WRITE (pol_unit,
'(A16)', advance=
"no")
" POLARIZABILITY|"
726 WRITE (pol_unit,
'(E20.8E3)', advance=
"no") omega_series(i)
729 WRITE (pol_unit,
'(E20.8E3)', advance=
"no") value_series(i)
730 DO k = 1, n_elems - 1
731 WRITE (pol_unit,
'(E20.8E3,E20.8E3)', advance=
"no") &
732 REAL(polarizability_series(k, i)), aimag(polarizability_series(k, i))
735 WRITE (pol_unit,
'(E20.8E3,E20.8E3)') &
736 REAL(polarizability_series(n_elems, i)), aimag(polarizability_series(n_elems, i))
741 DEALLOCATE (value_series)
742 DEALLOCATE (ft_real_series)
743 DEALLOCATE (ft_imag_series)
745 DEALLOCATE (field_series)
746 DEALLOCATE (moment_series)
748 DEALLOCATE (omega_series)
749 DEALLOCATE (polarizability_series)
766 SUBROUTINE ft_simple(time_series, value_series, result_series, iresult_series, omega_series, &
767 damping_opt, t0_opt, subtract_initial_opt)
768 REAL(kind=
dp),
DIMENSION(:) :: time_series
769 REAL(kind=
dp),
DIMENSION(:) :: value_series
770 REAL(kind=
dp),
DIMENSION(:) :: result_series
771 REAL(kind=
dp),
DIMENSION(:) :: iresult_series
772 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: omega_series
773 REAL(kind=
dp),
OPTIONAL :: damping_opt
774 REAL(kind=
dp),
OPTIONAL :: t0_opt
775 LOGICAL,
OPTIONAL :: subtract_initial_opt
776 CHARACTER(len=*),
PARAMETER :: routinen =
"ft_simple"
777 INTEGER :: n, i, j, t0_i, j_wrap, handle
778 REAL(kind=
dp) :: t0, delta_t, delta_omega, damping, &
780 LOGICAL :: subtract_initial
782 CALL timeset(routinen, handle)
784 n =
SIZE(time_series)
787 IF (
PRESENT(t0_opt))
THEN
793 IF (time_series(i) >= t0_opt)
THEN
799 t0 = time_series(t0_i)
802 damping = 4.0_dp/(time_series(n) - time_series(t0_i))
803 IF (
PRESENT(damping_opt))
THEN
805 IF (damping_opt > 0.0_dp) damping = 1.0_dp/damping_opt
806 IF (damping_opt == 0.0_dp) damping = 0.0_dp
809 IF (
PRESENT(subtract_initial_opt))
THEN
810 subtract_initial = subtract_initial_opt
812 subtract_initial = .true.
817 delta_t = time_series(2) - time_series(1)
818 delta_omega =
twopi/(time_series(n) - time_series(1))
820 value_subtract = 0.0_dp
821 IF (subtract_initial) value_subtract = value_series(1)
823 result_series(i) = 0.0_dp
824 iresult_series(i) = 0.0_dp
825 IF (
PRESENT(omega_series)) omega_series(i) = delta_omega*(i - 1)
827 j_wrap =
modulo(j + t0_i - 2, n) + 1
828 result_series(i) = result_series(i) + cos(
twopi*(i - 1)*(j - 1)/n)* &
829 exp(-damping*delta_t*(j - 1))*(value_series(j_wrap) - value_subtract)
830 iresult_series(i) = iresult_series(i) + sin(
twopi*(i - 1)*(j - 1)/n)* &
831 exp(-damping*delta_t*(j - 1))*(value_series(j_wrap) - value_subtract)
834 delta_omega =
twopi/(time_series(n) - time_series(1))
835 result_series(:) = delta_t*result_series(:)
836 iresult_series(:) = delta_t*iresult_series(:)
838 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,...
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...