35#include "./base/base_uses.f90"
41 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mp2_grids'
72 do_im_time, do_ri_sos_laplace_mp2, do_print, tau_tj, tau_wj, qs_env, do_gw_im_time, &
73 do_kpoints_cubic_RPA, e_fermi, tj, wj, weights_cos_tf_t_to_w, &
74 weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, regularization)
77 INTEGER,
INTENT(IN) :: unit_nr
78 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
79 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
80 INTEGER,
INTENT(IN) :: num_integ_points
81 LOGICAL,
INTENT(IN) :: do_im_time, do_ri_sos_laplace_mp2, &
83 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
84 INTENT(OUT) :: tau_tj, tau_wj
86 LOGICAL,
INTENT(IN) :: do_gw_im_time, do_kpoints_cubic_rpa
87 REAL(kind=
dp),
INTENT(OUT) :: e_fermi
88 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
89 INTENT(INOUT) :: tj, wj
90 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
91 INTENT(OUT) :: weights_cos_tf_t_to_w, &
92 weights_cos_tf_w_to_t, &
94 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: regularization
96 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_minimax_grid'
97 INTEGER,
PARAMETER :: num_points_per_magnitude = 200
99 INTEGER :: handle, ierr, ispin, jquad, nspins
100 LOGICAL :: my_do_kpoints, my_open_shell
101 REAL(kind=
dp) :: emax, emin, max_error_min, my_e_range, &
102 my_regularization, scaling
103 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: x_tw
106 CALL timeset(routinen, handle)
110 my_open_shell = (nspins == 2)
113 my_do_kpoints = .false.
114 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
115 my_do_kpoints = do_kpoints_cubic_rpa
118 my_regularization = 0.0_dp
119 IF (
PRESENT(regularization))
THEN
120 my_regularization = regularization
123 IF (my_do_kpoints)
THEN
124 CALL gap_and_max_eig_diff_kpoints(qs_env, para_env, emin, emax, e_fermi)
125 my_e_range = emax/emin
127 IF (qs_env%mp2_env%E_range <= 1.0_dp .OR. qs_env%mp2_env%E_gap <= 0.0_dp)
THEN
131 IF (homo(ispin) > 0)
THEN
132 emin = min(emin, eigenval(homo(ispin) + 1, 1, ispin) - eigenval(homo(ispin), 1, ispin))
133 emax = max(emax, maxval(eigenval(:, :, ispin)) - minval(eigenval(:, :, ispin)))
136 my_e_range = emax/emin
137 qs_env%mp2_env%e_range = my_e_range
138 qs_env%mp2_env%e_gap = emin
144 my_e_range = qs_env%mp2_env%E_range
145 emin = qs_env%mp2_env%E_gap
146 emax = emin*my_e_range
150 IF (num_integ_points > 20 .AND. my_e_range < 100.0_dp)
THEN
152 CALL cp_warn(__location__, &
153 "You requested a large minimax grid (> 20 points) for a small minimax range R (R < 100). "// &
154 "That may lead to numerical "// &
155 "instabilities when computing minimax grid weights. You can prevent small ranges by choosing "// &
156 "a larger basis set with higher angular momenta or alternatively using all-electron calculations.")
159 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
160 ALLOCATE (x_tw(2*num_integ_points))
163 IF (num_integ_points .LE. 20)
THEN
169 ALLOCATE (tj(num_integ_points))
172 ALLOCATE (wj(num_integ_points))
175 DO jquad = 1, num_integ_points
176 tj(jquad) = x_tw(jquad)
177 wj(jquad) = x_tw(jquad + num_integ_points)
181 IF (num_integ_points >= 26)
THEN
187 IF (unit_nr > 0 .AND. do_print)
THEN
188 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
189 "MINIMAX_INFO| Number of integration points:", num_integ_points
190 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
191 "MINIMAX_INFO| Gap for the minimax approximation:", emin
192 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
193 "MINIMAX_INFO| Range for the minimax approximation:", my_e_range
194 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)")
"MINIMAX_INFO| Minimax parameters:",
"Weights",
"Abscissas"
195 DO jquad = 1, num_integ_points
196 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") wj(jquad), tj(jquad)
212 IF (do_im_time .OR. do_ri_sos_laplace_mp2)
THEN
214 ALLOCATE (x_tw(2*num_integ_points))
217 IF (num_integ_points .LE. 20)
THEN
225 IF (do_ri_sos_laplace_mp2) scaling = 1.0_dp
227 ALLOCATE (tau_tj(num_integ_points))
230 ALLOCATE (tau_wj(num_integ_points))
233 DO jquad = 1, num_integ_points
234 tau_tj(jquad) = x_tw(jquad)/scaling
235 tau_wj(jquad) = x_tw(jquad + num_integ_points)/scaling
240 IF (unit_nr > 0 .AND. do_print)
THEN
241 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
242 "MINIMAX_INFO| Range for the minimax approximation:", my_e_range
244 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
245 "MINIMAX_INFO| Gap:", emin
246 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)") &
247 "MINIMAX_INFO| Minimax parameters of the time grid:",
"Weights",
"Abscissas"
248 DO jquad = 1, num_integ_points
249 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") tau_wj(jquad), tau_tj(jquad)
255 tau_tj(:) = tau_tj(:)/emin
256 tau_wj(:) = tau_wj(:)/emin
258 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
259 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
260 weights_cos_tf_t_to_w = 0.0_dp
263 emin, emax, max_error_min, num_points_per_magnitude, &
267 ALLOCATE (weights_cos_tf_w_to_t(num_integ_points, num_integ_points))
268 weights_cos_tf_w_to_t = 0.0_dp
271 emin, emax, max_error_min, num_points_per_magnitude, &
274 IF (do_gw_im_time)
THEN
277 ALLOCATE (weights_sin_tf_t_to_w(num_integ_points, num_integ_points))
278 weights_sin_tf_t_to_w = 0.0_dp
281 emin, emax, max_error_min, num_points_per_magnitude, &
284 IF (unit_nr > 0)
THEN
285 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,ES15.2)") &
286 "MINIMAX_INFO| Maximum deviation of the imag. time fit:", max_error_min
294 CALL timestop(handle)
316 SUBROUTINE get_clenshaw_grid(para_env, para_env_RPA, unit_nr, homo, virtual, Eigenval, num_integ_points, &
317 num_integ_group, color_rpa_group, fm_mat_S, my_do_gw, &
318 ext_scaling, a_scaling, tj, wj)
321 INTEGER,
INTENT(IN) :: unit_nr
322 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
323 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
324 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
326 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
327 LOGICAL,
INTENT(IN) :: my_do_gw
328 REAL(kind=
dp),
INTENT(IN) :: ext_scaling
329 REAL(kind=
dp),
INTENT(OUT) :: a_scaling
330 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
331 INTENT(OUT) :: tj, wj
333 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_clenshaw_grid'
335 INTEGER :: handle, jquad, nspins
336 LOGICAL :: my_open_shell
338 CALL timeset(routinen, handle)
341 my_open_shell = (nspins == 2)
344 ALLOCATE (tj(num_integ_points))
347 ALLOCATE (wj(num_integ_points))
350 DO jquad = 1, num_integ_points - 1
351 tj(jquad) = jquad*
pi/(2.0_dp*num_integ_points)
352 wj(jquad) =
pi/(num_integ_points*sin(tj(jquad))**2)
354 tj(num_integ_points) =
pi/2.0_dp
355 wj(num_integ_points) =
pi/(2.0_dp*num_integ_points*sin(tj(num_integ_points))**2)
357 IF (my_do_gw .AND. ext_scaling > 0.0_dp)
THEN
358 a_scaling = ext_scaling
360 CALL calc_scaling_factor(a_scaling, para_env, para_env_rpa, homo, virtual, eigenval, &
361 num_integ_points, num_integ_group, color_rpa_group, &
365 IF (unit_nr > 0)
WRITE (unit_nr,
'(T3,A,T56,F25.5)')
'INTEG_INFO| Scaling parameter:', a_scaling
367 wj(:) = wj(:)*a_scaling
369 CALL timestop(handle)
388 SUBROUTINE calc_scaling_factor(a_scaling_ext, para_env, para_env_RPA, homo, virtual, Eigenval, &
389 num_integ_points, num_integ_group, color_rpa_group, &
390 tj_ext, wj_ext, fm_mat_S)
391 REAL(kind=
dp),
INTENT(OUT) :: a_scaling_ext
393 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
394 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
395 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
397 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
398 INTENT(IN) :: tj_ext, wj_ext
399 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
401 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_scaling_factor'
403 INTEGER :: handle, icycle, jquad, ncol_local, &
404 ncol_local_beta, nspins
405 LOGICAL :: my_open_shell
406 REAL(kind=
dp) :: a_high, a_low, a_scaling, conv_param, eps, first_deriv, left_term, &
407 right_term, right_term_ref, right_term_ref_beta, step
408 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cottj, d_ia, d_ia_beta, iaia_ri, &
409 iaia_ri_beta, m_ia, m_ia_beta
412 CALL timeset(routinen, handle)
415 my_open_shell = (nspins == 2)
419 ALLOCATE (cottj(num_integ_points))
422 DO jquad = 1, num_integ_points
423 cottj(jquad) = 1.0_dp/tan(tj_ext(jquad))
426 CALL calc_ia_ia_integrals(para_env_rpa, homo(1), virtual(1), ncol_local, right_term_ref, eigenval(:, 1, 1), &
427 d_ia, iaia_ri, m_ia, fm_mat_s(1), para_env_col)
430 IF (my_open_shell)
THEN
431 CALL calc_ia_ia_integrals(para_env_rpa, homo(2), virtual(2), ncol_local_beta, right_term_ref_beta, eigenval(:, 1, 2), &
432 d_ia_beta, iaia_ri_beta, m_ia_beta, fm_mat_s(2), para_env_col_beta)
434 right_term_ref = right_term_ref + right_term_ref_beta
438 IF (para_env%mepos == 0)
THEN
439 CALL para_env%bcast(right_term_ref, 0)
441 right_term_ref = 0.0_dp
442 CALL para_env%bcast(right_term_ref, 0)
447 conv_param = 100.0_dp*epsilon(right_term_ref)
451 right_term = -right_term_ref
452 DO icycle = 1, num_integ_points*2
455 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
456 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
457 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
458 para_env, para_env_col, para_env_col_beta)
459 left_term = left_term/4.0_dp/
pi*a_scaling
461 IF (abs(left_term) > abs(right_term) .OR. abs(left_term + right_term) <= conv_param)
EXIT
463 a_high = a_high + step
467 IF (abs(left_term + right_term) >= conv_param)
THEN
468 IF (a_scaling >= 2*num_integ_points*step)
THEN
472 DO icycle = 1, num_integ_points*2
473 a_scaling = (a_low + a_high)/2.0_dp
475 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
476 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
477 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
478 para_env, para_env_col, para_env_col_beta)
479 left_term = left_term/4.0_dp/
pi*a_scaling
481 IF (abs(left_term) > abs(right_term))
THEN
487 IF (abs(a_high - a_low) < 1.0e-5_dp)
EXIT
494 a_scaling_ext = a_scaling
495 CALL para_env%bcast(a_scaling_ext, 0)
503 IF (my_open_shell)
THEN
504 DEALLOCATE (iaia_ri_beta)
505 DEALLOCATE (d_ia_beta)
506 DEALLOCATE (m_ia_beta)
510 CALL timestop(handle)
512 END SUBROUTINE calc_scaling_factor
528 SUBROUTINE calc_ia_ia_integrals(para_env_RPA, homo, virtual, ncol_local, right_term_ref, Eigenval, &
529 D_ia, iaia_RI, M_ia, fm_mat_S, para_env_col)
532 INTEGER,
INTENT(IN) :: homo, virtual
533 INTEGER,
INTENT(OUT) :: ncol_local
534 REAL(kind=
dp),
INTENT(OUT) :: right_term_ref
535 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval
536 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
537 INTENT(OUT) :: d_ia, iaia_ri, m_ia
541 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_ia_ia_integrals'
543 INTEGER :: avirt, color_col, color_row, handle, &
544 i_global, iib, iocc, nrow_local
545 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
546 REAL(kind=
dp) :: eigen_diff
547 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: iaia_ri_dp
550 CALL timeset(routinen, handle)
556 nrow_local=nrow_local, &
557 ncol_local=ncol_local, &
558 row_indices=row_indices, &
559 col_indices=col_indices)
562 ALLOCATE (iaia_ri_dp(ncol_local))
566 DO iib = 1, ncol_local
567 iaia_ri_dp(iib) = iaia_ri_dp(iib) + dot_product(fm_mat_s%local_data(:, iib), fm_mat_s%local_data(:, iib))
586 color_col = fm_mat_s%matrix_struct%context%mepos(2)
587 ALLOCATE (para_env_col)
588 CALL para_env_col%from_split(para_env_rpa, color_col)
590 CALL para_env_col%sum(iaia_ri_dp)
593 ALLOCATE (iaia_ri(ncol_local))
594 DO iib = 1, ncol_local
595 iaia_ri(iib) = iaia_ri_dp(iib)
597 DEALLOCATE (iaia_ri_dp)
602 ALLOCATE (d_ia(ncol_local))
604 ALLOCATE (m_ia(ncol_local))
606 DO iib = 1, ncol_local
607 i_global = col_indices(iib)
609 iocc = max(1, i_global - 1)/virtual + 1
610 avirt = i_global - (iocc - 1)*virtual
611 eigen_diff = eigenval(avirt + homo) - eigenval(iocc)
613 d_ia(iib) = eigen_diff
616 DO iib = 1, ncol_local
617 m_ia(iib) = d_ia(iib)*d_ia(iib) + 2.0_dp*d_ia(iib)*iaia_ri(iib)
620 right_term_ref = 0.0_dp
621 DO iib = 1, ncol_local
622 right_term_ref = right_term_ref + (sqrt(m_ia(iib)) - d_ia(iib) - iaia_ri(iib))
624 right_term_ref = right_term_ref/2.0_dp
627 color_row = fm_mat_s%matrix_struct%context%mepos(1)
628 ALLOCATE (para_env_row)
629 CALL para_env_row%from_split(para_env_rpa, color_row)
632 CALL para_env_row%sum(right_term_ref)
636 CALL timestop(handle)
638 END SUBROUTINE calc_ia_ia_integrals
661 SUBROUTINE calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
662 M_ia, cottj, wj, D_ia, D_ia_beta, M_ia_beta, &
663 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
664 para_env, para_env_col, para_env_col_beta)
665 REAL(kind=
dp),
INTENT(IN) :: a_scaling
666 REAL(kind=
dp),
INTENT(INOUT) :: left_term, first_deriv
667 INTEGER,
INTENT(IN) :: num_integ_points
668 LOGICAL,
INTENT(IN) :: my_open_shell
669 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
670 INTENT(IN) :: m_ia, cottj, wj, d_ia, d_ia_beta, &
672 INTEGER,
INTENT(IN) :: ncol_local, ncol_local_beta, &
673 num_integ_group, color_rpa_group
677 INTEGER :: iib, jquad
678 REAL(kind=
dp) :: first_deriv_beta, left_term_beta, omega
682 left_term_beta = 0.0_dp
683 first_deriv_beta = 0.0_dp
684 DO jquad = 1, num_integ_points
686 IF (
modulo(jquad, num_integ_group) /= color_rpa_group) cycle
687 omega = a_scaling*cottj(jquad)
689 DO iib = 1, ncol_local
691 IF (
modulo(iib, para_env_col%num_pe) /= para_env_col%mepos) cycle
693 left_term = left_term + wj(jquad)* &
694 (log(1.0_dp + (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2)) - &
695 (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2))
696 first_deriv = first_deriv + wj(jquad)*cottj(jquad)**2* &
697 ((-m_ia(iib) + d_ia(iib)**2)**2/((omega**2 + d_ia(iib)**2)**2*(omega**2 + m_ia(iib))))
700 IF (my_open_shell)
THEN
701 DO iib = 1, ncol_local_beta
703 IF (
modulo(iib, para_env_col_beta%num_pe) /= para_env_col_beta%mepos) cycle
705 left_term_beta = left_term_beta + wj(jquad)* &
706 (log(1.0_dp + (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2)) - &
707 (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2))
709 first_deriv_beta + wj(jquad)*cottj(jquad)**2* &
710 ((-m_ia_beta(iib) + d_ia_beta(iib)**2)**2/((omega**2 + d_ia_beta(iib)**2)**2*(omega**2 + m_ia_beta(iib))))
717 CALL para_env%sum(left_term)
718 CALL para_env%sum(first_deriv)
720 IF (my_open_shell)
THEN
721 CALL para_env%sum(left_term_beta)
722 CALL para_env%sum(first_deriv_beta)
724 left_term = left_term + left_term_beta
725 first_deriv = first_deriv + first_deriv_beta
728 END SUBROUTINE calculate_objfunc
743 E_min, E_max, max_error, num_points_per_magnitude, &
746 INTEGER,
INTENT(IN) :: num_integ_points
747 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
749 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
750 INTENT(INOUT) :: weights_cos_tf_t_to_w
751 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
752 INTENT(IN) :: omega_tj
753 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
754 REAL(kind=
dp),
INTENT(INOUT) :: max_error
755 INTEGER,
INTENT(IN) :: num_points_per_magnitude
756 REAL(kind=
dp),
INTENT(IN) :: regularization
758 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_t_to_w'
760 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
762 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
763 REAL(kind=
dp) :: multiplicator, omega
764 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
766 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
767 mat_sinvvsinvt, mat_u
769 CALL timeset(routinen, handle)
772 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
776 num_x_nodes = max(num_x_nodes, num_integ_points)
778 ALLOCATE (x_values(num_x_nodes))
780 ALLOCATE (y_values(num_x_nodes))
782 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
784 ALLOCATE (tau_wj_work(num_integ_points))
786 ALLOCATE (sing_values(num_integ_points))
788 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
790 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
792 mat_sinvvsinvt = 0.0_dp
794 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
795 ALLOCATE (work(lwork))
797 ALLOCATE (iwork(8*num_integ_points))
799 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
800 mat_sinvvsinvsigma = 0.0_dp
801 ALLOCATE (vec_uty(num_x_nodes))
807 DO jquad = 1, num_integ_points
810 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
811 DO iii = 1, num_x_nodes
812 x_values(iii) = e_min*multiplicator**(iii - 1)
815 omega = omega_tj(jquad)
818 DO iii = 1, num_x_nodes
819 y_values(iii) = 2.0_dp*x_values(iii)/((x_values(iii))**2 + omega**2)
823 DO jjj = 1, num_integ_points
824 DO iii = 1, num_x_nodes
825 mat_a(iii, jjj) = cos(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
830 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
831 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
837 DO jjj = 1, num_integ_points
838 DO iii = 1, num_integ_points
840 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
841 /(regularization**2 + sing_values(jjj)**2)
846 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
847 0.0_dp, vec_uty, num_x_nodes)
850 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
851 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
853 weights_cos_tf_t_to_w(jquad, :) = tau_wj_work(:)
855 CALL calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
856 y_values, num_integ_points, num_x_nodes)
860 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, sing_values, mat_u, mat_sinvvsinvt, &
861 work, iwork, mat_sinvvsinvsigma, vec_uty)
863 CALL timestop(handle)
880 E_min, E_max, max_error, num_points_per_magnitude, regularization)
882 INTEGER,
INTENT(IN) :: num_integ_points
883 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
885 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
886 INTENT(INOUT) :: weights_sin_tf_t_to_w
887 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
888 INTENT(IN) :: omega_tj
889 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
890 REAL(kind=
dp),
INTENT(OUT) :: max_error
891 INTEGER,
INTENT(IN) :: num_points_per_magnitude
892 REAL(kind=
dp),
INTENT(IN) :: regularization
894 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_sin_tf_t_to_w'
896 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
898 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
899 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega
900 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
901 work_array, x_values, y_values
902 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
903 mat_sinvvsinvt, mat_u
905 CALL timeset(routinen, handle)
908 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
912 num_x_nodes = max(num_x_nodes, num_integ_points)
914 ALLOCATE (x_values(num_x_nodes))
916 ALLOCATE (y_values(num_x_nodes))
918 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
920 ALLOCATE (tau_wj_work(num_integ_points))
922 ALLOCATE (work_array(2*num_integ_points))
924 ALLOCATE (sing_values(num_integ_points))
926 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
928 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
930 mat_sinvvsinvt = 0.0_dp
932 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
933 ALLOCATE (work(lwork))
935 ALLOCATE (iwork(8*num_integ_points))
937 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
938 mat_sinvvsinvsigma = 0.0_dp
939 ALLOCATE (vec_uty(num_x_nodes))
945 DO jquad = 1, num_integ_points
947 chi2_min_jquad = 100.0_dp
950 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
951 DO iii = 1, num_x_nodes
952 x_values(iii) = e_min*multiplicator**(iii - 1)
955 omega = omega_tj(jquad)
958 DO iii = 1, num_x_nodes
960 y_values(iii) = 2.0_dp*omega/((x_values(iii))**2 + omega**2)
964 DO jjj = 1, num_integ_points
965 DO iii = 1, num_x_nodes
966 mat_a(iii, jjj) = sin(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
971 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
972 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
978 DO jjj = 1, num_integ_points
979 DO iii = 1, num_integ_points
981 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
982 /(regularization**2 + sing_values(jjj)**2)
987 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
988 0.0_dp, vec_uty, num_x_nodes)
991 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
992 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
994 weights_sin_tf_t_to_w(jquad, :) = tau_wj_work(:)
996 CALL calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
997 y_values, num_integ_points, num_x_nodes)
1001 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
1002 work, iwork, mat_sinvvsinvsigma, vec_uty)
1004 CALL timestop(handle)
1019 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1020 y_values, num_integ_points, num_x_nodes)
1022 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1023 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1024 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1025 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1028 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1030 max_error_tmp = 0.0_dp
1032 DO kkk = 1, num_x_nodes
1036 CALL eval_fit_func_tau_grid_cosine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1038 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1039 max_error_tmp = abs(y_values(kkk) - func_val)
1040 func_val_temp = func_val
1045 IF (max_error_tmp > max_error)
THEN
1047 max_error = max_error_tmp
1051 END SUBROUTINE calc_max_error_fit_tau_grid_with_cosine
1062 PURE SUBROUTINE eval_fit_func_tau_grid_cosine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1064 REAL(kind=
dp),
INTENT(OUT) :: func_val
1065 REAL(kind=
dp),
INTENT(IN) :: x_value
1066 INTEGER,
INTENT(IN) :: num_integ_points
1067 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1068 INTENT(IN) :: tau_tj, tau_wj_work
1069 REAL(kind=
dp),
INTENT(IN) :: omega
1075 DO iii = 1, num_integ_points
1078 func_val = func_val + tau_wj_work(iii)*cos(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1082 END SUBROUTINE eval_fit_func_tau_grid_cosine
1093 PURE SUBROUTINE eval_fit_func_tau_grid_sine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1095 REAL(kind=
dp),
INTENT(INOUT) :: func_val
1096 REAL(kind=
dp),
INTENT(IN) :: x_value
1097 INTEGER,
INTENT(in) :: num_integ_points
1098 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1099 INTENT(IN) :: tau_tj, tau_wj_work
1100 REAL(kind=
dp),
INTENT(IN) :: omega
1106 DO iii = 1, num_integ_points
1109 func_val = func_val + tau_wj_work(iii)*sin(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1113 END SUBROUTINE eval_fit_func_tau_grid_sine
1126 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1127 y_values, num_integ_points, num_x_nodes)
1129 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1130 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1131 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1132 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1135 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1137 max_error_tmp = 0.0_dp
1139 DO kkk = 1, num_x_nodes
1143 CALL eval_fit_func_tau_grid_sine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1145 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1146 max_error_tmp = abs(y_values(kkk) - func_val)
1147 func_val_temp = func_val
1152 IF (max_error_tmp > max_error)
THEN
1154 max_error = max_error_tmp
1158 END SUBROUTINE calc_max_error_fit_tau_grid_with_sine
1167 INTEGER,
INTENT(IN) :: nr, iw
1169 INTEGER :: ierr, ir, jquad, num_integ_points
1170 REAL(kind=
dp) :: max_error, multiplicator, rc, rc_max
1171 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: tau_tj, tau_wj, tj, wj, x_tw
1172 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: weights_cos_tf_t_to_w
1176 multiplicator = rc_max**(1.0_dp/(real(nr, kind=
dp) - 1.0_dp))
1178 DO num_integ_points = 1, 20
1180 ALLOCATE (x_tw(2*num_integ_points))
1182 ALLOCATE (tau_tj(num_integ_points))
1184 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
1185 weights_cos_tf_t_to_w = 0.0_dp
1186 ALLOCATE (tau_wj(num_integ_points))
1188 ALLOCATE (tj(num_integ_points))
1190 ALLOCATE (wj(num_integ_points))
1195 rc = 2.0_dp*multiplicator**ir
1200 DO jquad = 1, num_integ_points
1201 tj(jquad) = x_tw(jquad)
1202 wj(jquad) = x_tw(jquad + num_integ_points)
1209 DO jquad = 1, num_integ_points
1210 tau_tj(jquad) = x_tw(jquad)/2.0_dp
1211 tau_wj(jquad) = x_tw(jquad + num_integ_points)/2.0_dp
1215 weights_cos_tf_t_to_w, tj, &
1216 1.0_dp, rc, max_error, 200, 0.0_dp)
1219 WRITE (iw,
'(T2, I3, F12.1, ES12.3)') num_integ_points, rc, max_error
1224 DEALLOCATE (x_tw, tau_tj, weights_cos_tf_t_to_w, tau_wj, wj, tj)
1243 E_min, E_max, max_error, num_points_per_magnitude, regularization)
1245 INTEGER,
INTENT(IN) :: num_integ_points
1246 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1247 INTENT(IN) :: tau_tj
1248 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
1249 INTENT(INOUT) :: weights_cos_tf_w_to_t
1250 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1251 INTENT(IN) :: omega_tj
1252 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
1253 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1254 INTEGER,
INTENT(IN) :: num_points_per_magnitude
1255 REAL(kind=
dp),
INTENT(IN) :: regularization
1257 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_w_to_t'
1259 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
1261 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1262 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega, &
1264 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: omega_wj_work, sing_values, vec_uty, &
1265 work, work_array, x_values, y_values
1266 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
1267 mat_sinvvsinvt, mat_u
1269 CALL timeset(routinen, handle)
1272 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
1276 num_x_nodes = max(num_x_nodes, num_integ_points)
1278 ALLOCATE (x_values(num_x_nodes))
1280 ALLOCATE (y_values(num_x_nodes))
1282 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
1284 ALLOCATE (omega_wj_work(num_integ_points))
1285 omega_wj_work = 0.0_dp
1286 ALLOCATE (work_array(2*num_integ_points))
1288 ALLOCATE (sing_values(num_integ_points))
1289 sing_values = 0.0_dp
1290 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
1292 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
1294 mat_sinvvsinvt = 0.0_dp
1296 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
1297 ALLOCATE (work(lwork))
1299 ALLOCATE (iwork(8*num_integ_points))
1301 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
1302 mat_sinvvsinvsigma = 0.0_dp
1303 ALLOCATE (vec_uty(num_x_nodes))
1307 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
1308 DO iii = 1, num_x_nodes
1309 x_values(iii) = e_min*multiplicator**(iii - 1)
1315 DO jquad = 1, num_integ_points
1317 chi2_min_jquad = 100.0_dp
1322 DO iii = 1, num_x_nodes
1323 y_values(iii) = exp(-x_values(iii)*tau)
1327 DO jjj = 1, num_integ_points
1328 DO iii = 1, num_x_nodes
1329 omega = omega_tj(jjj)
1330 x_value = x_values(iii)
1331 mat_a(iii, jjj) = cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1336 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
1337 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
1343 DO jjj = 1, num_integ_points
1344 DO iii = 1, num_integ_points
1346 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
1347 /(regularization**2 + sing_values(jjj)**2)
1352 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
1353 0.0_dp, vec_uty, num_x_nodes)
1356 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
1357 num_x_nodes, 0.0_dp, omega_wj_work, num_integ_points)
1359 weights_cos_tf_w_to_t(jquad, :) = omega_wj_work(:)
1361 CALL calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1362 y_values, num_integ_points, num_x_nodes)
1366 DEALLOCATE (x_values, y_values, mat_a, omega_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
1367 work, iwork, mat_sinvvsinvsigma, vec_uty)
1369 CALL timestop(handle)
1384 SUBROUTINE calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1385 y_values, num_integ_points, num_x_nodes)
1387 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1388 REAL(kind=
dp),
INTENT(IN) :: tau
1389 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1390 INTENT(IN) :: omega_tj, omega_wj_work, x_values, &
1392 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1394 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_max_error_fit_omega_grid_with_cosine'
1396 INTEGER :: handle, kkk
1397 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1399 CALL timeset(routinen, handle)
1401 max_error_tmp = 0.0_dp
1403 DO kkk = 1, num_x_nodes
1407 CALL eval_fit_func_omega_grid_cosine(func_val, x_values(kkk), num_integ_points, omega_tj, omega_wj_work, tau)
1409 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1410 max_error_tmp = abs(y_values(kkk) - func_val)
1411 func_val_temp = func_val
1416 IF (max_error_tmp > max_error)
THEN
1418 max_error = max_error_tmp
1422 CALL timestop(handle)
1424 END SUBROUTINE calc_max_error_fit_omega_grid_with_cosine
1435 PURE SUBROUTINE eval_fit_func_omega_grid_cosine(func_val, x_value, num_integ_points, omega_tj, omega_wj_work, tau)
1436 REAL(kind=
dp),
INTENT(OUT) :: func_val
1437 REAL(kind=
dp),
INTENT(IN) :: x_value
1438 INTEGER,
INTENT(IN) :: num_integ_points
1439 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1440 INTENT(IN) :: omega_tj, omega_wj_work
1441 REAL(kind=
dp),
INTENT(IN) :: tau
1444 REAL(kind=
dp) :: omega
1448 DO iii = 1, num_integ_points
1451 omega = omega_tj(iii)
1452 func_val = func_val + omega_wj_work(iii)*cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1456 END SUBROUTINE eval_fit_func_omega_grid_cosine
1466 SUBROUTINE gap_and_max_eig_diff_kpoints(qs_env, para_env, gap, max_eig_diff, e_fermi)
1470 REAL(kind=
dp),
INTENT(OUT) :: gap, max_eig_diff, e_fermi
1472 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gap_and_max_eig_diff_kpoints'
1474 INTEGER :: handle, homo, ikpgr, ispin, kplocal, &
1476 INTEGER,
DIMENSION(2) :: kp_range
1477 REAL(kind=
dp) :: e_homo, e_homo_temp, e_lumo, e_lumo_temp
1478 REAL(kind=
dp),
DIMENSION(3) :: tmp
1479 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1484 CALL timeset(routinen, handle)
1489 mo_set => kpoint%kp_env(1)%kpoint_env%mos(1, 1)
1493 kplocal = kp_range(2) - kp_range(1) + 1
1496 max_eig_diff = 0.0_dp
1500 DO ikpgr = 1, kplocal
1501 kp => kpoint%kp_env(ikpgr)%kpoint_env
1502 nspin =
SIZE(kp%mos, 2)
1504 mo_set => kp%mos(1, ispin)
1505 CALL get_mo_set(mo_set, eigenvalues=eigenvalues, homo=homo)
1506 e_homo_temp = eigenvalues(homo)
1507 e_lumo_temp = eigenvalues(homo + 1)
1509 IF (e_homo_temp > e_homo) e_homo = e_homo_temp
1510 IF (e_lumo_temp < e_lumo) e_lumo = e_lumo_temp
1511 IF (eigenvalues(nmo) - eigenvalues(1) > max_eig_diff) max_eig_diff = eigenvalues(nmo) - eigenvalues(1)
1520 tmp(3) = max_eig_diff
1521 CALL para_env%max(tmp)
1523 gap = -tmp(2) - tmp(1)
1524 e_fermi = (tmp(1) - tmp(2))*0.5_dp
1525 max_eig_diff = tmp(3)
1527 CALL timestop(handle)
1544 do_kpoints_cubic_RPA, Emin, Emax, e_fermi)
1548 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
1549 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
1550 LOGICAL,
INTENT(IN) :: do_ri_sos_laplace_mp2, &
1551 do_kpoints_cubic_rpa
1552 REAL(kind=
dp),
INTENT(OUT) :: emin, emax, e_fermi
1554 CHARACTER(LEN=*),
PARAMETER :: routinen =
'init_greenx_grids'
1556 INTEGER :: handle, ispin, nspins
1557 LOGICAL :: my_do_kpoints, my_open_shell
1558 REAL(kind=
dp) :: my_e_range
1561 CALL timeset(routinen, handle)
1564 my_open_shell = (nspins == 2)
1567 my_do_kpoints = .false.
1568 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1569 my_do_kpoints = do_kpoints_cubic_rpa
1572 IF (my_do_kpoints)
THEN
1573 CALL gap_and_max_eig_diff_kpoints(qs_env, para_env, emin, emax, e_fermi)
1574 my_e_range = emax/emin
1576 IF (qs_env%mp2_env%E_range <= 1.0_dp .OR. qs_env%mp2_env%E_gap <= 0.0_dp)
THEN
1579 DO ispin = 1, nspins
1580 IF (homo(ispin) > 0)
THEN
1581 emin = min(emin, eigenval(homo(ispin) + 1, 1, ispin) - eigenval(homo(ispin), 1, ispin))
1582 emax = max(emax, maxval(eigenval(:, :, ispin)) - minval(eigenval(:, :, ispin)))
1585 my_e_range = emax/emin
1586 qs_env%mp2_env%e_range = my_e_range
1587 qs_env%mp2_env%e_gap = emin
1593 my_e_range = qs_env%mp2_env%E_range
1594 emin = qs_env%mp2_env%E_gap
1595 emax = emin*my_e_range
1602 IF (do_ri_sos_laplace_mp2)
THEN
1606 CALL timestop(handle)
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
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)
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 init_greenx_grids(qs_env, para_env, homo, eigenval, do_ri_sos_laplace_mp2, do_kpoints_cubic_rpa, emin, emax, e_fermi)
returns minimal and maximal energy values for the E_range for the minimax grid selection
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, 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.
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