(git:ccc2433)
mp2_ri_libint.F
Go to the documentation of this file.
1 !--------------------------------------------------------------------------------------------------!
2 ! CP2K: A general program to perform molecular dynamics simulations !
3 ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 ! !
5 ! SPDX-License-Identifier: GPL-2.0-or-later !
6 !--------------------------------------------------------------------------------------------------!
7 
8 ! **************************************************************************************************
9 !> \brief Routines to calculate the 3 and 2 center ERI's needed in the RI
10 !> approximation using libint
11 !> \par History
12 !> 08.2013 created [Mauro Del Ben]
13 !> \author Mauro Del Ben
14 ! **************************************************************************************************
16  USE atomic_kind_types, ONLY: atomic_kind_type,&
19  gto_basis_set_type,&
21  USE cell_types, ONLY: cell_type
24  cp_blacs_env_type
25  USE cp_control_types, ONLY: dft_control_type
26  USE cp_files, ONLY: close_file,&
27  open_file
32  cp_fm_struct_type
33  USE cp_fm_types, ONLY: cp_fm_create,&
35  cp_fm_release,&
37  cp_fm_type
38  USE gamma, ONLY: init_md_ftable
43  USE hfx_types, ONLY: &
44  hfx_basis_info_type, hfx_basis_type, hfx_create_neighbor_cells, hfx_pgf_list, &
45  hfx_pgf_product_list, hfx_potential_type, hfx_screen_coeff_type, hfx_type, log_zero, &
46  pair_set_list_type
49  USE kinds, ONLY: dp,&
50  int_8
51  USE libint_wrapper, ONLY: cp_libint_t
52  USE message_passing, ONLY: mp_para_env_type
53  USE mp2_types, ONLY: init_tshpsc_lmax,&
54  mp2_biel_type,&
55  mp2_type,&
56  pair_list_type_mp2
57  USE orbital_pointers, ONLY: nco,&
58  ncoset,&
59  nso
60  USE particle_types, ONLY: particle_type
61  USE qs_environment_types, ONLY: get_qs_env,&
62  qs_environment_type
63  USE qs_kind_types, ONLY: get_qs_kind,&
65  qs_kind_type
66  USE t_sh_p_s_c, ONLY: free_c0,&
67  init
68 #include "./base/base_uses.f90"
69 
70  IMPLICIT NONE
71  PRIVATE
72 
74 
75  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mp2_ri_libint'
76 
77 !***
78 
79 CONTAINS
80 
81 ! **************************************************************************************************
82 !> \brief ...
83 !> \param dimen ...
84 !> \param RI_dimen ...
85 !> \param occupied ...
86 !> \param natom ...
87 !> \param mp2_biel ...
88 !> \param mp2_env ...
89 !> \param C ...
90 !> \param kind_of ...
91 !> \param RI_basis_parameter ...
92 !> \param RI_basis_info ...
93 !> \param basis_S0 ...
94 !> \param RI_index_table ...
95 !> \param qs_env ...
96 !> \param para_env ...
97 !> \param Lai ...
98 ! **************************************************************************************************
99  SUBROUTINE libint_ri_mp2(dimen, RI_dimen, occupied, natom, mp2_biel, mp2_env, C, &
100  kind_of, &
101  RI_basis_parameter, RI_basis_info, basis_S0, RI_index_table, &
102  qs_env, para_env, &
103  Lai)
104  INTEGER :: dimen, ri_dimen, occupied, natom
105  TYPE(mp2_biel_type) :: mp2_biel
106  TYPE(mp2_type) :: mp2_env
107  REAL(kind=dp), DIMENSION(dimen, dimen) :: c
108  INTEGER, DIMENSION(:) :: kind_of
109  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: ri_basis_parameter
110  TYPE(hfx_basis_info_type) :: ri_basis_info
111  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_s0
112  INTEGER, ALLOCATABLE, DIMENSION(:, :) :: ri_index_table
113  TYPE(qs_environment_type), POINTER :: qs_env
114  TYPE(mp_para_env_type), POINTER :: para_env
115  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: lai
116 
117  CHARACTER(LEN=*), PARAMETER :: routinen = 'libint_ri_mp2'
118 
119  INTEGER :: handle, nkind
120 
121  CALL timeset(routinen, handle)
122 
123  ! Get the RI basis set and store in to a nice form
124  IF (.NOT. (ASSOCIATED(ri_basis_parameter))) THEN
125  IF (ALLOCATED(ri_index_table)) DEALLOCATE (ri_index_table)
126  IF (ASSOCIATED(basis_s0)) DEALLOCATE (basis_s0)
127  CALL read_ri_basis_set(qs_env, ri_basis_parameter, ri_basis_info, &
128  natom, nkind, kind_of, ri_index_table, ri_dimen, &
129  basis_s0)
130  END IF
131 
132  CALL calc_lai_libint(mp2_env, qs_env, para_env, &
133  mp2_biel, dimen, c, occupied, &
134  ri_basis_parameter, ri_basis_info, ri_index_table, ri_dimen, basis_s0, &
135  lai)
136 
137  CALL timestop(handle)
138 
139  END SUBROUTINE libint_ri_mp2
140 
141 ! **************************************************************************************************
142 !> \brief Read the auxiliary basis set for RI approxiamtion
143 !> \param qs_env ...
144 !> \param RI_basis_parameter ...
145 !> \param RI_basis_info ...
146 !> \param natom ...
147 !> \param nkind ...
148 !> \param kind_of ...
149 !> \param RI_index_table ...
150 !> \param RI_dimen ...
151 !> \param basis_S0 ...
152 !> \par History
153 !> 08.2013 created [Mauro Del Ben]
154 !> \author Mauro Del Ben
155 ! **************************************************************************************************
156  SUBROUTINE read_ri_basis_set(qs_env, RI_basis_parameter, RI_basis_info, &
157  natom, nkind, kind_of, RI_index_table, RI_dimen, &
158  basis_S0)
159  TYPE(qs_environment_type), POINTER :: qs_env
160  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: ri_basis_parameter
161  TYPE(hfx_basis_info_type) :: ri_basis_info
162  INTEGER :: natom, nkind
163  INTEGER, DIMENSION(:) :: kind_of
164  INTEGER, ALLOCATABLE, DIMENSION(:, :) :: ri_index_table
165  INTEGER :: ri_dimen
166  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_s0
167 
168  INTEGER :: co_counter, counter, i, iatom, ikind, ipgf, iset, j, k, la, max_am_kind, &
169  max_coeff, max_nsgfl, max_pgf, max_pgf_kind, max_set, nl_count, nset, nseta, offset_a, &
170  offset_a1, s_offset_nl_a, sgfa, so_counter
171  INTEGER, DIMENSION(:), POINTER :: la_max, la_min, npgfa, nshell
172  INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, nl_a
173  REAL(dp), DIMENSION(:, :), POINTER :: sphi_a
174  TYPE(gto_basis_set_type), POINTER :: orb_basis_a
175  TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
176  TYPE(qs_kind_type), POINTER :: atom_kind
177 
178  NULLIFY (ri_basis_parameter)
179 
180  NULLIFY (qs_kind_set)
181  CALL get_qs_env(qs_env=qs_env, qs_kind_set=qs_kind_set)
182 
183  nkind = SIZE(qs_kind_set, 1)
184  ALLOCATE (ri_basis_parameter(nkind))
185  ALLOCATE (basis_s0(nkind))
186  max_set = 0
187  DO ikind = 1, nkind
188  NULLIFY (atom_kind)
189  atom_kind => qs_kind_set(ikind)
190  ! here we reset the initial RI basis such that we can
191  ! work with non-normalized auxiliary basis functions
192  CALL get_qs_kind(qs_kind=atom_kind, &
193  basis_set=orb_basis_a, basis_type="RI_AUX")
194  IF (.NOT. (ASSOCIATED(orb_basis_a))) THEN
195  cpabort("Initial RI auxiliary basis not specified.")
196  END IF
197  orb_basis_a%gcc = 1.0_dp
198  orb_basis_a%norm_type = 1
199  CALL init_aux_basis_set(orb_basis_a)
200 
201  CALL get_qs_kind_set(qs_kind_set=qs_kind_set, &
202  maxsgf=ri_basis_info%max_sgf, &
203  maxnset=ri_basis_info%max_set, &
204  maxlgto=ri_basis_info%max_am, &
205  basis_type="RI_AUX")
206  CALL get_gto_basis_set(gto_basis_set=orb_basis_a, &
207  lmax=ri_basis_parameter(ikind)%lmax, &
208  lmin=ri_basis_parameter(ikind)%lmin, &
209  npgf=ri_basis_parameter(ikind)%npgf, &
210  nset=ri_basis_parameter(ikind)%nset, &
211  zet=ri_basis_parameter(ikind)%zet, &
212  nsgf_set=ri_basis_parameter(ikind)%nsgf, &
213  first_sgf=ri_basis_parameter(ikind)%first_sgf, &
214  sphi=ri_basis_parameter(ikind)%sphi, &
215  nsgf=ri_basis_parameter(ikind)%nsgf_total, &
216  l=ri_basis_parameter(ikind)%nl, &
217  nshell=ri_basis_parameter(ikind)%nshell, &
218  set_radius=ri_basis_parameter(ikind)%set_radius, &
219  pgf_radius=ri_basis_parameter(ikind)%pgf_radius, &
220  kind_radius=ri_basis_parameter(ikind)%kind_radius)
221 
222  max_set = max(max_set, ri_basis_parameter(ikind)%nset)
223 
224  basis_s0(ikind)%kind_radius = ri_basis_parameter(ikind)%kind_radius
225  basis_s0(ikind)%nset = 1
226  basis_s0(ikind)%nsgf_total = 1
227  ALLOCATE (basis_s0(ikind)%set_radius(1))
228  basis_s0(ikind)%set_radius(1) = ri_basis_parameter(ikind)%kind_radius
229  ALLOCATE (basis_s0(ikind)%lmax(1))
230  basis_s0(ikind)%lmax(1) = 0
231  ALLOCATE (basis_s0(ikind)%lmin(1))
232  basis_s0(ikind)%lmin(1) = 0
233  ALLOCATE (basis_s0(ikind)%npgf(1))
234  basis_s0(ikind)%npgf(1) = 1
235  ALLOCATE (basis_s0(ikind)%nsgf(1))
236  basis_s0(ikind)%nsgf(1) = 1
237  ALLOCATE (basis_s0(ikind)%nshell(1))
238  basis_s0(ikind)%nshell(1) = 1
239  ALLOCATE (basis_s0(ikind)%pgf_radius(1, 1))
240  basis_s0(ikind)%pgf_radius(1, 1) = ri_basis_parameter(ikind)%kind_radius
241  ALLOCATE (basis_s0(ikind)%sphi(1, 1))
242  basis_s0(ikind)%sphi(1, 1) = 1.0_dp
243  ALLOCATE (basis_s0(ikind)%zet(1, 1))
244  basis_s0(ikind)%zet(1, 1) = 0.0_dp
245  ALLOCATE (basis_s0(ikind)%first_sgf(1, 1))
246  basis_s0(ikind)%first_sgf(1, 1) = 1
247  ALLOCATE (basis_s0(ikind)%nl(1, 1))
248  basis_s0(ikind)%nl(1, 1) = 0
249 
250  ALLOCATE (basis_s0(ikind)%nsgfl(0:0, 1))
251  basis_s0(ikind)%nsgfl = 1
252  ALLOCATE (basis_s0(ikind)%sphi_ext(1, 0:0, 1, 1))
253  basis_s0(ikind)%sphi_ext(1, 0, 1, 1) = 1.0_dp
254 
255  END DO
256  ri_basis_info%max_set = max_set
257 
258  DO ikind = 1, nkind
259  ALLOCATE (ri_basis_parameter(ikind)%nsgfl(0:ri_basis_info%max_am, max_set))
260  ri_basis_parameter(ikind)%nsgfl = 0
261  nset = ri_basis_parameter(ikind)%nset
262  nshell => ri_basis_parameter(ikind)%nshell
263  DO iset = 1, nset
264  DO i = 0, ri_basis_info%max_am
265  nl_count = 0
266  DO j = 1, nshell(iset)
267  IF (ri_basis_parameter(ikind)%nl(j, iset) == i) nl_count = nl_count + 1
268  END DO
269  ri_basis_parameter(ikind)%nsgfl(i, iset) = nl_count
270  END DO
271  END DO
272  END DO
273 
274  max_nsgfl = 0
275  max_pgf = 0
276  DO ikind = 1, nkind
277  max_coeff = 0
278  max_am_kind = 0
279  max_pgf_kind = 0
280  npgfa => ri_basis_parameter(ikind)%npgf
281  nseta = ri_basis_parameter(ikind)%nset
282  nl_a => ri_basis_parameter(ikind)%nsgfl
283  la_max => ri_basis_parameter(ikind)%lmax
284  la_min => ri_basis_parameter(ikind)%lmin
285  DO iset = 1, nseta
286  max_pgf_kind = max(max_pgf_kind, npgfa(iset))
287  max_pgf = max(max_pgf, npgfa(iset))
288  DO la = la_min(iset), la_max(iset)
289  max_nsgfl = max(max_nsgfl, nl_a(la, iset))
290  max_coeff = max(max_coeff, nso(la)*nl_a(la, iset)*nco(la))
291  max_am_kind = max(max_am_kind, la)
292  END DO
293  END DO
294  ALLOCATE (ri_basis_parameter(ikind)%sphi_ext(max_coeff, 0:max_am_kind, max_pgf_kind, nseta))
295  ri_basis_parameter(ikind)%sphi_ext = 0.0_dp
296  END DO
297 
298  DO ikind = 1, nkind
299  sphi_a => ri_basis_parameter(ikind)%sphi
300  nseta = ri_basis_parameter(ikind)%nset
301  la_max => ri_basis_parameter(ikind)%lmax
302  la_min => ri_basis_parameter(ikind)%lmin
303  npgfa => ri_basis_parameter(ikind)%npgf
304  first_sgfa => ri_basis_parameter(ikind)%first_sgf
305  nl_a => ri_basis_parameter(ikind)%nsgfl
306  DO iset = 1, nseta
307  sgfa = first_sgfa(1, iset)
308  DO ipgf = 1, npgfa(iset)
309  offset_a1 = (ipgf - 1)*ncoset(la_max(iset))
310  s_offset_nl_a = 0
311  DO la = la_min(iset), la_max(iset)
312  offset_a = offset_a1 + ncoset(la - 1)
313  co_counter = 0
314  co_counter = co_counter + 1
315  so_counter = 0
316  DO k = sgfa + s_offset_nl_a, sgfa + s_offset_nl_a + nso(la)*nl_a(la, iset) - 1
317  DO i = offset_a + 1, offset_a + nco(la)
318  so_counter = so_counter + 1
319  ri_basis_parameter(ikind)%sphi_ext(so_counter, la, ipgf, iset) = sphi_a(i, k)
320  END DO
321  END DO
322  s_offset_nl_a = s_offset_nl_a + nso(la)*(nl_a(la, iset))
323  END DO
324  END DO
325  END DO
326  END DO
327 
328  ALLOCATE (ri_index_table(natom, max_set))
329  ri_index_table = -huge(0)
330  counter = 0
331  ri_dimen = 0
332  DO iatom = 1, natom
333  ikind = kind_of(iatom)
334  nset = ri_basis_parameter(ikind)%nset
335  DO iset = 1, nset
336  ri_index_table(iatom, iset) = counter + 1
337  counter = counter + ri_basis_parameter(ikind)%nsgf(iset)
338  ri_dimen = ri_dimen + ri_basis_parameter(ikind)%nsgf(iset)
339  END DO
340  END DO
341 
342  END SUBROUTINE read_ri_basis_set
343 
344 ! **************************************************************************************************
345 !> \brief Release the auxiliary basis set for RI approxiamtion (to be used
346 !> only in the case of basis optimization)
347 !> \param RI_basis_parameter ...
348 !> \param basis_S0 ...
349 !> \par History
350 !> 08.2013 created [Mauro Del Ben]
351 !> \author Mauro Del Ben
352 ! **************************************************************************************************
353  SUBROUTINE release_ri_basis_set(RI_basis_parameter, basis_S0)
354  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: ri_basis_parameter, basis_s0
355 
356  INTEGER :: i
357 
358 ! RI basis
359 
360  DO i = 1, SIZE(ri_basis_parameter)
361  DEALLOCATE (ri_basis_parameter(i)%nsgfl)
362  DEALLOCATE (ri_basis_parameter(i)%sphi_ext)
363  END DO
364  DEALLOCATE (ri_basis_parameter)
365 
366  ! S0 basis
367  DO i = 1, SIZE(basis_s0)
368  DEALLOCATE (basis_s0(i)%set_radius)
369  DEALLOCATE (basis_s0(i)%lmax)
370  DEALLOCATE (basis_s0(i)%lmin)
371  DEALLOCATE (basis_s0(i)%npgf)
372  DEALLOCATE (basis_s0(i)%nsgf)
373  DEALLOCATE (basis_s0(i)%nshell)
374  DEALLOCATE (basis_s0(i)%pgf_radius)
375  DEALLOCATE (basis_s0(i)%sphi)
376  DEALLOCATE (basis_s0(i)%zet)
377  DEALLOCATE (basis_s0(i)%first_sgf)
378  DEALLOCATE (basis_s0(i)%nl)
379  DEALLOCATE (basis_s0(i)%nsgfl)
380  DEALLOCATE (basis_s0(i)%sphi_ext)
381  END DO
382  DEALLOCATE (basis_s0)
383 
384  END SUBROUTINE release_ri_basis_set
385 
386 ! **************************************************************************************************
387 !> \brief ...
388 !> \param mp2_env ...
389 !> \param qs_env ...
390 !> \param para_env ...
391 !> \param mp2_biel ...
392 !> \param dimen ...
393 !> \param C ...
394 !> \param occupied ...
395 !> \param RI_basis_parameter ...
396 !> \param RI_basis_info ...
397 !> \param RI_index_table ...
398 !> \param RI_dimen ...
399 !> \param basis_S0 ...
400 !> \param Lai ...
401 !> \par History
402 !> 08.2013 created [Mauro Del Ben]
403 !> \author Mauro Del Ben
404 ! **************************************************************************************************
405  SUBROUTINE calc_lai_libint(mp2_env, qs_env, para_env, &
406  mp2_biel, dimen, C, occupied, &
407  RI_basis_parameter, RI_basis_info, RI_index_table, RI_dimen, basis_S0, &
408  Lai)
409 
410  TYPE(mp2_type) :: mp2_env
411  TYPE(qs_environment_type), POINTER :: qs_env
412  TYPE(mp_para_env_type), POINTER :: para_env
413  TYPE(mp2_biel_type) :: mp2_biel
414  INTEGER :: dimen
415  REAL(kind=dp), DIMENSION(dimen, dimen) :: c
416  INTEGER :: occupied
417  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: ri_basis_parameter
418  TYPE(hfx_basis_info_type) :: ri_basis_info
419  INTEGER, ALLOCATABLE, DIMENSION(:, :) :: ri_index_table
420  INTEGER :: ri_dimen
421  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_s0
422  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: lai
423 
424  CHARACTER(LEN=*), PARAMETER :: routinen = 'calc_lai_libint'
425 
426  INTEGER :: counter_l_blocks, handle, i, i_list_kl, i_set_list_kl, i_set_list_kl_start, &
427  i_set_list_kl_stop, iatom, iatom_end, iatom_start, iib, ikind, info_chol, iset, jatom, &
428  jatom_end, jatom_start, jjb, jkind, jset, katom, katom_end, katom_start, kkb, kkind, &
429  kset, kset_start, l_b_i_end, l_b_i_start, l_b_k_end, l_b_k_start, latom, latom_end, &
430  latom_start, lkind, llb, lset, max_pgf, max_set, natom, ncob, nints, nseta, nsetb, nsetc, &
431  nsetd, nsgf_max, nspins, orb_k_end, orb_k_start, orb_l_end, orb_l_start, &
432  primitive_counter, sphi_a_u1, sphi_a_u2, sphi_a_u3, sphi_b_u1, sphi_b_u2, sphi_b_u3
433  INTEGER :: sphi_c_u1, sphi_c_u2, sphi_c_u3, sphi_d_u1, sphi_d_u2, sphi_d_u3, virtual
434  INTEGER(int_8) :: estimate_to_store_int, neris_tmp, &
435  neris_total, nprim_ints
436  INTEGER, ALLOCATABLE, DIMENSION(:) :: kind_of, nimages
437  INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, lc_max, &
438  lc_min, ld_max, ld_min, npgfa, npgfb, &
439  npgfc, npgfd, nsgfa, nsgfb, nsgfc, &
440  nsgfd
441  INTEGER, DIMENSION(:, :), POINTER :: nsgfl_a, nsgfl_b, nsgfl_c, nsgfl_d
442  LOGICAL :: do_periodic
443  LOGICAL, DIMENSION(:, :), POINTER :: shm_atomic_pair_list
444  REAL(kind=dp) :: cartesian_estimate, coeffs_kind_max0, eps_schwarz, ln_10, &
445  log10_eps_schwarz, log10_pmax, max_contraction_val, pmax_atom, pmax_entry, ra(3), rb(3), &
446  rc(3), rd(3)
447  REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: ee_buffer1, ee_buffer2, &
448  ee_primitives_tmp, ee_work, ee_work2, &
449  primitive_integrals
450  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: l_block, l_full_matrix, max_contraction
451  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: bi1, mnrs
452  REAL(kind=dp), DIMENSION(:), POINTER :: p_work
453  REAL(kind=dp), DIMENSION(:, :), POINTER :: shm_pmax_block, zeta, zetb, zetc, zetd
454  REAL(kind=dp), DIMENSION(:, :, :), POINTER :: sphi_a_ext_set, sphi_b_ext_set, &
455  sphi_c_ext_set, sphi_d_ext_set
456  REAL(kind=dp), DIMENSION(:, :, :, :), POINTER :: sphi_a_ext, sphi_b_ext, sphi_c_ext, &
457  sphi_d_ext
458  TYPE(cell_type), POINTER :: cell
459  TYPE(cp_blacs_env_type), POINTER :: blacs_env
460  TYPE(cp_fm_struct_type), POINTER :: fm_struct_l
461  TYPE(cp_fm_type) :: fm_matrix_l
462  TYPE(cp_libint_t) :: private_lib
463  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_parameter
464  TYPE(hfx_pgf_list), ALLOCATABLE, DIMENSION(:) :: pgf_list_ij, pgf_list_kl
465  TYPE(hfx_pgf_product_list), ALLOCATABLE, &
466  DIMENSION(:) :: pgf_product_list
467  TYPE(hfx_potential_type) :: mp2_potential_parameter
468  TYPE(hfx_screen_coeff_type), ALLOCATABLE, &
469  DIMENSION(:, :), TARGET :: radii_pgf_large, screen_coeffs_pgf_large
470  TYPE(hfx_screen_coeff_type), DIMENSION(:, :), &
471  POINTER :: screen_coeffs_kind, tmp_r_1, tmp_r_2, &
472  tmp_screen_pgf1, tmp_screen_pgf2
473  TYPE(hfx_screen_coeff_type), &
474  DIMENSION(:, :, :, :), POINTER :: screen_coeffs_set
475  TYPE(hfx_screen_coeff_type), &
476  DIMENSION(:, :, :, :, :, :), POINTER :: radii_pgf, screen_coeffs_pgf
477  TYPE(hfx_type), POINTER :: actual_x_data
478  TYPE(pair_list_type_mp2) :: list_kl
479  TYPE(pair_set_list_type), ALLOCATABLE, &
480  DIMENSION(:) :: set_list_kl
481  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
482 
483  CALL timeset(routinen, handle)
484 
485  ln_10 = log(10.0_dp)
486 
487  !! initialize some counters
488  neris_tmp = 0_int_8
489  neris_total = 0_int_8
490  nprim_ints = 0_int_8
491 
492  CALL prepare_integral_calc(cell, qs_env, mp2_env, para_env, mp2_potential_parameter, actual_x_data, &
493  do_periodic, basis_parameter, max_set, particle_set, natom, kind_of, &
494  nsgf_max, primitive_integrals, ee_work, ee_work2, ee_buffer1, ee_buffer2, &
495  ee_primitives_tmp, nspins, max_contraction, max_pgf, pgf_list_ij, &
496  pgf_list_kl, pgf_product_list, nimages, eps_schwarz, log10_eps_schwarz, &
497  private_lib, p_work, screen_coeffs_set, screen_coeffs_kind, screen_coeffs_pgf, &
498  radii_pgf, ri_basis_parameter, ri_basis_info)
499 
500  ALLOCATE (radii_pgf_large(SIZE(radii_pgf, 1), SIZE(radii_pgf, 2)))
501  ALLOCATE (screen_coeffs_pgf_large(SIZE(screen_coeffs_pgf, 1), SIZE(screen_coeffs_pgf, 2)))
502  DO iib = 1, SIZE(radii_pgf, 1)
503  DO jjb = 1, SIZE(radii_pgf, 2)
504  radii_pgf_large(iib, jjb)%x = 100_dp
505  END DO
506  END DO
507  DO iib = 1, SIZE(screen_coeffs_pgf, 1)
508  DO jjb = 1, SIZE(screen_coeffs_pgf, 2)
509  screen_coeffs_pgf_large(iib, jjb)%x = 5000_dp
510  END DO
511  END DO
512  tmp_r_1 => radii_pgf_large(:, :)
513  tmp_r_2 => radii_pgf_large(:, :)
514  tmp_screen_pgf1 => screen_coeffs_pgf_large(:, :)
515  tmp_screen_pgf2 => screen_coeffs_pgf_large(:, :)
516 
517  ! start computing the L matrix
518  ALLOCATE (l_full_matrix(ri_dimen, ri_dimen))
519  l_full_matrix = 0.0_dp
520 
521  counter_l_blocks = 0
522  DO iatom = 1, natom
523  jatom = iatom
524 
525  ikind = kind_of(iatom)
526  jkind = kind_of(jatom)
527  ra = particle_set(iatom)%r(:)
528  rb = particle_set(jatom)%r(:)
529 
530  la_max => ri_basis_parameter(ikind)%lmax
531  la_min => ri_basis_parameter(ikind)%lmin
532  npgfa => ri_basis_parameter(ikind)%npgf
533  nseta = ri_basis_parameter(ikind)%nset
534  zeta => ri_basis_parameter(ikind)%zet
535  nsgfa => ri_basis_parameter(ikind)%nsgf
536  sphi_a_ext => ri_basis_parameter(ikind)%sphi_ext(:, :, :, :)
537  nsgfl_a => ri_basis_parameter(ikind)%nsgfl
538  sphi_a_u1 = ubound(sphi_a_ext, 1)
539  sphi_a_u2 = ubound(sphi_a_ext, 2)
540  sphi_a_u3 = ubound(sphi_a_ext, 3)
541 
542  lb_max => basis_s0(jkind)%lmax
543  lb_min => basis_s0(jkind)%lmin
544  npgfb => basis_s0(jkind)%npgf
545  nsetb = basis_s0(jkind)%nset
546  zetb => basis_s0(jkind)%zet
547  nsgfb => basis_s0(jkind)%nsgf
548  sphi_b_ext => basis_s0(jkind)%sphi_ext(:, :, :, :)
549  nsgfl_b => basis_s0(jkind)%nsgfl
550  sphi_b_u1 = ubound(sphi_b_ext, 1)
551  sphi_b_u2 = ubound(sphi_b_ext, 2)
552  sphi_b_u3 = ubound(sphi_b_ext, 3)
553 
554  DO katom = iatom, natom
555  latom = katom
556 
557  kkind = kind_of(katom)
558  lkind = kind_of(latom)
559  rc = particle_set(katom)%r(:)
560  rd = particle_set(latom)%r(:)
561 
562  lc_max => ri_basis_parameter(kkind)%lmax
563  lc_min => ri_basis_parameter(kkind)%lmin
564  npgfc => ri_basis_parameter(kkind)%npgf
565  nsetc = ri_basis_parameter(kkind)%nset
566  zetc => ri_basis_parameter(kkind)%zet
567  nsgfc => ri_basis_parameter(kkind)%nsgf
568  sphi_c_ext => ri_basis_parameter(kkind)%sphi_ext(:, :, :, :)
569  nsgfl_c => ri_basis_parameter(kkind)%nsgfl
570  sphi_c_u1 = ubound(sphi_c_ext, 1)
571  sphi_c_u2 = ubound(sphi_c_ext, 2)
572  sphi_c_u3 = ubound(sphi_c_ext, 3)
573 
574  ld_max => basis_s0(lkind)%lmax
575  ld_min => basis_s0(lkind)%lmin
576  npgfd => basis_s0(lkind)%npgf
577  nsetd = ri_basis_parameter(lkind)%nset
578  zetd => basis_s0(lkind)%zet
579  nsgfd => basis_s0(lkind)%nsgf
580  sphi_d_ext => basis_s0(lkind)%sphi_ext(:, :, :, :)
581  nsgfl_d => basis_s0(lkind)%nsgfl
582  sphi_d_u1 = ubound(sphi_d_ext, 1)
583  sphi_d_u2 = ubound(sphi_d_ext, 2)
584  sphi_d_u3 = ubound(sphi_d_ext, 3)
585 
586  jset = 1
587  lset = 1
588  DO iset = 1, nseta
589 
590  ncob = npgfb(jset)*ncoset(lb_max(jset))
591  sphi_a_ext_set => sphi_a_ext(:, :, :, iset)
592  sphi_b_ext_set => sphi_b_ext(:, :, :, jset)
593 
594  l_b_i_start = ri_index_table(iatom, iset)
595  l_b_i_end = ri_index_table(iatom, iset) + nsgfa(iset) - 1
596 
597  kset_start = 1
598  IF (iatom == katom) kset_start = iset
599  DO kset = kset_start, nsetc
600 
601  counter_l_blocks = counter_l_blocks + 1
602  IF (mod(counter_l_blocks, para_env%num_pe) /= para_env%mepos) cycle
603 
604  sphi_c_ext_set => sphi_c_ext(:, :, :, kset)
605  sphi_d_ext_set => sphi_d_ext(:, :, :, lset)
606 
607  l_b_k_start = ri_index_table(katom, kset)
608  l_b_k_end = ri_index_table(katom, kset) + nsgfc(kset) - 1
609 
610  pmax_entry = 0.0_dp
611  log10_pmax = pmax_entry
612  log10_eps_schwarz = log_zero
613 
614  max_contraction_val = 1.0000_dp
615 
616  ALLOCATE (l_block(nsgfa(iset), nsgfc(kset)))
617 
618  CALL coulomb4(private_lib, ra, rb, rc, rd, npgfa(iset), npgfb(jset), npgfc(kset), npgfd(lset), &
619  la_min(iset), la_max(iset), lb_min(jset), lb_max(jset), &
620  lc_min(kset), lc_max(kset), ld_min(lset), ld_max(lset), &
621  nsgfa(iset), nsgfb(jset), nsgfc(kset), nsgfd(lset), &
622  sphi_a_u1, sphi_a_u2, sphi_a_u3, &
623  sphi_b_u1, sphi_b_u2, sphi_b_u3, &
624  sphi_c_u1, sphi_c_u2, sphi_c_u3, &
625  sphi_d_u1, sphi_d_u2, sphi_d_u3, &
626  zeta(1:npgfa(iset), iset), zetb(1:npgfb(jset), jset), &
627  zetc(1:npgfc(kset), kset), zetd(1:npgfd(lset), lset), &
628  primitive_integrals, &
629  mp2_potential_parameter, &
630  actual_x_data%neighbor_cells, screen_coeffs_set(1, 1, 1, 1)%x, &
631  screen_coeffs_set(1, 1, 1, 1)%x, eps_schwarz, &
632  max_contraction_val, cartesian_estimate, cell, neris_tmp, &
633  log10_pmax, log10_eps_schwarz, &
634  tmp_r_1, tmp_r_2, tmp_screen_pgf1, tmp_screen_pgf2, &
635  pgf_list_ij, pgf_list_kl, pgf_product_list, &
636  nsgfl_a(:, iset), nsgfl_b(:, jset), &
637  nsgfl_c(:, kset), nsgfl_d(:, lset), &
638  sphi_a_ext_set, &
639  sphi_b_ext_set, &
640  sphi_c_ext_set, &
641  sphi_d_ext_set, &
642  ee_work, ee_work2, ee_buffer1, ee_buffer2, ee_primitives_tmp, &
643  nimages, do_periodic, p_work)
644 
645  primitive_counter = 0
646  DO llb = 1, nsgfd(lset)
647  DO kkb = 1, nsgfc(kset)
648  DO jjb = 1, nsgfb(jset)
649  DO iib = 1, nsgfa(iset)
650  primitive_counter = primitive_counter + 1
651  l_block(iib, kkb) = primitive_integrals(primitive_counter)
652  END DO
653  END DO
654  END DO
655  END DO
656 
657  l_full_matrix(l_b_i_start:l_b_i_end, l_b_k_start:l_b_k_end) = l_block
658  l_full_matrix(l_b_k_start:l_b_k_end, l_b_i_start:l_b_i_end) = transpose(l_block)
659 
660  DEALLOCATE (l_block)
661 
662  END DO ! kset
663  END DO ! iset
664 
665  END DO !katom
666  END DO !iatom
667 
668  ! now create a fm_matrix for the L matrix
669  CALL para_env%sum(l_full_matrix)
670 
671  ! create a sub blacs_env
672  NULLIFY (blacs_env)
673  CALL cp_blacs_env_create(blacs_env=blacs_env, para_env=para_env)
674 
675  NULLIFY (fm_struct_l)
676  CALL cp_fm_struct_create(fm_struct_l, context=blacs_env, nrow_global=ri_dimen, &
677  ncol_global=ri_dimen, para_env=para_env)
678  CALL cp_fm_create(fm_matrix_l, fm_struct_l, name="fm_matrix_L")
679  CALL cp_fm_struct_release(fm_struct_l)
680  CALL cp_blacs_env_release(blacs_env)
681 
682  CALL cp_fm_set_submatrix(fm=fm_matrix_l, new_values=l_full_matrix, start_row=1, start_col=1, &
683  n_rows=ri_dimen, n_cols=ri_dimen)
684 
685  info_chol = 0
686  CALL cp_fm_cholesky_decompose(matrix=fm_matrix_l, n=ri_dimen, info_out=info_chol)
687  cpassert(info_chol == 0)
688 
689  ! triangual invert
690  CALL cp_fm_triangular_invert(matrix_a=fm_matrix_l, uplo_tr='U')
691 
692  ! replicate L matrix to each proc
693  l_full_matrix = 0.0_dp
694  CALL cp_fm_get_submatrix(fm_matrix_l, l_full_matrix, 1, 1, ri_dimen, ri_dimen, .false.)
695  CALL cp_fm_release(fm_matrix_l)
696 
697  ! clean lower part
698  DO iib = 1, ri_dimen
699  l_full_matrix(iib + 1:ri_dimen, iib) = 0.0_dp
700  END DO
701 
702  ALLOCATE (list_kl%elements(natom**2))
703 
704  coeffs_kind_max0 = maxval(screen_coeffs_kind(:, :)%x(2))
705  ALLOCATE (set_list_kl((max_set*natom)**2))
706 
707  !! precalculate maximum density matrix elements in blocks
708  actual_x_data%pmax_block = 0.0_dp
709  shm_pmax_block => actual_x_data%pmax_block
710 
711  shm_atomic_pair_list => actual_x_data%atomic_pair_list
712 
713  iatom_start = 1
714  iatom_end = natom
715  jatom_start = 1
716  jatom_end = natom
717  katom_start = 1
718  katom_end = natom
719  latom_start = 1
720  latom_end = natom
721 
722  CALL build_pair_list_mp2(natom, list_kl, set_list_kl, katom_start, katom_end, &
723  latom_start, latom_end, &
724  kind_of, basis_parameter, particle_set, &
725  do_periodic, screen_coeffs_set, screen_coeffs_kind, &
726  coeffs_kind_max0, log10_eps_schwarz, cell, 0.d+00, &
727  shm_atomic_pair_list)
728 
729  virtual = dimen - occupied
730 
731  ALLOCATE (lai(ri_dimen, virtual, occupied))
732  lai = 0.0_dp
733 
734  DO iatom = 1, natom
735  jatom = iatom
736 
737  ikind = kind_of(iatom)
738  jkind = kind_of(jatom)
739  ra = particle_set(iatom)%r(:)
740  rb = particle_set(jatom)%r(:)
741 
742  la_max => ri_basis_parameter(ikind)%lmax
743  la_min => ri_basis_parameter(ikind)%lmin
744  npgfa => ri_basis_parameter(ikind)%npgf
745  nseta = ri_basis_parameter(ikind)%nset
746  zeta => ri_basis_parameter(ikind)%zet
747  nsgfa => ri_basis_parameter(ikind)%nsgf
748  sphi_a_ext => ri_basis_parameter(ikind)%sphi_ext(:, :, :, :)
749  nsgfl_a => ri_basis_parameter(ikind)%nsgfl
750  sphi_a_u1 = ubound(sphi_a_ext, 1)
751  sphi_a_u2 = ubound(sphi_a_ext, 2)
752  sphi_a_u3 = ubound(sphi_a_ext, 3)
753 
754  lb_max => basis_s0(jkind)%lmax
755  lb_min => basis_s0(jkind)%lmin
756  npgfb => basis_s0(jkind)%npgf
757  nsetb = basis_s0(jkind)%nset
758  zetb => basis_s0(jkind)%zet
759  nsgfb => basis_s0(jkind)%nsgf
760  sphi_b_ext => basis_s0(jkind)%sphi_ext(:, :, :, :)
761  nsgfl_b => basis_s0(jkind)%nsgfl
762  sphi_b_u1 = ubound(sphi_b_ext, 1)
763  sphi_b_u2 = ubound(sphi_b_ext, 2)
764  sphi_b_u3 = ubound(sphi_b_ext, 3)
765 
766  jset = 1
767  DO iset = 1, nseta
768 
769  counter_l_blocks = counter_l_blocks + 1
770  IF (mod(counter_l_blocks, para_env%num_pe) /= para_env%mepos) cycle
771 
772  ncob = npgfb(jset)*ncoset(lb_max(jset))
773  sphi_a_ext_set => sphi_a_ext(:, :, :, iset)
774  sphi_b_ext_set => sphi_b_ext(:, :, :, jset)
775 
776  l_b_i_start = ri_index_table(iatom, iset)
777  l_b_i_end = ri_index_table(iatom, iset) + nsgfa(iset) - 1
778 
779  ALLOCATE (bi1(dimen, dimen, nsgfa(iset)))
780  bi1 = 0.0_dp
781 
782  DO i_list_kl = 1, list_kl%n_element
783 
784  katom = list_kl%elements(i_list_kl)%pair(1)
785  latom = list_kl%elements(i_list_kl)%pair(2)
786 
787  i_set_list_kl_start = list_kl%elements(i_list_kl)%set_bounds(1)
788  i_set_list_kl_stop = list_kl%elements(i_list_kl)%set_bounds(2)
789  kkind = list_kl%elements(i_list_kl)%kind_pair(1)
790  lkind = list_kl%elements(i_list_kl)%kind_pair(2)
791  rc = list_kl%elements(i_list_kl)%r1
792  rd = list_kl%elements(i_list_kl)%r2
793 
794  pmax_atom = 0.0_dp
795 
796  lc_max => basis_parameter(kkind)%lmax
797  lc_min => basis_parameter(kkind)%lmin
798  npgfc => basis_parameter(kkind)%npgf
799  zetc => basis_parameter(kkind)%zet
800  nsgfc => basis_parameter(kkind)%nsgf
801  sphi_c_ext => basis_parameter(kkind)%sphi_ext(:, :, :, :)
802  nsgfl_c => basis_parameter(kkind)%nsgfl
803  sphi_c_u1 = ubound(sphi_c_ext, 1)
804  sphi_c_u2 = ubound(sphi_c_ext, 2)
805  sphi_c_u3 = ubound(sphi_c_ext, 3)
806 
807  ld_max => basis_parameter(lkind)%lmax
808  ld_min => basis_parameter(lkind)%lmin
809  npgfd => basis_parameter(lkind)%npgf
810  zetd => basis_parameter(lkind)%zet
811  nsgfd => basis_parameter(lkind)%nsgf
812  sphi_d_ext => basis_parameter(lkind)%sphi_ext(:, :, :, :)
813  nsgfl_d => basis_parameter(lkind)%nsgfl
814  sphi_d_u1 = ubound(sphi_d_ext, 1)
815  sphi_d_u2 = ubound(sphi_d_ext, 2)
816  sphi_d_u3 = ubound(sphi_d_ext, 3)
817 
818  DO i_set_list_kl = i_set_list_kl_start, i_set_list_kl_stop
819  kset = set_list_kl(i_set_list_kl)%pair(1)
820  lset = set_list_kl(i_set_list_kl)%pair(2)
821 
822  IF (katom == latom .AND. lset < kset) cycle
823 
824  orb_k_start = mp2_biel%index_table(katom, kset)
825  orb_k_end = orb_k_start + nsgfc(kset) - 1
826  orb_l_start = mp2_biel%index_table(latom, lset)
827  orb_l_end = orb_l_start + nsgfd(lset) - 1
828 
829  !! get max_vals if we screen on initial density
830  pmax_entry = 0.0_dp
831 
832  sphi_c_ext_set => sphi_c_ext(:, :, :, kset)
833  sphi_d_ext_set => sphi_d_ext(:, :, :, lset)
834 
835  log10_pmax = pmax_entry
836  log10_eps_schwarz = log_zero
837 
838  IF (ALLOCATED(mnrs)) DEALLOCATE (mnrs)
839  ALLOCATE (mnrs(nsgfd(lset), nsgfc(kset), nsgfa(iset)))
840 
841  mnrs = 0.0_dp
842 
843  max_contraction_val = max_contraction(kset, katom)*max_contraction(lset, latom)
844 
845  CALL coulomb4(private_lib, ra, rb, rc, rd, npgfa(iset), npgfb(jset), npgfc(kset), npgfd(lset), &
846  la_min(iset), la_max(iset), lb_min(jset), lb_max(jset), &
847  lc_min(kset), lc_max(kset), ld_min(lset), ld_max(lset), &
848  nsgfa(iset), nsgfb(jset), nsgfc(kset), nsgfd(lset), &
849  sphi_a_u1, sphi_a_u2, sphi_a_u3, &
850  sphi_b_u1, sphi_b_u2, sphi_b_u3, &
851  sphi_c_u1, sphi_c_u2, sphi_c_u3, &
852  sphi_d_u1, sphi_d_u2, sphi_d_u3, &
853  zeta(1:npgfa(iset), iset), zetb(1:npgfb(jset), jset), &
854  zetc(1:npgfc(kset), kset), zetd(1:npgfd(lset), lset), &
855  primitive_integrals, &
856  mp2_potential_parameter, &
857  actual_x_data%neighbor_cells, screen_coeffs_set(kset, kset, kkind, kkind)%x, &
858  screen_coeffs_set(kset, kset, kkind, kkind)%x, eps_schwarz, &
859  max_contraction_val, cartesian_estimate, cell, neris_tmp, &
860  log10_pmax, log10_eps_schwarz, &
861  tmp_r_1, tmp_r_2, tmp_screen_pgf1, tmp_screen_pgf2, &
862  pgf_list_ij, pgf_list_kl, pgf_product_list, &
863  nsgfl_a(:, iset), nsgfl_b(:, jset), &
864  nsgfl_c(:, kset), nsgfl_d(:, lset), &
865  sphi_a_ext_set, &
866  sphi_b_ext_set, &
867  sphi_c_ext_set, &
868  sphi_d_ext_set, &
869  ee_work, ee_work2, ee_buffer1, ee_buffer2, ee_primitives_tmp, &
870  nimages, do_periodic, p_work)
871 
872  nints = nsgfa(iset)*nsgfb(jset)*nsgfc(kset)*nsgfd(lset)
873  neris_total = neris_total + nints
874  nprim_ints = nprim_ints + neris_tmp
875  IF (cartesian_estimate == 0.0_dp) cartesian_estimate = tiny(cartesian_estimate)
876  estimate_to_store_int = exponent(cartesian_estimate)
877  estimate_to_store_int = max(estimate_to_store_int, -15_int_8)
878  cartesian_estimate = set_exponent(1.0_dp, estimate_to_store_int + 1)
879 
880  primitive_counter = 0
881  DO llb = 1, nsgfd(lset)
882  DO kkb = 1, nsgfc(kset)
883  DO jjb = 1, nsgfb(jset)
884  DO iib = 1, nsgfa(iset)
885  primitive_counter = primitive_counter + 1
886  mnrs(llb, kkb, iib) = primitive_integrals(primitive_counter)
887  END DO
888  END DO
889  END DO
890  END DO
891 
892  DO iib = 1, nsgfa(iset)
893  bi1(orb_l_start:orb_l_end, orb_k_start:orb_k_end, iib) = mnrs(:, :, iib)
894  bi1(orb_k_start:orb_k_end, orb_l_start:orb_l_end, iib) = transpose(mnrs(:, :, iib))
895  END DO
896 
897  END DO ! i_set_list_kl
898  END DO ! i_list_kl
899 
900  DO iib = 1, nsgfa(iset)
901  bi1(1:virtual, 1:occupied, iib) = matmul(transpose(c(1:dimen, occupied + 1:dimen)), &
902  matmul(bi1(1:dimen, 1:dimen, iib), c(1:dimen, 1:occupied)))
903  lai(l_b_i_start + iib - 1, 1:virtual, 1:occupied) = bi1(1:virtual, 1:occupied, iib)
904  END DO
905 
906  DEALLOCATE (bi1)
907 
908  END DO
909  END DO
910 
911  CALL para_env%sum(lai)
912 
913  DO iib = 1, occupied
914  IF (mod(iib, para_env%num_pe) == para_env%mepos) THEN
915  lai(1:ri_dimen, 1:virtual, iib) = matmul(transpose(l_full_matrix), lai(1:ri_dimen, 1:virtual, iib))
916  ELSE
917  lai(:, :, iib) = 0.0_dp
918  END IF
919  END DO
920 
921  CALL para_env%sum(lai)
922 
923  DEALLOCATE (set_list_kl)
924 
925  DO i = 1, max_pgf**2
926  DEALLOCATE (pgf_list_ij(i)%image_list)
927  DEALLOCATE (pgf_list_kl(i)%image_list)
928  END DO
929 
930  DEALLOCATE (pgf_list_ij)
931  DEALLOCATE (pgf_list_kl)
932  DEALLOCATE (pgf_product_list)
933 
934  DEALLOCATE (max_contraction, kind_of)
935 
936  DEALLOCATE (ee_work, ee_work2, ee_buffer1, ee_buffer2, ee_primitives_tmp)
937 
938  DEALLOCATE (nimages)
939 
940  IF (mp2_env%potential_parameter%potential_type == do_potential_tshpsc) THEN
941  init_tshpsc_lmax = -1
942  CALL free_c0()
943  END IF
944 
945  CALL timestop(handle)
946 
947  END SUBROUTINE calc_lai_libint
948 
949 ! **************************************************************************************************
950 !> \brief ...
951 !> \param cell ...
952 !> \param qs_env ...
953 !> \param mp2_env ...
954 !> \param para_env ...
955 !> \param mp2_potential_parameter ...
956 !> \param actual_x_data ...
957 !> \param do_periodic ...
958 !> \param basis_parameter ...
959 !> \param max_set ...
960 !> \param particle_set ...
961 !> \param natom ...
962 !> \param kind_of ...
963 !> \param nsgf_max ...
964 !> \param primitive_integrals ...
965 !> \param ee_work ...
966 !> \param ee_work2 ...
967 !> \param ee_buffer1 ...
968 !> \param ee_buffer2 ...
969 !> \param ee_primitives_tmp ...
970 !> \param nspins ...
971 !> \param max_contraction ...
972 !> \param max_pgf ...
973 !> \param pgf_list_ij ...
974 !> \param pgf_list_kl ...
975 !> \param pgf_product_list ...
976 !> \param nimages ...
977 !> \param eps_schwarz ...
978 !> \param log10_eps_schwarz ...
979 !> \param private_lib ...
980 !> \param p_work ...
981 !> \param screen_coeffs_set ...
982 !> \param screen_coeffs_kind ...
983 !> \param screen_coeffs_pgf ...
984 !> \param radii_pgf ...
985 !> \param RI_basis_parameter ...
986 !> \param RI_basis_info ...
987 ! **************************************************************************************************
988  SUBROUTINE prepare_integral_calc(cell, qs_env, mp2_env, para_env, mp2_potential_parameter, actual_x_data, &
989  do_periodic, basis_parameter, max_set, particle_set, natom, kind_of, &
990  nsgf_max, primitive_integrals, ee_work, ee_work2, ee_buffer1, ee_buffer2, &
991  ee_primitives_tmp, nspins, max_contraction, max_pgf, pgf_list_ij, &
992  pgf_list_kl, pgf_product_list, nimages, eps_schwarz, log10_eps_schwarz, &
993  private_lib, p_work, screen_coeffs_set, screen_coeffs_kind, screen_coeffs_pgf, &
994  radii_pgf, RI_basis_parameter, RI_basis_info)
995 
996  TYPE(cell_type), POINTER :: cell
997  TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
998  TYPE(mp2_type), INTENT(INOUT) :: mp2_env
999  TYPE(mp_para_env_type), INTENT(IN) :: para_env
1000  TYPE(hfx_potential_type), INTENT(OUT) :: mp2_potential_parameter
1001  TYPE(hfx_type), POINTER :: actual_x_data
1002  LOGICAL, INTENT(OUT) :: do_periodic
1003  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_parameter
1004  INTEGER, INTENT(OUT) :: max_set
1005  TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
1006  INTEGER, INTENT(OUT) :: natom
1007  INTEGER, ALLOCATABLE, DIMENSION(:), INTENT(OUT) :: kind_of
1008  INTEGER, INTENT(OUT) :: nsgf_max
1009  REAL(kind=dp), ALLOCATABLE, DIMENSION(:), &
1010  INTENT(OUT) :: primitive_integrals, ee_work, ee_work2, &
1011  ee_buffer1, ee_buffer2, &
1012  ee_primitives_tmp
1013  INTEGER, INTENT(OUT) :: nspins
1014  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :), &
1015  INTENT(OUT) :: max_contraction
1016  INTEGER, INTENT(OUT) :: max_pgf
1017  TYPE(hfx_pgf_list), ALLOCATABLE, DIMENSION(:), &
1018  INTENT(OUT) :: pgf_list_ij, pgf_list_kl
1019  TYPE(hfx_pgf_product_list), ALLOCATABLE, &
1020  DIMENSION(:), INTENT(OUT) :: pgf_product_list
1021  INTEGER, ALLOCATABLE, DIMENSION(:), INTENT(OUT) :: nimages
1022  REAL(kind=dp), INTENT(OUT) :: eps_schwarz, log10_eps_schwarz
1023  TYPE(cp_libint_t), INTENT(OUT) :: private_lib
1024  REAL(kind=dp), DIMENSION(:), POINTER :: p_work
1025  TYPE(hfx_screen_coeff_type), &
1026  DIMENSION(:, :, :, :), POINTER :: screen_coeffs_set
1027  TYPE(hfx_screen_coeff_type), DIMENSION(:, :), &
1028  POINTER :: screen_coeffs_kind
1029  TYPE(hfx_screen_coeff_type), &
1030  DIMENSION(:, :, :, :, :, :), POINTER :: screen_coeffs_pgf, radii_pgf
1031  TYPE(hfx_basis_type), DIMENSION(:), OPTIONAL, &
1032  POINTER :: ri_basis_parameter
1033  TYPE(hfx_basis_info_type), INTENT(IN), OPTIONAL :: ri_basis_info
1034 
1035  CHARACTER(LEN=*), PARAMETER :: routinen = 'prepare_integral_calc'
1036 
1037  INTEGER :: handle, i_thread, ii, ikind, irep, &
1038  l_max, n_threads, ncos_max, nkind, &
1039  nneighbors
1040  TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
1041  TYPE(dft_control_type), POINTER :: dft_control
1042  TYPE(hfx_basis_info_type), POINTER :: basis_info
1043  TYPE(hfx_type), POINTER :: shm_master_x_data
1044 
1045  CALL timeset(routinen, handle)
1046 
1047  NULLIFY (dft_control)
1048 
1049  irep = 1
1050 
1051  CALL get_qs_env(qs_env, &
1052  atomic_kind_set=atomic_kind_set, &
1053  cell=cell, &
1054  dft_control=dft_control)
1055 
1056  !! Calculate l_max used in fgamma , because init_md_ftable is definitely not thread safe
1057  nkind = SIZE(atomic_kind_set, 1)
1058  l_max = 0
1059  DO ikind = 1, nkind
1060  l_max = max(l_max, maxval(qs_env%x_data(1, 1)%basis_parameter(ikind)%lmax))
1061  END DO
1062  IF (PRESENT(ri_basis_parameter)) THEN
1063  DO ikind = 1, nkind
1064  l_max = max(l_max, maxval(ri_basis_parameter(ikind)%lmax))
1065  END DO
1066  END IF
1067  l_max = 4*l_max
1068  CALL init_md_ftable(l_max)
1069 
1070  CALL get_potential_parameters(mp2_env, l_max, para_env, mp2_potential_parameter)
1071 
1072  n_threads = 1
1073 
1074  i_thread = 0
1075 
1076  actual_x_data => qs_env%x_data(irep, i_thread + 1)
1077 
1078  shm_master_x_data => qs_env%x_data(irep, 1)
1079 
1080  do_periodic = actual_x_data%periodic_parameter%do_periodic
1081 
1082  IF (do_periodic) THEN
1083  ! ** Rebuild neighbor lists in case the cell has changed (i.e. NPT MD)
1084  actual_x_data%periodic_parameter%number_of_shells = actual_x_data%periodic_parameter%mode
1085  CALL hfx_create_neighbor_cells(actual_x_data, actual_x_data%periodic_parameter%number_of_shells_from_input, &
1086  cell, i_thread)
1087  END IF
1088 
1089  basis_parameter => actual_x_data%basis_parameter
1090  basis_info => actual_x_data%basis_info
1091 
1092  max_set = basis_info%max_set
1093  IF (PRESENT(ri_basis_info)) max_set = max(max_set, ri_basis_info%max_set)
1094 
1095  CALL get_qs_env(qs_env=qs_env, &
1096  atomic_kind_set=atomic_kind_set, &
1097  particle_set=particle_set)
1098 
1099  natom = SIZE(particle_set, 1)
1100 
1101  CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, kind_of=kind_of)
1102 
1103  !! precompute maximum nco and allocate scratch
1104  ncos_max = 0
1105  nsgf_max = 0
1106  CALL get_ncos_and_ncsgf(natom, kind_of, basis_parameter, ncos_max, nsgf_max)
1107  IF (PRESENT(ri_basis_parameter)) THEN
1108  CALL get_ncos_and_ncsgf(natom, kind_of, ri_basis_parameter, ncos_max, nsgf_max)
1109  END IF
1110 
1111  !! Allocate the arrays for the integrals.
1112  ALLOCATE (primitive_integrals(nsgf_max**4))
1113  primitive_integrals = 0.0_dp
1114 
1115  ALLOCATE (ee_work(ncos_max**4))
1116  ALLOCATE (ee_work2(ncos_max**4))
1117  ALLOCATE (ee_buffer1(ncos_max**4))
1118  ALLOCATE (ee_buffer2(ncos_max**4))
1119  ALLOCATE (ee_primitives_tmp(nsgf_max**4))
1120 
1121  nspins = dft_control%nspins
1122 
1123  CALL get_max_contraction(max_contraction, max_set, natom, max_pgf, kind_of, basis_parameter)
1124 
1125  ! ** Allocate buffers for pgf_lists
1126  nneighbors = SIZE(actual_x_data%neighbor_cells)
1127  ALLOCATE (pgf_list_ij(max_pgf**2))
1128  ALLOCATE (pgf_list_kl(max_pgf**2))
1129  ALLOCATE (pgf_product_list(nneighbors**3))
1130  ALLOCATE (nimages(max_pgf**2))
1131 
1132  DO ii = 1, max_pgf**2
1133  ALLOCATE (pgf_list_ij(ii)%image_list(nneighbors))
1134  ALLOCATE (pgf_list_kl(ii)%image_list(nneighbors))
1135  END DO
1136 
1137  !!! Skipped part
1138 
1139  !! Get screening parameter
1140  eps_schwarz = actual_x_data%screening_parameter%eps_schwarz
1141  IF (eps_schwarz <= 0.0_dp) THEN
1142  log10_eps_schwarz = log_zero
1143  ELSE
1144  log10_eps_schwarz = log10(eps_schwarz)
1145  END IF
1146 
1147  !! The number of integrals that fit into the given MAX_MEMORY
1148 
1149  private_lib = actual_x_data%lib
1150 
1151  !!!!!!!! Missing part on the density matrix
1152 
1153  !! Initialize schwarz screening matrices for near field estimates and boxing screening matrices
1154  !! for far field estimates. The update is only performed if the geomtry of the system changed.
1155  !! If the system is periodic, then the corresponding routines are called and some variables
1156  !! are initialized
1157 
1158  IF (.NOT. shm_master_x_data%screen_funct_is_initialized) THEN
1159  CALL calc_pair_dist_radii(qs_env, basis_parameter, &
1160  shm_master_x_data%pair_dist_radii_pgf, max_set, max_pgf, eps_schwarz, &
1161  n_threads, i_thread)
1162  CALL calc_screening_functions(qs_env, basis_parameter, private_lib, shm_master_x_data%potential_parameter, &
1163  shm_master_x_data%screen_funct_coeffs_set, &
1164  shm_master_x_data%screen_funct_coeffs_kind, &
1165  shm_master_x_data%screen_funct_coeffs_pgf, &
1166  shm_master_x_data%pair_dist_radii_pgf, &
1167  max_set, max_pgf, n_threads, i_thread, p_work)
1168 
1169  shm_master_x_data%screen_funct_is_initialized = .true.
1170  END IF
1171 
1172  screen_coeffs_set => shm_master_x_data%screen_funct_coeffs_set
1173  screen_coeffs_kind => shm_master_x_data%screen_funct_coeffs_kind
1174  screen_coeffs_pgf => shm_master_x_data%screen_funct_coeffs_pgf
1175  radii_pgf => shm_master_x_data%pair_dist_radii_pgf
1176 
1177  CALL timestop(handle)
1178 
1179  END SUBROUTINE prepare_integral_calc
1180 
1181 ! **************************************************************************************************
1182 !> \brief ...
1183 !> \param mp2_env ...
1184 !> \param l_max ...
1185 !> \param para_env ...
1186 !> \param mp2_potential_parameter ...
1187 ! **************************************************************************************************
1188  SUBROUTINE get_potential_parameters(mp2_env, l_max, para_env, mp2_potential_parameter)
1189 
1190  TYPE(mp2_type) :: mp2_env
1191  INTEGER, INTENT(IN) :: l_max
1192  TYPE(mp_para_env_type), INTENT(IN) :: para_env
1193  TYPE(hfx_potential_type), INTENT(OUT) :: mp2_potential_parameter
1194 
1195  INTEGER :: unit_id
1196 
1197  IF (mp2_env%potential_parameter%potential_type == do_potential_tshpsc) THEN
1198  IF (l_max > init_tshpsc_lmax) THEN
1199  IF (para_env%is_source()) THEN
1200  CALL open_file(unit_number=unit_id, file_name=mp2_env%potential_parameter%filename)
1201  END IF
1202  CALL init(l_max, unit_id, para_env%mepos, para_env)
1203  IF (para_env%is_source()) THEN
1204  CALL close_file(unit_id)
1205  END IF
1206  init_tshpsc_lmax = l_max
1207  END IF
1208  mp2_potential_parameter%cutoff_radius = mp2_env%potential_parameter%cutoff_radius/2.0_dp
1209  ELSE IF (mp2_env%potential_parameter%potential_type == do_potential_long) THEN
1210  mp2_potential_parameter%omega = mp2_env%potential_parameter%omega
1211  END IF
1212 
1213  mp2_potential_parameter%potential_type = mp2_env%potential_parameter%potential_type
1214 
1215  END SUBROUTINE get_potential_parameters
1216 
1217 ! **************************************************************************************************
1218 !> \brief ...
1219 !> \param natom ...
1220 !> \param kind_of ...
1221 !> \param basis_parameter ...
1222 !> \param ncos_max ...
1223 !> \param nsgf_max ...
1224 ! **************************************************************************************************
1225  SUBROUTINE get_ncos_and_ncsgf(natom, kind_of, basis_parameter, ncos_max, nsgf_max)
1226 
1227  INTEGER, INTENT(IN) :: natom
1228  INTEGER, DIMENSION(:), INTENT(IN) :: kind_of
1229  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_parameter
1230  INTEGER, INTENT(INOUT) :: ncos_max, nsgf_max
1231 
1232  INTEGER :: iatom, ikind, iset, nseta
1233  INTEGER, DIMENSION(:), POINTER :: la_max, npgfa, nsgfa
1234 
1235  DO iatom = 1, natom
1236  ikind = kind_of(iatom)
1237  nseta = basis_parameter(ikind)%nset
1238  npgfa => basis_parameter(ikind)%npgf
1239  la_max => basis_parameter(ikind)%lmax
1240  nsgfa => basis_parameter(ikind)%nsgf
1241  DO iset = 1, nseta
1242  ncos_max = max(ncos_max, ncoset(la_max(iset)))
1243  nsgf_max = max(nsgf_max, nsgfa(iset))
1244  END DO
1245  END DO
1246 
1247  END SUBROUTINE get_ncos_and_ncsgf
1248 
1249 ! **************************************************************************************************
1250 !> \brief ...
1251 !> \param max_contraction ...
1252 !> \param max_set ...
1253 !> \param natom ...
1254 !> \param max_pgf ...
1255 !> \param kind_of ...
1256 !> \param basis_parameter ...
1257 ! **************************************************************************************************
1258  SUBROUTINE get_max_contraction(max_contraction, max_set, natom, max_pgf, kind_of, basis_parameter)
1259 
1260  REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :), &
1261  INTENT(OUT) :: max_contraction
1262  INTEGER, INTENT(IN) :: max_set, natom
1263  INTEGER, INTENT(OUT) :: max_pgf
1264  INTEGER, DIMENSION(:), INTENT(IN) :: kind_of
1265  TYPE(hfx_basis_type), DIMENSION(:), POINTER :: basis_parameter
1266 
1267  INTEGER :: i, jatom, jkind, jset, ncob, nsetb, sgfb
1268  INTEGER, DIMENSION(:), POINTER :: lb_max, npgfb, nsgfb
1269  INTEGER, DIMENSION(:, :), POINTER :: first_sgfb
1270  REAL(kind=dp), DIMENSION(:, :), POINTER :: sphi_b
1271 
1272  ALLOCATE (max_contraction(max_set, natom))
1273 
1274  max_contraction = 0.0_dp
1275  max_pgf = 0
1276  DO jatom = 1, natom
1277  jkind = kind_of(jatom)
1278  lb_max => basis_parameter(jkind)%lmax
1279  nsetb = basis_parameter(jkind)%nset
1280  npgfb => basis_parameter(jkind)%npgf
1281  first_sgfb => basis_parameter(jkind)%first_sgf
1282  sphi_b => basis_parameter(jkind)%sphi
1283  nsgfb => basis_parameter(jkind)%nsgf
1284  DO jset = 1, nsetb
1285  ! takes the primitive to contracted transformation into account
1286  ncob = npgfb(jset)*ncoset(lb_max(jset))
1287  sgfb = first_sgfb(1, jset)
1288  ! if the primitives are assumed to be all of max_val2, max_val2*p2s_b becomes
1289  ! the maximum value after multiplication with sphi_b
1290  max_contraction(jset, jatom) = maxval((/(sum(abs(sphi_b(1:ncob, i))), i=sgfb, sgfb + nsgfb(jset) - 1)/))
1291  max_pgf = max(max_pgf, npgfb(jset))
1292  END DO
1293  END DO
1294 
1295  END SUBROUTINE get_max_contraction
1296 
1297 END MODULE mp2_ri_libint
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.
subroutine, public init_aux_basis_set(gto_basis_set)
...
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius)
...
Handles all functions related to the CELL.
Definition: cell_types.F:15
methods related to the blacs parallel environment
Definition: cp_blacs_env.F:15
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
Definition: cp_blacs_env.F:282
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
Definition: cp_blacs_env.F:123
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Utility routines to open and close files. Tracking of preconnections.
Definition: cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition: cp_files.F:308
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition: cp_files.F:119
basic linear algebra operations for full matrices
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,...
represent the structure of a full matrix
Definition: cp_fm_struct.F:14
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
Definition: cp_fm_struct.F:125
subroutine, public cp_fm_struct_release(fmstruct)
releases a full matrix structure
Definition: cp_fm_struct.F:320
represent a full matrix distributed on many processors
Definition: cp_fm_types.F:15
subroutine, public cp_fm_set_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
Definition: cp_fm_types.F:768
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
Definition: cp_fm_types.F:901
subroutine, public cp_fm_create(matrix, matrix_struct, name, use_sp)
creates a new full matrix with the given structure
Definition: cp_fm_types.F:167
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Definition: gamma.F:15
subroutine, public init_md_ftable(nmax)
Initialize a table of F_n(t) values in the range 0 <= t <= 12 with a stepsize of 0....
Definition: gamma.F:540
Routines to calculate HFX energy and potential.
subroutine, public coulomb4(lib, ra, rb, rc, rd, npgfa, npgfb, npgfc, npgfd, la_min, la_max, lb_min, lb_max, lc_min, lc_max, ld_min, ld_max, nsgfa, nsgfb, nsgfc, nsgfd, sphi_a_u1, sphi_a_u2, sphi_a_u3, sphi_b_u1, sphi_b_u2, sphi_b_u3, sphi_c_u1, sphi_c_u2, sphi_c_u3, sphi_d_u1, sphi_d_u2, sphi_d_u3, zeta, zetb, zetc, zetd, primitive_integrals, potential_parameter, neighbor_cells, screen1, screen2, eps_schwarz, max_contraction_val, cart_estimate, cell, neris_tmp, log10_pmax, log10_eps_schwarz, R1_pgf, R2_pgf, pgf1, pgf2, pgf_list_ij, pgf_list_kl, pgf_product_list, nsgfl_a, nsgfl_b, nsgfl_c, nsgfl_d, sphi_a_ext, sphi_b_ext, sphi_c_ext, sphi_d_ext, ee_work, ee_work2, ee_buffer1, ee_buffer2, ee_primitives_tmp, nimages, do_periodic, p_work)
calculates two-electron integrals of a quartet/shell using the library lib_int in the periodic case
Routines for optimizing load balance between processes in HFX calculations.
subroutine, public build_pair_list_mp2(natom, list, set_list, i_start, i_end, j_start, j_end, kind_of, basis_parameter, particle_set, do_periodic, coeffs_set, coeffs_kind, coeffs_kind_max0, log10_eps_schwarz, cell, pmax_blocks, atomic_pair_list, skip_atom_symmetry)
...
Several screening methods used in HFX calcualtions.
subroutine, public calc_screening_functions(qs_env, basis_parameter, lib, potential_parameter, coeffs_set, coeffs_kind, coeffs_pgf, radii_pgf, max_set, max_pgf, n_threads, i_thread, p_work)
calculates screening functions for schwarz screening
subroutine, public calc_pair_dist_radii(qs_env, basis_parameter, radii_pgf, max_set, max_pgf, eps_schwarz, n_threads, i_thread)
calculates radius functions for longrange screening
Types and set/get functions for HFX.
Definition: hfx_types.F:15
real(dp), parameter, public log_zero
Definition: hfx_types.F:118
subroutine, public hfx_create_neighbor_cells(x_data, pbc_shells, cell, i_thread, nkp_grid)
This routine computes the neighbor cells that are taken into account in periodic runs
Definition: hfx_types.F:2049
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_potential_long
integer, parameter, public do_potential_tshpsc
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
Interface to the Libint-Library or a c++ wrapper.
Interface to the message passing library MPI.
Routines to calculate the 3 and 2 center ERI's needed in the RI approximation using libint.
Definition: mp2_ri_libint.F:15
subroutine, public read_ri_basis_set(qs_env, RI_basis_parameter, RI_basis_info, natom, nkind, kind_of, RI_index_table, RI_dimen, basis_S0)
Read the auxiliary basis set for RI approxiamtion.
subroutine, public release_ri_basis_set(RI_basis_parameter, basis_S0)
Release the auxiliary basis set for RI approxiamtion (to be used only in the case of basis optimizati...
subroutine, public libint_ri_mp2(dimen, RI_dimen, occupied, natom, mp2_biel, mp2_env, C, kind_of, RI_basis_parameter, RI_basis_info, basis_S0, RI_index_table, qs_env, para_env, Lai)
...
subroutine, public prepare_integral_calc(cell, qs_env, mp2_env, para_env, mp2_potential_parameter, actual_x_data, do_periodic, basis_parameter, max_set, particle_set, natom, kind_of, nsgf_max, primitive_integrals, ee_work, ee_work2, ee_buffer1, ee_buffer2, ee_primitives_tmp, nspins, max_contraction, max_pgf, pgf_list_ij, pgf_list_kl, pgf_product_list, nimages, eps_schwarz, log10_eps_schwarz, private_lib, p_work, screen_coeffs_set, screen_coeffs_kind, screen_coeffs_pgf, radii_pgf, RI_basis_parameter, RI_basis_info)
...
Types needed for MP2 calculations.
Definition: mp2_types.F:14
integer, save, public init_tshpsc_lmax
Definition: mp2_types.F:71
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:), allocatable, public ncoset
integer, dimension(:), allocatable, public nso
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_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Definition: qs_kind_types.F:23
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, 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_r3d_rs_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_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr)
Get attributes of an atomic kind set.
subroutine, public free_c0()
...
Definition: t_sh_p_s_c.F:1142
subroutine, public init(Nder, iunit, mepos, group)
...
Definition: t_sh_p_s_c.F:1112