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)
112 tau_tj, tau_wj, qs_env%mp2_env%ri_g0w0%regularization_minimax, &
113 tj, wj, weights_cos_tf_t_to_w, &
114 weights_cos_tf_w_to_t, weights_sin_tf_t_to_w, ierr)
118 CALL timestop(handle)
126 my_do_kpoints = .false.
127 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
128 my_do_kpoints = do_kpoints_cubic_rpa
131 my_regularization = 0.0_dp
132 IF (
PRESENT(regularization))
THEN
133 my_regularization = regularization
135 IF (num_integ_points > 20 .AND. e_range < 100.0_dp)
THEN
137 CALL cp_warn(__location__, &
138 "You requested a large minimax grid (> 20 points) for a small minimax range R (R < 100). "// &
139 "That may lead to numerical "// &
140 "instabilities when computing minimax grid weights. You can prevent small ranges by choosing "// &
141 "a larger basis set with higher angular momenta or alternatively using all-electron calculations.")
144 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
145 ALLOCATE (x_tw(2*num_integ_points))
148 IF (num_integ_points .LE. 20)
THEN
154 ALLOCATE (tj(num_integ_points))
157 ALLOCATE (wj(num_integ_points))
160 DO jquad = 1, num_integ_points
161 tj(jquad) = x_tw(jquad)
162 wj(jquad) = x_tw(jquad + num_integ_points)
166 IF (num_integ_points >= 26)
THEN
172 IF (unit_nr > 0 .AND. do_print)
THEN
173 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
174 "MINIMAX_INFO| Number of integration points:", num_integ_points
175 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
176 "MINIMAX_INFO| Gap for the minimax approximation:", emin
177 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
178 "MINIMAX_INFO| Range for the minimax approximation:", e_range
179 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)")
"MINIMAX_INFO| Minimax parameters:",
"Weights",
"Abscissas"
180 DO jquad = 1, num_integ_points
181 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") wj(jquad), tj(jquad)
192 IF (do_im_time .OR. do_ri_sos_laplace_mp2)
THEN
194 ALLOCATE (x_tw(2*num_integ_points))
197 IF (num_integ_points .LE. 20)
THEN
205 IF (do_ri_sos_laplace_mp2) scaling = 1.0_dp
207 ALLOCATE (tau_tj(num_integ_points))
210 ALLOCATE (tau_wj(num_integ_points))
213 DO jquad = 1, num_integ_points
214 tau_tj(jquad) = x_tw(jquad)/scaling
215 tau_wj(jquad) = x_tw(jquad + num_integ_points)/scaling
220 IF (unit_nr > 0 .AND. do_print)
THEN
221 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
222 "MINIMAX_INFO| Range for the minimax approximation:", e_range
224 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
225 "MINIMAX_INFO| Gap:", emin
226 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)") &
227 "MINIMAX_INFO| Minimax parameters of the time grid:",
"Weights",
"Abscissas"
228 DO jquad = 1, num_integ_points
229 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") tau_wj(jquad), tau_tj(jquad)
235 tau_tj(:) = tau_tj(:)/emin
236 tau_wj(:) = tau_wj(:)/emin
238 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
239 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
240 weights_cos_tf_t_to_w = 0.0_dp
243 emin, emax, max_error_min, num_points_per_magnitude, &
247 ALLOCATE (weights_cos_tf_w_to_t(num_integ_points, num_integ_points))
248 weights_cos_tf_w_to_t = 0.0_dp
251 emin, emax, max_error_min, num_points_per_magnitude, &
254 IF (do_gw_im_time)
THEN
257 ALLOCATE (weights_sin_tf_t_to_w(num_integ_points, num_integ_points))
258 weights_sin_tf_t_to_w = 0.0_dp
261 emin, emax, max_error_min, num_points_per_magnitude, &
264 IF (unit_nr > 0)
THEN
265 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,ES15.2)") &
266 "MINIMAX_INFO| Maximum deviation of the imag. time fit:", max_error_min
275 CALL timestop(handle)
297 SUBROUTINE get_clenshaw_grid(para_env, para_env_RPA, unit_nr, homo, virtual, Eigenval, num_integ_points, &
298 num_integ_group, color_rpa_group, fm_mat_S, my_do_gw, &
299 ext_scaling, a_scaling, tj, wj)
302 INTEGER,
INTENT(IN) :: unit_nr
303 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
304 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
305 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
307 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
308 LOGICAL,
INTENT(IN) :: my_do_gw
309 REAL(kind=
dp),
INTENT(IN) :: ext_scaling
310 REAL(kind=
dp),
INTENT(OUT) :: a_scaling
311 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
312 INTENT(OUT) :: tj, wj
314 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_clenshaw_grid'
316 INTEGER :: handle, jquad, nspins
317 LOGICAL :: my_open_shell
319 CALL timeset(routinen, handle)
322 my_open_shell = (nspins == 2)
325 ALLOCATE (tj(num_integ_points))
328 ALLOCATE (wj(num_integ_points))
331 DO jquad = 1, num_integ_points - 1
332 tj(jquad) = jquad*
pi/(2.0_dp*num_integ_points)
333 wj(jquad) =
pi/(num_integ_points*sin(tj(jquad))**2)
335 tj(num_integ_points) =
pi/2.0_dp
336 wj(num_integ_points) =
pi/(2.0_dp*num_integ_points*sin(tj(num_integ_points))**2)
338 IF (my_do_gw .AND. ext_scaling > 0.0_dp)
THEN
339 a_scaling = ext_scaling
341 CALL calc_scaling_factor(a_scaling, para_env, para_env_rpa, homo, virtual, eigenval, &
342 num_integ_points, num_integ_group, color_rpa_group, &
346 IF (unit_nr > 0)
WRITE (unit_nr,
'(T3,A,T56,F25.5)')
'INTEG_INFO| Scaling parameter:', a_scaling
348 wj(:) = wj(:)*a_scaling
350 CALL timestop(handle)
369 SUBROUTINE calc_scaling_factor(a_scaling_ext, para_env, para_env_RPA, homo, virtual, Eigenval, &
370 num_integ_points, num_integ_group, color_rpa_group, &
371 tj_ext, wj_ext, fm_mat_S)
372 REAL(kind=
dp),
INTENT(OUT) :: a_scaling_ext
374 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
375 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
376 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
378 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
379 INTENT(IN) :: tj_ext, wj_ext
380 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
382 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_scaling_factor'
384 INTEGER :: handle, icycle, jquad, ncol_local, &
385 ncol_local_beta, nspins
386 LOGICAL :: my_open_shell
387 REAL(kind=
dp) :: a_high, a_low, a_scaling, conv_param, eps, first_deriv, left_term, &
388 right_term, right_term_ref, right_term_ref_beta, step
389 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cottj, d_ia, d_ia_beta, iaia_ri, &
390 iaia_ri_beta, m_ia, m_ia_beta
393 CALL timeset(routinen, handle)
396 my_open_shell = (nspins == 2)
400 ALLOCATE (cottj(num_integ_points))
403 DO jquad = 1, num_integ_points
404 cottj(jquad) = 1.0_dp/tan(tj_ext(jquad))
407 CALL calc_ia_ia_integrals(para_env_rpa, homo(1), virtual(1), ncol_local, right_term_ref, eigenval(:, 1, 1), &
408 d_ia, iaia_ri, m_ia, fm_mat_s(1), para_env_col)
411 IF (my_open_shell)
THEN
412 CALL calc_ia_ia_integrals(para_env_rpa, homo(2), virtual(2), ncol_local_beta, right_term_ref_beta, eigenval(:, 1, 2), &
413 d_ia_beta, iaia_ri_beta, m_ia_beta, fm_mat_s(2), para_env_col_beta)
415 right_term_ref = right_term_ref + right_term_ref_beta
419 IF (para_env%mepos == 0)
THEN
420 CALL para_env%bcast(right_term_ref, 0)
422 right_term_ref = 0.0_dp
423 CALL para_env%bcast(right_term_ref, 0)
428 conv_param = 100.0_dp*epsilon(right_term_ref)
432 right_term = -right_term_ref
433 DO icycle = 1, num_integ_points*2
436 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
437 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
438 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
439 para_env, para_env_col, para_env_col_beta)
440 left_term = left_term/4.0_dp/
pi*a_scaling
442 IF (abs(left_term) > abs(right_term) .OR. abs(left_term + right_term) <= conv_param)
EXIT
444 a_high = a_high + step
448 IF (abs(left_term + right_term) >= conv_param)
THEN
449 IF (a_scaling >= 2*num_integ_points*step)
THEN
453 DO icycle = 1, num_integ_points*2
454 a_scaling = (a_low + a_high)/2.0_dp
456 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
457 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
458 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
459 para_env, para_env_col, para_env_col_beta)
460 left_term = left_term/4.0_dp/
pi*a_scaling
462 IF (abs(left_term) > abs(right_term))
THEN
468 IF (abs(a_high - a_low) < 1.0e-5_dp)
EXIT
475 a_scaling_ext = a_scaling
476 CALL para_env%bcast(a_scaling_ext, 0)
484 IF (my_open_shell)
THEN
485 DEALLOCATE (iaia_ri_beta)
486 DEALLOCATE (d_ia_beta)
487 DEALLOCATE (m_ia_beta)
491 CALL timestop(handle)
493 END SUBROUTINE calc_scaling_factor
509 SUBROUTINE calc_ia_ia_integrals(para_env_RPA, homo, virtual, ncol_local, right_term_ref, Eigenval, &
510 D_ia, iaia_RI, M_ia, fm_mat_S, para_env_col)
513 INTEGER,
INTENT(IN) :: homo, virtual
514 INTEGER,
INTENT(OUT) :: ncol_local
515 REAL(kind=
dp),
INTENT(OUT) :: right_term_ref
516 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval
517 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
518 INTENT(OUT) :: d_ia, iaia_ri, m_ia
522 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_ia_ia_integrals'
524 INTEGER :: avirt, color_col, color_row, handle, &
525 i_global, iib, iocc, nrow_local
526 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
527 REAL(kind=
dp) :: eigen_diff
528 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: iaia_ri_dp
531 CALL timeset(routinen, handle)
537 nrow_local=nrow_local, &
538 ncol_local=ncol_local, &
539 row_indices=row_indices, &
540 col_indices=col_indices)
543 ALLOCATE (iaia_ri_dp(ncol_local))
547 DO iib = 1, ncol_local
548 iaia_ri_dp(iib) = iaia_ri_dp(iib) + dot_product(fm_mat_s%local_data(:, iib), fm_mat_s%local_data(:, iib))
567 color_col = fm_mat_s%matrix_struct%context%mepos(2)
568 ALLOCATE (para_env_col)
569 CALL para_env_col%from_split(para_env_rpa, color_col)
571 CALL para_env_col%sum(iaia_ri_dp)
574 ALLOCATE (iaia_ri(ncol_local))
575 DO iib = 1, ncol_local
576 iaia_ri(iib) = iaia_ri_dp(iib)
578 DEALLOCATE (iaia_ri_dp)
583 ALLOCATE (d_ia(ncol_local))
585 ALLOCATE (m_ia(ncol_local))
587 DO iib = 1, ncol_local
588 i_global = col_indices(iib)
590 iocc = max(1, i_global - 1)/virtual + 1
591 avirt = i_global - (iocc - 1)*virtual
592 eigen_diff = eigenval(avirt + homo) - eigenval(iocc)
594 d_ia(iib) = eigen_diff
597 DO iib = 1, ncol_local
598 m_ia(iib) = d_ia(iib)*d_ia(iib) + 2.0_dp*d_ia(iib)*iaia_ri(iib)
601 right_term_ref = 0.0_dp
602 DO iib = 1, ncol_local
603 right_term_ref = right_term_ref + (sqrt(m_ia(iib)) - d_ia(iib) - iaia_ri(iib))
605 right_term_ref = right_term_ref/2.0_dp
608 color_row = fm_mat_s%matrix_struct%context%mepos(1)
609 ALLOCATE (para_env_row)
610 CALL para_env_row%from_split(para_env_rpa, color_row)
613 CALL para_env_row%sum(right_term_ref)
617 CALL timestop(handle)
619 END SUBROUTINE calc_ia_ia_integrals
642 SUBROUTINE calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
643 M_ia, cottj, wj, D_ia, D_ia_beta, M_ia_beta, &
644 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
645 para_env, para_env_col, para_env_col_beta)
646 REAL(kind=
dp),
INTENT(IN) :: a_scaling
647 REAL(kind=
dp),
INTENT(INOUT) :: left_term, first_deriv
648 INTEGER,
INTENT(IN) :: num_integ_points
649 LOGICAL,
INTENT(IN) :: my_open_shell
650 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
651 INTENT(IN) :: m_ia, cottj, wj, d_ia, d_ia_beta, &
653 INTEGER,
INTENT(IN) :: ncol_local, ncol_local_beta, &
654 num_integ_group, color_rpa_group
658 INTEGER :: iib, jquad
659 REAL(kind=
dp) :: first_deriv_beta, left_term_beta, omega
663 left_term_beta = 0.0_dp
664 first_deriv_beta = 0.0_dp
665 DO jquad = 1, num_integ_points
667 IF (
modulo(jquad, num_integ_group) /= color_rpa_group) cycle
668 omega = a_scaling*cottj(jquad)
670 DO iib = 1, ncol_local
672 IF (
modulo(iib, para_env_col%num_pe) /= para_env_col%mepos) cycle
674 left_term = left_term + wj(jquad)* &
675 (log(1.0_dp + (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2)) - &
676 (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2))
677 first_deriv = first_deriv + wj(jquad)*cottj(jquad)**2* &
678 ((-m_ia(iib) + d_ia(iib)**2)**2/((omega**2 + d_ia(iib)**2)**2*(omega**2 + m_ia(iib))))
681 IF (my_open_shell)
THEN
682 DO iib = 1, ncol_local_beta
684 IF (
modulo(iib, para_env_col_beta%num_pe) /= para_env_col_beta%mepos) cycle
686 left_term_beta = left_term_beta + wj(jquad)* &
687 (log(1.0_dp + (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2)) - &
688 (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2))
690 first_deriv_beta + wj(jquad)*cottj(jquad)**2* &
691 ((-m_ia_beta(iib) + d_ia_beta(iib)**2)**2/((omega**2 + d_ia_beta(iib)**2)**2*(omega**2 + m_ia_beta(iib))))
698 CALL para_env%sum(left_term)
699 CALL para_env%sum(first_deriv)
701 IF (my_open_shell)
THEN
702 CALL para_env%sum(left_term_beta)
703 CALL para_env%sum(first_deriv_beta)
705 left_term = left_term + left_term_beta
706 first_deriv = first_deriv + first_deriv_beta
709 END SUBROUTINE calculate_objfunc
724 E_min, E_max, max_error, num_points_per_magnitude, &
727 INTEGER,
INTENT(IN) :: num_integ_points
728 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
730 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
731 INTENT(INOUT) :: weights_cos_tf_t_to_w
732 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
733 INTENT(IN) :: omega_tj
734 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
735 REAL(kind=
dp),
INTENT(INOUT) :: max_error
736 INTEGER,
INTENT(IN) :: num_points_per_magnitude
737 REAL(kind=
dp),
INTENT(IN) :: regularization
739 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_t_to_w'
741 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
743 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
744 REAL(kind=
dp) :: multiplicator, omega
745 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
747 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
748 mat_sinvvsinvt, mat_u
750 CALL timeset(routinen, handle)
753 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
757 num_x_nodes = max(num_x_nodes, num_integ_points)
759 ALLOCATE (x_values(num_x_nodes))
761 ALLOCATE (y_values(num_x_nodes))
763 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
765 ALLOCATE (tau_wj_work(num_integ_points))
767 ALLOCATE (sing_values(num_integ_points))
769 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
771 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
773 mat_sinvvsinvt = 0.0_dp
775 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
776 ALLOCATE (work(lwork))
778 ALLOCATE (iwork(8*num_integ_points))
780 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
781 mat_sinvvsinvsigma = 0.0_dp
782 ALLOCATE (vec_uty(num_x_nodes))
788 DO jquad = 1, num_integ_points
791 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
792 DO iii = 1, num_x_nodes
793 x_values(iii) = e_min*multiplicator**(iii - 1)
796 omega = omega_tj(jquad)
799 DO iii = 1, num_x_nodes
800 y_values(iii) = 2.0_dp*x_values(iii)/((x_values(iii))**2 + omega**2)
804 DO jjj = 1, num_integ_points
805 DO iii = 1, num_x_nodes
806 mat_a(iii, jjj) = cos(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
811 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
812 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
818 DO jjj = 1, num_integ_points
819 DO iii = 1, num_integ_points
821 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
822 /(regularization**2 + sing_values(jjj)**2)
827 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
828 0.0_dp, vec_uty, num_x_nodes)
831 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
832 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
834 weights_cos_tf_t_to_w(jquad, :) = tau_wj_work(:)
836 CALL calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
837 y_values, num_integ_points, num_x_nodes)
841 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, sing_values, mat_u, mat_sinvvsinvt, &
842 work, iwork, mat_sinvvsinvsigma, vec_uty)
844 CALL timestop(handle)
861 E_min, E_max, max_error, num_points_per_magnitude, regularization)
863 INTEGER,
INTENT(IN) :: num_integ_points
864 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
866 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
867 INTENT(INOUT) :: weights_sin_tf_t_to_w
868 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
869 INTENT(IN) :: omega_tj
870 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
871 REAL(kind=
dp),
INTENT(OUT) :: max_error
872 INTEGER,
INTENT(IN) :: num_points_per_magnitude
873 REAL(kind=
dp),
INTENT(IN) :: regularization
875 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_sin_tf_t_to_w'
877 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
879 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
880 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega
881 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
882 work_array, x_values, y_values
883 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
884 mat_sinvvsinvt, mat_u
886 CALL timeset(routinen, handle)
889 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
893 num_x_nodes = max(num_x_nodes, num_integ_points)
895 ALLOCATE (x_values(num_x_nodes))
897 ALLOCATE (y_values(num_x_nodes))
899 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
901 ALLOCATE (tau_wj_work(num_integ_points))
903 ALLOCATE (work_array(2*num_integ_points))
905 ALLOCATE (sing_values(num_integ_points))
907 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
909 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
911 mat_sinvvsinvt = 0.0_dp
913 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
914 ALLOCATE (work(lwork))
916 ALLOCATE (iwork(8*num_integ_points))
918 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
919 mat_sinvvsinvsigma = 0.0_dp
920 ALLOCATE (vec_uty(num_x_nodes))
926 DO jquad = 1, num_integ_points
928 chi2_min_jquad = 100.0_dp
931 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
932 DO iii = 1, num_x_nodes
933 x_values(iii) = e_min*multiplicator**(iii - 1)
936 omega = omega_tj(jquad)
939 DO iii = 1, num_x_nodes
941 y_values(iii) = 2.0_dp*omega/((x_values(iii))**2 + omega**2)
945 DO jjj = 1, num_integ_points
946 DO iii = 1, num_x_nodes
947 mat_a(iii, jjj) = sin(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
952 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
953 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
959 DO jjj = 1, num_integ_points
960 DO iii = 1, num_integ_points
962 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
963 /(regularization**2 + sing_values(jjj)**2)
968 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
969 0.0_dp, vec_uty, num_x_nodes)
972 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
973 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
975 weights_sin_tf_t_to_w(jquad, :) = tau_wj_work(:)
977 CALL calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
978 y_values, num_integ_points, num_x_nodes)
982 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
983 work, iwork, mat_sinvvsinvsigma, vec_uty)
985 CALL timestop(handle)
1000 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1001 y_values, num_integ_points, num_x_nodes)
1003 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1004 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1005 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1006 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1009 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1011 max_error_tmp = 0.0_dp
1013 DO kkk = 1, num_x_nodes
1017 CALL eval_fit_func_tau_grid_cosine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1019 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1020 max_error_tmp = abs(y_values(kkk) - func_val)
1021 func_val_temp = func_val
1026 IF (max_error_tmp > max_error)
THEN
1028 max_error = max_error_tmp
1032 END SUBROUTINE calc_max_error_fit_tau_grid_with_cosine
1043 PURE SUBROUTINE eval_fit_func_tau_grid_cosine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1045 REAL(kind=
dp),
INTENT(OUT) :: func_val
1046 REAL(kind=
dp),
INTENT(IN) :: x_value
1047 INTEGER,
INTENT(IN) :: num_integ_points
1048 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1049 INTENT(IN) :: tau_tj, tau_wj_work
1050 REAL(kind=
dp),
INTENT(IN) :: omega
1056 DO iii = 1, num_integ_points
1059 func_val = func_val + tau_wj_work(iii)*cos(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1063 END SUBROUTINE eval_fit_func_tau_grid_cosine
1074 PURE SUBROUTINE eval_fit_func_tau_grid_sine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1076 REAL(kind=
dp),
INTENT(INOUT) :: func_val
1077 REAL(kind=
dp),
INTENT(IN) :: x_value
1078 INTEGER,
INTENT(in) :: num_integ_points
1079 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1080 INTENT(IN) :: tau_tj, tau_wj_work
1081 REAL(kind=
dp),
INTENT(IN) :: omega
1087 DO iii = 1, num_integ_points
1090 func_val = func_val + tau_wj_work(iii)*sin(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1094 END SUBROUTINE eval_fit_func_tau_grid_sine
1107 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1108 y_values, num_integ_points, num_x_nodes)
1110 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1111 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1112 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1113 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1116 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1118 max_error_tmp = 0.0_dp
1120 DO kkk = 1, num_x_nodes
1124 CALL eval_fit_func_tau_grid_sine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1126 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1127 max_error_tmp = abs(y_values(kkk) - func_val)
1128 func_val_temp = func_val
1133 IF (max_error_tmp > max_error)
THEN
1135 max_error = max_error_tmp
1139 END SUBROUTINE calc_max_error_fit_tau_grid_with_sine
1148 INTEGER,
INTENT(IN) :: nr, iw
1150 INTEGER :: ierr, ir, jquad, num_integ_points
1151 REAL(kind=
dp) :: max_error, multiplicator, rc, rc_max
1152 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: tau_tj, tau_wj, tj, wj, x_tw
1153 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: weights_cos_tf_t_to_w
1157 multiplicator = rc_max**(1.0_dp/(real(nr, kind=
dp) - 1.0_dp))
1159 DO num_integ_points = 1, 20
1161 ALLOCATE (x_tw(2*num_integ_points))
1163 ALLOCATE (tau_tj(num_integ_points))
1165 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
1166 weights_cos_tf_t_to_w = 0.0_dp
1167 ALLOCATE (tau_wj(num_integ_points))
1169 ALLOCATE (tj(num_integ_points))
1171 ALLOCATE (wj(num_integ_points))
1176 rc = 2.0_dp*multiplicator**ir
1181 DO jquad = 1, num_integ_points
1182 tj(jquad) = x_tw(jquad)
1183 wj(jquad) = x_tw(jquad + num_integ_points)
1190 DO jquad = 1, num_integ_points
1191 tau_tj(jquad) = x_tw(jquad)/2.0_dp
1192 tau_wj(jquad) = x_tw(jquad + num_integ_points)/2.0_dp
1196 weights_cos_tf_t_to_w, tj, &
1197 1.0_dp, rc, max_error, 200, 0.0_dp)
1200 WRITE (iw,
'(T2, I3, F12.1, ES12.3)') num_integ_points, rc, max_error
1205 DEALLOCATE (x_tw, tau_tj, weights_cos_tf_t_to_w, tau_wj, wj, tj)
1224 E_min, E_max, max_error, num_points_per_magnitude, regularization)
1226 INTEGER,
INTENT(IN) :: num_integ_points
1227 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1228 INTENT(IN) :: tau_tj
1229 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
1230 INTENT(INOUT) :: weights_cos_tf_w_to_t
1231 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1232 INTENT(IN) :: omega_tj
1233 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
1234 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1235 INTEGER,
INTENT(IN) :: num_points_per_magnitude
1236 REAL(kind=
dp),
INTENT(IN) :: regularization
1238 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_w_to_t'
1240 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
1242 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1243 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega, &
1245 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: omega_wj_work, sing_values, vec_uty, &
1246 work, work_array, x_values, y_values
1247 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
1248 mat_sinvvsinvt, mat_u
1250 CALL timeset(routinen, handle)
1253 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
1257 num_x_nodes = max(num_x_nodes, num_integ_points)
1259 ALLOCATE (x_values(num_x_nodes))
1261 ALLOCATE (y_values(num_x_nodes))
1263 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
1265 ALLOCATE (omega_wj_work(num_integ_points))
1266 omega_wj_work = 0.0_dp
1267 ALLOCATE (work_array(2*num_integ_points))
1269 ALLOCATE (sing_values(num_integ_points))
1270 sing_values = 0.0_dp
1271 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
1273 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
1275 mat_sinvvsinvt = 0.0_dp
1277 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
1278 ALLOCATE (work(lwork))
1280 ALLOCATE (iwork(8*num_integ_points))
1282 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
1283 mat_sinvvsinvsigma = 0.0_dp
1284 ALLOCATE (vec_uty(num_x_nodes))
1288 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
1289 DO iii = 1, num_x_nodes
1290 x_values(iii) = e_min*multiplicator**(iii - 1)
1296 DO jquad = 1, num_integ_points
1298 chi2_min_jquad = 100.0_dp
1303 DO iii = 1, num_x_nodes
1304 y_values(iii) = exp(-x_values(iii)*tau)
1308 DO jjj = 1, num_integ_points
1309 DO iii = 1, num_x_nodes
1310 omega = omega_tj(jjj)
1311 x_value = x_values(iii)
1312 mat_a(iii, jjj) = cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1317 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
1318 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
1324 DO jjj = 1, num_integ_points
1325 DO iii = 1, num_integ_points
1327 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
1328 /(regularization**2 + sing_values(jjj)**2)
1333 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
1334 0.0_dp, vec_uty, num_x_nodes)
1337 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
1338 num_x_nodes, 0.0_dp, omega_wj_work, num_integ_points)
1340 weights_cos_tf_w_to_t(jquad, :) = omega_wj_work(:)
1342 CALL calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1343 y_values, num_integ_points, num_x_nodes)
1347 DEALLOCATE (x_values, y_values, mat_a, omega_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
1348 work, iwork, mat_sinvvsinvsigma, vec_uty)
1350 CALL timestop(handle)
1365 SUBROUTINE calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1366 y_values, num_integ_points, num_x_nodes)
1368 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1369 REAL(kind=
dp),
INTENT(IN) :: tau
1370 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1371 INTENT(IN) :: omega_tj, omega_wj_work, x_values, &
1373 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1375 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_max_error_fit_omega_grid_with_cosine'
1377 INTEGER :: handle, kkk
1378 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1380 CALL timeset(routinen, handle)
1382 max_error_tmp = 0.0_dp
1384 DO kkk = 1, num_x_nodes
1388 CALL eval_fit_func_omega_grid_cosine(func_val, x_values(kkk), num_integ_points, omega_tj, omega_wj_work, tau)
1390 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1391 max_error_tmp = abs(y_values(kkk) - func_val)
1392 func_val_temp = func_val
1397 IF (max_error_tmp > max_error)
THEN
1399 max_error = max_error_tmp
1403 CALL timestop(handle)
1405 END SUBROUTINE calc_max_error_fit_omega_grid_with_cosine
1416 PURE SUBROUTINE eval_fit_func_omega_grid_cosine(func_val, x_value, num_integ_points, omega_tj, omega_wj_work, tau)
1417 REAL(kind=
dp),
INTENT(OUT) :: func_val
1418 REAL(kind=
dp),
INTENT(IN) :: x_value
1419 INTEGER,
INTENT(IN) :: num_integ_points
1420 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1421 INTENT(IN) :: omega_tj, omega_wj_work
1422 REAL(kind=
dp),
INTENT(IN) :: tau
1425 REAL(kind=
dp) :: omega
1429 DO iii = 1, num_integ_points
1432 omega = omega_tj(iii)
1433 func_val = func_val + omega_wj_work(iii)*cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1437 END SUBROUTINE eval_fit_func_omega_grid_cosine
1447 SUBROUTINE gap_and_max_eig_diff_kpoints(qs_env, para_env, gap, max_eig_diff, e_fermi)
1451 REAL(kind=
dp),
INTENT(OUT) :: gap, max_eig_diff, e_fermi
1453 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gap_and_max_eig_diff_kpoints'
1455 INTEGER :: handle, homo, ikpgr, ispin, kplocal, &
1457 INTEGER,
DIMENSION(2) :: kp_range
1458 REAL(kind=
dp) :: e_homo, e_homo_temp, e_lumo, e_lumo_temp
1459 REAL(kind=
dp),
DIMENSION(3) :: tmp
1460 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1465 CALL timeset(routinen, handle)
1470 mo_set => kpoint%kp_env(1)%kpoint_env%mos(1, 1)
1474 kplocal = kp_range(2) - kp_range(1) + 1
1477 max_eig_diff = 0.0_dp
1481 DO ikpgr = 1, kplocal
1482 kp => kpoint%kp_env(ikpgr)%kpoint_env
1483 nspin =
SIZE(kp%mos, 2)
1485 mo_set => kp%mos(1, ispin)
1486 CALL get_mo_set(mo_set, eigenvalues=eigenvalues, homo=homo)
1487 e_homo_temp = eigenvalues(homo)
1488 e_lumo_temp = eigenvalues(homo + 1)
1490 IF (e_homo_temp > e_homo) e_homo = e_homo_temp
1491 IF (e_lumo_temp < e_lumo) e_lumo = e_lumo_temp
1492 IF (eigenvalues(nmo) - eigenvalues(1) > max_eig_diff) max_eig_diff = eigenvalues(nmo) - eigenvalues(1)
1501 tmp(3) = max_eig_diff
1502 CALL para_env%max(tmp)
1504 gap = -tmp(2) - tmp(1)
1505 e_fermi = (tmp(1) - tmp(2))*0.5_dp
1506 max_eig_diff = tmp(3)
1508 CALL timestop(handle)
1525 SUBROUTINE determine_energy_range(qs_env, para_env, homo, Eigenval, do_ri_sos_laplace_mp2, &
1526 do_kpoints_cubic_RPA, Emin, Emax, e_range, e_fermi)
1530 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo
1531 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
1532 LOGICAL,
INTENT(IN) :: do_ri_sos_laplace_mp2, &
1533 do_kpoints_cubic_rpa
1534 REAL(kind=
dp),
INTENT(OUT) :: emin, emax, e_range, e_fermi
1536 CHARACTER(LEN=*),
PARAMETER :: routinen =
'determine_energy_range'
1538 INTEGER :: handle, ispin, nspins
1539 LOGICAL :: my_do_kpoints
1542 CALL timeset(routinen, handle)
1547 my_do_kpoints = .false.
1548 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
1549 my_do_kpoints = do_kpoints_cubic_rpa
1552 IF (my_do_kpoints)
THEN
1553 CALL gap_and_max_eig_diff_kpoints(qs_env, para_env, emin, emax, e_fermi)
1556 IF (qs_env%mp2_env%E_range <= 1.0_dp .OR. qs_env%mp2_env%E_gap <= 0.0_dp)
THEN
1559 DO ispin = 1, nspins
1560 IF (homo(ispin) > 0)
THEN
1561 emin = min(emin, eigenval(homo(ispin) + 1, 1, ispin) - eigenval(homo(ispin), 1, ispin))
1562 emax = max(emax, maxval(eigenval(:, :, ispin)) - minval(eigenval(:, :, ispin)))
1566 qs_env%mp2_env%e_range = e_range
1567 qs_env%mp2_env%e_gap = emin
1573 e_range = qs_env%mp2_env%E_range
1574 emin = qs_env%mp2_env%E_gap
1582 IF (do_ri_sos_laplace_mp2)
THEN
1587 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
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)
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, 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, 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, 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