39 USE dbcsr_api,
ONLY: &
40 dbcsr_add, dbcsr_binary_write, dbcsr_checksum, dbcsr_copy, dbcsr_create, &
41 dbcsr_deallocate_matrix, dbcsr_desymmetrize, dbcsr_filter, dbcsr_get_info, &
42 dbcsr_get_occupation, dbcsr_init_p, dbcsr_iterator_blocks_left, dbcsr_iterator_next_block, &
43 dbcsr_iterator_start, dbcsr_iterator_stop, dbcsr_iterator_type, dbcsr_p_type, dbcsr_scale, &
89 #include "../base/base_uses.f90"
95 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rt_propagation_output'
112 TYPE(qs_environment_type),
POINTER :: qs_env
113 INTEGER,
INTENT(in) :: run_type
114 REAL(
dp),
INTENT(in),
OPTIONAL :: delta_iter, used_time
116 INTEGER :: n_electrons, n_proj, nspin, output_unit, &
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
131 NULLIFY (logger, dft_control)
139 particle_set=particle_set, &
140 atomic_kind_set=atomic_kind_set, &
141 qs_kind_set=qs_kind_set, &
142 dft_control=dft_control)
147 n_electrons = n_electrons - dft_control%charge
149 CALL qs_rho_get(rho_struct=rho, tot_rho_r=qs_tot_rho_r)
151 tot_rho_r = accurate_sum(qs_tot_rho_r)
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): ", &
163 REAL(n_electrons,
dp)
164 WRITE (unit=output_unit, fmt=
"((T3,A,T59,F22.14))") &
165 "Total energy:", rtp%energy_new
167 WRITE (unit=output_unit, fmt=
"((T3,A,T61,F20.14))") &
168 "Energy difference to previous iteration step:", rtp%energy_new - rtp%energy_old
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
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
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
195 IF (output_unit > 0) &
198 "PRINT%PROGRAM_RUN_INFO")
200 IF (rtp%converged)
THEN
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)
207 dft_section,
"REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS"),
cp_p_file))
THEN
208 CALL print_rtp_energy_components(qs_env, dft_section)
210 IF (.NOT. dft_control%qs_control%dftb)
THEN
211 CALL write_available_results(qs_env=qs_env, rtp=rtp)
213 IF (rtp%linear_scaling)
THEN
214 CALL get_rtp(rtp=rtp, rho_new=rho_new)
216 dft_section,
"REAL_TIME_PROPAGATION%PRINT%RESTART"),
cp_p_file))
THEN
217 CALL write_rt_p_to_restart(rho_new, .false.)
220 dft_section,
"REAL_TIME_PROPAGATION%PRINT%RESTART_HISTORY"),
cp_p_file))
THEN
221 CALL write_rt_p_to_restart(rho_new, .true.)
223 IF (.NOT. dft_control%qs_control%dftb)
THEN
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)
233 CALL get_rtp(rtp=rtp, mos_new=mos_new)
234 IF (.NOT. dft_control%qs_control%dftb)
THEN
236 dft_section,
"REAL_TIME_PROPAGATION%PRINT%CURRENT"),
cp_p_file))
THEN
238 nspin =
SIZE(mos_new)/2
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")
246 CALL rt_current(qs_env, p_im(spin)%matrix, dft_section, spin, nspin)
250 IF (dft_control%rtp_control%is_proj_mo)
THEN
251 DO n_proj = 1,
SIZE(dft_control%rtp_control%proj_mo_list)
253 dft_control%rtp_control%proj_mo_list(n_proj)%proj_mo, n_proj)
258 dft_section, qs_kind_set)
262 rtp%energy_old = rtp%energy_new
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")
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
283 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_calculate_orthonormality'
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
292 NULLIFY (tmp_fm_struct)
294 CALL timeset(routinen, handle)
296 nspin =
SIZE(mos_new)/2
306 nrow_global=n, ncol_global=k)
314 para_env=mos_new(re)%matrix_struct%para_env, &
315 context=mos_new(re)%matrix_struct%context)
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)
325 CALL cp_fm_release(svec_re)
326 CALL cp_fm_release(svec_im)
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)
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))
337 CALL cp_fm_release(overlap_re)
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
343 CALL timestop(handle)
345 END SUBROUTINE rt_calculate_orthonormality
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
362 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_convergence'
363 REAL(kind=
dp),
PARAMETER :: one = 1.0_dp, zero = 0.0_dp
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
373 NULLIFY (tmp_fm_struct)
375 CALL timeset(routinen, handle)
377 CALL get_rtp(rtp=rtp, mos_new=mos_new)
379 nspin =
SIZE(delta_mos)/2
382 DO i = 1,
SIZE(mos_new)
393 delta_mos(re)%matrix_struct, &
394 delta_mos(re)%matrix_struct%context, &
401 CALL cp_fm_get_info(delta_mos(re), ncol_local=lcol, ncol_global=nmo, &
408 work%local_data(:, icol) = delta_mos(re)%local_data(:, icol)
409 work%local_data(:, icol + lcol) = delta_mos(im)%local_data(:, icol)
414 CALL cp_fm_release(work)
417 para_env=delta_mos(re)%matrix_struct%para_env, &
418 context=delta_mos(re)%matrix_struct%context)
421 delta_mos(re)%matrix_struct%context, &
428 CALL parallel_gemm(
"T",
"N", nmo, newdim, nao, one, delta_mos(re), &
431 CALL parallel_gemm(
"T",
"N", nmo, newdim, nao, one, delta_mos(im), &
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))
443 CALL cp_fm_release(work)
444 CALL cp_fm_release(work1)
445 CALL cp_fm_release(work2)
452 CALL delta_mos(1)%matrix_struct%para_env%max(max_alpha)
453 delta_eps = sqrt(max_alpha)
455 CALL timestop(handle)
469 TYPE(rt_prop_type),
POINTER :: rtp
470 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: delta_p
471 REAL(
dp),
INTENT(out) :: delta_eps
473 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_convergence_density'
474 REAL(kind=
dp),
PARAMETER :: one = 1.0_dp, zero = 0.0_dp
476 INTEGER :: col_atom, group_handle, handle, i, &
478 REAL(
dp) :: alpha, max_alpha
479 REAL(
dp),
DIMENSION(:),
POINTER :: block_values
480 TYPE(dbcsr_iterator_type) :: iter
481 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_new
482 TYPE(dbcsr_type),
POINTER :: tmp
483 TYPE(mp_comm_type) :: group
485 CALL timeset(routinen, handle)
487 CALL get_rtp(rtp=rtp, rho_new=rho_new)
489 DO i = 1,
SIZE(rho_new)
490 CALL dbcsr_add(delta_p(i)%matrix, rho_new(i)%matrix, one, -one)
493 DO i = 1,
SIZE(delta_p)
495 CALL dbcsr_iterator_start(iter, delta_p(i)%matrix)
496 DO WHILE (dbcsr_iterator_blocks_left(iter))
497 CALL dbcsr_iterator_next_block(iter, row_atom, col_atom, block_values)
498 block_values = block_values*block_values
500 CALL dbcsr_iterator_stop(iter)
504 CALL dbcsr_create(tmp, template=delta_p(1)%matrix, matrix_type=
"N")
505 DO ispin = 1,
SIZE(delta_p)/2
506 CALL dbcsr_desymmetrize(delta_p(2*ispin - 1)%matrix, tmp)
507 CALL dbcsr_add(delta_p(2*ispin)%matrix, tmp, one, one)
511 DO ispin = 1,
SIZE(delta_p)/2
512 CALL dbcsr_iterator_start(iter, delta_p(2*ispin)%matrix)
513 DO WHILE (dbcsr_iterator_blocks_left(iter))
514 CALL dbcsr_iterator_next_block(iter, row_atom, col_atom, block_values)
515 alpha = maxval(block_values)
516 IF (alpha > max_alpha) max_alpha = alpha
518 CALL dbcsr_iterator_stop(iter)
520 CALL dbcsr_get_info(delta_p(1)%matrix, group=group_handle)
521 CALL group%set_handle(group_handle)
522 CALL group%max(max_alpha)
523 delta_eps = sqrt(max_alpha)
524 CALL dbcsr_deallocate_matrix(tmp)
525 CALL timestop(handle)
535 SUBROUTINE make_moment(qs_env)
537 TYPE(qs_environment_type),
POINTER :: qs_env
539 CHARACTER(len=*),
PARAMETER :: routinen =
'make_moment'
541 INTEGER :: handle, output_unit
542 TYPE(cp_logger_type),
POINTER :: logger
543 TYPE(dft_control_type),
POINTER :: dft_control
545 CALL timeset(routinen, handle)
547 NULLIFY (dft_control)
551 CALL get_qs_env(qs_env, dft_control=dft_control)
552 IF (dft_control%qs_control%dftb)
THEN
554 ELSE IF (dft_control%qs_control%xtb)
THEN
559 CALL timestop(handle)
561 END SUBROUTINE make_moment
572 REAL(kind=
dp) :: filter_eps
573 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho
575 CHARACTER(len=*),
PARAMETER :: routinen =
'report_density_occupation'
577 INTEGER :: handle, i, im, ispin, re, unit_nr
578 REAL(kind=
dp) :: eps, occ
579 TYPE(cp_logger_type),
POINTER :: logger
580 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: tmp
582 CALL timeset(routinen, handle)
589 CALL dbcsr_init_p(tmp(i)%matrix)
590 CALL dbcsr_create(tmp(i)%matrix, template=rho(i)%matrix)
591 CALL dbcsr_copy(tmp(i)%matrix, rho(i)%matrix)
593 DO ispin = 1,
SIZE(rho)/2
596 eps = max(filter_eps, 1.0e-11_dp)
597 DO WHILE (eps < 1.1_dp)
598 CALL dbcsr_filter(tmp(re)%matrix, eps)
599 occ = dbcsr_get_occupation(tmp(re)%matrix)
600 IF (unit_nr > 0)
WRITE (unit_nr, fmt=
"((T3,A,I1,A,F15.12,A,T61,F20.10))")
"Occupation of rho spin ", &
601 ispin,
" eps ", eps,
" real: ", occ
604 eps = max(filter_eps, 1.0e-11_dp)
605 DO WHILE (eps < 1.1_dp)
606 CALL dbcsr_filter(tmp(im)%matrix, eps)
607 occ = dbcsr_get_occupation(tmp(im)%matrix)
608 IF (unit_nr > 0)
WRITE (unit_nr, fmt=
"((T3,A,I1,A,F15.12,A,T61,F20.10))")
"Occupation of rho spin ", &
609 ispin,
" eps ", eps,
" imag: ", occ
614 CALL timestop(handle)
625 SUBROUTINE write_rt_p_to_restart(rho_new, history)
627 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_new
630 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_rt_p_to_restart'
632 CHARACTER(LEN=default_path_length) :: file_name, project_name
633 INTEGER :: handle, im, ispin, re, unit_nr
634 REAL(kind=
dp) :: cs_pos
635 TYPE(cp_logger_type),
POINTER :: logger
637 CALL timeset(routinen, handle)
639 IF (logger%para_env%is_source())
THEN
645 project_name = logger%iter_info%project_name
646 DO ispin = 1,
SIZE(rho_new)/2
650 WRITE (file_name,
'(A,I0,A)') &
651 trim(project_name)//
"_LS_DM_SPIN_RE", ispin,
"_"//trim(
cp_iter_string(logger%iter_info))//
"_RESTART.dm"
653 WRITE (file_name,
'(A,I0,A)') trim(project_name)//
"_LS_DM_SPIN_RE", ispin,
"_RESTART.dm"
655 cs_pos = dbcsr_checksum(rho_new(re)%matrix, pos=.true.)
656 IF (unit_nr > 0)
THEN
657 WRITE (unit_nr,
'(T2,A,E20.8)')
"Writing restart DM "//trim(file_name)//
" with checksum: ", cs_pos
659 CALL dbcsr_binary_write(rho_new(re)%matrix, file_name)
661 WRITE (file_name,
'(A,I0,A)') &
662 trim(project_name)//
"_LS_DM_SPIN_IM", ispin,
"_"//trim(
cp_iter_string(logger%iter_info))//
"_RESTART.dm"
664 WRITE (file_name,
'(A,I0,A)') trim(project_name)//
"_LS_DM_SPIN_IM", ispin,
"_RESTART.dm"
666 cs_pos = dbcsr_checksum(rho_new(im)%matrix, pos=.true.)
667 IF (unit_nr > 0)
THEN
668 WRITE (unit_nr,
'(T2,A,E20.8)')
"Writing restart DM "//trim(file_name)//
" with checksum: ", cs_pos
670 CALL dbcsr_binary_write(rho_new(im)%matrix, file_name)
673 CALL timestop(handle)
675 END SUBROUTINE write_rt_p_to_restart
686 SUBROUTINE rt_current(qs_env, P_im, dft_section, spin, nspin)
687 TYPE(qs_environment_type),
POINTER :: qs_env
688 TYPE(dbcsr_type),
POINTER :: p_im
689 TYPE(section_vals_type),
POINTER :: dft_section
690 INTEGER :: spin, nspin
692 CHARACTER(len=*),
PARAMETER :: routinen =
'rt_current'
694 CHARACTER(len=1) :: char_spin
695 CHARACTER(len=14) :: ext
696 CHARACTER(len=2) :: sdir
697 INTEGER :: dir, handle, print_unit
698 INTEGER,
DIMENSION(:),
POINTER :: stride(:)
700 TYPE(cp_logger_type),
POINTER :: logger
701 TYPE(current_env_type) :: current_env
702 TYPE(dbcsr_type),
POINTER :: tmp, zero
703 TYPE(particle_list_type),
POINTER :: particles
704 TYPE(pw_c1d_gs_type) :: gs
705 TYPE(pw_env_type),
POINTER :: pw_env
706 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
707 TYPE(pw_r3d_rs_type) :: rs
708 TYPE(qs_subsys_type),
POINTER :: subsys
710 CALL timeset(routinen, handle)
713 CALL get_qs_env(qs_env=qs_env, subsys=subsys, pw_env=pw_env)
715 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
719 CALL dbcsr_create(zero, template=p_im)
720 CALL dbcsr_copy(zero, p_im)
721 CALL dbcsr_set(zero, 0.0_dp)
722 CALL dbcsr_create(tmp, template=p_im)
723 CALL dbcsr_copy(tmp, p_im)
725 CALL dbcsr_scale(tmp, 0.5_dp)
727 current_env%gauge = -1
728 current_env%gauge_init = .false.
729 CALL auxbas_pw_pool%create_pw(rs)
730 CALL auxbas_pw_pool%create_pw(gs)
740 CALL calculate_jrho_resp(zero, tmp, zero, zero, dir, dir, rs, gs, qs_env, current_env, retain_rsgrid=.true.)
742 stride =
section_get_ivals(dft_section,
"REAL_TIME_PROPAGATION%PRINT%CURRENT%STRIDE")
746 ELSEIF (dir == 2)
THEN
751 WRITE (char_spin,
"(I1)") spin
753 ext =
"-SPIN-"//char_spin//sdir//
".cube"
756 extension=ext, file_status=
"REPLACE", file_action=
"WRITE", &
757 log_filename=.false., mpi_io=mpi_io)
759 CALL cp_pw_to_cube(rs, print_unit,
"EMD current", particles=particles, stride=stride, &
767 CALL auxbas_pw_pool%give_back_pw(rs)
768 CALL auxbas_pw_pool%give_back_pw(gs)
770 CALL dbcsr_deallocate_matrix(zero)
771 CALL dbcsr_deallocate_matrix(tmp)
775 CALL timestop(handle)
777 END SUBROUTINE rt_current
789 SUBROUTINE write_available_results(qs_env, rtp)
790 TYPE(qs_environment_type),
POINTER :: qs_env
791 TYPE(rt_prop_type),
POINTER :: rtp
793 CHARACTER(len=*),
PARAMETER :: routinen =
'write_available_results'
796 TYPE(qs_scf_env_type),
POINTER :: scf_env
798 CALL timeset(routinen, handle)
801 IF (rtp%linear_scaling)
THEN
811 CALL timestop(handle)
813 END SUBROUTINE write_available_results
823 SUBROUTINE print_field_applied(qs_env, dft_section)
824 TYPE(qs_environment_type),
POINTER :: qs_env
825 TYPE(section_vals_type),
POINTER :: dft_section
827 CHARACTER(LEN=3),
DIMENSION(3) :: rlab
828 CHARACTER(LEN=default_path_length) :: filename
829 INTEGER :: i, i_step, output_unit, unit_nr
831 REAL(kind=
dp) :: field(3)
832 TYPE(cp_logger_type),
POINTER :: logger
833 TYPE(dft_control_type),
POINTER :: dft_control
834 TYPE(rt_prop_type),
POINTER :: rtp
836 NULLIFY (dft_control)
841 CALL get_qs_env(qs_env, dft_control=dft_control, rtp=rtp)
846 "REAL_TIME_PROPAGATION%PRINT%FIELD", extension=
".dat", is_new_file=new_file)
848 IF (output_unit > 0)
THEN
849 rlab = [
CHARACTER(LEN=3) ::
"X",
"Y",
"Z"]
850 IF (unit_nr /= output_unit)
THEN
851 INQUIRE (unit=unit_nr, name=filename)
852 WRITE (unit=output_unit, fmt=
"(/,T2,A,2(/,T3,A),/)") &
853 "FIELD",
"The field applied is written to the file:", &
856 WRITE (unit=output_unit, fmt=
"(/,T2,A)")
"FIELD APPLIED [a.u.]"
857 WRITE (unit=output_unit, fmt=
"(T5,3(A,A,E16.8,1X))") &
858 (trim(rlab(i)),
"=", dft_control%rtp_control%field(i), i=1, 3)
862 IF (dft_control%apply_efield_field)
THEN
863 WRITE (unit=unit_nr, fmt=
'("#",5X,A,8X,A,3(6X,A))')
"Step Nr.",
"Time[fs]",
" Field X",
" Field Y",
" Field Z"
864 ELSE IF (dft_control%apply_vector_potential)
THEN
865 WRITE (unit=unit_nr, fmt=
'("#",5X,A,8X,A,6(6X,A))')
"Step Nr.",
"Time[fs]",
" Field X",
" Field Y",
" Field Z", &
866 "Vec. Pot. X",
"Vec. Pot. Y",
"Vec. Pot. Z"
870 IF (dft_control%apply_efield_field)
THEN
871 CALL make_field(dft_control, field, qs_env%sim_step, qs_env%sim_time)
872 WRITE (unit=unit_nr, fmt=
"(I10,F20.6,3(E16.8,1X))") i_step, i_step*rtp%dt*
femtoseconds, field(1), field(2), field(3)
873 ELSE IF (dft_control%apply_vector_potential)
THEN
874 WRITE (unit=unit_nr, fmt=
"(I10,F20.6,6(E16.8,1X))") i_step, i_step*rtp%dt*
femtoseconds, &
875 dft_control%rtp_control%field(1), dft_control%rtp_control%field(2), dft_control%rtp_control%field(3), &
876 dft_control%rtp_control%vec_pot(1), dft_control%rtp_control%vec_pot(2), dft_control%rtp_control%vec_pot(3)
882 "REAL_TIME_PROPAGATION%PRINT%FIELD")
884 END SUBROUTINE print_field_applied
893 SUBROUTINE print_rtp_energy_components(qs_env, dft_section)
894 TYPE(qs_environment_type),
POINTER :: qs_env
895 TYPE(section_vals_type),
POINTER :: dft_section
897 CHARACTER(LEN=default_path_length) :: filename
898 INTEGER :: i_step, output_unit, unit_nr
900 TYPE(cp_logger_type),
POINTER :: logger
901 TYPE(dft_control_type),
POINTER :: dft_control
902 TYPE(qs_energy_type),
POINTER :: energy
903 TYPE(rt_prop_type),
POINTER :: rtp
905 NULLIFY (dft_control, energy, rtp)
910 CALL get_qs_env(qs_env, dft_control=dft_control, rtp=rtp, energy=energy)
914 "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS", extension=
".ener", &
915 file_action=
"WRITE", is_new_file=new_file)
917 IF (output_unit > 0)
THEN
918 IF (unit_nr /= output_unit)
THEN
919 INQUIRE (unit=unit_nr, name=filename)
920 WRITE (unit=output_unit, fmt=
"(/,T2,A,2(/,T3,A),/)") &
921 "ENERGY_CONSTITUENTS",
"Total Energy constituents written to file:", &
924 WRITE (unit=output_unit, fmt=
"(/,T2,A)")
"ENERGY_CONSTITUENTS"
930 WRITE (unit=unit_nr, fmt=
'("#",5X,A,8X,A,10(6X,A))')
"Step Nr.",
"Time[fs]", &
931 "Total ener.[a.u.]",
"core[a.u.] ",
" overlap [a.u.]",
"hartree[a.u.]",
" exc. [a.u.] ", &
932 " hartree 1c[a.u.]",
"exc 1c[a.u.] ",
"exc admm[a.u.]",
"exc 1c admm[a.u.]",
"efield LG"
935 WRITE (unit=unit_nr, fmt=
"(I10,F20.6,10(F20.9))") &
936 i_step, i_step*rtp%dt*
femtoseconds, energy%total, energy%core, energy%core_overlap, energy%hartree, energy%exc, &
937 energy%hartree_1c, energy%exc1, energy%exc_aux_fit, energy%exc1_aux_fit, energy%efield_core
942 "REAL_TIME_PROPAGATION%PRINT%E_CONSTITUENTS")
944 END SUBROUTINE print_rtp_energy_components
Define the atomic kind types and their sub types.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
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, 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
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
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:
real(kind=dp), parameter, public femtoseconds
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_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, 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, 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)
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)
...
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)
...
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)
...