Loading [MathJax]/extensions/tex2jax.js
 (git:aabdcc8)
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
rt_propagation_output.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 Routine for the real time propagation output.
10!> \author Florian Schiffmann (02.09)
11! **************************************************************************************************
12
16 USE cp_dbcsr_api, ONLY: &
30 USE cp_fm_types, ONLY: cp_fm_create,&
40 cp_p_file,&
45 USE efield_utils, ONLY: make_field
46 USE input_constants, ONLY: ehrenfest,&
51 USE kahan_sum, ONLY: accurate_sum
52 USE kinds, ONLY: default_path_length,&
53 dp
54 USE machine, ONLY: m_flush
59 USE physcon, ONLY: femtoseconds
60 USE pw_env_types, ONLY: pw_env_get,&
62 USE pw_methods, ONLY: pw_zero
64 USE pw_types, ONLY: pw_c1d_gs_type,&
74 USE qs_rho_types, ONLY: qs_rho_get,&
84 USE rt_propagation_types, ONLY: get_rtp,&
89#include "../base/base_uses.f90"
90
91 IMPLICIT NONE
92
93 PRIVATE
94
95 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'rt_propagation_output'
96
97 PUBLIC :: rt_prop_output, &
101
102CONTAINS
103
104! **************************************************************************************************
105!> \brief ...
106!> \param qs_env ...
107!> \param run_type ...
108!> \param delta_iter ...
109!> \param used_time ...
110! **************************************************************************************************
111 SUBROUTINE rt_prop_output(qs_env, run_type, delta_iter, used_time)
112 TYPE(qs_environment_type), POINTER :: qs_env
113 INTEGER, INTENT(in) :: run_type
114 REAL(dp), INTENT(in), OPTIONAL :: delta_iter, used_time
115
116 INTEGER :: n_electrons, n_proj, nspin, output_unit, &
117 spin
118 REAL(dp) :: orthonormality, tot_rho_r
119 REAL(kind=dp), DIMENSION(:), POINTER :: qs_tot_rho_r
120 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
121 TYPE(cp_fm_type), DIMENSION(:), POINTER :: mos_new
122 TYPE(cp_logger_type), POINTER :: logger
123 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s, p_im, rho_new
124 TYPE(dft_control_type), POINTER :: dft_control
125 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
126 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
127 TYPE(qs_rho_type), POINTER :: rho
128 TYPE(rt_prop_type), POINTER :: rtp
129 TYPE(section_vals_type), POINTER :: dft_section, input, rtp_section
130
131 NULLIFY (logger, dft_control)
132
133 logger => cp_get_default_logger()
134 CALL get_qs_env(qs_env, &
135 rtp=rtp, &
136 matrix_s=matrix_s, &
137 input=input, &
138 rho=rho, &
139 particle_set=particle_set, &
140 atomic_kind_set=atomic_kind_set, &
141 qs_kind_set=qs_kind_set, &
142 dft_control=dft_control)
143
144 rtp_section => section_vals_get_subs_vals(input, "DFT%REAL_TIME_PROPAGATION")
145
146 CALL get_qs_kind_set(qs_kind_set, nelectron=n_electrons)
147 n_electrons = n_electrons - dft_control%charge
148
149 CALL qs_rho_get(rho_struct=rho, tot_rho_r=qs_tot_rho_r)
150
151 tot_rho_r = accurate_sum(qs_tot_rho_r)
152
153 output_unit = cp_print_key_unit_nr(logger, rtp_section, "PRINT%PROGRAM_RUN_INFO", &
154 extension=".scfLog")
155
156 IF (output_unit > 0) THEN
157 WRITE (output_unit, fmt="(/,(T3,A,T40,I5))") &
158 "Information at iteration step:", rtp%iter
159 WRITE (unit=output_unit, fmt="((T3,A,T41,2F20.10))") &
160 "Total electronic density (r-space): ", &
161 tot_rho_r, &
162 tot_rho_r + &
163 REAL(n_electrons, dp)
164 WRITE (unit=output_unit, fmt="((T3,A,T59,F22.14))") &
165 "Total energy:", rtp%energy_new
166 IF (run_type == ehrenfest) &
167 WRITE (unit=output_unit, fmt="((T3,A,T61,F20.14))") &
168 "Energy difference to previous iteration step:", rtp%energy_new - rtp%energy_old
169 IF (run_type == real_time_propagation) &
170 WRITE (unit=output_unit, fmt="((T3,A,T61,F20.14))") &
171 "Energy difference to initial state:", rtp%energy_new - rtp%energy_old
172 IF (PRESENT(delta_iter)) &
173 WRITE (unit=output_unit, fmt="((T3,A,T61,E20.6))") &
174 "Convergence:", delta_iter
175 IF (rtp%converged) THEN
176 IF (run_type == real_time_propagation) &
177 WRITE (unit=output_unit, fmt="((T3,A,T61,F12.2))") &
178 "Time needed for propagation:", used_time
179 WRITE (unit=output_unit, fmt="(/,(T3,A,3X,F16.14))") &
180 "CONVERGENCE REACHED", rtp%energy_new - rtp%energy_old
181 END IF
182 END IF
183
184 IF (rtp%converged) THEN
185 IF (.NOT. rtp%linear_scaling) THEN
186 CALL get_rtp(rtp=rtp, mos_new=mos_new)
187 CALL rt_calculate_orthonormality(orthonormality, &
188 mos_new, matrix_s(1)%matrix)
189 IF (output_unit > 0) &
190 WRITE (output_unit, fmt="(/,(T3,A,T60,F20.10))") &
191 "Max deviation from orthonormalization:", orthonormality
192 END IF
193 END IF
194
195 IF (output_unit > 0) &
196 CALL m_flush(output_unit)
197 CALL cp_print_key_finished_output(output_unit, logger, rtp_section, &
198 "PRINT%PROGRAM_RUN_INFO")
199
200 IF (rtp%converged) THEN
201 dft_section => section_vals_get_subs_vals(input, "DFT")
202 IF (btest(cp_print_key_should_output(logger%iter_info, &
203 dft_section, "REAL_TIME_PROPAGATION%PRINT%FIELD"), cp_p_file)) &
204 CALL print_field_applied(qs_env, dft_section)
205 CALL make_moment(qs_env)
206 IF (btest(cp_print_key_should_output(logger%iter_info, &
207 dft_section, "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS"), cp_p_file)) THEN
208 CALL print_rtp_energy_components(qs_env, dft_section)
209 END IF
210 IF (.NOT. dft_control%qs_control%dftb) THEN
211 CALL write_available_results(qs_env=qs_env, rtp=rtp)
212 END IF
213 IF (rtp%linear_scaling) THEN
214 CALL get_rtp(rtp=rtp, rho_new=rho_new)
215 IF (btest(cp_print_key_should_output(logger%iter_info, &
216 dft_section, "REAL_TIME_PROPAGATION%PRINT%RESTART"), cp_p_file)) THEN
217 CALL write_rt_p_to_restart(rho_new, .false.)
218 END IF
219 IF (btest(cp_print_key_should_output(logger%iter_info, &
220 dft_section, "REAL_TIME_PROPAGATION%PRINT%RESTART_HISTORY"), cp_p_file)) THEN
221 CALL write_rt_p_to_restart(rho_new, .true.)
222 END IF
223 IF (.NOT. dft_control%qs_control%dftb) THEN
224 !Not sure if these things could also work with dftb or not
225 IF (btest(cp_print_key_should_output(logger%iter_info, &
226 dft_section, "REAL_TIME_PROPAGATION%PRINT%CURRENT"), cp_p_file)) THEN
227 DO spin = 1, SIZE(rho_new)/2
228 CALL rt_current(qs_env, rho_new(2*spin)%matrix, dft_section, spin, SIZE(rho_new)/2)
229 END DO
230 END IF
231 END IF
232 ELSE
233 CALL get_rtp(rtp=rtp, mos_new=mos_new)
234 IF (.NOT. dft_control%qs_control%dftb) THEN
235 IF (btest(cp_print_key_should_output(logger%iter_info, &
236 dft_section, "REAL_TIME_PROPAGATION%PRINT%CURRENT"), cp_p_file)) THEN
237 NULLIFY (p_im)
238 nspin = SIZE(mos_new)/2
239 CALL dbcsr_allocate_matrix_set(p_im, nspin)
240 DO spin = 1, nspin
241 CALL dbcsr_init_p(p_im(spin)%matrix)
242 CALL dbcsr_create(p_im(spin)%matrix, template=matrix_s(1)%matrix, matrix_type="N")
243 END DO
244 CALL calculate_p_imaginary(qs_env, rtp, p_im)
245 DO spin = 1, nspin
246 CALL rt_current(qs_env, p_im(spin)%matrix, dft_section, spin, nspin)
247 END DO
249 END IF
250 IF (dft_control%rtp_control%is_proj_mo) THEN
251 DO n_proj = 1, SIZE(dft_control%rtp_control%proj_mo_list)
252 CALL compute_and_write_proj_mo(qs_env, mos_new, &
253 dft_control%rtp_control%proj_mo_list(n_proj)%proj_mo, n_proj)
254 END DO
255 END IF
256 END IF
257 CALL write_rt_mos_to_restart(qs_env%mos, mos_new, particle_set, &
258 dft_section, qs_kind_set)
259 END IF
260 END IF
261
262 rtp%energy_old = rtp%energy_new
263
264 IF (.NOT. rtp%converged .AND. rtp%iter >= dft_control%rtp_control%max_iter) &
265 CALL cp_abort(__location__, "EMD did not converge, either increase MAX_ITER "// &
266 "or use a smaller TIMESTEP")
267
268 END SUBROUTINE rt_prop_output
269
270! **************************************************************************************************
271!> \brief computes the effective orthonormality of a set of mos given an s-matrix
272!> orthonormality is the max deviation from unity of the C^T S C
273!> \param orthonormality ...
274!> \param mos_new ...
275!> \param matrix_s ...
276!> \author Florian Schiffmann (02.09)
277! **************************************************************************************************
278 SUBROUTINE rt_calculate_orthonormality(orthonormality, mos_new, matrix_s)
279 REAL(kind=dp), INTENT(out) :: orthonormality
280 TYPE(cp_fm_type), DIMENSION(:), POINTER :: mos_new
281 TYPE(dbcsr_type), OPTIONAL, POINTER :: matrix_s
282
283 CHARACTER(len=*), PARAMETER :: routinen = 'rt_calculate_orthonormality'
284
285 INTEGER :: handle, i, im, ispin, j, k, n, &
286 ncol_local, nrow_local, nspin, re
287 INTEGER, DIMENSION(:), POINTER :: col_indices, row_indices
288 REAL(kind=dp) :: alpha, max_alpha, max_beta
289 TYPE(cp_fm_struct_type), POINTER :: tmp_fm_struct
290 TYPE(cp_fm_type) :: overlap_re, svec_im, svec_re
291
292 NULLIFY (tmp_fm_struct)
293
294 CALL timeset(routinen, handle)
295
296 nspin = SIZE(mos_new)/2
297 max_alpha = 0.0_dp
298 max_beta = 0.0_dp
299 DO ispin = 1, nspin
300 re = ispin*2 - 1
301 im = ispin*2
302 ! get S*C
303 CALL cp_fm_create(svec_re, mos_new(im)%matrix_struct)
304 CALL cp_fm_create(svec_im, mos_new(im)%matrix_struct)
305 CALL cp_fm_get_info(mos_new(im), &
306 nrow_global=n, ncol_global=k)
307 CALL cp_dbcsr_sm_fm_multiply(matrix_s, mos_new(re), &
308 svec_re, k)
309 CALL cp_dbcsr_sm_fm_multiply(matrix_s, mos_new(im), &
310 svec_im, k)
311
312 ! get C^T (S*C)
313 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=k, ncol_global=k, &
314 para_env=mos_new(re)%matrix_struct%para_env, &
315 context=mos_new(re)%matrix_struct%context)
316 CALL cp_fm_create(overlap_re, tmp_fm_struct)
317
318 CALL cp_fm_struct_release(tmp_fm_struct)
319
320 CALL parallel_gemm('T', 'N', k, k, n, 1.0_dp, mos_new(re), &
321 svec_re, 0.0_dp, overlap_re)
322 CALL parallel_gemm('T', 'N', k, k, n, 1.0_dp, mos_new(im), &
323 svec_im, 1.0_dp, overlap_re)
324
325 CALL cp_fm_release(svec_re)
326 CALL cp_fm_release(svec_im)
327
328 CALL cp_fm_get_info(overlap_re, nrow_local=nrow_local, ncol_local=ncol_local, &
329 row_indices=row_indices, col_indices=col_indices)
330 DO i = 1, nrow_local
331 DO j = 1, ncol_local
332 alpha = overlap_re%local_data(i, j)
333 IF (row_indices(i) .EQ. col_indices(j)) alpha = alpha - 1.0_dp
334 max_alpha = max(max_alpha, abs(alpha))
335 END DO
336 END DO
337 CALL cp_fm_release(overlap_re)
338 END DO
339 CALL mos_new(1)%matrix_struct%para_env%max(max_alpha)
340 CALL mos_new(1)%matrix_struct%para_env%max(max_beta)
341 orthonormality = max_alpha
342
343 CALL timestop(handle)
344
345 END SUBROUTINE rt_calculate_orthonormality
346
347! **************************************************************************************************
348!> \brief computes the convergence criterion for RTP and EMD
349!> \param rtp ...
350!> \param matrix_s Overlap matrix without the derivatives
351!> \param delta_mos ...
352!> \param delta_eps ...
353!> \author Florian Schiffmann (02.09)
354! **************************************************************************************************
355
356 SUBROUTINE rt_convergence(rtp, matrix_s, delta_mos, delta_eps)
357 TYPE(rt_prop_type), POINTER :: rtp
358 TYPE(dbcsr_type), POINTER :: matrix_s
359 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: delta_mos
360 REAL(dp), INTENT(out) :: delta_eps
361
362 CHARACTER(len=*), PARAMETER :: routinen = 'rt_convergence'
363 REAL(kind=dp), PARAMETER :: one = 1.0_dp, zero = 0.0_dp
364
365 INTEGER :: handle, i, icol, im, ispin, j, lcol, &
366 lrow, nao, newdim, nmo, nspin, re
367 LOGICAL :: double_col, double_row
368 REAL(kind=dp) :: alpha, max_alpha
369 TYPE(cp_fm_struct_type), POINTER :: newstruct, newstruct1, tmp_fm_struct
370 TYPE(cp_fm_type) :: work, work1, work2
371 TYPE(cp_fm_type), DIMENSION(:), POINTER :: mos_new
372
373 NULLIFY (tmp_fm_struct)
374
375 CALL timeset(routinen, handle)
376
377 CALL get_rtp(rtp=rtp, mos_new=mos_new)
378
379 nspin = SIZE(delta_mos)/2
380 max_alpha = 0.0_dp
381
382 DO i = 1, SIZE(mos_new)
383 CALL cp_fm_scale_and_add(-one, delta_mos(i), one, mos_new(i))
384 END DO
385
386 DO ispin = 1, nspin
387 re = ispin*2 - 1
388 im = ispin*2
389
390 double_col = .true.
391 double_row = .false.
392 CALL cp_fm_struct_double(newstruct, &
393 delta_mos(re)%matrix_struct, &
394 delta_mos(re)%matrix_struct%context, &
395 double_col, &
396 double_row)
397
398 CALL cp_fm_create(work, matrix_struct=newstruct)
399 CALL cp_fm_create(work1, matrix_struct=newstruct)
400
401 CALL cp_fm_get_info(delta_mos(re), ncol_local=lcol, ncol_global=nmo, &
402 nrow_global=nao)
403 CALL cp_fm_get_info(work, ncol_global=newdim)
404
405 CALL cp_fm_set_all(work, zero, zero)
406
407 DO icol = 1, lcol
408 work%local_data(:, icol) = delta_mos(re)%local_data(:, icol)
409 work%local_data(:, icol + lcol) = delta_mos(im)%local_data(:, icol)
410 END DO
411
412 CALL cp_dbcsr_sm_fm_multiply(matrix_s, work, work1, ncol=newdim)
413
414 CALL cp_fm_release(work)
415
416 CALL cp_fm_struct_create(tmp_fm_struct, nrow_global=nmo, ncol_global=nmo, &
417 para_env=delta_mos(re)%matrix_struct%para_env, &
418 context=delta_mos(re)%matrix_struct%context)
419 CALL cp_fm_struct_double(newstruct1, &
420 tmp_fm_struct, &
421 delta_mos(re)%matrix_struct%context, &
422 double_col, &
423 double_row)
424
425 CALL cp_fm_create(work, matrix_struct=newstruct1)
426 CALL cp_fm_create(work2, matrix_struct=newstruct1)
427
428 CALL parallel_gemm("T", "N", nmo, newdim, nao, one, delta_mos(re), &
429 work1, zero, work)
430
431 CALL parallel_gemm("T", "N", nmo, newdim, nao, one, delta_mos(im), &
432 work1, zero, work2)
433
434 CALL cp_fm_get_info(work, nrow_local=lrow)
435 DO i = 1, lrow
436 DO j = 1, lcol
437 alpha = sqrt((work%local_data(i, j) + work2%local_data(i, j + lcol))**2 + &
438 (work%local_data(i, j + lcol) - work2%local_data(i, j))**2)
439 max_alpha = max(max_alpha, abs(alpha))
440 END DO
441 END DO
442
443 CALL cp_fm_release(work)
444 CALL cp_fm_release(work1)
445 CALL cp_fm_release(work2)
446 CALL cp_fm_struct_release(tmp_fm_struct)
447 CALL cp_fm_struct_release(newstruct)
448 CALL cp_fm_struct_release(newstruct1)
449
450 END DO
451
452 CALL delta_mos(1)%matrix_struct%para_env%max(max_alpha)
453 delta_eps = sqrt(max_alpha)
454
455 CALL timestop(handle)
456
457 END SUBROUTINE rt_convergence
458
459! **************************************************************************************************
460!> \brief computes the convergence criterion for RTP and EMD based on the density matrix
461!> \param rtp ...
462!> \param delta_P ...
463!> \param delta_eps ...
464!> \author Samuel Andermatt (02.14)
465! **************************************************************************************************
466
467 SUBROUTINE rt_convergence_density(rtp, delta_P, delta_eps)
468
469 TYPE(rt_prop_type), POINTER :: rtp
470 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: delta_p
471 REAL(dp), INTENT(out) :: delta_eps
472
473 CHARACTER(len=*), PARAMETER :: routinen = 'rt_convergence_density'
474 REAL(kind=dp), PARAMETER :: one = 1.0_dp, zero = 0.0_dp
475
476 INTEGER :: col_atom, handle, i, ispin, row_atom
477 REAL(dp) :: alpha, max_alpha
478 REAL(dp), DIMENSION(:, :), POINTER :: block_values
479 TYPE(dbcsr_iterator_type) :: iter
480 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_new
481 TYPE(dbcsr_type), POINTER :: tmp
482 TYPE(mp_comm_type) :: group
483
484 CALL timeset(routinen, handle)
485
486 CALL get_rtp(rtp=rtp, rho_new=rho_new)
487
488 DO i = 1, SIZE(rho_new)
489 CALL dbcsr_add(delta_p(i)%matrix, rho_new(i)%matrix, one, -one)
490 END DO
491 !get the maximum value of delta_P
492 DO i = 1, SIZE(delta_p)
493 !square all entries of both matrices
494 CALL dbcsr_iterator_start(iter, delta_p(i)%matrix)
495 DO WHILE (dbcsr_iterator_blocks_left(iter))
496 CALL dbcsr_iterator_next_block(iter, row_atom, col_atom, block_values)
497 block_values = block_values*block_values
498 END DO
499 CALL dbcsr_iterator_stop(iter)
500 END DO
501 NULLIFY (tmp)
502 ALLOCATE (tmp)
503 CALL dbcsr_create(tmp, template=delta_p(1)%matrix, matrix_type="N")
504 DO ispin = 1, SIZE(delta_p)/2
505 CALL dbcsr_desymmetrize(delta_p(2*ispin - 1)%matrix, tmp)
506 CALL dbcsr_add(delta_p(2*ispin)%matrix, tmp, one, one)
507 END DO
508 !the absolute values are now in the even entries of delta_P
509 max_alpha = zero
510 DO ispin = 1, SIZE(delta_p)/2
511 CALL dbcsr_iterator_start(iter, delta_p(2*ispin)%matrix)
512 DO WHILE (dbcsr_iterator_blocks_left(iter))
513 CALL dbcsr_iterator_next_block(iter, row_atom, col_atom, block_values)
514 alpha = maxval(block_values)
515 IF (alpha > max_alpha) max_alpha = alpha
516 END DO
517 CALL dbcsr_iterator_stop(iter)
518 END DO
519 CALL dbcsr_get_info(delta_p(1)%matrix, group=group)
520 CALL group%max(max_alpha)
521 delta_eps = sqrt(max_alpha)
523 CALL timestop(handle)
524
525 END SUBROUTINE rt_convergence_density
526
527! **************************************************************************************************
528!> \brief interface to qs_moments. Does only work for nonperiodic dipole
529!> \param qs_env ...
530!> \author Florian Schiffmann (02.09)
531! **************************************************************************************************
532
533 SUBROUTINE make_moment(qs_env)
534
535 TYPE(qs_environment_type), POINTER :: qs_env
536
537 CHARACTER(len=*), PARAMETER :: routinen = 'make_moment'
538
539 INTEGER :: handle, output_unit
540 TYPE(cp_logger_type), POINTER :: logger
541 TYPE(dft_control_type), POINTER :: dft_control
542
543 CALL timeset(routinen, handle)
544
545 NULLIFY (dft_control)
546
547 logger => cp_get_default_logger()
548 output_unit = cp_logger_get_default_io_unit(logger)
549 CALL get_qs_env(qs_env, dft_control=dft_control)
550 IF (dft_control%qs_control%dftb) THEN
551 CALL scf_post_calculation_tb(qs_env, "DFTB", .false.)
552 ELSE IF (dft_control%qs_control%xtb) THEN
553 CALL scf_post_calculation_tb(qs_env, "xTB", .false.)
554 ELSE
555 CALL qs_scf_post_moments(qs_env%input, logger, qs_env, output_unit)
556 END IF
557 CALL timestop(handle)
558
559 END SUBROUTINE make_moment
560
561! **************************************************************************************************
562!> \brief Reports the sparsity pattern of the complex density matrix
563!> \param filter_eps ...
564!> \param rho ...
565!> \author Samuel Andermatt (09.14)
566! **************************************************************************************************
567
568 SUBROUTINE report_density_occupation(filter_eps, rho)
569
570 REAL(kind=dp) :: filter_eps
571 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho
572
573 CHARACTER(len=*), PARAMETER :: routinen = 'report_density_occupation'
574
575 INTEGER :: handle, i, im, ispin, re, unit_nr
576 REAL(kind=dp) :: eps, occ
577 TYPE(cp_logger_type), POINTER :: logger
578 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: tmp
579
580 CALL timeset(routinen, handle)
581
582 logger => cp_get_default_logger()
583 unit_nr = cp_logger_get_default_io_unit(logger)
584 NULLIFY (tmp)
585 CALL dbcsr_allocate_matrix_set(tmp, SIZE(rho))
586 DO i = 1, SIZE(rho)
587 CALL dbcsr_init_p(tmp(i)%matrix)
588 CALL dbcsr_create(tmp(i)%matrix, template=rho(i)%matrix)
589 CALL dbcsr_copy(tmp(i)%matrix, rho(i)%matrix)
590 END DO
591 DO ispin = 1, SIZE(rho)/2
592 re = 2*ispin - 1
593 im = 2*ispin
594 eps = max(filter_eps, 1.0e-11_dp)
595 DO WHILE (eps < 1.1_dp)
596 CALL dbcsr_filter(tmp(re)%matrix, eps)
597 occ = dbcsr_get_occupation(tmp(re)%matrix)
598 IF (unit_nr > 0) WRITE (unit_nr, fmt="((T3,A,I1,A,F15.12,A,T61,F20.10))") "Occupation of rho spin ", &
599 ispin, " eps ", eps, " real: ", occ
600 eps = eps*10
601 END DO
602 eps = max(filter_eps, 1.0e-11_dp)
603 DO WHILE (eps < 1.1_dp)
604 CALL dbcsr_filter(tmp(im)%matrix, eps)
605 occ = dbcsr_get_occupation(tmp(im)%matrix)
606 IF (unit_nr > 0) WRITE (unit_nr, fmt="((T3,A,I1,A,F15.12,A,T61,F20.10))") "Occupation of rho spin ", &
607 ispin, " eps ", eps, " imag: ", occ
608 eps = eps*10.0_dp
609 END DO
610 END DO
612 CALL timestop(handle)
613
614 END SUBROUTINE report_density_occupation
615
616! **************************************************************************************************
617!> \brief Writes the density matrix and the atomic positions to a restart file
618!> \param rho_new ...
619!> \param history ...
620!> \author Samuel Andermatt (09.14)
621! **************************************************************************************************
622
623 SUBROUTINE write_rt_p_to_restart(rho_new, history)
624
625 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_new
626 LOGICAL :: history
627
628 CHARACTER(LEN=*), PARAMETER :: routinen = 'write_rt_p_to_restart'
629
630 CHARACTER(LEN=default_path_length) :: file_name, project_name
631 INTEGER :: handle, im, ispin, re, unit_nr
632 REAL(kind=dp) :: cs_pos
633 TYPE(cp_logger_type), POINTER :: logger
634
635 CALL timeset(routinen, handle)
636 logger => cp_get_default_logger()
637 IF (logger%para_env%is_source()) THEN
638 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
639 ELSE
640 unit_nr = -1
641 END IF
642
643 project_name = logger%iter_info%project_name
644 DO ispin = 1, SIZE(rho_new)/2
645 re = 2*ispin - 1
646 im = 2*ispin
647 IF (history) THEN
648 WRITE (file_name, '(A,I0,A)') &
649 trim(project_name)//"_LS_DM_SPIN_RE", ispin, "_"//trim(cp_iter_string(logger%iter_info))//"_RESTART.dm"
650 ELSE
651 WRITE (file_name, '(A,I0,A)') trim(project_name)//"_LS_DM_SPIN_RE", ispin, "_RESTART.dm"
652 END IF
653 cs_pos = dbcsr_checksum(rho_new(re)%matrix, pos=.true.)
654 IF (unit_nr > 0) THEN
655 WRITE (unit_nr, '(T2,A,E20.8)') "Writing restart DM "//trim(file_name)//" with checksum: ", cs_pos
656 END IF
657 CALL dbcsr_binary_write(rho_new(re)%matrix, file_name)
658 IF (history) THEN
659 WRITE (file_name, '(A,I0,A)') &
660 trim(project_name)//"_LS_DM_SPIN_IM", ispin, "_"//trim(cp_iter_string(logger%iter_info))//"_RESTART.dm"
661 ELSE
662 WRITE (file_name, '(A,I0,A)') trim(project_name)//"_LS_DM_SPIN_IM", ispin, "_RESTART.dm"
663 END IF
664 cs_pos = dbcsr_checksum(rho_new(im)%matrix, pos=.true.)
665 IF (unit_nr > 0) THEN
666 WRITE (unit_nr, '(T2,A,E20.8)') "Writing restart DM "//trim(file_name)//" with checksum: ", cs_pos
667 END IF
668 CALL dbcsr_binary_write(rho_new(im)%matrix, file_name)
669 END DO
670
671 CALL timestop(handle)
672
673 END SUBROUTINE write_rt_p_to_restart
674
675! **************************************************************************************************
676!> \brief Collocation of the current and printing of it in a cube file
677!> \param qs_env ...
678!> \param P_im ...
679!> \param dft_section ...
680!> \param spin ...
681!> \param nspin ...
682!> \author Samuel Andermatt (06.15)
683! **************************************************************************************************
684 SUBROUTINE rt_current(qs_env, P_im, dft_section, spin, nspin)
685 TYPE(qs_environment_type), POINTER :: qs_env
686 TYPE(dbcsr_type), POINTER :: p_im
687 TYPE(section_vals_type), POINTER :: dft_section
688 INTEGER :: spin, nspin
689
690 CHARACTER(len=*), PARAMETER :: routinen = 'rt_current'
691
692 CHARACTER(len=1) :: char_spin
693 CHARACTER(len=14) :: ext
694 CHARACTER(len=2) :: sdir
695 INTEGER :: dir, handle, print_unit
696 INTEGER, DIMENSION(:), POINTER :: stride(:)
697 LOGICAL :: mpi_io
698 TYPE(cp_logger_type), POINTER :: logger
699 TYPE(current_env_type) :: current_env
700 TYPE(dbcsr_type), POINTER :: tmp, zero
701 TYPE(particle_list_type), POINTER :: particles
702 TYPE(pw_c1d_gs_type) :: gs
703 TYPE(pw_env_type), POINTER :: pw_env
704 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
705 TYPE(pw_r3d_rs_type) :: rs
706 TYPE(qs_subsys_type), POINTER :: subsys
707
708 CALL timeset(routinen, handle)
709
710 logger => cp_get_default_logger()
711 CALL get_qs_env(qs_env=qs_env, subsys=subsys, pw_env=pw_env)
712 CALL qs_subsys_get(subsys, particles=particles)
713 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
714
715 NULLIFY (zero, tmp)
716 ALLOCATE (zero, tmp)
717 CALL dbcsr_create(zero, template=p_im)
718 CALL dbcsr_copy(zero, p_im)
719 CALL dbcsr_set(zero, 0.0_dp)
720 CALL dbcsr_create(tmp, template=p_im)
721 CALL dbcsr_copy(tmp, p_im)
722 IF (nspin == 1) THEN
723 CALL dbcsr_scale(tmp, 0.5_dp)
724 END IF
725 current_env%gauge = -1
726 current_env%gauge_init = .false.
727 CALL auxbas_pw_pool%create_pw(rs)
728 CALL auxbas_pw_pool%create_pw(gs)
729
730 NULLIFY (stride)
731 ALLOCATE (stride(3))
732
733 DO dir = 1, 3
734
735 CALL pw_zero(rs)
736 CALL pw_zero(gs)
737
738 CALL calculate_jrho_resp(zero, tmp, zero, zero, dir, dir, rs, gs, qs_env, current_env, retain_rsgrid=.true.)
739
740 stride = section_get_ivals(dft_section, "REAL_TIME_PROPAGATION%PRINT%CURRENT%STRIDE")
741
742 IF (dir == 1) THEN
743 sdir = "-x"
744 ELSEIF (dir == 2) THEN
745 sdir = "-y"
746 ELSE
747 sdir = "-z"
748 END IF
749 WRITE (char_spin, "(I1)") spin
750
751 ext = "-SPIN-"//char_spin//sdir//".cube"
752 mpi_io = .true.
753 print_unit = cp_print_key_unit_nr(logger, dft_section, "REAL_TIME_PROPAGATION%PRINT%CURRENT", &
754 extension=ext, file_status="REPLACE", file_action="WRITE", &
755 log_filename=.false., mpi_io=mpi_io)
756
757 CALL cp_pw_to_cube(rs, print_unit, "EMD current", particles=particles, stride=stride, &
758 mpi_io=mpi_io)
759
760 CALL cp_print_key_finished_output(print_unit, logger, dft_section, "REAL_TIME_PROPAGATION%PRINT%CURRENT", &
761 mpi_io=mpi_io)
762
763 END DO
764
765 CALL auxbas_pw_pool%give_back_pw(rs)
766 CALL auxbas_pw_pool%give_back_pw(gs)
767
768 CALL dbcsr_deallocate_matrix(zero)
770
771 DEALLOCATE (stride)
772
773 CALL timestop(handle)
774
775 END SUBROUTINE rt_current
776
777! **************************************************************************************************
778!> \brief Interface routine to trigger writing of results available from normal
779!> SCF. Can write MO-dependent and MO free results (needed for call from
780!> the linear scaling code)
781!> Update: trigger also some of prints for time-dependent runs
782!> \param qs_env ...
783!> \param rtp ...
784!> \par History
785!> 2022-11 Update [Guillaume Le Breton]
786! **************************************************************************************************
787 SUBROUTINE write_available_results(qs_env, rtp)
788 TYPE(qs_environment_type), POINTER :: qs_env
789 TYPE(rt_prop_type), POINTER :: rtp
790
791 CHARACTER(len=*), PARAMETER :: routinen = 'write_available_results'
792
793 INTEGER :: handle
794 TYPE(qs_scf_env_type), POINTER :: scf_env
795
796 CALL timeset(routinen, handle)
797
798 CALL get_qs_env(qs_env, scf_env=scf_env)
799 IF (rtp%linear_scaling) THEN
800 CALL write_mo_free_results(qs_env)
801 ELSE
802 CALL write_mo_free_results(qs_env)
803 CALL write_mo_dependent_results(qs_env, scf_env)
804 ! Time-dependent MO print
805 CALL write_rtp_mos_to_output_unit(qs_env, rtp)
806 CALL write_rtp_mo_cubes(qs_env, rtp)
807 END IF
808
809 CALL timestop(handle)
810
811 END SUBROUTINE write_available_results
812
813! **************************************************************************************************
814!> \brief Print the field applied to the system. Either the electric
815!> field or the vector potential depending on the gauge used
816!> \param qs_env ...
817!> \param dft_section ...
818!> \par History
819!> 2023-01 Created [Guillaume Le Breton]
820! **************************************************************************************************
821 SUBROUTINE print_field_applied(qs_env, dft_section)
822 TYPE(qs_environment_type), POINTER :: qs_env
823 TYPE(section_vals_type), POINTER :: dft_section
824
825 CHARACTER(LEN=3), DIMENSION(3) :: rlab
826 CHARACTER(LEN=default_path_length) :: filename
827 INTEGER :: i, i_step, output_unit, unit_nr
828 LOGICAL :: new_file
829 REAL(kind=dp) :: field(3)
830 TYPE(cp_logger_type), POINTER :: logger
831 TYPE(dft_control_type), POINTER :: dft_control
832 TYPE(rt_prop_type), POINTER :: rtp
833
834 NULLIFY (dft_control)
835
836 logger => cp_get_default_logger()
837 output_unit = cp_logger_get_default_io_unit(logger)
838
839 CALL get_qs_env(qs_env, dft_control=dft_control, rtp=rtp)
840
841 i_step = rtp%istep
842
843 unit_nr = cp_print_key_unit_nr(logger, dft_section, &
844 "REAL_TIME_PROPAGATION%PRINT%FIELD", extension=".dat", is_new_file=new_file)
845
846 IF (output_unit > 0) THEN
847 rlab = [CHARACTER(LEN=3) :: "X", "Y", "Z"]
848 IF (unit_nr /= output_unit) THEN
849 INQUIRE (unit=unit_nr, name=filename)
850 WRITE (unit=output_unit, fmt="(/,T2,A,2(/,T3,A),/)") &
851 "FIELD", "The field applied is written to the file:", &
852 trim(filename)
853 ELSE
854 WRITE (unit=output_unit, fmt="(/,T2,A)") "FIELD APPLIED [a.u.]"
855 WRITE (unit=output_unit, fmt="(T5,3(A,A,E16.8,1X))") &
856 (trim(rlab(i)), "=", dft_control%rtp_control%field(i), i=1, 3)
857 END IF
858
859 IF (new_file) THEN
860 IF (dft_control%apply_efield_field) THEN
861 WRITE (unit=unit_nr, fmt='("#",5X,A,8X,A,3(6X,A))') "Step Nr.", "Time[fs]", " Field X", " Field Y", " Field Z"
862 ELSE IF (dft_control%apply_vector_potential) THEN
863 WRITE (unit=unit_nr, fmt='("#",5X,A,8X,A,6(6X,A))') "Step Nr.", "Time[fs]", " Field X", " Field Y", " Field Z", &
864 " Vec. Pot. X", " Vec. Pot. Y", " Vec. Pot. Z"
865 END IF
866 END IF
867
868 field = 0.0_dp
869 IF (dft_control%apply_efield_field) THEN
870 CALL make_field(dft_control, field, qs_env%sim_step, qs_env%sim_time)
871 WRITE (unit=unit_nr, fmt="(I10,F16.6,3(F16.8,1X))") qs_env%sim_step, qs_env%sim_time*femtoseconds, &
872 field(1), field(2), field(3)
873! DO i=1,3
874! IF (ABS(field(i))< 10E-10) field(i) = 0.0_dp
875! END IF
876 ELSE IF (dft_control%apply_vector_potential) THEN
877 WRITE (unit=unit_nr, fmt="(I10,F16.6,6(F16.8,1X))") qs_env%sim_step, qs_env%sim_time*femtoseconds, &
878 dft_control%rtp_control%field(1), dft_control%rtp_control%field(2), dft_control%rtp_control%field(3), &
879 dft_control%rtp_control%vec_pot(1), dft_control%rtp_control%vec_pot(2), dft_control%rtp_control%vec_pot(3)
880 END IF
881
882 END IF
883
884 CALL cp_print_key_finished_output(unit_nr, logger, dft_section, &
885 "REAL_TIME_PROPAGATION%PRINT%FIELD")
886
887 END SUBROUTINE print_field_applied
888
889! **************************************************************************************************
890!> \brief Print the components of the total energy used in an RTP calculation
891!> \param qs_env ...
892!> \param dft_section ...
893!> \par History
894!> 2024-02 Created [ANB]
895! **************************************************************************************************
896 SUBROUTINE print_rtp_energy_components(qs_env, dft_section)
897 TYPE(qs_environment_type), POINTER :: qs_env
898 TYPE(section_vals_type), POINTER :: dft_section
899
900 CHARACTER(LEN=default_path_length) :: filename
901 INTEGER :: i_step, output_unit, unit_nr
902 LOGICAL :: new_file
903 TYPE(cp_logger_type), POINTER :: logger
904 TYPE(dft_control_type), POINTER :: dft_control
905 TYPE(qs_energy_type), POINTER :: energy
906 TYPE(rt_prop_type), POINTER :: rtp
907
908 NULLIFY (dft_control, energy, rtp)
909
910 logger => cp_get_default_logger()
911 output_unit = cp_logger_get_default_io_unit(logger)
912
913 CALL get_qs_env(qs_env, dft_control=dft_control, rtp=rtp, energy=energy)
914 i_step = rtp%istep
915
916 unit_nr = cp_print_key_unit_nr(logger, dft_section, &
917 "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS", extension=".ener", &
918 file_action="WRITE", is_new_file=new_file)
919
920 IF (output_unit > 0) THEN
921 IF (unit_nr /= output_unit) THEN
922 INQUIRE (unit=unit_nr, name=filename)
923 WRITE (unit=output_unit, fmt="(/,T2,A,2(/,T3,A),/)") &
924 "ENERGY_CONSTITUENTS", "Total Energy constituents written to file:", &
925 trim(filename)
926 ELSE
927 WRITE (unit=output_unit, fmt="(/,T2,A)") "ENERGY_CONSTITUENTS"
928 END IF
929
930 IF (new_file) THEN
931 ! NOTE that these are not all terms contributing to the total energy for RTP, only a selection of those
932 ! most significant / impactful. Therefore the printed components likely will not add up to the total energy.
933 WRITE (unit=unit_nr, fmt='("#",5X,A,8X,A,10(6X,A))') "Step Nr.", "Time[fs]", &
934 "Total ener.[a.u.]", "core[a.u.] ", " overlap [a.u.]", "hartree[a.u.]", " exc. [a.u.] ", &
935 " hartree 1c[a.u.]", "exc 1c[a.u.] ", "exc admm[a.u.]", "exc 1c admm[a.u.]", "efield LG"
936
937 END IF
938 WRITE (unit=unit_nr, fmt="(I10,F20.6,10(F20.9))") &
939 qs_env%sim_step, qs_env%sim_time*femtoseconds, &
940 energy%total, energy%core, energy%core_overlap, energy%hartree, energy%exc, &
941 energy%hartree_1c, energy%exc1, energy%exc_aux_fit, energy%exc1_aux_fit, energy%efield_core
942
943 END IF
944
945 CALL cp_print_key_finished_output(unit_nr, logger, dft_section, &
946 "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS")
947
948 END SUBROUTINE print_rtp_energy_components
949
950END MODULE rt_propagation_output
Define the atomic kind types and their sub types.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset)
...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_desymmetrize(matrix_a, matrix_b)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_filter(matrix, eps)
...
subroutine, public dbcsr_binary_write(matrix, filepath)
...
real(kind=dp) function, public dbcsr_get_occupation(matrix)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
real(kind=dp) function, public dbcsr_checksum(matrix, pos)
Calculates the checksum of a DBCSR matrix.
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
basic linear algebra operations for full matrices
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_double(fmstruct, struct, context, col, row)
creates a struct with twice the number of blocks on each core. If matrix A has to be multiplied with ...
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
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
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
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...
character(len=default_string_length) function, public cp_iter_string(iter_info, print_key, for_file)
returns the iteration string, a string that is useful to create unique filenames (once you trim it)
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)
...
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,...
integer, parameter, public cp_p_file
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...
A wrapper around pw_to_cube() which accepts particle_list_type.
subroutine, public cp_pw_to_cube(pw, unit_nr, title, particles, stride, zero_tails, silent, mpi_io)
...
all routins needed for a nonperiodic electric field
subroutine, public make_field(dft_control, field, sim_step, sim_time)
computes the amplitude of the efield within a given envelop
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public ehrenfest
integer, parameter, public real_time_propagation
objects that represent the structure of input sections and the data contained in an input section
integer function, dimension(:), pointer, public section_get_ivals(section_vals, keyword_name)
...
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
sums arrays of real/complex numbers with much reduced round-off as compared to a naive implementation...
Definition kahan_sum.F:29
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
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:130
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
represent a simple array based list of the given type
Define the data structure for the particle information.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public femtoseconds
Definition physcon.F:153
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
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, 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, 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, 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, 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, ecoul_1c, rho0_s_rs, rho0_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)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg)
Get attributes of an atomic kind set.
given the response wavefunctions obtained by the application of the (rxp), p, and ((dk-dl)xp) operato...
subroutine, public calculate_jrho_resp(mat_d0, mat_jp, mat_jp_rii, mat_jp_riii, ib, idir, current_rs, current_gs, qs_env, current_env, soft_valid, retain_rsgrid)
Calculation of the idir component of the response current density in the presence of a constant magne...
Type definitiona for linear response calculations.
Definition and initialisation of the mo data type.
Definition qs_mo_io.F:21
subroutine, public write_rt_mos_to_restart(mo_array, rt_mos, particle_set, dft_section, qs_kind_set)
...
Definition qs_mo_io.F:233
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(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)
returns info about the density described by this object. If some representation is not available an e...
Does all kind of post scf calculations for GPW/GAPW.
subroutine, public write_mo_free_results(qs_env)
Write QS results always available (if switched on through the print_keys) Can be called from ls_scf.
subroutine, public qs_scf_post_moments(input, logger, qs_env, output_unit)
Computes and prints electric moments.
subroutine, public write_mo_dependent_results(qs_env, scf_env)
Write QS results available if MO's are present (if switched on through the print_keys) Writes only MO...
Does all kind of post scf calculations for DFTB.
subroutine, public scf_post_calculation_tb(qs_env, tb_type, no_mos)
collects possible post - scf calculations and prints info / computes properties.
module that contains the definitions of the scf types
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
Function related to MO projection in RTP calculations.
subroutine, public compute_and_write_proj_mo(qs_env, mos_new, proj_mo, n_proj)
Compute the projection of the current MO coefficients on reference ones and write the results.
Routine for the real time propagation output.
subroutine, public report_density_occupation(filter_eps, rho)
Reports the sparsity pattern of the complex density matrix.
subroutine, public rt_prop_output(qs_env, run_type, delta_iter, used_time)
...
subroutine, public rt_convergence(rtp, matrix_s, delta_mos, delta_eps)
computes the convergence criterion for RTP and EMD
subroutine, public rt_convergence_density(rtp, delta_p, delta_eps)
computes the convergence criterion for RTP and EMD based on the density matrix
Types and set_get for real time propagation depending on runtype and diagonalization method different...
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 write_rtp_mos_to_output_unit(qs_env, rtp)
...
subroutine, public write_rtp_mo_cubes(qs_env, rtp)
Write the time dependent amplitude of the MOs in real grid. Very close to qs_scf_post_gpw/qs_scf_post...
subroutine, public calculate_p_imaginary(qs_env, rtp, matrix_p_im, keep_sparsity)
...
Provides all information about an atomic kind.
keeps the information about the structure of a 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...
contained for different pw related things
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.