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