72 USE omp_lib,
ONLY: omp_get_thread_num, &
73 omp_get_num_threads, &
74 omp_set_num_threads, &
78 dbt_copy_matrix_to_tensor, &
79 dbt_copy_tensor_to_matrix, &
162#include "../base/base_uses.f90"
168 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
"rt_bse"
178 MODULE PROCEDURE get_sigma_complex, &
184 MODULE PROCEDURE get_hartree_env, &
198 CHARACTER(len=*),
PARAMETER :: routinen =
'run_propagation_bse'
200 INTEGER :: i, j, k, handle
202 REAL(kind=
dp) :: metric, enum_re, enum_im, &
203 idempotence_dev, a_metric_1, a_metric_2
205 CALL timeset(routinen, handle)
225 CALL initialize_rtbse_env(rtbse_env)
229 rtbse_env%sim_time = real(rtbse_env%sim_start,
dp)*rtbse_env%sim_dt
231 IF (.NOT. rtbse_env%restart_extracted)
THEN
237 IF (rtbse_env%dft_control%rtp_control%apply_delta_pulse .AND. (.NOT. rtbse_env%restart_extracted))
THEN
238 CALL apply_delta_pulse(rtbse_env)
242 DO i = rtbse_env%sim_start, rtbse_env%sim_nsteps
245 rtbse_env%sim_time = real(i,
dp)*rtbse_env%sim_dt
246 rtbse_env%sim_step = i
248 CALL etrs_scf_loop(rtbse_env, rtbse_env%rho, rtbse_env%rho_M, rtbse_env%rho_new, converged, k, metric)
249 CALL get_electron_number(rtbse_env, rtbse_env%rho_new, enum_re, enum_im)
253 CALL get_idempotence_deviation(rtbse_env, rtbse_env%rho_new, idempotence_dev)
254 DO j = 1, rtbse_env%n_spin
255 CALL cp_cfm_to_fm(rtbse_env%sigma_SEX(j), rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
256 CALL antiherm_metric(real_fm=rtbse_env%real_workspace(1), imag_fm=rtbse_env%real_workspace(2), &
257 workspace=rtbse_env%rho_workspace, metric=a_metric_1)
258 CALL antiherm_metric(real_fm=rtbse_env%hartree_curr(j), &
259 workspace=rtbse_env%rho_workspace, metric=a_metric_2)
263 IF (.NOT. converged) cpabort(
"ETRS did not converge")
264 DO j = 1, rtbse_env%n_spin
285 CALL timestop(handle)
294 SUBROUTINE initialize_rtbse_env(rtbse_env)
296 CHARACTER(len=*),
PARAMETER :: routinen =
"initialize_rtbse_env"
298 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: moments_dbcsr_p
300 REAL(kind=
dp),
DIMENSION(:),
POINTER :: custom_ref_point, &
302 REAL(kind=
dp),
DIMENSION(3) :: rpoint
303 INTEGER :: i, k, handle
305 CALL timeset(routinen, handle)
308 CALL get_qs_env(rtbse_env%qs_env, bs_env=bs_env, matrix_s=matrix_s)
312 NULLIFY (moments_dbcsr_p)
313 ALLOCATE (moments_dbcsr_p(3))
316 NULLIFY (moments_dbcsr_p(k)%matrix)
318 ALLOCATE (moments_dbcsr_p(k)%matrix)
320 CALL dbcsr_copy(moments_dbcsr_p(k)%matrix, matrix_s(1)%matrix)
324 NULLIFY (custom_ref_point)
325 ALLOCATE (custom_ref_point(3), source=0.0_dp)
336 DEALLOCATE (custom_ref_point)
339 CALL copy_dbcsr_to_fm(moments_dbcsr_p(k)%matrix, rtbse_env%moments_field(k))
345 DEALLOCATE (moments_dbcsr_p(k)%matrix)
347 DEALLOCATE (moments_dbcsr_p)
353 ALLOCATE (occupations(rtbse_env%n_ao))
355 DO i = 1, rtbse_env%n_spin
356 occupations(:) = 0.0_dp
357 occupations(1:rtbse_env%n_occ(i)) = 1.0_dp
359 CALL cp_fm_to_fm(bs_env%fm_mo_coeff_Gamma(i), rtbse_env%real_workspace(1))
361 CALL parallel_gemm(
"N",
"T", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
362 1.0_dp, rtbse_env%real_workspace(1), bs_env%fm_mo_coeff_Gamma(i), &
363 0.0_dp, rtbse_env%real_workspace(2))
365 CALL cp_fm_to_cfm(msourcer=rtbse_env%real_workspace(2), mtarget=rtbse_env%rho(i))
369 DEALLOCATE (occupations)
371 IF (rtbse_env%dft_control%rtp_control%initial_wfn ==
use_rt_restart)
THEN
387 CALL cp_fm_to_cfm(msourcer=rtbse_env%S_fm, mtarget=rtbse_env%S_cfm)
392 DO i = 1, rtbse_env%n_spin
395 CALL cp_fm_to_fm(bs_env%fm_mo_coeff_Gamma(i), rtbse_env%real_workspace(1))
400 CALL parallel_gemm(
"N",
"T", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
401 1.0_dp, rtbse_env%real_workspace(1), bs_env%fm_mo_coeff_Gamma(i), &
402 0.0_dp, rtbse_env%real_workspace(2))
404 CALL parallel_gemm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
405 1.0_dp, rtbse_env%S_fm, rtbse_env%real_workspace(2), &
406 0.0_dp, rtbse_env%real_workspace(1))
408 CALL parallel_gemm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
409 1.0_dp, rtbse_env%real_workspace(1), rtbse_env%S_fm, &
410 0.0_dp, rtbse_env%real_workspace(2))
411 CALL cp_fm_to_cfm(msourcer=rtbse_env%real_workspace(2), mtarget=rtbse_env%ham_reference(i))
414 CALL cp_fm_to_cfm(msourcer=bs_env%fm_ks_Gamma(i), mtarget=rtbse_env%ham_reference(i))
421 CALL init_hartree(rtbse_env, rtbse_env%v_dbcsr)
427 CALL dbcsr_set(rtbse_env%w_dbcsr, 0.0_dp)
430 CALL dbcsr_add(rtbse_env%w_dbcsr, rtbse_env%v_dbcsr, 1.0_dp, 1.0_dp)
431 CALL dbt_copy_matrix_to_tensor(rtbse_env%w_dbcsr, rtbse_env%screened_dbt)
434 DO i = 1, rtbse_env%n_spin
435 CALL get_hartree(rtbse_env, rtbse_env%rho_orig(i), rtbse_env%hartree_curr(i))
437 CALL cp_fm_scale(rtbse_env%spin_degeneracy, rtbse_env%hartree_curr(i))
439 CALL cp_fm_to_cfm(msourcer=rtbse_env%hartree_curr(i), mtarget=rtbse_env%ham_workspace(1))
441 cmplx(-1.0, 0.0, kind=
dp), rtbse_env%ham_workspace(1))
449 DO i = 1, rtbse_env%n_spin
451 CALL get_sigma(rtbse_env, rtbse_env%sigma_COH(i), -0.5_dp, rtbse_env%S_inv_fm)
453 CALL cp_fm_to_cfm(msourcer=rtbse_env%sigma_COH(i), mtarget=rtbse_env%ham_workspace(1))
455 cmplx(-1.0, 0.0, kind=
dp), rtbse_env%ham_workspace(1))
459 CALL get_sigma(rtbse_env, rtbse_env%sigma_SEX(i), -1.0_dp, rtbse_env%rho_orig(i))
462 cmplx(-1.0, 0.0, kind=
dp), rtbse_env%sigma_SEX(i))
466 DO i = 1, rtbse_env%n_spin
467 CALL get_sigma(rtbse_env, rtbse_env%sigma_SEX(i), -1.0_dp, rtbse_env%rho_orig(i))
469 cmplx(-1.0, 0.0, kind=
dp), rtbse_env%sigma_SEX(i))
474 CALL timestop(handle)
475 END SUBROUTINE initialize_rtbse_env
482 SUBROUTINE apply_delta_pulse(rtbse_env)
484 CHARACTER(len=*),
PARAMETER :: routinen =
"apply_delta_pulse"
485 REAL(kind=
dp) :: intensity, metric
486 REAL(kind=
dp),
DIMENSION(3) :: kvec
487 INTEGER :: i, k, handle
489 CALL timeset(routinen, handle)
492 IF (rtbse_env%unit_nr > 0)
WRITE (rtbse_env%unit_nr,
'(A28)')
' RTBSE| Applying delta pulse'
494 intensity = -rtbse_env%dft_control%rtp_control%delta_pulse_scale
496 kvec(:) = rtbse_env%dft_control%rtp_control%delta_pulse_direction(:)
497 IF (rtbse_env%unit_nr > 0)
WRITE (rtbse_env%unit_nr,
'(A38,E14.4E3,E14.4E3,E14.4E3)') &
498 " RTBSE| Delta pulse elements (a.u.) : ", intensity*kvec(:)
503 kvec(k), rtbse_env%moments_field(k))
506 CALL cp_fm_transpose(rtbse_env%real_workspace(1), rtbse_env%real_workspace(2))
508 0.5_dp, rtbse_env%real_workspace(2))
510 IF (rtbse_env%mat_exp_method ==
do_bch)
THEN
512 CALL parallel_gemm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
513 intensity, rtbse_env%S_inv_fm, rtbse_env%real_workspace(1), &
514 0.0_dp, rtbse_env%real_workspace(2))
515 DO i = 1, rtbse_env%n_spin
517 CALL cp_fm_to_cfm(msourcei=rtbse_env%real_workspace(2), mtarget=rtbse_env%ham_workspace(i))
519 ELSE IF (rtbse_env%mat_exp_method ==
do_exact)
THEN
520 DO i = 1, rtbse_env%n_spin
521 CALL cp_fm_to_cfm(msourcer=rtbse_env%real_workspace(1), mtarget=rtbse_env%ham_effective(i))
522 CALL cp_cfm_gexp(rtbse_env%ham_effective(i), rtbse_env%S_cfm, rtbse_env%ham_workspace(i), &
523 cmplx(0.0, intensity, kind=
dp), rtbse_env%rho_workspace)
527 CALL propagate_density(rtbse_env, rtbse_env%ham_workspace, rtbse_env%rho, rtbse_env%rho_new)
528 metric = rho_metric(rtbse_env%rho_new, rtbse_env%rho, rtbse_env%n_spin)
529 IF (rtbse_env%unit_nr > 0)
WRITE (rtbse_env%unit_nr, (
'(A42,E38.8E3)'))
" RTBSE| Metric difference after delta kick", metric
531 DO i = 1, rtbse_env%n_spin
535 CALL timestop(handle)
536 END SUBROUTINE apply_delta_pulse
544 FUNCTION rho_metric(rho_new, rho_old, nspin, workspace_opt)
RESULT(metric)
545 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER,
INTENT(IN):: rho_new, &
547 INTEGER,
INTENT(IN) :: nspin
548 TYPE(
cp_cfm_type),
POINTER,
OPTIONAL :: workspace_opt
550 REAL(kind=
dp) :: metric
551 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: partial_metric
553 COMPLEX(kind=dp) :: scale_factor
555 ALLOCATE (partial_metric(nspin))
558 IF (
PRESENT(workspace_opt))
THEN
559 workspace = workspace_opt
574 metric = metric + partial_metric(j)*partial_metric(j)
576 metric = sqrt(metric)
579 DEALLOCATE (partial_metric)
587 SUBROUTINE antiherm_metric(real_fm, imag_fm, workspace, metric)
589 TYPE(
cp_fm_type),
INTENT(IN),
OPTIONAL :: imag_fm
590 REAL(kind=
dp),
INTENT(OUT) :: metric
591 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER :: workspace
592 COMPLEX(kind=dp) :: complex_one
595 IF (
PRESENT(imag_fm))
THEN
598 CALL cp_fm_to_cfm(msourcer=real_fm, mtarget=workspace(1))
602 complex_one = cmplx(1.0, 0.0, kind=
dp)
615 SUBROUTINE ham_to_exp(rtbse_env, ham, ham_exp)
619 CHARACTER(len=*),
PARAMETER :: routinen =
"ham_to_exp"
621 CALL timeset(routinen, handle)
622 DO j = 1, rtbse_env%n_spin
623 IF (rtbse_env%mat_exp_method ==
do_bch)
THEN
626 CALL multiply_fm_cfm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
627 1.0_dp, rtbse_env%S_inv_fm, ham(j), &
628 0.0_dp, rtbse_env%rho_workspace(1))
632 CALL cp_cfm_scale(cmplx(0.0, -rtbse_env%sim_dt/2, kind=
dp), rtbse_env%rho_workspace(1))
635 ELSE IF (rtbse_env%mat_exp_method ==
do_exact)
THEN
636 CALL cp_cfm_gexp(ham(j), rtbse_env%S_cfm, ham_exp(j), &
637 cmplx(0.0, -rtbse_env%sim_dt/2, kind=
dp), rtbse_env%rho_workspace)
639 cpabort(
"Only BCH and Taylor matrix exponentiation implemented")
643 CALL timestop(handle)
651 SUBROUTINE update_effective_ham(rtbse_env, rho)
654 CHARACTER(len=*),
PARAMETER :: routinen =
"update_effective_ham"
655 INTEGER :: k, j, nspin, handle
657 CALL timeset(routinen, handle)
659 nspin = rtbse_env%n_spin
663 CALL cp_cfm_to_cfm(rtbse_env%ham_reference(j), rtbse_env%ham_effective(j))
666 IF (rtbse_env%dft_control%apply_efield_field)
THEN
667 CALL make_field(rtbse_env%dft_control, rtbse_env%field, rtbse_env%sim_step, rtbse_env%sim_time)
670 rtbse_env%field(:) = 0.0_dp
675 CALL cp_fm_to_cfm(msourcer=rtbse_env%moments_field(k), mtarget=rtbse_env%ham_workspace(1))
677 cmplx(rtbse_env%field(k), 0.0, kind=
dp), rtbse_env%ham_workspace(1))
681 CALL get_sigma(rtbse_env, rtbse_env%sigma_COH(j), -0.5_dp, rtbse_env%S_inv_fm)
682 CALL cp_fm_to_cfm(msourcer=rtbse_env%sigma_COH(j), mtarget=rtbse_env%ham_workspace(1))
684 cmplx(1.0, 0.0, kind=
dp), rtbse_env%ham_workspace(1))
688 CALL get_sigma(rtbse_env, rtbse_env%sigma_SEX(j), -1.0_dp, rho(j))
690 cmplx(1.0, 0.0, kind=
dp), rtbse_env%sigma_SEX(j))
694 rtbse_env%hartree_curr(j))
695 CALL cp_fm_to_cfm(msourcer=rtbse_env%hartree_curr(j), mtarget=rtbse_env%ham_workspace(1))
697 cmplx(rtbse_env%spin_degeneracy, 0.0, kind=
dp), rtbse_env%ham_workspace(1))
701 CALL cp_cfm_transpose(rtbse_env%ham_effective(j),
'C', rtbse_env%ham_workspace(1))
703 cmplx(0.5, 0.0, kind=
dp), rtbse_env%ham_workspace(1))
705 CALL timestop(handle)
706 END SUBROUTINE update_effective_ham
717 SUBROUTINE etrs_scf_loop(rtbse_env, rho_start, rho_mid, rho_end, converged, k, metric)
719 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER :: rho_start, &
724 REAL(kind=
dp) :: metric
725 CHARACTER(len=*),
PARAMETER :: routinen =
"etrs_scf_loop"
728 CALL timeset(routinen, handle)
744 CALL update_effective_ham(rtbse_env, rho_start)
746 CALL ham_to_exp(rtbse_env, rtbse_env%ham_effective, rtbse_env%ham_workspace)
748 CALL propagate_density(rtbse_env, rtbse_env%ham_workspace, rho_start, rho_mid)
750 CALL propagate_density(rtbse_env, rtbse_env%ham_workspace, rho_mid, rtbse_env%rho_new_last)
752 rtbse_env%sim_step = rtbse_env%sim_step + 1
753 rtbse_env%sim_time = rtbse_env%sim_time + rtbse_env%sim_dt
756 DO k = 1, rtbse_env%etrs_max_iter
758 CALL update_effective_ham(rtbse_env, rtbse_env%rho_new_last)
759 CALL ham_to_exp(rtbse_env, rtbse_env%ham_effective, rtbse_env%ham_workspace)
761 CALL propagate_density(rtbse_env, rtbse_env%ham_workspace, rho_mid, rho_end)
763 metric = rho_metric(rho_end, rtbse_env%rho_new_last, rtbse_env%n_spin)
766 IF (metric < rtbse_env%etrs_threshold)
THEN
771 DO j = 1, rtbse_env%n_spin
778 CALL timestop(handle)
779 END SUBROUTINE etrs_scf_loop
790 SUBROUTINE bch_propagate(propagator_matrix, target_matrix, result_matrix, workspace, threshold_opt, max_iter_opt)
794 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER :: propagator_matrix
796 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER :: target_matrix
798 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER :: result_matrix, workspace
800 REAL(kind=
dp),
OPTIONAL :: threshold_opt
801 INTEGER,
OPTIONAL :: max_iter_opt
802 CHARACTER(len=*),
PARAMETER :: routinen =
"bch_propagate"
803 REAL(kind=
dp) :: threshold, prefactor, metric
804 INTEGER :: max_iter, i, n_spin, n_ao, k, &
807 CHARACTER(len=77) :: error
809 CALL timeset(routinen, handle)
813 IF (
PRESENT(threshold_opt))
THEN
814 threshold = threshold_opt
819 IF (
PRESENT(max_iter_opt))
THEN
820 max_iter = max_iter_opt
825 n_spin =
SIZE(target_matrix)
839 prefactor = 1.0_dp/real(k, kind=
dp)
842 cmplx(prefactor, 0.0, kind=
dp), propagator_matrix(i), workspace(i), &
843 cmplx(0.0, 0.0, kind=
dp), workspace(i + w_stride))
845 cmplx(prefactor, 0.0, kind=
dp), workspace(i), propagator_matrix(i), &
846 cmplx(1.0, 0.0, kind=
dp), workspace(i + w_stride))
849 cmplx(1.0, 0.0, kind=
dp), workspace(i + w_stride))
851 metric = rho_metric(workspace(w_stride + 1:), workspace(1:w_stride), n_spin)
852 IF (metric <= threshold)
THEN
861 IF (.NOT. converged)
THEN
862 WRITE (error,
'(A35,E13.4E3,A16,E13.4E3)')
"BCH did not converge, BCH Metric : ", &
863 metric,
"BCH Threshold : ", threshold
867 CALL timestop(handle)
868 END SUBROUTINE bch_propagate
876 SUBROUTINE propagate_density(rtbse_env, exponential, rho_old, rho_new)
878 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER :: exponential, &
881 CHARACTER(len=*),
PARAMETER :: routinen =
"propagate_density"
884 CALL timeset(routinen, handle)
885 IF (rtbse_env%mat_exp_method ==
do_exact)
THEN
887 DO j = 1, rtbse_env%n_spin
889 CALL parallel_gemm(
"N",
"C", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
890 cmplx(1.0, 0.0, kind=
dp), rho_old(j), exponential(j), &
891 cmplx(0.0, 0.0, kind=
dp), rtbse_env%rho_workspace(1))
893 CALL parallel_gemm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
894 cmplx(1.0, 0.0, kind=
dp), exponential(j), rtbse_env%rho_workspace(1), &
895 cmplx(0.0, 0.0, kind=
dp), rho_new(j))
897 ELSE IF (rtbse_env%mat_exp_method ==
do_bch)
THEN
899 CALL bch_propagate(exponential, rho_old, rho_new, rtbse_env%rho_workspace, threshold_opt=rtbse_env%exp_accuracy, &
900 max_iter_opt=rtbse_env%etrs_max_iter)
902 cpabort(
"Only BCH and exact matrix exponentiation implemented.")
905 CALL timestop(handle)
916 SUBROUTINE get_electron_number(rtbse_env, rho, electron_n_re, electron_n_im)
919 REAL(kind=
dp),
INTENT(OUT) :: electron_n_re, electron_n_im
920 COMPLEX(kind=dp) :: electron_n_buffer
923 electron_n_re = 0.0_dp
924 electron_n_im = 0.0_dp
925 CALL cp_fm_to_cfm(msourcer=rtbse_env%S_fm, mtarget=rtbse_env%rho_workspace(1))
926 DO j = 1, rtbse_env%n_spin
927 CALL cp_cfm_trace(rtbse_env%rho_workspace(1), rho(j), electron_n_buffer)
928 electron_n_re = electron_n_re + real(electron_n_buffer, kind=
dp)
929 electron_n_im = electron_n_im + real(aimag(electron_n_buffer), kind=
dp)
932 electron_n_re = electron_n_re*rtbse_env%spin_degeneracy
933 electron_n_im = electron_n_im*rtbse_env%spin_degeneracy
934 END SUBROUTINE get_electron_number
943 SUBROUTINE get_idempotence_deviation(rtbse_env, rho, deviation_metric)
946 REAL(kind=
dp),
INTENT(OUT) :: deviation_metric
947 COMPLEX(kind=dp) :: buffer_1, buffer_2
948 REAL(kind=
dp) :: buffer_dev
951 deviation_metric = 0.0_dp
954 CALL cp_fm_to_cfm(msourcer=rtbse_env%S_fm, mtarget=rtbse_env%rho_workspace(1))
955 DO j = 1, rtbse_env%n_spin
956 CALL cp_cfm_trace(rtbse_env%rho_workspace(1), rho(j), buffer_1)
957 buffer_dev = buffer_dev + real(abs(buffer_1)*abs(buffer_1), kind=
dp)
960 DO j = 1, rtbse_env%n_spin
962 CALL multiply_fm_cfm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
963 1.0_dp, rtbse_env%S_fm, rho(j), &
964 0.0_dp, rtbse_env%rho_workspace(2))
966 CALL parallel_gemm(
"N",
"N", rtbse_env%n_ao, rtbse_env%n_ao, rtbse_env%n_ao, &
967 cmplx(1.0, 0.0, kind=
dp), rho(j), rtbse_env%rho_workspace(2), &
968 cmplx(0.0, 0.0, kind=
dp), rtbse_env%rho_workspace(3))
970 CALL cp_cfm_trace(rtbse_env%rho_workspace(1), rtbse_env%rho_workspace(3), buffer_2)
971 deviation_metric = deviation_metric + real(abs(buffer_2)*abs(buffer_2), kind=
dp)
973 deviation_metric = sqrt(deviation_metric) - sqrt(buffer_dev)
974 END SUBROUTINE get_idempotence_deviation
985 SUBROUTINE get_sigma_complex(rtbse_env, sigma_cfm, prefactor_opt, greens_cfm)
988 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: prefactor_opt
990 REAL(kind=
dp) :: prefactor
993 IF (
PRESENT(prefactor_opt)) prefactor = prefactor_opt
997 CALL cp_cfm_to_fm(msource=greens_cfm, mtargetr=rtbse_env%real_workspace(1))
998 CALL get_sigma(rtbse_env, rtbse_env%real_workspace(2), prefactor, rtbse_env%real_workspace(1))
999 CALL cp_fm_to_cfm(msourcer=rtbse_env%real_workspace(2), mtarget=rtbse_env%ham_workspace(1))
1001 CALL cp_cfm_to_fm(msource=greens_cfm, mtargeti=rtbse_env%real_workspace(1))
1002 CALL get_sigma(rtbse_env, rtbse_env%real_workspace(2), prefactor, rtbse_env%real_workspace(1))
1003 CALL cp_fm_to_cfm(msourcei=rtbse_env%real_workspace(2), mtarget=sigma_cfm)
1006 cmplx(1.0, 0.0, kind=
dp), rtbse_env%ham_workspace(1))
1008 END SUBROUTINE get_sigma_complex
1018 SUBROUTINE get_sigma_real(rtbse_env, sigma_fm, prefactor_opt, greens_fm)
1021 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: prefactor_opt
1023 REAL(kind=
dp) :: prefactor
1026 IF (
PRESENT(prefactor_opt)) prefactor = prefactor_opt
1031 CALL get_sigma_dbcsr(rtbse_env, sigma_fm, prefactor, rtbse_env%rho_dbcsr)
1033 END SUBROUTINE get_sigma_real
1042 SUBROUTINE get_sigma_dbcsr(rtbse_env, sigma_fm, prefactor_opt, greens_dbcsr)
1045 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: prefactor_opt
1047 REAL(kind=
dp) :: prefactor
1050 IF (
PRESENT(prefactor_opt)) prefactor = prefactor_opt
1052 CALL get_sigma_noenv(sigma_fm, prefactor_opt, greens_dbcsr, &
1053 rtbse_env%screened_dbt, rtbse_env%t_3c_w, &
1054 rtbse_env%t_3c_work_RI_AO__AO, rtbse_env%t_3c_work2_RI_AO__AO, &
1055 rtbse_env%greens_dbt)
1056 END SUBROUTINE get_sigma_dbcsr
1072 SUBROUTINE get_sigma_noenv(sigma_fm, prefactor_opt, greens_dbcsr, screened_dbt, &
1073 int_3c_dbt, work_dbt_3c_1, work_dbt_3c_2, work_dbt_2c)
1075 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: prefactor_opt
1077 TYPE(dbt_type) :: screened_dbt, &
1082 CHARACTER(len=*),
PARAMETER :: routineN =
'get_sigma'
1083 REAL(kind=
dp) :: prefactor
1087 CALL timeset(routinen, handle)
1089 IF (
PRESENT(prefactor_opt))
THEN
1090 prefactor = prefactor_opt
1101 CALL dbt_contract(alpha=1.0_dp, &
1102 tensor_1=screened_dbt, &
1103 tensor_2=int_3c_dbt, &
1105 tensor_3=work_dbt_3c_1, &
1106 contract_1=[2], notcontract_1=[1], map_1=[1], &
1107 contract_2=[1], notcontract_2=[2, 3], map_2=[2, 3])
1111 CALL dbt_copy_matrix_to_tensor(greens_dbcsr, work_dbt_2c)
1114 CALL dbt_contract(alpha=1.0_dp, &
1115 tensor_1=work_dbt_3c_1, &
1116 tensor_2=work_dbt_2c, &
1118 tensor_3=work_dbt_3c_2, &
1119 contract_1=[2], notcontract_1=[1, 3], map_1=[1, 3], &
1120 contract_2=[2], notcontract_2=[1], map_2=[2])
1122 CALL dbt_contract(alpha=prefactor, &
1123 tensor_1=int_3c_dbt, &
1124 tensor_2=work_dbt_3c_2, &
1126 tensor_3=work_dbt_2c, &
1127 contract_1=[1, 3], notcontract_1=[2], map_1=[1], &
1128 contract_2=[1, 2], notcontract_2=[3], map_2=[2])
1132 CALL dbcsr_create(sigma_dbcsr, name=
"sigma", template=greens_dbcsr)
1133 CALL dbt_copy_tensor_to_matrix(work_dbt_2c, sigma_dbcsr)
1137 CALL dbt_clear(work_dbt_3c_1)
1138 CALL dbt_clear(work_dbt_3c_2)
1139 CALL dbt_clear(work_dbt_2c)
1140 CALL timestop(handle)
1142 END SUBROUTINE get_sigma_noenv
1150 SUBROUTINE init_hartree(rtbse_env, v_dbcsr)
1159 TYPE(
dbcsr_type),
DIMENSION(:),
ALLOCATABLE :: V_dbcsr_a, &
1164 bs_env => rtbse_env%bs_env
1167 ALLOCATE (v_dbcsr_a(1))
1168 ALLOCATE (metric_dbcsr(1))
1169 CALL dbcsr_create(v_dbcsr_a(1), name=
"Hartree_dbcsr", template=bs_env%mat_RI_RI%matrix)
1170 CALL dbcsr_create(metric_dbcsr(1), name=
"RI_metric_dbcsr", template=bs_env%mat_RI_RI%matrix)
1175 coulomb_op,
"Coulomb_neighbor_2c_list", rtbse_env%qs_env, &
1176 sym_ij=.false., molecular=.true.)
1178 bs_env%basis_set_RI, bs_env%basis_set_RI, coulomb_op, &
1179 do_kpoints=.false., regularization_ri=bs_env%regularization_RI)
1183 bs_env%ri_metric,
"Metric_neighbor_2c_list", rtbse_env%qs_env, &
1184 sym_ij=.false., molecular=.true.)
1186 bs_env%basis_set_RI, bs_env%basis_set_RI, bs_env%ri_metric, &
1187 do_kpoints=.false., regularization_ri=bs_env%regularization_RI)
1190 CALL cp_fm_create(metric_fm, bs_env%fm_RI_RI%matrix_struct)
1192 CALL cp_fm_create(metric_inv_fm, bs_env%fm_RI_RI%matrix_struct)
1194 CALL cp_fm_create(work_fm, bs_env%fm_RI_RI%matrix_struct)
1202 work_fm, bs_env%n_RI)
1203 CALL parallel_gemm(
"N",
"N", bs_env%n_RI, bs_env%n_RI, bs_env%n_RI, &
1204 1.0_dp, metric_inv_fm, work_fm, 0.0_dp, v_fm)
1215 DEALLOCATE (v_dbcsr_a)
1216 DEALLOCATE (metric_dbcsr)
1234 SUBROUTINE get_hartree_env(rtbse_env, rho_fm, v_fm)
1241 CALL get_qs_env(rtbse_env%qs_env, para_env=para_env, bs_env=bs_env)
1243 CALL get_hartree_noenv(v_fm, rho_fm, rtbse_env%int_3c_array, rtbse_env%v_dbcsr, &
1244 rtbse_env%n_RI, bs_env%sizes_RI, &
1245 para_env, rtbse_env%rho_dbcsr, rtbse_env%v_ao_dbcsr)
1246 END SUBROUTINE get_hartree_env
1262 SUBROUTINE get_hartree_noenv(v_fm, rho_fm, int_3c, v_dbcsr, n_RI, sizes_RI, para_env, rho_dbcsr, v_ao_dbcsr)
1265 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: int_3c
1268 INTEGER,
DIMENSION(:) :: sizes_ri
1271 CHARACTER(len=*),
PARAMETER :: routineN =
"get_hartree"
1273 INTEGER :: i, j, k, n, nblocks, ind_1, ind_2, row_offset, col_offset, &
1274 row_size, col_size, j_n_AO, k_n_AO, i_n_RI, &
1275 ri_offset, ind_i, handle
1276 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: pvector, qvector
1277 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: block_matrix
1278 INTEGER :: nblkrows_local, nblkcols_local, j_blk, k_blk, j_offset, k_offset
1279 INTEGER,
DIMENSION(:),
POINTER :: local_blk_rows, local_blk_cols
1283 mark_used(ri_offset)
1290 CALL timeset(routinen, handle)
1293 ALLOCATE (qvector(n_ri), source=0.0_dp)
1294 ALLOCATE (pvector(n_ri), source=0.0_dp)
1303 CALL dbcsr_get_info(rho_dbcsr, nblkrows_local=nblkrows_local, nblkcols_local=nblkcols_local, &
1304 local_rows=local_blk_rows, local_cols=local_blk_cols)
1305 DO j_blk = 1, nblkrows_local
1307 DO k_blk = 1, nblkcols_local
1310 CALL dbcsr_get_block_p(rho_dbcsr, local_blk_rows(j_blk), local_blk_cols(k_blk), &
1311 block=block_matrix, found=found, row_size=row_size, col_size=col_size)
1313 IF (.NOT. found) cycle
1320 qvector(i) = qvector(i) + int_3c(j_offset + j, k_offset + k, i)*block_matrix(j, k)
1326 k_offset = k_offset + col_size
1329 j_offset = j_offset + row_size
1333 CALL para_env%sum(qvector)
1341 row_offset=row_offset, col_offset=col_offset, row_size=row_size, col_size=col_size)
1343 j_n_ao = sizes_ri(ind_1)
1344 k_n_ao = sizes_ri(ind_2)
1350 pvector(j + row_offset - 1) = pvector(j + row_offset - 1) + block_matrix(j, k)*qvector(k + col_offset - 1)
1357 CALL para_env%sum(pvector)
1362 DO j_blk = 1, nblkrows_local
1364 DO k_blk = 1, nblkcols_local
1367 CALL dbcsr_get_block_p(v_ao_dbcsr, local_blk_rows(j_blk), local_blk_cols(k_blk), &
1368 block=block_matrix, found=found, row_size=row_size, col_size=col_size)
1370 IF (.NOT. found)
THEN
1372 CALL dbcsr_reserve_blocks(v_ao_dbcsr, local_blk_rows(j_blk:j_blk), local_blk_cols(k_blk:k_blk))
1374 CALL dbcsr_get_block_p(v_ao_dbcsr, local_blk_rows(j_blk), local_blk_cols(k_blk), &
1375 block=block_matrix, found=found, row_size=row_size, col_size=col_size)
1382 block_matrix(j, k) = 0.0_dp
1384 block_matrix(j, k) = block_matrix(j, k) + pvector(i)*int_3c(j_offset + j, k_offset + k, i)
1390 k_offset = k_offset + col_size
1393 j_offset = j_offset + row_size
1398 DEALLOCATE (qvector)
1399 DEALLOCATE (pvector)
1401 CALL timestop(handle)
1402 END SUBROUTINE get_hartree_noenv
1416 SUBROUTINE cp_cfm_gexp(amatrix, bmatrix, exponential, eig_scale_opt, work_opt)
1421 COMPLEX(kind=dp),
INTENT(IN),
OPTIONAL :: eig_scale_opt
1422 TYPE(
cp_cfm_type),
DIMENSION(:),
POINTER,
OPTIONAL :: work_opt
1423 CHARACTER(len=*),
PARAMETER :: routineN =
"cp_cfm_gexp"
1424 COMPLEX(kind=dp) :: eig_scale
1425 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: eigenvalues
1426 COMPLEX(kind=dp),
DIMENSION(:),
ALLOCATABLE :: expvalues
1428 LOGICAL :: deallocate_work
1429 INTEGER :: nrow, i, handle
1431 CALL timeset(routinen, handle)
1434 IF (
PRESENT(eig_scale_opt))
THEN
1435 eig_scale = eig_scale_opt
1437 eig_scale = cmplx(1.0, 0.0, kind=
dp)
1441 IF (
PRESENT(work_opt) .AND.
SIZE(work_opt) >= 4)
THEN
1442 deallocate_work = .false.
1445 deallocate_work = .true.
1453 nrow = amatrix%matrix_struct%nrow_global
1455 ALLOCATE (eigenvalues(nrow))
1456 ALLOCATE (expvalues(nrow))
1463 CALL cp_cfm_geeig(work(1), work(2), work(3), eigenvalues, work(4))
1466 expvalues(:) = exp(eigenvalues(:)*eig_scale)
1476 cmplx(1.0, 0.0, kind=
dp), work(1), work(3), &
1477 cmplx(0.0, 0.0, kind=
dp), work(2))
1480 cmplx(1.0, 0.0, kind=
dp), work(2), bmatrix, &
1481 cmplx(0.0, 0.0, kind=
dp), exponential)
1484 IF (deallocate_work)
THEN
1491 DEALLOCATE (eigenvalues)
1492 DEALLOCATE (expvalues)
1494 CALL timestop(handle)
1495 END SUBROUTINE cp_cfm_gexp
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_scale_and_add(alpha, matrix_a, beta, matrix_b)
Scale and add two BLACS matrices (a = alpha*a + beta*b).
real(kind=dp) function, public cp_cfm_norm(matrix, mode)
Norm of matrix using (p)zlange.
subroutine, public cp_cfm_transpose(matrix, trans, matrixt)
Transposes a BLACS distributed complex matrix.
subroutine, public cp_cfm_column_scale(matrix_a, scaling)
Scales columns of the full matrix by corresponding factors.
subroutine, public cp_cfm_trace(matrix_a, matrix_b, trace)
Returns the trace of matrix_a^T matrix_b, i.e sum_{i,j}(matrix_a(i,j)*matrix_b(i,j)) .
used for collecting diagonalization schemes available for cp_cfm_type
subroutine, public cp_cfm_geeig(amatrix, bmatrix, eigenvectors, eigenvalues, work)
General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_fm_to_cfm(msourcer, msourcei, mtarget)
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value f...
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
subroutine, public cp_cfm_to_fm(msource, mtargetr, mtargeti)
Copy real and imaginary parts of a complex full matrix into separate real-value full matrices.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
logical function, public dbcsr_has_symmetry(matrix)
...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
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_block_p(matrix, row, col, block, found, row_size, col_size)
...
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_reserve_blocks(matrix, rows, cols)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
integer function, public dbcsr_get_num_blocks(matrix)
...
subroutine, public dbcsr_clear(matrix)
...
subroutine, public dbcsr_put_block(matrix, row, col, block, summation)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_print(matrix, variable_name, unit_nr)
Prints given matrix in matlab format (only present blocks).
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
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
basic linear algebra operations for full matrices
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
subroutine, public cp_fm_transpose(matrix, matrixt)
transposes a matrix matrixt = matrix ^ T
real(kind=dp) function, public cp_fm_norm(matrix, mode)
norm of matrix using (p)dlange
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....
subroutine, public cp_fm_invert(matrix_a, matrix_inverse, det_a, eps_svd, eigval)
Inverts a cp_fm_type matrix, optionally returning the determinant of the input matrix.
subroutine, public cp_fm_scale(alpha, matrix_a)
scales a matrix matrix_a = alpha * matrix_b
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_geeig(amatrix, bmatrix, eigenvectors, eigenvalues, work)
General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B.
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_write_unformatted(fm, unit)
...
subroutine, public cp_fm_get_element(matrix, irow_global, icol_global, alpha, local)
returns an element of a fm this value is valid on every cpu using this call is expensive
subroutine, public cp_fm_read_unformatted(fm, unit)
...
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_set_element(matrix, irow_global, icol_global, alpha)
sets an element of a matrix
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
subroutine, public cp_fm_write_formatted(fm, unit, header, value_format)
Write out a full matrix in plain text.
This is the start of a dbt_api, all publically needed functions are exported here....
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 for the force calculations.
recursive subroutine, public force_env_calc_energy_force(force_env, calc_force, consistent_energies, skip_external_control, eval_energy_forces, require_consistent_energy_force, linres, calc_stress_tensor)
Interface routine for force and energy calculations.
Interface for the force calculations.
Utility method to build 3-center integrals for small cell GW.
subroutine, public build_3c_integral_block(int_3c, qs_env, potential_parameter, basis_j, basis_k, basis_i, cell_j, cell_k, cell_i, atom_j, atom_k, atom_i, j_bf_start_from_atom, k_bf_start_from_atom, i_bf_start_from_atom)
...
Routines from paper [Graml2024].
subroutine, public compute_3c_integrals(qs_env, bs_env, t_3c, atoms_ao_1, atoms_ao_2, atoms_ri)
...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
2- and 3-center electron repulsion integral routines based on libint2 Currently available operators: ...
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
Routines for calculating a complex matrix exponential.
subroutine, public taylor_full_complex(exp_h, re_part, im_part, nsquare, ntaylor)
subroutine for general complex matrix exponentials on input a separate cp_fm_type for real and comple...
Interface to the message passing library MPI.
Calculates the moment integrals <a|r^m|b>
subroutine, public get_reference_point(rpoint, drpoint, qs_env, fist_env, reference, ref_point, ifirst, ilast)
...
Framework for 2c-integrals for RI.
subroutine, public ri_2c_integral_mat(qs_env, fm_matrix_minv_l_kpoints, fm_matrix_l, dimen_ri, ri_metric, do_kpoints, kpoints, put_mat_ks_env, regularization_ri, ikp_ext, do_build_cell_index)
...
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public femtoseconds
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho, ks_env, soft_valid, compute_tau, compute_grad, basis_type, der_type, idir, task_list_external, pw_env_external)
computes the density corresponding to a given density matrix on the grid
Utility subroutine for qs energy calculation.
subroutine, public qs_energies_init(qs_env, calc_forces)
Refactoring of qs_energies_scf. Driver routine for the initial setup and calculations for a qs energy...
Utility subroutine for qs energy calculation.
subroutine, public qs_energies_properties(qs_env, calc_forces)
Refactoring of qs_energies_scf. Moves computation of properties into separate subroutine.
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.
Build up the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public integrate_v_rspace(v_rspace, hmat, hmat_kp, pmat, pmat_kp, qs_env, calculate_forces, force_adm, compute_tau, gapw, basis_type, pw_env_external, task_list_external)
computes matrix elements corresponding to a given potential
Define the quickstep kind type and their sub types.
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public qs_ks_build_kohn_sham_matrix(qs_env, calculate_forces, just_energy, print_active, ext_ks_matrix)
routine where the real calculations are made: the KS matrix is calculated
Definition and initialisation of the mo data type.
subroutine, public read_mo_set_from_restart(mo_array, atomic_kind_set, qs_kind_set, particle_set, para_env, id_nr, multiplicity, dft_section, natom_mismatch, cdft, out_unit)
...
Definition and initialisation of the mo data type.
subroutine, public init_mo_set(mo_set, fm_pool, fm_ref, fm_struct, name)
initializes an allocated mo_set. eigenvalues, mo_coeff, occupation_numbers are valid only after this ...
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)
...
subroutine, public build_berry_moment_matrix(qs_env, cosmat, sinmat, kvec, sab_orb_external, basis_type)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
Utility methods to build 3-center integral tensors of various types.
subroutine, public build_2c_integrals(t2c, filter_eps, qs_env, nl_2c, basis_i, basis_j, potential_parameter, do_kpoints, do_hfx_kpoints, ext_kpoints, regularization_ri)
...
subroutine, public build_2c_neighbor_lists(ij_list, basis_i, basis_j, potential_parameter, name, qs_env, sym_ij, molecular, dist_2d, pot_to_rad)
Build 2-center neighborlists adapted to different operators This mainly wraps build_neighbor_lists fo...
subroutine, public neighbor_list_3c_destroy(ijk_list)
Destroy 3c neighborlist.
Input/output from the propagation via RT-BSE method.
subroutine, public print_rtbse_header_info(rtbse_env)
Writes the header and basic info to the standard output.
subroutine, public output_restart(rtbse_env, rho, time_index)
Outputs the restart info (last finished iteration step) + restard density matrix.
subroutine, public print_etrs_info(rtbse_env, step, metric)
Writes the update after single etrs iteration - only for log level > medium.
subroutine, public read_field(rtbse_env)
Reads the field from the files provided by input - useful for the continuation run.
subroutine, public output_field(rtbse_env)
Prints the current field components into a file provided by input.
subroutine, public print_etrs_info_header(rtbse_env)
Writes the header for the etrs iteration updates - only for log level > medium.
subroutine, public output_mos_contravariant(rtbse_env, rho, print_key_section)
Outputs the matrix in MO basis for matrix coefficients corresponding to contravariant operator,...
subroutine, public read_moments(rtbse_env)
Reads the moments and time traces from the save files.
subroutine, public output_moments_ft(rtbse_env)
Outputs the Fourier transform of moments stored in the environment memory to the configured file.
subroutine, public read_restart(rtbse_env)
Reads the density matrix from restart files and updates the starting time.
subroutine, public print_timestep_info(rtbse_env, step, convergence, electron_num_re, etrs_num)
Writes the header for the etrs iteration updates - only for log level > medium.
subroutine, public output_polarizability(rtbse_env)
Outputs the isotropic polarizability tensor element alpha _ ij = mu_i(omega)/E_j(omega),...
subroutine, public output_moments(rtbse_env, rho)
Outputs the expectation value of moments from a given density matrix.
Data storage and other types for propagation via RT-BSE method.
subroutine, public release_rtbse_env(rtbse_env)
Releases the environment allocated structures.
subroutine, public multiply_cfm_fm(trans_c, trans_r, na, nb, nc, alpha, matrix_c, matrix_r, beta, res)
Multiplies complex matrix by a real matrix from the right.
subroutine, public create_rtbse_env(rtbse_env, qs_env, force_env)
Allocates structures and prepares rtbse_env for run.
subroutine, public multiply_fm_cfm(trans_r, trans_c, na, nb, nc, alpha, matrix_r, matrix_c, beta, res)
Multiplies real matrix by a complex matrix from the right.
Routines for the propagation via RT-BSE method.
subroutine, public run_propagation_bse(qs_env, force_env)
Runs the electron-only real time BSE propagation.
Routines for propagating the orbitals.
subroutine, public s_matrices_create(s_mat, rtp)
calculates the needed overlap-like matrices depending on the way the exponential is calculated,...
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 for that prepare rtp and EMD.
subroutine, public rt_initialize_rho_from_mos(rtp, mos, mos_old)
Computes the density matrix from the mos Update: Initialized the density matrix from complex mos (for...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Just to build arrays of pointers to matrices.
Represent a complex full matrix.
just to build arrays of pointers to matrices
wrapper to abstract the force evaluation of the various methods
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...