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)
76 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
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
85 TYPE(qs_environment_type),
POINTER :: qs_env
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
104 TYPE(section_vals_type),
POINTER :: input
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)
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:", my_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)
207 IF (do_im_time .OR. do_ri_sos_laplace_mp2)
THEN
209 ALLOCATE (x_tw(2*num_integ_points))
212 IF (num_integ_points .LE. 20)
THEN
220 IF (do_ri_sos_laplace_mp2) scaling = 1.0_dp
222 ALLOCATE (tau_tj(0:num_integ_points))
225 ALLOCATE (tau_wj(num_integ_points))
228 DO jquad = 1, num_integ_points
229 tau_tj(jquad) = x_tw(jquad)/scaling
230 tau_wj(jquad) = x_tw(jquad + num_integ_points)/scaling
235 IF (unit_nr > 0 .AND. do_print)
THEN
236 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
237 "MINIMAX_INFO| Range for the minimax approximation:", my_e_range
239 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,F15.4)") &
240 "MINIMAX_INFO| Gap:", emin
241 WRITE (unit=unit_nr, fmt=
"(T3,A,T54,A,T72,A)") &
242 "MINIMAX_INFO| Minimax parameters of the time grid:",
"Weights",
"Abscissas"
243 DO jquad = 1, num_integ_points
244 WRITE (unit=unit_nr, fmt=
"(T41,F20.10,F20.10)") tau_wj(jquad), tau_tj(jquad)
250 tau_tj(:) = tau_tj(:)/emin
251 tau_wj(:) = tau_wj(:)/emin
253 IF (.NOT. do_ri_sos_laplace_mp2)
THEN
254 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
255 weights_cos_tf_t_to_w = 0.0_dp
258 emin, emax, max_error_min, num_points_per_magnitude, &
262 ALLOCATE (weights_cos_tf_w_to_t(num_integ_points, num_integ_points))
263 weights_cos_tf_w_to_t = 0.0_dp
266 emin, emax, max_error_min, num_points_per_magnitude, &
269 IF (do_gw_im_time)
THEN
272 ALLOCATE (weights_sin_tf_t_to_w(num_integ_points, num_integ_points))
273 weights_sin_tf_t_to_w = 0.0_dp
276 emin, emax, max_error_min, num_points_per_magnitude, &
279 IF (unit_nr > 0)
THEN
280 WRITE (unit=unit_nr, fmt=
"(T3,A,T66,ES15.2)") &
281 "MINIMAX_INFO| Maximum deviation of the imag. time fit:", max_error_min
289 CALL timestop(handle)
311 SUBROUTINE get_clenshaw_grid(para_env, para_env_RPA, unit_nr, homo, virtual, Eigenval, num_integ_points, &
312 num_integ_group, color_rpa_group, fm_mat_S, my_do_gw, &
313 ext_scaling, a_scaling, tj, wj)
315 TYPE(mp_para_env_type),
INTENT(IN) :: para_env, para_env_rpa
316 INTEGER,
INTENT(IN) :: unit_nr
317 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
318 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
319 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
321 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
322 LOGICAL,
INTENT(IN) :: my_do_gw
323 REAL(kind=
dp),
INTENT(IN) :: ext_scaling
324 REAL(kind=
dp),
INTENT(OUT) :: a_scaling
325 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
326 INTENT(OUT) :: tj, wj
328 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_clenshaw_grid'
330 INTEGER :: handle, jquad, nspins
331 LOGICAL :: my_open_shell
333 CALL timeset(routinen, handle)
336 my_open_shell = (nspins == 2)
339 ALLOCATE (tj(num_integ_points))
342 ALLOCATE (wj(num_integ_points))
345 DO jquad = 1, num_integ_points - 1
346 tj(jquad) = jquad*
pi/(2.0_dp*num_integ_points)
347 wj(jquad) =
pi/(num_integ_points*sin(tj(jquad))**2)
349 tj(num_integ_points) =
pi/2.0_dp
350 wj(num_integ_points) =
pi/(2.0_dp*num_integ_points*sin(tj(num_integ_points))**2)
352 IF (my_do_gw .AND. ext_scaling > 0.0_dp)
THEN
353 a_scaling = ext_scaling
355 CALL calc_scaling_factor(a_scaling, para_env, para_env_rpa, homo, virtual, eigenval, &
356 num_integ_points, num_integ_group, color_rpa_group, &
360 IF (unit_nr > 0)
WRITE (unit_nr,
'(T3,A,T56,F25.5)')
'INTEG_INFO| Scaling parameter:', a_scaling
362 wj(:) = wj(:)*a_scaling
364 CALL timestop(handle)
383 SUBROUTINE calc_scaling_factor(a_scaling_ext, para_env, para_env_RPA, homo, virtual, Eigenval, &
384 num_integ_points, num_integ_group, color_rpa_group, &
385 tj_ext, wj_ext, fm_mat_S)
386 REAL(kind=
dp),
INTENT(OUT) :: a_scaling_ext
387 TYPE(mp_para_env_type),
INTENT(IN) :: para_env, para_env_rpa
388 INTEGER,
DIMENSION(:),
INTENT(IN) :: homo, virtual
389 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(IN) :: eigenval
390 INTEGER,
INTENT(IN) :: num_integ_points, num_integ_group, &
392 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
393 INTENT(IN) :: tj_ext, wj_ext
394 TYPE(cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_s
396 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_scaling_factor'
398 INTEGER :: handle, icycle, jquad, ncol_local, &
399 ncol_local_beta, nspins
400 LOGICAL :: my_open_shell
401 REAL(kind=
dp) :: a_high, a_low, a_scaling, conv_param, eps, first_deriv, left_term, &
402 right_term, right_term_ref, right_term_ref_beta, step
403 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cottj, d_ia, d_ia_beta, iaia_ri, &
404 iaia_ri_beta, m_ia, m_ia_beta
405 TYPE(mp_para_env_type),
POINTER :: para_env_col, para_env_col_beta
407 CALL timeset(routinen, handle)
410 my_open_shell = (nspins == 2)
414 ALLOCATE (cottj(num_integ_points))
417 DO jquad = 1, num_integ_points
418 cottj(jquad) = 1.0_dp/tan(tj_ext(jquad))
421 CALL calc_ia_ia_integrals(para_env_rpa, homo(1), virtual(1), ncol_local, right_term_ref, eigenval(:, 1, 1), &
422 d_ia, iaia_ri, m_ia, fm_mat_s(1), para_env_col)
425 IF (my_open_shell)
THEN
426 CALL calc_ia_ia_integrals(para_env_rpa, homo(2), virtual(2), ncol_local_beta, right_term_ref_beta, eigenval(:, 1, 2), &
427 d_ia_beta, iaia_ri_beta, m_ia_beta, fm_mat_s(2), para_env_col_beta)
429 right_term_ref = right_term_ref + right_term_ref_beta
433 IF (para_env%mepos == 0)
THEN
434 CALL para_env%bcast(right_term_ref, 0)
436 right_term_ref = 0.0_dp
437 CALL para_env%bcast(right_term_ref, 0)
442 conv_param = 100.0_dp*epsilon(right_term_ref)
446 right_term = -right_term_ref
447 DO icycle = 1, num_integ_points*2
450 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
451 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
452 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
453 para_env, para_env_col, para_env_col_beta)
454 left_term = left_term/4.0_dp/
pi*a_scaling
456 IF (abs(left_term) > abs(right_term) .OR. abs(left_term + right_term) <= conv_param)
EXIT
458 a_high = a_high + step
462 IF (abs(left_term + right_term) >= conv_param)
THEN
463 IF (a_scaling >= 2*num_integ_points*step)
THEN
467 DO icycle = 1, num_integ_points*2
468 a_scaling = (a_low + a_high)/2.0_dp
470 CALL calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
471 m_ia, cottj, wj_ext, d_ia, d_ia_beta, m_ia_beta, &
472 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
473 para_env, para_env_col, para_env_col_beta)
474 left_term = left_term/4.0_dp/
pi*a_scaling
476 IF (abs(left_term) > abs(right_term))
THEN
482 IF (abs(a_high - a_low) < 1.0e-5_dp)
EXIT
489 a_scaling_ext = a_scaling
490 CALL para_env%bcast(a_scaling_ext, 0)
498 IF (my_open_shell)
THEN
499 DEALLOCATE (iaia_ri_beta)
500 DEALLOCATE (d_ia_beta)
501 DEALLOCATE (m_ia_beta)
505 CALL timestop(handle)
507 END SUBROUTINE calc_scaling_factor
523 SUBROUTINE calc_ia_ia_integrals(para_env_RPA, homo, virtual, ncol_local, right_term_ref, Eigenval, &
524 D_ia, iaia_RI, M_ia, fm_mat_S, para_env_col)
526 TYPE(mp_para_env_type),
INTENT(IN) :: para_env_rpa
527 INTEGER,
INTENT(IN) :: homo, virtual
528 INTEGER,
INTENT(OUT) :: ncol_local
529 REAL(kind=
dp),
INTENT(OUT) :: right_term_ref
530 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenval
531 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
532 INTENT(OUT) :: d_ia, iaia_ri, m_ia
533 TYPE(cp_fm_type),
INTENT(IN) :: fm_mat_s
534 TYPE(mp_para_env_type),
POINTER :: para_env_col
536 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_ia_ia_integrals'
538 INTEGER :: avirt, color_col, color_row, handle, &
539 i_global, iib, iocc, nrow_local
540 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
541 REAL(kind=
dp) :: eigen_diff
542 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: iaia_ri_dp
543 TYPE(mp_para_env_type),
POINTER :: para_env_row
545 CALL timeset(routinen, handle)
551 nrow_local=nrow_local, &
552 ncol_local=ncol_local, &
553 row_indices=row_indices, &
554 col_indices=col_indices)
557 ALLOCATE (iaia_ri_dp(ncol_local))
561 DO iib = 1, ncol_local
562 iaia_ri_dp(iib) = iaia_ri_dp(iib) + dot_product(fm_mat_s%local_data(:, iib), fm_mat_s%local_data(:, iib))
581 color_col = fm_mat_s%matrix_struct%context%mepos(2)
582 ALLOCATE (para_env_col)
583 CALL para_env_col%from_split(para_env_rpa, color_col)
585 CALL para_env_col%sum(iaia_ri_dp)
588 ALLOCATE (iaia_ri(ncol_local))
589 DO iib = 1, ncol_local
590 iaia_ri(iib) = iaia_ri_dp(iib)
592 DEALLOCATE (iaia_ri_dp)
597 ALLOCATE (d_ia(ncol_local))
599 ALLOCATE (m_ia(ncol_local))
601 DO iib = 1, ncol_local
602 i_global = col_indices(iib)
604 iocc = max(1, i_global - 1)/virtual + 1
605 avirt = i_global - (iocc - 1)*virtual
606 eigen_diff = eigenval(avirt + homo) - eigenval(iocc)
608 d_ia(iib) = eigen_diff
611 DO iib = 1, ncol_local
612 m_ia(iib) = d_ia(iib)*d_ia(iib) + 2.0_dp*d_ia(iib)*iaia_ri(iib)
615 right_term_ref = 0.0_dp
616 DO iib = 1, ncol_local
617 right_term_ref = right_term_ref + (sqrt(m_ia(iib)) - d_ia(iib) - iaia_ri(iib))
619 right_term_ref = right_term_ref/2.0_dp
622 color_row = fm_mat_s%matrix_struct%context%mepos(1)
623 ALLOCATE (para_env_row)
624 CALL para_env_row%from_split(para_env_rpa, color_row)
627 CALL para_env_row%sum(right_term_ref)
631 CALL timestop(handle)
633 END SUBROUTINE calc_ia_ia_integrals
656 SUBROUTINE calculate_objfunc(a_scaling, left_term, first_deriv, num_integ_points, my_open_shell, &
657 M_ia, cottj, wj, D_ia, D_ia_beta, M_ia_beta, &
658 ncol_local, ncol_local_beta, num_integ_group, color_rpa_group, &
659 para_env, para_env_col, para_env_col_beta)
660 REAL(kind=
dp),
INTENT(IN) :: a_scaling
661 REAL(kind=
dp),
INTENT(INOUT) :: left_term, first_deriv
662 INTEGER,
INTENT(IN) :: num_integ_points
663 LOGICAL,
INTENT(IN) :: my_open_shell
664 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
665 INTENT(IN) :: m_ia, cottj, wj, d_ia, d_ia_beta, &
667 INTEGER,
INTENT(IN) :: ncol_local, ncol_local_beta, &
668 num_integ_group, color_rpa_group
669 TYPE(mp_para_env_type),
INTENT(IN) :: para_env, para_env_col
670 TYPE(mp_para_env_type),
POINTER :: para_env_col_beta
672 INTEGER :: iib, jquad
673 REAL(kind=
dp) :: first_deriv_beta, left_term_beta, omega
677 left_term_beta = 0.0_dp
678 first_deriv_beta = 0.0_dp
679 DO jquad = 1, num_integ_points
681 IF (
modulo(jquad, num_integ_group) /= color_rpa_group) cycle
682 omega = a_scaling*cottj(jquad)
684 DO iib = 1, ncol_local
686 IF (
modulo(iib, para_env_col%num_pe) /= para_env_col%mepos) cycle
688 left_term = left_term + wj(jquad)* &
689 (log(1.0_dp + (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2)) - &
690 (m_ia(iib) - d_ia(iib)**2)/(omega**2 + d_ia(iib)**2))
691 first_deriv = first_deriv + wj(jquad)*cottj(jquad)**2* &
692 ((-m_ia(iib) + d_ia(iib)**2)**2/((omega**2 + d_ia(iib)**2)**2*(omega**2 + m_ia(iib))))
695 IF (my_open_shell)
THEN
696 DO iib = 1, ncol_local_beta
698 IF (
modulo(iib, para_env_col_beta%num_pe) /= para_env_col_beta%mepos) cycle
700 left_term_beta = left_term_beta + wj(jquad)* &
701 (log(1.0_dp + (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2)) - &
702 (m_ia_beta(iib) - d_ia_beta(iib)**2)/(omega**2 + d_ia_beta(iib)**2))
704 first_deriv_beta + wj(jquad)*cottj(jquad)**2* &
705 ((-m_ia_beta(iib) + d_ia_beta(iib)**2)**2/((omega**2 + d_ia_beta(iib)**2)**2*(omega**2 + m_ia_beta(iib))))
712 CALL para_env%sum(left_term)
713 CALL para_env%sum(first_deriv)
715 IF (my_open_shell)
THEN
716 CALL para_env%sum(left_term_beta)
717 CALL para_env%sum(first_deriv_beta)
719 left_term = left_term + left_term_beta
720 first_deriv = first_deriv + first_deriv_beta
723 END SUBROUTINE calculate_objfunc
738 E_min, E_max, max_error, num_points_per_magnitude, &
741 INTEGER,
INTENT(IN) :: num_integ_points
742 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
744 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
745 INTENT(INOUT) :: weights_cos_tf_t_to_w
746 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
747 INTENT(IN) :: omega_tj
748 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
749 REAL(kind=
dp),
INTENT(INOUT) :: max_error
750 INTEGER,
INTENT(IN) :: num_points_per_magnitude
751 REAL(kind=
dp),
INTENT(IN) :: regularization
753 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_t_to_w'
755 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
757 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
758 REAL(kind=
dp) :: multiplicator, omega
759 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
761 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
762 mat_sinvvsinvt, mat_u
764 CALL timeset(routinen, handle)
767 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
771 num_x_nodes = max(num_x_nodes, num_integ_points)
773 ALLOCATE (x_values(num_x_nodes))
775 ALLOCATE (y_values(num_x_nodes))
777 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
779 ALLOCATE (tau_wj_work(num_integ_points))
781 ALLOCATE (sing_values(num_integ_points))
783 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
785 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
787 mat_sinvvsinvt = 0.0_dp
789 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
790 ALLOCATE (work(lwork))
792 ALLOCATE (iwork(8*num_integ_points))
794 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
795 mat_sinvvsinvsigma = 0.0_dp
796 ALLOCATE (vec_uty(num_x_nodes))
802 DO jquad = 1, num_integ_points
805 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
806 DO iii = 1, num_x_nodes
807 x_values(iii) = e_min*multiplicator**(iii - 1)
810 omega = omega_tj(jquad)
813 DO iii = 1, num_x_nodes
814 y_values(iii) = 2.0_dp*x_values(iii)/((x_values(iii))**2 + omega**2)
818 DO jjj = 1, num_integ_points
819 DO iii = 1, num_x_nodes
820 mat_a(iii, jjj) = cos(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
825 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
826 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
832 DO jjj = 1, num_integ_points
833 DO iii = 1, num_integ_points
835 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
836 /(regularization**2 + sing_values(jjj)**2)
841 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
842 0.0_dp, vec_uty, num_x_nodes)
845 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
846 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
848 weights_cos_tf_t_to_w(jquad, :) = tau_wj_work(:)
850 CALL calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
851 y_values, num_integ_points, num_x_nodes)
855 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, sing_values, mat_u, mat_sinvvsinvt, &
856 work, iwork, mat_sinvvsinvsigma, vec_uty)
858 CALL timestop(handle)
875 E_min, E_max, max_error, num_points_per_magnitude, regularization)
877 INTEGER,
INTENT(IN) :: num_integ_points
878 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
880 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
881 INTENT(INOUT) :: weights_sin_tf_t_to_w
882 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
883 INTENT(IN) :: omega_tj
884 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
885 REAL(kind=
dp),
INTENT(OUT) :: max_error
886 INTEGER,
INTENT(IN) :: num_points_per_magnitude
887 REAL(kind=
dp),
INTENT(IN) :: regularization
889 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_sin_tf_t_to_w'
891 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
893 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
894 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega
895 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: sing_values, tau_wj_work, vec_uty, work, &
896 work_array, x_values, y_values
897 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
898 mat_sinvvsinvt, mat_u
900 CALL timeset(routinen, handle)
903 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
907 num_x_nodes = max(num_x_nodes, num_integ_points)
909 ALLOCATE (x_values(num_x_nodes))
911 ALLOCATE (y_values(num_x_nodes))
913 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
915 ALLOCATE (tau_wj_work(num_integ_points))
917 ALLOCATE (work_array(2*num_integ_points))
919 ALLOCATE (sing_values(num_integ_points))
921 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
923 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
925 mat_sinvvsinvt = 0.0_dp
927 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
928 ALLOCATE (work(lwork))
930 ALLOCATE (iwork(8*num_integ_points))
932 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
933 mat_sinvvsinvsigma = 0.0_dp
934 ALLOCATE (vec_uty(num_x_nodes))
940 DO jquad = 1, num_integ_points
942 chi2_min_jquad = 100.0_dp
945 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
946 DO iii = 1, num_x_nodes
947 x_values(iii) = e_min*multiplicator**(iii - 1)
950 omega = omega_tj(jquad)
953 DO iii = 1, num_x_nodes
955 y_values(iii) = 2.0_dp*omega/((x_values(iii))**2 + omega**2)
959 DO jjj = 1, num_integ_points
960 DO iii = 1, num_x_nodes
961 mat_a(iii, jjj) = sin(omega*tau_tj(jjj))*exp(-x_values(iii)*tau_tj(jjj))
966 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
967 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
973 DO jjj = 1, num_integ_points
974 DO iii = 1, num_integ_points
976 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
977 /(regularization**2 + sing_values(jjj)**2)
982 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
983 0.0_dp, vec_uty, num_x_nodes)
986 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
987 num_x_nodes, 0.0_dp, tau_wj_work, num_integ_points)
989 weights_sin_tf_t_to_w(jquad, :) = tau_wj_work(:)
991 CALL calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
992 y_values, num_integ_points, num_x_nodes)
996 DEALLOCATE (x_values, y_values, mat_a, tau_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
997 work, iwork, mat_sinvvsinvsigma, vec_uty)
999 CALL timestop(handle)
1014 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_cosine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1015 y_values, num_integ_points, num_x_nodes)
1017 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1018 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1019 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1020 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1023 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1025 max_error_tmp = 0.0_dp
1027 DO kkk = 1, num_x_nodes
1031 CALL eval_fit_func_tau_grid_cosine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1033 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1034 max_error_tmp = abs(y_values(kkk) - func_val)
1035 func_val_temp = func_val
1040 IF (max_error_tmp > max_error)
THEN
1042 max_error = max_error_tmp
1046 END SUBROUTINE calc_max_error_fit_tau_grid_with_cosine
1057 PURE SUBROUTINE eval_fit_func_tau_grid_cosine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1059 REAL(kind=
dp),
INTENT(OUT) :: func_val
1060 REAL(kind=
dp),
INTENT(IN) :: x_value
1061 INTEGER,
INTENT(IN) :: num_integ_points
1062 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1063 INTENT(IN) :: tau_tj, tau_wj_work
1064 REAL(kind=
dp),
INTENT(IN) :: omega
1070 DO iii = 1, num_integ_points
1073 func_val = func_val + tau_wj_work(iii)*cos(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1077 END SUBROUTINE eval_fit_func_tau_grid_cosine
1088 PURE SUBROUTINE eval_fit_func_tau_grid_sine(func_val, x_value, num_integ_points, tau_tj, tau_wj_work, omega)
1090 REAL(kind=
dp),
INTENT(INOUT) :: func_val
1091 REAL(kind=
dp),
INTENT(IN) :: x_value
1092 INTEGER,
INTENT(in) :: num_integ_points
1093 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1094 INTENT(IN) :: tau_tj, tau_wj_work
1095 REAL(kind=
dp),
INTENT(IN) :: omega
1101 DO iii = 1, num_integ_points
1104 func_val = func_val + tau_wj_work(iii)*sin(omega*tau_tj(iii))*exp(-x_value*tau_tj(iii))
1108 END SUBROUTINE eval_fit_func_tau_grid_sine
1121 PURE SUBROUTINE calc_max_error_fit_tau_grid_with_sine(max_error, omega, tau_tj, tau_wj_work, x_values, &
1122 y_values, num_integ_points, num_x_nodes)
1124 REAL(kind=
dp),
INTENT(INOUT) :: max_error, omega
1125 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1126 INTENT(IN) :: tau_tj, tau_wj_work, x_values, y_values
1127 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1130 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1132 max_error_tmp = 0.0_dp
1134 DO kkk = 1, num_x_nodes
1138 CALL eval_fit_func_tau_grid_sine(func_val, x_values(kkk), num_integ_points, tau_tj, tau_wj_work, omega)
1140 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1141 max_error_tmp = abs(y_values(kkk) - func_val)
1142 func_val_temp = func_val
1147 IF (max_error_tmp > max_error)
THEN
1149 max_error = max_error_tmp
1153 END SUBROUTINE calc_max_error_fit_tau_grid_with_sine
1162 INTEGER,
INTENT(IN) :: nr, iw
1164 INTEGER :: ierr, ir, jquad, num_integ_points
1165 REAL(kind=
dp) :: max_error, multiplicator, rc, rc_max
1166 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: tau_tj, tau_wj, tj, wj, x_tw
1167 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: weights_cos_tf_t_to_w
1171 multiplicator = rc_max**(1.0_dp/(real(nr, kind=
dp) - 1.0_dp))
1173 DO num_integ_points = 1, 20
1175 ALLOCATE (x_tw(2*num_integ_points))
1177 ALLOCATE (tau_tj(num_integ_points))
1179 ALLOCATE (weights_cos_tf_t_to_w(num_integ_points, num_integ_points))
1180 weights_cos_tf_t_to_w = 0.0_dp
1181 ALLOCATE (tau_wj(num_integ_points))
1183 ALLOCATE (tj(num_integ_points))
1185 ALLOCATE (wj(num_integ_points))
1190 rc = 2.0_dp*multiplicator**ir
1195 DO jquad = 1, num_integ_points
1196 tj(jquad) = x_tw(jquad)
1197 wj(jquad) = x_tw(jquad + num_integ_points)
1204 DO jquad = 1, num_integ_points
1205 tau_tj(jquad) = x_tw(jquad)/2.0_dp
1206 tau_wj(jquad) = x_tw(jquad + num_integ_points)/2.0_dp
1210 weights_cos_tf_t_to_w, tj, &
1211 1.0_dp, rc, max_error, 200, 0.0_dp)
1214 WRITE (iw,
'(T2, I3, F12.1, ES12.3)') num_integ_points, rc, max_error
1219 DEALLOCATE (x_tw, tau_tj, weights_cos_tf_t_to_w, tau_wj, wj, tj)
1238 E_min, E_max, max_error, num_points_per_magnitude, regularization)
1240 INTEGER,
INTENT(IN) :: num_integ_points
1241 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1242 INTENT(IN) :: tau_tj
1243 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
1244 INTENT(INOUT) :: weights_cos_tf_w_to_t
1245 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1246 INTENT(IN) :: omega_tj
1247 REAL(kind=
dp),
INTENT(IN) :: e_min, e_max
1248 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1249 INTEGER,
INTENT(IN) :: num_points_per_magnitude
1250 REAL(kind=
dp),
INTENT(IN) :: regularization
1252 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_l_sq_wghts_cos_tf_w_to_t'
1254 INTEGER :: handle, iii, info, jjj, jquad, lwork, &
1256 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1257 REAL(kind=
dp) :: chi2_min_jquad, multiplicator, omega, &
1259 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: omega_wj_work, sing_values, vec_uty, &
1260 work, work_array, x_values, y_values
1261 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: mat_a, mat_sinvvsinvsigma, &
1262 mat_sinvvsinvt, mat_u
1264 CALL timeset(routinen, handle)
1267 num_x_nodes = (int(log10(e_max/e_min)) + 1)*num_points_per_magnitude
1271 num_x_nodes = max(num_x_nodes, num_integ_points)
1273 ALLOCATE (x_values(num_x_nodes))
1275 ALLOCATE (y_values(num_x_nodes))
1277 ALLOCATE (mat_a(num_x_nodes, num_integ_points))
1279 ALLOCATE (omega_wj_work(num_integ_points))
1280 omega_wj_work = 0.0_dp
1281 ALLOCATE (work_array(2*num_integ_points))
1283 ALLOCATE (sing_values(num_integ_points))
1284 sing_values = 0.0_dp
1285 ALLOCATE (mat_u(num_x_nodes, num_x_nodes))
1287 ALLOCATE (mat_sinvvsinvt(num_x_nodes, num_integ_points))
1289 mat_sinvvsinvt = 0.0_dp
1291 lwork = 8*num_integ_points*num_integ_points + 12*num_integ_points + 2*num_x_nodes
1292 ALLOCATE (work(lwork))
1294 ALLOCATE (iwork(8*num_integ_points))
1296 ALLOCATE (mat_sinvvsinvsigma(num_integ_points, num_x_nodes))
1297 mat_sinvvsinvsigma = 0.0_dp
1298 ALLOCATE (vec_uty(num_x_nodes))
1302 multiplicator = (e_max/e_min)**(1.0_dp/(real(num_x_nodes, kind=
dp) - 1.0_dp))
1303 DO iii = 1, num_x_nodes
1304 x_values(iii) = e_min*multiplicator**(iii - 1)
1310 DO jquad = 1, num_integ_points
1312 chi2_min_jquad = 100.0_dp
1317 DO iii = 1, num_x_nodes
1318 y_values(iii) = exp(-x_values(iii)*tau)
1322 DO jjj = 1, num_integ_points
1323 DO iii = 1, num_x_nodes
1324 omega = omega_tj(jjj)
1325 x_value = x_values(iii)
1326 mat_a(iii, jjj) = cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1331 CALL dgesdd(
'A', num_x_nodes, num_integ_points, mat_a, num_x_nodes, sing_values, mat_u, num_x_nodes, &
1332 mat_sinvvsinvt, num_x_nodes, work, lwork, iwork, info)
1338 DO jjj = 1, num_integ_points
1339 DO iii = 1, num_integ_points
1341 mat_sinvvsinvsigma(iii, jjj) = mat_sinvvsinvt(jjj, iii)*sing_values(jjj) &
1342 /(regularization**2 + sing_values(jjj)**2)
1347 CALL dgemm(
'T',
'N', num_x_nodes, 1, num_x_nodes, 1.0_dp, mat_u, num_x_nodes, y_values, num_x_nodes, &
1348 0.0_dp, vec_uty, num_x_nodes)
1351 CALL dgemm(
'N',
'N', num_integ_points, 1, num_x_nodes, 1.0_dp, mat_sinvvsinvsigma, num_integ_points, vec_uty, &
1352 num_x_nodes, 0.0_dp, omega_wj_work, num_integ_points)
1354 weights_cos_tf_w_to_t(jquad, :) = omega_wj_work(:)
1356 CALL calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1357 y_values, num_integ_points, num_x_nodes)
1361 DEALLOCATE (x_values, y_values, mat_a, omega_wj_work, work_array, sing_values, mat_u, mat_sinvvsinvt, &
1362 work, iwork, mat_sinvvsinvsigma, vec_uty)
1364 CALL timestop(handle)
1379 SUBROUTINE calc_max_error_fit_omega_grid_with_cosine(max_error, tau, omega_tj, omega_wj_work, x_values, &
1380 y_values, num_integ_points, num_x_nodes)
1382 REAL(kind=
dp),
INTENT(INOUT) :: max_error
1383 REAL(kind=
dp),
INTENT(IN) :: tau
1384 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1385 INTENT(IN) :: omega_tj, omega_wj_work, x_values, &
1387 INTEGER,
INTENT(IN) :: num_integ_points, num_x_nodes
1389 CHARACTER(LEN=*),
PARAMETER :: routinen =
'calc_max_error_fit_omega_grid_with_cosine'
1391 INTEGER :: handle, kkk
1392 REAL(kind=
dp) :: func_val, func_val_temp, max_error_tmp
1394 CALL timeset(routinen, handle)
1396 max_error_tmp = 0.0_dp
1398 DO kkk = 1, num_x_nodes
1402 CALL eval_fit_func_omega_grid_cosine(func_val, x_values(kkk), num_integ_points, omega_tj, omega_wj_work, tau)
1404 IF (abs(y_values(kkk) - func_val) > max_error_tmp)
THEN
1405 max_error_tmp = abs(y_values(kkk) - func_val)
1406 func_val_temp = func_val
1411 IF (max_error_tmp > max_error)
THEN
1413 max_error = max_error_tmp
1417 CALL timestop(handle)
1419 END SUBROUTINE calc_max_error_fit_omega_grid_with_cosine
1430 PURE SUBROUTINE eval_fit_func_omega_grid_cosine(func_val, x_value, num_integ_points, omega_tj, omega_wj_work, tau)
1431 REAL(kind=
dp),
INTENT(OUT) :: func_val
1432 REAL(kind=
dp),
INTENT(IN) :: x_value
1433 INTEGER,
INTENT(IN) :: num_integ_points
1434 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
1435 INTENT(IN) :: omega_tj, omega_wj_work
1436 REAL(kind=
dp),
INTENT(IN) :: tau
1439 REAL(kind=
dp) :: omega
1443 DO iii = 1, num_integ_points
1446 omega = omega_tj(iii)
1447 func_val = func_val + omega_wj_work(iii)*cos(tau*omega)*2.0_dp*x_value/(x_value**2 + omega**2)
1451 END SUBROUTINE eval_fit_func_omega_grid_cosine
1461 SUBROUTINE gap_and_max_eig_diff_kpoints(qs_env, para_env, gap, max_eig_diff, e_fermi)
1463 TYPE(qs_environment_type),
POINTER :: qs_env
1464 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
1465 REAL(kind=
dp),
INTENT(OUT) :: gap, max_eig_diff, e_fermi
1467 CHARACTER(LEN=*),
PARAMETER :: routinen =
'gap_and_max_eig_diff_kpoints'
1469 INTEGER :: handle, homo, ikpgr, ispin, kplocal, &
1471 INTEGER,
DIMENSION(2) :: kp_range
1472 REAL(kind=
dp) :: e_homo, e_homo_temp, e_lumo, e_lumo_temp
1473 REAL(kind=
dp),
DIMENSION(3) :: tmp
1474 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1475 TYPE(kpoint_env_type),
POINTER :: kp
1476 TYPE(kpoint_type),
POINTER :: kpoint
1477 TYPE(mo_set_type),
POINTER :: mo_set
1479 CALL timeset(routinen, handle)
1484 mo_set => kpoint%kp_env(1)%kpoint_env%mos(1, 1)
1488 kplocal = kp_range(2) - kp_range(1) + 1
1491 max_eig_diff = 0.0_dp
1495 DO ikpgr = 1, kplocal
1496 kp => kpoint%kp_env(ikpgr)%kpoint_env
1497 nspin =
SIZE(kp%mos, 2)
1499 mo_set => kp%mos(1, ispin)
1500 CALL get_mo_set(mo_set, eigenvalues=eigenvalues, homo=homo)
1501 e_homo_temp = eigenvalues(homo)
1502 e_lumo_temp = eigenvalues(homo + 1)
1504 IF (e_homo_temp > e_homo) e_homo = e_homo_temp
1505 IF (e_lumo_temp < e_lumo) e_lumo = e_lumo_temp
1506 IF (eigenvalues(nmo) - eigenvalues(1) > max_eig_diff) max_eig_diff = eigenvalues(nmo) - eigenvalues(1)
1515 tmp(3) = max_eig_diff
1516 CALL para_env%max(tmp)
1518 gap = -tmp(2) - tmp(1)
1519 e_fermi = (tmp(1) - tmp(2))*0.5_dp
1520 max_eig_diff = tmp(3)
1522 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 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 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 test_least_square_ft(nR, iw)
test the singular value decomposition for the computation of integration weights for the Fourier tran...
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_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_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_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
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.