(git:3f0d10b)
Loading...
Searching...
No Matches
rt_propagation.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 Routines for the real time propagation.
10!> \author Florian Schiffmann (02.09)
11! **************************************************************************************************
12
14 USE bibliography, ONLY: andermatt2016,&
15 cite_reference
16 USE cell_types, ONLY: cell_type
19 USE cp_dbcsr_api, ONLY: dbcsr_copy,&
25 USE cp_fm_types, ONLY: cp_fm_set_all,&
35 cp_p_file,&
60 USE kinds, ONLY: default_path_length,&
61 dp
62 USE machine, ONLY: m_walltime
65 USE pw_env_types, ONLY: pw_env_type
75 USE qs_ks_types, ONLY: qs_ks_did_change,&
79 USE qs_mo_types, ONLY: get_mo_set,&
84 USE qs_rho_types, ONLY: qs_rho_set,&
92 print_ft,&
95 USE rt_propagation_types, ONLY: get_rtp,&
110#include "../base/base_uses.f90"
111
112 IMPLICIT NONE
113
114 PRIVATE
115
116 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'rt_propagation'
117
118 PUBLIC :: rt_prop_setup
119
120CONTAINS
121
122! **************************************************************************************************
123!> \brief creates rtp_type, gets the initial state, either by reading MO's
124!> from file or calling SCF run
125!> \param force_env ...
126!> \author Florian Schiffmann (02.09)
127! **************************************************************************************************
128
129 SUBROUTINE rt_prop_setup(force_env)
130 TYPE(force_env_type), POINTER :: force_env
131
132 INTEGER :: aspc_order
133 LOGICAL :: magnetic, track_current, &
134 track_current_int, vel_reprs
135 TYPE(dft_control_type), POINTER :: dft_control
136 TYPE(global_environment_type), POINTER :: globenv
137 TYPE(qs_energy_type), POINTER :: energy
138 TYPE(qs_environment_type), POINTER :: qs_env
139 TYPE(rt_prop_type), POINTER :: rtp
140 TYPE(rtp_control_type), POINTER :: rtp_control
141 TYPE(section_vals_type), POINTER :: current_int_section, current_section, hfx_sections, &
142 input, ls_scf_section, md_section, motion_section, print_moments_section, &
143 rtp_print_section, rtp_section
144
145 NULLIFY (qs_env, rtp_control, dft_control)
146
147 CALL cite_reference(andermatt2016)
148
149 CALL force_env_get(force_env=force_env, qs_env=qs_env, globenv=globenv)
150 CALL get_qs_env(qs_env, dft_control=dft_control, energy=energy)
151 rtp_control => dft_control%rtp_control
152
153 ! The RTP/EMD ADMM implementation (density fit, KS merge and forces) only supports
154 ! basis projection without purification and without exchange scaling
155 IF (dft_control%do_admm) THEN
156 IF (dft_control%admm_control%purification_method /= do_admm_purify_none) THEN
157 CALL cp_abort(__location__, "RTP/EMD with ADMM requires ADMM_PURIFICATION_METHOD NONE "// &
158 "(the default is MO_DIAG). Use e.g. ADMM_TYPE ADMM2.")
159 END IF
160 IF (dft_control%admm_control%method /= do_admm_basis_projection) THEN
161 CALL cp_abort(__location__, "RTP/EMD with ADMM requires METHOD BASIS_PROJECTION. "// &
162 "ADMMQ and ADMMS are not implemented for RTP/EMD.")
163 END IF
164 IF (dft_control%admm_control%scaling_model /= do_admm_exch_scaling_none) THEN
165 CALL cp_abort(__location__, "RTP/EMD with ADMM requires EXCH_SCALING_MODEL NONE. "// &
166 "ADMMP and ADMMS are not implemented for RTP/EMD.")
167 END IF
168 END IF
169
170 ! Takes care that an initial wavefunction/density is available
171 ! Can either be by performing an scf loop or reading a restart
172 CALL rt_initial_guess(qs_env, force_env, rtp_control)
173
174 ! Initializes the extrapolation
175 NULLIFY (rtp)
176 CALL get_qs_env(qs_env=qs_env, rtp=rtp, input=input)
177 aspc_order = rtp_control%aspc_order
178 CALL rtp_history_create(rtp, aspc_order)
179
180 ! Reads the simulation parameters from the input
181 motion_section => section_vals_get_subs_vals(force_env%root_section, "MOTION")
182 md_section => section_vals_get_subs_vals(motion_section, "MD")
183 hfx_sections => section_vals_get_subs_vals(force_env%root_section, "FORCE_EVAL%DFT%XC%HF")
184 rtp_section => section_vals_get_subs_vals(force_env%root_section, "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION")
185 print_moments_section => section_vals_get_subs_vals(force_env%root_section, "FORCE_EVAL%DFT%PRINT%MOMENTS")
186 CALL section_vals_val_get(md_section, "TIMESTEP", r_val=qs_env%rtp%dt)
187 CALL section_vals_val_get(md_section, "STEP_START_VAL", i_val=qs_env%rtp%i_start)
188 CALL section_vals_val_get(md_section, "STEPS", i_val=rtp%nsteps)
189 CALL section_vals_val_get(md_section, "MAX_STEPS", i_val=rtp%max_steps)
190
191 ls_scf_section => section_vals_get_subs_vals(input, "DFT%LS_SCF")
192 CALL section_vals_val_get(ls_scf_section, "EPS_FILTER", r_val=rtp%filter_eps)
193 IF (.NOT. qs_env%rtp%linear_scaling) rtp%filter_eps = 0.0_dp
194 IF (rtp_control%acc_ref < 1) rtp_control%acc_ref = 1
195 rtp%filter_eps_small = rtp%filter_eps/rtp_control%acc_ref
196 CALL section_vals_val_get(ls_scf_section, "EPS_LANCZOS", r_val=rtp%lanzcos_threshold)
197 CALL section_vals_val_get(ls_scf_section, "MAX_ITER_LANCZOS", i_val=rtp%lanzcos_max_iter)
198 CALL section_vals_val_get(ls_scf_section, "SIGN_SQRT_ORDER", i_val=rtp%newton_schulz_order)
199 CALL section_vals_get(hfx_sections, explicit=rtp%do_hfx)
200 CALL section_vals_val_get(print_moments_section, "MAGNETIC", l_val=magnetic)
201 CALL section_vals_val_get(print_moments_section, "VEL_REPRS", l_val=vel_reprs)
202
203 ! The imaginary part of the density matrix (needed for the current) is generically
204 ! nonzero whenever the propagated state is not stationary, independently of whether
205 ! an explicit time-dependent field/vector potential is applied: e.g. an excited
206 ! state prepared by occupation swap, from LR-TDDFT, or via a MOM-constrained SCF.
207 ! Rather than trying to detect every possible way of preparing such a state, track
208 ! the imaginary density whenever the user actually requests output that needs it.
209 rtp_print_section => section_vals_get_subs_vals(rtp_section, "PRINT")
210 current_section => section_vals_get_subs_vals(rtp_print_section, "CURRENT")
211 current_int_section => section_vals_get_subs_vals(rtp_print_section, "CURRENT_INT")
212 CALL section_vals_get(current_section, explicit=track_current)
213 CALL section_vals_get(current_int_section, explicit=track_current_int)
214
215 rtp%track_imag_density = (magnetic) .OR. (vel_reprs) .OR. (rtp_control%velocity_gauge) &
216 .OR. (rtp%do_hfx) .OR. (.NOT. rtp_control%fixed_ions) &
217 .OR. (track_current) .OR. (track_current_int)
218 rtp%propagate_complex_ks = rtp%do_hfx .OR. rtp_control%velocity_gauge
219
220 ! Marek : In case some print sections that apply so far only to RTBSE are present,
221 ! warn the user that the quantities will not be in fact printed out
222 CALL warn_section_unused(rtp_print_section, "DENSITY_MATRIX", &
223 "DENSITY_MATRIX printing not implemented for non-RTBSE code.")
224
225 CALL rt_init_complex_quantities(qs_env, imag_p=rtp%track_imag_density, &
226 imag_ks=rtp%propagate_complex_ks, imag_h=rtp_control%velocity_gauge)
227
228 IF (rtp_control%save_local_moments) CALL rt_init_local_moments(rtp, qs_env)
229
230 ! Hmm, not really like to initialize with the structure of S but I reckon it is
231 ! done everywhere like this
232 IF (rtp%do_hfx) CALL rtp_hfx_rebuild(qs_env)
233
234 ! Setup the MO projection environment if required
235 IF (rtp_control%is_proj_mo) CALL init_mo_projection(qs_env, rtp_control)
236
237 CALL init_propagation_run(qs_env)
238 IF (.NOT. rtp_control%fixed_ions) THEN
239 !derivativs of the overlap needed for EMD
240 CALL calc_s_derivs(qs_env)
241 ! a bit hidden, but computes SinvH and SinvB (calc_SinvH for CN,EM and ARNOLDI)
242 ! make_etrs_exp in case of ETRS in combination with TAYLOR and PADE
243 END IF
244 CALL init_propagators(qs_env)
245 IF (rtp_control%fixed_ions) THEN
246 CALL run_propagation(qs_env, force_env, globenv)
247 ELSE
248 rtp_control%initial_step = .true.
249 CALL force_env_calc_energy_force(force_env, calc_force=.true.)
250 rtp_control%initial_step = .false.
251 rtp%energy_old = energy%total
252 END IF
253
254 IF (rtp_control%save_local_moments) THEN
255 ! Call routines for outputs and deallocations of FT observables
256 CALL final_ft_output(qs_env)
257 END IF
258
259 IF (ASSOCIATED(rtp_control%print_pol_elements)) DEALLOCATE (rtp_control%print_pol_elements)
260
261 END SUBROUTINE rt_prop_setup
262
263! **************************************************************************************************
264!> \brief calculates the matrices needed in the first step of EMD/RTP
265!> \param qs_env ...
266!> \author Florian Schiffmann (02.09)
267! **************************************************************************************************
268
269 SUBROUTINE init_propagation_run(qs_env)
270 TYPE(qs_environment_type), POINTER :: qs_env
271
272 REAL(kind=dp), PARAMETER :: zero = 0.0_dp
273
274 INTEGER :: i, ispin, re
275 INTEGER, DIMENSION(2) :: nelectron_spin
276 TYPE(cp_fm_type), DIMENSION(:), POINTER :: mos_new, mos_old
277 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, rho_new, rho_old
278 TYPE(dft_control_type), POINTER :: dft_control
279 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
280 TYPE(rt_prop_type), POINTER :: rtp
281 TYPE(rtp_control_type), POINTER :: rtp_control
282
283 NULLIFY (dft_control, rtp, rtp_control)
284
285 CALL cite_reference(andermatt2016)
286
287 CALL get_qs_env(qs_env, &
288 rtp=rtp, &
289 dft_control=dft_control)
290 rtp_control => dft_control%rtp_control
291
292 IF (rtp_control%initial_wfn == use_scf_wfn) THEN
293 IF (rtp_control%apply_delta_pulse .OR. rtp_control%apply_delta_pulse_mag) THEN
294 CALL apply_delta_pulse(qs_env, rtp, rtp_control)
295 ELSE
296 IF (.NOT. rtp%linear_scaling) THEN
297 CALL get_rtp(rtp=rtp, mos_old=mos_old)
298 CALL get_qs_env(qs_env, mos=mos)
299 DO i = 1, SIZE(mos)
300 CALL cp_fm_to_fm(mos(i)%mo_coeff, mos_old(2*i - 1))
301 CALL cp_fm_set_all(mos_old(2*i), zero, zero)
302 END DO
303 END IF
304 END IF
305 END IF
306
307 IF (.NOT. rtp%linear_scaling) THEN
308 CALL get_rtp(rtp=rtp, mos_old=mos_old, mos_new=mos_new)
309 DO i = 1, SIZE(mos_old)
310 CALL cp_fm_to_fm(mos_old(i), mos_new(i))
311 END DO
312 CALL calc_update_rho(qs_env)
313 ELSE
314 IF (rtp_control%initial_wfn == use_scf_wfn) THEN
315 CALL get_qs_env(qs_env, &
316 matrix_ks=matrix_ks, &
317 mos=mos, &
318 nelectron_spin=nelectron_spin)
319 IF (ASSOCIATED(mos)) THEN
320 !The wavefunction was minimized by an mo based algorith. P is therefore calculated from the mos
321 IF (ASSOCIATED(rtp%mos)) THEN
322 IF (ASSOCIATED(rtp%mos%old)) THEN
323 ! Delta kick was applied and the results is in rtp%mos%old
324 CALL rt_initialize_rho_from_mos(rtp, mos, mos_old=rtp%mos%old)
325 ELSE
326 CALL rt_initialize_rho_from_mos(rtp, mos)
327 END IF
328 ELSE
329 CALL rt_initialize_rho_from_mos(rtp, mos)
330 END IF
331 ELSE
332 ! The wavefunction was minimized using a linear scaling method.
333 ! The density matrix is therefore taken from the ls_scf_env.
334 CALL get_rtp(rtp=rtp, rho_old=rho_old, rho_new=rho_new)
335 DO ispin = 1, SIZE(rho_old)/2
336 re = 2*ispin - 1
337 CALL dbcsr_copy(rho_old(re)%matrix, qs_env%ls_scf_env%matrix_p(ispin))
338 CALL dbcsr_copy(rho_new(re)%matrix, qs_env%ls_scf_env%matrix_p(ispin))
339 END DO
340 END IF
341 CALL calc_update_rho_sparse(qs_env)
342 END IF
343 END IF
344 ! Modify KS matrix to include the electric field in the length gauge
345 ! or the additional terms in the velocity gauge
346 IF (dft_control%apply_efield_field) THEN
348 ELSE IF (rtp_control%velocity_gauge) THEN
349 ! As matrix_h and matrix_h_im are not updated by qs_ks_update_qs_env()
350 ! the non-gauge transformed non-local part has to be subtracted here
351 CALL velocity_gauge_ks_matrix(qs_env, subtract_nl_term=.true.)
352 END IF
353 CALL qs_ks_update_qs_env(qs_env, calculate_forces=.false.)
354
355 END SUBROUTINE init_propagation_run
356
357! **************************************************************************************************
358!> \brief performs the real RTP run, gets information from MD section
359!> uses MD as iteration level
360!> \param qs_env ...
361!> \param force_env ...
362!> \param globenv ...
363!> \author Florian Schiffmann (02.09)
364! **************************************************************************************************
365
366 SUBROUTINE run_propagation(qs_env, force_env, globenv)
367 TYPE(qs_environment_type), POINTER :: qs_env
368 TYPE(force_env_type), POINTER :: force_env
369 TYPE(global_environment_type), POINTER :: globenv
370
371 CHARACTER(len=*), PARAMETER :: routinen = 'run_propagation'
372
373 INTEGER :: aspc_order, handle, i_iter, i_step, &
374 max_iter, max_steps, output_unit, &
375 unit_nr
376 LOGICAL :: moments_read, should_stop
377 REAL(kind=dp) :: eps_ener, time_iter_start, &
378 time_iter_stop, used_time
379 TYPE(cp_logger_type), POINTER :: logger
380 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_new
381 TYPE(dft_control_type), POINTER :: dft_control
382 TYPE(pw_env_type), POINTER :: pw_env
383 TYPE(qs_energy_type), POINTER :: energy
384 TYPE(rt_prop_type), POINTER :: rtp
385 TYPE(rtp_control_type), POINTER :: rtp_control
386 TYPE(section_vals_type), POINTER :: input, moments_section, rtp_section
387
388 should_stop = .false.
389 CALL timeset(routinen, handle)
390
391 CALL cite_reference(andermatt2016)
392
393 NULLIFY (logger, dft_control, energy, rtp, rtp_control, input, rtp_section)
394 logger => cp_get_default_logger()
395 IF (logger%para_env%is_source()) THEN
396 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
397 ELSE
398 unit_nr = -1
399 END IF
400
401 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control, rtp=rtp, energy=energy, input=input)
402
403 rtp_control => dft_control%rtp_control
404 max_steps = min(rtp%nsteps, rtp%max_steps)
405 max_iter = rtp_control%max_iter
406 eps_ener = rtp_control%eps_ener
407
408 aspc_order = rtp_control%aspc_order
409
410 rtp%energy_old = energy%total
411 time_iter_start = m_walltime()
412 CALL cp_add_iter_level(logger, "MD")
413 CALL cp_iterate(logger%iter_info, iter_nr=0)
414 IF (rtp%i_start >= max_steps) CALL cp_abort(__location__, &
415 "maximum step number smaller than initial step value")
416
417 rtp_section => section_vals_get_subs_vals(input, "DFT%REAL_TIME_PROPAGATION")
418 output_unit = cp_print_key_unit_nr(logger, rtp_section, "PRINT%PROGRAM_RUN_INFO", &
419 extension=".scfLog")
420 ! Add the zero iteration moments to the moment trace
421 IF (rtp_control%save_local_moments) THEN
422 CALL get_rtp(rtp, rho_new=rho_new)
423 moments_section => section_vals_get_subs_vals(rtp_section, "PRINT%MOMENTS")
424 ! TODO : Conditions on when not to read the files
425 CALL read_moments(moments_section, 0, rtp%i_start, rtp%moments, rtp%times, moments_read)
426 ! Recalculate the field at times in the trace/Read the field from the files
427 CALL recalculate_fields(rtp%fields, rtp%times, 0, rtp%i_start, dft_control)
428 IF (.NOT. moments_read) THEN
429 CALL calc_local_moment(rtp%local_moments, rho_new, rtp%local_moments_work, rtp%moments(:, :, 1))
430 qs_env%sim_time = real(rtp%i_start, dp)*rtp%dt
431 rtp%times(1) = qs_env%sim_time
432 CALL print_moments(moments_section, output_unit, rtp%moments(:, :, 1), &
433 qs_env%sim_time, rtp%track_imag_density)
434 END IF
435 END IF
436
437 DO i_step = rtp%i_start + 1, max_steps
438 IF (output_unit > 0) THEN
439 WRITE (output_unit, fmt="(/,(T2,A,T40,I6))") &
440 "Real time propagation step:", i_step
441 END IF
442 energy%efield_core = 0.0_dp
443 qs_env%sim_time = real(i_step, dp)*rtp%dt
444 CALL get_qs_env(qs_env, pw_env=pw_env)
445 pw_env%poisson_env%parameters%dbc_params%time = qs_env%sim_time
446 qs_env%sim_step = i_step
447 rtp%istep = i_step - rtp%i_start
448 CALL calculate_ecore_efield(qs_env, .false.)
449 IF (dft_control%apply_external_potential) THEN
450 IF (.NOT. dft_control%expot_control%static) THEN
451 dft_control%eval_external_potential = .true.
452 END IF
453 END IF
454 CALL external_c_potential(qs_env, calculate_forces=.false.)
455 CALL external_e_potential(qs_env)
456 CALL cp_iterate(logger%iter_info, last=(i_step == max_steps), iter_nr=i_step)
457 rtp%converged = .false.
458 DO i_iter = 1, max_iter
459 IF (i_step == rtp%i_start + 1 .AND. i_iter == 2 .AND. rtp_control%hfx_redistribute) THEN
460 CALL qs_ks_did_change(qs_env%ks_env, s_mstruct_changed=.true.)
461 END IF
462 rtp%iter = i_iter
463 CALL propagation_step(qs_env, rtp, rtp_control)
464 CALL qs_ks_update_qs_env(qs_env, calculate_forces=.false.)
465 rtp%energy_new = energy%total
466 IF (rtp%converged) EXIT
467 CALL rt_prop_output(qs_env, real_time_propagation, rtp%delta_iter)
468 END DO
469 IF (rtp%converged) THEN
470 CALL external_control(should_stop, "MD", globenv=globenv)
471 IF (should_stop) CALL cp_iterate(logger%iter_info, last=.true., iter_nr=i_step)
472 time_iter_stop = m_walltime()
473 used_time = time_iter_stop - time_iter_start
474 time_iter_start = time_iter_stop
475 CALL rt_prop_output(qs_env, real_time_propagation, delta_iter=rtp%delta_iter, used_time=used_time)
476 CALL rt_write_input_restart(force_env=force_env, qs_env=qs_env)
477 IF (modulo(i_step, dft_control%localize_each) == 0) THEN
478 CALL rtp_localize(qs_env, rtp)
479 END IF
480 IF (should_stop) EXIT
481 ELSE
482 EXIT
483 END IF
484 END DO
485 CALL cp_rm_iter_level(logger, "MD")
486
487 IF (.NOT. rtp%converged) THEN
488 CALL cp_abort(__location__, "propagation did not converge, "// &
489 "either increase MAX_ITER or use a smaller TIMESTEP")
490 END IF
491
492 CALL timestop(handle)
493
494 END SUBROUTINE run_propagation
495
496! **************************************************************************************************
497!> \brief overwrites some values in the input file such that the .restart
498!> file will contain the appropriate information
499!> \param md_env ...
500!> \param qs_env ...
501!> \param force_env ...
502!> \author Florian Schiffmann (02.09)
503! **************************************************************************************************
504
505 SUBROUTINE rt_write_input_restart(md_env, qs_env, force_env)
506 TYPE(md_environment_type), OPTIONAL, POINTER :: md_env
507 TYPE(qs_environment_type), OPTIONAL, POINTER :: qs_env
508 TYPE(force_env_type), POINTER :: force_env
509
510 CHARACTER(len=default_path_length) :: file_name
511 REAL(kind=dp), DIMENSION(:), POINTER :: tmp_vals
512 TYPE(cp_logger_type), POINTER :: logger
513 TYPE(dft_control_type), POINTER :: dft_control
514 TYPE(section_vals_type), POINTER :: dft_section, efield_section, &
515 motion_section, print_key, &
516 root_section, rt_section
517
518 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
519 root_section => force_env%root_section
520 motion_section => section_vals_get_subs_vals(root_section, "MOTION")
521 dft_section => section_vals_get_subs_vals(root_section, "FORCE_EVAL%DFT")
522 rt_section => section_vals_get_subs_vals(root_section, "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION")
523
524 CALL section_vals_val_set(rt_section, "INITIAL_WFN", i_val=use_rt_restart)
525 CALL section_vals_val_set(rt_section, "APPLY_DELTA_PULSE", l_val=.false.)
526 CALL section_vals_val_set(rt_section, "APPLY_DELTA_PULSE_MAG", l_val=.false.)
527 CALL section_vals_val_set(rt_section, "APPLY_WFN_MIX_INIT_RESTART", l_val=.false.)
528
529 logger => cp_get_default_logger()
530
531 ! to continue propagating the TD wavefunction we need to read from the new .rtpwfn
532 IF (btest(cp_print_key_should_output(logger%iter_info, &
533 rt_section, "PRINT%RESTART"), cp_p_file)) THEN
534 print_key => section_vals_get_subs_vals(rt_section, "PRINT%RESTART")
535 file_name = cp_print_key_generate_filename(logger, print_key, &
536 extension=".rtpwfn", my_local=.false.)
537 CALL section_vals_val_set(dft_section, "WFN_RESTART_FILE_NAME", c_val=trim(file_name))
538 END IF
539
540 ! coming from RTP
541 IF (.NOT. PRESENT(md_env)) THEN
542 CALL section_vals_val_set(motion_section, "MD%STEP_START_VAL", i_val=force_env%qs_env%sim_step)
543 END IF
544
545 IF (dft_control%apply_vector_potential) THEN
546 efield_section => section_vals_get_subs_vals(root_section, "FORCE_EVAL%DFT%EFIELD")
547 NULLIFY (tmp_vals)
548 ALLOCATE (tmp_vals(3))
549 tmp_vals = dft_control%efield_fields(1)%efield%vec_pot_initial
550 CALL section_vals_val_set(efield_section, "VEC_POT_INITIAL", &
551 r_vals_ptr=tmp_vals, &
552 i_rep_section=1)
553 END IF
554
555 CALL write_restart(md_env=md_env, root_section=root_section)
556
557 END SUBROUTINE rt_write_input_restart
558
559! **************************************************************************************************
560!> \brief Creates the initial electronic states and allocates the necessary
561!> matrices
562!> \param qs_env ...
563!> \param force_env ...
564!> \param rtp_control ...
565!> \author Florian Schiffmann (02.09)
566! **************************************************************************************************
567
568 SUBROUTINE rt_initial_guess(qs_env, force_env, rtp_control)
569 TYPE(qs_environment_type), POINTER :: qs_env
570 TYPE(force_env_type), POINTER :: force_env
571 TYPE(rtp_control_type), POINTER :: rtp_control
572
573 INTEGER :: homo, ispin
574 LOGICAL :: energy_consistency
575 TYPE(cp_fm_type), POINTER :: mo_coeff
576 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
577 TYPE(dft_control_type), POINTER :: dft_control
578
579 NULLIFY (matrix_s, dft_control)
580 CALL get_qs_env(qs_env, dft_control=dft_control)
581 cpassert(ASSOCIATED(qs_env))
582
583 SELECT CASE (rtp_control%initial_wfn)
584 CASE (use_scf_wfn)
585 qs_env%sim_time = 0.0_dp
586 qs_env%sim_step = 0
587 energy_consistency = .true.
588 !in the linear scaling case we need a correct kohn-sham matrix, which we cannot get with consistent energies
589 IF (rtp_control%linear_scaling) energy_consistency = .false.
590 CALL force_env_calc_energy_force(force_env, calc_force=.false., &
591 consistent_energies=energy_consistency)
592 qs_env%run_rtp = .true.
593 ALLOCATE (qs_env%rtp)
594 CALL get_qs_env(qs_env, matrix_s=matrix_s)
595 IF (dft_control%do_admm) THEN
596 CALL hfx_admm_init(qs_env)
597 CALL rt_prop_create(qs_env%rtp, qs_env%mos, qs_env%mpools, dft_control, matrix_s(1)%matrix, &
598 rtp_control%linear_scaling, qs_env%admm_env%mos_aux_fit)
599 ELSE
600 CALL rt_prop_create(qs_env%rtp, qs_env%mos, qs_env%mpools, dft_control, matrix_s(1)%matrix, &
601 rtp_control%linear_scaling)
602 END IF
603
605 CALL qs_energies_init(qs_env, .false.)
606 IF (.NOT. rtp_control%linear_scaling .OR. rtp_control%initial_wfn == use_restart_wfn) THEN
607 DO ispin = 1, SIZE(qs_env%mos)
608 CALL get_mo_set(qs_env%mos(ispin), mo_coeff=mo_coeff, homo=homo)
609 IF (.NOT. ASSOCIATED(mo_coeff)) THEN
610 CALL init_mo_set(qs_env%mos(ispin), &
611 qs_env%mpools%ao_mo_fm_pools(ispin)%pool, &
612 name="qs_env%mo"//trim(adjustl(cp_to_string(ispin))))
613 END IF
614 END DO
615 IF (dft_control%do_admm) CALL hfx_admm_init(qs_env)
616 END IF
617 ALLOCATE (qs_env%rtp)
618 CALL get_qs_env(qs_env, matrix_s=matrix_s)
619 CALL rt_prop_create(qs_env%rtp, qs_env%mos, qs_env%mpools, dft_control, matrix_s(1)%matrix, &
620 rtp_control%linear_scaling, qs_env%admm_env%mos_aux_fit)
621 CALL get_restart_wfn(qs_env)
622 cpassert(ASSOCIATED(qs_env))
623
624 qs_env%run_rtp = .true.
625 END SELECT
626
627 END SUBROUTINE rt_initial_guess
628
629! **************************************************************************************************
630!> \brief ...
631!> \param qs_env ...
632!> \param imag_p ...
633!> \param imag_ks ...
634!> \param imag_h ...
635! **************************************************************************************************
636 SUBROUTINE rt_init_complex_quantities(qs_env, imag_p, imag_ks, imag_h)
637 TYPE(qs_environment_type), POINTER :: qs_env
638 LOGICAL, INTENT(in) :: imag_p, imag_ks, imag_h
639
640 TYPE(dft_control_type), POINTER :: dft_control
641 TYPE(qs_ks_env_type), POINTER :: ks_env
642 TYPE(qs_rho_type), POINTER :: rho
643 TYPE(rt_prop_type), POINTER :: rtp
644
645 NULLIFY (ks_env, rho, dft_control)
646
647 CALL get_qs_env(qs_env, &
648 dft_control=dft_control, &
649 ks_env=ks_env, &
650 rho=rho, &
651 rtp=rtp)
652
653 ! rho
654 CALL qs_rho_set(rho, complex_rho_ao=imag_p)
655 IF (imag_p) CALL allocate_rho_ao_imag_from_real(rho, qs_env)
656
657 ! ks
658 CALL set_ks_env(ks_env, complex_ks=imag_ks)
659 IF (imag_ks) THEN
660 CALL qs_ks_allocate_basics(qs_env, is_complex=imag_ks)
661 IF (.NOT. dft_control%rtp_control%fixed_ions) THEN
662 CALL rtp_create_sinvh_imag(rtp, dft_control%nspins)
663 END IF
664 END IF
665
666 ! h
667 IF (imag_h) CALL qs_matrix_h_allocate_imag_from_real(qs_env)
668
669 END SUBROUTINE rt_init_complex_quantities
670
671! **************************************************************************************************
672!> \brief Allocates and fills the local moment matrices (only available for linear scaling)
673!> \param rtp Real time propagtion properties - local moment matrices are stored there
674!> \param qs_env QS environment necessary for moment matrix calculation
675! **************************************************************************************************
676 SUBROUTINE rt_init_local_moments(rtp, qs_env)
677 TYPE(rt_prop_type), POINTER :: rtp
678 TYPE(qs_environment_type), POINTER :: qs_env
679
680 INTEGER :: k, nspin, output_unit
681 REAL(kind=dp), DIMENSION(3) :: reference_point
682 TYPE(cp_logger_type), POINTER :: logger
683 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s, rho_old
684 TYPE(dft_control_type), POINTER :: dft_control
685 TYPE(rtp_control_type), POINTER :: rtc
686 TYPE(section_vals_type), POINTER :: input, moments_section
687
688 logger => cp_get_default_logger()
689 output_unit = cp_logger_get_default_io_unit(logger)
690
691 CALL get_qs_env(qs_env, dft_control=dft_control, matrix_s=matrix_s, input=input)
692 rtc => dft_control%rtp_control
693 moments_section => section_vals_get_subs_vals(input, &
694 "DFT%REAL_TIME_PROPAGATION%PRINT%MOMENTS")
695
696 ! Construct the local moments matrix - copy from matrix_s structure
697 ! NOTE : construction where blocks are allocated by neighbour lists does not seem to work,
698 ! so doing a copy instead of:
699 ! CALL dbcsr_create(rtp%local_moments(k)%matrix, template=matrix_s(1)%matrix, &
700 ! name="Local moment")
701 ! CALL cp_dbcsr_alloc_block_from_nbl(rtp%local_moments(k)%matrix, sab_all)
702 NULLIFY (rtp%local_moments)
703 ALLOCATE (rtp%local_moments(3))
704 DO k = 1, 3
705 NULLIFY (rtp%local_moments(k)%matrix)
706 ALLOCATE (rtp%local_moments(k)%matrix)
707 CALL dbcsr_create(rtp%local_moments(k)%matrix, template=matrix_s(1)%matrix, name="Local moment")
708 CALL dbcsr_copy(rtp%local_moments(k)%matrix, matrix_s(1)%matrix)
709 CALL dbcsr_set(rtp%local_moments(k)%matrix, 0.0_dp)
710 END DO
711 ! Workspace allocation
712 NULLIFY (rtp%local_moments_work)
713 ALLOCATE (rtp%local_moments_work)
714 CALL dbcsr_create(rtp%local_moments_work, template=rtp%local_moments(1)%matrix, name="tmp")
715 CALL dbcsr_copy(rtp%local_moments_work, rtp%local_moments(1)%matrix)
716
717 CALL get_reference_point(rpoint=reference_point, qs_env=qs_env, &
718 reference=rtc%moment_trace_ref_type, ref_point=rtc%moment_trace_user_ref_point)
719
720 CALL build_local_moment_matrix(qs_env, rtp%local_moments, 1, reference_point)
721
722 ! Allocate the moments trace and output start moments
723 CALL get_rtp(rtp, rho_old=rho_old)
724 nspin = SIZE(rho_old)/2
725 ALLOCATE (rtp%moments(SIZE(rho_old)/2, 3, rtp%nsteps + 1), source=cmplx(0.0, 0.0, kind=dp))
726 NULLIFY (rtp%times)
727 ALLOCATE (rtp%times(rtp%nsteps + 1))
728 NULLIFY (rtp%fields)
729 ALLOCATE (rtp%fields(3, rtp%nsteps + 1), source=cmplx(0.0, 0.0, kind=dp))
730
731 END SUBROUTINE rt_init_local_moments
732
733! **************************************************************************************************
734!> \brief Allocates and fills the local moment matrices (only available for linear scaling)
735!> \param qs_env QS environment necessary for moment matrix calculation
736! **************************************************************************************************
737 SUBROUTINE final_ft_output(qs_env)
738 TYPE(qs_environment_type), POINTER :: qs_env
739
740 INTEGER :: k, unit_nr
741 TYPE(cell_type), POINTER :: cell
742 TYPE(cp_logger_type), POINTER :: logger
743 TYPE(dft_control_type), POINTER :: dft_control
744 TYPE(rt_prop_type), POINTER :: rtp
745 TYPE(section_vals_type), POINTER :: input, rtp_section
746
747 CALL get_qs_env(qs_env, cell=cell, rtp=rtp, input=input, dft_control=dft_control)
748 rtp_section => section_vals_get_subs_vals(input, "DFT%REAL_TIME_PROPAGATION")
749 logger => cp_get_default_logger()
750 unit_nr = cp_logger_get_default_io_unit(logger)
751 CALL print_ft(rtp_section, rtp%moments, rtp%times, rtp%fields, dft_control%rtp_control, &
752 info_opt=unit_nr, cell=cell)
753 ! Deallocating the local moments matrices and array
754 DO k = 1, 3
755 CALL dbcsr_release(rtp%local_moments(k)%matrix)
756 DEALLOCATE (rtp%local_moments(k)%matrix)
757 END DO
758 DEALLOCATE (rtp%local_moments)
759 CALL dbcsr_release(rtp%local_moments_work)
760 DEALLOCATE (rtp%local_moments_work)
761 DEALLOCATE (rtp%moments)
762 DEALLOCATE (rtp%times)
763 DEALLOCATE (rtp%fields)
764 END SUBROUTINE final_ft_output
765
766END MODULE rt_propagation
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public andermatt2016
Handles all functions related to the CELL.
Definition cell_types.F:15
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
Routines to handle the external control of CP2K.
subroutine, public external_control(should_stop, flag, globenv, target_time, start_time, force_check)
External manipulations during a run : when the <PROJECT_NAME>.EXIT_$runtype command is sent the progr...
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
various routines to log and control the output. The idea is that decisions about where to log should ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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...
subroutine, public cp_add_iter_level(logger, level_name, n_rlevel_new)
Adds an iteration 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...
integer, parameter, public cp_p_file
subroutine, public cp_iterate(iteration_info, last, iter_nr, increment, iter_nr_out)
adds one to the actual iteration
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
subroutine, public cp_rm_iter_level(logger, level_name, n_rlevel_att)
Removes an iteration level.
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, file_access)
...
all routins needed for a nonperiodic electric field
subroutine, public efield_potential_lengh_gauge(qs_env, calculate_forces)
Replace the original implementation of the electric-electronic interaction in the length gauge....
subroutine, public calculate_ecore_efield(qs_env, calculate_forces)
Computes the force and the energy due to a efield on the cores Note: In the velocity gauge,...
Interface for the force calculations.
recursive subroutine, public force_env_calc_energy_force(force_env, calc_force, consistent_energies, skip_external_control, eval_energy_forces, require_consistent_energy_force, linres, calc_stress_tensor)
Interface routine for force and energy calculations.
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
Define type storing the global information of a run. Keep the amount of stored data small....
Utilities for hfx and admm methods.
subroutine, public hfx_admm_init(qs_env, calculate_forces, ext_xc_section)
...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_admm_purify_none
integer, parameter, public use_restart_wfn
integer, parameter, public use_scf_wfn
integer, parameter, public do_admm_basis_projection
integer, parameter, public use_rt_restart
integer, parameter, public do_admm_exch_scaling_none
integer, parameter, public real_time_propagation
Set of routines to dump the restart file of CP2K.
subroutine, public write_restart(md_env, force_env, root_section, coords, vels, pint_env, helium_env)
checks if a restart needs to be written and does so, updating all necessary fields in the input file....
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
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
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition machine.F:144
Calculates the moment integrals <a|r^m|b>.
subroutine, public get_reference_point(rpoint, drpoint, qs_env, fist_env, reference, ref_point, ifirst, ilast)
...
container for various plainwaves related things
Calculation of the core Hamiltonian integral matrix <a|H|b> over Cartesian Gaussian-type functions.
subroutine, public qs_matrix_h_allocate_imag_from_real(qs_env)
(Re-)allocates matrix_h_im from matrix_h
Utility subroutine for qs energy calculation.
subroutine, public qs_energies_init(qs_env, calc_forces)
Refactoring of qs_energies_scf. Driver routine for the initial setup and calculations for a qs energy...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Routines to handle an external electrostatic field The external field can be generic and is provided ...
subroutine, public external_c_potential(qs_env, calculate_forces)
Computes the force and the energy due to the external potential on the cores.
subroutine, public external_e_potential(qs_env)
Computes the external potential on the grid.
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public qs_ks_update_qs_env(qs_env, calculate_forces, just_energy, print_active)
updates the Kohn Sham matrix of the given qs_env (facility method)
subroutine, public qs_ks_allocate_basics(qs_env, is_complex)
Allocate ks_matrix if necessary, take current overlap matrix as template.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public qs_ks_did_change(ks_env, s_mstruct_changed, rho_changed, potential_changed, full_reset)
tells that some of the things relevant to the ks calculation did change. has to be called when change...
Definition and initialisation of the mo data type.
Definition qs_mo_io.F:21
subroutine, public wfn_restart_file_name(filename, exist, section, logger, kp, xas, rtp)
...
Definition qs_mo_io.F:460
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public init_mo_set(mo_set, fm_pool, fm_ref, fm_struct, name, counter, complex_coeff)
initializes an allocated mo_set. eigenvalues, mo_coeff, occupation_numbers are valid only after this ...
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count, cmo_coeff)
Get the components of a MO set data structure.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>.
Definition qs_moments.F:14
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type, all_images, minimum_image, neighbor_image, first_component)
...
Definition qs_moments.F:178
methods of the rho structure (defined in qs_rho_types)
subroutine, public allocate_rho_ao_imag_from_real(rho, qs_env)
(Re-)allocates rho_ao_im from real part rho_ao
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_set(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
...
Routines to apply a delta pulse for RTP and EMD.
subroutine, public apply_delta_pulse(qs_env, rtp, rtp_control)
Interface to call the delta pulse depending on the type of calculation.
Utility functions that are needed for RTP/EMD in combination with HF or hybrid functionals (needs to ...
subroutine, public rtp_hfx_rebuild(qs_env)
rebuilds the structures of P and KS (imaginary) in case S changed
Function related to MO projection in RTP calculations.
subroutine, public init_mo_projection(qs_env, rtp_control)
Initialize the mo projection objects for time dependent run.
Routines for propagating the orbitals.
subroutine, public rtp_localize(qs_env, rtp)
Computes Maximally localised Wannier functions and print properties according to FORCE_EVALDFTLOCALIZ...
subroutine, public propagation_step(qs_env, rtp, rtp_control)
performs a single propagation step a(t+Dt)=U(t+Dt,t)*a(0) and calculates the new exponential
Routine for the real time propagation output.
subroutine, public print_ft(rtp_section, moments, times, fields, rtc, info_opt, cell)
Calculate and print the Fourier transforms + polarizabilites from moment trace.
subroutine, public rt_prop_output(qs_env, run_type, delta_iter, used_time)
...
subroutine, public print_moments(moments_section, info_unit, moments, time, imag_opt, append_opt)
Print the dipole moments into a file.
subroutine, public calc_local_moment(moment_matrices, density_matrices, work, moment, imag_opt)
Calculate the values of real/imaginary parts of moments in all directions.
Types and set_get for real time propagation depending on runtype and diagonalization method different...
subroutine, public rt_prop_create(rtp, mos, mpools, dft_control, template, linear_scaling, mos_aux)
...
subroutine, public rtp_create_sinvh_imag(rtp, nspins)
Initialize SinvH_imag for rtp.
subroutine, public rtp_history_create(rtp, aspc_order)
...
subroutine, public get_rtp(rtp, exp_h_old, exp_h_new, h_last_iter, rho_old, rho_next, rho_new, mos, mos_new, mos_old, mos_next, s_inv, s_half, s_minus_half, b_mat, c_mat, propagator_matrix, mixing, mixing_factor, s_der, dt, nsteps, sinvh, sinvh_imag, sinvb, admm_mos)
...
Routines needed for EMD.
subroutine, public calc_update_rho_sparse(qs_env)
Copies the density matrix back into the qs_envrhorho_ao.
subroutine, public recalculate_fields(fields, times, orig_start, i_start, dft_control)
Recalculates the field for index range given by orig_start and i_start, with times taken from the tim...
subroutine, public calc_s_derivs(qs_env)
Calculates dS/dR respectily the velocity weighted derivatves only needed for ehrenfest MD.
subroutine, public read_moments(moments_section, orig_start, current_start, moments, times, mom_read)
Attempt to read the moments from a previously written file.
subroutine, public calc_update_rho(qs_env)
calculates the density from the complex MOs and passes the density to qs_env.
subroutine, public warn_section_unused(section, subsection_name, error_message)
Warn about unused sections of the print section - only implemented for some of the methods.
subroutine, public get_restart_wfn(qs_env)
reads the restart file. At the moment only SCF (means only real)
Routines to perform the RTP in the velocity gauge.
subroutine, public velocity_gauge_ks_matrix(qs_env, subtract_nl_term)
...
Routines for the real time propagation.
subroutine, public rt_prop_setup(force_env)
creates rtp_type, gets the initial state, either by reading MO's from file or calling SCF run
Routines for that prepare rtp and EMD.
subroutine, public init_propagators(qs_env)
prepares the initial matrices for the propagators
subroutine, public rt_initialize_rho_from_mos(rtp, mos, mos_old)
Computes the density matrix from the mos Update: Initialized the density matrix from complex mos (for...
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
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...
wrapper to abstract the force evaluation of the various methods
contains the initially parsed file and the initial parallel environment
contained for different pw related things
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.