24 dbcsr_type_antisymmetric, dbcsr_type_no_symmetry, dbcsr_type_symmetric
105#include "../base/base_uses.f90"
111 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rt_propagation_output'
137 INTEGER,
INTENT(in) :: run_type
138 REAL(
dp),
INTENT(in),
OPTIONAL :: delta_iter, used_time
140 INTEGER :: i, n_electrons, n_proj, natom, nspin, &
141 output_unit, spin, unit_nr
142 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: first_sgf, last_sgf
143 INTEGER,
DIMENSION(2) :: nelectron_spin
144 INTEGER,
DIMENSION(:),
POINTER :: row_blk_sizes
146 REAL(
dp) :: orthonormality, strace, tot_rho_r, trace
147 REAL(kind=
dp),
DIMENSION(3) :: field, reference_point, vec_pot
148 REAL(kind=
dp),
DIMENSION(:),
POINTER :: qs_tot_rho_r
149 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: j_int
152 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: mos_new
155 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_cim, matrix_cre, matrix_s, p_im, &
160 POINTER :: sab_all, sab_orb, sap_ppnl
162 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
167 NULLIFY (logger, dft_control)
175 particle_set=particle_set, &
176 atomic_kind_set=atomic_kind_set, &
177 qs_kind_set=qs_kind_set, &
178 dft_control=dft_control, sab_all=sab_all, sab_orb=sab_orb, &
179 sap_ppnl=sap_ppnl, cell=cell, &
180 dbcsr_dist=dbcsr_dist, nelectron_spin=nelectron_spin)
185 n_electrons = n_electrons - dft_control%charge
187 CALL qs_rho_get(rho_struct=rho, tot_rho_r=qs_tot_rho_r)
194 IF (output_unit > 0)
THEN
195 WRITE (output_unit, fmt=
"(/,(T3,A,T40,I5))") &
196 "Information at iteration step:", rtp%iter
197 WRITE (unit=output_unit, fmt=
"((T3,A,T41,2F20.10))") &
198 "Total electronic density (r-space): ", &
201 REAL(n_electrons,
dp)
202 WRITE (unit=output_unit, fmt=
"((T3,A,T59,F22.14))") &
203 "Total energy:", rtp%energy_new
205 WRITE (unit=output_unit, fmt=
"((T3,A,T61,F20.14))") &
206 "Energy difference to previous iteration step:", rtp%energy_new - rtp%energy_old
209 WRITE (unit=output_unit, fmt=
"((T3,A,T61,F20.14))") &
210 "Energy difference to initial state:", rtp%energy_new - rtp%energy_old
212 IF (
PRESENT(delta_iter))
THEN
213 WRITE (unit=output_unit, fmt=
"((T3,A,T61,E20.6))") &
214 "Convergence:", delta_iter
216 IF (rtp%converged)
THEN
218 WRITE (unit=output_unit, fmt=
"((T3,A,T61,F12.2))") &
219 "Time needed for propagation:", used_time
221 WRITE (unit=output_unit, fmt=
"(/,(T3,A,3X,F16.14))") &
222 "CONVERGENCE REACHED", rtp%energy_new - rtp%energy_old
226 IF (rtp%converged)
THEN
227 IF (.NOT. rtp%linear_scaling)
THEN
228 CALL get_rtp(rtp=rtp, mos_new=mos_new)
229 CALL rt_calculate_orthonormality(orthonormality, &
230 mos_new, matrix_s(1)%matrix)
231 IF (output_unit > 0)
THEN
232 WRITE (output_unit, fmt=
"(/,(T3,A,T60,F20.10))") &
233 "Max deviation from orthonormalization:", orthonormality
238 IF (output_unit > 0)
THEN
242 "PRINT%PROGRAM_RUN_INFO")
244 IF (rtp%converged)
THEN
247 dft_section,
"REAL_TIME_PROPAGATION%PRINT%FIELD"),
cp_p_file))
THEN
248 CALL print_field_applied(qs_env, dft_section)
250 CALL make_moment(qs_env)
252 dft_section,
"REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS"),
cp_p_file))
THEN
253 CALL print_rtp_energy_components(qs_env, dft_section)
255 IF (.NOT. dft_control%qs_control%dftb)
THEN
256 CALL write_available_results(qs_env=qs_env, rtp=rtp)
259 IF (rtp%linear_scaling)
THEN
260 CALL get_rtp(rtp=rtp, rho_new=rho_new)
263 IF (dft_control%rtp_control%save_local_moments)
THEN
265 IF (dft_control%apply_efield_field)
THEN
266 CALL make_field(dft_control, field, qs_env%sim_step, qs_env%sim_time)
267 rtp%fields(:, rtp%istep + rtp%i_start + 1) = cmplx(field(:), 0.0, kind=
dp)
269 IF (.NOT. dft_control%rtp_control%fixed_ions)
THEN
276 rtp%local_moments_work, rtp%moments(:, :, rtp%istep + rtp%i_start + 1))
278 rtp%times(rtp%istep + rtp%i_start + 1) = qs_env%sim_time
281 rtp%moments(:, :, rtp%istep + rtp%i_start + 1), qs_env%sim_time, rtp%track_imag_density)
285 dft_section,
"REAL_TIME_PROPAGATION%PRINT%RESTART"),
cp_p_file))
THEN
286 CALL write_rt_p_to_restart(rho_new, .false.)
289 dft_section,
"REAL_TIME_PROPAGATION%PRINT%RESTART_HISTORY"),
cp_p_file))
THEN
290 CALL write_rt_p_to_restart(rho_new, .true.)
292 IF (.NOT. dft_control%qs_control%dftb)
THEN
295 dft_section,
"REAL_TIME_PROPAGATION%PRINT%CURRENT"),
cp_p_file))
THEN
296 DO spin = 1,
SIZE(rho_new)/2
297 CALL rt_current(qs_env, rho_new(2*spin)%matrix, dft_section, spin,
SIZE(rho_new)/2)
302 CALL get_rtp(rtp=rtp, mos_new=mos_new)
303 IF (.NOT. dft_control%qs_control%dftb .AND. .NOT. dft_control%qs_control%xtb)
THEN
304 IF (rtp%track_imag_density)
THEN
305 NULLIFY (p_im, p_xyz)
310 natom =
SIZE(particle_set, 1)
311 ALLOCATE (first_sgf(natom))
312 ALLOCATE (last_sgf(natom))
314 first_sgf=first_sgf, &
316 ALLOCATE (row_blk_sizes(natom))
317 CALL dbcsr_convert_offsets_to_sizes(first_sgf, row_blk_sizes, last_sgf)
318 DEALLOCATE (first_sgf)
319 DEALLOCATE (last_sgf)
321 ALLOCATE (p_xyz(1)%matrix)
324 dist=dbcsr_dist, matrix_type=dbcsr_type_antisymmetric, &
325 row_blk_size=row_blk_sizes, col_blk_size=row_blk_sizes, &
330 ALLOCATE (p_xyz(i)%matrix)
335 DEALLOCATE (row_blk_sizes)
337 nspin =
SIZE(mos_new)/2
339 ALLOCATE (j_int(nspin, 3))
344 CALL dbcsr_create(tmp_ao, template=matrix_s(1)%matrix, matrix_type=dbcsr_type_no_symmetry, name=
"tmp")
352 CALL dbcsr_multiply(
"T",
"N", 1.0_dp, p_im(spin)%matrix, p_xyz(i)%matrix, &
355 strace = strace + trace
357 j_int(spin, i) = -trace + dft_control%rtp_control%vec_pot(i)*nelectron_spin(spin)
366 IF (
ASSOCIATED(sap_ppnl))
THEN
370 IF (dft_control%rtp_control%velocity_gauge .AND. &
371 dft_control%rtp_control%nl_gauge_transform)
THEN
372 vec_pot = dft_control%rtp_control%vec_pot
375 NULLIFY (matrix_cre, matrix_cim)
380 CALL dbcsr_create(matrix_cre(i)%matrix, template=matrix_s(1)%matrix, &
381 matrix_type=dbcsr_type_antisymmetric, &
382 name=
"nl commutator real part")
384 CALL dbcsr_set(matrix_cre(i)%matrix, 0.0_dp)
386 CALL dbcsr_create(matrix_cim(i)%matrix, template=matrix_s(1)%matrix, &
387 matrix_type=dbcsr_type_symmetric, &
388 name=
"nl commutator imaginary part")
390 CALL dbcsr_set(matrix_cim(i)%matrix, 0.0_dp)
399 CALL dbcsr_multiply(
"T",
"N", 1.0_dp, p_re(spin)%matrix, matrix_cim(i)%matrix, &
402 j_int(spin, i) = j_int(spin, i) - trace
404 CALL dbcsr_multiply(
"T",
"N", 1.0_dp, p_im(spin)%matrix, matrix_cre(i)%matrix, &
407 j_int(spin, i) = j_int(spin, i) - trace
416 dft_section,
"REAL_TIME_PROPAGATION%PRINT%CURRENT_INT"),
cp_p_file))
THEN
420 "REAL_TIME_PROPAGATION%PRINT%CURRENT_INT", extension=
".dat", is_new_file=new_file)
422 IF (output_unit > 0)
THEN
423 WRITE (unit=output_unit, fmt=
"(T2,A,E24.16)") &
424 "RTP_CURRENT| CheckSum j_int=", sqrt(sum(j_int**2))
427 WRITE (unit=unit_nr, fmt=
'("#",5X,A,4X,A,2X,A,2(10X,A),4X,A,2(10X,A))') &
428 "Step Nr.",
"Time[fs]",
"ALPHA jint[X]",
"jint[Y]",
"jint[Z]", &
429 "BETA jint[X]",
"jint[Y]",
"jint[Z]"
431 WRITE (unit=unit_nr, fmt=
'("#",5X,A,4X,A,8X,A,2(10X,A))')
"Step Nr.",
"Time[fs]", &
432 "jint[X]",
"jint[Y]",
"jint[Z]"
437 WRITE (unit=unit_nr, fmt=
"(I10,F16.6,6(F16.8,1X))") qs_env%sim_step, qs_env%sim_time*
femtoseconds, &
438 j_int(1, 1:3), j_int(2, 1:3)
440 WRITE (unit=unit_nr, fmt=
"(I10,F16.6,3(F16.8,1X))") qs_env%sim_step, qs_env%sim_time*
femtoseconds, &
445 "REAL_TIME_PROPAGATION%PRINT%CURRENT_INT")
450 dft_section,
"REAL_TIME_PROPAGATION%PRINT%CURRENT"),
cp_p_file))
THEN
452 CALL rt_current(qs_env, p_im(spin)%matrix, dft_section, spin, nspin)
460 IF (dft_control%rtp_control%is_proj_mo)
THEN
461 DO n_proj = 1,
SIZE(dft_control%rtp_control%proj_mo_list)
463 dft_control%rtp_control%proj_mo_list(n_proj)%proj_mo, n_proj)
468 dft_section, qs_kind_set)
472 rtp%energy_old = rtp%energy_new
474 IF (.NOT. rtp%converged .AND. rtp%iter >= dft_control%rtp_control%max_iter)
THEN
475 CALL cp_abort(__location__,
"EMD did not converge, either increase MAX_ITER "// &
476 "or use a smaller TIMESTEP")
489 SUBROUTINE rt_calculate_orthonormality(orthonormality, mos_new, matrix_s)
490 REAL(kind=
dp),
INTENT(out) :: orthonormality
491 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: mos_new
492 TYPE(
dbcsr_type),
OPTIONAL,
POINTER :: matrix_s
494 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_calculate_orthonormality'
496 INTEGER :: handle, i, im, ispin, j, k, n, &
497 ncol_local, nrow_local, nspin, re
498 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
499 REAL(kind=
dp) :: alpha, max_alpha, max_beta
501 TYPE(
cp_fm_type) :: overlap_re, svec_im, svec_re
503 NULLIFY (tmp_fm_struct)
505 CALL timeset(routinen, handle)
507 nspin =
SIZE(mos_new)/2
517 nrow_global=n, ncol_global=k)
525 para_env=mos_new(re)%matrix_struct%para_env, &
526 context=mos_new(re)%matrix_struct%context)
532 svec_re, 0.0_dp, overlap_re)
534 svec_im, 1.0_dp, overlap_re)
539 CALL cp_fm_get_info(overlap_re, nrow_local=nrow_local, ncol_local=ncol_local, &
540 row_indices=row_indices, col_indices=col_indices)
543 alpha = overlap_re%local_data(i, j)
544 IF (row_indices(i) == col_indices(j)) alpha = alpha - 1.0_dp
545 max_alpha = max(max_alpha, abs(alpha))
550 CALL mos_new(1)%matrix_struct%para_env%max(max_alpha)
551 CALL mos_new(1)%matrix_struct%para_env%max(max_beta)
552 orthonormality = max_alpha
554 CALL timestop(handle)
556 END SUBROUTINE rt_calculate_orthonormality
570 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: delta_mos
571 REAL(
dp),
INTENT(out) :: delta_eps
573 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_convergence'
574 REAL(kind=
dp),
PARAMETER ::
one = 1.0_dp,
zero = 0.0_dp
576 INTEGER :: handle, i, icol, im, ispin, j, lcol, &
577 lrow, nao, newdim, nmo, nspin, re
578 LOGICAL :: double_col, double_row
579 REAL(kind=
dp) :: alpha, max_alpha
582 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: mos_new
584 NULLIFY (tmp_fm_struct)
586 CALL timeset(routinen, handle)
588 CALL get_rtp(rtp=rtp, mos_new=mos_new)
590 nspin =
SIZE(delta_mos)/2
593 DO i = 1,
SIZE(mos_new)
604 delta_mos(re)%matrix_struct, &
605 delta_mos(re)%matrix_struct%context, &
612 CALL cp_fm_get_info(delta_mos(re), ncol_local=lcol, ncol_global=nmo, &
619 work%local_data(:, icol) = delta_mos(re)%local_data(:, icol)
620 work%local_data(:, icol + lcol) = delta_mos(im)%local_data(:, icol)
628 para_env=delta_mos(re)%matrix_struct%para_env, &
629 context=delta_mos(re)%matrix_struct%context)
632 delta_mos(re)%matrix_struct%context, &
648 alpha = sqrt((work%local_data(i, j) + work2%local_data(i, j + lcol))**2 + &
649 (work%local_data(i, j + lcol) - work2%local_data(i, j))**2)
650 max_alpha = max(max_alpha, abs(alpha))
663 CALL delta_mos(1)%matrix_struct%para_env%max(max_alpha)
664 delta_eps = sqrt(max_alpha)
666 CALL timestop(handle)
682 REAL(
dp),
INTENT(out) :: delta_eps
684 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_convergence_density'
685 REAL(kind=
dp),
PARAMETER ::
one = 1.0_dp,
zero = 0.0_dp
687 INTEGER :: col_atom, handle, i, ispin, row_atom
688 REAL(
dp) :: alpha, max_alpha
689 REAL(
dp),
DIMENSION(:, :),
POINTER :: block_values
695 CALL timeset(routinen, handle)
697 CALL get_rtp(rtp=rtp, rho_new=rho_new)
699 DO i = 1,
SIZE(rho_new)
703 DO i = 1,
SIZE(delta_p)
708 block_values = block_values*block_values
714 CALL dbcsr_create(tmp, template=delta_p(1)%matrix, matrix_type=
"N")
715 DO ispin = 1,
SIZE(delta_p)/2
721 DO ispin = 1,
SIZE(delta_p)/2
725 alpha = maxval(block_values)
726 IF (alpha > max_alpha) max_alpha = alpha
731 CALL group%max(max_alpha)
732 delta_eps = sqrt(max_alpha)
734 CALL timestop(handle)
744 SUBROUTINE make_moment(qs_env)
748 CHARACTER(len=*),
PARAMETER :: routinen =
'make_moment'
750 INTEGER :: handle, output_unit
754 CALL timeset(routinen, handle)
756 NULLIFY (dft_control)
760 CALL get_qs_env(qs_env, dft_control=dft_control)
761 IF (dft_control%qs_control%dftb)
THEN
763 ELSE IF (dft_control%qs_control%xtb)
THEN
768 CALL timestop(handle)
770 END SUBROUTINE make_moment
781 REAL(kind=
dp) :: filter_eps
784 CHARACTER(len=*),
PARAMETER :: routinen =
'report_density_occupation'
786 INTEGER :: handle, i, im, ispin, re, unit_nr
787 REAL(kind=
dp) :: eps, occ
791 CALL timeset(routinen, handle)
799 CALL dbcsr_create(tmp(i)%matrix, template=rho(i)%matrix)
802 DO ispin = 1,
SIZE(rho)/2
805 eps = max(filter_eps, 1.0e-11_dp)
806 DO WHILE (eps < 1.1_dp)
809 IF (unit_nr > 0)
WRITE (unit_nr, fmt=
"((T3,A,I1,A,F15.12,A,T61,F20.10))")
"Occupation of rho spin ", &
810 ispin,
" eps ", eps,
" real: ", occ
813 eps = max(filter_eps, 1.0e-11_dp)
814 DO WHILE (eps < 1.1_dp)
817 IF (unit_nr > 0)
WRITE (unit_nr, fmt=
"((T3,A,I1,A,F15.12,A,T61,F20.10))")
"Occupation of rho spin ", &
818 ispin,
" eps ", eps,
" imag: ", occ
823 CALL timestop(handle)
834 SUBROUTINE write_rt_p_to_restart(rho_new, history)
839 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_rt_p_to_restart'
841 CHARACTER(LEN=default_path_length) :: file_name, project_name
842 INTEGER :: handle, im, ispin, re, unit_nr
843 REAL(kind=
dp) :: cs_pos
846 CALL timeset(routinen, handle)
848 IF (logger%para_env%is_source())
THEN
854 project_name = logger%iter_info%project_name
855 DO ispin = 1,
SIZE(rho_new)/2
859 WRITE (file_name,
'(A,I0,A)') &
860 trim(project_name)//
"_LS_DM_SPIN_RE", ispin,
"_"//trim(
cp_iter_string(logger%iter_info))//
"_RESTART.dm"
862 WRITE (file_name,
'(A,I0,A)') trim(project_name)//
"_LS_DM_SPIN_RE", ispin,
"_RESTART.dm"
865 IF (unit_nr > 0)
THEN
866 WRITE (unit_nr,
'(T2,A,E20.8)')
"Writing restart DM "//trim(file_name)//
" with checksum: ", cs_pos
870 WRITE (file_name,
'(A,I0,A)') &
871 trim(project_name)//
"_LS_DM_SPIN_IM", ispin,
"_"//trim(
cp_iter_string(logger%iter_info))//
"_RESTART.dm"
873 WRITE (file_name,
'(A,I0,A)') trim(project_name)//
"_LS_DM_SPIN_IM", ispin,
"_RESTART.dm"
876 IF (unit_nr > 0)
THEN
877 WRITE (unit_nr,
'(T2,A,E20.8)')
"Writing restart DM "//trim(file_name)//
" with checksum: ", cs_pos
882 CALL timestop(handle)
884 END SUBROUTINE write_rt_p_to_restart
895 SUBROUTINE rt_current(qs_env, P_im, dft_section, spin, nspin)
899 INTEGER :: spin, nspin
901 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_current'
903 CHARACTER(len=1) :: char_spin
904 CHARACTER(len=14) :: ext
905 CHARACTER(len=2) :: sdir
906 INTEGER :: dir, handle, print_unit
907 INTEGER,
DIMENSION(:),
POINTER :: stride
919 CALL timeset(routinen, handle)
922 CALL get_qs_env(qs_env=qs_env, subsys=subsys, pw_env=pw_env)
924 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
936 current_env%gauge = -1
937 current_env%gauge_init = .false.
938 CALL auxbas_pw_pool%create_pw(rs)
939 CALL auxbas_pw_pool%create_pw(gs)
949 CALL calculate_jrho_resp(
zero, tmp,
zero,
zero, dir, dir, rs, gs, qs_env, current_env, retain_rsgrid=.true.)
951 stride =
section_get_ivals(dft_section,
"REAL_TIME_PROPAGATION%PRINT%CURRENT%STRIDE")
955 ELSE IF (dir == 2)
THEN
960 WRITE (char_spin,
"(I1)") spin
962 ext =
"-SPIN-"//char_spin//sdir//
".cube"
965 extension=ext, file_status=
"REPLACE", file_action=
"WRITE", &
966 log_filename=.false., mpi_io=mpi_io)
968 CALL cp_pw_to_cube(rs, print_unit,
"EMD current", particles=particles, stride=stride, &
976 CALL auxbas_pw_pool%give_back_pw(rs)
977 CALL auxbas_pw_pool%give_back_pw(gs)
984 CALL timestop(handle)
986 END SUBROUTINE rt_current
998 SUBROUTINE write_available_results(qs_env, rtp)
1002 CHARACTER(len=*),
PARAMETER :: routinen =
'write_available_results'
1007 CALL timeset(routinen, handle)
1010 IF (rtp%linear_scaling)
THEN
1020 CALL timestop(handle)
1022 END SUBROUTINE write_available_results
1032 SUBROUTINE print_field_applied(qs_env, dft_section)
1036 CHARACTER(LEN=3),
DIMENSION(3) :: rlab
1037 CHARACTER(LEN=default_path_length) :: filename
1038 INTEGER :: i, i_step, output_unit, unit_nr
1040 REAL(kind=
dp) :: field(3)
1045 NULLIFY (dft_control)
1050 CALL get_qs_env(qs_env, dft_control=dft_control, rtp=rtp)
1055 "REAL_TIME_PROPAGATION%PRINT%FIELD", extension=
".dat", is_new_file=new_file)
1057 IF (output_unit > 0)
THEN
1058 rlab = [
CHARACTER(LEN=3) ::
"X",
"Y",
"Z"]
1059 IF (unit_nr /= output_unit)
THEN
1060 INQUIRE (unit=unit_nr, name=filename)
1061 WRITE (unit=output_unit, fmt=
"(/,T2,A,2(/,T3,A),/)") &
1062 "FIELD",
"The field applied is written to the file:", &
1065 WRITE (unit=output_unit, fmt=
"(/,T2,A)")
"FIELD APPLIED [a.u.]"
1066 WRITE (unit=output_unit, fmt=
"(T5,3(A,A,E16.8,1X))") &
1067 (trim(rlab(i)),
"=", dft_control%rtp_control%field(i), i=1, 3)
1071 IF (dft_control%apply_efield_field)
THEN
1072 WRITE (unit=unit_nr, fmt=
'("#",5X,A,8X,A,3(6X,A))')
"Step Nr.",
"Time[fs]",
" Field X",
" Field Y",
" Field Z"
1073 ELSE IF (dft_control%apply_vector_potential)
THEN
1074 WRITE (unit=unit_nr, fmt=
'("#",5X,A,8X,A,6(6X,A))')
"Step Nr.",
"Time[fs]",
" Field X",
" Field Y",
" Field Z", &
1075 " Vec. Pot. X",
" Vec. Pot. Y",
" Vec. Pot. Z"
1080 IF (dft_control%apply_efield_field)
THEN
1081 CALL make_field(dft_control, field, qs_env%sim_step, qs_env%sim_time)
1082 WRITE (unit=unit_nr, fmt=
"(I10,F16.6,3(F16.8,1X))") qs_env%sim_step, qs_env%sim_time*
femtoseconds, &
1083 field(1), field(2), field(3)
1087 ELSE IF (dft_control%apply_vector_potential)
THEN
1088 WRITE (unit=unit_nr, fmt=
"(I10,F16.6,6(F16.8,1X))") qs_env%sim_step, qs_env%sim_time*
femtoseconds, &
1089 dft_control%rtp_control%field(1), dft_control%rtp_control%field(2), dft_control%rtp_control%field(3), &
1090 dft_control%rtp_control%vec_pot(1), dft_control%rtp_control%vec_pot(2), dft_control%rtp_control%vec_pot(3)
1096 "REAL_TIME_PROPAGATION%PRINT%FIELD")
1098 END SUBROUTINE print_field_applied
1107 SUBROUTINE print_rtp_energy_components(qs_env, dft_section)
1111 CHARACTER(LEN=default_path_length) :: filename
1112 INTEGER :: i_step, output_unit, unit_nr
1119 NULLIFY (dft_control, energy, rtp)
1124 CALL get_qs_env(qs_env, dft_control=dft_control, rtp=rtp, energy=energy)
1128 "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS", extension=
".ener", &
1129 file_action=
"WRITE", is_new_file=new_file)
1131 IF (output_unit > 0)
THEN
1132 IF (unit_nr /= output_unit)
THEN
1133 INQUIRE (unit=unit_nr, name=filename)
1134 WRITE (unit=output_unit, fmt=
"(/,T2,A,2(/,T3,A),/)") &
1135 "ENERGY_CONSTITUENTS",
"Total Energy constituents written to file:", &
1138 WRITE (unit=output_unit, fmt=
"(/,T2,A)")
"ENERGY_CONSTITUENTS"
1144 WRITE (unit=unit_nr, fmt=
'("#",5X,A,8X,A,10(6X,A))')
"Step Nr.",
"Time[fs]", &
1145 "Total ener.[a.u.]",
"core[a.u.] ",
" overlap [a.u.]",
"hartree[a.u.]",
" exc. [a.u.] ", &
1146 " hartree 1c[a.u.]",
"exc 1c[a.u.] ",
"exc admm[a.u.]",
"exc 1c admm[a.u.]",
"efield LG"
1149 WRITE (unit=unit_nr, fmt=
"(I10,F20.6,10(F20.9))") &
1151 energy%total, energy%core, energy%core_overlap, energy%hartree, energy%exc, &
1152 energy%hartree_1c, energy%exc1, energy%exc_aux_fit, energy%exc1_aux_fit, energy%efield_core
1157 "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS")
1159 END SUBROUTINE print_rtp_energy_components
1172 SUBROUTINE print_moments(moments_section, info_unit, moments, time, imag_opt, append_opt)
1174 INTEGER :: info_unit
1175 COMPLEX(kind=dp),
DIMENSION(:, :) :: moments
1176 REAL(kind=
dp),
OPTIONAL :: time
1177 LOGICAL,
OPTIONAL :: imag_opt, append_opt
1179 CHARACTER(len=14),
DIMENSION(4) :: file_extensions
1180 CHARACTER(len=21) :: prefix
1181 COMPLEX(kind=dp),
DIMENSION(3, 1) :: moment_t
1182 INTEGER :: i, ndir, nspin, print_unit
1183 LOGICAL :: append, imaginary
1188 nspin =
SIZE(moments, 1)
1189 ndir =
SIZE(moments, 2)
1191 IF (nspin < 1) cpabort(
"Zero spin index size in print moments!")
1192 IF (ndir < 1) cpabort(
"Zero direction index size in print moments!")
1195 IF (
PRESENT(imag_opt)) imaginary = imag_opt
1198 IF (
PRESENT(append_opt)) append = append_opt
1203 file_extensions(1) =
"_SPIN_A_RE.dat"
1204 file_extensions(2) =
"_SPIN_A_IM.dat"
1205 file_extensions(3) =
"_SPIN_B_RE.dat"
1206 file_extensions(4) =
"_SPIN_B_IM.dat"
1209 moment_t(:, 1) = moments(i, :)
1212 IF (print_unit == info_unit)
THEN
1214 prefix =
" MOMENTS_TRACE_RE|"
1217 CALL print_rt_file(print_unit, xvals=[time], yvals=moment_t, &
1218 prefix=prefix, prefix_format=
"(A18)", &
1223 headers=[
"# Time [fs]",
" re(mom_t) x [at.u.]", &
1224 " re(mom_t) y [at.u.]",
" re(mom_t) z [at.u.]"], &
1225 xvals=[time], yvals=moment_t, &
1226 prefix=prefix, prefix_format=
"(A18)", &
1233 CALL print_rt_file(print_unit, xvals=[time], yvals=moment_t, &
1238 headers=[
"# Time [fs]",
" re(mom_t) x [at.u.]", &
1239 " re(mom_t) y [at.u.]",
" re(mom_t) z [at.u.]"], &
1240 xvals=[time], yvals=moment_t, &
1248 IF (print_unit == info_unit)
THEN
1250 prefix =
" MOMENTS_TRACE_IM|"
1253 CALL print_rt_file(print_unit, xvals=[time], yvals=moment_t, &
1254 prefix=prefix, prefix_format=
"(A18)", &
1259 headers=[
"# Time [fs]",
" im(mom_t) x [at.u.]", &
1260 " im(mom_t) y [at.u.]",
" im(mom_t) z [at.u.]"], &
1261 xvals=[time], yvals=moment_t, &
1262 prefix=prefix, prefix_format=
"(A18)", &
1269 CALL print_rt_file(print_unit, xvals=[time], yvals=moment_t, &
1274 headers=[
"# Time [fs]",
" im(mom_t) x [at.u.]", &
1275 " im(mom_t) y [at.u.]",
" im(mom_t) z [at.u.]"], &
1276 xvals=[time], yvals=moment_t, &
1297 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: moment_matrices, density_matrices
1299 COMPLEX(kind=dp),
DIMENSION(:, :) :: moment
1300 LOGICAL,
OPTIONAL :: imag_opt
1302 INTEGER :: i, k, nspin
1304 REAL(kind=
dp) :: real_moment
1307 IF (
PRESENT(imag_opt)) imag = imag_opt
1308 nspin =
SIZE(density_matrices)/2
1313 density_matrices(2*i - 1)%matrix, moment_matrices(k)%matrix, &
1316 moment(i, k) = cmplx(real_moment, 0.0, kind=
dp)
1319 density_matrices(2*i)%matrix, moment_matrices(k)%matrix, &
1322 moment(i, k) = moment(i, k) + cmplx(0.0, real_moment, kind=
dp)
1341 SUBROUTINE print_ft(rtp_section, moments, times, fields, rtc, info_opt, cell)
1343 COMPLEX(kind=dp),
DIMENSION(:, :, :),
POINTER :: moments
1344 REAL(kind=
dp),
DIMENSION(:),
POINTER :: times
1345 COMPLEX(kind=dp),
DIMENSION(:, :),
POINTER :: fields
1347 INTEGER,
OPTIONAL :: info_opt
1348 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell
1350 CHARACTER(len=*),
PARAMETER :: routinen =
'print_ft'
1352 CHARACTER(len=11),
DIMENSION(2) :: file_extensions
1353 CHARACTER(len=20),
ALLOCATABLE,
DIMENSION(:) :: headers
1354 CHARACTER(len=21) :: prefix
1355 CHARACTER(len=5) :: prefix_format
1356 COMPLEX(kind=dp),
ALLOCATABLE,
DIMENSION(:) :: omegas_complex, omegas_pade
1357 COMPLEX(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: field_results, field_results_pade, &
1358 pol_results, pol_results_pade, pol_results_pade_spin_total, pol_results_spin_total, &
1359 results, results_pade, results_pade_spin_total, results_spin_total, value_series
1360 INTEGER :: ft_unit, handle, i, idx_omega_zero, &
1361 info_unit, k, k_static, n, n_elems, &
1363 LOGICAL :: do_moments_ft, do_polarizability
1364 REAL(kind=
dp) :: damping, t0
1365 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: omegas, omegas_pade_real
1366 REAL(kind=
dp),
DIMENSION(3) :: delta_vec
1370 CALL timeset(routinen, handle)
1380 nspin =
SIZE(moments, 1)
1382 n_elems =
SIZE(rtc%print_pol_elements, 1)
1385 IF (
PRESENT(info_opt)) info_unit = info_opt
1388 file_extensions(1) =
"_SPIN_A.dat"
1389 file_extensions(2) =
"_SPIN_B.dat"
1394 do_polarizability = do_polarizability .AND. (n_elems > 0)
1396 damping = rtc%ft_damping
1400 IF (do_polarizability)
THEN
1401 ALLOCATE (field_results(3, n))
1402 IF (rtc%apply_delta_pulse)
THEN
1404 IF (
PRESENT(cell))
THEN
1405 delta_vec(:) = (real(rtc%delta_pulse_direction(1), kind=
dp)*cell%h_inv(1, :) + &
1406 REAL(rtc%delta_pulse_direction(2), kind=
dp)*cell%h_inv(2, :) + &
1407 REAL(rtc%delta_pulse_direction(3), kind=
dp)*cell%h_inv(3, :)) &
1408 *
twopi*rtc%delta_pulse_scale
1410 delta_vec(:) = real(rtc%delta_pulse_direction(:), kind=
dp)*rtc%delta_pulse_scale
1413 field_results(k, :) = cmplx(delta_vec(k), 0.0, kind=
dp)
1417 CALL multi_fft(times, fields, field_results, &
1418 damping_opt=damping, t0_opt=t0, subtract_initial_opt=.true.)
1422 IF (do_moments_ft .OR. do_polarizability)
THEN
1426 ALLOCATE (results(3*nspin, n))
1427 ALLOCATE (omegas(n))
1428 ALLOCATE (value_series(3*nspin, n))
1431 value_series(3*(i - 1) + k, :) = moments(i, k, :)
1435 CALL multi_fft(times, value_series, results, omegas, &
1436 damping_opt=damping, t0_opt=t0, subtract_initial_opt=.true.)
1437 DEALLOCATE (value_series)
1441 file_form=
"FORMATTED", file_position=
"REWIND")
1443 IF (ft_unit > 0)
THEN
1444 ALLOCATE (headers(7))
1445 headers(2) =
" x,real [at.u.]"
1446 headers(3) =
" x,imag [at.u.]"
1447 headers(4) =
" y,real [at.u.]"
1448 headers(5) =
" y,imag [at.u.]"
1449 headers(6) =
" z,real [at.u.]"
1450 headers(7) =
" z,imag [at.u.]"
1451 IF (info_unit == ft_unit)
THEN
1452 headers(1) =
"# Energy [eV]"
1453 prefix =
" MOMENTS_FT|"
1454 prefix_format =
"(A12)"
1455 CALL print_rt_file(ft_unit, headers, omegas, results(3*(i - 1) + 1:3*(i - 1) + 3, :), &
1456 prefix, prefix_format,
evolt)
1458 headers(1) =
"# omega [at.u.]"
1459 CALL print_rt_file(ft_unit, headers, omegas, results(3*(i - 1) + 1:3*(i - 1) + 3, :))
1461 DEALLOCATE (headers)
1467 ALLOCATE (results_spin_total(3, n))
1468 results_spin_total(:, :) = (0.0_dp, 0.0_dp)
1471 results_spin_total(k, :) = results_spin_total(k, :) + results(3*(i - 1) + k, :)
1475 file_form=
"FORMATTED", file_position=
"REWIND")
1476 IF (ft_unit > 0)
THEN
1477 ALLOCATE (headers(7))
1478 headers(2) =
" x,real [at.u.]"
1479 headers(3) =
" x,imag [at.u.]"
1480 headers(4) =
" y,real [at.u.]"
1481 headers(5) =
" y,imag [at.u.]"
1482 headers(6) =
" z,real [at.u.]"
1483 headers(7) =
" z,imag [at.u.]"
1484 IF (info_unit == ft_unit)
THEN
1485 headers(1) =
"# Energy [eV]"
1486 prefix =
" MOMENTS_FT|"
1487 prefix_format =
"(A12)"
1488 CALL print_rt_file(ft_unit, headers, omegas, results_spin_total, &
1489 prefix, prefix_format,
evolt)
1491 headers(1) =
"# omega [at.u.]"
1492 CALL print_rt_file(ft_unit, headers, omegas, results_spin_total)
1494 DEALLOCATE (headers)
1497 DEALLOCATE (results_spin_total)
1501 IF (rtc%pade_requested .AND. (do_moments_ft .OR. do_polarizability))
THEN
1502 ALLOCATE (omegas_complex(
SIZE(omegas)))
1503 omegas_complex(:) = cmplx(omegas(:), 0.0, kind=
dp)
1504 n_pade = int((rtc%pade_e_max - rtc%pade_e_min)/rtc%pade_e_step)
1505 ALLOCATE (omegas_pade(n_pade))
1506 ALLOCATE (omegas_pade_real(n_pade))
1509 omegas_pade_real(i) = (i - 1)*rtc%pade_e_step + rtc%pade_e_min
1510 omegas_pade(i) = cmplx(omegas_pade_real(i), 0.0, kind=
dp)
1512 ALLOCATE (results_pade(nspin*3, n_pade), source=cmplx(0.0, 0.0, kind=
dp))
1515 CALL greenx_refine_ft(rtc%pade_fit_e_min, rtc%pade_fit_e_max, omegas_complex, results(3*(i - 1) + k, :), &
1516 omegas_pade, results_pade(3*(i - 1) + k, :))
1519 ft_unit =
cp_print_key_unit_nr(logger, moment_ft_section, extension=
"_PADE"//file_extensions(i), &
1520 file_form=
"FORMATTED", file_position=
"REWIND")
1521 IF (ft_unit > 0)
THEN
1522 ALLOCATE (headers(7))
1523 headers(2) =
" x,real,pade [at.u.]"
1524 headers(3) =
" x,imag,pade [at.u.]"
1525 headers(4) =
" y,real,pade [at.u.]"
1526 headers(5) =
" y,imag,pade [at.u.]"
1527 headers(6) =
" z,real,pade [at.u.]"
1528 headers(7) =
" z,imag,pade [at.u.]"
1529 IF (info_unit == ft_unit)
THEN
1530 headers(1) =
"# Energy [eV]"
1531 prefix =
" MOMENTS_FT_PADE|"
1532 prefix_format =
"(A17)"
1533 CALL print_rt_file(ft_unit, headers, omegas_pade_real, results_pade(3*(i - 1) + 1:3*(i - 1) + 3, :), &
1534 prefix, prefix_format,
evolt)
1536 headers(1) =
"# omega [at.u.]"
1537 CALL print_rt_file(ft_unit, headers, omegas_pade_real, results_pade(3*(i - 1) + 1:3*(i - 1) + 3, :))
1539 DEALLOCATE (headers)
1544 ALLOCATE (results_pade_spin_total(3, n_pade))
1545 results_pade_spin_total(:, :) = (0.0_dp, 0.0_dp)
1548 results_pade_spin_total(k, :) = results_pade_spin_total(k, :) + results_pade(3*(i - 1) + k, :)
1552 file_form=
"FORMATTED", file_position=
"REWIND")
1553 IF (ft_unit > 0)
THEN
1554 ALLOCATE (headers(7))
1555 headers(2) =
" x,real,pade [at.u.]"
1556 headers(3) =
" x,imag,pade [at.u.]"
1557 headers(4) =
" y,real,pade [at.u.]"
1558 headers(5) =
" y,imag,pade [at.u.]"
1559 headers(6) =
" z,real,pade [at.u.]"
1560 headers(7) =
" z,imag,pade [at.u.]"
1561 IF (info_unit == ft_unit)
THEN
1562 headers(1) =
"# Energy [eV]"
1563 prefix =
" MOMENTS_FT_PADE|"
1564 prefix_format =
"(A17)"
1565 CALL print_rt_file(ft_unit, headers, omegas_pade_real, results_pade_spin_total, &
1566 prefix, prefix_format,
evolt)
1568 headers(1) =
"# omega [at.u.]"
1569 CALL print_rt_file(ft_unit, headers, omegas_pade_real, results_pade_spin_total)
1571 DEALLOCATE (headers)
1573 DEALLOCATE (results_pade_spin_total)
1577 IF (do_polarizability)
THEN
1579 ALLOCATE (pol_results(n_elems, n))
1583 pol_results(k, :) = results(3*(i - 1) + &
1584 rtc%print_pol_elements(k, 1), :)/ &
1585 (field_results(rtc%print_pol_elements(k, 2), :) + &
1586 1.0e-10*field_results(rtc%print_pol_elements(k, 2), 2))
1590 file_form=
"FORMATTED", file_position=
"REWIND")
1591 IF (ft_unit > 0)
THEN
1592 ALLOCATE (headers(2*n_elems + 1))
1594 WRITE (headers(2*k),
"(A16,I2,I2)")
"real pol. elem.", &
1595 rtc%print_pol_elements(k, 1), &
1596 rtc%print_pol_elements(k, 2)
1597 WRITE (headers(2*k + 1),
"(A16,I2,I2)")
"imag pol. elem.", &
1598 rtc%print_pol_elements(k, 1), &
1599 rtc%print_pol_elements(k, 2)
1602 IF (info_unit == ft_unit)
THEN
1603 headers(1) =
"# Energy [eV]"
1604 prefix =
" POLARIZABILITY|"
1605 prefix_format =
"(A16)"
1607 prefix, prefix_format,
evolt)
1609 headers(1) =
"# omega [at.u.]"
1612 DEALLOCATE (headers)
1617 IF (info_unit > 0)
THEN
1618 idx_omega_zero = minloc(abs(omegas), dim=1)
1620 WRITE (info_unit,
'(A,T22,A,T28,A,T36,A,T59,A)') &
1621 " STATIC_POL|",
"spin",
"element",
"Re [a.u.]",
"Im [a.u.]"
1623 DO k_static = 1, n_elems
1624 WRITE (info_unit,
'(A,T22,I4,T28,I3,",",I3,T36,ES22.10E3,T59,ES22.10E3)') &
1625 " STATIC_POL|", i, &
1626 rtc%print_pol_elements(k_static, 1), &
1627 rtc%print_pol_elements(k_static, 2), &
1628 REAL(pol_results(k_static, idx_omega_zero), kind=
dp), &
1629 aimag(pol_results(k_static, idx_omega_zero))
1636 ALLOCATE (pol_results_spin_total(n_elems, n))
1637 pol_results_spin_total(:, :) = (0.0_dp, 0.0_dp)
1640 pol_results_spin_total(k, :) = pol_results_spin_total(k, :) + &
1641 results(3*(i - 1) + rtc%print_pol_elements(k, 1), :)
1643 pol_results_spin_total(k, :) = pol_results_spin_total(k, :)/ &
1644 (field_results(rtc%print_pol_elements(k, 2), :) + &
1645 1.0e-10*field_results(rtc%print_pol_elements(k, 2), 2))
1648 file_form=
"FORMATTED", file_position=
"REWIND")
1649 IF (ft_unit > 0)
THEN
1650 ALLOCATE (headers(2*n_elems + 1))
1652 WRITE (headers(2*k),
"(A16,I2,I2)")
"real pol. elem.", &
1653 rtc%print_pol_elements(k, 1), &
1654 rtc%print_pol_elements(k, 2)
1655 WRITE (headers(2*k + 1),
"(A16,I2,I2)")
"imag pol. elem.", &
1656 rtc%print_pol_elements(k, 1), &
1657 rtc%print_pol_elements(k, 2)
1659 IF (info_unit == ft_unit)
THEN
1660 headers(1) =
"# Energy [eV]"
1661 prefix =
" POLARIZABILITY|"
1662 prefix_format =
"(A16)"
1663 CALL print_rt_file(ft_unit, headers, omegas, pol_results_spin_total, &
1664 prefix, prefix_format,
evolt)
1666 headers(1) =
"# omega [at.u.]"
1667 CALL print_rt_file(ft_unit, headers, omegas, pol_results_spin_total)
1669 DEALLOCATE (headers)
1673 IF (info_unit > 0)
THEN
1674 idx_omega_zero = minloc(abs(omegas), dim=1)
1675 DO k_static = 1, n_elems
1676 WRITE (info_unit,
'(A,T22,A,T28,I3,",",I3,T36,ES22.10E3,T59,ES22.10E3)') &
1677 " STATIC_POL|",
"TOT", &
1678 rtc%print_pol_elements(k_static, 1), &
1679 rtc%print_pol_elements(k_static, 2), &
1680 REAL(pol_results_spin_total(k_static, idx_omega_zero), kind=
dp), &
1681 aimag(pol_results_spin_total(k_static, idx_omega_zero))
1684 DEALLOCATE (pol_results_spin_total)
1689 IF (rtc%pade_requested .AND. do_polarizability)
THEN
1691 ALLOCATE (field_results_pade(3, n_pade))
1692 IF (rtc%apply_delta_pulse)
THEN
1694 field_results_pade(k, :) = cmplx(delta_vec(k), 0.0, kind=
dp)
1699 omegas_complex, field_results(k, :), &
1700 omegas_pade, field_results_pade(k, :))
1704 ALLOCATE (pol_results_pade(n_elems, n_pade))
1709 pol_results_pade(k, :) = results_pade(3*(i - 1) + rtc%print_pol_elements(k, 1), :)/( &
1710 field_results_pade(rtc%print_pol_elements(k, 2), :) + &
1711 field_results_pade(rtc%print_pol_elements(k, 2), 2)*1.0e-10_dp)
1715 file_form=
"FORMATTED", file_position=
"REWIND")
1716 IF (ft_unit > 0)
THEN
1717 ALLOCATE (headers(2*n_elems + 1))
1719 WRITE (headers(2*k),
"(A16,I2,I2)")
"re,pade,pol.", &
1720 rtc%print_pol_elements(k, 1), &
1721 rtc%print_pol_elements(k, 2)
1722 WRITE (headers(2*k + 1),
"(A16,I2,I2)")
"im,pade,pol.", &
1723 rtc%print_pol_elements(k, 1), &
1724 rtc%print_pol_elements(k, 2)
1727 IF (info_unit == ft_unit)
THEN
1728 headers(1) =
"# Energy [eV]"
1729 prefix =
" POLARIZABILITY_PADE|"
1730 prefix_format =
"(A21)"
1731 CALL print_rt_file(ft_unit, headers, omegas_pade_real, pol_results_pade, &
1732 prefix, prefix_format,
evolt)
1734 headers(1) =
"# omega [at.u.]"
1735 CALL print_rt_file(ft_unit, headers, omegas_pade_real, pol_results_pade)
1737 DEALLOCATE (headers)
1743 ALLOCATE (pol_results_pade_spin_total(n_elems, n_pade))
1744 pol_results_pade_spin_total(:, :) = (0.0_dp, 0.0_dp)
1747 pol_results_pade_spin_total(k, :) = pol_results_pade_spin_total(k, :) + &
1748 results_pade(3*(i - 1) + rtc%print_pol_elements(k, 1), :)
1750 pol_results_pade_spin_total(k, :) = pol_results_pade_spin_total(k, :)/( &
1751 field_results_pade(rtc%print_pol_elements(k, 2), :) + &
1752 field_results_pade(rtc%print_pol_elements(k, 2), 2)*1.0e-10_dp)
1755 file_form=
"FORMATTED", file_position=
"REWIND")
1756 IF (ft_unit > 0)
THEN
1757 ALLOCATE (headers(2*n_elems + 1))
1759 WRITE (headers(2*k),
"(A16,I2,I2)")
"re,pade,pol.", &
1760 rtc%print_pol_elements(k, 1), &
1761 rtc%print_pol_elements(k, 2)
1762 WRITE (headers(2*k + 1),
"(A16,I2,I2)")
"im,pade,pol.", &
1763 rtc%print_pol_elements(k, 1), &
1764 rtc%print_pol_elements(k, 2)
1766 IF (info_unit == ft_unit)
THEN
1767 headers(1) =
"# Energy [eV]"
1768 prefix =
" POLARIZABILITY_PADE|"
1769 prefix_format =
"(A21)"
1770 CALL print_rt_file(ft_unit, headers, omegas_pade_real, pol_results_pade_spin_total, &
1771 prefix, prefix_format,
evolt)
1773 headers(1) =
"# omega [at.u.]"
1774 CALL print_rt_file(ft_unit, headers, omegas_pade_real, pol_results_pade_spin_total)
1776 DEALLOCATE (headers)
1779 DEALLOCATE (pol_results_pade_spin_total)
1781 DEALLOCATE (field_results_pade)
1782 DEALLOCATE (pol_results_pade)
1785 IF (rtc%pade_requested .AND. (do_moments_ft .OR. do_polarizability))
THEN
1786 DEALLOCATE (omegas_complex)
1787 DEALLOCATE (omegas_pade)
1788 DEALLOCATE (omegas_pade_real)
1789 DEALLOCATE (results_pade)
1792 IF (do_polarizability)
THEN
1793 DEALLOCATE (pol_results)
1794 DEALLOCATE (field_results)
1797 IF (do_moments_ft .OR. do_polarizability)
THEN
1798 DEALLOCATE (results)
1802 CALL timestop(handle)
1817 SUBROUTINE print_rt_file(rt_unit, headers, xvals, yvals, prefix, prefix_format, xscale_opt, comp_opt)
1818 INTEGER,
INTENT(IN) :: rt_unit
1819 CHARACTER(len=20),
DIMENSION(:),
INTENT(IN), &
1821 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: xvals
1822 COMPLEX(kind=dp),
DIMENSION(:, :),
INTENT(IN) :: yvals
1823 CHARACTER(len=21),
INTENT(IN),
OPTIONAL :: prefix
1824 CHARACTER(len=5),
INTENT(IN),
OPTIONAL :: prefix_format
1825 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: xscale_opt
1826 INTEGER,
OPTIONAL :: comp_opt
1828 INTEGER :: do_comp, i, j, ncols, nrows
1829 LOGICAL :: do_headers, do_prefix
1830 REAL(kind=
dp) :: xscale
1833 IF (
PRESENT(prefix))
THEN
1834 IF (
PRESENT(prefix_format))
THEN
1837 cpabort(
"Printing of prefix with missing format!")
1842 IF (
PRESENT(xscale_opt)) xscale = xscale_opt
1844 ncols =
SIZE(yvals, 1)
1845 nrows =
SIZE(yvals, 2)
1849 IF (
PRESENT(comp_opt)) do_comp = comp_opt
1851 do_headers =
PRESENT(headers)
1853 IF (do_headers)
THEN
1856 cpabort(
"Not enought headers to print the file!")
1860 IF (
SIZE(xvals) < nrows)
THEN
1861 cpabort(
"Not enough xvals to print all yvals!")
1864 IF (rt_unit > 0)
THEN
1866 IF (do_headers)
THEN
1869 WRITE (rt_unit, prefix_format, advance=
"no") prefix
1871 WRITE (rt_unit,
"(A20)", advance=
"no") headers(1)
1873 SELECT CASE (do_comp)
1876 DO j = 1, 2*ncols - 1
1877 WRITE (rt_unit,
"(A20)", advance=
"no") headers(j + 1)
1879 WRITE (rt_unit,
"(A20)") headers(2*ncols + 1)
1883 WRITE (rt_unit,
"(A20)", advance=
"no") headers(j + 1)
1885 WRITE (rt_unit,
"(A20)") headers(ncols + 1)
1892 WRITE (rt_unit, prefix_format, advance=
"no") prefix
1894 WRITE (rt_unit,
"(E20.8E3)", advance=
"no") xvals(i)*xscale
1896 SELECT CASE (do_comp)
1898 WRITE (rt_unit,
"(E20.8E3)", advance=
"no") &
1901 WRITE (rt_unit,
"(E20.8E3)", advance=
"no") &
1905 WRITE (rt_unit,
"(E20.8E3,E20.8E3)", advance=
"no") &
1906 REAL(yvals(j, i)), aimag(yvals(j, i))
1910 SELECT CASE (do_comp)
1912 WRITE (rt_unit,
"(E20.8E3)") real(yvals(j, i))
1914 WRITE (rt_unit,
"(E20.8E3)") aimag(yvals(j, i))
1917 WRITE (rt_unit,
"(E20.8E3,E20.8E3)") &
1918 REAL(yvals(j, i)), aimag(yvals(j, i))
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
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)
...
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_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
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_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
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.
subroutine, public dbcsr_trace(matrix, trace)
Computes the trace of the given matrix, also known as the sum of its diagonal elements.
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
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
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, nrow, ncol, set_zero)
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
logical function, public cp_printkey_is_on(iteration_info, print_key)
returns true if the printlevel activates this printkey does not look if this iteration it should be p...
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, zeff, stride, max_file_size_mb, 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
Interface to the Greenx library.
subroutine, public greenx_refine_ft(fit_e_min, fit_e_max, x_fit, y_fit, x_eval, y_eval, n_pade_opt)
Refines the FT grid using Padé approximants.
sums arrays of real/complex numbers with much reduced round-off as compared to a naive implementation...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition of mathematical constants and functions.
real(kind=dp), parameter, public one
real(kind=dp), parameter, public twopi
real(kind=dp), parameter, public zero
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 methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis, ncgf)
Get the components of a particle set.
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public femtoseconds
real(kind=dp), parameter, public evolt
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, 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.
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, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
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.
subroutine, public write_rt_mos_to_restart(mo_array, rt_mos, particle_set, dft_section, qs_kind_set)
...
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>.
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type, all_images, minimum_image, neighbor_image, first_component)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public build_lin_mom_matrix(qs_env, matrix, minimum_image)
Calculation of the linear momentum matrix <mu|∂|nu> over Cartesian Gaussian functions.
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.
Separation of Fourier transform utilities into separate file.
subroutine, public multi_fft(time_series, value_series, result_series, omega_series, damping_opt, t0_opt, subtract_initial_opt)
Calculates the Fourier transform - couples to FFT libraries in CP2K, if available.
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 report_density_occupation(filter_eps, rho)
Reports the sparsity pattern of the complex density matrix.
subroutine, public print_rt_file(rt_unit, headers, xvals, yvals, prefix, prefix_format, xscale_opt, comp_opt)
...
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 rt_convergence(rtp, matrix_s, delta_mos, delta_eps)
computes the convergence criterion for RTP and EMD
integer, parameter, public rt_file_comp_both
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.
integer, parameter, public rt_file_comp_imag
integer, parameter, public rt_file_comp_real
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)
...
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...
Routines to perform the RTP in the velocity gauge.
subroutine, public velocity_gauge_nl_commutator(qs_env, matrix_cre, matrix_cim, vec_pot)
Calculate the commutator [Vnl~, r_d] (d=x,y,z) of the gauge-transformed nonlocal pseudopotential with...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
keeps the information about the structure of a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represent a list of objects
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.