(git:6344619)
Loading...
Searching...
No Matches
mp2_integrals.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Routines to calculate and distribute 2c- and 3c- integrals for RI
10!> \par History
11!> 06.2012 created [Mauro Del Ben]
12!> 03.2019 separated from mp2_ri_gpw [Frederick Stein]
13! **************************************************************************************************
15 USE omp_lib, ONLY: omp_get_num_threads,&
16 omp_get_thread_num
20 USE bibliography, ONLY: delben2013,&
21 cite_reference
22 USE cell_types, ONLY: cell_type,&
25 USE cp_cfm_types, ONLY: cp_cfm_type
27 USE cp_dbcsr_api, ONLY: &
29 dbcsr_release_p, dbcsr_set, dbcsr_type, dbcsr_type_no_symmetry
37 USE cp_fm_types, ONLY: cp_fm_create,&
43 USE dbt_api, ONLY: &
44 dbt_clear, dbt_contract, dbt_copy, dbt_create, dbt_destroy, dbt_distribution_destroy, &
45 dbt_distribution_new, dbt_distribution_type, dbt_filter, dbt_get_block, dbt_get_info, &
46 dbt_get_stored_coordinates, dbt_mp_environ_pgrid, dbt_pgrid_create, dbt_pgrid_destroy, &
47 dbt_pgrid_type, dbt_put_block, dbt_reserve_blocks, dbt_scale, dbt_split_blocks, dbt_type
51 USE hfx_types, ONLY: alloc_containers,&
54 USE input_constants, ONLY: &
61 USE kinds, ONLY: default_string_length,&
62 dp,&
63 int_8
65 USE kpoint_types, ONLY: kpoint_type
67 libint_potential_type
68 USE machine, ONLY: m_flush
69 USE message_passing, ONLY: mp_cart_type,&
73 USE mp2_eri_gpw, ONLY: cleanup_gpw,&
80 USE pw_env_types, ONLY: pw_env_type
83 USE pw_types, ONLY: pw_c1d_gs_type,&
104 USE util, ONLY: get_limit
105#include "./base/base_uses.f90"
106
107 IMPLICIT NONE
108
109 PRIVATE
110
111 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mp2_integrals'
112
114
115 TYPE intermediate_matrix_type
116 TYPE(dbcsr_type) :: matrix_ia_jnu, matrix_ia_jb
117 INTEGER :: max_row_col_local = 0
118 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: local_col_row_info
119 TYPE(cp_fm_type) :: fm_BIb_jb = cp_fm_type()
120 CHARACTER(LEN=default_string_length) :: descr = ""
121 END TYPE intermediate_matrix_type
122
123CONTAINS
124
125! **************************************************************************************************
126!> \brief with ri mp2 gpw
127!> \param BIb_C ...
128!> \param BIb_C_gw ...
129!> \param BIb_C_bse_ij ...
130!> \param BIb_C_bse_ab ...
131!> \param gd_array ...
132!> \param gd_B_virtual ...
133!> \param dimen_RI ...
134!> \param dimen_RI_red ...
135!> \param qs_env ...
136!> \param para_env ...
137!> \param para_env_sub ...
138!> \param color_sub ...
139!> \param cell ...
140!> \param particle_set ...
141!> \param atomic_kind_set ...
142!> \param qs_kind_set ...
143!> \param fm_matrix_PQ ...
144!> \param cfm_matrix_L_kpoints ...
145!> \param cfm_matrix_Minv_L_kpoints ...
146!> \param fm_matrix_Minv_L_gamma real Gamma-point factor used by the real-valued RPA path
147!> \param fm_matrix_Minv ...
148!> \param fm_matrix_Minv_Vtrunc_Minv ...
149!> \param nmo ...
150!> \param homo ...
151!> \param mat_munu ...
152!> \param sab_orb_sub ...
153!> \param mo_coeff_o ...
154!> \param mo_coeff_v ...
155!> \param mo_coeff_all ...
156!> \param mo_coeff_gw ...
157!> \param mo_coeff_o_bse ...
158!> \param mo_coeff_v_bse ...
159!> \param eps_filter ...
160!> \param unit_nr ...
161!> \param mp2_memory ...
162!> \param calc_PQ_cond_num ...
163!> \param calc_forces ...
164!> \param blacs_env_sub ...
165!> \param my_do_gw ...
166!> \param do_bse ...
167!> \param gd_B_all ...
168!> \param starts_array_mc ...
169!> \param ends_array_mc ...
170!> \param starts_array_mc_block ...
171!> \param ends_array_mc_block ...
172!> \param gw_corr_lev_occ ...
173!> \param gw_corr_lev_virt ...
174!> \param bse_lev_virt ...
175!> \param do_im_time ...
176!> \param do_kpoints_cubic_RPA ...
177!> \param kpoints ...
178!> \param t_3c_M ...
179!> \param t_3c_O ...
180!> \param t_3c_O_compressed ...
181!> \param t_3c_O_ind ...
182!> \param ri_metric ...
183!> \param gd_B_occ_bse ...
184!> \param gd_B_virt_bse ...
185!> \author Mauro Del Ben
186! **************************************************************************************************
187 SUBROUTINE mp2_ri_gpw_compute_in(BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, gd_array, gd_B_virtual, &
188 dimen_RI, dimen_RI_red, qs_env, para_env, para_env_sub, color_sub, &
189 cell, particle_set, atomic_kind_set, qs_kind_set, &
190 fm_matrix_PQ, cfm_matrix_L_kpoints, cfm_matrix_Minv_L_kpoints, fm_matrix_Minv_L_gamma, &
191 fm_matrix_Minv, fm_matrix_Minv_Vtrunc_Minv, &
192 nmo, homo, mat_munu, &
193 sab_orb_sub, mo_coeff_o, mo_coeff_v, mo_coeff_all, &
194 mo_coeff_gw, mo_coeff_o_bse, mo_coeff_v_bse, eps_filter, unit_nr, &
195 mp2_memory, calc_PQ_cond_num, calc_forces, blacs_env_sub, my_do_gw, do_bse, &
196 gd_B_all, starts_array_mc, ends_array_mc, &
197 starts_array_mc_block, ends_array_mc_block, &
198 gw_corr_lev_occ, gw_corr_lev_virt, &
199 bse_lev_virt, &
200 do_im_time, do_kpoints_cubic_RPA, kpoints, &
201 t_3c_M, t_3c_O, t_3c_O_compressed, t_3c_O_ind, &
202 ri_metric, gd_B_occ_bse, gd_B_virt_bse)
203
204 TYPE(three_dim_real_array), ALLOCATABLE, &
205 DIMENSION(:), INTENT(OUT) :: bib_c, bib_c_gw, bib_c_bse_ij, &
206 bib_c_bse_ab
207 TYPE(group_dist_d1_type), INTENT(OUT) :: gd_array
208 TYPE(group_dist_d1_type), ALLOCATABLE, &
209 DIMENSION(:), INTENT(OUT) :: gd_b_virtual
210 INTEGER, INTENT(OUT) :: dimen_ri, dimen_ri_red
211 TYPE(qs_environment_type), POINTER :: qs_env
212 TYPE(mp_para_env_type), POINTER :: para_env, para_env_sub
213 INTEGER, INTENT(IN) :: color_sub
214 TYPE(cell_type), POINTER :: cell
215 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
216 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
217 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
218 TYPE(cp_fm_type), INTENT(OUT) :: fm_matrix_pq
219 TYPE(cp_cfm_type), ALLOCATABLE, DIMENSION(:) :: cfm_matrix_l_kpoints, &
220 cfm_matrix_minv_l_kpoints
221 TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:, :) :: fm_matrix_minv_l_gamma, fm_matrix_minv, &
222 fm_matrix_minv_vtrunc_minv
223 INTEGER, INTENT(IN) :: nmo
224 INTEGER, DIMENSION(:), INTENT(IN) :: homo
225 TYPE(dbcsr_p_type), INTENT(INOUT) :: mat_munu
226 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
227 INTENT(IN), POINTER :: sab_orb_sub
228 TYPE(dbcsr_p_type), DIMENSION(:), INTENT(IN) :: mo_coeff_o, mo_coeff_v, mo_coeff_all, &
229 mo_coeff_gw, mo_coeff_o_bse, &
230 mo_coeff_v_bse
231 REAL(kind=dp), INTENT(IN) :: eps_filter
232 INTEGER, INTENT(IN) :: unit_nr
233 REAL(kind=dp), INTENT(IN) :: mp2_memory
234 LOGICAL, INTENT(IN) :: calc_pq_cond_num, calc_forces
235 TYPE(cp_blacs_env_type), POINTER :: blacs_env_sub
236 LOGICAL, INTENT(IN) :: my_do_gw, do_bse
237 TYPE(group_dist_d1_type), INTENT(OUT) :: gd_b_all
238 INTEGER, ALLOCATABLE, DIMENSION(:), INTENT(OUT) :: starts_array_mc, ends_array_mc, &
239 starts_array_mc_block, &
240 ends_array_mc_block
241 INTEGER, INTENT(IN) :: gw_corr_lev_occ, gw_corr_lev_virt
242 INTEGER, DIMENSION(:), INTENT(IN) :: bse_lev_virt
243 LOGICAL, INTENT(IN) :: do_im_time, do_kpoints_cubic_rpa
244 TYPE(kpoint_type), POINTER :: kpoints
245 TYPE(dbt_type), INTENT(OUT) :: t_3c_m
246 TYPE(dbt_type), ALLOCATABLE, DIMENSION(:, :), &
247 INTENT(OUT) :: t_3c_o
248 TYPE(hfx_compression_type), ALLOCATABLE, &
249 DIMENSION(:, :, :), INTENT(INOUT) :: t_3c_o_compressed
250 TYPE(block_ind_type), ALLOCATABLE, &
251 DIMENSION(:, :, :) :: t_3c_o_ind
252 TYPE(libint_potential_type), INTENT(IN) :: ri_metric
253 TYPE(group_dist_d1_type), ALLOCATABLE, &
254 DIMENSION(:), INTENT(OUT) :: gd_b_occ_bse, gd_b_virt_bse
255
256 CHARACTER(LEN=*), PARAMETER :: routinen = 'mp2_ri_gpw_compute_in'
257
258 INTEGER :: cm, cut_memory, cut_memory_int, eri_method, gw_corr_lev_total, handle, handle2, &
259 handle4, i, i_counter, i_mem, ibasis, ispin, itmp(2), j, jcell, kcell, lll, min_bsize, &
260 my_b_all_end, my_b_all_size, my_b_all_start, my_group_l_end, my_group_l_size, &
261 my_group_l_start, n_rep, natom, ngroup, nimg, nkind, nspins, potential_type, &
262 ri_metric_type
263 INTEGER(int_8) :: nze
264 INTEGER, ALLOCATABLE, DIMENSION(:) :: dist_ao_1, dist_ao_2, dist_ri, &
265 ends_array_mc_block_int, ends_array_mc_int, my_b_occ_bse_end, my_b_occ_bse_size, &
266 my_b_occ_bse_start, my_b_size, my_b_virt_bse_end, my_b_virt_bse_size, &
267 my_b_virt_bse_start, my_b_virtual_end, my_b_virtual_start, sizes_ao, sizes_ao_split, &
268 sizes_ri, sizes_ri_split, starts_array_mc_block_int, starts_array_mc_int, virtual
269 INTEGER, DIMENSION(2, 3) :: bounds
270 INTEGER, DIMENSION(3) :: bounds_3c, pcoord, pdims, pdims_t3c, &
271 periodic
272 LOGICAL :: do_gpw, do_kpoints_from_gamma, do_svd, &
273 memory_info
274 REAL(kind=dp) :: compression_factor, cutoff_old, eps_pgf_orb, eps_pgf_orb_old, eps_svd, &
275 mem_for_abk, mem_for_iak, mem_for_ijk, memory_3c, occ, omega_pot, rc_ang, &
276 relative_cutoff_old
277 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: e_cutoff_old
278 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: my_lrows, my_vrows
279 TYPE(cp_eri_mme_param), POINTER :: eri_param
280 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: mat_munu_local_l
281 TYPE(dbt_pgrid_type) :: pgrid_t3c_m, pgrid_t3c_overl
282 TYPE(dbt_type) :: t_3c_overl_int_template, t_3c_tmp
283 TYPE(dbt_type), ALLOCATABLE, DIMENSION(:, :) :: t_3c_overl_int
284 TYPE(dft_control_type), POINTER :: dft_control
285 TYPE(distribution_3d_type) :: dist_3d
286 TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: basis_set_ao, basis_set_ri_aux
287 TYPE(gto_basis_set_type), POINTER :: orb_basis, ri_basis
288 TYPE(intermediate_matrix_type), ALLOCATABLE, &
289 DIMENSION(:) :: intermed_mat, intermed_mat_bse_ab, &
290 intermed_mat_bse_ij, intermed_mat_gw
291 TYPE(mp_cart_type) :: mp_comm_t3c_2
292 TYPE(neighbor_list_3c_type) :: nl_3c
293 TYPE(pw_c1d_gs_type) :: pot_g, rho_g
294 TYPE(pw_env_type), POINTER :: pw_env_sub
295 TYPE(pw_poisson_type), POINTER :: poisson_env
296 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
297 TYPE(pw_r3d_rs_type) :: psi_l, rho_r
298 TYPE(section_vals_type), POINTER :: qs_section
299 TYPE(task_list_type), POINTER :: task_list_sub
300
301 CALL timeset(routinen, handle)
302
303 CALL cite_reference(delben2013)
304
305 nspins = SIZE(homo)
306
307 ALLOCATE (virtual(nspins))
308 virtual(:) = nmo - homo(:)
309 gw_corr_lev_total = gw_corr_lev_virt + gw_corr_lev_occ
310
311 eri_method = qs_env%mp2_env%eri_method
312 eri_param => qs_env%mp2_env%eri_mme_param
313 do_svd = qs_env%mp2_env%do_svd
314 eps_svd = qs_env%mp2_env%eps_svd
315 potential_type = qs_env%mp2_env%potential_parameter%potential_type
316 ri_metric_type = ri_metric%potential_type
317 omega_pot = qs_env%mp2_env%potential_parameter%omega
318
319 ! whether we need gpw integrals (plus pw stuff)
320 do_gpw = (eri_method == do_eri_gpw) .OR. &
321 ((potential_type == do_potential_long .OR. ri_metric_type == do_potential_long) &
322 .AND. qs_env%mp2_env%eri_method == do_eri_os) &
323 .OR. (ri_metric_type == do_potential_id .AND. qs_env%mp2_env%eri_method == do_eri_mme)
324
325 IF (do_svd .AND. calc_forces) THEN
326 cpabort("SVD not implemented for forces.!")
327 END IF
328
329 do_kpoints_from_gamma = qs_env%mp2_env%ri_rpa_im_time%do_kpoints_from_Gamma
330 IF (do_kpoints_cubic_rpa .OR. do_kpoints_from_gamma) THEN
331 CALL get_qs_env(qs_env=qs_env, &
332 kpoints=kpoints)
333 END IF
334 IF (do_kpoints_from_gamma) THEN
335 CALL compute_kpoints(qs_env, kpoints, unit_nr)
336 END IF
337
338 IF (do_bse) THEN
339 IF (.NOT. my_do_gw) THEN
340 CALL cp_abort(__location__, "BSE calculations require prior GW calculations.")
341 END IF
342 IF (do_im_time) THEN
343 CALL cp_abort(__location__, "BSE calculations are not implemented for low-scaling GW.")
344 END IF
345 ! GPW integrals have to be implemented later
346 IF (eri_method == do_eri_gpw) THEN
347 CALL cp_abort(__location__, &
348 "BSE calculations are not implemented for GPW integrals. "// &
349 "This is probably caused by invoking a periodic calculation. "// &
350 "Use PERIODIC NONE for BSE calculations.")
351 END IF
352 END IF
353
354 ngroup = para_env%num_pe/para_env_sub%num_pe
355
356 ! Preparations for MME method to compute ERIs
357 IF (qs_env%mp2_env%eri_method == do_eri_mme) THEN
358 ! cell might have changed, so we need to reset parameters
359 CALL cp_eri_mme_set_params(eri_param, cell, qs_kind_set, basis_type_1="ORB", basis_type_2="RI_AUX", para_env=para_env)
360 END IF
361
362 CALL get_cell(cell=cell, periodic=periodic)
363 ! for minimax Ewald summation, full periodicity is required
364 IF (eri_method == do_eri_mme) THEN
365 cpassert(periodic(1) == 1 .AND. periodic(2) == 1 .AND. periodic(3) == 1)
366 END IF
367
368 IF (do_svd .AND. (do_kpoints_from_gamma .OR. do_kpoints_cubic_rpa)) THEN
369 cpabort("SVD with kpoints not implemented yet!")
370 END IF
371
372 CALL get_2c_integrals(qs_env, eri_method, eri_param, para_env, para_env_sub, mp2_memory, &
373 my_lrows, my_vrows, fm_matrix_pq, ngroup, color_sub, dimen_ri, dimen_ri_red, &
374 kpoints, my_group_l_size, my_group_l_start, my_group_l_end, &
375 gd_array, calc_pq_cond_num .AND. .NOT. do_svd, do_svd, eps_svd, &
376 qs_env%mp2_env%potential_parameter, ri_metric, &
377 cfm_matrix_l_kpoints, cfm_matrix_minv_l_kpoints, fm_matrix_minv_l_gamma, &
378 fm_matrix_minv, fm_matrix_minv_vtrunc_minv, &
379 do_im_time, do_kpoints_from_gamma .OR. do_kpoints_cubic_rpa, qs_env%mp2_env%mp2_gpw%eps_pgf_orb_S, &
380 qs_kind_set, sab_orb_sub, calc_forces, unit_nr)
381
382 IF (unit_nr > 0) THEN
383 associate(ri_metric => qs_env%mp2_env%ri_metric)
384 SELECT CASE (ri_metric%potential_type)
386 WRITE (unit_nr, fmt="(/T3,A,T74,A)") &
387 "RI_INFO| RI metric: ", "COULOMB"
388 CASE (do_potential_short)
389 WRITE (unit_nr, fmt="(T3,A,T71,A)") &
390 "RI_INFO| RI metric: ", "SHORTRANGE"
391 WRITE (unit_nr, '(T3,A,T61,F20.10)') &
392 "RI_INFO| Omega: ", ri_metric%omega
393 rc_ang = cp_unit_from_cp2k(ri_metric%cutoff_radius, "angstrom")
394 WRITE (unit_nr, '(T3,A,T61,F20.10)') &
395 "RI_INFO| Cutoff Radius [angstrom]: ", rc_ang
396 CASE (do_potential_long)
397 WRITE (unit_nr, fmt="(T3,A,T72,A)") &
398 "RI_INFO| RI metric: ", "LONGRANGE"
399 WRITE (unit_nr, '(T3,A,T61,F20.10)') &
400 "RI_INFO| Omega: ", ri_metric%omega
401 CASE (do_potential_id)
402 WRITE (unit_nr, fmt="(T3,A,T74,A)") &
403 "RI_INFO| RI metric: ", "OVERLAP"
405 WRITE (unit_nr, fmt="(T3,A,T64,A)") &
406 "RI_INFO| RI metric: ", "TRUNCATED COULOMB"
407 rc_ang = cp_unit_from_cp2k(ri_metric%cutoff_radius, "angstrom")
408 WRITE (unit_nr, '(T3,A,T61,F20.2)') &
409 "RI_INFO| Cutoff Radius [angstrom]: ", rc_ang
410 END SELECT
411 END associate
412 END IF
413
414 IF (calc_forces .AND. .NOT. do_im_time) THEN
415 ! we need (P|Q)^(-1/2) for future use, just save it
416 ! in a fully (home made) distributed way
417 itmp = get_limit(dimen_ri, para_env_sub%num_pe, para_env_sub%mepos)
418 lll = itmp(2) - itmp(1) + 1
419 ALLOCATE (qs_env%mp2_env%ri_grad%PQ_half(lll, my_group_l_size))
420 qs_env%mp2_env%ri_grad%PQ_half(:, :) = my_lrows(itmp(1):itmp(2), 1:my_group_l_size)
421 IF (.NOT. compare_potential_types(qs_env%mp2_env%ri_metric, qs_env%mp2_env%potential_parameter)) THEN
422 ALLOCATE (qs_env%mp2_env%ri_grad%operator_half(lll, my_group_l_size))
423 qs_env%mp2_env%ri_grad%operator_half(:, :) = my_vrows(itmp(1):itmp(2), 1:my_group_l_size)
424 DEALLOCATE (my_vrows)
425 END IF
426 END IF
427
428 IF (unit_nr > 0) THEN
429 WRITE (unit=unit_nr, fmt="(T3,A,T75,i6)") &
430 "RI_INFO| Number of auxiliary basis functions:", dimen_ri, &
431 "GENERAL_INFO| Number of basis functions:", nmo, &
432 "GENERAL_INFO| Number of occupied orbitals:", homo(1), &
433 "GENERAL_INFO| Number of virtual orbitals:", virtual(1)
434 IF (do_svd) THEN
435 WRITE (unit=unit_nr, fmt="(T3,A,T75,i6)") &
436 "RI_INFO| Reduced auxiliary basis set size:", dimen_ri_red
437 END IF
438
439 mem_for_iak = dimen_ri*real(sum(homo*virtual), kind=dp)*8.0_dp/(1024_dp**2)
440 mem_for_ijk = dimen_ri*real(sum(homo(1:nspins)**2), kind=dp)*8.0_dp/(1024_dp**2)
441 mem_for_abk = dimen_ri*real(sum(bse_lev_virt(1:nspins)**2), kind=dp)*8.0_dp/(1024_dp**2)
442
443 IF (.NOT. do_im_time) THEN
444 WRITE (unit_nr, '(T3,A,T66,F11.2,A4)') 'RI_INFO| Total memory for (ia|K) integrals:', &
445 mem_for_iak, ' MiB'
446 IF (my_do_gw .AND. .NOT. do_im_time) THEN
447 mem_for_iak = dimen_ri*real(nmo, kind=dp)*gw_corr_lev_total*8.0_dp/(1024_dp**2)
448
449 WRITE (unit_nr, '(T3,A,T66,F11.2,A4)') 'RI_INFO| Total memory for G0W0-(nm|K) integrals:', &
450 mem_for_iak, ' MiB'
451 END IF
452 END IF
453 IF (do_bse) THEN
454 WRITE (unit_nr, '(T3,A,T66,F11.2,A4)') 'RI_INFO| Total memory for (ij|K) integrals:', &
455 mem_for_ijk, ' MiB'
456 WRITE (unit_nr, '(T3,A,T66,F11.2,A4)') 'RI_INFO| Total memory for (ab|K) integrals:', &
457 mem_for_abk, ' MiB'
458 END IF
459 CALL m_flush(unit_nr)
460 END IF
461
462 CALL para_env%sync() ! sync to see memory output
463
464 ! in case we do imaginary time, we need the overlap tensor (alpha beta P) or trunc. Coulomb tensor
465 IF (.NOT. do_im_time) THEN
466
467 ALLOCATE (gd_b_virtual(nspins), intermed_mat(nspins))
468 ALLOCATE (my_b_virtual_start(nspins), my_b_virtual_end(nspins), my_b_size(nspins))
469 DO ispin = 1, nspins
470
471 CALL create_intermediate_matrices(intermed_mat(ispin), mo_coeff_o(ispin)%matrix, virtual(ispin), homo(ispin), &
472 trim(adjustl(cp_to_string(ispin))), blacs_env_sub, para_env_sub)
473
474 CALL create_group_dist(gd_b_virtual(ispin), para_env_sub%num_pe, virtual(ispin))
475 CALL get_group_dist(gd_b_virtual(ispin), para_env_sub%mepos, my_b_virtual_start(ispin), my_b_virtual_end(ispin), &
476 my_b_size(ispin))
477
478 END DO
479
480 ! in the case of G0W0, we need (K|nm), n,m may be occ or virt (m restricted to corrected levels)
481 IF (my_do_gw) THEN
482
483 ALLOCATE (intermed_mat_gw(nspins))
484 DO ispin = 1, nspins
485 CALL create_intermediate_matrices(intermed_mat_gw(ispin), mo_coeff_gw(ispin)%matrix, &
486 nmo, gw_corr_lev_total, &
487 "gw_"//trim(adjustl(cp_to_string(ispin))), &
488 blacs_env_sub, para_env_sub)
489
490 END DO
491
492 CALL create_group_dist(gd_b_all, para_env_sub%num_pe, nmo)
493 CALL get_group_dist(gd_b_all, para_env_sub%mepos, my_b_all_start, my_b_all_end, my_b_all_size)
494
495 IF (do_bse) THEN
496 ! virt x virt slab size bse_lev_virt(ispin) is per-spin, so gd_B_virt_bse is an array;
497 ! the occupied count homo(ispin) is per-spin, so gd_B_occ_bse and the bse intermediates are arrays
498 ALLOCATE (intermed_mat_bse_ab(nspins), intermed_mat_bse_ij(nspins), gd_b_occ_bse(nspins), gd_b_virt_bse(nspins))
499 ALLOCATE (my_b_occ_bse_start(nspins), my_b_occ_bse_end(nspins), my_b_occ_bse_size(nspins))
500 ALLOCATE (my_b_virt_bse_start(nspins), my_b_virt_bse_end(nspins), my_b_virt_bse_size(nspins))
501 DO ispin = 1, nspins
502 CALL create_group_dist(gd_b_virt_bse(ispin), para_env_sub%num_pe, bse_lev_virt(ispin))
503 CALL get_group_dist(gd_b_virt_bse(ispin), para_env_sub%mepos, my_b_virt_bse_start(ispin), &
504 my_b_virt_bse_end(ispin), my_b_virt_bse_size(ispin))
505 ! virt x virt matrices
506 CALL create_intermediate_matrices(intermed_mat_bse_ab(ispin), mo_coeff_v_bse(ispin)%matrix, &
507 bse_lev_virt(ispin), bse_lev_virt(ispin), &
508 "bse_ab_"//trim(adjustl(cp_to_string(ispin))), blacs_env_sub, para_env_sub)
509
510 ! occ x occ matrices
511 ! We do not implement bse_lev_occ here, because the small number of occupied levels
512 ! does not critically influence the memory
513 CALL create_intermediate_matrices(intermed_mat_bse_ij(ispin), mo_coeff_o_bse(ispin)%matrix, &
514 homo(ispin), homo(ispin), &
515 "bse_ij_"//trim(adjustl(cp_to_string(ispin))), blacs_env_sub, para_env_sub)
516
517 CALL create_group_dist(gd_b_occ_bse(ispin), para_env_sub%num_pe, homo(ispin))
518 CALL get_group_dist(gd_b_occ_bse(ispin), para_env_sub%mepos, my_b_occ_bse_start(ispin), &
519 my_b_occ_bse_end(ispin), my_b_occ_bse_size(ispin))
520 END DO
521
522 END IF
523 END IF
524
525 ! array that will store the (ia|K) integrals
526 ALLOCATE (bib_c(nspins))
527 DO ispin = 1, nspins
528 ALLOCATE (bib_c(ispin)%array(my_group_l_size, my_b_size(ispin), homo(ispin)))
529 bib_c(ispin)%array = 0.0_dp
530 END DO
531
532 ! in the case of GW, we also need (nm|K)
533 IF (my_do_gw) THEN
534
535 ALLOCATE (bib_c_gw(nspins))
536 DO ispin = 1, nspins
537 ALLOCATE (bib_c_gw(ispin)%array(my_group_l_size, my_b_all_size, gw_corr_lev_total))
538 bib_c_gw(ispin)%array = 0.0_dp
539 END DO
540
541 END IF
542
543 IF (do_bse) THEN
544
545 ALLOCATE (bib_c_bse_ij(nspins), bib_c_bse_ab(nspins))
546 DO ispin = 1, nspins
547 ALLOCATE (bib_c_bse_ij(ispin)%array(my_group_l_size, my_b_occ_bse_size(ispin), homo(ispin)))
548 bib_c_bse_ij(ispin)%array = 0.0_dp
549
550 ALLOCATE (bib_c_bse_ab(ispin)%array(my_group_l_size, my_b_virt_bse_size(ispin), bse_lev_virt(ispin)))
551 bib_c_bse_ab(ispin)%array = 0.0_dp
552 END DO
553
554 END IF
555
556 CALL timeset(routinen//"_loop", handle2)
557
558 IF (eri_method == do_eri_mme .AND. &
559 (ri_metric%potential_type == do_potential_coulomb .OR. ri_metric%potential_type == do_potential_long) .OR. &
560 eri_method == do_eri_os .AND. ri_metric%potential_type == do_potential_coulomb) THEN
561
562 ! Add a warning for automatically generated RI_AUX basis sets
563 ! Tend to be not sufficiently converged
564 IF (qs_env%mp2_env%ri_aux_auto_generated) THEN
565 CALL cp_warn(__location__, &
566 "At least one RI_AUX basis set was not explicitly invoked in &KIND-section. "// &
567 "Automatically RI-basis sets and ERI_METHOD OS tend to be not converged. "// &
568 "Consider specifying BASIS_SET RI_AUX explicitly with a sufficiently large basis.")
569 END IF
570
571 NULLIFY (mat_munu_local_l)
572 ALLOCATE (mat_munu_local_l(my_group_l_size))
573 DO lll = 1, my_group_l_size
574 NULLIFY (mat_munu_local_l(lll)%matrix)
575 ALLOCATE (mat_munu_local_l(lll)%matrix)
576 CALL dbcsr_copy(mat_munu_local_l(lll)%matrix, mat_munu%matrix)
577 CALL dbcsr_set(mat_munu_local_l(lll)%matrix, 0.0_dp)
578 END DO
579 CALL mp2_eri_3c_integrate(eri_param, ri_metric, para_env_sub, qs_env, &
580 first_c=my_group_l_start, last_c=my_group_l_end, &
581 mat_ab=mat_munu_local_l, &
582 basis_type_a="ORB", basis_type_b="ORB", &
583 basis_type_c="RI_AUX", &
584 sab_nl=sab_orb_sub, eri_method=eri_method)
585
586 DO ispin = 1, nspins
587 DO lll = 1, my_group_l_size
588 CALL ao_to_mo_and_store_b(para_env_sub, mat_munu_local_l(lll), intermed_mat(ispin), &
589 bib_c(ispin)%array(lll, :, :), &
590 mo_coeff_o(ispin)%matrix, mo_coeff_v(ispin)%matrix, &
591 eps_filter, &
592 my_b_virtual_end(ispin), my_b_virtual_start(ispin))
593 END DO
594 CALL contract_b_l(bib_c(ispin)%array, my_lrows, gd_b_virtual(ispin)%sizes, &
595 gd_array%sizes, qs_env%mp2_env%eri_blksize, &
596 ngroup, color_sub, para_env, para_env_sub)
597 END DO
598
599 IF (my_do_gw) THEN
600
601 DO ispin = 1, nspins
602 DO lll = 1, my_group_l_size
603 CALL ao_to_mo_and_store_b(para_env_sub, mat_munu_local_l(lll), intermed_mat_gw(ispin), &
604 bib_c_gw(ispin)%array(lll, :, :), &
605 mo_coeff_gw(ispin)%matrix, mo_coeff_all(ispin)%matrix, eps_filter, &
606 my_b_all_end, my_b_all_start)
607 END DO
608 CALL contract_b_l(bib_c_gw(ispin)%array, my_lrows, gd_b_all%sizes, gd_array%sizes, qs_env%mp2_env%eri_blksize, &
609 ngroup, color_sub, para_env, para_env_sub)
610 END DO
611 END IF
612
613 IF (do_bse) THEN
614
615 DO ispin = 1, nspins
616 ! B^ab_P matrix elements for BSE
617 DO lll = 1, my_group_l_size
618 CALL ao_to_mo_and_store_b(para_env_sub, mat_munu_local_l(lll), intermed_mat_bse_ab(ispin), &
619 bib_c_bse_ab(ispin)%array(lll, :, :), &
620 mo_coeff_v_bse(ispin)%matrix, mo_coeff_v_bse(ispin)%matrix, eps_filter, &
621 my_b_all_end, my_b_all_start)
622 END DO
623 CALL contract_b_l(bib_c_bse_ab(ispin)%array, my_lrows, gd_b_virt_bse(ispin)%sizes, gd_array%sizes, &
624 qs_env%mp2_env%eri_blksize, ngroup, color_sub, para_env, para_env_sub)
625
626 ! B^ij_P matrix elements for BSE
627 DO lll = 1, my_group_l_size
628 CALL ao_to_mo_and_store_b(para_env_sub, mat_munu_local_l(lll), intermed_mat_bse_ij(ispin), &
629 bib_c_bse_ij(ispin)%array(lll, :, :), &
630 mo_coeff_o(ispin)%matrix, mo_coeff_o(ispin)%matrix, eps_filter, &
631 my_b_occ_bse_end(ispin), my_b_occ_bse_start(ispin))
632 END DO
633 CALL contract_b_l(bib_c_bse_ij(ispin)%array, my_lrows, gd_b_occ_bse(ispin)%sizes, gd_array%sizes, &
634 qs_env%mp2_env%eri_blksize, ngroup, color_sub, para_env, para_env_sub)
635 END DO
636
637 END IF
638
639 DO lll = 1, my_group_l_size
640 CALL dbcsr_release_p(mat_munu_local_l(lll)%matrix)
641 END DO
642 DEALLOCATE (mat_munu_local_l)
643
644 ELSE IF (do_gpw) THEN
645
646 CALL prepare_gpw(qs_env, dft_control, e_cutoff_old, cutoff_old, relative_cutoff_old, para_env_sub, pw_env_sub, &
647 auxbas_pw_pool, poisson_env, task_list_sub, rho_r, rho_g, pot_g, psi_l, sab_orb_sub)
648
649 DO i_counter = 1, my_group_l_size
650
651 CALL mp2_eri_3c_integrate_gpw(psi_l, rho_g, atomic_kind_set, qs_kind_set, cell, dft_control, &
652 particle_set, pw_env_sub, my_lrows(:, i_counter), poisson_env, rho_r, pot_g, &
653 ri_metric, mat_munu, qs_env, task_list_sub)
654
655 DO ispin = 1, nspins
656 CALL ao_to_mo_and_store_b(para_env_sub, mat_munu, intermed_mat(ispin), &
657 bib_c(ispin)%array(i_counter, :, :), &
658 mo_coeff_o(ispin)%matrix, mo_coeff_v(ispin)%matrix, eps_filter, &
659 my_b_virtual_end(ispin), my_b_virtual_start(ispin))
660
661 END DO
662
663 IF (my_do_gw) THEN
664 ! transform (K|mu nu) to (K|nm), n corresponds to corrected GW levels, m is in nmo
665 DO ispin = 1, nspins
666 CALL ao_to_mo_and_store_b(para_env_sub, mat_munu, intermed_mat_gw(ispin), &
667 bib_c_gw(ispin)%array(i_counter, :, :), &
668 mo_coeff_gw(ispin)%matrix, mo_coeff_all(ispin)%matrix, eps_filter, &
669 my_b_all_end, my_b_all_start)
670
671 END DO
672 END IF
673
674 END DO
675
676 CALL cleanup_gpw(qs_env, e_cutoff_old, cutoff_old, relative_cutoff_old, para_env_sub, pw_env_sub, &
677 task_list_sub, auxbas_pw_pool, rho_r, rho_g, pot_g, psi_l)
678 ELSE
679 cpabort("Integration method not implemented!")
680 END IF
681
682 CALL timestop(handle2)
683
684 DEALLOCATE (my_lrows)
685
686 DO ispin = 1, nspins
687 CALL release_intermediate_matrices(intermed_mat(ispin))
688 END DO
689 DEALLOCATE (intermed_mat)
690
691 IF (my_do_gw) THEN
692 DO ispin = 1, nspins
693 CALL release_intermediate_matrices(intermed_mat_gw(ispin))
694 END DO
695 DEALLOCATE (intermed_mat_gw)
696 END IF
697
698 IF (do_bse) THEN
699 DO ispin = 1, nspins
700 CALL release_intermediate_matrices(intermed_mat_bse_ab(ispin))
701 CALL release_intermediate_matrices(intermed_mat_bse_ij(ispin))
702 END DO
703 DEALLOCATE (intermed_mat_bse_ab, intermed_mat_bse_ij)
704 END IF
705
706 ! imag. time = low-scaling SOS-MP2, RPA, GW
707 ELSE
708
709 memory_info = qs_env%mp2_env%ri_rpa_im_time%memory_info
710
711 ! we need 3 tensors:
712 ! 1) t_3c_overl_int: 3c overlap integrals, optimized for easy access to integral blocks
713 ! (atomic blocks)
714 ! 2) t_3c_O: 3c overlap integrals, optimized for contraction (split blocks)
715 ! 3) t_3c_M: tensor M, optimized for contraction
716
717 CALL get_qs_env(qs_env, natom=natom, nkind=nkind, dft_control=dft_control)
718
719 pdims_t3c = 0
720 CALL dbt_pgrid_create(para_env, pdims_t3c, pgrid_t3c_overl)
721
722 ! set up basis
723 ALLOCATE (sizes_ri(natom), sizes_ao(natom))
724 ALLOCATE (basis_set_ri_aux(nkind), basis_set_ao(nkind))
725 CALL basis_set_list_setup(basis_set_ri_aux, "RI_AUX", qs_kind_set)
726 CALL get_particle_set(particle_set, qs_kind_set, nsgf=sizes_ri, basis=basis_set_ri_aux)
727 CALL basis_set_list_setup(basis_set_ao, "ORB", qs_kind_set)
728 CALL get_particle_set(particle_set, qs_kind_set, nsgf=sizes_ao, basis=basis_set_ao)
729
730 ! make sure we use the QS%EPS_PGF_ORB
731 qs_section => section_vals_get_subs_vals(qs_env%input, "DFT%QS")
732 CALL section_vals_val_get(qs_section, "EPS_PGF_ORB", n_rep_val=n_rep)
733 IF (n_rep /= 0) THEN
734 CALL section_vals_val_get(qs_section, "EPS_PGF_ORB", r_val=eps_pgf_orb)
735 ELSE
736 CALL section_vals_val_get(qs_section, "EPS_DEFAULT", r_val=eps_pgf_orb)
737 eps_pgf_orb = sqrt(eps_pgf_orb)
738 END IF
739 eps_pgf_orb_old = dft_control%qs_control%eps_pgf_orb
740
741 DO ibasis = 1, SIZE(basis_set_ao)
742 orb_basis => basis_set_ao(ibasis)%gto_basis_set
743 CALL init_interaction_radii_orb_basis(orb_basis, eps_pgf_orb)
744 ri_basis => basis_set_ri_aux(ibasis)%gto_basis_set
745 CALL init_interaction_radii_orb_basis(ri_basis, eps_pgf_orb)
746 END DO
747
748 cut_memory_int = qs_env%mp2_env%ri_rpa_im_time%cut_memory
749 CALL create_tensor_batches(sizes_ri, cut_memory_int, starts_array_mc_int, ends_array_mc_int, &
750 starts_array_mc_block_int, ends_array_mc_block_int)
751
752 DEALLOCATE (starts_array_mc_int, ends_array_mc_int)
753
754 CALL create_3c_tensor(t_3c_overl_int_template, dist_ri, dist_ao_1, dist_ao_2, pgrid_t3c_overl, &
755 sizes_ri, sizes_ao, sizes_ao, map1=[1, 2], map2=[3], &
756 name="O (RI AO | AO)")
757
758 CALL get_qs_env(qs_env, nkind=nkind, particle_set=particle_set)
759 CALL dbt_mp_environ_pgrid(pgrid_t3c_overl, pdims, pcoord)
760 CALL mp_comm_t3c_2%create(pgrid_t3c_overl%mp_comm_2d, 3, pdims)
761 CALL distribution_3d_create(dist_3d, dist_ri, dist_ao_1, dist_ao_2, &
762 nkind, particle_set, mp_comm_t3c_2, own_comm=.true.)
763 DEALLOCATE (dist_ri, dist_ao_1, dist_ao_2)
764
765 CALL build_3c_neighbor_lists(nl_3c, basis_set_ri_aux, basis_set_ao, basis_set_ao, &
766 dist_3d, ri_metric, "RPA_3c_nl", qs_env, &
767 sym_jk=.NOT. do_kpoints_cubic_rpa, own_dist=.true.)
768
769 ! init k points
770 IF (do_kpoints_cubic_rpa) THEN
771 ! set up new kpoint type with periodic images according to eps_grid from MP2 section
772 ! instead of eps_pgf_orb from QS section
773 CALL kpoint_init_cell_index(kpoints, nl_3c%jk_list, para_env, dft_control%nimages)
774 IF (unit_nr > 0) WRITE (unit=unit_nr, fmt="(T3,A,T75,i6)") &
775 "3C_OVERLAP_INTEGRALS_INFO| Number of periodic images considered:", dft_control%nimages
776
777 nimg = dft_control%nimages
778 ELSE
779 nimg = 1
780 END IF
781
782 ALLOCATE (t_3c_overl_int(nimg, nimg))
783
784 DO i = 1, SIZE(t_3c_overl_int, 1)
785 DO j = 1, SIZE(t_3c_overl_int, 2)
786 CALL dbt_create(t_3c_overl_int_template, t_3c_overl_int(i, j))
787 END DO
788 END DO
789
790 CALL dbt_destroy(t_3c_overl_int_template)
791
792 ! split blocks to improve load balancing for tensor contraction
793 min_bsize = qs_env%mp2_env%ri_rpa_im_time%min_bsize
794
795 CALL pgf_block_sizes(atomic_kind_set, basis_set_ao, min_bsize, sizes_ao_split)
796 CALL pgf_block_sizes(atomic_kind_set, basis_set_ri_aux, min_bsize, sizes_ri_split)
797
798 pdims_t3c = 0
799 CALL dbt_pgrid_create(para_env, pdims_t3c, pgrid_t3c_m)
800
801 associate(cut_memory => qs_env%mp2_env%ri_rpa_im_time%cut_memory)
802 CALL create_tensor_batches(sizes_ao_split, cut_memory, starts_array_mc, ends_array_mc, &
803 starts_array_mc_block, ends_array_mc_block)
804 CALL create_tensor_batches(sizes_ri_split, cut_memory, &
805 qs_env%mp2_env%ri_rpa_im_time%starts_array_mc_RI, &
806 qs_env%mp2_env%ri_rpa_im_time%ends_array_mc_RI, &
807 qs_env%mp2_env%ri_rpa_im_time%starts_array_mc_block_RI, &
808 qs_env%mp2_env%ri_rpa_im_time%ends_array_mc_block_RI)
809
810 END associate
811 cut_memory = qs_env%mp2_env%ri_rpa_im_time%cut_memory
812
813 CALL create_3c_tensor(t_3c_m, dist_ri, dist_ao_1, dist_ao_2, pgrid_t3c_m, &
814 sizes_ri_split, sizes_ao_split, sizes_ao_split, &
815 map1=[1], map2=[2, 3], &
816 name="M (RI | AO AO)")
817 DEALLOCATE (dist_ri, dist_ao_1, dist_ao_2)
818 CALL dbt_pgrid_destroy(pgrid_t3c_m)
819
820 ALLOCATE (t_3c_o(SIZE(t_3c_overl_int, 1), SIZE(t_3c_overl_int, 2)))
821 ALLOCATE (t_3c_o_compressed(SIZE(t_3c_overl_int, 1), SIZE(t_3c_overl_int, 2), cut_memory))
822 ALLOCATE (t_3c_o_ind(SIZE(t_3c_overl_int, 1), SIZE(t_3c_overl_int, 2), cut_memory))
823 CALL create_3c_tensor(t_3c_o(1, 1), dist_ri, dist_ao_1, dist_ao_2, pgrid_t3c_overl, &
824 sizes_ri_split, sizes_ao_split, sizes_ao_split, &
825 map1=[1, 2], map2=[3], &
826 name="O (RI AO | AO)")
827 DEALLOCATE (dist_ri, dist_ao_1, dist_ao_2)
828 CALL dbt_pgrid_destroy(pgrid_t3c_overl)
829
830 DO i = 1, SIZE(t_3c_o, 1)
831 DO j = 1, SIZE(t_3c_o, 2)
832 IF (i > 1 .OR. j > 1) CALL dbt_create(t_3c_o(1, 1), t_3c_o(i, j))
833 END DO
834 END DO
835
836 ! build integrals in batches and copy to optimized format
837 ! note: integrals are stored in terms of atomic blocks. To avoid a memory bottleneck,
838 ! integrals are calculated in batches and copied to optimized format with subatomic blocks
839
840 DO cm = 1, cut_memory_int
841 CALL build_3c_integrals(t_3c_overl_int, &
842 qs_env%mp2_env%ri_rpa_im_time%eps_filter/2, &
843 qs_env, &
844 nl_3c, &
845 int_eps=qs_env%mp2_env%ri_rpa_im_time%eps_filter/2, &
846 basis_i=basis_set_ri_aux, &
847 basis_j=basis_set_ao, basis_k=basis_set_ao, &
848 potential_parameter=ri_metric, &
849 do_kpoints=do_kpoints_cubic_rpa, &
850 bounds_i=[starts_array_mc_block_int(cm), ends_array_mc_block_int(cm)], desymmetrize=.false.)
851 CALL timeset(routinen//"_copy_3c", handle4)
852 ! copy integral tensor t_3c_overl_int to t_3c_O tensor optimized for contraction
853 DO i = 1, SIZE(t_3c_overl_int, 1)
854 DO j = 1, SIZE(t_3c_overl_int, 2)
855
856 CALL dbt_copy(t_3c_overl_int(i, j), t_3c_o(i, j), order=[1, 3, 2], &
857 summation=.true., move_data=.true.)
858 CALL dbt_clear(t_3c_overl_int(i, j))
859 CALL dbt_filter(t_3c_o(i, j), qs_env%mp2_env%ri_rpa_im_time%eps_filter/2)
860 ! rescaling, probably because of neighbor list
861 IF (do_kpoints_cubic_rpa .AND. cm == cut_memory_int) THEN
862 CALL dbt_scale(t_3c_o(i, j), 0.5_dp)
863 END IF
864 END DO
865 END DO
866 CALL timestop(handle4)
867 END DO
868
869 DO i = 1, SIZE(t_3c_overl_int, 1)
870 DO j = 1, SIZE(t_3c_overl_int, 2)
871 CALL dbt_destroy(t_3c_overl_int(i, j))
872 END DO
873 END DO
874 DEALLOCATE (t_3c_overl_int)
875
876 CALL timeset(routinen//"_copy_3c", handle4)
877 ! desymmetrize
878 CALL dbt_create(t_3c_o(1, 1), t_3c_tmp)
879 DO jcell = 1, nimg
880 DO kcell = 1, jcell
881 CALL dbt_copy(t_3c_o(jcell, kcell), t_3c_tmp)
882 CALL dbt_copy(t_3c_tmp, t_3c_o(kcell, jcell), order=[1, 3, 2], summation=.true., move_data=.true.)
883 CALL dbt_filter(t_3c_o(kcell, jcell), qs_env%mp2_env%ri_rpa_im_time%eps_filter)
884 END DO
885 END DO
886 DO jcell = 1, nimg
887 DO kcell = jcell + 1, nimg
888 CALL dbt_copy(t_3c_o(jcell, kcell), t_3c_tmp)
889 CALL dbt_copy(t_3c_tmp, t_3c_o(kcell, jcell), order=[1, 3, 2], summation=.false., move_data=.true.)
890 CALL dbt_filter(t_3c_o(kcell, jcell), qs_env%mp2_env%ri_rpa_im_time%eps_filter)
891 END DO
892 END DO
893
894 CALL dbt_get_info(t_3c_o(1, 1), nfull_total=bounds_3c)
895 CALL get_tensor_occupancy(t_3c_o(1, 1), nze, occ)
896 memory_3c = 0.0_dp
897
898 bounds(:, 1) = [1, bounds_3c(1)]
899 bounds(:, 3) = [1, bounds_3c(3)]
900 DO i = 1, SIZE(t_3c_o, 1)
901 DO j = 1, SIZE(t_3c_o, 2)
902 DO i_mem = 1, cut_memory
903 bounds(:, 2) = [starts_array_mc(i_mem), ends_array_mc(i_mem)]
904 CALL dbt_copy(t_3c_o(i, j), t_3c_tmp, bounds=bounds)
905
906 CALL alloc_containers(t_3c_o_compressed(i, j, i_mem), 1)
907 CALL compress_tensor(t_3c_tmp, t_3c_o_ind(i, j, i_mem)%ind, &
908 t_3c_o_compressed(i, j, i_mem), &
909 qs_env%mp2_env%ri_rpa_im_time%eps_compress, memory_3c)
910 END DO
911 CALL dbt_clear(t_3c_o(i, j))
912 END DO
913 END DO
914
915 CALL para_env%sum(memory_3c)
916
917 compression_factor = real(nze, dp)*1.0e-06_dp*8.0_dp/memory_3c
918
919 IF (unit_nr > 0) THEN
920 WRITE (unit=unit_nr, fmt="((T3,A,T66,F11.2,A4))") &
921 "MEMORY_INFO| Memory for 3-center integrals (compressed):", memory_3c, ' MiB'
922
923 WRITE (unit=unit_nr, fmt="((T3,A,T60,F21.2))") &
924 "MEMORY_INFO| Compression factor: ", compression_factor
925 END IF
926
927 CALL dbt_destroy(t_3c_tmp)
928
929 CALL timestop(handle4)
930
931 DO ibasis = 1, SIZE(basis_set_ao)
932 orb_basis => basis_set_ao(ibasis)%gto_basis_set
933 CALL init_interaction_radii_orb_basis(orb_basis, eps_pgf_orb_old)
934 ri_basis => basis_set_ri_aux(ibasis)%gto_basis_set
935 CALL init_interaction_radii_orb_basis(ri_basis, eps_pgf_orb_old)
936 END DO
937
938 DEALLOCATE (basis_set_ri_aux, basis_set_ao)
939
940 CALL neighbor_list_3c_destroy(nl_3c)
941
942 END IF
943
944 CALL timestop(handle)
945
946 END SUBROUTINE mp2_ri_gpw_compute_in
947
948! **************************************************************************************************
949!> \brief Contract (P|ai) = (R|P) x (R|ai)
950!> \param BIb_C (R|ai)
951!> \param my_Lrows (R|P)
952!> \param sizes_B number of a (virtual) indices per subgroup process
953!> \param sizes_L number of P / R (auxiliary) indices per subgroup
954!> \param blk_size ...
955!> \param ngroup how many subgroups (NG)
956!> \param igroup subgroup color
957!> \param mp_comm communicator
958!> \param para_env_sub ...
959! **************************************************************************************************
960 SUBROUTINE contract_b_l(BIb_C, my_Lrows, sizes_B, sizes_L, blk_size, ngroup, igroup, mp_comm, para_env_sub)
961 REAL(kind=dp), DIMENSION(:, :, :), INTENT(INOUT) :: bib_c
962 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: my_lrows
963 INTEGER, DIMENSION(:), INTENT(IN) :: sizes_b, sizes_l
964 INTEGER, DIMENSION(2), INTENT(IN) :: blk_size
965 INTEGER, INTENT(IN) :: ngroup, igroup
966
967 CLASS(mp_comm_type), INTENT(IN) :: mp_comm
968 TYPE(mp_para_env_type), INTENT(IN) :: para_env_sub
969
970 CHARACTER(LEN=*), PARAMETER :: routinen = 'contract_B_L'
971 LOGICAL, PARAMETER :: debug = .false.
972
973 INTEGER :: check_proc, handle, i, iend, ii, ioff, &
974 istart, loc_a, loc_p, nblk_per_thread
975 INTEGER, ALLOCATABLE, DIMENSION(:) :: block_ind_l_p, block_ind_l_r
976 INTEGER, DIMENSION(1) :: dist_b_i, map_b_1, map_l_1, map_l_2, &
977 sizes_i
978 INTEGER, DIMENSION(2) :: map_b_2, pdims_l
979 INTEGER, DIMENSION(3) :: pdims_b
980 LOGICAL :: found
981 INTEGER, DIMENSION(ngroup) :: dist_l_p, dist_l_r
982 INTEGER, DIMENSION(para_env_sub%num_pe) :: dist_b_a
983 TYPE(dbt_distribution_type) :: dist_b, dist_l
984 TYPE(dbt_pgrid_type) :: mp_comm_b, mp_comm_l
985 TYPE(dbt_type) :: tb_in, tb_in_split, tb_out, &
986 tb_out_split, tl, tl_split
987
988 CALL timeset(routinen, handle)
989
990 sizes_i(1) = SIZE(bib_c, 3)
991
992 associate(nproc => para_env_sub%num_pe, iproc => para_env_sub%mepos, iproc_glob => mp_comm%mepos)
993
994 ! local block index for R/P and a
995 loc_p = igroup + 1; loc_a = iproc + 1
996
997 cpassert(SIZE(sizes_l) == ngroup)
998 cpassert(SIZE(sizes_b) == nproc)
999 cpassert(sizes_l(loc_p) == SIZE(bib_c, 1))
1000 cpassert(sizes_l(loc_p) == SIZE(my_lrows, 2))
1001 cpassert(sizes_b(loc_a) == SIZE(bib_c, 2))
1002
1003 ! Tensor distributions as follows:
1004 ! Process grid NG x Nw
1005 ! Each process has coordinates (np, nw)
1006 ! tB_in: (R|ai): R distributed (np), a distributed (nw)
1007 ! tB_out: (P|ai): P distributed (np), a distributed (nw)
1008 ! tL: (R|P): R distributed (nw), P distributed (np)
1009
1010 ! define mappings between tensor index and matrix index:
1011 ! (R|ai) and (P|ai):
1012 map_b_1 = [1] ! index 1 (R or P) maps to 1st matrix index (np distributed)
1013 map_b_2 = [2, 3] ! indices 2, 3 (a, i) map to 2nd matrix index (nw distributed)
1014 ! (R|P):
1015 map_l_1 = [2] ! index 2 (P) maps to 1st matrix index (np distributed)
1016 map_l_2 = [1] ! index 1 (R) maps to 2nd matrix index (nw distributed)
1017
1018 ! derive nd process grid that is compatible with distributions and 2d process grid
1019 ! (R|ai) / (P|ai) on process grid NG x Nw x 1
1020 ! (R|P) on process grid NG x Nw
1021 pdims_b = [ngroup, nproc, 1]
1022 pdims_l = [nproc, ngroup]
1023
1024 CALL dbt_pgrid_create(mp_comm, pdims_b, mp_comm_b)
1025 CALL dbt_pgrid_create(mp_comm, pdims_l, mp_comm_l)
1026
1027 ! setup distribution vectors such that distribution matches parallel data layout of BIb_C and my_Lrows
1028 dist_b_i = [0]
1029 dist_b_a = [(i, i=0, nproc - 1)]
1030 dist_l_r = [(modulo(i, nproc), i=0, ngroup - 1)] ! R index is replicated in my_Lrows, we impose a cyclic distribution
1031 dist_l_p = [(i, i=0, ngroup - 1)]
1032
1033 ! create distributions and tensors
1034 CALL dbt_distribution_new(dist_b, mp_comm_b, dist_l_p, dist_b_a, dist_b_i)
1035 CALL dbt_distribution_new(dist_l, mp_comm_l, dist_l_r, dist_l_p)
1036
1037 CALL dbt_create(tb_in, "(R|ai)", dist_b, map_b_1, map_b_2, sizes_l, sizes_b, sizes_i)
1038 CALL dbt_create(tb_out, "(P|ai)", dist_b, map_b_1, map_b_2, sizes_l, sizes_b, sizes_i)
1039 CALL dbt_create(tl, "(R|P)", dist_l, map_l_1, map_l_2, sizes_l, sizes_l)
1040
1041 IF (debug) THEN
1042 ! check that tensor distribution is correct
1043 CALL dbt_get_stored_coordinates(tb_in, [loc_p, loc_a, 1], check_proc)
1044 cpassert(check_proc == iproc_glob)
1045 END IF
1046
1047 ! reserve (R|ai) block
1048!$OMP PARALLEL DEFAULT(NONE) SHARED(tB_in,loc_P,loc_a)
1049 CALL dbt_reserve_blocks(tb_in, [loc_p], [loc_a], [1])
1050!$OMP END PARALLEL
1051
1052 ! reserve (R|P) blocks
1053 ! in my_Lrows, R index is replicated. For (R|P), we distribute quadratic blocks cyclically over
1054 ! the processes in a subgroup.
1055 ! There are NG blocks, so each process holds at most NG/Nw+1 blocks.
1056 ALLOCATE (block_ind_l_r(ngroup/nproc + 1))
1057 ALLOCATE (block_ind_l_p(ngroup/nproc + 1))
1058 block_ind_l_r(:) = 0; block_ind_l_p(:) = 0
1059 ii = 0
1060 DO i = 1, ngroup
1061 CALL dbt_get_stored_coordinates(tl, [i, loc_p], check_proc)
1062 IF (check_proc == iproc_glob) THEN
1063 ii = ii + 1
1064 block_ind_l_r(ii) = i
1065 block_ind_l_p(ii) = loc_p
1066 END IF
1067 END DO
1068
1069!TODO: Parallelize creation of block list.
1070!$OMP PARALLEL DEFAULT(NONE) SHARED(tL,block_ind_L_R,block_ind_L_P,ii) &
1071!$OMP PRIVATE(nblk_per_thread,istart,iend)
1072 nblk_per_thread = ii/omp_get_num_threads() + 1
1073 istart = omp_get_thread_num()*nblk_per_thread + 1
1074 iend = min(istart + nblk_per_thread, ii)
1075 CALL dbt_reserve_blocks(tl, block_ind_l_r(istart:iend), block_ind_l_p(istart:iend))
1076!$OMP END PARALLEL
1077
1078 ! insert (R|ai) block
1079 CALL dbt_put_block(tb_in, [loc_p, loc_a, 1], shape(bib_c), bib_c)
1080
1081 ! insert (R|P) blocks
1082 ioff = 0
1083 DO i = 1, ngroup
1084 istart = ioff + 1; iend = ioff + sizes_l(i)
1085 ioff = ioff + sizes_l(i)
1086 CALL dbt_get_stored_coordinates(tl, [i, loc_p], check_proc)
1087 IF (check_proc == iproc_glob) THEN
1088 CALL dbt_put_block(tl, [i, loc_p], [sizes_l(i), sizes_l(loc_p)], my_lrows(istart:iend, :))
1089 END IF
1090 END DO
1091 END associate
1092
1093 CALL dbt_split_blocks(tb_in, tb_in_split, [blk_size(2), blk_size(1), blk_size(1)])
1094 CALL dbt_split_blocks(tl, tl_split, [blk_size(2), blk_size(2)])
1095 CALL dbt_split_blocks(tb_out, tb_out_split, [blk_size(2), blk_size(1), blk_size(1)])
1096
1097 ! contract
1098 CALL dbt_contract(alpha=1.0_dp, tensor_1=tb_in_split, tensor_2=tl_split, &
1099 beta=0.0_dp, tensor_3=tb_out_split, &
1100 contract_1=[1], notcontract_1=[2, 3], &
1101 contract_2=[1], notcontract_2=[2], &
1102 map_1=[2, 3], map_2=[1], optimize_dist=.true.)
1103
1104 ! retrieve local block of contraction result (P|ai)
1105 CALL dbt_copy(tb_out_split, tb_out)
1106
1107 CALL dbt_get_block(tb_out, [loc_p, loc_a, 1], shape(bib_c), bib_c, found)
1108 cpassert(found)
1109
1110 ! cleanup
1111 CALL dbt_destroy(tb_in)
1112 CALL dbt_destroy(tb_in_split)
1113 CALL dbt_destroy(tb_out)
1114 CALL dbt_destroy(tb_out_split)
1115 CALL dbt_destroy(tl)
1116 CALL dbt_destroy(tl_split)
1117
1118 CALL dbt_distribution_destroy(dist_b)
1119 CALL dbt_distribution_destroy(dist_l)
1120
1121 CALL dbt_pgrid_destroy(mp_comm_b)
1122 CALL dbt_pgrid_destroy(mp_comm_l)
1123
1124 CALL timestop(handle)
1125
1126 END SUBROUTINE contract_b_l
1127
1128! **************************************************************************************************
1129!> \brief Encapsulate building of intermediate matrices matrix_ia_jnu(_beta
1130!> matrix_ia_jb(_beta),fm_BIb_jb(_beta),matrix_in_jnu(for G0W0) and
1131!> fm_BIb_all(for G0W0)
1132!> \param intermed_mat ...
1133!> \param mo_coeff_templ ...
1134!> \param size_1 ...
1135!> \param size_2 ...
1136!> \param matrix_name_2 ...
1137!> \param blacs_env_sub ...
1138!> \param para_env_sub ...
1139!> \author Jan Wilhelm
1140! **************************************************************************************************
1141 SUBROUTINE create_intermediate_matrices(intermed_mat, mo_coeff_templ, size_1, size_2, &
1142 matrix_name_2, blacs_env_sub, para_env_sub)
1143
1144 TYPE(intermediate_matrix_type), INTENT(OUT) :: intermed_mat
1145 TYPE(dbcsr_type), INTENT(INOUT) :: mo_coeff_templ
1146 INTEGER, INTENT(IN) :: size_1, size_2
1147 CHARACTER(LEN=*), INTENT(IN) :: matrix_name_2
1148 TYPE(cp_blacs_env_type), POINTER :: blacs_env_sub
1149 TYPE(mp_para_env_type), POINTER :: para_env_sub
1150
1151 CHARACTER(LEN=*), PARAMETER :: routinen = 'create_intermediate_matrices'
1152
1153 INTEGER :: handle, ncol_local, nfullcols_total, &
1154 nfullrows_total, nrow_local
1155 INTEGER, DIMENSION(:), POINTER :: col_indices, row_indices
1156 TYPE(cp_fm_struct_type), POINTER :: fm_struct
1157
1158 CALL timeset(routinen, handle)
1159
1160 ! initialize and create the matrix (K|jnu)
1161 CALL dbcsr_create(intermed_mat%matrix_ia_jnu, template=mo_coeff_templ)
1162
1163 ! Allocate Sparse matrices: (K|jb)
1164 CALL cp_dbcsr_m_by_n_from_template(intermed_mat%matrix_ia_jb, template=mo_coeff_templ, m=size_2, n=size_1, &
1165 sym=dbcsr_type_no_symmetry)
1166
1167 ! set all to zero in such a way that the memory is actually allocated
1168 CALL dbcsr_set(intermed_mat%matrix_ia_jnu, 0.0_dp)
1169 CALL dbcsr_set(intermed_mat%matrix_ia_jb, 0.0_dp)
1170
1171 ! create the analogous of matrix_ia_jb in fm type
1172 NULLIFY (fm_struct)
1173 CALL dbcsr_get_info(intermed_mat%matrix_ia_jb, nfullrows_total=nfullrows_total, nfullcols_total=nfullcols_total)
1174 CALL cp_fm_struct_create(fm_struct, context=blacs_env_sub, nrow_global=nfullrows_total, &
1175 ncol_global=nfullcols_total, para_env=para_env_sub)
1176 CALL cp_fm_create(intermed_mat%fm_BIb_jb, fm_struct, name="fm_BIb_jb_"//matrix_name_2)
1177
1178 CALL copy_dbcsr_to_fm(intermed_mat%matrix_ia_jb, intermed_mat%fm_BIb_jb)
1179 CALL cp_fm_struct_release(fm_struct)
1180
1181 CALL cp_fm_get_info(matrix=intermed_mat%fm_BIb_jb, &
1182 nrow_local=nrow_local, &
1183 ncol_local=ncol_local, &
1184 row_indices=row_indices, &
1185 col_indices=col_indices)
1186
1187 intermed_mat%max_row_col_local = max(nrow_local, ncol_local)
1188 CALL para_env_sub%max(intermed_mat%max_row_col_local)
1189
1190 ALLOCATE (intermed_mat%local_col_row_info(0:intermed_mat%max_row_col_local, 2))
1191 intermed_mat%local_col_row_info = 0
1192 ! 0,1 nrows
1193 intermed_mat%local_col_row_info(0, 1) = nrow_local
1194 intermed_mat%local_col_row_info(1:nrow_local, 1) = row_indices(1:nrow_local)
1195 ! 0,2 ncols
1196 intermed_mat%local_col_row_info(0, 2) = ncol_local
1197 intermed_mat%local_col_row_info(1:ncol_local, 2) = col_indices(1:ncol_local)
1198
1199 intermed_mat%descr = matrix_name_2
1200
1201 CALL timestop(handle)
1202
1203 END SUBROUTINE create_intermediate_matrices
1204
1205! **************************************************************************************************
1206!> \brief Encapsulate ERI postprocessing: AO to MO transformation and store in B matrix.
1207!> \param para_env ...
1208!> \param mat_munu ...
1209!> \param intermed_mat ...
1210!> \param BIb_jb ...
1211!> \param mo_coeff_o ...
1212!> \param mo_coeff_v ...
1213!> \param eps_filter ...
1214!> \param my_B_end ...
1215!> \param my_B_start ...
1216! **************************************************************************************************
1217 SUBROUTINE ao_to_mo_and_store_b(para_env, mat_munu, intermed_mat, BIb_jb, &
1218 mo_coeff_o, mo_coeff_v, eps_filter, &
1219 my_B_end, my_B_start)
1220 TYPE(mp_para_env_type), INTENT(IN) :: para_env
1221 TYPE(dbcsr_p_type), INTENT(IN) :: mat_munu
1222 TYPE(intermediate_matrix_type), INTENT(INOUT) :: intermed_mat
1223 REAL(kind=dp), DIMENSION(:, :), INTENT(OUT) :: bib_jb
1224 TYPE(dbcsr_type), POINTER :: mo_coeff_o, mo_coeff_v
1225 REAL(kind=dp), INTENT(IN) :: eps_filter
1226 INTEGER, INTENT(IN) :: my_b_end, my_b_start
1227
1228 CHARACTER(LEN=*), PARAMETER :: routinen = 'ao_to_mo_and_store_B'
1229
1230 INTEGER :: handle
1231
1232 CALL timeset(routinen//"_mult_"//trim(intermed_mat%descr), handle)
1233
1234 CALL dbcsr_multiply("N", "N", 1.0_dp, mat_munu%matrix, mo_coeff_o, &
1235 0.0_dp, intermed_mat%matrix_ia_jnu, filter_eps=eps_filter)
1236 CALL dbcsr_multiply("T", "N", 1.0_dp, intermed_mat%matrix_ia_jnu, mo_coeff_v, &
1237 0.0_dp, intermed_mat%matrix_ia_jb, filter_eps=eps_filter)
1238 CALL timestop(handle)
1239
1240 CALL timeset(routinen//"_E_Ex_"//trim(intermed_mat%descr), handle)
1241 CALL copy_dbcsr_to_fm(intermed_mat%matrix_ia_jb, intermed_mat%fm_BIb_jb)
1242
1243 CALL grep_my_integrals(para_env, intermed_mat%fm_BIb_jb, bib_jb, intermed_mat%max_row_col_local, &
1244 intermed_mat%local_col_row_info, &
1245 my_b_end, my_b_start)
1246
1247 CALL timestop(handle)
1248 END SUBROUTINE ao_to_mo_and_store_b
1249
1250! **************************************************************************************************
1251!> \brief ...
1252!> \param intermed_mat ...
1253! **************************************************************************************************
1254 SUBROUTINE release_intermediate_matrices(intermed_mat)
1255 TYPE(intermediate_matrix_type), INTENT(INOUT) :: intermed_mat
1256
1257 CALL dbcsr_release(intermed_mat%matrix_ia_jnu)
1258 CALL dbcsr_release(intermed_mat%matrix_ia_jb)
1259 CALL cp_fm_release(intermed_mat%fm_BIb_jb)
1260 DEALLOCATE (intermed_mat%local_col_row_info)
1261
1262 END SUBROUTINE release_intermediate_matrices
1263
1264! **************************************************************************************************
1265!> \brief ...
1266!> \param qs_env ...
1267!> \param kpoints ...
1268!> \param unit_nr ...
1269! **************************************************************************************************
1270 SUBROUTINE compute_kpoints(qs_env, kpoints, unit_nr)
1271
1272 TYPE(qs_environment_type), POINTER :: qs_env
1273 TYPE(kpoint_type), POINTER :: kpoints
1274 INTEGER :: unit_nr
1275
1276 CHARACTER(LEN=*), PARAMETER :: routinen = 'compute_kpoints'
1277
1278 INTEGER :: handle, i, i_dim, ix, iy, iz, nkp, &
1279 nkp_extra, nkp_orig
1280 INTEGER, DIMENSION(3) :: nkp_grid, nkp_grid_extra, periodic
1281 LOGICAL :: do_extrapolate_kpoints
1282 TYPE(cell_type), POINTER :: cell
1283 TYPE(dft_control_type), POINTER :: dft_control
1284 TYPE(mp_para_env_type), POINTER :: para_env
1285 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
1286 POINTER :: sab_orb
1287
1288 CALL timeset(routinen, handle)
1289
1290 NULLIFY (cell, dft_control, para_env)
1291 CALL get_qs_env(qs_env=qs_env, cell=cell, para_env=para_env, dft_control=dft_control, sab_orb=sab_orb)
1292 CALL get_cell(cell=cell, periodic=periodic)
1293
1294 ! general because we augment a Monkhorst-Pack mesh by additional points in the BZ
1295 kpoints%kp_scheme = "GENERAL"
1296 kpoints%symmetry = .false.
1297 kpoints%verbose = .false.
1298 kpoints%full_grid = .true.
1299 kpoints%use_real_wfn = .false.
1300 kpoints%eps_geo = 1.e-6_dp
1301 nkp_grid(1:3) = qs_env%mp2_env%ri_rpa_im_time%kp_grid(1:3)
1302 do_extrapolate_kpoints = qs_env%mp2_env%ri_rpa_im_time%do_extrapolate_kpoints
1303
1304 DO i_dim = 1, 3
1305 IF (periodic(i_dim) == 1) THEN
1306 cpassert(modulo(nkp_grid(i_dim), 2) == 0)
1307 END IF
1308 IF (periodic(i_dim) == 0) THEN
1309 cpassert(nkp_grid(i_dim) == 1)
1310 END IF
1311 END DO
1312
1313 nkp_orig = nkp_grid(1)*nkp_grid(2)*nkp_grid(3)/2
1314
1315 IF (do_extrapolate_kpoints) THEN
1316
1317 cpassert(qs_env%mp2_env%ri_rpa_im_time%kpoint_weights_W_method == kp_weights_w_uniform)
1318
1319 DO i_dim = 1, 3
1320 IF (periodic(i_dim) == 1) nkp_grid_extra(i_dim) = nkp_grid(i_dim) + 2
1321 IF (periodic(i_dim) == 0) nkp_grid_extra(i_dim) = 1
1322 END DO
1323
1324 qs_env%mp2_env%ri_rpa_im_time%kp_grid_extra(1:3) = nkp_grid_extra(1:3)
1325
1326 nkp_extra = nkp_grid_extra(1)*nkp_grid_extra(2)*nkp_grid_extra(3)/2
1327
1328 ELSE
1329
1330 nkp_grid_extra(1:3) = 0
1331 nkp_extra = 0
1332
1333 END IF
1334
1335 nkp = nkp_orig + nkp_extra
1336
1337 qs_env%mp2_env%ri_rpa_im_time%nkp_orig = nkp_orig
1338 qs_env%mp2_env%ri_rpa_im_time%nkp_extra = nkp_extra
1339
1340 ALLOCATE (kpoints%xkp(3, nkp), kpoints%wkp(nkp))
1341
1342 kpoints%nkp_grid(1:3) = nkp_grid(1:3)
1343 kpoints%nkp = nkp
1344
1345 ALLOCATE (qs_env%mp2_env%ri_rpa_im_time%wkp_V(nkp))
1346 IF (do_extrapolate_kpoints) THEN
1347 kpoints%wkp(1:nkp_orig) = 1.0_dp/real(nkp_orig, kind=dp) &
1348 /(1.0_dp - sqrt(real(nkp_extra, kind=dp)/real(nkp_orig, kind=dp)))
1349 kpoints%wkp(nkp_orig + 1:nkp) = 1.0_dp/real(nkp_extra, kind=dp) &
1350 /(1.0_dp - sqrt(real(nkp_orig, kind=dp)/real(nkp_extra, kind=dp)))
1351 qs_env%mp2_env%ri_rpa_im_time%wkp_V(1:nkp_orig) = 0.0_dp
1352 qs_env%mp2_env%ri_rpa_im_time%wkp_V(nkp_orig + 1:nkp) = 1.0_dp/real(nkp_extra, kind=dp)
1353 ELSE
1354 kpoints%wkp(:) = 1.0_dp/real(nkp, kind=dp)
1355 qs_env%mp2_env%ri_rpa_im_time%wkp_V(:) = kpoints%wkp(:)
1356 END IF
1357
1358 i = 0
1359 DO ix = 1, nkp_grid(1)
1360 DO iy = 1, nkp_grid(2)
1361 DO iz = 1, nkp_grid(3)
1362
1363 IF (i == nkp_orig) cycle
1364 i = i + 1
1365
1366 kpoints%xkp(1, i) = real(2*ix - nkp_grid(1) - 1, kind=dp)/(2._dp*real(nkp_grid(1), kind=dp))
1367 kpoints%xkp(2, i) = real(2*iy - nkp_grid(2) - 1, kind=dp)/(2._dp*real(nkp_grid(2), kind=dp))
1368 kpoints%xkp(3, i) = real(2*iz - nkp_grid(3) - 1, kind=dp)/(2._dp*real(nkp_grid(3), kind=dp))
1369
1370 END DO
1371 END DO
1372 END DO
1373
1374 DO ix = 1, nkp_grid_extra(1)
1375 DO iy = 1, nkp_grid_extra(2)
1376 DO iz = 1, nkp_grid_extra(3)
1377
1378 i = i + 1
1379 IF (i > nkp) cycle
1380
1381 kpoints%xkp(1, i) = real(2*ix - nkp_grid_extra(1) - 1, kind=dp)/(2._dp*real(nkp_grid_extra(1), kind=dp))
1382 kpoints%xkp(2, i) = real(2*iy - nkp_grid_extra(2) - 1, kind=dp)/(2._dp*real(nkp_grid_extra(2), kind=dp))
1383 kpoints%xkp(3, i) = real(2*iz - nkp_grid_extra(3) - 1, kind=dp)/(2._dp*real(nkp_grid_extra(3), kind=dp))
1384
1385 END DO
1386 END DO
1387 END DO
1388
1389 CALL kpoint_init_cell_index(kpoints, sab_orb, para_env, dft_control%nimages)
1390
1391 CALL set_qs_env(qs_env, kpoints=kpoints)
1392
1393 IF (unit_nr > 0) THEN
1394
1395 IF (do_extrapolate_kpoints) THEN
1396 WRITE (unit=unit_nr, fmt="(T3,A,T69,3I4)") "KPOINT_INFO| K-point mesh for V (leading to Sigma^x):", nkp_grid(1:3)
1397 WRITE (unit=unit_nr, fmt="(T3,A,T69)") "KPOINT_INFO| K-point extrapolation for W^c is used (W^c leads to Sigma^c):"
1398 WRITE (unit=unit_nr, fmt="(T3,A,T69,3I4)") "KPOINT_INFO| K-point mesh 1 for W^c:", nkp_grid(1:3)
1399 WRITE (unit=unit_nr, fmt="(T3,A,T69,3I4)") "KPOINT_INFO| K-point mesh 2 for W^c:", nkp_grid_extra(1:3)
1400 ELSE
1401 WRITE (unit=unit_nr, fmt="(T3,A,T69,3I4)") "KPOINT_INFO| K-point mesh for V and W:", nkp_grid(1:3)
1402 WRITE (unit=unit_nr, fmt="(T3,A,T75,I6)") "KPOINT_INFO| Number of kpoints for V and W:", nkp
1403 END IF
1404
1405 SELECT CASE (qs_env%mp2_env%ri_rpa_im_time%kpoint_weights_W_method)
1406 CASE (kp_weights_w_tailored)
1407 WRITE (unit=unit_nr, fmt="(T3,A,T81)") &
1408 "KPOINT_INFO| K-point weights for W: TAILORED"
1409 CASE (kp_weights_w_auto)
1410 WRITE (unit=unit_nr, fmt="(T3,A,T81)") &
1411 "KPOINT_INFO| K-point weights for W: AUTO"
1412 CASE (kp_weights_w_uniform)
1413 WRITE (unit=unit_nr, fmt="(T3,A,T81)") &
1414 "KPOINT_INFO| K-point weights for W: UNIFORM"
1415 END SELECT
1416
1417 END IF
1418
1419 CALL timestop(handle)
1420
1421 END SUBROUTINE compute_kpoints
1422
1423! **************************************************************************************************
1424!> \brief ...
1425!> \param para_env_sub ...
1426!> \param fm_BIb_jb ...
1427!> \param BIb_jb ...
1428!> \param max_row_col_local ...
1429!> \param local_col_row_info ...
1430!> \param my_B_virtual_end ...
1431!> \param my_B_virtual_start ...
1432! **************************************************************************************************
1433 SUBROUTINE grep_my_integrals(para_env_sub, fm_BIb_jb, BIb_jb, max_row_col_local, &
1434 local_col_row_info, &
1435 my_B_virtual_end, my_B_virtual_start)
1436 TYPE(mp_para_env_type), INTENT(IN) :: para_env_sub
1437 TYPE(cp_fm_type), INTENT(IN) :: fm_bib_jb
1438 REAL(kind=dp), DIMENSION(:, :), INTENT(OUT) :: bib_jb
1439 INTEGER, INTENT(IN) :: max_row_col_local
1440 INTEGER, ALLOCATABLE, DIMENSION(:, :), INTENT(IN) :: local_col_row_info
1441 INTEGER, INTENT(IN) :: my_b_virtual_end, my_b_virtual_start
1442
1443 INTEGER :: i_global, iib, j_global, jjb, ncol_rec, &
1444 nrow_rec, proc_receive, proc_send, &
1445 proc_shift
1446 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: rec_col_row_info
1447 INTEGER, DIMENSION(:), POINTER :: col_indices_rec, row_indices_rec
1448 REAL(kind=dp), DIMENSION(:, :), POINTER :: local_bi, rec_bi
1449
1450 ALLOCATE (rec_col_row_info(0:max_row_col_local, 2))
1451
1452 rec_col_row_info(:, :) = local_col_row_info
1453
1454 nrow_rec = rec_col_row_info(0, 1)
1455 ncol_rec = rec_col_row_info(0, 2)
1456
1457 ALLOCATE (row_indices_rec(nrow_rec))
1458 row_indices_rec = rec_col_row_info(1:nrow_rec, 1)
1459
1460 ALLOCATE (col_indices_rec(ncol_rec))
1461 col_indices_rec = rec_col_row_info(1:ncol_rec, 2)
1462
1463 ! accumulate data on BIb_jb buffer starting from myself
1464 DO jjb = 1, ncol_rec
1465 j_global = col_indices_rec(jjb)
1466 IF (j_global >= my_b_virtual_start .AND. j_global <= my_b_virtual_end) THEN
1467 DO iib = 1, nrow_rec
1468 i_global = row_indices_rec(iib)
1469 bib_jb(j_global - my_b_virtual_start + 1, i_global) = fm_bib_jb%local_data(iib, jjb)
1470 END DO
1471 END IF
1472 END DO
1473
1474 DEALLOCATE (row_indices_rec)
1475 DEALLOCATE (col_indices_rec)
1476
1477 IF (para_env_sub%num_pe > 1) THEN
1478 ALLOCATE (local_bi(nrow_rec, ncol_rec))
1479 local_bi(1:nrow_rec, 1:ncol_rec) = fm_bib_jb%local_data(1:nrow_rec, 1:ncol_rec)
1480
1481 DO proc_shift = 1, para_env_sub%num_pe - 1
1482 proc_send = modulo(para_env_sub%mepos + proc_shift, para_env_sub%num_pe)
1483 proc_receive = modulo(para_env_sub%mepos - proc_shift, para_env_sub%num_pe)
1484
1485 ! first exchange information on the local data
1486 rec_col_row_info = 0
1487 CALL para_env_sub%sendrecv(local_col_row_info, proc_send, rec_col_row_info, proc_receive)
1488 nrow_rec = rec_col_row_info(0, 1)
1489 ncol_rec = rec_col_row_info(0, 2)
1490
1491 ALLOCATE (row_indices_rec(nrow_rec))
1492 row_indices_rec = rec_col_row_info(1:nrow_rec, 1)
1493
1494 ALLOCATE (col_indices_rec(ncol_rec))
1495 col_indices_rec = rec_col_row_info(1:ncol_rec, 2)
1496
1497 ALLOCATE (rec_bi(nrow_rec, ncol_rec))
1498 rec_bi = 0.0_dp
1499
1500 ! then send and receive the real data
1501 CALL para_env_sub%sendrecv(local_bi, proc_send, rec_bi, proc_receive)
1502
1503 ! accumulate the received data on BIb_jb buffer
1504 DO jjb = 1, ncol_rec
1505 j_global = col_indices_rec(jjb)
1506 IF (j_global >= my_b_virtual_start .AND. j_global <= my_b_virtual_end) THEN
1507 DO iib = 1, nrow_rec
1508 i_global = row_indices_rec(iib)
1509 bib_jb(j_global - my_b_virtual_start + 1, i_global) = rec_bi(iib, jjb)
1510 END DO
1511 END IF
1512 END DO
1513
1514 DEALLOCATE (col_indices_rec)
1515 DEALLOCATE (row_indices_rec)
1516 DEALLOCATE (rec_bi)
1517 END DO
1518
1519 DEALLOCATE (local_bi)
1520 END IF
1521
1522 DEALLOCATE (rec_col_row_info)
1523
1524 END SUBROUTINE grep_my_integrals
1525
1526END MODULE mp2_integrals
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.
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public delben2013
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
Definition cell_types.F:234
methods related to the blacs parallel environment
Represents a complex full matrix distributed on many processors.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release_p(matrix)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
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 cp_dbcsr_m_by_n_from_template(matrix, template, m, n, sym)
Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the templ...
Interface to Minimax-Ewald method for periodic ERI's to be used in CP2K.
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
Definition cp_fm_types.F:15
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_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
various routines to log and control the output. The idea is that decisions about where to log should ...
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Definition cp_units.F:1311
This is the start of a dbt_api, all publically needed functions are exported here....
Definition dbt_api.F:17
Types to describe group distributions.
Types and set/get functions for HFX.
Definition hfx_types.F:16
subroutine, public alloc_containers(data, bin_size)
...
Definition hfx_types.F:2989
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_eri_os
integer, parameter, public kp_weights_w_auto
integer, parameter, public kp_weights_w_uniform
integer, parameter, public do_eri_mme
integer, parameter, public do_potential_truncated
integer, parameter, public do_potential_id
integer, parameter, public do_potential_coulomb
integer, parameter, public do_potential_short
integer, parameter, public kp_weights_w_tailored
integer, parameter, public do_potential_long
integer, parameter, public do_eri_gpw
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public int_8
Definition kinds.F:54
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
Routines needed for kpoint calculation.
subroutine, public kpoint_init_cell_index(kpoint, sab_nl, para_env, nimages)
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.
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 Coulomb operator types.
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:127
Interface to the message passing library MPI.
Routines to calculate 2c- and 3c-integrals for RI with GPW.
Definition mp2_eri_gpw.F:13
subroutine, public prepare_gpw(qs_env, dft_control, e_cutoff_old, cutoff_old, relative_cutoff_old, para_env_sub, pw_env_sub, auxbas_pw_pool, poisson_env, task_list_sub, rho_r, rho_g, pot_g, psi_l, sab_orb_sub)
Prepares GPW calculation for RI-MP2/RI-RPA.
subroutine, public mp2_eri_3c_integrate_gpw(psi_l, rho_g, atomic_kind_set, qs_kind_set, cell, dft_control, particle_set, pw_env_sub, external_vector, poisson_env, rho_r, pot_g, potential_parameter, mat_munu, qs_env, task_list_sub)
...
subroutine, public cleanup_gpw(qs_env, e_cutoff_old, cutoff_old, relative_cutoff_old, para_env_sub, pw_env_sub, task_list_sub, auxbas_pw_pool, rho_r, rho_g, pot_g, psi_l)
Cleanup GPW integration for RI-MP2/RI-RPA.
Interface to direct methods for electron repulsion integrals for MP2.
Definition mp2_eri.F:12
subroutine, public mp2_eri_3c_integrate(param, potential_parameter, para_env, qs_env, first_c, last_c, mat_ab, basis_type_a, basis_type_b, basis_type_c, sab_nl, eri_method, pabc, force_a, force_b, force_c, mat_dabc, mat_adbc, mat_abdc)
high-level integration routine for 3c integrals (ab|c) over CP2K basis sets. For each local function ...
Definition mp2_eri.F:702
Routines to calculate and distribute 2c- and 3c- integrals for RI.
subroutine, public compute_kpoints(qs_env, kpoints, unit_nr)
...
subroutine, public mp2_ri_gpw_compute_in(bib_c, bib_c_gw, bib_c_bse_ij, bib_c_bse_ab, gd_array, gd_b_virtual, dimen_ri, dimen_ri_red, qs_env, para_env, para_env_sub, color_sub, cell, particle_set, atomic_kind_set, qs_kind_set, fm_matrix_pq, cfm_matrix_l_kpoints, cfm_matrix_minv_l_kpoints, fm_matrix_minv_l_gamma, fm_matrix_minv, fm_matrix_minv_vtrunc_minv, nmo, homo, mat_munu, sab_orb_sub, mo_coeff_o, mo_coeff_v, mo_coeff_all, mo_coeff_gw, mo_coeff_o_bse, mo_coeff_v_bse, eps_filter, unit_nr, mp2_memory, calc_pq_cond_num, calc_forces, blacs_env_sub, my_do_gw, do_bse, gd_b_all, starts_array_mc, ends_array_mc, starts_array_mc_block, ends_array_mc_block, gw_corr_lev_occ, gw_corr_lev_virt, bse_lev_virt, do_im_time, do_kpoints_cubic_rpa, kpoints, t_3c_m, t_3c_o, t_3c_o_compressed, t_3c_o_ind, ri_metric, gd_b_occ_bse, gd_b_virt_bse)
with ri mp2 gpw
Framework for 2c-integrals for RI.
Definition mp2_ri_2c.F:14
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, cfm_matrix_l_kpoints, cfm_matrix_minv_l_kpoints, fm_matrix_minv_l_gamma, 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)
...
Definition mp2_ri_2c.F:169
Types needed for MP2 calculations.
Definition mp2_types.F:14
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis, ncgf)
Get the components of a particle set.
Define the data structure for the particle information.
container for various plainwaves related things
functions related to the poisson solver on regular grids
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
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.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set 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_orb_basis(orb_basis_set, eps_pgf_orb, eps_pgf_short)
...
Define the quickstep kind type and their sub types.
Define the neighbor list data types and the corresponding functionality.
Utility methods to build 3-center integral tensors of various types.
subroutine, public distribution_3d_create(dist_3d, dist1, dist2, dist3, nkind, particle_set, mp_comm_3d, own_comm)
Create a 3d distribution.
subroutine, public pgf_block_sizes(atomic_kind_set, basis, min_blk_size, pgf_blk_sizes)
...
subroutine, public create_tensor_batches(sizes, nbatches, starts_array, ends_array, starts_array_block, ends_array_block)
...
subroutine, public create_3c_tensor(t3c, dist_1, dist_2, dist_3, pgrid, sizes_1, sizes_2, sizes_3, map1, map2, name)
...
Utility methods to build 3-center integral tensors of various types.
Definition qs_tensors.F:11
subroutine, public build_3c_integrals(t3c, filter_eps, qs_env, nl_3c, basis_i, basis_j, basis_k, potential_parameter, int_eps, op_pos, do_kpoints, do_hfx_kpoints, desymmetrize, cell_sym, bounds_i, bounds_j, bounds_k, ri_range, img_to_ri_cell, cell_to_index_ext)
Build 3-center integral tensor.
subroutine, public compress_tensor(tensor, blk_indices, compressed, eps, memory)
...
subroutine, public neighbor_list_3c_destroy(ijk_list)
Destroy 3c neighborlist.
Definition qs_tensors.F:381
subroutine, public get_tensor_occupancy(tensor, nze, occ)
...
subroutine, public build_3c_neighbor_lists(ijk_list, basis_i, basis_j, basis_k, dist_3d, potential_parameter, name, qs_env, sym_ij, sym_jk, sym_ik, molecular, op_pos, own_dist)
Build a 3-center neighbor list.
Definition qs_tensors.F:280
types for task lists
All kind of helpful little routines.
Definition util.F:14
pure integer function, dimension(2), public get_limit(m, n, me)
divide m entries into n parts, return size of part me
Definition util.F:333
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
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
represent a full matrix
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
environment for the poisson solver
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.