(git:4733e3f)
Loading...
Searching...
No Matches
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-2026 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, &
18 USE cp_cfm_types, ONLY: cp_cfm_type, &
21 USE kinds, ONLY: dp, &
33 USE rt_bse_types, ONLY: rtbse_env_type, &
36 USE cp_files, ONLY: open_file, &
39 USE input_constants, ONLY: do_exact, &
40 do_bch, &
44 USE physcon, ONLY: femtoseconds
48
49#include "../base/base_uses.f90"
50
51 IMPLICIT NONE
52
53 PRIVATE
54
55 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = "rt_bse_io"
56
57
58
59
60 PUBLIC :: output_moments, &
62 read_field, &
71
72CONTAINS
73
74! **************************************************************************************************
75!> \brief Writes the header and basic info to the standard output
76!> \param rtbse_env Entry point - rtbse environment
77! **************************************************************************************************
78 SUBROUTINE print_rtbse_header_info(rtbse_env)
79 TYPE(rtbse_env_type) :: rtbse_env
80 TYPE(cp_logger_type), POINTER :: logger
81
82 logger => cp_get_default_logger()
83
84 IF (rtbse_env%unit_nr > 0) THEN
85 WRITE (rtbse_env%unit_nr, *) ''
86 WRITE (rtbse_env%unit_nr, '(A)') ' /-----------------------------------------------'// &
87 '------------------------------\'
88 WRITE (rtbse_env%unit_nr, '(A)') ' | '// &
89 ' |'
90 WRITE (rtbse_env%unit_nr, '(A)') ' | Real Time Bethe-Salpeter Propagation'// &
91 ' |'
92 WRITE (rtbse_env%unit_nr, '(A)') ' | '// &
93 ' |'
94 WRITE (rtbse_env%unit_nr, '(A)') ' \-----------------------------------------------'// &
95 '------------------------------/'
96 WRITE (rtbse_env%unit_nr, *) ''
97
98 ! Methods used
99 WRITE (rtbse_env%unit_nr, '(A19)', advance="no") ' Exponential method'
100 SELECT CASE (rtbse_env%mat_exp_method)
101 CASE (do_bch)
102 WRITE (rtbse_env%unit_nr, '(A61)') 'BCH'
103 CASE (do_exact)
104 WRITE (rtbse_env%unit_nr, '(A61)') 'EXACT'
105 END SELECT
106
107 WRITE (rtbse_env%unit_nr, '(A22)', advance="no") ' Reference Hamiltonian'
108 SELECT CASE (rtbse_env%ham_reference_type)
109 CASE (rtp_bse_ham_g0w0)
110 WRITE (rtbse_env%unit_nr, '(A58)') 'G0W0'
111 CASE (rtp_bse_ham_ks)
112 WRITE (rtbse_env%unit_nr, '(A58)') 'Kohn-Sham'
113 END SELECT
114
115 WRITE (rtbse_env%unit_nr, '(A18,L62)') ' Apply delta pulse', &
116 rtbse_env%dft_control%rtp_control%apply_delta_pulse
117
118 WRITE (rtbse_env%unit_nr, '(A)') ''
119 END IF
120
121 END SUBROUTINE print_rtbse_header_info
122
123! **************************************************************************************************
124!> \brief Writes the update after single etrs iteration - only for log level > medium
125!> \param rtbse_env Entry point - rtbse environment
126! **************************************************************************************************
127 SUBROUTINE print_etrs_info(rtbse_env, step, metric)
128 TYPE(rtbse_env_type) :: rtbse_env
129 INTEGER :: step
130 REAL(kind=dp) :: metric
131 TYPE(cp_logger_type), POINTER :: logger
132
133 logger => cp_get_default_logger()
134
135 IF (logger%iter_info%print_level > medium_print_level .AND. rtbse_env%unit_nr > 0) THEN
136 WRITE (rtbse_env%unit_nr, '(A7,I5, E20.8E3)') ' RTBSE|', step, metric
137 END IF
138
139 END SUBROUTINE print_etrs_info
140! **************************************************************************************************
141!> \brief Writes the header for the etrs iteration updates - only for log level > medium
142!> \param rtbse_env Entry point - rtbse environment
143! **************************************************************************************************
144 SUBROUTINE print_etrs_info_header(rtbse_env)
145 TYPE(rtbse_env_type) :: rtbse_env
146 TYPE(cp_logger_type), POINTER :: logger
147
148 logger => cp_get_default_logger()
149
150 IF (logger%iter_info%print_level > medium_print_level .AND. rtbse_env%unit_nr > 0) THEN
151 WRITE (rtbse_env%unit_nr, '(A13, A20)') ' RTBSE| Iter.', 'Convergence'
152 END IF
153
154 END SUBROUTINE print_etrs_info_header
155! **************************************************************************************************
156!> \brief Writes the header for the etrs iteration updates - only for log level > low
157!> \param rtbse_env Entry point - rtbse environment
158! **************************************************************************************************
159 SUBROUTINE print_timestep_info(rtbse_env, step, convergence, electron_num_re, etrs_num)
160 TYPE(rtbse_env_type) :: rtbse_env
161 INTEGER :: step
162 REAL(kind=dp) :: convergence
163 REAL(kind=dp) :: electron_num_re
164 INTEGER :: etrs_num
165 TYPE(cp_logger_type), POINTER :: logger
166
167 logger => cp_get_default_logger()
168
169 IF (logger%iter_info%print_level > low_print_level .AND. rtbse_env%unit_nr > 0) THEN
170 WRITE (rtbse_env%unit_nr, '(A23,A20,A20,A17)') " RTBSE| Simulation step", "Convergence", &
171 "Electron number", "ETRS Iterations"
172 WRITE (rtbse_env%unit_nr, '(A7,I16,E20.8E3,E20.8E3,I17)') ' RTBSE|', step, convergence, &
173 electron_num_re, etrs_num
174 END IF
175
176 END SUBROUTINE print_timestep_info
177
178! **************************************************************************************************
179!> \brief Outputs the matrix in MO basis for matrix coefficients corresponding to contravariant
180!> operator, i.e. density matrix
181!> \param rtbse_env Entry point - gwbse environment
182!> \param rho Density matrix in AO basis
183!> \param rtp_section RTP input section
184! **************************************************************************************************
185 SUBROUTINE output_mos_contravariant(rtbse_env, rho, print_key_section)
186 TYPE(rtbse_env_type) :: rtbse_env
187 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: rho
188 TYPE(section_vals_type), POINTER :: print_key_section
189 TYPE(cp_logger_type), POINTER :: logger
190 INTEGER :: j, rho_unit_re, rho_unit_im
191 CHARACTER(len=14), DIMENSION(4) :: file_labels
192
193 file_labels(1) = "_SPIN_A_RE.dat"
194 file_labels(2) = "_SPIN_A_IM.dat"
195 file_labels(3) = "_SPIN_B_RE.dat"
196 file_labels(4) = "_SPIN_B_IM.dat"
197 logger => cp_get_default_logger()
198 ! Start by multiplying the current density by MOS
199 DO j = 1, rtbse_env%n_spin
200 rho_unit_re = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j - 1))
201 rho_unit_im = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j))
202 ! Transform the density matrix into molecular orbitals basis and print it out
203 ! S * rho
204 CALL multiply_fm_cfm("N", "N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
205 1.0_dp, rtbse_env%S_fm, rho(j), &
206 0.0_dp, rtbse_env%rho_workspace(1))
207 ! C^T * S * rho
208 CALL multiply_fm_cfm("T", "N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
209 1.0_dp, rtbse_env%bs_env%fm_mo_coeff_Gamma(j), rtbse_env%rho_workspace(1), &
210 0.0_dp, rtbse_env%rho_workspace(2))
211 ! C^T * S * rho * S
212 CALL multiply_cfm_fm("N", "N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
213 1.0_dp, rtbse_env%rho_workspace(2), rtbse_env%S_fm, &
214 0.0_dp, rtbse_env%rho_workspace(1))
215 ! C^T * S * rho * S * C
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(1), rtbse_env%bs_env%fm_mo_coeff_Gamma(j), &
218 0.0_dp, rtbse_env%rho_workspace(2))
219 ! Print real and imaginary parts separately
220 CALL cp_cfm_to_fm(rtbse_env%rho_workspace(2), &
221 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
222 CALL cp_fm_write_formatted(rtbse_env%real_workspace(1), rho_unit_re)
223 CALL cp_fm_write_formatted(rtbse_env%real_workspace(2), rho_unit_im)
224 CALL cp_print_key_finished_output(rho_unit_re, logger, print_key_section)
225 CALL cp_print_key_finished_output(rho_unit_im, logger, print_key_section)
226 END DO
227 END SUBROUTINE output_mos_contravariant
228! **************************************************************************************************
229!> \brief Outputs the matrix in MO basis for matrix components corresponding to covariant representation,
230!> i.e. the Hamiltonian matrix
231!> \param rtbse_env Entry point - gwbse environment
232!> \param cohsex cohsex matrix in AO basis, covariant representation
233!> \param rtp_section RTP input section
234! **************************************************************************************************
235 SUBROUTINE output_mos_covariant(rtbse_env, ham, print_key_section)
236 TYPE(rtbse_env_type) :: rtbse_env
237 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: ham
238 TYPE(section_vals_type), POINTER :: print_key_section
239 TYPE(cp_logger_type), POINTER :: logger
240 INTEGER :: j, rho_unit_re, rho_unit_im
241 CHARACTER(len=21), DIMENSION(4) :: file_labels
242
243 file_labels(1) = "_SPIN_A_RE.dat"
244 file_labels(2) = "_SPIN_A_IM.dat"
245 file_labels(3) = "_SPIN_B_RE.dat"
246 file_labels(4) = "_SPIN_B_IM.dat"
247 logger => cp_get_default_logger()
248 DO j = 1, rtbse_env%n_spin
249 rho_unit_re = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j - 1))
250 rho_unit_im = cp_print_key_unit_nr(logger, print_key_section, extension=file_labels(2*j))
251 ! C^T * cohsex
252 CALL multiply_fm_cfm("T", "N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
253 1.0_dp, rtbse_env%bs_env%fm_mo_coeff_Gamma(j), ham(j), &
254 0.0_dp, rtbse_env%rho_workspace(1))
255 ! C^T * cohsex * C
256 CALL multiply_cfm_fm("N", "N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
257 1.0_dp, rtbse_env%rho_workspace(1), rtbse_env%bs_env%fm_mo_coeff_Gamma(j), &
258 0.0_dp, rtbse_env%rho_workspace(2))
259 ! Print real and imaginary parts separately
260 CALL cp_cfm_to_fm(rtbse_env%rho_workspace(2), &
261 rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
262 CALL cp_fm_write_formatted(rtbse_env%real_workspace(1), rho_unit_re)
263 CALL cp_fm_write_formatted(rtbse_env%real_workspace(2), rho_unit_im)
264 CALL cp_print_key_finished_output(rho_unit_re, logger, print_key_section)
265 CALL cp_print_key_finished_output(rho_unit_im, logger, print_key_section)
266 END DO
267 END SUBROUTINE output_mos_covariant
268! **************************************************************************************************
269!> \brief Prints the current field components into a file provided by input
270!> \param rtbse_env Entry point - gwbse environment
271!> \param rtp_section RTP input section
272! **************************************************************************************************
273 SUBROUTINE output_field(rtbse_env, append_opt)
274 TYPE(rtbse_env_type) :: rtbse_env
275 LOGICAL, OPTIONAL :: append_opt
276 TYPE(cp_logger_type), POINTER :: logger
277 INTEGER :: field_unit, n, i
278 LOGICAL :: append
279
280 ! Figure out whether we are appending or not, true by default
281 append = .true.
282 IF (PRESENT(append_opt)) append = .false.
283
284 ! First, write the current field to memory
285 ! Need the absolute index
286 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
287 DO i = 1, 3
288 rtbse_env%field_trace(i, n) = cmplx(rtbse_env%field(i), 0.0, kind=dp)
289 END DO
290 rtbse_env%time_trace(n) = rtbse_env%sim_time
291
292 ! Now, continue to file output
293 ! Get logger
294 logger => cp_get_default_logger()
295 ! Get file descriptor
296 field_unit = cp_print_key_unit_nr(logger, rtbse_env%field_section, extension=".dat")
297 IF (append) THEN
298 CALL print_rt_file(field_unit, xvals=rtbse_env%time_trace(n:n), &
299 yvals=rtbse_env%field_trace(:, n:n), &
300 xscale_opt=femtoseconds, comp_opt=rt_file_comp_real)
301 ELSE
302 CALL print_rt_file(field_unit, [ &
303 "# Time [fs]", &
304 " field x [at.u.]", &
305 " field y [at.u.]", &
306 " field z [at.u.]"], &
307 rtbse_env%time_trace(n:n), rtbse_env%field_trace(:, n:n), &
308 xscale_opt=femtoseconds, comp_opt=rt_file_comp_real)
309 END IF
310 CALL cp_print_key_finished_output(field_unit, logger, rtbse_env%field_section)
311
312 END SUBROUTINE output_field
313! **************************************************************************************************
314!> \brief Reads the field from the files provided by input - useful for the continuation run
315!> \param rtbse_env Entry point - gwbse environment
316!> \param rtp_section RTP input section
317! **************************************************************************************************
318 SUBROUTINE read_field(rtbse_env)
319 TYPE(rtbse_env_type) :: rtbse_env
320 TYPE(cp_logger_type), POINTER :: logger
321 CHARACTER(len=default_path_length) :: save_name
322 INTEGER :: k, n, field_unit
323 REAL(kind=dp), DIMENSION(3) :: real_field
324
325 ! Get logger
326 logger => cp_get_default_logger()
327 ! Get file name
328 save_name = cp_print_key_generate_filename(logger, rtbse_env%field_section, extension=".dat", my_local=.false.)
329 IF (file_exists(save_name)) THEN
330 CALL open_file(save_name, file_status="OLD", file_form="FORMATTED", file_action="READ", &
331 unit_number=field_unit)
332 ! Skip the first line - it contains headers
333 READ (field_unit, '()')
334 DO k = rtbse_env%sim_start_orig, rtbse_env%sim_start
335 n = k - rtbse_env%sim_start_orig + 1
336 READ (field_unit, '(E20.8E3,E20.8E3,E20.8E3,E20.8E3)') rtbse_env%time_trace(n), &
337 real_field(1), real_field(2), real_field(3)
338 rtbse_env%field_trace(:, n) = cmplx(real_field(:), 0.0, kind=dp)
339 ! Set the time units back to atomic units
340 rtbse_env%time_trace(n) = rtbse_env%time_trace(n)/femtoseconds
341 END DO
342 CALL close_file(field_unit)
343 ELSE IF (.NOT. rtbse_env%dft_control%rtp_control%apply_delta_pulse .AND. &
344 rtbse_env%dft_control%rtp_control%initial_wfn == use_rt_restart) THEN
345 cpwarn("Restart without RT field file - unknown field trace set to zero.")
346 END IF
347 END SUBROUTINE read_field
348
349! **************************************************************************************************
350!> \brief Outputs the expectation value of moments from a given density matrix
351!> \note Moments matrix is provided by the rtbse_env, uses rho_workspace(1:3)
352!> \param rtbse_env Entry point - gwbse environment
353!> \param rho Density matrix in AO basis
354!> \param rtp_section RTP section of the input parameters, where moments destination may be present
355! **************************************************************************************************
356 SUBROUTINE output_moments(rtbse_env, rho)
357 TYPE(rtbse_env_type) :: rtbse_env
358 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: rho
359 INTEGER :: i, j, n
360 REAL(kind=dp), DIMENSION(3) :: moments_re
361
362 n = rtbse_env%sim_step - rtbse_env%sim_start_orig + 1
363
364 DO j = 1, rtbse_env%n_spin
365 ! Need to transpose due to the definition of trace function
366 CALL cp_cfm_to_fm(msource=rho(j), mtargetr=rtbse_env%real_workspace(2))
367 DO i = 1, 3
368 ! Moments should be symmetric, test without transopose?
369 CALL cp_fm_transpose(rtbse_env%moments(i), rtbse_env%real_workspace(1))
370 CALL cp_fm_trace(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), moments_re(i))
371 ! Scale by spin degeneracy and electron charge
372 moments_re(i) = -moments_re(i)*rtbse_env%spin_degeneracy
373 rtbse_env%moments_trace(j, i, n) = cmplx(moments_re(i), 0.0, kind=dp)
374 END DO
375 ! Same for imaginary part
376 CALL cp_cfm_to_fm(msource=rho(j), mtargeti=rtbse_env%real_workspace(2))
377 DO i = 1, 3
378 CALL cp_fm_transpose(rtbse_env%moments(i), rtbse_env%real_workspace(1))
379 CALL cp_fm_trace(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), moments_re(i))
380 ! Scale by spin degeneracy and electron charge
381 moments_re(i) = -moments_re(i)*rtbse_env%spin_degeneracy
382 rtbse_env%moments_trace(j, i, n) = rtbse_env%moments_trace(j, i, n) + cmplx(0.0, moments_re(i), kind=dp)
383 END DO
384 END DO
385 ! Output to the file
386 CALL print_moments(rtbse_env%moments_section, rtbse_env%unit_nr, rtbse_env%moments_trace(:, :, n), &
387 rtbse_env%sim_time, .true., append_opt=(rtbse_env%sim_step /= rtbse_env%sim_start_orig))
388 END SUBROUTINE output_moments
389! **************************************************************************************************
390!> \brief Outputs the restart info (last finished iteration step) + restard density matrix
391!> \param restart_section Print key section for the restart files
392!> \param rho Density matrix in AO basis
393!> \param time_index Time index to be written into the info file
394! **************************************************************************************************
395 SUBROUTINE output_restart(rtbse_env, rho, time_index)
396 TYPE(rtbse_env_type), POINTER :: rtbse_env
397 TYPE(cp_cfm_type), DIMENSION(:), POINTER :: rho
398 INTEGER :: time_index
399 TYPE(cp_fm_type), DIMENSION(:), POINTER :: workspace
400 CHARACTER(len=17), DIMENSION(4) :: file_labels
401 TYPE(cp_logger_type), POINTER :: logger
402 INTEGER :: rho_unit_nr, i
403
404 ! Default labels distinguishing up to two spin species and real/imaginary parts
405 file_labels(1) = "_SPIN_A_RE.matrix"
406 file_labels(2) = "_SPIN_A_IM.matrix"
407 file_labels(3) = "_SPIN_B_RE.matrix"
408 file_labels(4) = "_SPIN_B_IM.matrix"
409
410 logger => cp_get_default_logger()
411
412 workspace => rtbse_env%real_workspace
413
414 DO i = 1, rtbse_env%n_spin
415 CALL cp_cfm_to_fm(rho(i), workspace(1), workspace(2))
416 ! Real part
417 rho_unit_nr = cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=file_labels(2*i - 1), &
418 file_form="UNFORMATTED", file_position="REWIND")
419 CALL cp_fm_write_unformatted(workspace(1), rho_unit_nr)
420 CALL cp_print_key_finished_output(rho_unit_nr, logger, rtbse_env%restart_section)
421 ! Imag part
422 rho_unit_nr = cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=file_labels(2*i), &
423 file_form="UNFORMATTED", file_position="REWIND")
424 CALL cp_fm_write_unformatted(workspace(2), rho_unit_nr)
425 CALL cp_print_key_finished_output(rho_unit_nr, logger, rtbse_env%restart_section)
426 ! Info
427 rho_unit_nr = cp_print_key_unit_nr(logger, rtbse_env%restart_section, extension=".info", &
428 file_form="UNFORMATTED", file_position="REWIND")
429 IF (rho_unit_nr > 0) WRITE (rho_unit_nr) time_index
430 CALL cp_print_key_finished_output(rho_unit_nr, logger, rtbse_env%restart_section)
431 END DO
432 END SUBROUTINE output_restart
433! **************************************************************************************************
434!> \brief Reads the density matrix from restart files and updates the starting time
435!> \param restart_section Print key section for the restart files
436!> \param rho Density matrix in AO basis
437!> \param time_index Time index to be written into the info file
438! **************************************************************************************************
439 SUBROUTINE read_restart(rtbse_env)
440 TYPE(rtbse_env_type), POINTER :: rtbse_env
441 TYPE(cp_logger_type), POINTER :: logger
442 CHARACTER(len=default_path_length) :: save_name, save_name_2
443 INTEGER :: rho_unit_nr, j
444 CHARACTER(len=17), DIMENSION(4) :: file_labels
445
446 ! This allows the delta kick and output of moment at time 0 in all cases
447 ! except the case when both imaginary and real parts of the density are read
448 rtbse_env%restart_extracted = .false.
449 logger => cp_get_default_logger()
450 ! Start by probing/loading info file
451 save_name = cp_print_key_generate_filename(logger, rtbse_env%restart_section, extension=".info", my_local=.false.)
452 IF (file_exists(save_name)) THEN
453 CALL open_file(save_name, file_status="OLD", file_form="UNFORMATTED", file_action="READ", &
454 unit_number=rho_unit_nr)
455 READ (rho_unit_nr) rtbse_env%sim_start
456 CALL close_file(rho_unit_nr)
457 IF (rtbse_env%unit_nr > 0) WRITE (rtbse_env%unit_nr, '(A31,I25,A24)') " RTBSE| Starting from timestep ", &
458 rtbse_env%sim_start, ", delta kick NOT applied"
459 ELSE
460 cpwarn("Restart required but no info file found - starting from sim_step given in input")
461 END IF
462
463 ! Default labels distinguishing up to two spin species and real/imaginary parts
464 file_labels(1) = "_SPIN_A_RE.matrix"
465 file_labels(2) = "_SPIN_A_IM.matrix"
466 file_labels(3) = "_SPIN_B_RE.matrix"
467 file_labels(4) = "_SPIN_B_IM.matrix"
468 DO j = 1, rtbse_env%n_spin
469 save_name = cp_print_key_generate_filename(logger, rtbse_env%restart_section, &
470 extension=file_labels(2*j - 1), my_local=.false.)
471 save_name_2 = cp_print_key_generate_filename(logger, rtbse_env%restart_section, &
472 extension=file_labels(2*j), my_local=.false.)
473 IF (file_exists(save_name) .AND. file_exists(save_name_2)) THEN
474 CALL open_file(save_name, file_status="OLD", file_form="UNFORMATTED", file_action="READ", &
475 unit_number=rho_unit_nr)
476 CALL cp_fm_read_unformatted(rtbse_env%real_workspace(1), rho_unit_nr)
477 CALL close_file(rho_unit_nr)
478 CALL open_file(save_name_2, file_status="OLD", file_form="UNFORMATTED", file_action="READ", &
479 unit_number=rho_unit_nr)
480 CALL cp_fm_read_unformatted(rtbse_env%real_workspace(2), rho_unit_nr)
481 CALL close_file(rho_unit_nr)
482 CALL cp_fm_to_cfm(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2), &
483 rtbse_env%rho(j))
484 rtbse_env%restart_extracted = .true.
485 ELSE
486 cpwarn("Restart without some restart matrices - starting from SCF density.")
487 END IF
488 END DO
489 END SUBROUTINE read_restart
490END MODULE rt_bse_io
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:311
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:122
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
Definition cp_files.F:504
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
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_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 physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public femtoseconds
Definition physcon.F:153
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:79
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:236
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:396
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:128
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:319
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:145
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:186
subroutine, public output_field(rtbse_env, append_opt)
Prints the current field components into a file provided by input.
Definition rt_bse_io.F:274
subroutine, public read_restart(rtbse_env)
Reads the density matrix from restart files and updates the starting time.
Definition rt_bse_io.F:440
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 > low.
Definition rt_bse_io.F:160
subroutine, public output_moments(rtbse_env, rho)
Outputs the expectation value of moments from a given density matrix.
Definition rt_bse_io.F:357
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.
Routine for the real time propagation output.
subroutine, public print_rt_file(rt_unit, headers, xvals, yvals, prefix, prefix_format, xscale_opt, comp_opt)
...
subroutine, public print_moments(moments_section, info_unit, moments, time, imag_opt, append_opt)
Print the dipole moments into a file.
integer, parameter, public rt_file_comp_real
Represent a complex full matrix.
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...