107#include "./base/base_uses.f90"
113 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mp2_ri_2c'
157 SUBROUTINE get_2c_integrals(qs_env, eri_method, eri_param, para_env, para_env_sub, mp2_memory, &
158 my_Lrows, my_Vrows, fm_matrix_PQ, ngroup, color_sub, dimen_RI, dimen_RI_red, &
159 kpoints, my_group_L_size, my_group_L_start, my_group_L_end, &
160 gd_array, calc_PQ_cond_num, do_svd, eps_svd, potential, ri_metric, &
161 fm_matrix_L_kpoints, fm_matrix_Minv_L_kpoints, &
162 fm_matrix_Minv, fm_matrix_Minv_Vtrunc_Minv, &
163 do_im_time, do_kpoints, mp2_eps_pgf_orb_S, qs_kind_set, sab_orb_sub, calc_forces, unit_nr)
166 INTEGER,
INTENT(IN) :: eri_method
169 REAL(kind=
dp),
INTENT(IN) :: mp2_memory
170 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
171 INTENT(OUT) :: my_lrows, my_vrows
173 INTEGER,
INTENT(IN) :: ngroup, color_sub
174 INTEGER,
INTENT(OUT) :: dimen_ri, dimen_ri_red
176 INTEGER,
INTENT(OUT) :: my_group_l_size, my_group_l_start, &
179 LOGICAL,
INTENT(IN) :: calc_pq_cond_num, do_svd
180 REAL(kind=
dp),
INTENT(IN) :: eps_svd
182 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_l_kpoints, &
183 fm_matrix_minv_l_kpoints, &
185 fm_matrix_minv_vtrunc_minv
186 LOGICAL,
INTENT(IN) :: do_im_time, do_kpoints
187 REAL(kind=
dp),
INTENT(IN) :: mp2_eps_pgf_orb_s
188 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
190 POINTER :: sab_orb_sub
191 LOGICAL,
INTENT(IN) :: calc_forces
192 INTEGER,
INTENT(IN) :: unit_nr
194 CHARACTER(LEN=*),
PARAMETER :: routinen =
'get_2c_integrals'
196 INTEGER :: handle, num_small_eigen
197 REAL(kind=
dp) :: cond_num, eps_pgf_orb_old
198 TYPE(
cp_fm_type) :: fm_matrix_l_work, fm_matrix_m_inv_work, &
204 CALL timeset(routinen, handle)
207 CALL compute_2c_integrals(qs_env, eri_method, eri_param, para_env, para_env_sub, para_env_l, mp2_memory, &
208 fm_matrix_l_work, ngroup, color_sub, dimen_ri, &
209 my_group_l_size, my_group_l_start, my_group_l_end, &
210 gd_array, calc_pq_cond_num, cond_num, &
211 num_small_eigen, potential, sab_orb_sub, do_im_time=do_im_time)
213 IF (do_im_time .AND. calc_forces)
THEN
215 CALL cp_fm_create(fm_matrix_pq, fm_matrix_l_work%matrix_struct)
219 dimen_ri_red = dimen_ri
222 CALL decomp_mat_l(fm_matrix_l_work, do_svd, eps_svd, num_small_eigen, cond_num, .true., gd_array, ngroup, &
223 dimen_ri, dimen_ri_red, para_env)
228 CALL get_qs_env(qs_env, dft_control=dft_control)
231 eps_pgf_orb_old = dft_control%qs_control%eps_pgf_orb
232 dft_control%qs_control%eps_pgf_orb = mp2_eps_pgf_orb_s
235 CALL ri_2c_integral_mat(qs_env, fm_matrix_minv_l_kpoints, fm_matrix_l_work, dimen_ri, ri_metric, &
236 do_kpoints, kpoints, put_mat_ks_env=.true., &
237 regularization_ri=qs_env%mp2_env%ri_rpa_im_time%regularization_RI)
240 dft_control%qs_control%eps_pgf_orb = eps_pgf_orb_old
249 ALLOCATE (fm_matrix_minv_l_kpoints(1, 1))
252 CALL compute_2c_integrals(qs_env, eri_method, eri_param, para_env, para_env_sub, para_env_l, mp2_memory, &
253 fm_matrix_minv_l_kpoints(1, 1), ngroup, color_sub, dimen_ri, &
254 my_group_l_size, my_group_l_start, my_group_l_end, &
255 gd_array, calc_pq_cond_num, cond_num, &
256 num_small_eigen, ri_metric, sab_orb_sub, &
257 fm_matrix_l_extern=fm_matrix_l_work)
264 CALL compute_v_by_lattice_sum(qs_env, fm_matrix_l_kpoints, fm_matrix_minv_l_kpoints, kpoints)
267 kpoints, qs_env%mp2_env%ri_rpa_im_time%eps_eigval_S)
272 CALL ri_2c_integral_mat(qs_env, fm_matrix_minv_vtrunc_minv, fm_matrix_l_work, dimen_ri, trunc_coulomb, &
273 do_kpoints=.false., kpoints=kpoints, put_mat_ks_env=.false., regularization_ri=0.0_dp)
276 CALL ri_2c_integral_mat(qs_env, fm_matrix_minv, fm_matrix_l_work, dimen_ri, ri_metric, &
277 do_kpoints=.false., kpoints=kpoints, put_mat_ks_env=.false., regularization_ri=0.0_dp)
279 CALL gamma_only_inversion_of_m_and_mult_with_chol_dec_of_vtrunc(fm_matrix_minv_vtrunc_minv, &
280 fm_matrix_minv, qs_env)
282 IF (calc_forces .AND. (.NOT. do_im_time))
THEN
284 CALL cp_fm_create(fm_matrix_v, fm_matrix_l_work%matrix_struct)
287 CALL decomp_mat_l(fm_matrix_v, do_svd, eps_svd, num_small_eigen, cond_num, .true., gd_array, ngroup, &
288 dimen_ri, dimen_ri_red, para_env)
291 CALL decomp_mat_l(fm_matrix_l_work, do_svd, eps_svd, num_small_eigen, cond_num, .false., gd_array, ngroup, &
292 dimen_ri, dimen_ri_red, para_env)
294 CALL decomp_mat_l(fm_matrix_minv_l_kpoints(1, 1), .false., 0.0_dp, num_small_eigen, cond_num, .true., &
295 gd_array, ngroup, dimen_ri, dimen_ri_red, para_env)
297 CALL cp_fm_create(fm_matrix_m_inv_work, fm_matrix_minv_l_kpoints(1, 1)%matrix_struct)
300 CALL parallel_gemm(
'N',
'T', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_matrix_minv_l_kpoints(1, 1), &
301 fm_matrix_minv_l_kpoints(1, 1), 0.0_dp, fm_matrix_m_inv_work)
305 CALL reset_size_matrix(fm_matrix_minv_l_kpoints(1, 1), dimen_ri_red, fm_matrix_l_work%matrix_struct)
308 CALL parallel_gemm(
'T',
'N', dimen_ri, dimen_ri_red, dimen_ri, 1.0_dp, fm_matrix_m_inv_work, &
309 fm_matrix_l_work, 0.0_dp, fm_matrix_minv_l_kpoints(1, 1))
312 CALL parallel_gemm(
'T',
'T', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_matrix_m_inv_work, &
313 fm_matrix_l_work, 0.0_dp, fm_matrix_minv_l_kpoints(1, 1))
320 IF (.NOT. do_im_time)
THEN
322 CALL cp_fm_to_fm(fm_matrix_minv_l_kpoints(1, 1), fm_matrix_l_work)
330 CALL get_group_dist(gd_array, color_sub, my_group_l_start, my_group_l_end, my_group_l_size)
332 IF (.NOT. do_im_time)
THEN
333 IF (unit_nr > 0)
THEN
334 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)")
"RI_INFO| Cholesky decomposition group size:", para_env_l%num_pe
335 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)")
"RI_INFO| Number of groups for auxiliary basis functions", ngroup
336 IF (calc_pq_cond_num .OR. do_svd)
THEN
337 WRITE (unit=unit_nr, fmt=
"(T3,A,T67,ES14.5)") &
338 "RI_INFO| Condition number of the (P|Q):", cond_num
339 WRITE (unit=unit_nr, fmt=
"(T3,A,T75,i6)") &
340 "RI_INFO| Number of non-positive Eigenvalues of (P|Q):", num_small_eigen
346 CALL grep_lcols(fm_matrix_l_work, my_group_l_start, my_group_l_end, my_group_l_size, my_lrows)
348 qs_env%mp2_env%potential_parameter))
THEN
349 CALL grep_lcols(fm_matrix_v, my_group_l_start, my_group_l_end, my_group_l_size, my_vrows)
354 qs_env%mp2_env%potential_parameter)))
CALL cp_fm_release(fm_matrix_v)
357 CALL timestop(handle)
375 SUBROUTINE decomp_mat_l(fm_matrix_L, do_svd, eps_svd, num_small_eigen, cond_num, do_inversion, gd_array, ngroup, &
376 dimen_RI, dimen_RI_red, para_env)
378 TYPE(
cp_fm_type),
INTENT(INOUT) :: fm_matrix_l
379 LOGICAL,
INTENT(IN) :: do_svd
380 REAL(kind=
dp),
INTENT(IN) :: eps_svd
381 INTEGER,
INTENT(INOUT) :: num_small_eigen
382 REAL(kind=
dp),
INTENT(INOUT) :: cond_num
383 LOGICAL,
INTENT(IN) :: do_inversion
385 INTEGER,
INTENT(IN) :: ngroup, dimen_ri
386 INTEGER,
INTENT(INOUT) :: dimen_ri_red
390 CALL matrix_root_with_svd(fm_matrix_l, num_small_eigen, cond_num, eps_svd, do_inversion, para_env)
392 dimen_ri_red = dimen_ri - num_small_eigen
402 CALL cholesky_decomp(fm_matrix_l, dimen_ri, do_inversion=do_inversion)
404 IF (do_inversion)
CALL invert_mat(fm_matrix_l)
407 END SUBROUTINE decomp_mat_l
416 SUBROUTINE compute_v_by_lattice_sum(qs_env, fm_matrix_L_kpoints, fm_matrix_Minv_L_kpoints, kpoints)
418 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_l_kpoints, &
419 fm_matrix_minv_l_kpoints
422 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_V_by_lattice_sum'
424 INTEGER :: handle, i_dim, i_real_imag, ikp, nkp, &
426 INTEGER,
DIMENSION(3) :: nkp_grid_orig, periodic
429 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s_ri_aux_transl, matrix_v_ri_kp
431 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
433 CALL timeset(routinen, handle)
435 NULLIFY (matrix_s_ri_aux_transl, particle_set, cell, qs_kind_set)
438 matrix_s_ri_aux_kp=matrix_s_ri_aux_transl, &
439 particle_set=particle_set, &
441 qs_kind_set=qs_kind_set, &
442 atomic_kind_set=atomic_kind_set)
445 CALL get_cell(cell=cell, periodic=periodic)
447 IF (periodic(i_dim) == 1)
THEN
448 cpassert(
modulo(kpoints%nkp_grid(i_dim), 2) == 0)
454 ALLOCATE (fm_matrix_l_kpoints(nkp, 2))
456 DO i_real_imag = 1, 2
457 CALL cp_fm_create(fm_matrix_l_kpoints(ikp, i_real_imag), &
458 fm_matrix_minv_l_kpoints(1, i_real_imag)%matrix_struct)
459 CALL cp_fm_set_all(fm_matrix_l_kpoints(ikp, i_real_imag), 0.0_dp)
463 CALL allocate_matrix_v_ri_kp(matrix_v_ri_kp, matrix_s_ri_aux_transl, nkp)
465 IF (qs_env%mp2_env%ri_rpa_im_time%do_extrapolate_kpoints)
THEN
467 nkp_orig = qs_env%mp2_env%ri_rpa_im_time%nkp_orig
468 nkp_extra = qs_env%mp2_env%ri_rpa_im_time%nkp_extra
471 cell=cell, particle_set=particle_set, qs_kind_set=qs_kind_set, &
472 atomic_kind_set=atomic_kind_set, &
473 size_lattice_sum=qs_env%mp2_env%mp2_gpw%size_lattice_sum, &
476 nkp_grid_orig = kpoints%nkp_grid
477 kpoints%nkp_grid(1:3) = qs_env%mp2_env%ri_rpa_im_time%kp_grid_extra(1:3)
480 cell=cell, particle_set=particle_set, qs_kind_set=qs_kind_set, &
481 atomic_kind_set=atomic_kind_set, &
482 size_lattice_sum=qs_env%mp2_env%mp2_gpw%size_lattice_sum, &
485 kpoints%nkp_grid = nkp_grid_orig
490 cell=cell, particle_set=particle_set, qs_kind_set=qs_kind_set, &
491 atomic_kind_set=atomic_kind_set, &
492 size_lattice_sum=qs_env%mp2_env%mp2_gpw%size_lattice_sum, &
499 CALL copy_dbcsr_to_fm(matrix_v_ri_kp(ikp, 1)%matrix, fm_matrix_l_kpoints(ikp, 1))
500 CALL copy_dbcsr_to_fm(matrix_v_ri_kp(ikp, 2)%matrix, fm_matrix_l_kpoints(ikp, 2))
506 CALL timestop(handle)
508 END SUBROUTINE compute_v_by_lattice_sum
516 SUBROUTINE allocate_matrix_v_ri_kp(matrix_v_RI_kp, matrix_s_RI_aux_transl, nkp)
518 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_v_ri_kp, matrix_s_ri_aux_transl
523 NULLIFY (matrix_v_ri_kp)
528 ALLOCATE (matrix_v_ri_kp(ikp, 1)%matrix)
529 CALL dbcsr_create(matrix_v_ri_kp(ikp, 1)%matrix, template=matrix_s_ri_aux_transl(1, 1)%matrix, &
530 matrix_type=dbcsr_type_no_symmetry)
532 CALL dbcsr_set(matrix_v_ri_kp(ikp, 1)%matrix, 0.0_dp)
534 ALLOCATE (matrix_v_ri_kp(ikp, 2)%matrix)
535 CALL dbcsr_create(matrix_v_ri_kp(ikp, 2)%matrix, template=matrix_s_ri_aux_transl(1, 1)%matrix, &
536 matrix_type=dbcsr_type_no_symmetry)
538 CALL dbcsr_set(matrix_v_ri_kp(ikp, 2)%matrix, 0.0_dp)
542 END SUBROUTINE allocate_matrix_v_ri_kp
559 do_kpoints, kpoints, put_mat_KS_env, regularization_RI, ikp_ext, &
563 TYPE(
cp_fm_type),
ALLOCATABLE,
DIMENSION(:, :) :: fm_matrix_minv_l_kpoints
565 INTEGER,
INTENT(IN) :: dimen_ri
567 LOGICAL,
INTENT(IN) :: do_kpoints
569 LOGICAL,
OPTIONAL :: put_mat_ks_env
570 REAL(kind=
dp),
OPTIONAL :: regularization_ri
571 INTEGER,
OPTIONAL :: ikp_ext
572 LOGICAL,
OPTIONAL :: do_build_cell_index
574 CHARACTER(LEN=*),
PARAMETER :: routinen =
'RI_2c_integral_mat'
576 INTEGER :: handle, i_real_imag, i_size, ikp, &
577 ikp_for_xkp, img, n_real_imag, natom, &
579 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: sizes_ri
580 INTEGER,
DIMENSION(:),
POINTER :: col_bsize, row_bsize
581 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
582 LOGICAL :: my_do_build_cell_index, my_put_mat_ks_env
583 REAL(kind=
dp) :: my_regularization_ri
584 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: xkp
589 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s_ri_aux_transl
590 TYPE(
dbcsr_type),
ALLOCATABLE,
DIMENSION(:) :: mat_2c
591 TYPE(
dbcsr_type),
POINTER :: cmatrix, matrix_s_ri_aux_desymm, &
600 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
602 CALL timeset(routinen, handle)
604 NULLIFY (sab_ri, matrix_s_ri_aux_transl, dist_2d)
606 IF (
PRESENT(regularization_ri))
THEN
607 my_regularization_ri = regularization_ri
609 my_regularization_ri = 0.0_dp
612 IF (
PRESENT(put_mat_ks_env))
THEN
613 my_put_mat_ks_env = put_mat_ks_env
615 my_put_mat_ks_env = .false.
618 IF (
PRESENT(do_build_cell_index))
THEN
619 my_do_build_cell_index = do_build_cell_index
621 my_do_build_cell_index = .false.
626 blacs_env=blacs_env, &
628 distribution_2d=dist_2d, &
629 qs_kind_set=qs_kind_set, &
630 particle_set=particle_set, &
631 dft_control=dft_control, &
634 ALLOCATE (sizes_ri(natom))
635 ALLOCATE (basis_set_ri(nkind))
638 CALL get_particle_set(particle_set, qs_kind_set, nsgf=sizes_ri, basis=basis_set_ri)
641 sym_ij=.true., dist_2d=dist_2d)
644 ALLOCATE (row_bsize(
SIZE(sizes_ri)))
645 ALLOCATE (col_bsize(
SIZE(sizes_ri)))
646 row_bsize(:) = sizes_ri
647 col_bsize(:) = sizes_ri
650 cpassert(
PRESENT(kpoints))
651 IF (my_do_build_cell_index)
THEN
655 cell_to_index=cell_to_index)
657 nimg = dft_control%nimages
664 ALLOCATE (mat_2c(nimg))
665 CALL dbcsr_create(mat_2c(1),
"(RI|RI)", dbcsr_dist, dbcsr_type_symmetric, &
666 row_bsize, col_bsize)
667 DEALLOCATE (row_bsize, col_bsize)
674 ri_metric, do_kpoints=do_kpoints, ext_kpoints=kpoints, &
675 regularization_ri=my_regularization_ri)
678 DEALLOCATE (basis_set_ri)
680 IF (my_put_mat_ks_env)
THEN
681 CALL get_ks_env(qs_env%ks_env, matrix_s_ri_aux_kp=matrix_s_ri_aux_transl)
686 ALLOCATE (matrix_s_ri_aux_transl(1, img)%matrix)
687 CALL dbcsr_copy(matrix_s_ri_aux_transl(1, img)%matrix, mat_2c(img))
691 IF (my_put_mat_ks_env)
THEN
692 CALL set_ks_env(qs_env%ks_env, matrix_s_ri_aux_kp=matrix_s_ri_aux_transl)
695 IF (
PRESENT(ikp_ext)) nkp = 1
697 ALLOCATE (fm_matrix_minv_l_kpoints(nkp, n_real_imag))
699 DO i_real_imag = 1, n_real_imag
700 CALL cp_fm_create(fm_matrix_minv_l_kpoints(i_size, i_real_imag), fm_matrix_l%matrix_struct)
701 CALL cp_fm_set_all(fm_matrix_minv_l_kpoints(i_size, i_real_imag), 0.0_dp)
707 ncol_global=dimen_ri, para_env=para_env)
714 ALLOCATE (rmatrix, cmatrix, tmpmat)
715 CALL dbcsr_create(rmatrix, template=matrix_s_ri_aux_transl(1, 1)%matrix, &
716 matrix_type=dbcsr_type_symmetric)
717 CALL dbcsr_create(cmatrix, template=matrix_s_ri_aux_transl(1, 1)%matrix, &
718 matrix_type=dbcsr_type_antisymmetric)
719 CALL dbcsr_create(tmpmat, template=matrix_s_ri_aux_transl(1, 1)%matrix, &
720 matrix_type=dbcsr_type_no_symmetry)
730 IF (
PRESENT(ikp_ext))
THEN
731 ikp_for_xkp = ikp_ext
736 CALL rskp_transform(rmatrix=rmatrix, cmatrix=cmatrix, rsmat=matrix_s_ri_aux_transl, ispin=1, &
737 xkp=xkp(1:3, ikp_for_xkp), cell_to_index=cell_to_index, sab_nl=sab_ri)
744 CALL cp_fm_copy_general(fm_matrix_s_global, fm_matrix_minv_l_kpoints(ikp, 1), para_env)
751 CALL cp_fm_copy_general(fm_matrix_s_global, fm_matrix_minv_l_kpoints(ikp, 2), para_env)
761 NULLIFY (matrix_s_ri_aux_desymm)
762 ALLOCATE (matrix_s_ri_aux_desymm)
763 CALL dbcsr_create(matrix_s_ri_aux_desymm, template=matrix_s_ri_aux_transl(1, 1)%matrix, &
764 name=
'S_RI non_symm', matrix_type=dbcsr_type_no_symmetry)
782 IF (.NOT. my_put_mat_ks_env)
THEN
786 CALL timestop(handle)
815 SUBROUTINE compute_2c_integrals(qs_env, eri_method, eri_param, para_env, para_env_sub, para_env_L, mp2_memory, &
816 fm_matrix_L, ngroup, color_sub, dimen_RI, &
817 my_group_L_size, my_group_L_start, my_group_L_end, &
818 gd_array, calc_PQ_cond_num, cond_num, num_small_eigen, potential, &
819 sab_orb_sub, do_im_time, fm_matrix_L_extern)
822 INTEGER,
INTENT(IN) :: eri_method
827 REAL(kind=
dp),
INTENT(IN) :: mp2_memory
829 INTEGER,
INTENT(IN) :: ngroup, color_sub
830 INTEGER,
INTENT(OUT) :: dimen_ri, my_group_l_size, &
831 my_group_l_start, my_group_l_end
833 LOGICAL,
INTENT(IN) :: calc_pq_cond_num
834 REAL(kind=
dp),
INTENT(OUT) :: cond_num
835 INTEGER,
INTENT(OUT) :: num_small_eigen
838 POINTER :: sab_orb_sub
839 LOGICAL,
INTENT(IN),
OPTIONAL :: do_im_time
840 TYPE(
cp_fm_type),
INTENT(IN),
OPTIONAL :: fm_matrix_l_extern
842 CHARACTER(LEN=*),
PARAMETER :: routinen =
'compute_2c_integrals'
844 INTEGER :: best_group_size, color_l, group_size, handle, handle2, i_global, iatom, iib, &
845 ikind, iproc, j_global, jjb, natom, ncol_local, nkind, nrow_local, nsgf, potential_type, &
846 proc_receive, proc_receive_static, proc_send_static, proc_shift, rec_l_end, rec_l_size, &
847 rec_l_start, strat_group_size
848 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: kind_of
849 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
850 LOGICAL :: my_do_im_time
851 REAL(kind=
dp) :: min_mem_for_qk
852 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: egen_l
853 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: l_external_col, l_local_col
860 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
862 CALL timeset(routinen, handle)
864 my_do_im_time = .false.
865 IF (
PRESENT(do_im_time))
THEN
866 my_do_im_time = do_im_time
870 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set, &
871 particle_set=particle_set)
873 nkind =
SIZE(qs_kind_set)
874 natom =
SIZE(particle_set)
879 CALL get_qs_kind(qs_kind=qs_kind_set(ikind), basis_set=basis_set_a, basis_type=
"RI_AUX")
880 cpassert(
ASSOCIATED(basis_set_a))
885 ikind = kind_of(iatom)
886 CALL get_qs_kind(qs_kind=qs_kind_set(ikind), nsgf=nsgf, basis_type=
"RI_AUX")
887 dimen_ri = dimen_ri + nsgf
891 IF (dimen_ri < ngroup)
THEN
892 CALL cp_abort(__location__,
"Product of block size and number "// &
893 "of RI functions should not exceed total number of processes")
898 CALL get_group_dist(gd_array, color_sub, my_group_l_start, my_group_l_end, my_group_l_size)
900 CALL timeset(routinen//
"_loop_lm", handle2)
902 ALLOCATE (l_local_col(dimen_ri, my_group_l_size))
905 potential_type = potential%potential_type
912 basis_type_a=
"RI_AUX", basis_type_b=
"RI_AUX", &
913 hab=l_local_col, first_b=my_group_l_start, last_b=my_group_l_end, &
914 eri_method=eri_method)
921 natom, potential, sab_orb_sub, l_local_col, kind_of)
924 cpabort(
"unknown ERI method")
927 CALL timestop(handle2)
931 best_group_size = para_env%num_pe
933 strat_group_size = max(1, para_env%num_pe/10)
935 min_mem_for_qk = real(dimen_ri, kind=
dp)*dimen_ri*3.0_dp*8.0_dp/1024_dp/1024_dp
937 group_size = strat_group_size - 1
938 DO iproc = strat_group_size, para_env%num_pe
939 group_size = group_size + 1
942 IF (mod(para_env%num_pe, group_size) /= 0 .OR. mod(group_size, para_env_sub%num_pe) /= 0) cycle
945 IF (real(group_size, kind=
dp)*mp2_memory < min_mem_for_qk) cycle
947 best_group_size = group_size
951 IF (my_do_im_time)
THEN
953 best_group_size = para_env%num_pe
957 color_l = para_env%mepos/best_group_size
958 ALLOCATE (para_env_l)
959 CALL para_env_l%from_split(para_env, color_l)
962 NULLIFY (blacs_env_l)
966 CALL create_matrix_l(fm_matrix_l, blacs_env_l, dimen_ri, para_env_l,
"fm_matrix_L", fm_matrix_l_extern)
968 IF (my_do_im_time .AND. para_env%num_pe > 1)
THEN
970 CALL fill_fm_l_from_l_loc_non_blocking(fm_matrix_l, l_local_col, para_env, &
971 my_group_l_start, my_group_l_end, &
978 CALL comm_exchange%from_split(para_env_l, para_env_sub%mepos)
981 my_group_l_end, my_group_l_size, comm_exchange)
984 nrow_local=nrow_local, &
985 ncol_local=ncol_local, &
986 row_indices=row_indices, &
987 col_indices=col_indices)
989 DO jjb = 1, ncol_local
990 j_global = col_indices(jjb)
991 IF (j_global >= my_group_l_start .AND. j_global <= my_group_l_end)
THEN
992 DO iib = 1, nrow_local
993 i_global = row_indices(iib)
994 fm_matrix_l%local_data(iib, jjb) = l_local_col(i_global, j_global - my_group_l_start + 1)
999 proc_send_static =
modulo(comm_exchange%mepos + 1, comm_exchange%num_pe)
1000 proc_receive_static =
modulo(comm_exchange%mepos - 1, comm_exchange%num_pe)
1002 DO proc_shift = 1, comm_exchange%num_pe - 1
1003 proc_receive =
modulo(comm_exchange%mepos - proc_shift, comm_exchange%num_pe)
1005 CALL get_group_dist(gd_sub_array, proc_receive, rec_l_start, rec_l_end, rec_l_size)
1007 ALLOCATE (l_external_col(dimen_ri, rec_l_size))
1008 l_external_col = 0.0_dp
1010 CALL comm_exchange%sendrecv(l_local_col, proc_send_static, l_external_col, proc_receive_static)
1012 DO jjb = 1, ncol_local
1013 j_global = col_indices(jjb)
1014 IF (j_global >= rec_l_start .AND. j_global <= rec_l_end)
THEN
1015 DO iib = 1, nrow_local
1016 i_global = row_indices(iib)
1017 fm_matrix_l%local_data(iib, jjb) = l_external_col(i_global, j_global - rec_l_start + 1)
1022 CALL move_alloc(l_external_col, l_local_col)
1026 CALL comm_exchange%free()
1030 DEALLOCATE (l_local_col)
1035 comm_exchange = fm_matrix_l%matrix_struct%context%interconnect(para_env)
1036 CALL comm_exchange%sum(fm_matrix_l%local_data)
1037 CALL comm_exchange%free()
1042 IF (calc_pq_cond_num)
THEN
1046 CALL create_matrix_l(fm_matrix_l_diag, blacs_env_l, dimen_ri, para_env_l,
"fm_matrix_L_diag", fm_matrix_l_extern)
1048 CALL cp_fm_to_fm(source=fm_matrix_l, destination=fm_matrix_l_diag)
1050 ALLOCATE (egen_l(dimen_ri))
1053 CALL cp_fm_syevx(matrix=fm_matrix_l_diag, eigenvalues=egen_l)
1056 DO iib = 1, dimen_ri
1057 IF (abs(egen_l(iib)) < 0.001_dp) num_small_eigen = num_small_eigen + 1
1060 cond_num = maxval(abs(egen_l))/minval(abs(egen_l))
1062 CALL cp_fm_release(fm_matrix_l_diag)
1068 CALL cp_blacs_env_release(blacs_env_l)
1070 CALL timestop(handle)
1072 END SUBROUTINE compute_2c_integrals
1083 SUBROUTINE matrix_root_with_svd(matrix, num_small_evals, cond_num, eps_svd, do_inversion, para_env)
1084 TYPE(cp_fm_type),
INTENT(INOUT) :: matrix
1085 INTEGER,
INTENT(OUT) :: num_small_evals
1086 REAL(kind=dp),
INTENT(OUT) :: cond_num
1087 REAL(kind=dp),
INTENT(IN) :: eps_svd
1088 LOGICAL,
INTENT(IN) :: do_inversion
1089 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
1091 CHARACTER(LEN=*),
PARAMETER :: routinen =
'matrix_root_with_svd'
1093 INTEGER :: group_size_l, handle, ii, needed_evals, &
1095 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: num_eval
1096 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:) :: evals
1097 TYPE(cp_fm_type) :: evecs
1098 TYPE(mp_comm_type) :: comm_exchange
1100 CALL timeset(routinen, handle)
1103 CALL cp_fm_get_info(matrix=matrix, nrow_global=nrow)
1105 ALLOCATE (evals(nrow))
1108 CALL cp_fm_create(evecs, matrix%matrix_struct)
1111 CALL choose_eigv_solver(matrix, evecs, evals)
1116 IF (evals(ii) > eps_svd)
THEN
1117 num_small_evals = ii - 1
1121 needed_evals = nrow - num_small_evals
1124 cond_num = evals(nrow)/evals(num_small_evals + 1)
1127 evals(1:num_small_evals) = 0.0_dp
1128 IF (do_inversion)
THEN
1129 evals(num_small_evals + 1:nrow) = 1.0_dp/sqrt(evals(num_small_evals + 1:nrow))
1131 evals(num_small_evals + 1:nrow) = sqrt(evals(num_small_evals + 1:nrow))
1134 CALL cp_fm_column_scale(evecs, evals)
1140 group_size_l = para_env%num_pe/matrix%matrix_struct%para_env%num_pe
1141 comm_exchange = matrix%matrix_struct%context%interconnect(para_env)
1143 ALLOCATE (num_eval(0:group_size_l - 1))
1144 CALL comm_exchange%allgather(num_small_evals, num_eval)
1146 num_small_evals = minval(num_eval)
1148 IF (num_small_evals /= maxval(num_eval))
THEN
1150 pos_max = maxloc(num_eval)
1151 num_small_evals = num_eval(pos_max(1))
1152 needed_evals = nrow - num_small_evals
1155 CALL comm_exchange%bcast(evecs%local_data, pos_max(1))
1156 CALL comm_exchange%bcast(cond_num, pos_max(1))
1159 DEALLOCATE (num_eval)
1161 CALL comm_exchange%free()
1163 CALL reset_size_matrix(matrix, needed_evals, matrix%matrix_struct)
1166 CALL cp_fm_to_fm(evecs, matrix, needed_evals, num_small_evals + 1)
1168 CALL cp_fm_release(evecs)
1170 CALL timestop(handle)
1172 END SUBROUTINE matrix_root_with_svd
1180 SUBROUTINE reset_size_matrix(matrix, new_size, fm_struct_template)
1181 TYPE(cp_fm_type),
INTENT(INOUT) :: matrix
1182 INTEGER,
INTENT(IN) :: new_size
1183 TYPE(cp_fm_struct_type),
POINTER :: fm_struct_template
1185 CHARACTER(LEN=*),
PARAMETER :: routinen =
'reset_size_matrix'
1188 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
1190 CALL timeset(routinen, handle)
1194 CALL cp_fm_struct_create(fm_struct, ncol_global=new_size, template_fmstruct=fm_struct_template, force_block=.true.)
1196 CALL cp_fm_release(matrix)
1198 CALL cp_fm_create(matrix, fm_struct)
1199 CALL cp_fm_set_all(matrix, 0.0_dp)
1201 CALL cp_fm_struct_release(fm_struct)
1203 CALL timestop(handle)
1205 END SUBROUTINE reset_size_matrix
1216 SUBROUTINE fill_fm_l_from_l_loc_non_blocking(fm_matrix_L, L_local_col, para_env, my_group_L_start, &
1217 my_group_L_end, dimen_RI)
1218 TYPE(cp_fm_type),
INTENT(IN) :: fm_matrix_l
1219 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :), &
1220 INTENT(IN) :: l_local_col
1221 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
1222 INTEGER,
INTENT(IN) :: my_group_l_start, my_group_l_end, &
1225 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fill_fm_L_from_L_loc_non_blocking'
1227 INTEGER :: dummy_proc, handle, handle2, i_entry_rec, i_row, i_row_global, iproc, j_col, &
1228 j_col_global, lll, mmm, ncol_local, nrow_local, proc_send, send_pcol, send_prow
1229 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: entry_counter, num_entries_rec, &
1231 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
1232 TYPE(integ_mat_buffer_type),
ALLOCATABLE, &
1233 DIMENSION(:) :: buffer_rec, buffer_send
1234 TYPE(mp_request_type),
DIMENSION(:, :),
POINTER :: req_array
1236 CALL timeset(routinen, handle)
1238 CALL timeset(routinen//
"_1", handle2)
1241 CALL cp_fm_get_info(matrix=fm_matrix_l, &
1242 nrow_local=nrow_local, &
1243 ncol_local=ncol_local, &
1244 row_indices=row_indices, &
1245 col_indices=col_indices)
1247 ALLOCATE (num_entries_rec(0:para_env%num_pe - 1))
1248 ALLOCATE (num_entries_send(0:para_env%num_pe - 1))
1250 num_entries_rec(:) = 0
1251 num_entries_send(:) = 0
1256 DO lll = 1, dimen_ri
1258 send_prow = fm_matrix_l%matrix_struct%g2p_row(lll)
1260 DO mmm = my_group_l_start, my_group_l_end
1262 send_pcol = fm_matrix_l%matrix_struct%g2p_col(mmm)
1264 proc_send = fm_matrix_l%matrix_struct%context%blacs2mpi(send_prow, send_pcol)
1266 num_entries_send(proc_send) = num_entries_send(proc_send) + 1
1272 CALL timestop(handle2)
1274 CALL timeset(routinen//
"_2", handle2)
1276 CALL para_env%alltoall(num_entries_send, num_entries_rec, 1)
1278 CALL timestop(handle2)
1280 CALL timeset(routinen//
"_3", handle2)
1283 ALLOCATE (buffer_rec(0:para_env%num_pe - 1))
1284 ALLOCATE (buffer_send(0:para_env%num_pe - 1))
1287 DO iproc = 0, para_env%num_pe - 1
1289 ALLOCATE (buffer_rec(iproc)%msg(num_entries_rec(iproc)))
1290 buffer_rec(iproc)%msg = 0.0_dp
1294 CALL timestop(handle2)
1296 CALL timeset(routinen//
"_4", handle2)
1298 DO iproc = 0, para_env%num_pe - 1
1300 ALLOCATE (buffer_send(iproc)%msg(num_entries_send(iproc)))
1301 buffer_send(iproc)%msg = 0.0_dp
1305 CALL timestop(handle2)
1307 CALL timeset(routinen//
"_5", handle2)
1309 DO iproc = 0, para_env%num_pe - 1
1311 ALLOCATE (buffer_rec(iproc)%indx(num_entries_rec(iproc), 2))
1312 buffer_rec(iproc)%indx = 0
1316 CALL timestop(handle2)
1318 CALL timeset(routinen//
"_6", handle2)
1320 DO iproc = 0, para_env%num_pe - 1
1322 ALLOCATE (buffer_send(iproc)%indx(num_entries_send(iproc), 2))
1323 buffer_send(iproc)%indx = 0
1327 CALL timestop(handle2)
1329 CALL timeset(routinen//
"_7", handle2)
1331 ALLOCATE (entry_counter(0:para_env%num_pe - 1))
1332 entry_counter(:) = 0
1336 DO lll = 1, dimen_ri
1338 send_prow = fm_matrix_l%matrix_struct%g2p_row(lll)
1340 DO mmm = my_group_l_start, my_group_l_end
1342 send_pcol = fm_matrix_l%matrix_struct%g2p_col(mmm)
1344 proc_send = fm_matrix_l%matrix_struct%context%blacs2mpi(send_prow, send_pcol)
1346 entry_counter(proc_send) = entry_counter(proc_send) + 1
1348 buffer_send(proc_send)%msg(entry_counter(proc_send)) = &
1349 l_local_col(lll, mmm - my_group_l_start + 1)
1351 buffer_send(proc_send)%indx(entry_counter(proc_send), 1) = lll
1352 buffer_send(proc_send)%indx(entry_counter(proc_send), 2) = mmm
1358 ALLOCATE (req_array(1:para_env%num_pe, 4))
1360 CALL timestop(handle2)
1362 CALL timeset(routinen//
"_8", handle2)
1365 CALL communicate_buffer(para_env, num_entries_rec, num_entries_send, buffer_rec, &
1366 buffer_send, req_array)
1368 fm_matrix_l%local_data = 0.0_dp
1370 CALL timestop(handle2)
1372 CALL timeset(routinen//
"_9", handle2)
1375 DO iproc = 0, para_env%num_pe - 1
1377 DO i_entry_rec = 1, num_entries_rec(iproc)
1379 DO i_row = 1, nrow_local
1381 i_row_global = row_indices(i_row)
1383 DO j_col = 1, ncol_local
1385 j_col_global = col_indices(j_col)
1387 IF (i_row_global == buffer_rec(iproc)%indx(i_entry_rec, 1) .AND. &
1388 j_col_global == buffer_rec(iproc)%indx(i_entry_rec, 2))
THEN
1390 fm_matrix_l%local_data(i_row, j_col) = buffer_rec(iproc)%msg(i_entry_rec)
1402 CALL timestop(handle2)
1404 CALL timeset(routinen//
"_10", handle2)
1406 DO iproc = 0, para_env%num_pe - 1
1407 DEALLOCATE (buffer_rec(iproc)%msg)
1408 DEALLOCATE (buffer_rec(iproc)%indx)
1409 DEALLOCATE (buffer_send(iproc)%msg)
1410 DEALLOCATE (buffer_send(iproc)%indx)
1413 DEALLOCATE (buffer_rec, buffer_send)
1414 DEALLOCATE (req_array)
1415 DEALLOCATE (entry_counter)
1416 DEALLOCATE (num_entries_rec, num_entries_send)
1418 CALL timestop(handle2)
1420 CALL timestop(handle)
1422 END SUBROUTINE fill_fm_l_from_l_loc_non_blocking
1430 SUBROUTINE cholesky_decomp(fm_matrix_L, dimen_RI, do_inversion)
1432 TYPE(cp_fm_type),
INTENT(IN) :: fm_matrix_l
1433 INTEGER,
INTENT(IN) :: dimen_ri
1434 LOGICAL,
INTENT(IN) :: do_inversion
1436 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cholesky_decomp'
1438 INTEGER :: handle, i_global, iib, info_chol, &
1439 j_global, jjb, ncol_local, nrow_local
1440 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
1442 CALL timeset(routinen, handle)
1445 CALL cp_fm_cholesky_decompose(matrix=fm_matrix_l, n=dimen_ri, info_out=info_chol)
1446 cpassert(info_chol == 0)
1448 IF (.NOT. do_inversion)
THEN
1450 CALL cp_fm_get_info(matrix=fm_matrix_l, &
1451 nrow_local=nrow_local, &
1452 ncol_local=ncol_local, &
1453 row_indices=row_indices, &
1454 col_indices=col_indices)
1455 DO iib = 1, nrow_local
1456 i_global = row_indices(iib)
1457 DO jjb = 1, ncol_local
1458 j_global = col_indices(jjb)
1459 IF (j_global < i_global) fm_matrix_l%local_data(iib, jjb) = 0.0_dp
1465 CALL timestop(handle)
1467 END SUBROUTINE cholesky_decomp
1478 dimen_RI, kpoints, eps_eigval_S)
1480 TYPE(cp_fm_type),
DIMENSION(:, :),
INTENT(IN) :: fm_matrix_minv_l_kpoints, &
1482 INTEGER,
INTENT(IN) :: dimen_ri
1483 TYPE(kpoint_type),
POINTER :: kpoints
1484 REAL(kind=dp),
INTENT(IN) :: eps_eigval_s
1486 CHARACTER(LEN=*),
PARAMETER :: routinen =
'inversion_of_M_and_mult_with_chol_dec_of_V'
1487 COMPLEX(KIND=dp),
PARAMETER :: cone = cmplx(1.0_dp, 0.0_dp, kind=dp), &
1488 czero = cmplx(0.0_dp, 0.0_dp, kind=dp), ione = cmplx(0.0_dp, 1.0_dp, kind=dp)
1490 INTEGER :: handle, ikp, nkp
1491 TYPE(cp_cfm_type) :: cfm_matrix_k_tmp, cfm_matrix_m_tmp, &
1492 cfm_matrix_v_tmp, cfm_matrix_vtrunc_tmp
1493 TYPE(cp_fm_struct_type),
POINTER :: matrix_struct
1495 CALL timeset(routinen, handle)
1497 CALL cp_fm_get_info(fm_matrix_minv_l_kpoints(1, 1), matrix_struct=matrix_struct)
1499 CALL cp_cfm_create(cfm_matrix_m_tmp, matrix_struct)
1500 CALL cp_cfm_create(cfm_matrix_v_tmp, matrix_struct)
1501 CALL cp_cfm_create(cfm_matrix_k_tmp, matrix_struct)
1502 CALL cp_cfm_create(cfm_matrix_vtrunc_tmp, matrix_struct)
1504 CALL get_kpoint_info(kpoints, nkp=nkp)
1508 CALL cp_cfm_scale_and_add_fm(czero, cfm_matrix_m_tmp, cone, fm_matrix_minv_l_kpoints(ikp, 1))
1509 CALL cp_cfm_scale_and_add_fm(cone, cfm_matrix_m_tmp, ione, fm_matrix_minv_l_kpoints(ikp, 2))
1511 CALL cp_cfm_scale_and_add_fm(czero, cfm_matrix_v_tmp, cone, fm_matrix_l_kpoints(ikp, 1))
1512 CALL cp_cfm_scale_and_add_fm(cone, cfm_matrix_v_tmp, ione, fm_matrix_l_kpoints(ikp, 2))
1514 CALL cp_cfm_power(cfm_matrix_m_tmp, threshold=eps_eigval_s, exponent=-1.0_dp)
1516 CALL cp_cfm_power(cfm_matrix_v_tmp, threshold=0.0_dp, exponent=0.5_dp)
1519 CALL cp_cfm_to_fm(cfm_matrix_v_tmp, fm_matrix_l_kpoints(ikp, 1), fm_matrix_l_kpoints(ikp, 2))
1522 CALL parallel_gemm(
"N",
"C", dimen_ri, dimen_ri, dimen_ri, cone, cfm_matrix_m_tmp, cfm_matrix_v_tmp, &
1523 czero, cfm_matrix_k_tmp)
1526 CALL cp_cfm_to_fm(cfm_matrix_k_tmp, fm_matrix_minv_l_kpoints(ikp, 1), fm_matrix_minv_l_kpoints(ikp, 2))
1530 CALL cp_cfm_release(cfm_matrix_m_tmp)
1531 CALL cp_cfm_release(cfm_matrix_v_tmp)
1532 CALL cp_cfm_release(cfm_matrix_k_tmp)
1533 CALL cp_cfm_release(cfm_matrix_vtrunc_tmp)
1535 CALL timestop(handle)
1545 SUBROUTINE gamma_only_inversion_of_m_and_mult_with_chol_dec_of_vtrunc(fm_matrix_Minv_Vtrunc_Minv, &
1546 fm_matrix_Minv, qs_env)
1548 TYPE(cp_fm_type),
DIMENSION(:, :) :: fm_matrix_minv_vtrunc_minv, &
1550 TYPE(qs_environment_type),
POINTER :: qs_env
1552 CHARACTER(LEN=*),
PARAMETER :: &
1553 routinen =
'Gamma_only_inversion_of_M_and_mult_with_chol_dec_of_Vtrunc'
1555 INTEGER :: dimen_ri, handle, ndep
1556 REAL(kind=dp) :: eps_eigval_s_gamma
1557 TYPE(cp_fm_type) :: fm_matrix_ri_metric_inv_work, fm_work
1559 CALL timeset(routinen, handle)
1561 CALL cp_fm_create(fm_work, fm_matrix_minv(1, 1)%matrix_struct)
1562 CALL cp_fm_set_all(fm_work, 0.0_dp)
1564 CALL cp_fm_create(fm_matrix_ri_metric_inv_work, fm_matrix_minv(1, 1)%matrix_struct)
1565 CALL cp_fm_set_all(fm_matrix_ri_metric_inv_work, 0.0_dp)
1567 CALL cp_fm_get_info(matrix=fm_matrix_minv(1, 1), nrow_global=dimen_ri)
1569 eps_eigval_s_gamma = qs_env%mp2_env%ri_rpa_im_time%eps_eigval_S_Gamma
1571 IF (eps_eigval_s_gamma > 1.0e-18)
THEN
1574 CALL cp_fm_power(fm_matrix_minv(1, 1), fm_matrix_ri_metric_inv_work, -0.5_dp, &
1575 eps_eigval_s_gamma, ndep)
1579 CALL cholesky_decomp(fm_matrix_minv(1, 1), dimen_ri, do_inversion=.true.)
1581 CALL invert_mat(fm_matrix_minv(1, 1))
1585 CALL parallel_gemm(
'N',
'T', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_matrix_minv(1, 1), &
1586 fm_matrix_minv(1, 1), 0.0_dp, fm_matrix_ri_metric_inv_work)
1588 CALL cp_fm_to_fm(fm_matrix_ri_metric_inv_work, fm_matrix_minv(1, 1))
1590 CALL parallel_gemm(
'N',
'N', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_matrix_ri_metric_inv_work, &
1591 fm_matrix_minv_vtrunc_minv(1, 1), 0.0_dp, fm_work)
1593 CALL parallel_gemm(
'N',
'N', dimen_ri, dimen_ri, dimen_ri, 1.0_dp, fm_work, &
1594 fm_matrix_ri_metric_inv_work, 0.0_dp, fm_matrix_minv_vtrunc_minv(1, 1))
1596 CALL cp_fm_release(fm_work)
1597 CALL cp_fm_release(fm_matrix_ri_metric_inv_work)
1599 CALL timestop(handle)
1601 END SUBROUTINE gamma_only_inversion_of_m_and_mult_with_chol_dec_of_vtrunc
1612 cell_grid, do_BvK_cell)
1613 TYPE(qs_environment_type),
POINTER :: qs_env
1614 TYPE(libint_potential_type),
OPTIONAL :: trunc_coulomb
1615 REAL(kind=dp),
OPTIONAL :: rel_cutoff_trunc_coulomb_ri_x
1616 INTEGER,
DIMENSION(3),
OPTIONAL :: cell_grid
1617 LOGICAL,
OPTIONAL :: do_bvk_cell
1619 CHARACTER(LEN=*),
PARAMETER :: routinen =
'trunc_coulomb_for_exchange'
1621 INTEGER :: handle, i_dim
1622 INTEGER,
DIMENSION(3) :: periodic
1623 LOGICAL :: my_do_bvk_cell
1624 REAL(kind=dp) :: kp_fac, kp_fac_idim, my_rel_cutoff_trunc_coulomb_ri_x, &
1625 shortest_dist_cell_planes
1626 TYPE(cell_type),
POINTER :: cell
1627 TYPE(kpoint_type),
POINTER :: kpoints_scf
1629 CALL timeset(routinen, handle)
1632 CALL get_qs_env(qs_env, cell=cell, kpoints=kpoints_scf)
1633 CALL get_cell(cell=cell, periodic=periodic)
1635 my_do_bvk_cell = .false.
1636 IF (
PRESENT(do_bvk_cell)) my_do_bvk_cell = do_bvk_cell
1637 IF (my_do_bvk_cell)
THEN
1641 IF (periodic(i_dim) == 1)
THEN
1642 IF (
PRESENT(cell_grid))
THEN
1643 kp_fac_idim = real(cell_grid(i_dim), kind=dp)
1645 kp_fac_idim = real(kpoints_scf%nkp_grid(i_dim), kind=dp)
1647 IF (kp_fac > kp_fac_idim) kp_fac = kp_fac_idim
1654 shortest_dist_cell_planes = 1.0e4_dp
1655 IF (periodic(1) == 1)
THEN
1656 IF (shortest_dist_cell_planes > plane_distance(1, 0, 0, cell))
THEN
1657 shortest_dist_cell_planes = plane_distance(1, 0, 0, cell)
1660 IF (periodic(2) == 1)
THEN
1661 IF (shortest_dist_cell_planes > plane_distance(0, 1, 0, cell))
THEN
1662 shortest_dist_cell_planes = plane_distance(0, 1, 0, cell)
1665 IF (periodic(3) == 1)
THEN
1666 IF (shortest_dist_cell_planes > plane_distance(0, 0, 1, cell))
THEN
1667 shortest_dist_cell_planes = plane_distance(0, 0, 1, cell)
1671 IF (
PRESENT(rel_cutoff_trunc_coulomb_ri_x))
THEN
1672 my_rel_cutoff_trunc_coulomb_ri_x = rel_cutoff_trunc_coulomb_ri_x
1674 my_rel_cutoff_trunc_coulomb_ri_x = qs_env%mp2_env%ri_rpa_im_time%rel_cutoff_trunc_coulomb_ri_x
1677 IF (
PRESENT(trunc_coulomb))
THEN
1678 trunc_coulomb%potential_type = do_potential_truncated
1679 trunc_coulomb%cutoff_radius = shortest_dist_cell_planes* &
1680 my_rel_cutoff_trunc_coulomb_ri_x* &
1682 trunc_coulomb%filename =
"t_c_g.dat"
1684 trunc_coulomb%omega = 0.0_dp
1687 CALL timestop(handle)
1695 SUBROUTINE invert_mat(fm_matrix_L)
1697 TYPE(cp_fm_type),
INTENT(IN) :: fm_matrix_l
1699 CHARACTER(LEN=*),
PARAMETER :: routinen =
'invert_mat'
1701 INTEGER :: handle, i_global, iib, j_global, jjb, &
1702 ncol_local, nrow_local
1703 INTEGER,
DIMENSION(:),
POINTER :: col_indices, row_indices
1705 CALL timeset(routinen, handle)
1707 CALL cp_fm_triangular_invert(matrix_a=fm_matrix_l, uplo_tr=
'U')
1710 CALL cp_fm_get_info(matrix=fm_matrix_l, &
1711 nrow_local=nrow_local, &
1712 ncol_local=ncol_local, &
1713 row_indices=row_indices, &
1714 col_indices=col_indices)
1716 DO jjb = 1, ncol_local
1717 j_global = col_indices(jjb)
1718 DO iib = 1, nrow_local
1719 i_global = row_indices(iib)
1720 IF (j_global < i_global) fm_matrix_l%local_data(iib, jjb) = 0.0_dp
1724 CALL timestop(handle)
1726 END SUBROUTINE invert_mat
1737 SUBROUTINE create_matrix_l(fm_matrix_L, blacs_env_L, dimen_RI, para_env_L, name, fm_matrix_L_extern)
1738 TYPE(cp_fm_type),
INTENT(OUT) :: fm_matrix_l
1739 TYPE(cp_blacs_env_type),
POINTER :: blacs_env_l
1740 INTEGER,
INTENT(IN) :: dimen_ri
1741 TYPE(mp_para_env_type),
POINTER :: para_env_l
1742 CHARACTER(LEN=*),
INTENT(IN) :: name
1743 TYPE(cp_fm_type),
INTENT(IN),
OPTIONAL :: fm_matrix_l_extern
1745 CHARACTER(LEN=*),
PARAMETER :: routinen =
'create_matrix_L'
1748 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
1750 CALL timeset(routinen, handle)
1753 IF (
PRESENT(fm_matrix_l_extern))
THEN
1754 CALL cp_fm_create(fm_matrix_l, fm_matrix_l_extern%matrix_struct, name=name)
1757 CALL cp_fm_struct_create(fm_struct, context=blacs_env_l, nrow_global=dimen_ri, &
1758 ncol_global=dimen_ri, para_env=para_env_l)
1760 CALL cp_fm_create(fm_matrix_l, fm_struct, name=name)
1762 CALL cp_fm_struct_release(fm_struct)
1765 CALL cp_fm_set_all(matrix=fm_matrix_l, alpha=0.0_dp)
1767 CALL timestop(handle)
1769 END SUBROUTINE create_matrix_l
1779 SUBROUTINE grep_lcols(fm_matrix_L, &
1780 my_group_L_start, my_group_L_end, my_group_L_size, my_Lrows)
1781 TYPE(cp_fm_type),
INTENT(IN) :: fm_matrix_l
1782 INTEGER,
INTENT(IN) :: my_group_l_start, my_group_l_end, &
1784 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :), &
1785 INTENT(OUT) :: my_lrows
1787 CHARACTER(LEN=*),
PARAMETER :: routinen =
'grep_Lcols'
1789 INTEGER :: dimen_ri, handle, handle2, i_global, iib, j_global, jjb, max_row_col_local, &
1790 ncol_local, ncol_rec, nrow_local, nrow_rec, proc_receive_static, proc_send_static, &
1792 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: local_col_row_info, rec_col_row_info
1793 INTEGER,
DIMENSION(:),
POINTER :: col_indices, col_indices_rec, &
1794 row_indices, row_indices_rec
1795 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: local_l, rec_l
1796 REAL(kind=dp),
CONTIGUOUS,
DIMENSION(:, :), &
1797 POINTER :: local_l_internal
1798 TYPE(mp_para_env_type),
POINTER :: para_env
1800 CALL timeset(routinen, handle)
1802 CALL cp_fm_get_info(matrix=fm_matrix_l, &
1803 nrow_local=nrow_local, &
1804 ncol_local=ncol_local, &
1805 row_indices=row_indices, &
1806 col_indices=col_indices, &
1807 nrow_global=dimen_ri, &
1808 local_data=local_l_internal, &
1811 ALLOCATE (my_lrows(dimen_ri, my_group_l_size))
1814 ALLOCATE (local_l(nrow_local, ncol_local))
1815 local_l(:, :) = local_l_internal(1:nrow_local, 1:ncol_local)
1817 max_row_col_local = max(nrow_local, ncol_local)
1818 CALL para_env%max(max_row_col_local)
1820 ALLOCATE (local_col_row_info(0:max_row_col_local, 2))
1821 local_col_row_info = 0
1823 local_col_row_info(0, 1) = nrow_local
1824 local_col_row_info(1:nrow_local, 1) = row_indices(1:nrow_local)
1826 local_col_row_info(0, 2) = ncol_local
1827 local_col_row_info(1:ncol_local, 2) = col_indices(1:ncol_local)
1829 ALLOCATE (rec_col_row_info(0:max_row_col_local, 2))
1832 DO jjb = 1, ncol_local
1833 j_global = col_indices(jjb)
1834 IF (j_global >= my_group_l_start .AND. j_global <= my_group_l_end)
THEN
1835 DO iib = 1, nrow_local
1836 i_global = row_indices(iib)
1837 my_lrows(i_global, j_global - my_group_l_start + 1) = local_l(iib, jjb)
1842 proc_send_static =
modulo(para_env%mepos + 1, para_env%num_pe)
1843 proc_receive_static =
modulo(para_env%mepos - 1, para_env%num_pe)
1845 CALL timeset(routinen//
"_comm", handle2)
1847 DO proc_shift = 1, para_env%num_pe - 1
1849 rec_col_row_info = 0
1850 CALL para_env%sendrecv(local_col_row_info, proc_send_static, rec_col_row_info, proc_receive_static)
1851 nrow_rec = rec_col_row_info(0, 1)
1852 ncol_rec = rec_col_row_info(0, 2)
1854 ALLOCATE (row_indices_rec(nrow_rec))
1855 row_indices_rec = rec_col_row_info(1:nrow_rec, 1)
1857 ALLOCATE (col_indices_rec(ncol_rec))
1858 col_indices_rec = rec_col_row_info(1:ncol_rec, 2)
1860 ALLOCATE (rec_l(nrow_rec, ncol_rec))
1864 CALL para_env%sendrecv(local_l, proc_send_static, rec_l, proc_receive_static)
1867 DO jjb = 1, ncol_rec
1868 j_global = col_indices_rec(jjb)
1869 IF (j_global >= my_group_l_start .AND. j_global <= my_group_l_end)
THEN
1870 DO iib = 1, nrow_rec
1871 i_global = row_indices_rec(iib)
1872 my_lrows(i_global, j_global - my_group_l_start + 1) = rec_l(iib, jjb)
1877 local_col_row_info(:, :) = rec_col_row_info
1878 CALL move_alloc(rec_l, local_l)
1880 DEALLOCATE (col_indices_rec)
1881 DEALLOCATE (row_indices_rec)
1883 CALL timestop(handle2)
1885 DEALLOCATE (local_col_row_info)
1886 DEALLOCATE (rec_col_row_info)
1887 DEALLOCATE (local_l)
1889 CALL timestop(handle)
1891 END SUBROUTINE grep_lcols
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
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.
real(kind=dp) function, public plane_distance(h, k, l, cell)
Calculate the distance between two lattice planes as defined by a triple of Miller indices (hkl).
constants for the different operators of the 2c-integrals
integer, parameter, public operator_coulomb
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
subroutine, public cp_blacs_env_create(blacs_env, para_env, blacs_grid_layout, blacs_repeatable, row_major, grid_2d)
allocates and initializes a type that represent a blacs context
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...
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_cfm_to_fm(msource, mtargetr, mtargeti)
Copy real and imaginary parts of a complex full matrix into separate real-value full matrices.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_distribution_release(dist)
...
subroutine, public dbcsr_deallocate_matrix(matrix)
...
subroutine, public dbcsr_desymmetrize(matrix_a, matrix_b)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
subroutine, public dbcsr_reserve_all_blocks(matrix)
Reserves all blocks.
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_dist2d_to_dist(dist2d, dist)
Creates a DBCSR distribution from a distribution_2d.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
Interface to Minimax-Ewald method for periodic ERI's to be used in CP2K.
basic linear algebra operations for full matrices
subroutine, public cp_fm_column_scale(matrixa, scaling)
scales column i of matrix a with scaling(i)
subroutine, public cp_fm_triangular_invert(matrix_a, uplo_tr)
inverts a triangular matrix
various cholesky decomposition related routines
subroutine, public cp_fm_cholesky_decompose(matrix, n, info_out)
used to replace a symmetric positive def. matrix M with its cholesky decomposition U: M = U^T * U,...
used for collecting some of the diagonalization schemes available for cp_fm_type. cp_fm_power also mo...
subroutine, public cp_fm_power(matrix, work, exponent, threshold, n_dependent, verbose, eigvals)
...
subroutine, public choose_eigv_solver(matrix, eigenvectors, eigenvalues, info)
Choose the Eigensolver depending on which library is available ELPA seems to be unstable for small sy...
subroutine, public cp_fm_syevx(matrix, eigenvectors, eigenvalues, neig, work_syevx)
compute eigenvalues and optionally eigenvectors of a real symmetric matrix using scalapack....
represent the structure of a full matrix
subroutine, public cp_fm_struct_create(fmstruct, para_env, context, nrow_global, ncol_global, nrow_block, ncol_block, descriptor, first_p_pos, local_leading_dimension, template_fmstruct, square_blocks, force_block)
allocates and initializes a full matrix structure
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
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_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
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, use_sp)
creates a new full matrix with the given structure
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
Types to describe group distributions.
Defines the basic variable types.
integer, parameter, public dp
Routines to compute the Coulomb integral V_(alpha beta)(k) for a k-point k using lattice summation in...
subroutine, public build_2c_coulomb_matrix_kp(matrix_v_kp, kpoints, basis_type, cell, particle_set, qs_kind_set, atomic_kind_set, size_lattice_sum, operator_type, ikp_start, ikp_end)
...
Routines needed for kpoint calculation.
subroutine, public rskp_transform(rmatrix, cmatrix, rsmat, ispin, xkp, cell_to_index, sab_nl, is_complex, rs_sign)
Transformation of real space matrices to a kpoint.
subroutine, public kpoint_init_cell_index(kpoint, sab_nl, para_env, dft_control)
Generates the mapping of cell indices and linear RS index CELL (0,0,0) is always mapped to index 1.
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.
2- and 3-center electron repulsion integral routines based on libint2 Currently available operators: ...
pure logical function, public compare_potential_types(potential1, potential2)
Helper function to compare libint_potential_types.
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
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 2c- and 3c-integrals for RI with GPW.
subroutine, public mp2_eri_2c_integrate_gpw(qs_env, para_env_sub, my_group_l_start, my_group_l_end, natom, potential_parameter, sab_orb_sub, l_local_col, kind_of)
Integrates the potential of an RI function.
Interface to direct methods for electron repulsion integrals for MP2.
subroutine, public mp2_eri_2c_integrate(param, potential_parameter, para_env, qs_env, basis_type_a, basis_type_b, hab, first_b, last_b, eri_method, pab, force_a, force_b, hdab, hadb, reflection_z_a, reflection_z_b, do_reflection_a, do_reflection_b)
high-level integration routine for 2c integrals over CP2K basis sets. Contiguous column-wise distribu...
Framework for 2c-integrals for RI.
subroutine, public get_2c_integrals(qs_env, eri_method, eri_param, para_env, para_env_sub, mp2_memory, my_lrows, my_vrows, fm_matrix_pq, ngroup, color_sub, dimen_ri, dimen_ri_red, kpoints, my_group_l_size, my_group_l_start, my_group_l_end, gd_array, calc_pq_cond_num, do_svd, eps_svd, potential, ri_metric, fm_matrix_l_kpoints, fm_matrix_minv_l_kpoints, fm_matrix_minv, fm_matrix_minv_vtrunc_minv, do_im_time, do_kpoints, mp2_eps_pgf_orb_s, qs_kind_set, sab_orb_sub, calc_forces, unit_nr)
...
subroutine, public trunc_coulomb_for_exchange(qs_env, trunc_coulomb, rel_cutoff_trunc_coulomb_ri_x, cell_grid, do_bvk_cell)
...
subroutine, public inversion_of_m_and_mult_with_chol_dec_of_v(fm_matrix_minv_l_kpoints, fm_matrix_l_kpoints, dimen_ri, kpoints, eps_eigval_s)
...
subroutine, public ri_2c_integral_mat(qs_env, fm_matrix_minv_l_kpoints, fm_matrix_l, dimen_ri, ri_metric, do_kpoints, kpoints, put_mat_ks_env, regularization_ri, ikp_ext, do_build_cell_index)
...
Types needed for MP2 calculations.
basic linear algebra operations for full matrixes
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis)
Get the components of a particle set.
Define the data structure for the particle information.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
Some utility functions for the calculation of integrals.
subroutine, public basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
Set up an easy accessible list of the basis sets for all kinds.
Calculate the interaction radii for the operator matrix calculation.
subroutine, public init_interaction_radii(qs_control, qs_kind_set)
Initialize all the atomic kind radii for a given threshold value.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public release_neighbor_list_sets(nlists)
releases an array of neighbor_list_sets
Utility methods to build 3-center integral tensors of various types.
subroutine, public build_2c_integrals(t2c, filter_eps, qs_env, nl_2c, basis_i, basis_j, potential_parameter, do_kpoints, do_hfx_kpoints, ext_kpoints, regularization_ri)
...
subroutine, public build_2c_neighbor_lists(ij_list, basis_i, basis_j, potential_parameter, name, qs_env, sym_ij, molecular, dist_2d, pot_to_rad)
Build 2-center neighborlists adapted to different operators This mainly wraps build_neighbor_lists fo...
Auxiliary routines necessary to redistribute an fm_matrix from a given blacs_env to another.
subroutine, public communicate_buffer(para_env, num_entries_rec, num_entries_send, buffer_rec, buffer_send, req_array, do_indx, do_msg)
...
Routines treating GW and RPA calculations with kpoints.
subroutine, public cp_cfm_power(matrix, threshold, exponent, min_eigval)
...
Provides all information about an atomic kind.
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
distributes pairs on a 2d grid of processors
Contains information about kpoints.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.