Loading [MathJax]/extensions/tex2jax.js
 (git:aabdcc8)
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
rt_bse_io.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Input/output from the propagation via RT-BSE method.
10!> \author Stepan Marek (08.24)
11! **************************************************************************************************
12
14 USE cp_fm_types, ONLY: cp_fm_type, &
21 USE cp_cfm_types, ONLY: cp_cfm_type, &
25 USE kinds, ONLY: dp, &
39 USE rt_bse_types, ONLY: rtbse_env_type, &
42 USE cp_files, ONLY: open_file, &
45 USE input_constants, ONLY: do_exact, &
46 do_bch, &
50 USE physcon, ONLY: femtoseconds, &
51 evolt
52 USE mathconstants, ONLY: twopi
53
54#include "../base/base_uses.f90"
55
56 IMPLICIT NONE
57
58 PRIVATE
59
60 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = "rt_bse_io"
61
62
63
64
65 PUBLIC :: output_moments, &
70 read_field, &
79
80CONTAINS
81
82! **************************************************************************************************
83!> \brief Writes the header and basic info to the standard output
84!> \param rtbse_env Entry point - rtbse environment
85! **************************************************************************************************
86 SUBROUTINE print_rtbse_header_info(rtbse_env)
87 TYPE(rtbse_env_type) :: rtbse_env
88
89 WRITE (rtbse_env%unit_nr, *) ''
90 WRITE (rtbse_env%unit_nr, '(A)') ' /-----------------------------------------------'// &
91 '------------------------------\'
92 WRITE (rtbse_env%unit_nr, '(A)') ' | '// &
93 ' |'
94 WRITE (rtbse_env%unit_nr, '(A)') ' | Real Time Bethe-Salpeter Propagation'// &
95 ' |'
96 WRITE (rtbse_env%unit_nr, '(A)') ' | '// &
97 ' |'
98 WRITE (rtbse_env%unit_nr, '(A)') ' \-----------------------------------------------'// &
99 '------------------------------/'
100 WRITE (rtbse_env%unit_nr, *) ''
101
102 ! Methods used
103 WRITE (rtbse_env%unit_nr, '(A19)', advance="no") ' Exponential method'
104 SELECT CASE (rtbse_env%mat_exp_method)
105 CASE (do_bch)
106 WRITE (rtbse_env%unit_nr, '(A61)') 'BCH'
107 CASE (do_exact)
108 WRITE (rtbse_env%unit_nr, '(A61)') 'EXACT'
109 END SELECT
110
111 WRITE (rtbse_env%unit_nr, '(A22)', advance="no") ' Reference Hamiltonian'
112 SELECT CASE (rtbse_env%ham_reference_type)
113 CASE (rtp_bse_ham_g0w0)
114 WRITE (rtbse_env%unit_nr, '(A58)') 'G0W0'
115 CASE (rtp_bse_ham_ks)
116 WRITE (rtbse_env%unit_nr, '(A58)') 'Kohn-Sham'
117 END SELECT
118
119 WRITE (rtbse_env%unit_nr, '(A18,L62)') ' Apply delta pulse', &
120 rtbse_env%dft_control%rtp_control%apply_delta_pulse
121
122 WRITE (rtbse_env%unit_nr, '(A)') ''
123
124 END SUBROUTINE
125
126! **************************************************************************************************
127!> \brief Writes the update after single etrs iteration - only for log level > medium
128!> \param rtbse_env Entry point - rtbse environment
129! **************************************************************************************************
130 SUBROUTINE print_etrs_info(rtbse_env, step, metric)
131 TYPE(rtbse_env_type) :: rtbse_env
132 INTEGER :: step
133 REAL(kind=dp) :: metric
134 TYPE(cp_logger_type), POINTER :: logger
135
136 logger => cp_get_default_logger()
137
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
140 END IF
141
142 END SUBROUTINE
143! **************************************************************************************************
144!> \brief Writes the header for the etrs iteration updates - only for log level > medium
145!> \param rtbse_env Entry point - rtbse environment
146! **************************************************************************************************
147 SUBROUTINE print_etrs_info_header(rtbse_env)
148 TYPE(rtbse_env_type) :: rtbse_env
149 TYPE(cp_logger_type), POINTER :: logger
150
151 logger => cp_get_default_logger()
152
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'
155 END IF
156
157 END SUBROUTINE
158! **************************************************************************************************
159!> \brief Writes the header for the etrs iteration updates - only for log level > medium
160!> \param rtbse_env Entry point - rtbse environment
161! **************************************************************************************************
162 SUBROUTINE print_timestep_info(rtbse_env, step, convergence, electron_num_re, etrs_num)
163 TYPE(rtbse_env_type) :: rtbse_env
164 INTEGER :: step
165 REAL(kind=dp) :: convergence
166 REAL(kind=dp) :: electron_num_re
167 INTEGER :: etrs_num
168 TYPE(cp_logger_type), POINTER :: logger
169
170 logger => cp_get_default_logger()
171
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
177 END IF
178
179 END SUBROUTINE
180
181! **************************************************************************************************
182!> \brief Outputs the matrix in MO basis for matrix coefficients corresponding to contravariant
183!> operator, i.e. density matrix
184!> \param rtbse_env Entry point - gwbse environment
185!> \param rho Density matrix in AO basis
186!> \param rtp_section RTP input section
187! **************************************************************************************************
188 SUBROUTINE output_mos_contravariant(rtbse_env, rho, print_key_section)
189 TYPE(rtbse_env_type) :: rtbse_env
190 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: rho
191 TYPE(section_vals_type), POINTER :: print_key_section
192 TYPE(cp_logger_type), POINTER :: logger
193 INTEGER :: j, rho_unit_re, rho_unit_im
194 CHARACTER(len=14), DIMENSION(4) :: file_labels
195
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"
200 logger => cp_get_default_logger()
201 ! Start by multiplying the current density by MOS
202 DO j = 1, rtbse_env%n_spin
203 rho_unit_re = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j - 1))
204 rho_unit_im = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j))
205 ! Transform the density matrix into molecular orbitals basis and print it out
206 ! S * rho
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))
210 ! C^T * S * rho
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))
214 ! C^T * S * rho * S
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))
218 ! C^T * S * rho * S * C
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))
222 ! Print real and imaginary parts separately
223 CALL cp_cfm_to_fm(rtbse_env%rho_workspace(2), &
224 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
225 CALL cp_fm_write_formatted(rtbse_env%real_workspace(1), rho_unit_re)
226 CALL cp_fm_write_formatted(rtbse_env%real_workspace(2), rho_unit_im)
227 CALL cp_print_key_finished_output(rho_unit_re, logger, print_key_section)
228 CALL cp_print_key_finished_output(rho_unit_im, logger, print_key_section)
229 END DO
230 END SUBROUTINE
231! **************************************************************************************************
232!> \brief Outputs the matrix in MO basis for matrix components corresponding to covariant representation,
233!> i.e. the Hamiltonian matrix
234!> \param rtbse_env Entry point - gwbse environment
235!> \param cohsex cohsex matrix in AO basis, covariant representation
236!> \param rtp_section RTP input section
237! **************************************************************************************************
238 SUBROUTINE output_mos_covariant(rtbse_env, ham, print_key_section)
239 TYPE(rtbse_env_type) :: rtbse_env
240 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: ham
241 TYPE(section_vals_type), POINTER :: print_key_section
242 TYPE(cp_logger_type), POINTER :: logger
243 INTEGER :: j, rho_unit_re, rho_unit_im
244 CHARACTER(len=21), DIMENSION(4) :: file_labels
245
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"
250 logger => cp_get_default_logger()
251 DO j = 1, rtbse_env%n_spin
252 rho_unit_re = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j - 1))
253 rho_unit_im = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j))
254 ! C^T * cohsex
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))
258 ! C^T * cohsex * C
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))
262 ! Print real and imaginary parts separately
263 CALL cp_cfm_to_fm(rtbse_env%rho_workspace(2), &
264 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
265 CALL cp_fm_write_formatted(rtbse_env%real_workspace(1), rho_unit_re)
266 CALL cp_fm_write_formatted(rtbse_env%real_workspace(2), rho_unit_im)
267 CALL cp_print_key_finished_output(rho_unit_re, logger, print_key_section)
268 CALL cp_print_key_finished_output(rho_unit_im, logger, print_key_section)
269 END DO
270 END SUBROUTINE
271! **************************************************************************************************
272!> \brief Prints the current field components into a file provided by input
273!> \param rtbse_env Entry point - gwbse environment
274!> \param rtp_section RTP input section
275! **************************************************************************************************
276 SUBROUTINE output_field(rtbse_env)
277 TYPE(rtbse_env_type) :: rtbse_env
278 TYPE(cp_logger_type), POINTER :: logger
279 INTEGER :: field_unit, n, i
280
281 ! Get logger
282 logger => cp_get_default_logger()
283 ! Get file descriptor
284 field_unit = cp_print_key_unit_nr(logger, rtbse_env%field_section, extension=".dat")
285 ! If the file descriptor is non-zero, output field
286 ! TODO : Output also in SI
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)
290 END IF
291 ! Write the output to memory for FT
292 ! Need the absolute index
293 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
294 DO i = 1, 3
295 rtbse_env%field_trace(i)%series(n) = rtbse_env%field(i)
296 END DO
297 rtbse_env%time_trace%series(n) = rtbse_env%sim_time
298 CALL cp_print_key_finished_output(field_unit, logger, rtbse_env%field_section)
299
300 END SUBROUTINE
301! **************************************************************************************************
302!> \brief Reads the field from the files provided by input - useful for the continuation run
303!> \param rtbse_env Entry point - gwbse environment
304!> \param rtp_section RTP input section
305! **************************************************************************************************
306 SUBROUTINE read_field(rtbse_env)
307 TYPE(rtbse_env_type) :: rtbse_env
308 TYPE(cp_logger_type), POINTER :: logger
309 CHARACTER(len=default_path_length) :: save_name
310 INTEGER :: k, n, field_unit
311
312 ! Get logger
313 logger => cp_get_default_logger()
314 ! Get file name
315 save_name = cp_print_key_generate_filename(logger, rtbse_env%field_section, extension=".dat", my_local=.false.)
316 IF (file_exists(save_name)) THEN
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)
323 ! Set the time units back to atomic units
324 rtbse_env%time_trace%series(n) = rtbse_env%time_trace%series(n)/femtoseconds
325 END DO
326 CALL close_file(field_unit)
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.")
330 END IF
331 END SUBROUTINE read_field
332
333! **************************************************************************************************
334!> \brief Outputs the expectation value of moments from a given density matrix
335!> \note Moments matrix is provided by the rtbse_env, uses rho_workspace(1:3)
336!> \param rtbse_env Entry point - gwbse environment
337!> \param rho Density matrix in AO basis
338!> \param rtp_section RTP section of the input parameters, where moments destination may be present
339! **************************************************************************************************
340 SUBROUTINE output_moments(rtbse_env, rho)
341 TYPE(rtbse_env_type) :: rtbse_env
342 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: rho
343 TYPE(cp_logger_type), POINTER :: logger
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
347
348 ! Start by getting the relevant file unit
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"
353 logger => cp_get_default_logger()
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))
357 ! If, for any reason, the file unit is not provided, skip to next cycle immediately
358 ! TODO : Specify output units in config
359 ! Need to transpose due to the definition of trace function
360 CALL cp_cfm_to_fm(msource=rho(j), mtargetr=rtbse_env%real_workspace(2))
361 DO i = 1, 3
362 ! Moments should be symmetric, test without transopose?
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))
365 ! Scale by spin degeneracy and electron charge
366 moments(i) = -moments(i)*rtbse_env%spin_degeneracy
367 END DO
368 ! Output to the file
369 IF (moments_unit_re > 0) THEN
370 ! If outputting to standard output, also prepend identifying 'MOMENTS_TRACE|' string
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)
374 ELSE
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)
377 CALL cp_print_key_finished_output(moments_unit_re, logger, rtbse_env%moments_section)
378 END IF
379 END IF
380 ! Save to memory for FT - real part
381 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
382 DO i = 1, 3
383 rtbse_env%moments_trace(i)%series(n) = cmplx(moments(i), 0.0, kind=dp)
384 END DO
385 ! Same for imaginary part
386 CALL cp_cfm_to_fm(msource=rho(j), mtargeti=rtbse_env%real_workspace(2))
387 DO i = 1, 3
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))
390 ! Scale by spin degeneracy and electron charge
391 moments(i) = -moments(i)*rtbse_env%spin_degeneracy
392 END DO
393 ! Output to the file
394 IF (moments_unit_im > 0) THEN
395 ! If outputting to standard output, also prepend identifying 'MOMENTS_TRACE|' string
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)
399 ELSE
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)
402 ! Close the files
403 CALL cp_print_key_finished_output(moments_unit_im, logger, rtbse_env%moments_section)
404 END IF
405 END IF
406 ! Save to memory for FT - imag part
407 DO i = 1, 3
408 rtbse_env%moments_trace(i)%series(n) = rtbse_env%moments_trace(i)%series(n) + cmplx(0.0, moments(i), kind=dp)
409 END DO
410 END DO
411 END SUBROUTINE
412! **************************************************************************************************
413!> \brief Outputs the restart info (last finished iteration step) + restard density matrix
414!> \param restart_section Print key section for the restart files
415!> \param rho Density matrix in AO basis
416!> \param time_index Time index to be written into the info file
417! **************************************************************************************************
418 SUBROUTINE output_restart(rtbse_env, rho, time_index)
419 TYPE(rtbse_env_type), POINTER :: rtbse_env
420 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: rho
421 INTEGER :: time_index
422 TYPE(cp_fm_type), DIMENSION(:), POINTER :: workspace
423 CHARACTER(len=17), DIMENSION(4) :: file_labels
424 TYPE(cp_logger_type), POINTER :: logger
425 INTEGER :: rho_unit_nr, i
426
427 ! Default labels distinguishing up to two spin species and real/imaginary parts
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"
432
433 logger => cp_get_default_logger()
434
435 workspace => rtbse_env%real_workspace
436
437 DO i = 1, rtbse_env%n_spin
438 CALL cp_cfm_to_fm(rho(i), workspace(1), workspace(2))
439 ! Real part
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")
442 CALL cp_fm_write_unformatted(workspace(1), rho_unit_nr)
443 CALL cp_print_key_finished_output(rho_unit_nr, logger, rtbse_env%restart_section)
444 ! Imag part
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")
447 CALL cp_fm_write_unformatted(workspace(2), rho_unit_nr)
448 CALL cp_print_key_finished_output(rho_unit_nr, logger, rtbse_env%restart_section)
449 ! Info
450 rho_unit_nr = cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=".info", &
451 file_form="UNFORMATTED", file_position="REWIND")
452 IF (rho_unit_nr > 0) WRITE (rho_unit_nr) time_index
453 CALL cp_print_key_finished_output(rho_unit_nr, logger, rtbse_env%restart_section)
454 END DO
455 END SUBROUTINE output_restart
456! **************************************************************************************************
457!> \brief Reads the density matrix from restart files and updates the starting time
458!> \param restart_section Print key section for the restart files
459!> \param rho Density matrix in AO basis
460!> \param time_index Time index to be written into the info file
461! **************************************************************************************************
462 SUBROUTINE read_restart(rtbse_env)
463 TYPE(rtbse_env_type), POINTER :: rtbse_env
464 TYPE(cp_logger_type), POINTER :: logger
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
468
469 ! This allows the delta kick and output of moment at time 0 in all cases
470 ! except the case when both imaginary and real parts of the density are read
471 rtbse_env%restart_extracted = .false.
472 logger => cp_get_default_logger()
473 ! Start by probing/loading info file
474 save_name = cp_print_key_generate_filename(logger, rtbse_env%restart_section, extension=".info", my_local=.false.)
475 IF (file_exists(save_name)) THEN
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
479 CALL close_file(rho_unit_nr)
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"
482 ELSE
483 cpwarn("Restart required but no info file found - starting from sim_step given in input")
484 END IF
485
486 ! Default labels distinguishing up to two spin species and real/imaginary parts
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
492 save_name = cp_print_key_generate_filename(logger, rtbse_env%restart_section, &
493 extension=file_labels(2*j - 1), my_local=.false.)
494 save_name_2 = cp_print_key_generate_filename(logger, rtbse_env%restart_section, &
495 extension=file_labels(2*j), my_local=.false.)
496 IF (file_exists(save_name) .AND. file_exists(save_name_2)) THEN
497 CALL open_file(save_name, file_status="OLD", file_form="UNFORMATTED", file_action="READ", &
498 unit_number=rho_unit_nr)
499 CALL cp_fm_read_unformatted(rtbse_env%real_workspace(1), rho_unit_nr)
500 CALL close_file(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)
503 CALL cp_fm_read_unformatted(rtbse_env%real_workspace(2), rho_unit_nr)
504 CALL close_file(rho_unit_nr)
505 CALL cp_fm_to_cfm(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), &
506 rtbse_env%rho(j))
507 rtbse_env%restart_extracted = .true.
508 ELSE
509 cpwarn("Restart without some restart matrices - starting from SCF density.")
510 END IF
511 END DO
512 END SUBROUTINE read_restart
513! **************************************************************************************************
514!> \brief Reads the moments and time traces from the save files
515!> \param rtbse_env GW-BSE environment (assumes consistent setup, i.e. a continuation run).
516!> Otherwise, the traces are set at zero
517! **************************************************************************************************
518 SUBROUTINE read_moments(rtbse_env)
519 TYPE(rtbse_env_type), POINTER :: rtbse_env
520 TYPE(cp_logger_type), POINTER :: logger
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
526
527 logger => cp_get_default_logger()
528
529 ! Read moments from the previous run
530 ! Default labels distinguishing up to two spin species and real/imaginary parts
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
536 save_name = cp_print_key_generate_filename(logger, rtbse_env%moments_section, &
537 extension=file_labels(2*j - 1), my_local=.false.)
538 save_name_2 = cp_print_key_generate_filename(logger, rtbse_env%moments_section, &
539 extension=file_labels(2*j), my_local=.false.)
540 IF (file_exists(save_name) .AND. file_exists(save_name_2)) THEN
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)
545 ! Extra time step for the initial one
546 DO k = rtbse_env%sim_start_orig, rtbse_env%sim_start
547 ! Determine the absolute time step - offset in memory
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)
553 DO i = 1, 3
554 rtbse_env%moments_trace(i)%series(n) = cmplx(moments_re(i), moments_im(i), kind=dp)
555 END DO
556 rtbse_env%time_trace%series(n) = timestamp
557 END DO
558 ! Change back to atomic units in the trace
559 rtbse_env%time_trace%series(:) = rtbse_env%time_trace%series(:)/femtoseconds
560 CALL close_file(moments_unit_re)
561 CALL close_file(moments_unit_im)
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.")
564 END IF
565 END DO
566 END SUBROUTINE read_moments
567! **************************************************************************************************
568!> \brief Outputs the Fourier transform of moments stored in the environment memory to the configured file
569!> \param rtbse_env GW-BSE environment
570! **************************************************************************************************
571 SUBROUTINE output_moments_ft(rtbse_env)
572 TYPE(rtbse_env_type), POINTER :: rtbse_env
573 TYPE(cp_logger_type), POINTER :: logger
574 REAL(kind=dp), DIMENSION(:), POINTER :: omega_series, &
575 ft_real_series, &
576 ft_imag_series, &
577 value_series
578 ! Stores the data in ready for output format
579 ! - first dimension is 6 - 1 - real part along x, 2 - imag part along x, 3 - real part along y, ...
580 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: ft_full_series
581 INTEGER :: i, n, ft_unit
582
583 logger => cp_get_default_logger()
584
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))
595 ! Carry out for each direction independently and real and imaginary parts also independently
596 DO i = 1, 3
597 ! Real part of the value first
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(:)
603 ! Now imaginary part
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
609 END DO
610 DEALLOCATE (value_series)
611 ! Now, write these to file
612 ft_unit = cp_print_key_unit_nr(logger, rtbse_env%ft_section, extension=".dat", &
613 file_form="FORMATTED", file_position="REWIND")
614 IF (ft_unit > 0) THEN
615 DO i = 1, n
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)
620 END DO
621 END IF
622 CALL cp_print_key_finished_output(ft_unit, logger, rtbse_env%ft_section)
623 DEALLOCATE (ft_real_series)
624 DEALLOCATE (ft_imag_series)
625 DEALLOCATE (omega_series)
626 DEALLOCATE (ft_full_series)
627 END SUBROUTINE output_moments_ft
628! **************************************************************************************************
629!> \brief Outputs the isotropic polarizability tensor element alpha _ ij = mu_i(omega)/E_j(omega),
630!> where i and j are provided by the configuration. The tensor element is energy dependent and
631!> has real and imaginary parts
632!> \param rtbse_env GW-BSE environment
633! **************************************************************************************************
634 SUBROUTINE output_polarizability(rtbse_env)
635 TYPE(rtbse_env_type), POINTER :: rtbse_env
636 TYPE(cp_logger_type), POINTER :: logger
637 REAL(kind=dp), DIMENSION(:), ALLOCATABLE :: omega_series, &
638 ft_real_series, &
639 ft_imag_series, &
640 value_series
641 COMPLEX(kind=dp), DIMENSION(:), ALLOCATABLE :: moment_series, &
642 field_series
643 COMPLEX(kind=dp), DIMENSION(:, :), ALLOCATABLE :: polarizability_series
644 INTEGER :: pol_unit, &
645 i, k, n, n_elems
646
647 logger => cp_get_default_logger()
648
649 n = rtbse_env%sim_nsteps + 2
650 n_elems = SIZE(rtbse_env%pol_elements, 1)
651 ! All allocations together, although could save some memory, if required by consequent deallocations
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))
659
660 DO k = 1, n_elems
661 ! The moment ft
662 ! Real part
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)
667 ! Imaginary part
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)
672
673 ! Calculate the field transform - store it in ft_real_series
674 IF (rtbse_env%dft_control%rtp_control%apply_delta_pulse) THEN
675 ! Only divide by constant magnitude in atomic units
676 ! TODO : Fix for field with more than one direction
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)
680 ELSE
681 ! Calculate the transform of the field as well and divide by it
682 ! The field FT is not damped - assume field is localised in time
683 ! The field is strictly real
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.)
687 ! Regularization for the case when ft_series becomes identically zero - TODO : Set in config
688 field_series(:) = cmplx(ft_real_series(:), ft_imag_series(:) + 1.0e-20, kind=dp)
689 END IF
690 ! Divide to get the polarizability series
691 polarizability_series(k, :) = moment_series(:)/field_series(:)
692 END DO
693
694 ! Change units to eV for energy
695 ! use value_series for energy and moment_series for polarizability
696 value_series(:) = omega_series(:)*evolt
697 ! Print out the polarizability to a file
698 pol_unit = cp_print_key_unit_nr(logger, rtbse_env%pol_section, extension=".dat", &
699 file_form="FORMATTED", file_position="REWIND")
700 ! Printing for both the stdout and separate file
701 IF (pol_unit > 0) THEN
702 IF (pol_unit == rtbse_env%unit_nr) THEN
703 ! Print the stdout preline
704 WRITE (pol_unit, '(A16)', advance="no") " POLARIZABILITY|"
705 ELSE
706 ! Print also the energy in atomic units
707 WRITE (pol_unit, '(A1,A19)', advance="no") "#", "omega [a.u.]"
708 END IF
709 ! Common - print the energy in eV
710 WRITE (pol_unit, '(A20)', advance="no") "Energy [eV]"
711 ! Print a header for each polarizability element
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)
716 END DO
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)
720 DO i = 1, n
721 IF (pol_unit == rtbse_env%unit_nr) THEN
722 ! Print the stdout preline
723 WRITE (pol_unit, '(A16)', advance="no") " POLARIZABILITY|"
724 ELSE
725 ! omega in a.u.
726 WRITE (pol_unit, '(E20.8E3)', advance="no") omega_series(i)
727 END IF
728 ! Common values
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))
733 END DO
734 ! Print the final value and advance
735 WRITE (pol_unit, '(E20.8E3,E20.8E3)') &
736 REAL(polarizability_series(n_elems, i)), aimag(polarizability_series(n_elems, i))
737 END DO
738 CALL cp_print_key_finished_output(pol_unit, logger, rtbse_env%pol_section)
739 END IF
740
741 DEALLOCATE (value_series)
742 DEALLOCATE (ft_real_series)
743 DEALLOCATE (ft_imag_series)
744
745 DEALLOCATE (field_series)
746 DEALLOCATE (moment_series)
747
748 DEALLOCATE (omega_series)
749 DEALLOCATE (polarizability_series)
750 END SUBROUTINE output_polarizability
751! **************************************************************************************************
752!> \brief Naively calculates the Fourier transform - it is not the bottleneck of this calculation
753!> \param time_series Timestamps in atomic units of time
754!> \param value_series Values to be Fourier transformed - moments, field etc. So far only real.
755!> \param omega_series Array to be filled by sampled values of frequency
756!> \param result_series FT of the value series - real values (cosines)
757!> \param iresult_series FT of the value series - imaginary values (sines)
758!> \param damping_opt Supply custom exponential damping - default is 4.0/totalTime, i.e. ratio
759!> of last and first element in windowed value series is reduced by e^(-4)
760!> \param t0_opt Carry the FT only starting from certain time - allows for exclusion of trace before
761!> the pulse application etc.
762!> \author Stepan Marek
763!> \date 09.2024
764! **************************************************************************************************
765 ! So far only for defined one dimensional 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, &
779 value_subtract
780 LOGICAL :: subtract_initial
781
782 CALL timeset(routinen, handle)
783
784 n = SIZE(time_series)
785
786 t0_i = 1
787 IF (PRESENT(t0_opt)) THEN
788 ! Determine the index at which we start applying the damping
789 ! Also the index around which we fold around
790 DO i = 1, n
791 ! Increase until we break or reach the end of the time series
792 t0_i = i
793 IF (time_series(i) >= t0_opt) THEN
794 EXIT
795 END IF
796 END DO
797 END IF
798
799 t0 = time_series(t0_i)
800
801 ! Default damping so that at the end of the time series, divide value by e^-4
802 damping = 4.0_dp/(time_series(n) - time_series(t0_i))
803 IF (PRESENT(damping_opt)) THEN
804 ! Damping is given a time in which the moments reduce by factor of 1/e
805 IF (damping_opt > 0.0_dp) damping = 1.0_dp/damping_opt
806 IF (damping_opt == 0.0_dp) damping = 0.0_dp
807 END IF
808
809 IF (PRESENT(subtract_initial_opt)) THEN
810 subtract_initial = subtract_initial_opt
811 ELSE
812 subtract_initial = .true.
813 END IF
814
815 ! Construct the grid
816 ! Assume series equidistant
817 delta_t = time_series(2) - time_series(1)
818 delta_omega = twopi/(time_series(n) - time_series(1))
819 ! Subtract initial value, if requested (default is to subtract the value)
820 value_subtract = 0.0_dp
821 IF (subtract_initial) value_subtract = value_series(1)
822 DO i = 1, n
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)
826 DO j = 1, n
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)
832 END DO
833 END DO
834 delta_omega = twopi/(time_series(n) - time_series(1))
835 result_series(:) = delta_t*result_series(:)
836 iresult_series(:) = delta_t*iresult_series(:)
837
838 CALL timestop(handle)
839
840 END SUBROUTINE
841END MODULE rt_bse_io
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.
Definition cp_files.F:16
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.
Definition cp_files.F:308
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.
Definition cp_files.F:119
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
Definition cp_files.F:501
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
Definition cp_fm_types.F:15
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,...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_bch
integer, parameter, public use_rt_restart
integer, parameter, public do_exact
integer, parameter, public rtp_bse_ham_g0w0
integer, parameter, public rtp_bse_ham_ks
objects that represent the structure of input sections and the data contained in an input section
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_path_length
Definition kinds.F:58
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
basic linear algebra operations for full matrixes
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public femtoseconds
Definition physcon.F:153
real(kind=dp), parameter, public evolt
Definition physcon.F:183
Input/output from the propagation via RT-BSE method.
Definition rt_bse_io.F:13
subroutine, public print_rtbse_header_info(rtbse_env)
Writes the header and basic info to the standard output.
Definition rt_bse_io.F:87
subroutine, public output_mos_covariant(rtbse_env, ham, print_key_section)
Outputs the matrix in MO basis for matrix components corresponding to covariant representation,...
Definition rt_bse_io.F:239
subroutine, public output_restart(rtbse_env, rho, time_index)
Outputs the restart info (last finished iteration step) + restard density matrix.
Definition rt_bse_io.F:419
subroutine, public print_etrs_info(rtbse_env, step, metric)
Writes the update after single etrs iteration - only for log level > medium.
Definition rt_bse_io.F:131
subroutine, public read_field(rtbse_env)
Reads the field from the files provided by input - useful for the continuation run.
Definition rt_bse_io.F:307
subroutine, public output_field(rtbse_env)
Prints the current field components into a file provided by input.
Definition rt_bse_io.F:277
subroutine, public print_etrs_info_header(rtbse_env)
Writes the header for the etrs iteration updates - only for log level > medium.
Definition rt_bse_io.F:148
subroutine, public output_mos_contravariant(rtbse_env, rho, print_key_section)
Outputs the matrix in MO basis for matrix coefficients corresponding to contravariant operator,...
Definition rt_bse_io.F:189
subroutine, public read_moments(rtbse_env)
Reads the moments and time traces from the save files.
Definition rt_bse_io.F:519
subroutine, public output_moments_ft(rtbse_env)
Outputs the Fourier transform of moments stored in the environment memory to the configured file.
Definition rt_bse_io.F:572
subroutine, public read_restart(rtbse_env)
Reads the density matrix from restart files and updates the starting time.
Definition rt_bse_io.F:463
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.
Definition rt_bse_io.F:163
subroutine, public output_polarizability(rtbse_env)
Outputs the isotropic polarizability tensor element alpha _ ij = mu_i(omega)/E_j(omega),...
Definition rt_bse_io.F:635
subroutine, public output_moments(rtbse_env, rho)
Outputs the expectation value of moments from a given density matrix.
Definition rt_bse_io.F:341
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
represent a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...