84#include "./base/base_uses.f90"
90 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'rpa_gw_kpoints_util'
109 INTEGER,
INTENT(IN),
OPTIONAL :: n_active
148 Erpa, grid, wkp_W, do_gw_im_time, &
149 do_ri_Sigma_x, do_kpoints_from_Gamma, &
150 cfm_mat_Q, ikp_local, mat_P_omega, mat_P_omega_kp, &
151 qs_env, eps_filter_im_time, unit_nr, kpoints, cfm_mat_Minv_L_kpoints, &
152 cfm_matrix_L_kpoints, fm_mat_W, &
153 cfm_mat_RI_global_work, mat_MinvVMinv, fm_matrix_Minv, &
154 fm_matrix_Minv_Vtrunc_Minv)
156 INTEGER,
INTENT(IN) :: dimen_ri, jquad, nkp, count_ev_sc_gw
158 REAL(kind=
dp),
INTENT(INOUT) :: erpa
160 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: wkp_w
161 LOGICAL,
INTENT(IN) :: do_gw_im_time, do_ri_sigma_x, &
162 do_kpoints_from_gamma
164 INTEGER,
INTENT(IN) :: ikp_local
165 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
INTENT(INOUT) :: mat_p_omega, mat_p_omega_kp
167 REAL(kind=
dp),
INTENT(IN) :: eps_filter_im_time
168 INTEGER,
INTENT(IN) :: unit_nr
170 TYPE(
cp_cfm_type),
ALLOCATABLE,
DIMENSION(:) :: cfm_mat_minv_l_kpoints, &
172 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_w
175 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_minv, &
176 fm_matrix_minv_vtrunc_minv
178 CHARACTER(LEN=*),
PARAMETER :: routinen =
'invert_eps_compute_W_and_Erpa_kp'
180 INTEGER :: handle, ikp, num_integ_points
181 LOGICAL :: do_this_ikp
182 REAL(kind=
dp) :: t1, t2
183 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: diag_qomega
185 CALL timeset(routinen, handle)
187 num_integ_points =
SIZE(grid%frequency)
191 IF (do_kpoints_from_gamma)
THEN
195 CALL transform_p_from_real_space_to_kpoints(mat_p_omega, mat_p_omega_kp, &
196 kpoints, eps_filter_im_time, jquad)
198 ALLOCATE (diag_qomega(dimen_ri))
200 IF (unit_nr > 0)
WRITE (unit_nr,
'(/T3,A,1X,I3)') &
201 'GW_INFO| Computing chi and W frequency point', jquad
206 do_this_ikp = (ikp_local == -1) .OR. (ikp_local == 0 .AND. ikp == 1) .OR. (ikp_local == ikp)
207 IF (.NOT. do_this_ikp) cycle
210 CALL compute_q_kp_rpa(cfm_mat_q, &
212 cfm_mat_minv_l_kpoints(ikp), &
213 cfm_mat_ri_global_work, &
214 ikp, nkp, ikp_local, para_env, &
215 qs_env%mp2_env%ri_rpa_im_time%make_chi_pos_definite)
218 CALL cholesky_decomp_q(cfm_mat_q, diag_qomega, dimen_ri)
221 CALL frequency_and_kpoint_integration(erpa, cfm_mat_q, para_env, diag_qomega, &
222 dimen_ri, grid%frequency_weights(jquad), kpoints%wkp(ikp))
224 IF (do_gw_im_time)
THEN
227 IF (do_ri_sigma_x .AND. jquad == 1 .AND. count_ev_sc_gw == 1 .AND. do_kpoints_from_gamma)
THEN
229 CALL dbcsr_set(mat_minvvminv%matrix, 0.0_dp)
230 CALL copy_fm_to_dbcsr(fm_matrix_minv_vtrunc_minv(1, 1), mat_minvvminv%matrix, keep_sparsity=.false.)
233 IF (do_kpoints_from_gamma)
THEN
234 CALL compute_wc_real_space_tau_gw(fm_mat_w, cfm_mat_q, cfm_matrix_l_kpoints(ikp), &
237 ikp_local, para_env, kpoints, qs_env, wkp_w)
244 IF (do_gw_im_time .AND. do_kpoints_from_gamma .AND. jquad == num_integ_points)
THEN
245 CALL wc_to_minv_wc_minv(fm_mat_w, fm_matrix_minv, para_env, dimen_ri, num_integ_points)
246 CALL deallocate_kp_matrices(cfm_matrix_l_kpoints, cfm_mat_minv_l_kpoints)
249 DEALLOCATE (diag_qomega)
253 IF (unit_nr > 0)
WRITE (unit_nr,
'(T6,A,T56,F25.1)')
'Execution time (s):', t2 - t1
255 CALL timestop(handle)
264 SUBROUTINE deallocate_kp_matrices(cfm_matrix_L_kpoints, cfm_mat_Minv_L_kpoints)
266 TYPE(
cp_cfm_type),
ALLOCATABLE,
DIMENSION(:) :: cfm_matrix_l_kpoints, &
267 cfm_mat_minv_l_kpoints
269 CHARACTER(LEN=*),
PARAMETER :: routinen =
'deallocate_kp_matrices'
271 INTEGER :: handle, ikp
273 CALL timeset(routinen, handle)
275 IF (
ALLOCATED(cfm_mat_minv_l_kpoints))
THEN
276 DO ikp = 1,
SIZE(cfm_mat_minv_l_kpoints)
277 IF (
ASSOCIATED(cfm_mat_minv_l_kpoints(ikp)%matrix_struct))
CALL cp_cfm_release(cfm_mat_minv_l_kpoints(ikp))
279 DEALLOCATE (cfm_mat_minv_l_kpoints)
281 IF (
ALLOCATED(cfm_matrix_l_kpoints))
THEN
282 DO ikp = 1,
SIZE(cfm_matrix_l_kpoints)
283 IF (
ASSOCIATED(cfm_matrix_l_kpoints(ikp)%matrix_struct))
CALL cp_cfm_release(cfm_matrix_l_kpoints(ikp))
285 DEALLOCATE (cfm_matrix_l_kpoints)
288 CALL timestop(handle)
290 END SUBROUTINE deallocate_kp_matrices
304 SUBROUTINE compute_q_kp_rpa(cfm_mat_Q, mat_P_omega_kp, cfm_mat_L, &
305 cfm_mat_RI_global_work, ikp, nkp, ikp_local, para_env, &
306 make_chi_pos_definite)
309 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
INTENT(INOUT) :: mat_p_omega_kp
310 TYPE(
cp_cfm_type) :: cfm_mat_l, cfm_mat_ri_global_work
311 INTEGER,
INTENT(IN) :: ikp, nkp, ikp_local
313 LOGICAL,
INTENT(IN) :: make_chi_pos_definite
315 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Q_kp_RPA'
319 CALL timeset(routinen, handle)
323 CALL mat_p_to_subgroup(mat_p_omega_kp, cfm_mat_ri_global_work, cfm_mat_q, ikp, nkp, ikp_local, para_env)
326 IF (make_chi_pos_definite)
THEN
327 CALL cp_cfm_power(cfm_mat_q, threshold=0.0_dp, exponent=1.0_dp)
333 CALL timestop(handle)
335 END SUBROUTINE compute_q_kp_rpa
347 SUBROUTINE mat_p_to_subgroup(mat_P_omega_kp, cfm_mat_RI_global_work, cfm_mat_Q, ikp, nkp, ikp_local, para_env)
349 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
INTENT(INOUT) :: mat_p_omega_kp
350 TYPE(
cp_cfm_type),
INTENT(INOUT) :: cfm_mat_ri_global_work, cfm_mat_q
351 INTEGER,
INTENT(IN) :: ikp, nkp, ikp_local
354 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mat_P_to_subgroup'
356 INTEGER :: handle, jkp
359 TYPE(
dbcsr_type),
POINTER :: mat_p_omega_im, mat_p_omega_re
361 CALL timeset(routinen, handle)
363 CALL cp_fm_create(fm_mat_work, cfm_mat_ri_global_work%matrix_struct)
366 IF (ikp_local == -1 .AND. jkp /= ikp) cycle
368 mat_p_omega_re => mat_p_omega_kp(1, jkp)%matrix
371 CALL cp_fm_to_cfm(msourcer=fm_mat_work, mtarget=cfm_mat_ri_global_work)
373 mat_p_omega_im => mat_p_omega_kp(2, jkp)%matrix
378 IF (ikp_local /= -1)
CALL para_env%sync()
380 IF (ikp_local == -1 .OR. ikp_local == jkp)
THEN
386 IF (ikp_local /= -1)
CALL para_env%sync()
392 CALL timestop(handle)
394 END SUBROUTINE mat_p_to_subgroup
402 SUBROUTINE cholesky_decomp_q(cfm_mat_Q, diag_Qomega, dimen_RI)
405 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: diag_qomega
406 INTEGER,
INTENT(IN) :: dimen_ri
408 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cholesky_decomp_Q'
410 INTEGER :: handle, info_chol
411 COMPLEX(KIND=dp),
DIMENSION(dimen_RI) :: diag_q
413 CALL timeset(routinen, handle)
417 diag_qomega = real(diag_q, kind=
dp)
422 cpassert(info_chol == 0)
424 CALL timestop(handle)
426 END SUBROUTINE cholesky_decomp_q
438 SUBROUTINE frequency_and_kpoint_integration(Erpa, cfm_mat_Q, para_env, diag_Qomega, &
439 dimen_RI, freq_weight, kp_weight)
441 REAL(kind=
dp),
INTENT(INOUT) :: erpa
444 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: diag_qomega
445 INTEGER,
INTENT(IN) :: dimen_ri
446 REAL(kind=
dp),
INTENT(IN) :: freq_weight, kp_weight
448 CHARACTER(LEN=*),
PARAMETER :: routinen =
'frequency_and_kpoint_integration'
450 INTEGER :: handle, iib
451 COMPLEX(KIND=dp),
DIMENSION(dimen_RI) :: diag_chol
452 REAL(kind=
dp) :: fcomega
453 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: q_log
455 CALL timeset(routinen, handle)
457 ALLOCATE (q_log(dimen_ri))
460 q_log(:) = 2.0_dp*log(real(diag_chol, kind=
dp))
464 IF (
modulo(iib, para_env%num_pe) /= para_env%mepos) cycle
465 fcomega = fcomega + (q_log(iib) - diag_qomega(iib))/2.0_dp
468 erpa = erpa + fcomega*freq_weight*kp_weight
472 CALL timestop(handle)
474 END SUBROUTINE frequency_and_kpoint_integration
485 TYPE(
dbcsr_p_type),
DIMENSION(:),
INTENT(IN) :: mat_p_omega
488 INTEGER,
INTENT(IN) :: jquad, unit_nr
490 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_mat_cell_T_from_mat_gamma'
492 INTEGER :: col, handle, i_cell, num_cells_p, row
493 INTEGER,
DIMENSION(3) :: periodic
494 INTEGER,
DIMENSION(:, :),
POINTER :: index_to_cell_p
496 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: weights
497 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: data_block, image_block
502 CALL timeset(routinen, handle)
504 NULLIFY (cell, particle_set)
505 CALL get_qs_env(qs_env, cell=cell, particle_set=particle_set)
506 CALL get_cell(cell=cell, periodic=periodic)
509 CALL init_cell_index_rpa(2*periodic + 1, kpoints%cell_to_index, kpoints%index_to_cell, cell)
510 index_to_cell_p => kpoints%index_to_cell
511 num_cells_p =
SIZE(index_to_cell_p, 2)
512 cpassert(
SIZE(mat_p_omega) >= num_cells_p)
513 ALLOCATE (weights(num_cells_p))
515 DO i_cell = 2, num_cells_p
516 CALL dbcsr_copy(mat_p_omega(i_cell)%matrix, mat_p_omega(1)%matrix)
519 IF (jquad == 1 .AND. unit_nr > 0)
THEN
520 WRITE (unit_nr,
'(T3,A,T66,ES15.2)')
'GW_INFO| RI regularization parameter: ', &
521 qs_env%mp2_env%ri_rpa_im_time%regularization_RI
522 WRITE (unit_nr,
'(T3,A,T66,ES15.2)')
'GW_INFO| eps_eigval_S: ', &
523 qs_env%mp2_env%ri_rpa_im_time%eps_eigval_S
524 IF (qs_env%mp2_env%ri_rpa_im_time%make_chi_pos_definite)
THEN
525 WRITE (unit_nr,
'(T3,A,T81)') &
526 'GW_INFO| Make chi(iw,k) positive definite? TRUE'
528 WRITE (unit_nr,
'(T3,A,T81)') &
529 'GW_INFO| Make chi(iw,k) positive definite? FALSE'
537 cell, index_to_cell_p, weights)
539 DO i_cell = num_cells_p, 1, -1
541 block=image_block, found=found)
543 image_block = weights(i_cell)*data_block
548 CALL timestop(handle)
560 SUBROUTINE transform_p_from_real_space_to_kpoints(mat_P_omega, mat_P_omega_kp, &
561 kpoints, eps_filter_im_time, jquad)
563 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
INTENT(INOUT) :: mat_p_omega, mat_p_omega_kp
565 REAL(kind=
dp),
INTENT(IN) :: eps_filter_im_time
566 INTEGER,
INTENT(IN) :: jquad
568 CHARACTER(LEN=*),
PARAMETER :: routinen =
'transform_P_from_real_space_to_kpoints'
570 INTEGER :: handle, icell, nkp, num_integ_points
572 CALL timeset(routinen, handle)
574 num_integ_points =
SIZE(mat_p_omega, 1)
575 nkp =
SIZE(mat_p_omega, 2)
578 kpoints, eps_filter_im_time)
580 DO icell = 1,
SIZE(mat_p_omega, 2)
581 CALL dbcsr_set(mat_p_omega(jquad, icell)%matrix, 0.0_dp)
582 CALL dbcsr_filter(mat_p_omega(jquad, icell)%matrix, 1.0_dp)
585 CALL timestop(handle)
587 END SUBROUTINE transform_p_from_real_space_to_kpoints
599 kpoints, eps_filter_im_time, real_mat_real_space)
601 TYPE(
dbcsr_p_type),
DIMENSION(:),
INTENT(INOUT) :: real_mat_kp, imag_mat_kp, mat_real_space
603 REAL(kind=
dp),
INTENT(IN) :: eps_filter_im_time
604 LOGICAL,
INTENT(IN),
OPTIONAL :: real_mat_real_space
606 CHARACTER(LEN=*),
PARAMETER :: routinen =
'real_space_to_kpoint_transform_rpa'
608 INTEGER :: handle, i_cell, ik, nkp, num_cells
609 INTEGER,
DIMENSION(3) :: cell
610 INTEGER,
DIMENSION(:, :),
POINTER :: index_to_cell
611 LOGICAL :: my_real_mat_real_space
612 REAL(kind=
dp) :: arg, coskl, sinkl
613 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: xkp
616 CALL timeset(routinen, handle)
618 my_real_mat_real_space = .true.
619 IF (
PRESENT(real_mat_real_space)) my_real_mat_real_space = real_mat_real_space
622 template=real_mat_kp(1)%matrix, &
623 matrix_type=dbcsr_type_no_symmetry)
630 NULLIFY (index_to_cell)
631 index_to_cell => kpoints%index_to_cell
633 num_cells =
SIZE(index_to_cell, 2)
635 cpassert(
SIZE(mat_real_space) >= num_cells/2 + 1)
642 CALL dbcsr_set(real_mat_kp(ik)%matrix, 0.0_dp)
643 CALL dbcsr_set(imag_mat_kp(ik)%matrix, 0.0_dp)
645 DO i_cell = 1, num_cells/2 + 1
647 cell(:) = index_to_cell(:, i_cell)
649 arg = real(cell(1),
dp)*xkp(1, ik) + real(cell(2),
dp)*xkp(2, ik) + real(cell(3),
dp)*xkp(3, ik)
650 coskl = cos(
twopi*arg)
651 sinkl = sin(
twopi*arg)
653 IF (my_real_mat_real_space)
THEN
654 CALL dbcsr_add_local(real_mat_kp(ik)%matrix, mat_real_space(i_cell)%matrix, 1.0_dp, coskl)
655 CALL dbcsr_add_local(imag_mat_kp(ik)%matrix, mat_real_space(i_cell)%matrix, 1.0_dp, sinkl)
657 CALL dbcsr_add_local(real_mat_kp(ik)%matrix, mat_real_space(i_cell)%matrix, 1.0_dp, -sinkl)
658 CALL dbcsr_add_local(imag_mat_kp(ik)%matrix, mat_real_space(i_cell)%matrix, 1.0_dp, coskl)
661 IF (.NOT. (cell(1) == 0 .AND. cell(2) == 0 .AND. cell(3) == 0))
THEN
665 IF (my_real_mat_real_space)
THEN
666 CALL dbcsr_add_local(real_mat_kp(ik)%matrix, mat_work, 1.0_dp, coskl)
667 CALL dbcsr_add_local(imag_mat_kp(ik)%matrix, mat_work, 1.0_dp, -sinkl)
672 CALL dbcsr_add_local(real_mat_kp(ik)%matrix, mat_work, 1.0_dp, -sinkl)
673 CALL dbcsr_add_local(imag_mat_kp(ik)%matrix, mat_work, 1.0_dp, -coskl)
682 CALL dbcsr_filter(real_mat_kp(ik)%matrix, eps_filter_im_time)
683 CALL dbcsr_filter(imag_mat_kp(ik)%matrix, eps_filter_im_time)
689 CALL timestop(handle)
700 SUBROUTINE dbcsr_add_local(mat_a, mat_b, alpha, beta)
701 TYPE(
dbcsr_type),
INTENT(INOUT) :: mat_a, mat_b
702 REAL(kind=
dp),
INTENT(IN) :: alpha, beta
706 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: block_to_compute, data_block
713 NULLIFY (block_to_compute)
715 row=row, col=col, block=block_to_compute, found=found)
719 block_to_compute(:, :) = alpha*block_to_compute(:, :) + beta*data_block(:, :)
724 END SUBROUTINE dbcsr_add_local
741 SUBROUTINE compute_wc_real_space_tau_gw(fm_mat_W_tau, cfm_mat_Q, cfm_mat_L, &
743 ikp, grid, ikp_local, &
744 para_env, kpoints, qs_env, wkp_W)
746 TYPE(
cp_fm_type),
DIMENSION(:),
INTENT(IN) :: fm_mat_w_tau
749 INTEGER,
INTENT(IN) :: dimen_ri, jquad, ikp
751 INTEGER,
INTENT(IN) :: ikp_local
755 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: wkp_w
757 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_Wc_real_space_tau_GW'
759 INTEGER :: handle, handle2, iatom, iatom_old, iquad, irow, jatom, jatom_old, jcol, jkp, &
760 ncol_local, nkp, nrow_local, num_cells, num_integ_points
761 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_from_ri_index
762 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
763 INTEGER,
DIMENSION(:, :),
POINTER :: index_to_cell
764 REAL(kind=
dp) :: contribution, weight, weight_im, &
766 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat
767 REAL(kind=
dp),
DIMENSION(:),
POINTER :: wkp
768 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: xkp
771 TYPE(
cp_fm_type) :: fm_dummy, fm_mat_work_global, &
775 CALL timeset(routinen, handle)
777 num_integ_points =
SIZE(grid%imaginary_time)
779 CALL timeset(routinen//
"_1", handle2)
784 CALL cp_fm_create(fm_mat_work_global, fm_mat_w_tau(1)%matrix_struct)
787 CALL cp_fm_create(fm_mat_work_local, cfm_mat_q%matrix_struct)
790 CALL timestop(handle2)
792 CALL timeset(routinen//
"_2", handle2)
796 CALL timestop(handle2)
798 CALL timeset(routinen//
"_4", handle2)
801 index_to_cell => kpoints%index_to_cell
802 num_cells =
SIZE(index_to_cell, 2)
804 ALLOCATE (atom_from_ri_index(dimen_ri))
808 NULLIFY (cell, particle_set)
809 CALL get_qs_env(qs_env, cell=cell, particle_set=particle_set)
815 nrow_local=nrow_local, &
816 ncol_local=ncol_local, &
817 row_indices=row_indices, &
818 col_indices=col_indices)
820 DO irow = 1, nrow_local
821 DO jcol = 1, ncol_local
823 iatom = atom_from_ri_index(row_indices(irow))
824 jatom = atom_from_ri_index(col_indices(jcol))
826 IF (iatom /= iatom_old .OR. jatom /= jatom_old)
THEN
830 num_cells, iatom, jatom, xkp(1:3, ikp), wkp_w(ikp), &
831 cell, index_to_cell, hmat, particle_set)
838 contribution = weight_re*real(cfm_mat_work_2%local_data(irow, jcol)) + &
839 weight_im*aimag(cfm_mat_work_2%local_data(irow, jcol))
841 fm_mat_work_local%local_data(irow, jcol) = fm_mat_work_local%local_data(irow, jcol) + contribution
846 CALL timestop(handle2)
848 CALL timeset(routinen//
"_5", handle2)
850 IF (ikp_local == -1)
THEN
854 DO iquad = 1, num_integ_points
856 weight = grid%cosine_frequency_to_time(iquad, jquad)
858 IF (jquad == 1 .AND. ikp == 1)
THEN
862 CALL cp_fm_scale_and_add(alpha=1.0_dp, matrix_a=fm_mat_w_tau(iquad), beta=weight, matrix_b=fm_mat_work_global)
872 IF (ikp_local == jkp)
THEN
880 DO iquad = 1, num_integ_points
882 weight = grid%cosine_frequency_to_time(iquad, jquad)
884 IF (jquad == 1 .AND. jkp == 1)
THEN
889 matrix_b=fm_mat_work_global)
901 DEALLOCATE (atom_from_ri_index)
903 CALL timestop(handle2)
905 CALL timestop(handle)
907 END SUBROUTINE compute_wc_real_space_tau_gw
917 SUBROUTINE wc_to_minv_wc_minv(fm_mat_W, fm_matrix_Minv, para_env, dimen_RI, num_integ_points)
919 TYPE(
cp_fm_type),
DIMENSION(:, :) :: fm_matrix_minv
921 INTEGER :: dimen_ri, num_integ_points
923 CHARACTER(LEN=*),
PARAMETER :: routinen =
'Wc_to_Minv_Wc_Minv'
925 INTEGER :: handle, jquad
926 TYPE(
cp_fm_type) :: fm_work_minv, fm_work_minv_w
928 CALL timeset(routinen, handle)
930 CALL cp_fm_create(fm_work_minv, fm_mat_w(1)%matrix_struct)
933 CALL cp_fm_create(fm_work_minv_w, fm_mat_w(1)%matrix_struct)
935 DO jquad = 1, num_integ_points
937 CALL parallel_gemm(
'N',
'N', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_work_minv, fm_mat_w(jquad), &
938 0.0_dp, fm_work_minv_w)
939 CALL parallel_gemm(
'N',
'N', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_work_minv_w, fm_work_minv, &
940 0.0_dp, fm_mat_w(jquad))
948 CALL timestop(handle)
950 END SUBROUTINE wc_to_minv_wc_minv
964 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
965 INTENT(OUT) :: wkp_w, wkp_v
967 REAL(kind=
dp),
DIMENSION(3, 3) :: h_inv
968 INTEGER,
DIMENSION(3) :: periodic
970 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_wkp_W'
972 INTEGER :: handle, i_x, ikp, info, j_y, k_z, &
973 kpoint_weights_w_method, n_x, n_y, &
974 n_z, nkp, nsuperfine, num_lin_eqs
975 REAL(kind=
dp) :: exp_kpoints, integral, k_sq, weight
976 REAL(kind=
dp),
DIMENSION(3) :: k_vec, x_vec
977 REAL(kind=
dp),
DIMENSION(:),
POINTER :: right_side, wkp, wkp_tmp
978 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: matrix_lin_eqs, xkp
980 CALL timeset(routinen, handle)
982 kpoint_weights_w_method = qs_env%mp2_env%ri_rpa_im_time%kpoint_weights_W_method
996 ALLOCATE (wkp_v(nkp), wkp_w(nkp))
1000 IF (
ALLOCATED(qs_env%mp2_env%ri_rpa_im_time%wkp_V))
THEN
1001 wkp_v(:) = qs_env%mp2_env%ri_rpa_im_time%wkp_V(:)
1015 exp_kpoints = qs_env%mp2_env%ri_rpa_im_time%exp_tailored_weights
1019 IF (sum(periodic) == 2) exp_kpoints = -1.0_dp
1026 IF (periodic(1) == 1)
THEN
1031 IF (periodic(2) == 1)
THEN
1036 IF (periodic(3) == 1)
THEN
1044 weight = 1.0_dp/(real(n_x,
dp)*real(n_y,
dp)*real(n_z,
dp))
1049 IF (periodic(1) == 1)
THEN
1050 x_vec(1) = (real(i_x - nsuperfine/2,
dp) - 0.5_dp)/real(nsuperfine,
dp)
1054 IF (periodic(2) == 1)
THEN
1055 x_vec(2) = (real(j_y - nsuperfine/2,
dp) - 0.5_dp)/real(nsuperfine,
dp)
1059 IF (periodic(3) == 1)
THEN
1060 x_vec(3) = (real(k_z - nsuperfine/2,
dp) - 0.5_dp)/real(nsuperfine,
dp)
1065 k_vec = matmul(h_inv(1:3, 1:3), x_vec)
1066 k_sq = k_vec(1)**2 + k_vec(2)**2 + k_vec(3)**2
1067 integral = integral + weight*k_sq**(exp_kpoints*0.5_dp)
1073 num_lin_eqs = nkp + 2
1075 ALLOCATE (matrix_lin_eqs(num_lin_eqs, num_lin_eqs))
1076 matrix_lin_eqs(:, :) = 0.0_dp
1080 k_vec = matmul(h_inv(1:3, 1:3), xkp(1:3, ikp))
1081 k_sq = k_vec(1)**2 + k_vec(2)**2 + k_vec(3)**2
1083 matrix_lin_eqs(ikp, ikp) = 2.0_dp
1084 matrix_lin_eqs(ikp, nkp + 1) = 1.0_dp
1085 matrix_lin_eqs(nkp + 1, ikp) = 1.0_dp
1087 matrix_lin_eqs(ikp, nkp + 2) = k_sq**(exp_kpoints*0.5_dp)
1088 matrix_lin_eqs(nkp + 2, ikp) = k_sq**(exp_kpoints*0.5_dp)
1092 CALL invmat(matrix_lin_eqs, info)
1096 ALLOCATE (right_side(num_lin_eqs))
1098 right_side(nkp + 1) = 1.0_dp
1100 right_side(nkp + 2) = integral
1102 ALLOCATE (wkp_tmp(num_lin_eqs))
1104 wkp_tmp(1:num_lin_eqs) = matmul(matrix_lin_eqs, right_side)
1106 wkp_w(1:nkp) = wkp_tmp(1:nkp)
1108 DEALLOCATE (matrix_lin_eqs, right_side, wkp_tmp)
1112 CALL timestop(handle)
1123 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: eigenval_kp
1125 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_bandstruc_and_k_dependent_MOs'
1127 INTEGER :: handle, ikp, ispin, nmo, nspins
1128 INTEGER,
DIMENSION(3) :: nkp_grid_g
1129 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ev
1130 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: kpgeneral
1134 CALL timeset(routinen, handle)
1136 NULLIFY (qs_env%mp2_env%ri_rpa_im_time%kpoints_G, &
1137 qs_env%mp2_env%ri_rpa_im_time%kpoints_Sigma, &
1138 qs_env%mp2_env%ri_rpa_im_time%kpoints_Sigma_no_xc, &
1141 nkp_grid_g(1:3) = [1, 1, 1]
1143 CALL get_qs_env(qs_env=qs_env, para_env=para_env)
1145 CALL create_kp_and_calc_kp_orbitals(qs_env, qs_env%mp2_env%ri_rpa_im_time%kpoints_G, &
1146 "MONKHORST-PACK", para_env%num_pe, &
1147 mp_grid=nkp_grid_g(1:3))
1149 IF (qs_env%mp2_env%ri_g0w0%do_kpoints_Sigma)
THEN
1152 CALL get_kpgeneral_for_sigma_kpoints(qs_env, kpgeneral)
1154 CALL create_kp_and_calc_kp_orbitals(qs_env, qs_env%mp2_env%ri_rpa_im_time%kpoints_Sigma, &
1155 "GENERAL", para_env%num_pe, &
1156 kpgeneral=kpgeneral)
1158 CALL create_kp_and_calc_kp_orbitals(qs_env, qs_env%mp2_env%ri_rpa_im_time%kpoints_Sigma_no_xc, &
1159 "GENERAL", para_env%num_pe, &
1160 kpgeneral=kpgeneral, with_xc_terms=.false.)
1162 kpoints_sigma => qs_env%mp2_env%ri_rpa_im_time%kpoints_Sigma
1163 nmo =
SIZE(eigenval_kp, 1)
1164 nspins =
SIZE(eigenval_kp, 3)
1166 ALLOCATE (qs_env%mp2_env%ri_rpa_im_time%Eigenval_Gamma(nmo))
1167 qs_env%mp2_env%ri_rpa_im_time%Eigenval_Gamma(:) = eigenval_kp(:, 1, 1)
1169 DEALLOCATE (eigenval_kp)
1171 ALLOCATE (eigenval_kp(nmo, kpoints_sigma%nkp, nspins))
1173 DO ikp = 1, kpoints_sigma%nkp
1175 DO ispin = 1, nspins
1177 ev => kpoints_sigma%kp_env(ikp)%kpoint_env%mos(ispin)%eigenvalues
1179 eigenval_kp(:, ikp, ispin) = ev(:)
1185 DEALLOCATE (kpgeneral)
1189 CALL release_hfx_stuff(qs_env)
1191 CALL timestop(handle)
1199 SUBROUTINE release_hfx_stuff(qs_env)
1202 IF (
ASSOCIATED(qs_env%x_data) .AND. .NOT. qs_env%mp2_env%ri_g0w0%do_ri_Sigma_x)
THEN
1206 END SUBROUTINE release_hfx_stuff
1220 SUBROUTINE create_kp_and_calc_kp_orbitals(qs_env, kpoints, scheme, &
1221 group_size_ext, mp_grid, kpgeneral, with_xc_terms, &
1222 kp_shift, gamma_centered)
1226 CHARACTER(LEN=*),
INTENT(IN) :: scheme
1227 INTEGER :: group_size_ext
1228 INTEGER,
DIMENSION(3),
INTENT(IN),
OPTIONAL :: mp_grid
1229 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
1230 OPTIONAL :: kpgeneral
1231 LOGICAL,
OPTIONAL :: with_xc_terms
1232 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN),
OPTIONAL :: kp_shift
1233 LOGICAL,
INTENT(IN),
OPTIONAL :: gamma_centered
1235 CHARACTER(LEN=*),
PARAMETER :: routinen =
'create_kp_and_calc_kp_orbitals'
1237 INTEGER :: handle, i_re_im, ikp, ispin, nkp, nspins
1238 INTEGER,
DIMENSION(3) :: periodic
1239 LOGICAL :: my_with_xc_terms
1240 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eigenvalues
1246 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s, matrix_s_desymm
1247 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: mat_ks_kp, mat_s_kp
1254 CALL timeset(routinen, handle)
1256 my_with_xc_terms = .true.
1257 IF (
PRESENT(with_xc_terms)) my_with_xc_terms = with_xc_terms
1260 para_env=para_env, &
1261 blacs_env=blacs_env, &
1262 matrix_s=matrix_s, &
1264 scf_control=scf_control, &
1269 group_size_ext=group_size_ext, kp_shift=kp_shift, &
1270 gamma_centered=gamma_centered)
1279 CALL get_cell(cell=cell, periodic=periodic)
1281 CALL init_cell_index_rpa(2*periodic + 1, kpoints%cell_to_index, kpoints%index_to_cell, cell)
1284 CALL get_qs_env(qs_env, matrix_s=matrix_s, scf_env=scf_env, scf_control=scf_control, dft_control=dft_control)
1286 NULLIFY (matrix_s_desymm)
1288 ALLOCATE (matrix_s_desymm(1)%matrix)
1289 CALL dbcsr_create(matrix=matrix_s_desymm(1)%matrix, template=matrix_s(1)%matrix, &
1290 matrix_type=dbcsr_type_no_symmetry)
1297 matrix_struct => kpoints%kp_env(1)%kpoint_env%wmat(1, 1)%matrix_struct
1305 nspins = dft_control%nspins
1307 DO ispin = 1, nspins
1310 IF (my_with_xc_terms)
THEN
1311 CALL mat_kp_from_mat_gamma(qs_env, mat_ks_kp, qs_env%mp2_env%ri_g0w0%matrix_ks(ispin)%matrix, kpoints, ispin)
1313 CALL mat_kp_from_mat_gamma(qs_env, mat_ks_kp, qs_env%mp2_env%ri_g0w0%matrix_sigma_x_minus_vxc(ispin)%matrix, &
1319 CALL copy_dbcsr_to_fm(mat_ks_kp(ikp, 1)%matrix, kpoints%kp_env(ikp)%kpoint_env%wmat(1, ispin))
1322 CALL copy_dbcsr_to_fm(mat_ks_kp(ikp, 2)%matrix, kpoints%kp_env(ikp)%kpoint_env%wmat(2, ispin))
1331 kp => kpoints%kp_env(ikp)%kpoint_env
1333 CALL get_mo_set(kp%mos(ispin), eigenvalues=eigenvalues)
1336 qs_env%mp2_env%ri_rpa_im_time%make_overlap_mat_ao_pos_definite)
THEN
1337 CALL cp_cfm_geeig_canon(cksmat, csmat, cmos, eigenvalues, cwork, scf_control%eps_eigval)
1339 CALL cp_cfm_geeig(cksmat, csmat, cmos, eigenvalues, cwork)
1344 kp%mos(ispin)%eigenvalues = eigenvalues
1355 DEALLOCATE (mat_ks_kp)
1362 DEALLOCATE (mat_s_kp)
1365 DEALLOCATE (matrix_s_desymm)
1373 CALL timestop(handle)
1375 END SUBROUTINE create_kp_and_calc_kp_orbitals
1393 LOGICAL,
INTENT(IN),
OPTIONAL :: real_mat_real_space
1395 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mat_kp_from_mat_gamma'
1397 INTEGER :: handle, i_cell, i_re_im, ikp, nkp, &
1399 INTEGER,
DIMENSION(3) :: periodic
1400 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
1401 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: xkp
1403 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: mat_real_space
1405 CALL timeset(routinen, handle)
1408 CALL get_cell(cell=cell, periodic=periodic)
1409 num_cells = 3**(periodic(1) + periodic(2) + periodic(3))
1411 NULLIFY (mat_real_space)
1413 DO i_cell = 1, num_cells
1414 ALLOCATE (mat_real_space(i_cell)%matrix)
1415 CALL dbcsr_create(matrix=mat_real_space(i_cell)%matrix, &
1418 CALL dbcsr_set(mat_real_space(i_cell)%matrix, 0.0_dp)
1421 CALL dbcsr_copy(mat_real_space(1)%matrix, mat_gamma)
1425 NULLIFY (xkp, cell_to_index)
1426 CALL get_kpoint_info(kpoints, nkp=nkp, xkp=xkp, cell_to_index=cell_to_index)
1428 IF (ispin == 1)
THEN
1433 ALLOCATE (mat_kp(ikp, i_re_im)%matrix)
1434 CALL dbcsr_create(matrix=mat_kp(ikp, i_re_im)%matrix, template=mat_gamma)
1436 CALL dbcsr_set(mat_kp(ikp, i_re_im)%matrix, 0.0_dp)
1441 IF (
PRESENT(real_mat_real_space))
THEN
1443 real_mat_real_space)
1448 DO i_cell = 1, num_cells
1451 DEALLOCATE (mat_real_space)
1453 CALL timestop(handle)
1462 SUBROUTINE get_kpgeneral_for_sigma_kpoints(qs_env, kpgeneral)
1464 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: kpgeneral
1466 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_kpgeneral_for_Sigma_kpoints'
1468 INTEGER :: handle, i_kp_in_kp_line, i_special_kp, &
1469 i_x, ikk, j_y, k_z, n_kp_in_kp_line, &
1471 INTEGER,
DIMENSION(:),
POINTER :: nkp_grid
1473 CALL timeset(routinen, handle)
1475 n_special_kp = qs_env%mp2_env%ri_g0w0%n_special_kp
1476 n_kp_in_kp_line = qs_env%mp2_env%ri_g0w0%n_kp_in_kp_line
1477 IF (n_special_kp > 0)
THEN
1478 qs_env%mp2_env%ri_g0w0%nkp_self_energy_special_kp = n_kp_in_kp_line*(n_special_kp - 1) + 1
1480 qs_env%mp2_env%ri_g0w0%nkp_self_energy_special_kp = 0
1483 qs_env%mp2_env%ri_g0w0%nkp_self_energy_monkh_pack = qs_env%mp2_env%ri_g0w0%kp_grid_Sigma(1)* &
1484 qs_env%mp2_env%ri_g0w0%kp_grid_Sigma(2)* &
1485 qs_env%mp2_env%ri_g0w0%kp_grid_Sigma(3)
1487 qs_env%mp2_env%ri_g0w0%nkp_self_energy = qs_env%mp2_env%ri_g0w0%nkp_self_energy_special_kp + &
1488 qs_env%mp2_env%ri_g0w0%nkp_self_energy_monkh_pack
1490 ALLOCATE (kpgeneral(3, qs_env%mp2_env%ri_g0w0%nkp_self_energy))
1492 IF (n_special_kp > 0)
THEN
1494 kpgeneral(1:3, 1) = qs_env%mp2_env%ri_g0w0%xkp_special_kp(1:3, 1)
1498 DO i_special_kp = 2, n_special_kp
1499 DO i_kp_in_kp_line = 1, n_kp_in_kp_line
1502 kpgeneral(1:3, ikk) = qs_env%mp2_env%ri_g0w0%xkp_special_kp(1:3, i_special_kp - 1) + &
1503 REAL(i_kp_in_kp_line, kind=
dp)/real(n_kp_in_kp_line, kind=
dp)* &
1504 (qs_env%mp2_env%ri_g0w0%xkp_special_kp(1:3, i_special_kp) - &
1505 qs_env%mp2_env%ri_g0w0%xkp_special_kp(1:3, i_special_kp - 1))
1516 nkp_grid => qs_env%mp2_env%ri_g0w0%kp_grid_Sigma
1518 DO i_x = 1, nkp_grid(1)
1519 DO j_y = 1, nkp_grid(2)
1520 DO k_z = 1, nkp_grid(3)
1522 kpgeneral(1, ikk) = real(2*i_x - nkp_grid(1) - 1, kind=
dp)/(2._dp*real(nkp_grid(1), kind=
dp))
1523 kpgeneral(2, ikk) = real(2*j_y - nkp_grid(2) - 1, kind=
dp)/(2._dp*real(nkp_grid(2), kind=
dp))
1524 kpgeneral(3, ikk) = real(2*k_z - nkp_grid(3) - 1, kind=
dp)/(2._dp*real(nkp_grid(3), kind=
dp))
1529 CALL timestop(handle)
1531 END SUBROUTINE get_kpgeneral_for_sigma_kpoints
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Handles all functions related to the CELL.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
subroutine, public minimum_image_weights(ra, rb, cell, index_to_cell, weights)
Distribute an atom-pair contribution equally among its nearest candidate images. Images within 1....
methods related to the blacs parallel environment
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_scale_and_add_fm(alpha, matrix_a, beta, matrix_b)
Scale and add two BLACS matrices (a = alpha*a + beta*b). where b is a real matrix (adapted from cp_cf...
subroutine, public cp_cfm_get_diag(matrix, diag, n_active)
returns the diagonal of a complex full matrix: diag(i)= A_{ii}. Each diagonal entry is owned by one p...
subroutine, public cp_cfm_uplo_to_full(matrix, workspace, uplo)
...
subroutine, public cp_cfm_add_on_diag(matrix, alpha, n_active)
Adds a scalar to the diagonal of a distributed complex full matrix.
various cholesky decomposition related routines
subroutine, public cp_cfm_cholesky_decompose(matrix, n, info_out)
Used to replace a symmetric positive definite matrix M with its Cholesky decomposition U: M = U^T * U...
subroutine, public cp_cfm_cholesky_invert(matrix, n, info_out)
Used to replace Cholesky decomposition by the inverse.
used for collecting diagonalization schemes available for cp_cfm_type
subroutine, public cp_cfm_geeig_canon(amatrix, bmatrix, eigenvectors, eigenvalues, work, epseig, nmo_retained)
General Eigenvalue Problem AX = BXE Use canonical orthogonalization.
subroutine, public cp_cfm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)
Raise the positive spectral part of a Hermitian matrix to a real power. Eigenmodes with eigenvalues b...
subroutine, public cp_cfm_geeig(amatrix, bmatrix, eigenvectors, eigenvalues, work, lowest_subset)
General Eigenvalue Problem AX = BXE Single option version: Cholesky decomposition of B.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_copy_general(source, destination, para_env)
General copy of a cfm matrix to another cfm matrix. Uses non-blocking MPI rather than ScaLAPACK.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_fm_to_cfm(msourcer, msourcei, mtarget)
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value f...
subroutine, public cp_cfm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
subroutine, public cp_cfm_set_all(matrix, alpha, beta)
Set all elements of the full matrix to alpha. Besides, set all diagonal matrix elements to beta (if g...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_transposed(transposed, normal, shallow_data_copy, transpose_distribution, use_distribution)
...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_desymmetrize(matrix_a, matrix_b)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
subroutine, public dbcsr_filter(matrix, eps)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_reserve_all_blocks(matrix)
Reserves all blocks.
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm, plan, check_plan)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr matrix.
Basic linear algebra operations for full matrices.
subroutine, public cp_fm_scale_and_add(alpha, matrix_a, beta, matrix_b)
calc A <- alpha*A + beta*B optimized for alpha == 1.0 (just add beta*B) and beta == 0....
represent the structure of a full matrix
represent a full matrix distributed on many processors
subroutine, public cp_fm_copy_general(source, destination, para_env)
General copy of a fm matrix to another fm matrix. Uses non-blocking MPI rather than ScaLAPACK.
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
Full-matrix operations not provided by the CP2K FM packages.
subroutine, public cfm_contract_aba(matrix_a, matrix_b, matrix_c, workspace)
Computes A^H B A for complex full matrices.
Types and set/get functions for HFX.
subroutine, public hfx_release(x_data)
This routine deallocates all data structures
Defines the basic variable types.
integer, parameter, public dp
Routines needed for kpoint calculation.
subroutine, public kpoint_initialize_mo_set(kpoint)
...
subroutine, public kpoint_initialize_mos(kpoint, mos, added_mos, for_aux_fit)
Initialize a set of MOs and density matrix for each kpoint (kpoint group).
subroutine, public kpoint_env_initialize(kpoint, para_env, blacs_env, with_aux_fit)
Initialize the kpoint environment.
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered, lattice_fft)
Retrieve information from a kpoint environment.
Machine interface based on Fortran 2003 and POSIX.
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_one
complex(kind=dp), parameter, public gaussi
real(kind=dp), parameter, public twopi
complex(kind=dp), parameter, public z_zero
Collection of simple mathematical functions and subroutines.
subroutine, public invmat(a, info)
returns inverse of matrix using the lapack routines DGETRF and DGETRI
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
Calculation of band structures.
subroutine, public calculate_kpoints_for_bs(kpoint, scheme, group_size_ext, mp_grid, kpgeneral, kp_shift, gamma_centered)
...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count, cmo_coeff)
Get the components of a MO set data structure.
module that contains the definitions of the scf types
Utility routines for RPA and GW with imaginary time.
subroutine, public compute_weight_re_im(weight_re, weight_im, num_cells, iatom, jatom, xkp, wkp_w, cell, index_to_cell, hmat, particle_set)
...
subroutine, public get_atom_index_from_basis_function_index(qs_env, atom_from_basis_index, basis_size, basis_type, first_bf_from_atom)
...
Routines treating GW and RPA calculations with kpoints.
subroutine, public get_mat_cell_t_from_mat_gamma(mat_p_omega, qs_env, kpoints, jquad, unit_nr)
Split a real Gamma matrix among nearest images using normalized equal weights.
subroutine, public real_space_to_kpoint_transform_rpa(real_mat_kp, imag_mat_kp, mat_real_space, kpoints, eps_filter_im_time, real_mat_real_space)
...
subroutine, public compute_wkp_w(qs_env, wkp_w, wkp_v, kpoints, h_inv, periodic)
...
subroutine, public get_bandstruc_and_k_dependent_mos(qs_env, eigenval_kp)
...
subroutine, public cfm_screened_interaction_from_eps_cholesky(eps_chol, b, wc, n_active)
Form the screened interaction from a Cholesky-factorized dielectric matrix.
subroutine, public invert_eps_compute_w_and_erpa_kp(dimen_ri, jquad, nkp, count_ev_sc_gw, para_env, erpa, grid, wkp_w, do_gw_im_time, do_ri_sigma_x, do_kpoints_from_gamma, cfm_mat_q, ikp_local, mat_p_omega, mat_p_omega_kp, qs_env, eps_filter_im_time, unit_nr, kpoints, cfm_mat_minv_l_kpoints, cfm_matrix_l_kpoints, fm_mat_w, cfm_mat_ri_global_work, mat_minvvminv, fm_matrix_minv, fm_matrix_minv_vtrunc_minv)
...
subroutine, public mat_kp_from_mat_gamma(qs_env, mat_kp, mat_gamma, kpoints, ispin, real_mat_real_space)
...
Routines for low-scaling RPA/GW with imaginary time.
subroutine, public init_cell_index_rpa(cell_grid, cell_to_index, index_to_cell, cell)
...
parameters that control an scf iteration
Definition and construction of time/frequency grids for correlation methods.
Type defining parameters related to the simulation cell.
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Represent a complex full matrix.
keeps the information about the structure of a full matrix
Keeps information about a specific k-point.
Contains information about kpoints.
stores all the informations relevant to an mpi environment