36#include "./base/base_uses.f90"
42 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mp2_grids'
73 do_im_time, do_ri_sos_laplace_mp2, do_print, tau_tj, tau_wj, qs_env, do_gw_im_time, &
74 do_kpoints_cubic_RPA, e_fermi, tj, wj, weights_cos_tf_t_to_w, &
75 weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, regularization)
78 INTEGER,
INTENT(IN) :: unit_nr
79 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
80 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
81 INTEGER,
INTENT(IN) :: num_integ_points
82 LOGICAL,
INTENT(IN) :: do_im_time, do_ri_sos_laplace_mp2, &
84 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
85 INTENT(OUT) :: tau_tj, tau_wj
87 LOGICAL,
INTENT(IN) :: do_gw_im_time, do_kpoints_cubic_rpa
88 REAL(kind=
dp),
INTENT(OUT) :: e_fermi
89 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
91 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
92 INTENT(OUT) :: weights_cos_tf_t_to_w, &
93 weights_cos_tf_w_to_t, &
95 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: regularization
97 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_minimax_grid'
98 INTEGER,
PARAMETER :: num_points_per_magnitude = 200
100 INTEGER :: handle, ierr, jquad, nspins
101 LOGICAL :: my_do_kpoints
102 REAL(kind=
dp) :: e_range, emax, emin, max_error_min, &
103 my_regularization, scaling
104 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: x_tw
106 CALL timeset(routinen, handle)
108 CALL determine_energy_range(qs_env, para_env, homo, eigenval, do_ri_sos_laplace_mp2, &
109 do_kpoints_cubic_rpa, emin, emax, e_range, e_fermi)
113 IF (
SIZE(homo) > 1)
THEN
114 CALL cp_hint(__location__, &
115 "Open-shell RPA/GW uses one minimax grid spanning [min gap, max span] across "// &
116 "both spin channels; raise QUADRATURE_POINTS if QP convergence is marginal for "// &
117 "strongly spin-asymmetric systems.")
121 tau_tj, tau_wj, qs_env%mp2_env%ri_g0w0%regularization_minimax, &
122 tj, wj, weights_cos_tf_t_to_w, &
123 weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, ierr)
127 CALL timestop(handle)
135 my_do_kpoints = .false.
136 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
137 my_do_kpoints = do_kpoints_cubic_rpa
140 my_regularization = 0.0_dp
141 IF (
PRESENT(regularization))
THEN
142 my_regularization = regularization
144 IF (num_integ_points > 20 .AND. e_range < 100.0_dp)
THEN
145 IF (unit_nr > 0)
THEN
146 CALL cp_warn(__location__, &
147 "You requested a large minimax grid (> 20 points) for a small minimax range R (R < 100). "// &
148 "That may lead to numerical "// &
149 "instabilities when computing minimax grid weights. You can prevent small ranges by choosing "// &
150 "a larger basis set with higher angular momenta or alternatively using all-electron calculations.")
154 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
155 ALLOCATE (x_tw(2*num_integ_points))
158 IF (num_integ_points <= 20)
THEN
164 ALLOCATE (tj(num_integ_points))
167 ALLOCATE (wj(num_integ_points))
170 DO jquad = 1, num_integ_points
171 tj(jquad) = x_tw(jquad)
172 wj(jquad) = x_tw(jquad + num_integ_points)
176 IF (num_integ_points >= 26)
THEN
182 IF (unit_nr > 0 .AND. do_print)
THEN
183 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
184 "MINIMAX_INFO| Number of integration points:", num_integ_points
185 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
186 "MINIMAX_INFO| Gap for the minimax approximation:", emin
187 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
188 "MINIMAX_INFO| Range for the minimax approximation:", e_range
189 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)")
"MINIMAX_INFO| Minimax parameters:",
"Weights",
"Abscissas"
190 DO jquad = 1, num_integ_points
191 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") wj(jquad), tj(jquad)
202 IF (do_im_time .OR. do_ri_sos_laplace_mp2)
THEN
204 ALLOCATE (x_tw(2*num_integ_points))
207 IF (num_integ_points <= 20)
THEN
215 IF (do_ri_sos_laplace_mp2) scaling = 1.0_dp
217 ALLOCATE (tau_tj(num_integ_points))
220 ALLOCATE (tau_wj(num_integ_points))
223 DO jquad = 1, num_integ_points
224 tau_tj(jquad) = x_tw(jquad)/scaling
225 tau_wj(jquad) = x_tw(jquad + num_integ_points)/scaling
230 IF (unit_nr > 0 .AND. do_print)
THEN
231 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
232 "MINIMAX_INFO| Range for the minimax approximation:", e_range
234 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
235 "MINIMAX_INFO| Gap:", emin
236 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)") &
237 "MINIMAX_INFO| Minimax parameters of the time grid:",
"Weights",
"Abscissas"
238 DO jquad = 1, num_integ_points
239 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") tau_wj(jquad), tau_tj(jquad)
245 tau_tj(:) = tau_tj(:)/emin
246 tau_wj(:) = tau_wj(:)/emin
248 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
249 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
250 weights_cos_tf_t_to_w = 0.0_dp
253 emin, emax, max_error_min, num_points_per_magnitude, &
257 ALLOCATE (weights_cos_tf_w_to_t(num_integ_points, num_integ_points))
258 weights_cos_tf_w_to_t = 0.0_dp
261 emin, emax, max_error_min, num_points_per_magnitude, &
264 IF (do_gw_im_time)
THEN
267 ALLOCATE (weights_sin_tf_t_to_w(num_integ_points, num_integ_points))
268 weights_sin_tf_t_to_w = 0.0_dp
271 emin, emax, max_error_min, num_points_per_magnitude, &
274 IF (unit_nr > 0)
THEN
275 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,ES15.2)") &
276 "MINIMAX_INFO| Maximum deviation of the imag. time fit:", max_error_min
285 CALL timestop(handle)
307 SUBROUTINE get_clenshaw_grid(para_env, para_env_RPA, unit_nr, homo, virtual, Eigenval, num_integ_points, &
308 num_integ_group, color_rpa_group, fm_mat_S, my_do_gw, &
309 ext_scaling, a_scaling, tj, wj)
312 INTEGER,
INTENT(IN) :: unit_nr
313 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
314 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
315 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
317 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
318 LOGICAL,
INTENT(IN) :: my_do_gw
319 REAL(kind=
dp),
INTENT(IN) :: ext_scaling
320 REAL(kind=
dp),
INTENT(OUT) :: a_scaling
321 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
322 INTENT(OUT) :: tj, wj
324 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_clenshaw_grid'
326 INTEGER :: handle, jquad, nspins
327 LOGICAL :: my_open_shell
329 CALL timeset(routinen, handle)
332 my_open_shell = (nspins == 2)
335 ALLOCATE (tj(num_integ_points))
338 ALLOCATE (wj(num_integ_points))
341 DO jquad = 1, num_integ_points - 1
342 tj(jquad) = jquad*
pi/(2.0_dp*num_integ_points)
343 wj(jquad) =
pi/(num_integ_points*sin(tj(jquad))**2)
345 tj(num_integ_points) =
pi/2.0_dp
346 wj(num_integ_points) =
pi/(2.0_dp*num_integ_points*sin(tj(num_integ_points))**2)
348 IF (my_do_gw .AND. ext_scaling > 0.0_dp)
THEN
349 a_scaling = ext_scaling
351 CALL calc_scaling_factor(a_scaling, para_env, para_env_rpa, homo, virtual, eigenval, &
352 num_integ_points, num_integ_group, color_rpa_group, &
356 IF (unit_nr > 0)
WRITE (unit_nr,
'(T3,A,T56,F25.5)')
'INTEG_INFO| Scaling parameter:', a_scaling
358 wj(:) = wj(:)*a_scaling
360 CALL timestop(handle)
379 SUBROUTINE calc_scaling_factor(a_scaling_ext, para_env, para_env_RPA, homo, virtual, Eigenval, &
380 num_integ_points, num_integ_group, color_rpa_group, &
381 tj_ext, wj_ext, fm_mat_S)
382 REAL(kind=
dp),
INTENT(OUT) :: a_scaling_ext
384 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
385 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
386 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
388 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
389 INTENT(IN) :: tj_ext, wj_ext
390 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
392 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_scaling_factor'
394 INTEGER :: handle, icycle, jquad, ncol_local, &
395 ncol_local_beta, nspins
396 LOGICAL :: my_open_shell
397 REAL(kind=
dp) :: a_high, a_low, a_scaling, conv_param, eps, first_deriv, left_term, &
398 right_term, right_term_ref, right_term_ref_beta, step
399 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cottj, d_ia, d_ia_beta, iaia_ri, &
400 iaia_ri_beta, m_ia, m_ia_beta
403 CALL timeset(routinen, handle)
406 my_open_shell = (nspins == 2)
410 ALLOCATE (cottj(num_integ_points))
413 DO jquad = 1, num_integ_points
414 cottj(jquad) = 1.0_dp/tan(tj_ext(jquad))
417 CALL calc_ia_ia_integrals(para_env_rpa, homo(1), virtual(1), ncol_local, right_term_ref, eigenval(:, 1, 1), &
418 d_ia, iaia_ri, m_ia, fm_mat_s(1), para_env_col)
421 IF (my_open_shell)
THEN
422 CALL calc_ia_ia_integrals(para_env_rpa, homo(2), virtual(2), ncol_local_beta, right_term_ref_beta, eigenval(:, 1, 2), &
423 d_ia_beta, iaia_ri_beta, m_ia_beta, fm_mat_s(2), para_env_col_beta)
425 right_term_ref = right_term_ref + right_term_ref_beta
429 IF (para_env%mepos == 0)
THEN
430 CALL para_env%bcast(right_term_ref, 0)
432 right_term_ref = 0.0_dp
433 CALL para_env%bcast(right_term_ref, 0)
438 conv_param = 100.0_dp*epsilon(right_term_ref)
442 right_term = -right_term_ref
443 DO icycle = 1, num_integ_points*2
446 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
447 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
448 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
449 para_env, para_env_col, para_env_col_beta)
450 left_term = left_term/4.0_dp/
pi*a_scaling
452 IF (abs(left_term) > abs(right_term) .OR. abs(left_term + right_term) <= conv_param)
EXIT
454 a_high = a_high + step
458 IF (abs(left_term + right_term) >= conv_param)
THEN
459 IF (a_scaling >= 2*num_integ_points*step)
THEN
463 DO icycle = 1, num_integ_points*2
464 a_scaling = (a_low + a_high)/2.0_dp
466 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
467 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
468 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
469 para_env, para_env_col, para_env_col_beta)
470 left_term = left_term/4.0_dp/
pi*a_scaling
472 IF (abs(left_term) > abs(right_term))
THEN
478 IF (abs(a_high - a_low) < 1.0e-5_dp)
EXIT
485 a_scaling_ext = a_scaling
486 CALL para_env%bcast(a_scaling_ext, 0)
494 IF (my_open_shell)
THEN
495 DEALLOCATE (iaia_ri_beta)
496 DEALLOCATE (d_ia_beta)
497 DEALLOCATE (m_ia_beta)
501 CALL timestop(handle)
503 END SUBROUTINE calc_scaling_factor
519 SUBROUTINE calc_ia_ia_integrals(para_env_RPA, homo, virtual, ncol_local, right_term_ref, Eigenval, &
520 D_ia, iaia_RI, M_ia, fm_mat_S, para_env_col)
523 INTEGER,
INTENT(IN) :: homo, virtual
524 INTEGER,
INTENT(OUT) :: ncol_local
525 REAL(kind=
dp),
INTENT(OUT) :: right_term_ref
526 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval
527 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
528 INTENT(OUT) :: d_ia, iaia_ri, m_ia
532 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_ia_ia_integrals'
534 INTEGER :: avirt, color_col, color_row, handle, &
535 i_global, iib, iocc, nrow_local
536 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
537 REAL(kind=
dp) :: eigen_diff
538 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: iaia_ri_dp
541 CALL timeset(routinen, handle)
547 nrow_local=nrow_local, &
548 ncol_local=ncol_local, &
549 row_indices=row_indices, &
550 col_indices=col_indices)
553 ALLOCATE (iaia_ri_dp(ncol_local))
557 DO iib = 1, ncol_local
558 iaia_ri_dp(iib) = iaia_ri_dp(iib) + dot_product(fm_mat_s%local_data(:, iib), fm_mat_s%local_data(:, iib))
577 color_col = fm_mat_s%matrix_struct%context%mepos(2)
578 ALLOCATE (para_env_col)
579 CALL para_env_col%from_split(para_env_rpa, color_col)
581 CALL para_env_col%sum(iaia_ri_dp)
584 ALLOCATE (iaia_ri(ncol_local))
585 DO iib = 1, ncol_local
586 iaia_ri(iib) = iaia_ri_dp(iib)
588 DEALLOCATE (iaia_ri_dp)
593 ALLOCATE (d_ia(ncol_local))
595 ALLOCATE (m_ia(ncol_local))
597 DO iib = 1, ncol_local
598 i_global = col_indices(iib)
600 iocc = max(1, i_global - 1)/virtual + 1
601 avirt = i_global - (iocc - 1)*virtual
602 eigen_diff = eigenval(avirt + homo) - eigenval(iocc)
604 d_ia(iib) = eigen_diff
607 DO iib = 1, ncol_local
608 m_ia(iib) = d_ia(iib)*d_ia(iib) + 2.0_dp*d_ia(iib)*iaia_ri(iib)
611 right_term_ref = 0.0_dp
612 DO iib = 1, ncol_local
613 right_term_ref = right_term_ref + (sqrt(m_ia(iib)) - d_ia(iib) - iaia_ri(iib))
615 right_term_ref = right_term_ref/2.0_dp
618 color_row = fm_mat_s%matrix_struct%context%mepos(1)
619 ALLOCATE (para_env_row)
620 CALL para_env_row%from_split(para_env_rpa, color_row)
623 CALL para_env_row%sum(right_term_ref)
627 CALL timestop(handle)
629 END SUBROUTINE calc_ia_ia_integrals
652 SUBROUTINE calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
653 M_ia, cottj, wj, D_ia, D_ia_beta, M_ia_beta, &
654 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
655 para_env, para_env_col, para_env_col_beta)
656 REAL(kind=
dp),
INTENT(IN) :: a_scaling
657 REAL(kind=
dp),
INTENT(INOUT) :: left_term, first_deriv
658 INTEGER,
INTENT(IN) :: num_integ_points
659 LOGICAL,
INTENT(IN) :: my_open_shell
660 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
661 INTENT(IN) :: m_ia, cottj, wj, d_ia, d_ia_beta, &
663 INTEGER,
INTENT(IN) :: ncol_local, ncol_local_beta, &
664 num_integ_group, color_rpa_group
668 INTEGER :: iib, jquad
669 REAL(kind=
dp) :: first_deriv_beta, left_term_beta, omega
673 left_term_beta = 0.0_dp
674 first_deriv_beta = 0.0_dp
675 DO jquad = 1, num_integ_points
677 IF (
modulo(jquad, num_integ_group) /= color_rpa_group) cycle
678 omega = a_scaling*cottj(jquad)
680 DO iib = 1, ncol_local
682 IF (
modulo(iib, para_env_col%num_pe) /= para_env_col%mepos) cycle
684 left_term = left_term + wj(jquad)* &
685 (log(1.0_dp + (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2)) - &
686 (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2))
687 first_deriv = first_deriv + wj(jquad)*cottj(jquad)**2* &
688 ((-m_ia(iib) + d_ia(iib)**2)**2/((omega**2 + d_ia(iib)**2)**2*(omega**2 + m_ia(iib))))
691 IF (my_open_shell)
THEN
692 DO iib = 1, ncol_local_beta
694 IF (
modulo(iib, para_env_col_beta%num_pe) /= para_env_col_beta%mepos) cycle
696 left_term_beta = left_term_beta + wj(jquad)* &
697 (log(1.0_dp + (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2)) - &
698 (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2))
700 first_deriv_beta + wj(jquad)*cottj(jquad)**2* &
701 ((-m_ia_beta(iib) + d_ia_beta(iib)**2)**2/((omega**2 + d_ia_beta(iib)**2)**2*(omega**2 + m_ia_beta(iib))))
708 CALL para_env%sum(left_term)
709 CALL para_env%sum(first_deriv)
711 IF (my_open_shell)
THEN
712 CALL para_env%sum(left_term_beta)
713 CALL para_env%sum(first_deriv_beta)
715 left_term = left_term + left_term_beta
716 first_deriv = first_deriv + first_deriv_beta
719 END SUBROUTINE calculate_objfunc
734 E_min, E_max, max_error, num_points_per_magnitude, &
737 INTEGER,
INTENT(IN) :: num_integ_points
738 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
740 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
741 INTENT(INOUT) :: weights_cos_tf_t_to_w
742 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
743 INTENT(IN) :: omega_tj
744 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
745 REAL(kind=
dp),
INTENT(INOUT) :: max_error
746 INTEGER,
INTENT(IN) :: num_points_per_magnitude
747 REAL(kind=
dp),
INTENT(IN) :: regularization
749 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_t_to_w'
751 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
753 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
754 REAL(kind=
dp) :: multiplicator, omega
755 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
757 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
758 mat_sinvvsinvt, mat_u
760 CALL timeset(routinen, handle)
763 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
767 num_x_nodes = max(num_x_nodes, num_integ_points)
769 ALLOCATE (x_values(num_x_nodes))
771 ALLOCATE (y_values(num_x_nodes))
773 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
775 ALLOCATE (tau_wj_work(num_integ_points))
777 ALLOCATE (sing_values(num_integ_points))
779 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
781 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
783 mat_sinvvsinvt = 0.0_dp
785 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
786 ALLOCATE (work(lwork))
788 ALLOCATE (iwork(8*num_integ_points))
790 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
791 mat_sinvvsinvsigma = 0.0_dp
792 ALLOCATE (vec_uty(num_x_nodes))
798 DO jquad = 1, num_integ_points
801 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
802 DO iii = 1, num_x_nodes
803 x_values(iii) = e_min*multiplicator**(iii - 1)
806 omega = omega_tj(jquad)
809 DO iii = 1, num_x_nodes
810 y_values(iii) = 2.0_dp*x_values(iii)/((x_values(iii))**2 + omega**2)
814 DO jjj = 1, num_integ_points
815 DO iii = 1, num_x_nodes
816 mat_a(iii, jjj) = cos(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
821 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
822 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
828 DO jjj = 1, num_integ_points
829 DO iii = 1, num_integ_points
831 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
832 /(regularization**2 + sing_values(jjj)**2)
837 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
838 0.0_dp, vec_uty, num_x_nodes)
841 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
842 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
844 weights_cos_tf_t_to_w(jquad, :) = tau_wj_work(:)
846 CALL calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
847 y_values, num_integ_points, num_x_nodes)
851 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, sing_values, mat_u, mat_sinvvsinvt, &
852 work, iwork, mat_sinvvsinvsigma, vec_uty)
854 CALL timestop(handle)
871 E_min, E_max, max_error, num_points_per_magnitude, regularization)
873 INTEGER,
INTENT(IN) :: num_integ_points
874 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
876 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
877 INTENT(INOUT) :: weights_sin_tf_t_to_w
878 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
879 INTENT(IN) :: omega_tj
880 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
881 REAL(kind=
dp),
INTENT(OUT) :: max_error
882 INTEGER,
INTENT(IN) :: num_points_per_magnitude
883 REAL(kind=
dp),
INTENT(IN) :: regularization
885 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_sin_tf_t_to_w'
887 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
889 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
890 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega
891 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
892 work_array, x_values, y_values
893 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
894 mat_sinvvsinvt, mat_u
896 CALL timeset(routinen, handle)
899 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
903 num_x_nodes = max(num_x_nodes, num_integ_points)
905 ALLOCATE (x_values(num_x_nodes))
907 ALLOCATE (y_values(num_x_nodes))
909 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
911 ALLOCATE (tau_wj_work(num_integ_points))
913 ALLOCATE (work_array(2*num_integ_points))
915 ALLOCATE (sing_values(num_integ_points))
917 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
919 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
921 mat_sinvvsinvt = 0.0_dp
923 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
924 ALLOCATE (work(lwork))
926 ALLOCATE (iwork(8*num_integ_points))
928 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
929 mat_sinvvsinvsigma = 0.0_dp
930 ALLOCATE (vec_uty(num_x_nodes))
936 DO jquad = 1, num_integ_points
938 chi2_min_jquad = 100.0_dp
941 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
942 DO iii = 1, num_x_nodes
943 x_values(iii) = e_min*multiplicator**(iii - 1)
946 omega = omega_tj(jquad)
949 DO iii = 1, num_x_nodes
951 y_values(iii) = 2.0_dp*omega/((x_values(iii))**2 + omega**2)
955 DO jjj = 1, num_integ_points
956 DO iii = 1, num_x_nodes
957 mat_a(iii, jjj) = sin(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
962 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
963 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
969 DO jjj = 1, num_integ_points
970 DO iii = 1, num_integ_points
972 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
973 /(regularization**2 + sing_values(jjj)**2)
978 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
979 0.0_dp, vec_uty, num_x_nodes)
982 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
983 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
985 weights_sin_tf_t_to_w(jquad, :) = tau_wj_work(:)
987 CALL calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
988 y_values, num_integ_points, num_x_nodes)
992 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
993 work, iwork, mat_sinvvsinvsigma, vec_uty)
995 CALL timestop(handle)
1010 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1011 y_values, num_integ_points, num_x_nodes)
1013 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1014 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1015 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1016 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1019 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1021 max_error_tmp = 0.0_dp
1023 DO kkk = 1, num_x_nodes
1027 CALL eval_fit_func_tau_grid_cosine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1029 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1030 max_error_tmp = abs(y_values(kkk) - func_val)
1031 func_val_temp = func_val
1036 IF (max_error_tmp > max_error)
THEN
1038 max_error = max_error_tmp
1042 END SUBROUTINE calc_max_error_fit_tau_grid_with_cosine
1053 PURE SUBROUTINE eval_fit_func_tau_grid_cosine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1055 REAL(kind=
dp),
INTENT(OUT) :: func_val
1056 REAL(kind=
dp),
INTENT(IN) :: x_value
1057 INTEGER,
INTENT(IN) :: num_integ_points
1058 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1059 INTENT(IN) :: tau_tj, tau_wj_work
1060 REAL(kind=
dp),
INTENT(IN) :: omega
1066 DO iii = 1, num_integ_points
1069 func_val = func_val + tau_wj_work(iii)*cos(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1073 END SUBROUTINE eval_fit_func_tau_grid_cosine
1084 PURE SUBROUTINE eval_fit_func_tau_grid_sine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1086 REAL(kind=
dp),
INTENT(INOUT) :: func_val
1087 REAL(kind=
dp),
INTENT(IN) :: x_value
1088 INTEGER,
INTENT(in) :: num_integ_points
1089 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1090 INTENT(IN) :: tau_tj, tau_wj_work
1091 REAL(kind=
dp),
INTENT(IN) :: omega
1097 DO iii = 1, num_integ_points
1100 func_val = func_val + tau_wj_work(iii)*sin(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1104 END SUBROUTINE eval_fit_func_tau_grid_sine
1117 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1118 y_values, num_integ_points, num_x_nodes)
1120 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1121 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1122 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1123 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1126 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1128 max_error_tmp = 0.0_dp
1130 DO kkk = 1, num_x_nodes
1134 CALL eval_fit_func_tau_grid_sine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1136 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1137 max_error_tmp = abs(y_values(kkk) - func_val)
1138 func_val_temp = func_val
1143 IF (max_error_tmp > max_error)
THEN
1145 max_error = max_error_tmp
1149 END SUBROUTINE calc_max_error_fit_tau_grid_with_sine
1158 INTEGER,
INTENT(IN) :: nr, iw
1160 INTEGER :: ierr, ir, jquad, num_integ_points
1161 REAL(kind=
dp) :: max_error, multiplicator, rc, rc_max
1162 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: tau_tj, tau_wj, tj, wj, x_tw
1163 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: weights_cos_tf_t_to_w
1167 multiplicator = rc_max**(1.0_dp/(real(nr, kind=
dp) - 1.0_dp))
1169 DO num_integ_points = 1, 20
1171 ALLOCATE (x_tw(2*num_integ_points))
1173 ALLOCATE (tau_tj(num_integ_points))
1175 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
1176 weights_cos_tf_t_to_w = 0.0_dp
1177 ALLOCATE (tau_wj(num_integ_points))
1179 ALLOCATE (tj(num_integ_points))
1181 ALLOCATE (wj(num_integ_points))
1186 rc = 2.0_dp*multiplicator**ir
1191 DO jquad = 1, num_integ_points
1192 tj(jquad) = x_tw(jquad)
1193 wj(jquad) = x_tw(jquad + num_integ_points)
1200 DO jquad = 1, num_integ_points
1201 tau_tj(jquad) = x_tw(jquad)/2.0_dp
1202 tau_wj(jquad) = x_tw(jquad + num_integ_points)/2.0_dp
1206 weights_cos_tf_t_to_w, tj, &
1207 1.0_dp, rc, max_error, 200, 0.0_dp)
1210 WRITE (iw,
'(T2, I3, F12.1, ES12.3)') num_integ_points, rc, max_error
1215 DEALLOCATE (x_tw, tau_tj, weights_cos_tf_t_to_w, tau_wj, wj, tj)
1234 E_min, E_max, max_error, num_points_per_magnitude, regularization)
1236 INTEGER,
INTENT(IN) :: num_integ_points
1237 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1238 INTENT(IN) :: tau_tj
1239 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
1240 INTENT(INOUT) :: weights_cos_tf_w_to_t
1241 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1242 INTENT(IN) :: omega_tj
1243 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
1244 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1245 INTEGER,
INTENT(IN) :: num_points_per_magnitude
1246 REAL(kind=
dp),
INTENT(IN) :: regularization
1248 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_w_to_t'
1250 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
1252 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1253 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega, &
1255 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: omega_wj_work, sing_values, vec_uty, &
1256 work, work_array, x_values, y_values
1257 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
1258 mat_sinvvsinvt, mat_u
1260 CALL timeset(routinen, handle)
1263 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
1267 num_x_nodes = max(num_x_nodes, num_integ_points)
1269 ALLOCATE (x_values(num_x_nodes))
1271 ALLOCATE (y_values(num_x_nodes))
1273 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
1275 ALLOCATE (omega_wj_work(num_integ_points))
1276 omega_wj_work = 0.0_dp
1277 ALLOCATE (work_array(2*num_integ_points))
1279 ALLOCATE (sing_values(num_integ_points))
1280 sing_values = 0.0_dp
1281 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
1283 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
1285 mat_sinvvsinvt = 0.0_dp
1287 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
1288 ALLOCATE (work(lwork))
1290 ALLOCATE (iwork(8*num_integ_points))
1292 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
1293 mat_sinvvsinvsigma = 0.0_dp
1294 ALLOCATE (vec_uty(num_x_nodes))
1298 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
1299 DO iii = 1, num_x_nodes
1300 x_values(iii) = e_min*multiplicator**(iii - 1)
1306 DO jquad = 1, num_integ_points
1308 chi2_min_jquad = 100.0_dp
1313 DO iii = 1, num_x_nodes
1314 y_values(iii) = exp(-x_values(iii)*tau)
1318 DO jjj = 1, num_integ_points
1319 DO iii = 1, num_x_nodes
1320 omega = omega_tj(jjj)
1321 x_value = x_values(iii)
1322 mat_a(iii, jjj) = cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1327 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
1328 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
1334 DO jjj = 1, num_integ_points
1335 DO iii = 1, num_integ_points
1337 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
1338 /(regularization**2 + sing_values(jjj)**2)
1343 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
1344 0.0_dp, vec_uty, num_x_nodes)
1347 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
1348 num_x_nodes, 0.0_dp, omega_wj_work, num_integ_points)
1350 weights_cos_tf_w_to_t(jquad, :) = omega_wj_work(:)
1352 CALL calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1353 y_values, num_integ_points, num_x_nodes)
1357 DEALLOCATE (x_values, y_values, mat_a, omega_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
1358 work, iwork, mat_sinvvsinvsigma, vec_uty)
1360 CALL timestop(handle)
1375 SUBROUTINE calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1376 y_values, num_integ_points, num_x_nodes)
1378 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1379 REAL(kind=
dp),
INTENT(IN) :: tau
1380 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1381 INTENT(IN) :: omega_tj, omega_wj_work, x_values, &
1383 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1385 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_max_error_fit_omega_grid_with_cosine'
1387 INTEGER :: handle, kkk
1388 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1390 CALL timeset(routinen, handle)
1392 max_error_tmp = 0.0_dp
1394 DO kkk = 1, num_x_nodes
1398 CALL eval_fit_func_omega_grid_cosine(func_val, x_values(kkk), num_integ_points, omega_tj, omega_wj_work, tau)
1400 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1401 max_error_tmp = abs(y_values(kkk) - func_val)
1402 func_val_temp = func_val
1407 IF (max_error_tmp > max_error)
THEN
1409 max_error = max_error_tmp
1413 CALL timestop(handle)
1415 END SUBROUTINE calc_max_error_fit_omega_grid_with_cosine
1426 PURE SUBROUTINE eval_fit_func_omega_grid_cosine(func_val, x_value, num_integ_points, omega_tj, omega_wj_work, tau)
1427 REAL(kind=
dp),
INTENT(OUT) :: func_val
1428 REAL(kind=
dp),
INTENT(IN) :: x_value
1429 INTEGER,
INTENT(IN) :: num_integ_points
1430 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1431 INTENT(IN) :: omega_tj, omega_wj_work
1432 REAL(kind=
dp),
INTENT(IN) :: tau
1435 REAL(kind=
dp) :: omega
1439 DO iii = 1, num_integ_points
1442 omega = omega_tj(iii)
1443 func_val = func_val + omega_wj_work(iii)*cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1447 END SUBROUTINE eval_fit_func_omega_grid_cosine
1457 SUBROUTINE gap_and_max_eig_diff_kpoints(qs_env, para_env, gap, max_eig_diff, e_fermi)
1461 REAL(kind=
dp),
INTENT(OUT) :: gap, max_eig_diff, e_fermi
1463 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gap_and_max_eig_diff_kpoints'
1465 INTEGER :: handle, homo, ikpgr, ispin, kplocal, &
1467 INTEGER,
DIMENSION(2) :: kp_range
1468 REAL(kind=
dp) :: e_homo, e_homo_temp, e_lumo, e_lumo_temp
1469 REAL(kind=
dp),
DIMENSION(3) :: tmp
1470 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1475 CALL timeset(routinen, handle)
1480 mo_set => kpoint%kp_env(1)%kpoint_env%mos(1, 1)
1484 kplocal = kp_range(2) - kp_range(1) + 1
1487 max_eig_diff = 0.0_dp
1491 DO ikpgr = 1, kplocal
1492 kp => kpoint%kp_env(ikpgr)%kpoint_env
1493 nspin =
SIZE(kp%mos, 2)
1495 mo_set => kp%mos(1, ispin)
1496 CALL get_mo_set(mo_set, eigenvalues=eigenvalues, homo=homo)
1497 e_homo_temp = eigenvalues(homo)
1498 e_lumo_temp = eigenvalues(homo + 1)
1500 IF (e_homo_temp > e_homo) e_homo = e_homo_temp
1501 IF (e_lumo_temp < e_lumo) e_lumo = e_lumo_temp
1502 IF (eigenvalues(nmo) - eigenvalues(1) > max_eig_diff) max_eig_diff = eigenvalues(nmo) - eigenvalues(1)
1511 tmp(3) = max_eig_diff
1512 CALL para_env%max(tmp)
1514 gap = -tmp(2) - tmp(1)
1515 e_fermi = (tmp(1) - tmp(2))*0.5_dp
1516 max_eig_diff = tmp(3)
1518 CALL timestop(handle)
1520 END SUBROUTINE gap_and_max_eig_diff_kpoints
1535 SUBROUTINE determine_energy_range(qs_env, para_env, homo, Eigenval, do_ri_sos_laplace_mp2, &
1536 do_kpoints_cubic_RPA, Emin, Emax, e_range, e_fermi)
1540 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
1541 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
1542 LOGICAL,
INTENT(IN) :: do_ri_sos_laplace_mp2, &
1543 do_kpoints_cubic_rpa
1544 REAL(kind=
dp),
INTENT(OUT) :: emin, emax, e_range, e_fermi
1546 CHARACTER(LEN=*),
PARAMETER :: routinen =
'determine_energy_range'
1548 INTEGER :: handle, ispin, nspins
1549 LOGICAL :: my_do_kpoints
1552 CALL timeset(routinen, handle)
1557 my_do_kpoints = .false.
1558 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1559 my_do_kpoints = do_kpoints_cubic_rpa
1562 IF (my_do_kpoints)
THEN
1563 CALL gap_and_max_eig_diff_kpoints(qs_env, para_env, emin, emax, e_fermi)
1566 IF (qs_env%mp2_env%E_range <= 1.0_dp .OR. qs_env%mp2_env%E_gap <= 0.0_dp)
THEN
1569 DO ispin = 1, nspins
1570 IF (homo(ispin) > 0)
THEN
1571 emin = min(emin, eigenval(homo(ispin) + 1, 1, ispin) - eigenval(homo(ispin), 1, ispin))
1572 emax = max(emax, maxval(eigenval(:, :, ispin)) - minval(eigenval(:, :, ispin)))
1576 qs_env%mp2_env%e_range = e_range
1577 qs_env%mp2_env%e_gap = emin
1583 e_range = qs_env%mp2_env%E_range
1584 emin = qs_env%mp2_env%E_gap
1592 IF (do_ri_sos_laplace_mp2)
THEN
1597 CALL timestop(handle)
1598 END SUBROUTINE determine_energy_range
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and 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
Interface to the Greenx library.
subroutine, public greenx_get_minimax_grid(unit_nr, num_integ_points, emin, emax, tau_tj, tau_wj, regularization_minimax, tj, wj, weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, ierr)
...
Defines the basic variable types.
integer, parameter, public dp
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered, lattice_fft)
Retrieve information from a kpoint environment.
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 pi
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
Routines to calculate the minimax coefficients in order to approximate 1/x as a sum over exponential ...
subroutine, public get_exp_minimax_coeff_gw(k, e_range, aw)
...
Routines to calculate the minimax coefficients in order to approximate 1/x as a sum over exponential ...
subroutine, public get_exp_minimax_coeff(k, rc, aw, mm_error, which_coeffs)
Get best minimax approximation for given input parameters. Automatically chooses the most exact set o...
Routines to calculate the minimax coefficients for approximating 1/x as 1/x ~ 1/pi SUM_{i}^{K} w_i x^...
subroutine, public get_rpa_minimax_coeff_larger_grid(k, e_range, aw)
...
subroutine, public get_rpa_minimax_coeff(k, e_range, aw, ierr, print_warning)
The a_i and w_i coefficient are stored in aw such that the first 1:K elements correspond to a_i and t...
Routines to calculate frequency and time grids (integration points and weights) for correlation metho...
subroutine, public get_minimax_grid(para_env, unit_nr, homo, eigenval, num_integ_points, do_im_time, do_ri_sos_laplace_mp2, do_print, tau_tj, tau_wj, qs_env, do_gw_im_time, do_kpoints_cubic_rpa, e_fermi, tj, wj, weights_cos_tf_t_to_w, weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, regularization)
...
subroutine, public get_l_sq_wghts_cos_tf_w_to_t(num_integ_points, tau_tj, weights_cos_tf_w_to_t, omega_tj, e_min, e_max, max_error, num_points_per_magnitude, regularization)
...
subroutine, public get_l_sq_wghts_cos_tf_t_to_w(num_integ_points, tau_tj, weights_cos_tf_t_to_w, omega_tj, e_min, e_max, max_error, num_points_per_magnitude, regularization)
Calculate integration weights for the tau grid (in dependency of the omega node)
subroutine, public get_l_sq_wghts_sin_tf_t_to_w(num_integ_points, tau_tj, weights_sin_tf_t_to_w, omega_tj, e_min, e_max, max_error, num_points_per_magnitude, regularization)
Calculate integration weights for the tau grid (in dependency of the omega node)
subroutine, public test_least_square_ft(nr, iw)
test the singular value decomposition for the computation of integration weights for the Fourier tran...
subroutine, public get_clenshaw_grid(para_env, para_env_rpa, unit_nr, homo, virtual, eigenval, num_integ_points, num_integ_group, color_rpa_group, fm_mat_s, my_do_gw, ext_scaling, a_scaling, tj, wj)
...
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.
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Keeps information about a specific k-point.
Contains information about kpoints.
stores all the informations relevant to an mpi environment