(git:f2099e5)
Loading...
Searching...
No Matches
mp2_eri.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 Interface to direct methods for electron repulsion integrals for MP2.
10! **************************************************************************************************
11
12MODULE mp2_eri
19 USE cell_types, ONLY: cell_type, &
20 pbc
32 USE eri_mme_types, ONLY: eri_mme_param, &
33 eri_mme_set_potential, eri_mme_coulomb, eri_mme_longrange
34 USE input_constants, ONLY: do_eri_gpw, &
35 do_eri_mme, &
36 do_eri_os, &
42 USE kinds, ONLY: dp
48 USE libint_2c_3c, ONLY: libint_potential_type
49 USE orbital_pointers, ONLY: coset, &
51 ncoset
56 USE qs_kind_types, ONLY: get_qs_kind, &
66 USE util, ONLY: get_limit
68#include "./base/base_uses.f90"
69
70 IMPLICIT NONE
71
72 PRIVATE
73
74 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .false.
75
76 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mp2_eri'
77
78 PUBLIC :: &
86
88 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: forces
89 END TYPE mp2_eri_force
90
91CONTAINS
92
93! **************************************************************************************************
94!> \brief high-level integration routine for 2c integrals over CP2K basis sets.
95!> Contiguous column-wise distribution and parallelization over pairs of sets.
96!> \param param ...
97!> \param para_env mpi environment for local columns
98!> \param potential_parameter ...
99!> \param qs_env ...
100!> \param basis_type_a ...
101!> \param basis_type_b ...
102!> \param hab columns of ERI matrix
103!> \param first_b first column of hab
104!> \param last_b last column of hab
105!> \param eri_method ...
106!> \param pab ...
107!> \param force_a ...
108!> \param force_b ...
109!> \param hdab ...
110!> \param hadb ...
111!> \param reflection_z_a ...
112!> \param reflection_z_b ...
113!> \param do_reflection_a ...
114!> \param do_reflection_b ...
115! **************************************************************************************************
116 SUBROUTINE mp2_eri_2c_integrate(param, potential_parameter, para_env, qs_env, basis_type_a, basis_type_b, hab, first_b, &
117 last_b, eri_method, pab, force_a, force_b, hdab, hadb, &
118 reflection_z_a, reflection_z_b, do_reflection_a, do_reflection_b)
119 TYPE(cp_eri_mme_param), INTENT(INOUT) :: param
120 TYPE(libint_potential_type), INTENT(IN) :: potential_parameter
121 TYPE(mp_para_env_type), INTENT(IN) :: para_env
122 TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
123 CHARACTER(len=*), INTENT(IN), OPTIONAL :: basis_type_a, basis_type_b
124 REAL(kind=dp), DIMENSION(:, :), INTENT(INOUT) :: hab
125 INTEGER, INTENT(IN) :: first_b, last_b
126 INTEGER, INTENT(IN), OPTIONAL :: eri_method
127 REAL(kind=dp), DIMENSION(:, :), INTENT(IN), &
128 OPTIONAL :: pab
129 TYPE(mp2_eri_force), ALLOCATABLE, &
130 DIMENSION(:), INTENT(OUT), OPTIONAL :: force_a, force_b
131 REAL(kind=dp), DIMENSION(:, :, :), INTENT(INOUT), &
132 OPTIONAL :: hdab, hadb
133 REAL(kind=dp), INTENT(IN), OPTIONAL :: reflection_z_a, reflection_z_b
134 LOGICAL, INTENT(IN), OPTIONAL :: do_reflection_a, do_reflection_b
135
136 CHARACTER(len=*), PARAMETER :: routinen = 'mp2_eri_2c_integrate'
137
138 INTEGER :: atom_a, atom_b, atom_end, atom_start, first_set, g_count, handle, iatom, ikind, &
139 iset, jatom, jkind, jset, jset_end, jset_start, last_set, max_am_a, max_am_b, &
140 my_eri_method, my_setpair, n_setpair, natom, nkind, nseta, nseta_total, &
141 nsetb, nsetb_total, offset_a_end, &
142 offset_a_start, offset_b_end, offset_b_start, r_count, set_end, set_offset_end, &
143 set_offset_start, set_start, sgfa, sgfb
144 INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind, kind_of, natom_of_kind
145 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: eri_offsets
146 INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
147 npgfb, nsgfa, nsgfb
148 INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, first_sgfb
149 LOGICAL :: map_it_here, my_do_reflection_a, &
150 my_do_reflection_b
151 REAL(kind=dp) :: dab
152 REAL(kind=dp), DIMENSION(3) :: ra, rab, rb
153 REAL(kind=dp), DIMENSION(:, :), POINTER :: rpgfa, rpgfb, sphi_a, sphi_b, zeta, zetb
154 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
155 TYPE(cell_type), POINTER :: cell
156 TYPE(coulomb_integral_context_type) :: integral_context
157 TYPE(gto_basis_set_type), POINTER :: basis_set_a, basis_set_b
158 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
159 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
160
161 CALL timeset(routinen, handle)
162
163 my_eri_method = do_eri_mme
164 IF (PRESENT(eri_method)) my_eri_method = eri_method
165
166 my_do_reflection_a = .false.
167 IF (PRESENT(do_reflection_a) .AND. PRESENT(reflection_z_a)) my_do_reflection_a = do_reflection_a
168
169 my_do_reflection_b = .false.
170 IF (PRESENT(do_reflection_b) .AND. PRESENT(reflection_z_b)) my_do_reflection_b = do_reflection_b
171
172 g_count = 0; r_count = 0
173 ! get mapping between ERIs and atoms, sets, set offsets
174 CALL get_eri_offsets(qs_env, basis_type_b, eri_offsets)
175
176 atom_start = eri_offsets(first_b, 1)
177 set_start = eri_offsets(first_b, 2)
178 set_offset_start = eri_offsets(first_b, 3)
179
180 atom_end = eri_offsets(last_b, 1)
181 set_end = eri_offsets(last_b, 2)
182 set_offset_end = eri_offsets(last_b, 3)
183
184 ! get QS stuff
185 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set, &
186 cell=cell, particle_set=particle_set, natom=natom, nkind=nkind)
187
188 IF (my_eri_method == do_eri_os) THEN
189 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, maxlgto=max_am_a, basis_type=basis_type_a)
190 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, maxlgto=max_am_b, basis_type=basis_type_b)
191 CALL coulomb_integral_init(integral_context, max_am_2c=max(max_am_a, max_am_b))
192 END IF
193
194 CALL get_atomic_kind_set(atomic_kind_set, kind_of=kind_of, natom_of_kind=natom_of_kind, atom_of_kind=atom_of_kind)
195
196 IF (PRESENT(force_a)) CALL mp2_eri_allocate_forces(force_a, natom_of_kind)
197 IF (PRESENT(force_b)) CALL mp2_eri_allocate_forces(force_b, natom_of_kind)
198
199 ! get total number of local set pairs to integrate
200 nseta_total = 0
201 DO iatom = 1, natom
202 ikind = kind_of(iatom)
203 CALL get_qs_kind(qs_kind=qs_kind_set(ikind), basis_set=basis_set_a, basis_type=basis_type_a)
204 nseta_total = nseta_total + basis_set_a%nset
205 END DO
206
207 nsetb_total = 0
208 DO jatom = atom_start, atom_end
209 jkind = kind_of(jatom)
210 CALL get_qs_kind(qs_kind=qs_kind_set(jkind), basis_set=basis_set_b, basis_type=basis_type_b)
211 nsetb_total = nsetb_total + basis_set_b%nset
212 END DO
213
214 n_setpair = nseta_total*nsetb_total
215
216 my_setpair = 0
217
218 offset_a_end = 0
219 DO iatom = 1, natom
220 ikind = kind_of(iatom)
221 atom_a = atom_of_kind(iatom)
222 CALL get_qs_kind(qs_kind=qs_kind_set(ikind), basis_set=basis_set_a, basis_type=basis_type_a)
223
224 first_sgfa => basis_set_a%first_sgf
225 la_max => basis_set_a%lmax
226 la_min => basis_set_a%lmin
227 nseta = basis_set_a%nset
228 nsgfa => basis_set_a%nsgf_set
229 sphi_a => basis_set_a%sphi
230 rpgfa => basis_set_a%pgf_radius
231 zeta => basis_set_a%zet
232 npgfa => basis_set_a%npgf
233
234 ra(:) = pbc(particle_set(iatom)%r, cell)
235
236 IF (my_do_reflection_a) THEN
237 ra(3) = 2.0_dp*reflection_z_a - ra(3)
238 END IF
239
240 DO iset = 1, nseta
241 offset_a_start = offset_a_end
242 offset_a_end = offset_a_end + nsgfa(iset)
243 sgfa = first_sgfa(1, iset)
244
245 offset_b_end = 0
246 DO jatom = atom_start, atom_end
247 jkind = kind_of(jatom)
248 atom_b = atom_of_kind(jatom)
249 CALL get_qs_kind(qs_kind=qs_kind_set(jkind), basis_set=basis_set_b, basis_type=basis_type_b)
250
251 first_sgfb => basis_set_b%first_sgf
252 lb_max => basis_set_b%lmax
253 lb_min => basis_set_b%lmin
254 nsetb = basis_set_b%nset
255 nsgfb => basis_set_b%nsgf_set
256 sphi_b => basis_set_b%sphi
257 rpgfb => basis_set_b%pgf_radius
258 zetb => basis_set_b%zet
259 npgfb => basis_set_b%npgf
260
261 rb(:) = pbc(particle_set(jatom)%r, cell)
262
263 IF (my_do_reflection_b) THEN
264 rb(3) = 2.0_dp*reflection_z_b - rb(3)
265 END IF
266
267 rab(:) = ra(:) - rb(:) ! pbc not needed?
268 dab = sqrt(rab(1)**2 + rab(2)**2 + rab(3)**2)
269
270 jset_start = 1; jset_end = nsetb
271 IF (jatom == atom_start) jset_start = set_start
272 IF (jatom == atom_end) jset_end = set_end
273
274 DO jset = jset_start, jset_end
275 first_set = 1; last_set = nsgfb(jset)
276 IF (jset == jset_start .AND. jatom == atom_start) first_set = set_offset_start
277 IF (jset == jset_end .AND. jatom == atom_end) last_set = set_offset_end
278
279 offset_b_start = offset_b_end
280 offset_b_end = offset_b_end + last_set + 1 - first_set
281 sgfb = first_sgfb(1, jset)
282 my_setpair = my_setpair + 1
283 map_it_here = modulo(my_setpair, para_env%num_pe) == para_env%mepos
284
285 IF (map_it_here) THEN
286 IF (.NOT.PRESENT(force_a) .AND. &
287 .NOT.PRESENT(force_b)) THEN
288
289 CALL integrate_set_2c( &
290 param%par, potential_parameter, &
291 la_min(iset), la_max(iset), &
292 lb_min(jset), lb_max(jset), &
293 npgfa(iset), npgfb(jset), &
294 zeta(:, iset), zetb(:, jset), &
295 ra, rb, &
296 hab, nsgfa(iset), last_set - first_set + 1, &
297 offset_a_start, offset_b_start, &
298 0, first_set - 1, &
299 sphi_a, sphi_b, &
300 sgfa, sgfb, nsgfa(iset), nsgfb(jset), &
301 my_eri_method, &
302 pab=pab, &
303
304
305 hdab=hdab, hadb=hadb, &
306 g_count=g_count, r_count=r_count, &
307 do_reflection_a=do_reflection_a, do_reflection_b=do_reflection_b, &
308 coulomb_context=integral_context, &
309 rpgfa=rpgfa(:, iset), rpgfb=rpgfb(:, jset))
310 END IF
311 IF (.NOT.PRESENT(force_a) .AND. &
312 PRESENT(force_b)) THEN
313
314 CALL integrate_set_2c( &
315 param%par, potential_parameter, &
316 la_min(iset), la_max(iset), &
317 lb_min(jset), lb_max(jset), &
318 npgfa(iset), npgfb(jset), &
319 zeta(:, iset), zetb(:, jset), &
320 ra, rb, &
321 hab, nsgfa(iset), last_set - first_set + 1, &
322 offset_a_start, offset_b_start, &
323 0, first_set - 1, &
324 sphi_a, sphi_b, &
325 sgfa, sgfb, nsgfa(iset), nsgfb(jset), &
326 my_eri_method, &
327 pab=pab, &
328
329force_b=force_b(jkind)%forces(:, atom_b), &
330 hdab=hdab, hadb=hadb, &
331 g_count=g_count, r_count=r_count, &
332 do_reflection_a=do_reflection_a, do_reflection_b=do_reflection_b, &
333 coulomb_context=integral_context, &
334 rpgfa=rpgfa(:, iset), rpgfb=rpgfb(:, jset))
335 END IF
336 IF (PRESENT(force_a) .AND. &
337 .NOT.PRESENT(force_b)) THEN
338
339 CALL integrate_set_2c( &
340 param%par, potential_parameter, &
341 la_min(iset), la_max(iset), &
342 lb_min(jset), lb_max(jset), &
343 npgfa(iset), npgfb(jset), &
344 zeta(:, iset), zetb(:, jset), &
345 ra, rb, &
346 hab, nsgfa(iset), last_set - first_set + 1, &
347 offset_a_start, offset_b_start, &
348 0, first_set - 1, &
349 sphi_a, sphi_b, &
350 sgfa, sgfb, nsgfa(iset), nsgfb(jset), &
351 my_eri_method, &
352 pab=pab, &
353force_a=force_a(ikind)%forces(:, atom_a), &
354
355 hdab=hdab, hadb=hadb, &
356 g_count=g_count, r_count=r_count, &
357 do_reflection_a=do_reflection_a, do_reflection_b=do_reflection_b, &
358 coulomb_context=integral_context, &
359 rpgfa=rpgfa(:, iset), rpgfb=rpgfb(:, jset))
360 END IF
361 IF (PRESENT(force_a) .AND. &
362 PRESENT(force_b)) THEN
363
364 CALL integrate_set_2c( &
365 param%par, potential_parameter, &
366 la_min(iset), la_max(iset), &
367 lb_min(jset), lb_max(jset), &
368 npgfa(iset), npgfb(jset), &
369 zeta(:, iset), zetb(:, jset), &
370 ra, rb, &
371 hab, nsgfa(iset), last_set - first_set + 1, &
372 offset_a_start, offset_b_start, &
373 0, first_set - 1, &
374 sphi_a, sphi_b, &
375 sgfa, sgfb, nsgfa(iset), nsgfb(jset), &
376 my_eri_method, &
377 pab=pab, &
378force_a=force_a(ikind)%forces(:, atom_a), &
379force_b=force_b(jkind)%forces(:, atom_b), &
380 hdab=hdab, hadb=hadb, &
381 g_count=g_count, r_count=r_count, &
382 do_reflection_a=do_reflection_a, do_reflection_b=do_reflection_b, &
383 coulomb_context=integral_context, &
384 rpgfa=rpgfa(:, iset), rpgfb=rpgfb(:, jset))
385 END IF
386 END IF
387 END DO
388 END DO
389 END DO
390 END DO
391
392 IF (my_eri_method == do_eri_os) CALL coulomb_integral_cleanup(integral_context)
393
394 IF (my_eri_method == do_eri_mme) THEN
395
396 CALL cp_eri_mme_update_local_counts(param, para_env, g_count_2c=g_count, r_count_2c=r_count)
397
398 END IF
399
400 CALL para_env%sum(hab)
401 IF (PRESENT(hdab)) CALL para_env%sum(hdab)
402 IF (PRESENT(hadb)) CALL para_env%sum(hadb)
403
404 CALL timestop(handle)
405 END SUBROUTINE mp2_eri_2c_integrate
406
407! **************************************************************************************************
408!> \brief Integrate set pair and contract with sphi matrix.
409!> \param param ...
410!> \param potential_parameter ...
411!> \param la_min ...
412!> \param la_max ...
413!> \param lb_min ...
414!> \param lb_max ...
415!> \param npgfa ...
416!> \param npgfb ...
417!> \param zeta ...
418!> \param zetb ...
419!> \param ra ...
420!> \param rb ...
421!> \param hab ...
422!> \param n_hab_a ...
423!> \param n_hab_b ...
424!> \param offset_hab_a ...
425!> \param offset_hab_b ...
426!> \param offset_set_a ...
427!> \param offset_set_b ...
428!> \param sphi_a ...
429!> \param sphi_b ...
430!> \param sgfa ...
431!> \param sgfb ...
432!> \param nsgfa ...
433!> \param nsgfb ...
434!> \param eri_method ...
435!> \param pab ...
436!> \param force_a ...
437!> \param force_b ...
438!> \param hdab ...
439!> \param hadb ...
440!> \param G_count ...
441!> \param R_count ...
442!> \param do_reflection_a ...
443!> \param do_reflection_b ...
444!> \param rpgfa primitive Gaussian radii for basis A (required by the Libint library)
445!> \param rpgfb primitive Gaussian radii for basis B (required by the Libint library)
446!> \param coulomb_context context for the selected Coulomb integral library
447! **************************************************************************************************
448 SUBROUTINE integrate_set_2c(param, potential_parameter, la_min, la_max, lb_min, lb_max, npgfa, npgfb, zeta, zetb, &
449 ra, rb, hab, n_hab_a, n_hab_b, offset_hab_a, offset_hab_b, &
450 offset_set_a, offset_set_b, sphi_a, sphi_b, sgfa, sgfb, nsgfa, nsgfb, &
451 eri_method, pab, force_a, force_b, hdab, hadb, G_count, R_count, &
452 do_reflection_a, do_reflection_b, rpgfa, rpgfb, coulomb_context)
453 TYPE(eri_mme_param), INTENT(INOUT) :: param
454 TYPE(libint_potential_type), INTENT(IN) :: potential_parameter
455 INTEGER, INTENT(IN) :: la_min, la_max, lb_min, lb_max, npgfa
456 REAL(kind=dp), DIMENSION(npgfa), INTENT(IN) :: zeta
457 INTEGER, INTENT(IN) :: npgfb
458 REAL(kind=dp), DIMENSION(npgfb), INTENT(IN) :: zetb
459 REAL(kind=dp), DIMENSION(3), INTENT(IN) :: ra, rb
460 REAL(kind=dp), DIMENSION(:, :), INTENT(OUT) :: hab
461 INTEGER, INTENT(IN) :: n_hab_a, n_hab_b, offset_hab_a, &
462 offset_hab_b, offset_set_a, &
463 offset_set_b
464 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: sphi_a
465 INTEGER, INTENT(IN) :: sgfa, nsgfa
466 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: sphi_b
467 INTEGER, INTENT(IN) :: sgfb, nsgfb, eri_method
468 TYPE(coulomb_integral_context_type), INTENT(INOUT), OPTIONAL :: coulomb_context
469 REAL(kind=dp), DIMENSION(:, :), INTENT(IN), &
470 OPTIONAL :: pab
471 REAL(kind=dp), DIMENSION(3), INTENT(INOUT), &
472 OPTIONAL :: force_a, force_b
473 REAL(kind=dp), DIMENSION(:, :, :), INTENT(OUT), &
474 OPTIONAL :: hdab, hadb
475 INTEGER, INTENT(INOUT), OPTIONAL :: g_count, r_count
476 LOGICAL, INTENT(IN), OPTIONAL :: do_reflection_a, do_reflection_b
477 REAL(kind=dp), DIMENSION(:), INTENT(IN), OPTIONAL :: rpgfa, rpgfb
478
479 CHARACTER(LEN=*), PARAMETER :: routinen = 'integrate_set_2c'
480
481 INTEGER :: ax, ay, az, bx, by, bz, hab_a_end, hab_a_start, hab_b_end, hab_b_start, handle, &
482 i_xyz, ico, icox, icoy, icoz, ipgf, jco, jcox, jcoy, jcoz, jpgf, la, la_max_d, lb, &
483 lb_max_d, na, nb, ncoa, ncob, set_a_end, set_a_start, set_b_end, set_b_start, &
484 sphi_a_start, sphi_b_start
485 INTEGER, DIMENSION(3) :: la_xyz, lb_xyz
486 LOGICAL :: calculate_forces, my_do_reflection_a, &
487 my_do_reflection_b, do_force_a, do_force_b
488 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: hab_contr, hab_uncontr, &
489 hab_uncontr_d, pab_hh, pab_hs, &
490 pab_ss
491 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: hadb_contr, hadb_uncontr, hdab_contr, &
492 hdab_uncontr
493
494 ! note: tested only for one exponent per pair (npgfa = npgfb = 1)
495 CALL timeset(routinen, handle)
496
497 my_do_reflection_a = .false.
498 IF (PRESENT(do_reflection_a)) my_do_reflection_a = do_reflection_a
499
500 my_do_reflection_b = .false.
501 IF (PRESENT(do_reflection_b)) my_do_reflection_b = do_reflection_b
502
503 do_force_a = PRESENT(force_a) .OR. PRESENT(hdab)
504 do_force_b = PRESENT(force_b) .OR. PRESENT(hadb)
505 calculate_forces = do_force_a .OR. do_force_b
506
507 IF (PRESENT(force_a) .OR. PRESENT(force_b)) THEN
508 cpassert(PRESENT(pab))
509 cpassert(all(shape(pab) == shape(hab)))
510 END IF
511
512 la_max_d = la_max
513 lb_max_d = lb_max
514
515 IF (calculate_forces) THEN
516 IF (do_force_a) la_max_d = la_max + 1
517 IF (do_force_b) lb_max_d = lb_max + 1
518 END IF
519
520 ncoa = npgfa*ncoset(la_max)
521 ncob = npgfb*ncoset(lb_max)
522
523 ALLOCATE (hab_uncontr_d(ncoset(la_max_d), ncoset(lb_max_d))); hab_uncontr_d(:, :) = 0.0_dp
524 ALLOCATE (hab_uncontr(ncoa, ncob)); hab_uncontr(:, :) = 0.0_dp
525 IF (PRESENT(hdab)) THEN
526 ALLOCATE (hdab_uncontr(3, ncoa, ncob)); hdab_uncontr(:, :, :) = 0.0_dp
527 END IF
528 IF (PRESENT(hadb)) THEN
529 ALLOCATE (hadb_uncontr(3, ncoa, ncob)); hadb_uncontr(:, :, :) = 0.0_dp
530 END IF
531
532 hab_a_start = offset_hab_a + 1; hab_a_end = offset_hab_a + n_hab_a
533 hab_b_start = offset_hab_b + 1; hab_b_end = offset_hab_b + n_hab_b
534 set_a_start = offset_set_a + 1; set_a_end = offset_set_a + n_hab_a
535 set_b_start = offset_set_b + 1; set_b_end = offset_set_b + n_hab_b
536
537 IF (eri_method == do_eri_mme) THEN
538 CALL eri_mme_set_potential(param, convert_potential_type(potential_parameter%potential_type), potential_parameter%omega)
539
540 IF (calculate_forces .AND. PRESENT(pab)) THEN
541 ! uncontracted hermite-gaussian representation of density matrix
542 sphi_a_start = sgfa - 1 + set_a_start
543 sphi_b_start = sgfb - 1 + set_b_start
544
545 ALLOCATE (pab_ss(n_hab_a, n_hab_b))
546 pab_ss(:, :) = pab(hab_a_start:hab_a_end, hab_b_start:hab_b_end)
547 ALLOCATE (pab_hs(ncoa, n_hab_b)); ALLOCATE (pab_hh(ncoa, ncob))
548 CALL dgemm("N", "N", ncoa, n_hab_b, n_hab_a, 1.0_dp, &
549 sphi_a(:, sphi_a_start), SIZE(sphi_a, 1), pab_ss, n_hab_a, 0.0_dp, pab_hs, ncoa)
550 CALL dgemm("N", "T", ncoa, ncob, n_hab_b, 1.0_dp, &
551 pab_hs, ncoa, sphi_b(:, sphi_b_start), SIZE(sphi_b, 1), 0.0_dp, pab_hh, ncoa)
552 END IF
553
554 DO ipgf = 1, npgfa
555 na = (ipgf - 1)*ncoset(la_max)
556 DO jpgf = 1, npgfb
557 nb = (jpgf - 1)*ncoset(lb_max)
558 hab_uncontr_d(:, :) = 0.0_dp
559 CALL eri_mme_2c_integrate(param, &
560 la_min, la_max_d, lb_min, lb_max_d, &
561 zeta(ipgf), zetb(jpgf), ra - rb, hab_uncontr_d, 0, 0, g_count, r_count)
562
563 hab_uncontr(na + 1:na + ncoset(la_max), nb + 1:nb + ncoset(lb_max)) = &
564 hab_uncontr_d(:ncoset(la_max), :ncoset(lb_max))
565
566 IF (calculate_forces) THEN
567 DO lb = lb_min, lb_max
568 DO bx = 0, lb
569 DO by = 0, lb - bx
570 bz = lb - bx - by
571 jco = coset(bx, by, bz)
572 jcox = coset(bx + 1, by, bz)
573 jcoy = coset(bx, by + 1, bz)
574 jcoz = coset(bx, by, bz + 1)
575 DO la = la_min, la_max
576 DO ax = 0, la
577 DO ay = 0, la - ax
578 az = la - ax - ay
579 la_xyz = [ax, ay, az]
580 lb_xyz = [bx, by, bz]
581 ico = coset(ax, ay, az)
582 icox = coset(ax + 1, ay, az)
583 icoy = coset(ax, ay + 1, az)
584 icoz = coset(ax, ay, az + 1)
585 IF (PRESENT(force_a)) THEN
586 force_a(:) = force_a(:) + 2.0_dp*zeta(ipgf)* &
587 [pab_hh(na + ico, nb + jco)*hab_uncontr_d(icox, jco), &
588 pab_hh(na + ico, nb + jco)*hab_uncontr_d(icoy, jco), &
589 pab_hh(na + ico, nb + jco)*hab_uncontr_d(icoz, jco)]
590 END IF
591 IF (PRESENT(force_b)) THEN
592 force_b(:) = force_b(:) + 2.0_dp*zetb(jpgf)* &
593 [pab_hh(na + ico, nb + jco)*hab_uncontr_d(ico, jcox), &
594 pab_hh(na + ico, nb + jco)*hab_uncontr_d(ico, jcoy), &
595 pab_hh(na + ico, nb + jco)*hab_uncontr_d(ico, jcoz)]
596 END IF
597 IF (PRESENT(hdab)) THEN
598 hdab_uncontr(1:3, na + ico, nb + jco) = 2.0_dp*zeta(ipgf)* &
599 [hab_uncontr_d(icox, jco), &
600 hab_uncontr_d(icoy, jco), &
601 hab_uncontr_d(icoz, jco)]
602 END IF
603 IF (PRESENT(hadb)) THEN
604 hadb_uncontr(1:3, na + ico, nb + jco) = 2.0_dp*zetb(jpgf)* &
605 [hab_uncontr_d(ico, jcox), &
606 hab_uncontr_d(ico, jcoy), &
607 hab_uncontr_d(ico, jcoz)]
608 END IF
609 END DO
610 END DO
611 END DO
612 END DO
613 END DO
614 END DO
615 END IF
616
617 END DO
618 END DO
619
620 ELSE IF (eri_method == do_eri_os) THEN
621
622 IF (calculate_forces) cpabort("NYI")
623 IF (.NOT. PRESENT(rpgfa) .OR. .NOT. PRESENT(rpgfb)) THEN
624 cpabort("Two-center OS library requires primitive Gaussian radii")
625 END IF
626
627 cpassert(PRESENT(coulomb_context))
628 CALL compute_coulomb_2c(coulomb_context, la_min, la_max, lb_min, lb_max, npgfa, npgfb, zeta, zetb, &
629 rpgfa, rpgfb, ra, rb, hab_uncontr, potential_parameter)
630
631 ELSE IF (eri_method == do_eri_gpw) THEN
632
633 cpabort("GPW not enabled in the ERI interface.")
634
635 END IF
636
637 ALLOCATE (hab_contr(nsgfa, nsgfb))
638 IF (PRESENT(hdab)) THEN
639 ALLOCATE (hdab_contr(3, nsgfa, nsgfb))
640 END IF
641 IF (PRESENT(hadb)) THEN
642 ALLOCATE (hadb_contr(3, nsgfa, nsgfb))
643 END IF
644
645 CALL ab_contract(hab_contr, hab_uncontr, sphi_a(:, sgfa:), sphi_b(:, sgfb:), ncoa, ncob, nsgfa, nsgfb)
646
647 IF (calculate_forces) THEN
648 DO i_xyz = 1, 3
649 IF (PRESENT(hdab)) THEN
650 CALL ab_contract(hdab_contr(i_xyz, :, :), hdab_uncontr(i_xyz, :, :), &
651 sphi_a(:, sgfa:), sphi_b(:, sgfb:), ncoa, ncob, nsgfa, nsgfb)
652 END IF
653 IF (PRESENT(hadb)) THEN
654 CALL ab_contract(hadb_contr(i_xyz, :, :), hadb_uncontr(i_xyz, :, :), &
655 sphi_a(:, sgfa:), sphi_b(:, sgfb:), ncoa, ncob, nsgfa, nsgfb)
656 END IF
657 END DO
658 END IF
659
660 hab(hab_a_start:hab_a_end, hab_b_start:hab_b_end) = hab_contr(set_a_start:set_a_end, set_b_start:set_b_end)
661
662 IF (calculate_forces) THEN
663 IF (PRESENT(hdab)) hdab(:, hab_a_start:hab_a_end, hab_b_start:hab_b_end) = &
664 hdab_contr(:, set_a_start:set_a_end, set_b_start:set_b_end)
665 IF (PRESENT(hadb)) hadb(:, hab_a_start:hab_a_end, hab_b_start:hab_b_end) = &
666 hadb_contr(:, set_a_start:set_a_end, set_b_start:set_b_end)
667 END IF
668
669 CALL timestop(handle)
670
671 END SUBROUTINE integrate_set_2c
672
673! **************************************************************************************************
674!> \brief high-level integration routine for 3c integrals (ab|c) over CP2K basis sets.
675!> For each local function of c, (ab|c) is written to a DBCSR matrix mat_ab.
676!> \param param ...
677!> \param potential_parameter ...
678!> \param para_env ...
679!> \param qs_env ...
680!> \param first_c start index of local range of c
681!> \param last_c end index of local range of c
682!> \param mat_ab DBCSR matrices for each c
683!> \param basis_type_a ...
684!> \param basis_type_b ...
685!> \param basis_type_c ...
686!> \param sab_nl neighbor list for a, b
687!> \param eri_method ...
688!> \param pabc ...
689!> \param force_a ...
690!> \param force_b ...
691!> \param force_c ...
692!> \param mat_dabc ...
693!> \param mat_adbc ...
694!> \param mat_abdc ...
695! **************************************************************************************************
696 SUBROUTINE mp2_eri_3c_integrate(param, potential_parameter, para_env, qs_env, &
697 first_c, last_c, mat_ab, &
698 basis_type_a, basis_type_b, basis_type_c, &
699 sab_nl, eri_method, &
700 pabc, force_a, force_b, force_c, &
701 mat_dabc, mat_adbc, mat_abdc)
702 TYPE(cp_eri_mme_param), INTENT(INOUT) :: param
703 TYPE(libint_potential_type), INTENT(IN) :: potential_parameter
704 TYPE(mp_para_env_type), INTENT(IN) :: para_env
705 TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
706 INTEGER, INTENT(IN) :: first_c, last_c
707 TYPE(dbcsr_p_type), DIMENSION(last_c - first_c + 1), &
708 INTENT(INOUT) :: mat_ab
709 CHARACTER(LEN=*), INTENT(IN) :: basis_type_a, basis_type_b, basis_type_c
710 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
711 POINTER :: sab_nl
712 INTEGER, INTENT(IN), OPTIONAL :: eri_method
713 TYPE(dbcsr_p_type), DIMENSION(last_c - first_c + 1), &
714 INTENT(INOUT), OPTIONAL :: pabc
715 TYPE(mp2_eri_force), ALLOCATABLE, &
716 DIMENSION(:), INTENT(OUT), OPTIONAL :: force_a, force_b, force_c
717 TYPE(dbcsr_p_type), &
718 DIMENSION(3, last_c - first_c + 1), INTENT(INOUT), &
719 OPTIONAL :: mat_dabc, mat_adbc, mat_abdc
720
721 CHARACTER(LEN=*), PARAMETER :: routinen = 'mp2_eri_3c_integrate'
722
723 INTEGER :: atom_a, atom_b, atom_c, atom_end, atom_start, first_set, gg_count, gr_count, &
724 handle, i_xyz, iatom, ic, icol, ikind, inode, irow, iset, jatom, jkind, jset, katom, &
725 kkind, kset, kset_end, kset_start, last_jatom, last_set, max_am_a, max_am_b, max_am_c, &
726 mepos, my_eri_method, na, natom, &
727 nb, nc, nkind, nseta, nsetb, nsetc, nthread, offset_a_end, offset_a_start, offset_b_end, &
728 offset_b_start, offset_c_end, offset_c_start, rr_count, set_end, set_offset_end, &
729 set_offset_start, set_start, sgfa, sgfb, sgfc
730 INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind, kind_of, natom_of_kind
731 INTEGER, ALLOCATABLE, DIMENSION(:, :) :: eri_offsets
732 INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, lc_max, &
733 lc_min, npgfa, npgfb, npgfc, nsgfa, &
734 nsgfb, nsgfc
735 INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, first_sgfb, first_sgfc
736 LOGICAL :: calculate_forces, do_symmetric, found, to_be_asserted
737 REAL(kind=dp) :: dab
738 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: habc, pabc_block
739 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :, :) :: habdc, hadbc, hdabc
740 REAL(kind=dp), DIMENSION(3) :: ra, rab, rb, rc
741 REAL(kind=dp), DIMENSION(:), POINTER :: set_radius_a, set_radius_b
742 REAL(kind=dp), DIMENSION(:, :), POINTER :: munu_block, pab_block, rpgfa, rpgfb, rpgfc, sphi_a, &
743 sphi_b, sphi_c, zeta, zetb, zetc
744 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
745 TYPE(cell_type), POINTER :: cell
746 TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: basis_set_list_a, basis_set_list_b
747 TYPE(gto_basis_set_type), POINTER :: basis_set_a, basis_set_b, basis_set_c
748 TYPE(coulomb_integral_context_type) :: integral_context
750 DIMENSION(:), POINTER :: nl_iterator
751 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
752 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
753
754 CALL timeset(routinen, handle)
755
756 calculate_forces = PRESENT(force_a) .OR. PRESENT(force_b) .OR. PRESENT(force_c) .OR. &
757 PRESENT(mat_dabc) .OR. PRESENT(mat_adbc) .OR. PRESENT(mat_abdc)
758
759 my_eri_method = do_eri_mme
760 IF (PRESENT(eri_method)) my_eri_method = eri_method
761
762 IF (PRESENT(force_a) .OR. PRESENT(force_b) .OR. PRESENT(force_c)) THEN
763 cpassert(PRESENT(pabc))
764 END IF
765
766 gg_count = 0; gr_count = 0; rr_count = 0
767
768 nthread = 1
769
770 ! get mapping between ERIs and atoms, sets, set offsets
771 CALL get_eri_offsets(qs_env, basis_type_c, eri_offsets)
772
773 atom_start = eri_offsets(first_c, 1)
774 set_start = eri_offsets(first_c, 2)
775 set_offset_start = eri_offsets(first_c, 3)
776
777 atom_end = eri_offsets(last_c, 1)
778 set_end = eri_offsets(last_c, 2)
779 set_offset_end = eri_offsets(last_c, 3)
780
781 ! get QS stuff
782 CALL get_qs_env(qs_env, &
783 atomic_kind_set=atomic_kind_set, &
784 natom=natom, &
785 qs_kind_set=qs_kind_set, &
786 particle_set=particle_set, &
787 cell=cell, &
788 nkind=nkind)
789
790 CALL get_atomic_kind_set(atomic_kind_set, atom_of_kind=atom_of_kind, kind_of=kind_of, natom_of_kind=natom_of_kind)
791
792 IF (PRESENT(force_a)) CALL mp2_eri_allocate_forces(force_a, natom_of_kind)
793 IF (PRESENT(force_b)) CALL mp2_eri_allocate_forces(force_b, natom_of_kind)
794 IF (PRESENT(force_c)) CALL mp2_eri_allocate_forces(force_c, natom_of_kind)
795
796 nc = last_c - first_c + 1
797
798 ! check for symmetry
799 cpassert(SIZE(sab_nl) > 0)
800 CALL get_neighbor_list_set_p(neighbor_list_sets=sab_nl, symmetric=do_symmetric)
801
802 IF (do_symmetric) THEN
803 cpassert(basis_type_a == basis_type_b)
804 END IF
805
806 ALLOCATE (basis_set_list_a(nkind), basis_set_list_b(nkind))
807 CALL basis_set_list_setup(basis_set_list_a, basis_type_a, qs_kind_set)
808 CALL basis_set_list_setup(basis_set_list_b, basis_type_b, qs_kind_set)
809
810 IF (my_eri_method == do_eri_os) THEN
811 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, maxlgto=max_am_a, basis_type=basis_type_a)
812 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, maxlgto=max_am_b, basis_type=basis_type_b)
813 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, maxlgto=max_am_c, basis_type=basis_type_c)
814 CALL coulomb_integral_init(integral_context, max_am_3c=max(max_am_a, max_am_b, max_am_c))
815 END IF
816
817 CALL neighbor_list_iterator_create(nl_iterator, sab_nl, nthread=nthread)
818
819 mepos = 0
820
821 DO WHILE (neighbor_list_iterate(nl_iterator, mepos=mepos) == 0)
822 CALL get_iterator_info(nl_iterator, mepos=mepos, ikind=ikind, jkind=jkind, inode=inode, &
823 iatom=iatom, jatom=jatom, r=rab)
824
825 ! exclude periodic images because method is periodic intrinsically
826 IF (inode == 1) last_jatom = 0
827
828 IF (jatom /= last_jatom) THEN
829 last_jatom = jatom
830 ELSE
831 cycle
832 END IF
833
834 basis_set_a => basis_set_list_a(ikind)%gto_basis_set
835 ! When RI_AUX NONE is invoked, the pointers to basis_set_a and basis_set_b are created,
836 ! but not filled. Therefore, we check for the association and the number of entries.
837 IF (.NOT. ASSOCIATED(basis_set_a)) cycle
838 IF (sum(basis_set_a%nsgf_set) <= 0) cycle
839 basis_set_b => basis_set_list_b(jkind)%gto_basis_set
840 IF (.NOT. ASSOCIATED(basis_set_b)) cycle
841 IF (sum(basis_set_b%nsgf_set) <= 0) cycle
842 atom_a = atom_of_kind(iatom)
843 atom_b = atom_of_kind(jatom)
844
845 first_sgfa => basis_set_a%first_sgf
846 la_max => basis_set_a%lmax
847 la_min => basis_set_a%lmin
848 npgfa => basis_set_a%npgf
849 nseta = basis_set_a%nset
850 nsgfa => basis_set_a%nsgf_set
851 rpgfa => basis_set_a%pgf_radius
852 set_radius_a => basis_set_a%set_radius
853 sphi_a => basis_set_a%sphi
854 zeta => basis_set_a%zet
855 na = sum(nsgfa)
856
857 ra(:) = pbc(particle_set(iatom)%r, cell)
858
859 ! basis jkind
860 first_sgfb => basis_set_b%first_sgf
861 lb_max => basis_set_b%lmax
862 lb_min => basis_set_b%lmin
863 npgfb => basis_set_b%npgf
864 nsetb = basis_set_b%nset
865 nsgfb => basis_set_b%nsgf_set
866 rpgfb => basis_set_b%pgf_radius
867 set_radius_b => basis_set_b%set_radius
868 sphi_b => basis_set_b%sphi
869 zetb => basis_set_b%zet
870 nb = sum(nsgfb)
871
872 rb(:) = pbc(particle_set(jatom)%r, cell)
873
874 IF (do_symmetric) THEN
875 IF (iatom <= jatom) THEN
876 irow = iatom
877 icol = jatom
878 ELSE
879 irow = jatom
880 icol = iatom
881 END IF
882 ELSE
883 irow = iatom
884 icol = jatom
885 END IF
886
887 ALLOCATE (habc(na, nb, nc))
888 habc(:, :, :) = 0.0_dp ! needs to be initialized due to screening
889 IF (PRESENT(mat_dabc)) THEN
890 ALLOCATE (hdabc(3, na, nb, nc))
891 hdabc(:, :, :, :) = 0.0_dp
892 END IF
893 IF (PRESENT(mat_adbc)) THEN
894 ALLOCATE (hadbc(3, na, nb, nc))
895 hadbc(:, :, :, :) = 0.0_dp
896 END IF
897 IF (PRESENT(mat_abdc)) THEN
898 ALLOCATE (habdc(3, na, nb, nc))
899 habdc(:, :, :, :) = 0.0_dp
900 END IF
901
902 IF (calculate_forces .AND. PRESENT(pabc)) THEN
903 ALLOCATE (pabc_block(na, nb, nc))
904 DO ic = 1, nc
905 NULLIFY (pab_block)
906 CALL dbcsr_get_block_p(matrix=pabc(ic)%matrix, &
907 row=irow, col=icol, block=pab_block, found=found)
908 cpassert(found)
909 IF (irow == iatom) THEN
910 to_be_asserted = SIZE(pab_block, 1) == SIZE(pabc_block, 1) .AND. SIZE(pab_block, 2) == SIZE(pabc_block, 2)
911 cpassert(to_be_asserted)
912 pabc_block(:, :, ic) = pab_block(:, :)
913 ELSE
914 to_be_asserted = SIZE(pab_block, 2) == SIZE(pabc_block, 1) .AND. SIZE(pab_block, 1) == SIZE(pabc_block, 2)
915 cpassert(to_be_asserted)
916 pabc_block(:, :, ic) = transpose(pab_block(:, :))
917 END IF
918 END DO
919 END IF
920
921 rab(:) = pbc(rab, cell)
922 dab = sqrt(rab(1)**2 + rab(2)**2 + rab(3)**2)
923
924 offset_a_end = 0
925 DO iset = 1, nseta
926 offset_a_start = offset_a_end
927 offset_a_end = offset_a_end + nsgfa(iset)
928 sgfa = first_sgfa(1, iset)
929
930 offset_b_end = 0
931 DO jset = 1, nsetb
932 offset_b_start = offset_b_end
933 offset_b_end = offset_b_end + nsgfb(jset)
934
935 sgfb = first_sgfb(1, jset)
936
937 ! Screening
938 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
939
940 offset_c_end = 0
941 DO katom = atom_start, atom_end
942
943 atom_c = atom_of_kind(katom)
944
945 kkind = kind_of(katom)
946 CALL get_qs_kind(qs_kind=qs_kind_set(kkind), basis_set=basis_set_c, basis_type=basis_type_c)
947 first_sgfc => basis_set_c%first_sgf
948 lc_max => basis_set_c%lmax
949 lc_min => basis_set_c%lmin
950 nsetc = basis_set_c%nset
951 nsgfc => basis_set_c%nsgf_set
952 rpgfc => basis_set_c%pgf_radius
953 sphi_c => basis_set_c%sphi
954 zetc => basis_set_c%zet
955 npgfc => basis_set_c%npgf
956
957 rc(:) = pbc(particle_set(katom)%r, cell)
958
959 kset_start = 1; kset_end = nsetc
960 IF (katom == atom_start) kset_start = set_start
961 IF (katom == atom_end) kset_end = set_end
962
963 DO kset = kset_start, kset_end
964 first_set = 1; last_set = nsgfc(kset)
965 IF (kset == kset_start .AND. katom == atom_start) first_set = set_offset_start
966 IF (kset == kset_end .AND. katom == atom_end) last_set = set_offset_end
967
968 offset_c_start = offset_c_end
969 offset_c_end = offset_c_end + last_set + 1 - first_set
970 sgfc = first_sgfc(1, kset)
971
972 IF (.NOT.PRESENT(force_a) .AND. &
973 .NOT.PRESENT(force_b) .AND. &
974 .NOT.PRESENT(force_c) .AND. &
975 .NOT.PRESENT(pabc) .AND. &
976 .NOT.PRESENT(mat_dabc) .AND. &
977 .NOT.PRESENT(mat_adbc) .AND. &
978 .NOT.PRESENT(mat_abdc)) THEN
979 CALL integrate_set_3c( &
980 param%par, potential_parameter, &
981 la_min(iset), la_max(iset), &
982 lb_min(jset), lb_max(jset), &
983 lc_min(kset), lc_max(kset), &
984 npgfa(iset), npgfb(jset), npgfc(kset), &
985 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
986 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
987 ra, rb, rc, &
988 habc, &
989 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
990 offset_a_start, offset_b_start, offset_c_start, &
991 0, 0, first_set - 1, &
992 sphi_a, sphi_b, sphi_c, &
993 sgfa, sgfb, sgfc, &
994 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
995 my_eri_method, &
996 coulomb_context=integral_context, &
997
998
999
1000
1001 do_symmetric=do_symmetric, &
1002 on_diagonal=iatom == jatom, &
1003
1004
1005
1006 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1007 END IF
1008 IF (.NOT.PRESENT(force_a) .AND. &
1009 .NOT.PRESENT(force_b) .AND. &
1010 .NOT.PRESENT(force_c) .AND. &
1011 .NOT.PRESENT(pabc) .AND. &
1012 .NOT.PRESENT(mat_dabc) .AND. &
1013 .NOT.PRESENT(mat_adbc) .AND. &
1014 PRESENT(mat_abdc)) THEN
1015 CALL integrate_set_3c( &
1016 param%par, potential_parameter, &
1017 la_min(iset), la_max(iset), &
1018 lb_min(jset), lb_max(jset), &
1019 lc_min(kset), lc_max(kset), &
1020 npgfa(iset), npgfb(jset), npgfc(kset), &
1021 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1022 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1023 ra, rb, rc, &
1024 habc, &
1025 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1026 offset_a_start, offset_b_start, offset_c_start, &
1027 0, 0, first_set - 1, &
1028 sphi_a, sphi_b, sphi_c, &
1029 sgfa, sgfb, sgfc, &
1030 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1031 my_eri_method, &
1032 coulomb_context=integral_context, &
1033
1034
1035
1036
1037 do_symmetric=do_symmetric, &
1038 on_diagonal=iatom == jatom, &
1039
1040
1041habdc=habdc, &
1042 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1043 END IF
1044 IF (.NOT.PRESENT(force_a) .AND. &
1045 .NOT.PRESENT(force_b) .AND. &
1046 .NOT.PRESENT(force_c) .AND. &
1047 .NOT.PRESENT(pabc) .AND. &
1048 .NOT.PRESENT(mat_dabc) .AND. &
1049 PRESENT(mat_adbc) .AND. &
1050 .NOT.PRESENT(mat_abdc)) THEN
1051 CALL integrate_set_3c( &
1052 param%par, potential_parameter, &
1053 la_min(iset), la_max(iset), &
1054 lb_min(jset), lb_max(jset), &
1055 lc_min(kset), lc_max(kset), &
1056 npgfa(iset), npgfb(jset), npgfc(kset), &
1057 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1058 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1059 ra, rb, rc, &
1060 habc, &
1061 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1062 offset_a_start, offset_b_start, offset_c_start, &
1063 0, 0, first_set - 1, &
1064 sphi_a, sphi_b, sphi_c, &
1065 sgfa, sgfb, sgfc, &
1066 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1067 my_eri_method, &
1068 coulomb_context=integral_context, &
1069
1070
1071
1072
1073 do_symmetric=do_symmetric, &
1074 on_diagonal=iatom == jatom, &
1075
1076hadbc=hadbc, &
1077
1078 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1079 END IF
1080 IF (.NOT.PRESENT(force_a) .AND. &
1081 .NOT.PRESENT(force_b) .AND. &
1082 .NOT.PRESENT(force_c) .AND. &
1083 .NOT.PRESENT(pabc) .AND. &
1084 .NOT.PRESENT(mat_dabc) .AND. &
1085 PRESENT(mat_adbc) .AND. &
1086 PRESENT(mat_abdc)) THEN
1087 CALL integrate_set_3c( &
1088 param%par, potential_parameter, &
1089 la_min(iset), la_max(iset), &
1090 lb_min(jset), lb_max(jset), &
1091 lc_min(kset), lc_max(kset), &
1092 npgfa(iset), npgfb(jset), npgfc(kset), &
1093 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1094 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1095 ra, rb, rc, &
1096 habc, &
1097 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1098 offset_a_start, offset_b_start, offset_c_start, &
1099 0, 0, first_set - 1, &
1100 sphi_a, sphi_b, sphi_c, &
1101 sgfa, sgfb, sgfc, &
1102 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1103 my_eri_method, &
1104 coulomb_context=integral_context, &
1105
1106
1107
1108
1109 do_symmetric=do_symmetric, &
1110 on_diagonal=iatom == jatom, &
1111
1112hadbc=hadbc, &
1113habdc=habdc, &
1114 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1115 END IF
1116 IF (.NOT.PRESENT(force_a) .AND. &
1117 .NOT.PRESENT(force_b) .AND. &
1118 .NOT.PRESENT(force_c) .AND. &
1119 .NOT.PRESENT(pabc) .AND. &
1120 PRESENT(mat_dabc) .AND. &
1121 .NOT.PRESENT(mat_adbc) .AND. &
1122 .NOT.PRESENT(mat_abdc)) THEN
1123 CALL integrate_set_3c( &
1124 param%par, potential_parameter, &
1125 la_min(iset), la_max(iset), &
1126 lb_min(jset), lb_max(jset), &
1127 lc_min(kset), lc_max(kset), &
1128 npgfa(iset), npgfb(jset), npgfc(kset), &
1129 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1130 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1131 ra, rb, rc, &
1132 habc, &
1133 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1134 offset_a_start, offset_b_start, offset_c_start, &
1135 0, 0, first_set - 1, &
1136 sphi_a, sphi_b, sphi_c, &
1137 sgfa, sgfb, sgfc, &
1138 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1139 my_eri_method, &
1140 coulomb_context=integral_context, &
1141
1142
1143
1144
1145 do_symmetric=do_symmetric, &
1146 on_diagonal=iatom == jatom, &
1147hdabc=hdabc, &
1148
1149
1150 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1151 END IF
1152 IF (.NOT.PRESENT(force_a) .AND. &
1153 .NOT.PRESENT(force_b) .AND. &
1154 .NOT.PRESENT(force_c) .AND. &
1155 .NOT.PRESENT(pabc) .AND. &
1156 PRESENT(mat_dabc) .AND. &
1157 .NOT.PRESENT(mat_adbc) .AND. &
1158 PRESENT(mat_abdc)) THEN
1159 CALL integrate_set_3c( &
1160 param%par, potential_parameter, &
1161 la_min(iset), la_max(iset), &
1162 lb_min(jset), lb_max(jset), &
1163 lc_min(kset), lc_max(kset), &
1164 npgfa(iset), npgfb(jset), npgfc(kset), &
1165 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1166 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1167 ra, rb, rc, &
1168 habc, &
1169 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1170 offset_a_start, offset_b_start, offset_c_start, &
1171 0, 0, first_set - 1, &
1172 sphi_a, sphi_b, sphi_c, &
1173 sgfa, sgfb, sgfc, &
1174 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1175 my_eri_method, &
1176 coulomb_context=integral_context, &
1177
1178
1179
1180
1181 do_symmetric=do_symmetric, &
1182 on_diagonal=iatom == jatom, &
1183hdabc=hdabc, &
1184
1185habdc=habdc, &
1186 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1187 END IF
1188 IF (.NOT.PRESENT(force_a) .AND. &
1189 .NOT.PRESENT(force_b) .AND. &
1190 .NOT.PRESENT(force_c) .AND. &
1191 .NOT.PRESENT(pabc) .AND. &
1192 PRESENT(mat_dabc) .AND. &
1193 PRESENT(mat_adbc) .AND. &
1194 .NOT.PRESENT(mat_abdc)) THEN
1195 CALL integrate_set_3c( &
1196 param%par, potential_parameter, &
1197 la_min(iset), la_max(iset), &
1198 lb_min(jset), lb_max(jset), &
1199 lc_min(kset), lc_max(kset), &
1200 npgfa(iset), npgfb(jset), npgfc(kset), &
1201 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1202 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1203 ra, rb, rc, &
1204 habc, &
1205 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1206 offset_a_start, offset_b_start, offset_c_start, &
1207 0, 0, first_set - 1, &
1208 sphi_a, sphi_b, sphi_c, &
1209 sgfa, sgfb, sgfc, &
1210 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1211 my_eri_method, &
1212 coulomb_context=integral_context, &
1213
1214
1215
1216
1217 do_symmetric=do_symmetric, &
1218 on_diagonal=iatom == jatom, &
1219hdabc=hdabc, &
1220hadbc=hadbc, &
1221
1222 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1223 END IF
1224 IF (.NOT.PRESENT(force_a) .AND. &
1225 .NOT.PRESENT(force_b) .AND. &
1226 .NOT.PRESENT(force_c) .AND. &
1227 .NOT.PRESENT(pabc) .AND. &
1228 PRESENT(mat_dabc) .AND. &
1229 PRESENT(mat_adbc) .AND. &
1230 PRESENT(mat_abdc)) THEN
1231 CALL integrate_set_3c( &
1232 param%par, potential_parameter, &
1233 la_min(iset), la_max(iset), &
1234 lb_min(jset), lb_max(jset), &
1235 lc_min(kset), lc_max(kset), &
1236 npgfa(iset), npgfb(jset), npgfc(kset), &
1237 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1238 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1239 ra, rb, rc, &
1240 habc, &
1241 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1242 offset_a_start, offset_b_start, offset_c_start, &
1243 0, 0, first_set - 1, &
1244 sphi_a, sphi_b, sphi_c, &
1245 sgfa, sgfb, sgfc, &
1246 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1247 my_eri_method, &
1248 coulomb_context=integral_context, &
1249
1250
1251
1252
1253 do_symmetric=do_symmetric, &
1254 on_diagonal=iatom == jatom, &
1255hdabc=hdabc, &
1256hadbc=hadbc, &
1257habdc=habdc, &
1258 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1259 END IF
1260 IF (.NOT.PRESENT(force_a) .AND. &
1261 .NOT.PRESENT(force_b) .AND. &
1262 PRESENT(force_c) .AND. &
1263 .NOT.PRESENT(pabc) .AND. &
1264 .NOT.PRESENT(mat_dabc) .AND. &
1265 .NOT.PRESENT(mat_adbc) .AND. &
1266 .NOT.PRESENT(mat_abdc)) THEN
1267 CALL integrate_set_3c( &
1268 param%par, potential_parameter, &
1269 la_min(iset), la_max(iset), &
1270 lb_min(jset), lb_max(jset), &
1271 lc_min(kset), lc_max(kset), &
1272 npgfa(iset), npgfb(jset), npgfc(kset), &
1273 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1274 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1275 ra, rb, rc, &
1276 habc, &
1277 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1278 offset_a_start, offset_b_start, offset_c_start, &
1279 0, 0, first_set - 1, &
1280 sphi_a, sphi_b, sphi_c, &
1281 sgfa, sgfb, sgfc, &
1282 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1283 my_eri_method, &
1284 coulomb_context=integral_context, &
1285
1286
1287
1288force_c=force_c(kkind)%forces(:, atom_c), &
1289 do_symmetric=do_symmetric, &
1290 on_diagonal=iatom == jatom, &
1291
1292
1293
1294 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1295 END IF
1296 IF (.NOT.PRESENT(force_a) .AND. &
1297 .NOT.PRESENT(force_b) .AND. &
1298 PRESENT(force_c) .AND. &
1299 .NOT.PRESENT(pabc) .AND. &
1300 .NOT.PRESENT(mat_dabc) .AND. &
1301 .NOT.PRESENT(mat_adbc) .AND. &
1302 PRESENT(mat_abdc)) THEN
1303 CALL integrate_set_3c( &
1304 param%par, potential_parameter, &
1305 la_min(iset), la_max(iset), &
1306 lb_min(jset), lb_max(jset), &
1307 lc_min(kset), lc_max(kset), &
1308 npgfa(iset), npgfb(jset), npgfc(kset), &
1309 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1310 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1311 ra, rb, rc, &
1312 habc, &
1313 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1314 offset_a_start, offset_b_start, offset_c_start, &
1315 0, 0, first_set - 1, &
1316 sphi_a, sphi_b, sphi_c, &
1317 sgfa, sgfb, sgfc, &
1318 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1319 my_eri_method, &
1320 coulomb_context=integral_context, &
1321
1322
1323
1324force_c=force_c(kkind)%forces(:, atom_c), &
1325 do_symmetric=do_symmetric, &
1326 on_diagonal=iatom == jatom, &
1327
1328
1329habdc=habdc, &
1330 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1331 END IF
1332 IF (.NOT.PRESENT(force_a) .AND. &
1333 .NOT.PRESENT(force_b) .AND. &
1334 PRESENT(force_c) .AND. &
1335 .NOT.PRESENT(pabc) .AND. &
1336 .NOT.PRESENT(mat_dabc) .AND. &
1337 PRESENT(mat_adbc) .AND. &
1338 .NOT.PRESENT(mat_abdc)) THEN
1339 CALL integrate_set_3c( &
1340 param%par, potential_parameter, &
1341 la_min(iset), la_max(iset), &
1342 lb_min(jset), lb_max(jset), &
1343 lc_min(kset), lc_max(kset), &
1344 npgfa(iset), npgfb(jset), npgfc(kset), &
1345 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1346 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1347 ra, rb, rc, &
1348 habc, &
1349 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1350 offset_a_start, offset_b_start, offset_c_start, &
1351 0, 0, first_set - 1, &
1352 sphi_a, sphi_b, sphi_c, &
1353 sgfa, sgfb, sgfc, &
1354 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1355 my_eri_method, &
1356 coulomb_context=integral_context, &
1357
1358
1359
1360force_c=force_c(kkind)%forces(:, atom_c), &
1361 do_symmetric=do_symmetric, &
1362 on_diagonal=iatom == jatom, &
1363
1364hadbc=hadbc, &
1365
1366 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1367 END IF
1368 IF (.NOT.PRESENT(force_a) .AND. &
1369 .NOT.PRESENT(force_b) .AND. &
1370 PRESENT(force_c) .AND. &
1371 .NOT.PRESENT(pabc) .AND. &
1372 .NOT.PRESENT(mat_dabc) .AND. &
1373 PRESENT(mat_adbc) .AND. &
1374 PRESENT(mat_abdc)) THEN
1375 CALL integrate_set_3c( &
1376 param%par, potential_parameter, &
1377 la_min(iset), la_max(iset), &
1378 lb_min(jset), lb_max(jset), &
1379 lc_min(kset), lc_max(kset), &
1380 npgfa(iset), npgfb(jset), npgfc(kset), &
1381 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1382 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1383 ra, rb, rc, &
1384 habc, &
1385 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1386 offset_a_start, offset_b_start, offset_c_start, &
1387 0, 0, first_set - 1, &
1388 sphi_a, sphi_b, sphi_c, &
1389 sgfa, sgfb, sgfc, &
1390 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1391 my_eri_method, &
1392 coulomb_context=integral_context, &
1393
1394
1395
1396force_c=force_c(kkind)%forces(:, atom_c), &
1397 do_symmetric=do_symmetric, &
1398 on_diagonal=iatom == jatom, &
1399
1400hadbc=hadbc, &
1401habdc=habdc, &
1402 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1403 END IF
1404 IF (.NOT.PRESENT(force_a) .AND. &
1405 .NOT.PRESENT(force_b) .AND. &
1406 PRESENT(force_c) .AND. &
1407 .NOT.PRESENT(pabc) .AND. &
1408 PRESENT(mat_dabc) .AND. &
1409 .NOT.PRESENT(mat_adbc) .AND. &
1410 .NOT.PRESENT(mat_abdc)) THEN
1411 CALL integrate_set_3c( &
1412 param%par, potential_parameter, &
1413 la_min(iset), la_max(iset), &
1414 lb_min(jset), lb_max(jset), &
1415 lc_min(kset), lc_max(kset), &
1416 npgfa(iset), npgfb(jset), npgfc(kset), &
1417 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1418 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1419 ra, rb, rc, &
1420 habc, &
1421 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1422 offset_a_start, offset_b_start, offset_c_start, &
1423 0, 0, first_set - 1, &
1424 sphi_a, sphi_b, sphi_c, &
1425 sgfa, sgfb, sgfc, &
1426 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1427 my_eri_method, &
1428 coulomb_context=integral_context, &
1429
1430
1431
1432force_c=force_c(kkind)%forces(:, atom_c), &
1433 do_symmetric=do_symmetric, &
1434 on_diagonal=iatom == jatom, &
1435hdabc=hdabc, &
1436
1437
1438 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1439 END IF
1440 IF (.NOT.PRESENT(force_a) .AND. &
1441 .NOT.PRESENT(force_b) .AND. &
1442 PRESENT(force_c) .AND. &
1443 .NOT.PRESENT(pabc) .AND. &
1444 PRESENT(mat_dabc) .AND. &
1445 .NOT.PRESENT(mat_adbc) .AND. &
1446 PRESENT(mat_abdc)) THEN
1447 CALL integrate_set_3c( &
1448 param%par, potential_parameter, &
1449 la_min(iset), la_max(iset), &
1450 lb_min(jset), lb_max(jset), &
1451 lc_min(kset), lc_max(kset), &
1452 npgfa(iset), npgfb(jset), npgfc(kset), &
1453 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1454 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1455 ra, rb, rc, &
1456 habc, &
1457 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1458 offset_a_start, offset_b_start, offset_c_start, &
1459 0, 0, first_set - 1, &
1460 sphi_a, sphi_b, sphi_c, &
1461 sgfa, sgfb, sgfc, &
1462 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1463 my_eri_method, &
1464 coulomb_context=integral_context, &
1465
1466
1467
1468force_c=force_c(kkind)%forces(:, atom_c), &
1469 do_symmetric=do_symmetric, &
1470 on_diagonal=iatom == jatom, &
1471hdabc=hdabc, &
1472
1473habdc=habdc, &
1474 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1475 END IF
1476 IF (.NOT.PRESENT(force_a) .AND. &
1477 .NOT.PRESENT(force_b) .AND. &
1478 PRESENT(force_c) .AND. &
1479 .NOT.PRESENT(pabc) .AND. &
1480 PRESENT(mat_dabc) .AND. &
1481 PRESENT(mat_adbc) .AND. &
1482 .NOT.PRESENT(mat_abdc)) THEN
1483 CALL integrate_set_3c( &
1484 param%par, potential_parameter, &
1485 la_min(iset), la_max(iset), &
1486 lb_min(jset), lb_max(jset), &
1487 lc_min(kset), lc_max(kset), &
1488 npgfa(iset), npgfb(jset), npgfc(kset), &
1489 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1490 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1491 ra, rb, rc, &
1492 habc, &
1493 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1494 offset_a_start, offset_b_start, offset_c_start, &
1495 0, 0, first_set - 1, &
1496 sphi_a, sphi_b, sphi_c, &
1497 sgfa, sgfb, sgfc, &
1498 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1499 my_eri_method, &
1500 coulomb_context=integral_context, &
1501
1502
1503
1504force_c=force_c(kkind)%forces(:, atom_c), &
1505 do_symmetric=do_symmetric, &
1506 on_diagonal=iatom == jatom, &
1507hdabc=hdabc, &
1508hadbc=hadbc, &
1509
1510 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1511 END IF
1512 IF (.NOT.PRESENT(force_a) .AND. &
1513 .NOT.PRESENT(force_b) .AND. &
1514 PRESENT(force_c) .AND. &
1515 .NOT.PRESENT(pabc) .AND. &
1516 PRESENT(mat_dabc) .AND. &
1517 PRESENT(mat_adbc) .AND. &
1518 PRESENT(mat_abdc)) THEN
1519 CALL integrate_set_3c( &
1520 param%par, potential_parameter, &
1521 la_min(iset), la_max(iset), &
1522 lb_min(jset), lb_max(jset), &
1523 lc_min(kset), lc_max(kset), &
1524 npgfa(iset), npgfb(jset), npgfc(kset), &
1525 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1526 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1527 ra, rb, rc, &
1528 habc, &
1529 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1530 offset_a_start, offset_b_start, offset_c_start, &
1531 0, 0, first_set - 1, &
1532 sphi_a, sphi_b, sphi_c, &
1533 sgfa, sgfb, sgfc, &
1534 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1535 my_eri_method, &
1536 coulomb_context=integral_context, &
1537
1538
1539
1540force_c=force_c(kkind)%forces(:, atom_c), &
1541 do_symmetric=do_symmetric, &
1542 on_diagonal=iatom == jatom, &
1543hdabc=hdabc, &
1544hadbc=hadbc, &
1545habdc=habdc, &
1546 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1547 END IF
1548 IF (.NOT.PRESENT(force_a) .AND. &
1549 PRESENT(force_b) .AND. &
1550 .NOT.PRESENT(force_c) .AND. &
1551 .NOT.PRESENT(pabc) .AND. &
1552 .NOT.PRESENT(mat_dabc) .AND. &
1553 .NOT.PRESENT(mat_adbc) .AND. &
1554 .NOT.PRESENT(mat_abdc)) THEN
1555 CALL integrate_set_3c( &
1556 param%par, potential_parameter, &
1557 la_min(iset), la_max(iset), &
1558 lb_min(jset), lb_max(jset), &
1559 lc_min(kset), lc_max(kset), &
1560 npgfa(iset), npgfb(jset), npgfc(kset), &
1561 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1562 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1563 ra, rb, rc, &
1564 habc, &
1565 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1566 offset_a_start, offset_b_start, offset_c_start, &
1567 0, 0, first_set - 1, &
1568 sphi_a, sphi_b, sphi_c, &
1569 sgfa, sgfb, sgfc, &
1570 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1571 my_eri_method, &
1572 coulomb_context=integral_context, &
1573
1574
1575force_b=force_b(jkind)%forces(:, atom_b), &
1576
1577 do_symmetric=do_symmetric, &
1578 on_diagonal=iatom == jatom, &
1579
1580
1581
1582 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1583 END IF
1584 IF (.NOT.PRESENT(force_a) .AND. &
1585 PRESENT(force_b) .AND. &
1586 .NOT.PRESENT(force_c) .AND. &
1587 .NOT.PRESENT(pabc) .AND. &
1588 .NOT.PRESENT(mat_dabc) .AND. &
1589 .NOT.PRESENT(mat_adbc) .AND. &
1590 PRESENT(mat_abdc)) THEN
1591 CALL integrate_set_3c( &
1592 param%par, potential_parameter, &
1593 la_min(iset), la_max(iset), &
1594 lb_min(jset), lb_max(jset), &
1595 lc_min(kset), lc_max(kset), &
1596 npgfa(iset), npgfb(jset), npgfc(kset), &
1597 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1598 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1599 ra, rb, rc, &
1600 habc, &
1601 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1602 offset_a_start, offset_b_start, offset_c_start, &
1603 0, 0, first_set - 1, &
1604 sphi_a, sphi_b, sphi_c, &
1605 sgfa, sgfb, sgfc, &
1606 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1607 my_eri_method, &
1608 coulomb_context=integral_context, &
1609
1610
1611force_b=force_b(jkind)%forces(:, atom_b), &
1612
1613 do_symmetric=do_symmetric, &
1614 on_diagonal=iatom == jatom, &
1615
1616
1617habdc=habdc, &
1618 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1619 END IF
1620 IF (.NOT.PRESENT(force_a) .AND. &
1621 PRESENT(force_b) .AND. &
1622 .NOT.PRESENT(force_c) .AND. &
1623 .NOT.PRESENT(pabc) .AND. &
1624 .NOT.PRESENT(mat_dabc) .AND. &
1625 PRESENT(mat_adbc) .AND. &
1626 .NOT.PRESENT(mat_abdc)) THEN
1627 CALL integrate_set_3c( &
1628 param%par, potential_parameter, &
1629 la_min(iset), la_max(iset), &
1630 lb_min(jset), lb_max(jset), &
1631 lc_min(kset), lc_max(kset), &
1632 npgfa(iset), npgfb(jset), npgfc(kset), &
1633 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1634 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1635 ra, rb, rc, &
1636 habc, &
1637 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1638 offset_a_start, offset_b_start, offset_c_start, &
1639 0, 0, first_set - 1, &
1640 sphi_a, sphi_b, sphi_c, &
1641 sgfa, sgfb, sgfc, &
1642 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1643 my_eri_method, &
1644 coulomb_context=integral_context, &
1645
1646
1647force_b=force_b(jkind)%forces(:, atom_b), &
1648
1649 do_symmetric=do_symmetric, &
1650 on_diagonal=iatom == jatom, &
1651
1652hadbc=hadbc, &
1653
1654 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1655 END IF
1656 IF (.NOT.PRESENT(force_a) .AND. &
1657 PRESENT(force_b) .AND. &
1658 .NOT.PRESENT(force_c) .AND. &
1659 .NOT.PRESENT(pabc) .AND. &
1660 .NOT.PRESENT(mat_dabc) .AND. &
1661 PRESENT(mat_adbc) .AND. &
1662 PRESENT(mat_abdc)) THEN
1663 CALL integrate_set_3c( &
1664 param%par, potential_parameter, &
1665 la_min(iset), la_max(iset), &
1666 lb_min(jset), lb_max(jset), &
1667 lc_min(kset), lc_max(kset), &
1668 npgfa(iset), npgfb(jset), npgfc(kset), &
1669 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1670 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1671 ra, rb, rc, &
1672 habc, &
1673 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1674 offset_a_start, offset_b_start, offset_c_start, &
1675 0, 0, first_set - 1, &
1676 sphi_a, sphi_b, sphi_c, &
1677 sgfa, sgfb, sgfc, &
1678 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1679 my_eri_method, &
1680 coulomb_context=integral_context, &
1681
1682
1683force_b=force_b(jkind)%forces(:, atom_b), &
1684
1685 do_symmetric=do_symmetric, &
1686 on_diagonal=iatom == jatom, &
1687
1688hadbc=hadbc, &
1689habdc=habdc, &
1690 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1691 END IF
1692 IF (.NOT.PRESENT(force_a) .AND. &
1693 PRESENT(force_b) .AND. &
1694 .NOT.PRESENT(force_c) .AND. &
1695 .NOT.PRESENT(pabc) .AND. &
1696 PRESENT(mat_dabc) .AND. &
1697 .NOT.PRESENT(mat_adbc) .AND. &
1698 .NOT.PRESENT(mat_abdc)) THEN
1699 CALL integrate_set_3c( &
1700 param%par, potential_parameter, &
1701 la_min(iset), la_max(iset), &
1702 lb_min(jset), lb_max(jset), &
1703 lc_min(kset), lc_max(kset), &
1704 npgfa(iset), npgfb(jset), npgfc(kset), &
1705 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1706 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1707 ra, rb, rc, &
1708 habc, &
1709 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1710 offset_a_start, offset_b_start, offset_c_start, &
1711 0, 0, first_set - 1, &
1712 sphi_a, sphi_b, sphi_c, &
1713 sgfa, sgfb, sgfc, &
1714 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1715 my_eri_method, &
1716 coulomb_context=integral_context, &
1717
1718
1719force_b=force_b(jkind)%forces(:, atom_b), &
1720
1721 do_symmetric=do_symmetric, &
1722 on_diagonal=iatom == jatom, &
1723hdabc=hdabc, &
1724
1725
1726 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1727 END IF
1728 IF (.NOT.PRESENT(force_a) .AND. &
1729 PRESENT(force_b) .AND. &
1730 .NOT.PRESENT(force_c) .AND. &
1731 .NOT.PRESENT(pabc) .AND. &
1732 PRESENT(mat_dabc) .AND. &
1733 .NOT.PRESENT(mat_adbc) .AND. &
1734 PRESENT(mat_abdc)) THEN
1735 CALL integrate_set_3c( &
1736 param%par, potential_parameter, &
1737 la_min(iset), la_max(iset), &
1738 lb_min(jset), lb_max(jset), &
1739 lc_min(kset), lc_max(kset), &
1740 npgfa(iset), npgfb(jset), npgfc(kset), &
1741 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1742 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1743 ra, rb, rc, &
1744 habc, &
1745 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1746 offset_a_start, offset_b_start, offset_c_start, &
1747 0, 0, first_set - 1, &
1748 sphi_a, sphi_b, sphi_c, &
1749 sgfa, sgfb, sgfc, &
1750 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1751 my_eri_method, &
1752 coulomb_context=integral_context, &
1753
1754
1755force_b=force_b(jkind)%forces(:, atom_b), &
1756
1757 do_symmetric=do_symmetric, &
1758 on_diagonal=iatom == jatom, &
1759hdabc=hdabc, &
1760
1761habdc=habdc, &
1762 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1763 END IF
1764 IF (.NOT.PRESENT(force_a) .AND. &
1765 PRESENT(force_b) .AND. &
1766 .NOT.PRESENT(force_c) .AND. &
1767 .NOT.PRESENT(pabc) .AND. &
1768 PRESENT(mat_dabc) .AND. &
1769 PRESENT(mat_adbc) .AND. &
1770 .NOT.PRESENT(mat_abdc)) THEN
1771 CALL integrate_set_3c( &
1772 param%par, potential_parameter, &
1773 la_min(iset), la_max(iset), &
1774 lb_min(jset), lb_max(jset), &
1775 lc_min(kset), lc_max(kset), &
1776 npgfa(iset), npgfb(jset), npgfc(kset), &
1777 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1778 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1779 ra, rb, rc, &
1780 habc, &
1781 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1782 offset_a_start, offset_b_start, offset_c_start, &
1783 0, 0, first_set - 1, &
1784 sphi_a, sphi_b, sphi_c, &
1785 sgfa, sgfb, sgfc, &
1786 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1787 my_eri_method, &
1788 coulomb_context=integral_context, &
1789
1790
1791force_b=force_b(jkind)%forces(:, atom_b), &
1792
1793 do_symmetric=do_symmetric, &
1794 on_diagonal=iatom == jatom, &
1795hdabc=hdabc, &
1796hadbc=hadbc, &
1797
1798 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1799 END IF
1800 IF (.NOT.PRESENT(force_a) .AND. &
1801 PRESENT(force_b) .AND. &
1802 .NOT.PRESENT(force_c) .AND. &
1803 .NOT.PRESENT(pabc) .AND. &
1804 PRESENT(mat_dabc) .AND. &
1805 PRESENT(mat_adbc) .AND. &
1806 PRESENT(mat_abdc)) THEN
1807 CALL integrate_set_3c( &
1808 param%par, potential_parameter, &
1809 la_min(iset), la_max(iset), &
1810 lb_min(jset), lb_max(jset), &
1811 lc_min(kset), lc_max(kset), &
1812 npgfa(iset), npgfb(jset), npgfc(kset), &
1813 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1814 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1815 ra, rb, rc, &
1816 habc, &
1817 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1818 offset_a_start, offset_b_start, offset_c_start, &
1819 0, 0, first_set - 1, &
1820 sphi_a, sphi_b, sphi_c, &
1821 sgfa, sgfb, sgfc, &
1822 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1823 my_eri_method, &
1824 coulomb_context=integral_context, &
1825
1826
1827force_b=force_b(jkind)%forces(:, atom_b), &
1828
1829 do_symmetric=do_symmetric, &
1830 on_diagonal=iatom == jatom, &
1831hdabc=hdabc, &
1832hadbc=hadbc, &
1833habdc=habdc, &
1834 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1835 END IF
1836 IF (.NOT.PRESENT(force_a) .AND. &
1837 PRESENT(force_b) .AND. &
1838 PRESENT(force_c) .AND. &
1839 .NOT.PRESENT(pabc) .AND. &
1840 .NOT.PRESENT(mat_dabc) .AND. &
1841 .NOT.PRESENT(mat_adbc) .AND. &
1842 .NOT.PRESENT(mat_abdc)) THEN
1843 CALL integrate_set_3c( &
1844 param%par, potential_parameter, &
1845 la_min(iset), la_max(iset), &
1846 lb_min(jset), lb_max(jset), &
1847 lc_min(kset), lc_max(kset), &
1848 npgfa(iset), npgfb(jset), npgfc(kset), &
1849 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1850 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1851 ra, rb, rc, &
1852 habc, &
1853 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1854 offset_a_start, offset_b_start, offset_c_start, &
1855 0, 0, first_set - 1, &
1856 sphi_a, sphi_b, sphi_c, &
1857 sgfa, sgfb, sgfc, &
1858 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1859 my_eri_method, &
1860 coulomb_context=integral_context, &
1861
1862
1863force_b=force_b(jkind)%forces(:, atom_b), &
1864force_c=force_c(kkind)%forces(:, atom_c), &
1865 do_symmetric=do_symmetric, &
1866 on_diagonal=iatom == jatom, &
1867
1868
1869
1870 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1871 END IF
1872 IF (.NOT.PRESENT(force_a) .AND. &
1873 PRESENT(force_b) .AND. &
1874 PRESENT(force_c) .AND. &
1875 .NOT.PRESENT(pabc) .AND. &
1876 .NOT.PRESENT(mat_dabc) .AND. &
1877 .NOT.PRESENT(mat_adbc) .AND. &
1878 PRESENT(mat_abdc)) THEN
1879 CALL integrate_set_3c( &
1880 param%par, potential_parameter, &
1881 la_min(iset), la_max(iset), &
1882 lb_min(jset), lb_max(jset), &
1883 lc_min(kset), lc_max(kset), &
1884 npgfa(iset), npgfb(jset), npgfc(kset), &
1885 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1886 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1887 ra, rb, rc, &
1888 habc, &
1889 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1890 offset_a_start, offset_b_start, offset_c_start, &
1891 0, 0, first_set - 1, &
1892 sphi_a, sphi_b, sphi_c, &
1893 sgfa, sgfb, sgfc, &
1894 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1895 my_eri_method, &
1896 coulomb_context=integral_context, &
1897
1898
1899force_b=force_b(jkind)%forces(:, atom_b), &
1900force_c=force_c(kkind)%forces(:, atom_c), &
1901 do_symmetric=do_symmetric, &
1902 on_diagonal=iatom == jatom, &
1903
1904
1905habdc=habdc, &
1906 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1907 END IF
1908 IF (.NOT.PRESENT(force_a) .AND. &
1909 PRESENT(force_b) .AND. &
1910 PRESENT(force_c) .AND. &
1911 .NOT.PRESENT(pabc) .AND. &
1912 .NOT.PRESENT(mat_dabc) .AND. &
1913 PRESENT(mat_adbc) .AND. &
1914 .NOT.PRESENT(mat_abdc)) THEN
1915 CALL integrate_set_3c( &
1916 param%par, potential_parameter, &
1917 la_min(iset), la_max(iset), &
1918 lb_min(jset), lb_max(jset), &
1919 lc_min(kset), lc_max(kset), &
1920 npgfa(iset), npgfb(jset), npgfc(kset), &
1921 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1922 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1923 ra, rb, rc, &
1924 habc, &
1925 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1926 offset_a_start, offset_b_start, offset_c_start, &
1927 0, 0, first_set - 1, &
1928 sphi_a, sphi_b, sphi_c, &
1929 sgfa, sgfb, sgfc, &
1930 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1931 my_eri_method, &
1932 coulomb_context=integral_context, &
1933
1934
1935force_b=force_b(jkind)%forces(:, atom_b), &
1936force_c=force_c(kkind)%forces(:, atom_c), &
1937 do_symmetric=do_symmetric, &
1938 on_diagonal=iatom == jatom, &
1939
1940hadbc=hadbc, &
1941
1942 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1943 END IF
1944 IF (.NOT.PRESENT(force_a) .AND. &
1945 PRESENT(force_b) .AND. &
1946 PRESENT(force_c) .AND. &
1947 .NOT.PRESENT(pabc) .AND. &
1948 .NOT.PRESENT(mat_dabc) .AND. &
1949 PRESENT(mat_adbc) .AND. &
1950 PRESENT(mat_abdc)) THEN
1951 CALL integrate_set_3c( &
1952 param%par, potential_parameter, &
1953 la_min(iset), la_max(iset), &
1954 lb_min(jset), lb_max(jset), &
1955 lc_min(kset), lc_max(kset), &
1956 npgfa(iset), npgfb(jset), npgfc(kset), &
1957 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1958 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1959 ra, rb, rc, &
1960 habc, &
1961 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1962 offset_a_start, offset_b_start, offset_c_start, &
1963 0, 0, first_set - 1, &
1964 sphi_a, sphi_b, sphi_c, &
1965 sgfa, sgfb, sgfc, &
1966 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
1967 my_eri_method, &
1968 coulomb_context=integral_context, &
1969
1970
1971force_b=force_b(jkind)%forces(:, atom_b), &
1972force_c=force_c(kkind)%forces(:, atom_c), &
1973 do_symmetric=do_symmetric, &
1974 on_diagonal=iatom == jatom, &
1975
1976hadbc=hadbc, &
1977habdc=habdc, &
1978 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
1979 END IF
1980 IF (.NOT.PRESENT(force_a) .AND. &
1981 PRESENT(force_b) .AND. &
1982 PRESENT(force_c) .AND. &
1983 .NOT.PRESENT(pabc) .AND. &
1984 PRESENT(mat_dabc) .AND. &
1985 .NOT.PRESENT(mat_adbc) .AND. &
1986 .NOT.PRESENT(mat_abdc)) THEN
1987 CALL integrate_set_3c( &
1988 param%par, potential_parameter, &
1989 la_min(iset), la_max(iset), &
1990 lb_min(jset), lb_max(jset), &
1991 lc_min(kset), lc_max(kset), &
1992 npgfa(iset), npgfb(jset), npgfc(kset), &
1993 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
1994 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
1995 ra, rb, rc, &
1996 habc, &
1997 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
1998 offset_a_start, offset_b_start, offset_c_start, &
1999 0, 0, first_set - 1, &
2000 sphi_a, sphi_b, sphi_c, &
2001 sgfa, sgfb, sgfc, &
2002 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2003 my_eri_method, &
2004 coulomb_context=integral_context, &
2005
2006
2007force_b=force_b(jkind)%forces(:, atom_b), &
2008force_c=force_c(kkind)%forces(:, atom_c), &
2009 do_symmetric=do_symmetric, &
2010 on_diagonal=iatom == jatom, &
2011hdabc=hdabc, &
2012
2013
2014 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2015 END IF
2016 IF (.NOT.PRESENT(force_a) .AND. &
2017 PRESENT(force_b) .AND. &
2018 PRESENT(force_c) .AND. &
2019 .NOT.PRESENT(pabc) .AND. &
2020 PRESENT(mat_dabc) .AND. &
2021 .NOT.PRESENT(mat_adbc) .AND. &
2022 PRESENT(mat_abdc)) THEN
2023 CALL integrate_set_3c( &
2024 param%par, potential_parameter, &
2025 la_min(iset), la_max(iset), &
2026 lb_min(jset), lb_max(jset), &
2027 lc_min(kset), lc_max(kset), &
2028 npgfa(iset), npgfb(jset), npgfc(kset), &
2029 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2030 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2031 ra, rb, rc, &
2032 habc, &
2033 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2034 offset_a_start, offset_b_start, offset_c_start, &
2035 0, 0, first_set - 1, &
2036 sphi_a, sphi_b, sphi_c, &
2037 sgfa, sgfb, sgfc, &
2038 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2039 my_eri_method, &
2040 coulomb_context=integral_context, &
2041
2042
2043force_b=force_b(jkind)%forces(:, atom_b), &
2044force_c=force_c(kkind)%forces(:, atom_c), &
2045 do_symmetric=do_symmetric, &
2046 on_diagonal=iatom == jatom, &
2047hdabc=hdabc, &
2048
2049habdc=habdc, &
2050 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2051 END IF
2052 IF (.NOT.PRESENT(force_a) .AND. &
2053 PRESENT(force_b) .AND. &
2054 PRESENT(force_c) .AND. &
2055 .NOT.PRESENT(pabc) .AND. &
2056 PRESENT(mat_dabc) .AND. &
2057 PRESENT(mat_adbc) .AND. &
2058 .NOT.PRESENT(mat_abdc)) THEN
2059 CALL integrate_set_3c( &
2060 param%par, potential_parameter, &
2061 la_min(iset), la_max(iset), &
2062 lb_min(jset), lb_max(jset), &
2063 lc_min(kset), lc_max(kset), &
2064 npgfa(iset), npgfb(jset), npgfc(kset), &
2065 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2066 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2067 ra, rb, rc, &
2068 habc, &
2069 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2070 offset_a_start, offset_b_start, offset_c_start, &
2071 0, 0, first_set - 1, &
2072 sphi_a, sphi_b, sphi_c, &
2073 sgfa, sgfb, sgfc, &
2074 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2075 my_eri_method, &
2076 coulomb_context=integral_context, &
2077
2078
2079force_b=force_b(jkind)%forces(:, atom_b), &
2080force_c=force_c(kkind)%forces(:, atom_c), &
2081 do_symmetric=do_symmetric, &
2082 on_diagonal=iatom == jatom, &
2083hdabc=hdabc, &
2084hadbc=hadbc, &
2085
2086 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2087 END IF
2088 IF (.NOT.PRESENT(force_a) .AND. &
2089 PRESENT(force_b) .AND. &
2090 PRESENT(force_c) .AND. &
2091 .NOT.PRESENT(pabc) .AND. &
2092 PRESENT(mat_dabc) .AND. &
2093 PRESENT(mat_adbc) .AND. &
2094 PRESENT(mat_abdc)) THEN
2095 CALL integrate_set_3c( &
2096 param%par, potential_parameter, &
2097 la_min(iset), la_max(iset), &
2098 lb_min(jset), lb_max(jset), &
2099 lc_min(kset), lc_max(kset), &
2100 npgfa(iset), npgfb(jset), npgfc(kset), &
2101 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2102 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2103 ra, rb, rc, &
2104 habc, &
2105 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2106 offset_a_start, offset_b_start, offset_c_start, &
2107 0, 0, first_set - 1, &
2108 sphi_a, sphi_b, sphi_c, &
2109 sgfa, sgfb, sgfc, &
2110 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2111 my_eri_method, &
2112 coulomb_context=integral_context, &
2113
2114
2115force_b=force_b(jkind)%forces(:, atom_b), &
2116force_c=force_c(kkind)%forces(:, atom_c), &
2117 do_symmetric=do_symmetric, &
2118 on_diagonal=iatom == jatom, &
2119hdabc=hdabc, &
2120hadbc=hadbc, &
2121habdc=habdc, &
2122 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2123 END IF
2124 IF (PRESENT(force_a) .AND. &
2125 .NOT.PRESENT(force_b) .AND. &
2126 .NOT.PRESENT(force_c) .AND. &
2127 .NOT.PRESENT(pabc) .AND. &
2128 .NOT.PRESENT(mat_dabc) .AND. &
2129 .NOT.PRESENT(mat_adbc) .AND. &
2130 .NOT.PRESENT(mat_abdc)) THEN
2131 CALL integrate_set_3c( &
2132 param%par, potential_parameter, &
2133 la_min(iset), la_max(iset), &
2134 lb_min(jset), lb_max(jset), &
2135 lc_min(kset), lc_max(kset), &
2136 npgfa(iset), npgfb(jset), npgfc(kset), &
2137 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2138 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2139 ra, rb, rc, &
2140 habc, &
2141 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2142 offset_a_start, offset_b_start, offset_c_start, &
2143 0, 0, first_set - 1, &
2144 sphi_a, sphi_b, sphi_c, &
2145 sgfa, sgfb, sgfc, &
2146 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2147 my_eri_method, &
2148 coulomb_context=integral_context, &
2149
2150force_a=force_a(ikind)%forces(:, atom_a), &
2151
2152
2153 do_symmetric=do_symmetric, &
2154 on_diagonal=iatom == jatom, &
2155
2156
2157
2158 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2159 END IF
2160 IF (PRESENT(force_a) .AND. &
2161 .NOT.PRESENT(force_b) .AND. &
2162 .NOT.PRESENT(force_c) .AND. &
2163 .NOT.PRESENT(pabc) .AND. &
2164 .NOT.PRESENT(mat_dabc) .AND. &
2165 .NOT.PRESENT(mat_adbc) .AND. &
2166 PRESENT(mat_abdc)) THEN
2167 CALL integrate_set_3c( &
2168 param%par, potential_parameter, &
2169 la_min(iset), la_max(iset), &
2170 lb_min(jset), lb_max(jset), &
2171 lc_min(kset), lc_max(kset), &
2172 npgfa(iset), npgfb(jset), npgfc(kset), &
2173 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2174 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2175 ra, rb, rc, &
2176 habc, &
2177 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2178 offset_a_start, offset_b_start, offset_c_start, &
2179 0, 0, first_set - 1, &
2180 sphi_a, sphi_b, sphi_c, &
2181 sgfa, sgfb, sgfc, &
2182 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2183 my_eri_method, &
2184 coulomb_context=integral_context, &
2185
2186force_a=force_a(ikind)%forces(:, atom_a), &
2187
2188
2189 do_symmetric=do_symmetric, &
2190 on_diagonal=iatom == jatom, &
2191
2192
2193habdc=habdc, &
2194 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2195 END IF
2196 IF (PRESENT(force_a) .AND. &
2197 .NOT.PRESENT(force_b) .AND. &
2198 .NOT.PRESENT(force_c) .AND. &
2199 .NOT.PRESENT(pabc) .AND. &
2200 .NOT.PRESENT(mat_dabc) .AND. &
2201 PRESENT(mat_adbc) .AND. &
2202 .NOT.PRESENT(mat_abdc)) THEN
2203 CALL integrate_set_3c( &
2204 param%par, potential_parameter, &
2205 la_min(iset), la_max(iset), &
2206 lb_min(jset), lb_max(jset), &
2207 lc_min(kset), lc_max(kset), &
2208 npgfa(iset), npgfb(jset), npgfc(kset), &
2209 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2210 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2211 ra, rb, rc, &
2212 habc, &
2213 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2214 offset_a_start, offset_b_start, offset_c_start, &
2215 0, 0, first_set - 1, &
2216 sphi_a, sphi_b, sphi_c, &
2217 sgfa, sgfb, sgfc, &
2218 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2219 my_eri_method, &
2220 coulomb_context=integral_context, &
2221
2222force_a=force_a(ikind)%forces(:, atom_a), &
2223
2224
2225 do_symmetric=do_symmetric, &
2226 on_diagonal=iatom == jatom, &
2227
2228hadbc=hadbc, &
2229
2230 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2231 END IF
2232 IF (PRESENT(force_a) .AND. &
2233 .NOT.PRESENT(force_b) .AND. &
2234 .NOT.PRESENT(force_c) .AND. &
2235 .NOT.PRESENT(pabc) .AND. &
2236 .NOT.PRESENT(mat_dabc) .AND. &
2237 PRESENT(mat_adbc) .AND. &
2238 PRESENT(mat_abdc)) THEN
2239 CALL integrate_set_3c( &
2240 param%par, potential_parameter, &
2241 la_min(iset), la_max(iset), &
2242 lb_min(jset), lb_max(jset), &
2243 lc_min(kset), lc_max(kset), &
2244 npgfa(iset), npgfb(jset), npgfc(kset), &
2245 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2246 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2247 ra, rb, rc, &
2248 habc, &
2249 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2250 offset_a_start, offset_b_start, offset_c_start, &
2251 0, 0, first_set - 1, &
2252 sphi_a, sphi_b, sphi_c, &
2253 sgfa, sgfb, sgfc, &
2254 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2255 my_eri_method, &
2256 coulomb_context=integral_context, &
2257
2258force_a=force_a(ikind)%forces(:, atom_a), &
2259
2260
2261 do_symmetric=do_symmetric, &
2262 on_diagonal=iatom == jatom, &
2263
2264hadbc=hadbc, &
2265habdc=habdc, &
2266 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2267 END IF
2268 IF (PRESENT(force_a) .AND. &
2269 .NOT.PRESENT(force_b) .AND. &
2270 .NOT.PRESENT(force_c) .AND. &
2271 .NOT.PRESENT(pabc) .AND. &
2272 PRESENT(mat_dabc) .AND. &
2273 .NOT.PRESENT(mat_adbc) .AND. &
2274 .NOT.PRESENT(mat_abdc)) THEN
2275 CALL integrate_set_3c( &
2276 param%par, potential_parameter, &
2277 la_min(iset), la_max(iset), &
2278 lb_min(jset), lb_max(jset), &
2279 lc_min(kset), lc_max(kset), &
2280 npgfa(iset), npgfb(jset), npgfc(kset), &
2281 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2282 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2283 ra, rb, rc, &
2284 habc, &
2285 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2286 offset_a_start, offset_b_start, offset_c_start, &
2287 0, 0, first_set - 1, &
2288 sphi_a, sphi_b, sphi_c, &
2289 sgfa, sgfb, sgfc, &
2290 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2291 my_eri_method, &
2292 coulomb_context=integral_context, &
2293
2294force_a=force_a(ikind)%forces(:, atom_a), &
2295
2296
2297 do_symmetric=do_symmetric, &
2298 on_diagonal=iatom == jatom, &
2299hdabc=hdabc, &
2300
2301
2302 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2303 END IF
2304 IF (PRESENT(force_a) .AND. &
2305 .NOT.PRESENT(force_b) .AND. &
2306 .NOT.PRESENT(force_c) .AND. &
2307 .NOT.PRESENT(pabc) .AND. &
2308 PRESENT(mat_dabc) .AND. &
2309 .NOT.PRESENT(mat_adbc) .AND. &
2310 PRESENT(mat_abdc)) THEN
2311 CALL integrate_set_3c( &
2312 param%par, potential_parameter, &
2313 la_min(iset), la_max(iset), &
2314 lb_min(jset), lb_max(jset), &
2315 lc_min(kset), lc_max(kset), &
2316 npgfa(iset), npgfb(jset), npgfc(kset), &
2317 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2318 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2319 ra, rb, rc, &
2320 habc, &
2321 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2322 offset_a_start, offset_b_start, offset_c_start, &
2323 0, 0, first_set - 1, &
2324 sphi_a, sphi_b, sphi_c, &
2325 sgfa, sgfb, sgfc, &
2326 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2327 my_eri_method, &
2328 coulomb_context=integral_context, &
2329
2330force_a=force_a(ikind)%forces(:, atom_a), &
2331
2332
2333 do_symmetric=do_symmetric, &
2334 on_diagonal=iatom == jatom, &
2335hdabc=hdabc, &
2336
2337habdc=habdc, &
2338 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2339 END IF
2340 IF (PRESENT(force_a) .AND. &
2341 .NOT.PRESENT(force_b) .AND. &
2342 .NOT.PRESENT(force_c) .AND. &
2343 .NOT.PRESENT(pabc) .AND. &
2344 PRESENT(mat_dabc) .AND. &
2345 PRESENT(mat_adbc) .AND. &
2346 .NOT.PRESENT(mat_abdc)) THEN
2347 CALL integrate_set_3c( &
2348 param%par, potential_parameter, &
2349 la_min(iset), la_max(iset), &
2350 lb_min(jset), lb_max(jset), &
2351 lc_min(kset), lc_max(kset), &
2352 npgfa(iset), npgfb(jset), npgfc(kset), &
2353 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2354 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2355 ra, rb, rc, &
2356 habc, &
2357 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2358 offset_a_start, offset_b_start, offset_c_start, &
2359 0, 0, first_set - 1, &
2360 sphi_a, sphi_b, sphi_c, &
2361 sgfa, sgfb, sgfc, &
2362 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2363 my_eri_method, &
2364 coulomb_context=integral_context, &
2365
2366force_a=force_a(ikind)%forces(:, atom_a), &
2367
2368
2369 do_symmetric=do_symmetric, &
2370 on_diagonal=iatom == jatom, &
2371hdabc=hdabc, &
2372hadbc=hadbc, &
2373
2374 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2375 END IF
2376 IF (PRESENT(force_a) .AND. &
2377 .NOT.PRESENT(force_b) .AND. &
2378 .NOT.PRESENT(force_c) .AND. &
2379 .NOT.PRESENT(pabc) .AND. &
2380 PRESENT(mat_dabc) .AND. &
2381 PRESENT(mat_adbc) .AND. &
2382 PRESENT(mat_abdc)) THEN
2383 CALL integrate_set_3c( &
2384 param%par, potential_parameter, &
2385 la_min(iset), la_max(iset), &
2386 lb_min(jset), lb_max(jset), &
2387 lc_min(kset), lc_max(kset), &
2388 npgfa(iset), npgfb(jset), npgfc(kset), &
2389 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2390 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2391 ra, rb, rc, &
2392 habc, &
2393 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2394 offset_a_start, offset_b_start, offset_c_start, &
2395 0, 0, first_set - 1, &
2396 sphi_a, sphi_b, sphi_c, &
2397 sgfa, sgfb, sgfc, &
2398 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2399 my_eri_method, &
2400 coulomb_context=integral_context, &
2401
2402force_a=force_a(ikind)%forces(:, atom_a), &
2403
2404
2405 do_symmetric=do_symmetric, &
2406 on_diagonal=iatom == jatom, &
2407hdabc=hdabc, &
2408hadbc=hadbc, &
2409habdc=habdc, &
2410 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2411 END IF
2412 IF (PRESENT(force_a) .AND. &
2413 .NOT.PRESENT(force_b) .AND. &
2414 PRESENT(force_c) .AND. &
2415 .NOT.PRESENT(pabc) .AND. &
2416 .NOT.PRESENT(mat_dabc) .AND. &
2417 .NOT.PRESENT(mat_adbc) .AND. &
2418 .NOT.PRESENT(mat_abdc)) THEN
2419 CALL integrate_set_3c( &
2420 param%par, potential_parameter, &
2421 la_min(iset), la_max(iset), &
2422 lb_min(jset), lb_max(jset), &
2423 lc_min(kset), lc_max(kset), &
2424 npgfa(iset), npgfb(jset), npgfc(kset), &
2425 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2426 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2427 ra, rb, rc, &
2428 habc, &
2429 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2430 offset_a_start, offset_b_start, offset_c_start, &
2431 0, 0, first_set - 1, &
2432 sphi_a, sphi_b, sphi_c, &
2433 sgfa, sgfb, sgfc, &
2434 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2435 my_eri_method, &
2436 coulomb_context=integral_context, &
2437
2438force_a=force_a(ikind)%forces(:, atom_a), &
2439
2440force_c=force_c(kkind)%forces(:, atom_c), &
2441 do_symmetric=do_symmetric, &
2442 on_diagonal=iatom == jatom, &
2443
2444
2445
2446 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2447 END IF
2448 IF (PRESENT(force_a) .AND. &
2449 .NOT.PRESENT(force_b) .AND. &
2450 PRESENT(force_c) .AND. &
2451 .NOT.PRESENT(pabc) .AND. &
2452 .NOT.PRESENT(mat_dabc) .AND. &
2453 .NOT.PRESENT(mat_adbc) .AND. &
2454 PRESENT(mat_abdc)) THEN
2455 CALL integrate_set_3c( &
2456 param%par, potential_parameter, &
2457 la_min(iset), la_max(iset), &
2458 lb_min(jset), lb_max(jset), &
2459 lc_min(kset), lc_max(kset), &
2460 npgfa(iset), npgfb(jset), npgfc(kset), &
2461 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2462 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2463 ra, rb, rc, &
2464 habc, &
2465 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2466 offset_a_start, offset_b_start, offset_c_start, &
2467 0, 0, first_set - 1, &
2468 sphi_a, sphi_b, sphi_c, &
2469 sgfa, sgfb, sgfc, &
2470 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2471 my_eri_method, &
2472 coulomb_context=integral_context, &
2473
2474force_a=force_a(ikind)%forces(:, atom_a), &
2475
2476force_c=force_c(kkind)%forces(:, atom_c), &
2477 do_symmetric=do_symmetric, &
2478 on_diagonal=iatom == jatom, &
2479
2480
2481habdc=habdc, &
2482 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2483 END IF
2484 IF (PRESENT(force_a) .AND. &
2485 .NOT.PRESENT(force_b) .AND. &
2486 PRESENT(force_c) .AND. &
2487 .NOT.PRESENT(pabc) .AND. &
2488 .NOT.PRESENT(mat_dabc) .AND. &
2489 PRESENT(mat_adbc) .AND. &
2490 .NOT.PRESENT(mat_abdc)) THEN
2491 CALL integrate_set_3c( &
2492 param%par, potential_parameter, &
2493 la_min(iset), la_max(iset), &
2494 lb_min(jset), lb_max(jset), &
2495 lc_min(kset), lc_max(kset), &
2496 npgfa(iset), npgfb(jset), npgfc(kset), &
2497 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2498 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2499 ra, rb, rc, &
2500 habc, &
2501 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2502 offset_a_start, offset_b_start, offset_c_start, &
2503 0, 0, first_set - 1, &
2504 sphi_a, sphi_b, sphi_c, &
2505 sgfa, sgfb, sgfc, &
2506 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2507 my_eri_method, &
2508 coulomb_context=integral_context, &
2509
2510force_a=force_a(ikind)%forces(:, atom_a), &
2511
2512force_c=force_c(kkind)%forces(:, atom_c), &
2513 do_symmetric=do_symmetric, &
2514 on_diagonal=iatom == jatom, &
2515
2516hadbc=hadbc, &
2517
2518 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2519 END IF
2520 IF (PRESENT(force_a) .AND. &
2521 .NOT.PRESENT(force_b) .AND. &
2522 PRESENT(force_c) .AND. &
2523 .NOT.PRESENT(pabc) .AND. &
2524 .NOT.PRESENT(mat_dabc) .AND. &
2525 PRESENT(mat_adbc) .AND. &
2526 PRESENT(mat_abdc)) THEN
2527 CALL integrate_set_3c( &
2528 param%par, potential_parameter, &
2529 la_min(iset), la_max(iset), &
2530 lb_min(jset), lb_max(jset), &
2531 lc_min(kset), lc_max(kset), &
2532 npgfa(iset), npgfb(jset), npgfc(kset), &
2533 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2534 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2535 ra, rb, rc, &
2536 habc, &
2537 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2538 offset_a_start, offset_b_start, offset_c_start, &
2539 0, 0, first_set - 1, &
2540 sphi_a, sphi_b, sphi_c, &
2541 sgfa, sgfb, sgfc, &
2542 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2543 my_eri_method, &
2544 coulomb_context=integral_context, &
2545
2546force_a=force_a(ikind)%forces(:, atom_a), &
2547
2548force_c=force_c(kkind)%forces(:, atom_c), &
2549 do_symmetric=do_symmetric, &
2550 on_diagonal=iatom == jatom, &
2551
2552hadbc=hadbc, &
2553habdc=habdc, &
2554 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2555 END IF
2556 IF (PRESENT(force_a) .AND. &
2557 .NOT.PRESENT(force_b) .AND. &
2558 PRESENT(force_c) .AND. &
2559 .NOT.PRESENT(pabc) .AND. &
2560 PRESENT(mat_dabc) .AND. &
2561 .NOT.PRESENT(mat_adbc) .AND. &
2562 .NOT.PRESENT(mat_abdc)) THEN
2563 CALL integrate_set_3c( &
2564 param%par, potential_parameter, &
2565 la_min(iset), la_max(iset), &
2566 lb_min(jset), lb_max(jset), &
2567 lc_min(kset), lc_max(kset), &
2568 npgfa(iset), npgfb(jset), npgfc(kset), &
2569 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2570 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2571 ra, rb, rc, &
2572 habc, &
2573 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2574 offset_a_start, offset_b_start, offset_c_start, &
2575 0, 0, first_set - 1, &
2576 sphi_a, sphi_b, sphi_c, &
2577 sgfa, sgfb, sgfc, &
2578 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2579 my_eri_method, &
2580 coulomb_context=integral_context, &
2581
2582force_a=force_a(ikind)%forces(:, atom_a), &
2583
2584force_c=force_c(kkind)%forces(:, atom_c), &
2585 do_symmetric=do_symmetric, &
2586 on_diagonal=iatom == jatom, &
2587hdabc=hdabc, &
2588
2589
2590 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2591 END IF
2592 IF (PRESENT(force_a) .AND. &
2593 .NOT.PRESENT(force_b) .AND. &
2594 PRESENT(force_c) .AND. &
2595 .NOT.PRESENT(pabc) .AND. &
2596 PRESENT(mat_dabc) .AND. &
2597 .NOT.PRESENT(mat_adbc) .AND. &
2598 PRESENT(mat_abdc)) THEN
2599 CALL integrate_set_3c( &
2600 param%par, potential_parameter, &
2601 la_min(iset), la_max(iset), &
2602 lb_min(jset), lb_max(jset), &
2603 lc_min(kset), lc_max(kset), &
2604 npgfa(iset), npgfb(jset), npgfc(kset), &
2605 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2606 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2607 ra, rb, rc, &
2608 habc, &
2609 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2610 offset_a_start, offset_b_start, offset_c_start, &
2611 0, 0, first_set - 1, &
2612 sphi_a, sphi_b, sphi_c, &
2613 sgfa, sgfb, sgfc, &
2614 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2615 my_eri_method, &
2616 coulomb_context=integral_context, &
2617
2618force_a=force_a(ikind)%forces(:, atom_a), &
2619
2620force_c=force_c(kkind)%forces(:, atom_c), &
2621 do_symmetric=do_symmetric, &
2622 on_diagonal=iatom == jatom, &
2623hdabc=hdabc, &
2624
2625habdc=habdc, &
2626 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2627 END IF
2628 IF (PRESENT(force_a) .AND. &
2629 .NOT.PRESENT(force_b) .AND. &
2630 PRESENT(force_c) .AND. &
2631 .NOT.PRESENT(pabc) .AND. &
2632 PRESENT(mat_dabc) .AND. &
2633 PRESENT(mat_adbc) .AND. &
2634 .NOT.PRESENT(mat_abdc)) THEN
2635 CALL integrate_set_3c( &
2636 param%par, potential_parameter, &
2637 la_min(iset), la_max(iset), &
2638 lb_min(jset), lb_max(jset), &
2639 lc_min(kset), lc_max(kset), &
2640 npgfa(iset), npgfb(jset), npgfc(kset), &
2641 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2642 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2643 ra, rb, rc, &
2644 habc, &
2645 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2646 offset_a_start, offset_b_start, offset_c_start, &
2647 0, 0, first_set - 1, &
2648 sphi_a, sphi_b, sphi_c, &
2649 sgfa, sgfb, sgfc, &
2650 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2651 my_eri_method, &
2652 coulomb_context=integral_context, &
2653
2654force_a=force_a(ikind)%forces(:, atom_a), &
2655
2656force_c=force_c(kkind)%forces(:, atom_c), &
2657 do_symmetric=do_symmetric, &
2658 on_diagonal=iatom == jatom, &
2659hdabc=hdabc, &
2660hadbc=hadbc, &
2661
2662 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2663 END IF
2664 IF (PRESENT(force_a) .AND. &
2665 .NOT.PRESENT(force_b) .AND. &
2666 PRESENT(force_c) .AND. &
2667 .NOT.PRESENT(pabc) .AND. &
2668 PRESENT(mat_dabc) .AND. &
2669 PRESENT(mat_adbc) .AND. &
2670 PRESENT(mat_abdc)) THEN
2671 CALL integrate_set_3c( &
2672 param%par, potential_parameter, &
2673 la_min(iset), la_max(iset), &
2674 lb_min(jset), lb_max(jset), &
2675 lc_min(kset), lc_max(kset), &
2676 npgfa(iset), npgfb(jset), npgfc(kset), &
2677 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2678 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2679 ra, rb, rc, &
2680 habc, &
2681 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2682 offset_a_start, offset_b_start, offset_c_start, &
2683 0, 0, first_set - 1, &
2684 sphi_a, sphi_b, sphi_c, &
2685 sgfa, sgfb, sgfc, &
2686 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2687 my_eri_method, &
2688 coulomb_context=integral_context, &
2689
2690force_a=force_a(ikind)%forces(:, atom_a), &
2691
2692force_c=force_c(kkind)%forces(:, atom_c), &
2693 do_symmetric=do_symmetric, &
2694 on_diagonal=iatom == jatom, &
2695hdabc=hdabc, &
2696hadbc=hadbc, &
2697habdc=habdc, &
2698 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2699 END IF
2700 IF (PRESENT(force_a) .AND. &
2701 PRESENT(force_b) .AND. &
2702 .NOT.PRESENT(force_c) .AND. &
2703 .NOT.PRESENT(pabc) .AND. &
2704 .NOT.PRESENT(mat_dabc) .AND. &
2705 .NOT.PRESENT(mat_adbc) .AND. &
2706 .NOT.PRESENT(mat_abdc)) THEN
2707 CALL integrate_set_3c( &
2708 param%par, potential_parameter, &
2709 la_min(iset), la_max(iset), &
2710 lb_min(jset), lb_max(jset), &
2711 lc_min(kset), lc_max(kset), &
2712 npgfa(iset), npgfb(jset), npgfc(kset), &
2713 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2714 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2715 ra, rb, rc, &
2716 habc, &
2717 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2718 offset_a_start, offset_b_start, offset_c_start, &
2719 0, 0, first_set - 1, &
2720 sphi_a, sphi_b, sphi_c, &
2721 sgfa, sgfb, sgfc, &
2722 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2723 my_eri_method, &
2724 coulomb_context=integral_context, &
2725
2726force_a=force_a(ikind)%forces(:, atom_a), &
2727force_b=force_b(jkind)%forces(:, atom_b), &
2728
2729 do_symmetric=do_symmetric, &
2730 on_diagonal=iatom == jatom, &
2731
2732
2733
2734 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2735 END IF
2736 IF (PRESENT(force_a) .AND. &
2737 PRESENT(force_b) .AND. &
2738 .NOT.PRESENT(force_c) .AND. &
2739 .NOT.PRESENT(pabc) .AND. &
2740 .NOT.PRESENT(mat_dabc) .AND. &
2741 .NOT.PRESENT(mat_adbc) .AND. &
2742 PRESENT(mat_abdc)) THEN
2743 CALL integrate_set_3c( &
2744 param%par, potential_parameter, &
2745 la_min(iset), la_max(iset), &
2746 lb_min(jset), lb_max(jset), &
2747 lc_min(kset), lc_max(kset), &
2748 npgfa(iset), npgfb(jset), npgfc(kset), &
2749 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2750 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2751 ra, rb, rc, &
2752 habc, &
2753 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2754 offset_a_start, offset_b_start, offset_c_start, &
2755 0, 0, first_set - 1, &
2756 sphi_a, sphi_b, sphi_c, &
2757 sgfa, sgfb, sgfc, &
2758 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2759 my_eri_method, &
2760 coulomb_context=integral_context, &
2761
2762force_a=force_a(ikind)%forces(:, atom_a), &
2763force_b=force_b(jkind)%forces(:, atom_b), &
2764
2765 do_symmetric=do_symmetric, &
2766 on_diagonal=iatom == jatom, &
2767
2768
2769habdc=habdc, &
2770 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2771 END IF
2772 IF (PRESENT(force_a) .AND. &
2773 PRESENT(force_b) .AND. &
2774 .NOT.PRESENT(force_c) .AND. &
2775 .NOT.PRESENT(pabc) .AND. &
2776 .NOT.PRESENT(mat_dabc) .AND. &
2777 PRESENT(mat_adbc) .AND. &
2778 .NOT.PRESENT(mat_abdc)) THEN
2779 CALL integrate_set_3c( &
2780 param%par, potential_parameter, &
2781 la_min(iset), la_max(iset), &
2782 lb_min(jset), lb_max(jset), &
2783 lc_min(kset), lc_max(kset), &
2784 npgfa(iset), npgfb(jset), npgfc(kset), &
2785 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2786 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2787 ra, rb, rc, &
2788 habc, &
2789 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2790 offset_a_start, offset_b_start, offset_c_start, &
2791 0, 0, first_set - 1, &
2792 sphi_a, sphi_b, sphi_c, &
2793 sgfa, sgfb, sgfc, &
2794 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2795 my_eri_method, &
2796 coulomb_context=integral_context, &
2797
2798force_a=force_a(ikind)%forces(:, atom_a), &
2799force_b=force_b(jkind)%forces(:, atom_b), &
2800
2801 do_symmetric=do_symmetric, &
2802 on_diagonal=iatom == jatom, &
2803
2804hadbc=hadbc, &
2805
2806 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2807 END IF
2808 IF (PRESENT(force_a) .AND. &
2809 PRESENT(force_b) .AND. &
2810 .NOT.PRESENT(force_c) .AND. &
2811 .NOT.PRESENT(pabc) .AND. &
2812 .NOT.PRESENT(mat_dabc) .AND. &
2813 PRESENT(mat_adbc) .AND. &
2814 PRESENT(mat_abdc)) THEN
2815 CALL integrate_set_3c( &
2816 param%par, potential_parameter, &
2817 la_min(iset), la_max(iset), &
2818 lb_min(jset), lb_max(jset), &
2819 lc_min(kset), lc_max(kset), &
2820 npgfa(iset), npgfb(jset), npgfc(kset), &
2821 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2822 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2823 ra, rb, rc, &
2824 habc, &
2825 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2826 offset_a_start, offset_b_start, offset_c_start, &
2827 0, 0, first_set - 1, &
2828 sphi_a, sphi_b, sphi_c, &
2829 sgfa, sgfb, sgfc, &
2830 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2831 my_eri_method, &
2832 coulomb_context=integral_context, &
2833
2834force_a=force_a(ikind)%forces(:, atom_a), &
2835force_b=force_b(jkind)%forces(:, atom_b), &
2836
2837 do_symmetric=do_symmetric, &
2838 on_diagonal=iatom == jatom, &
2839
2840hadbc=hadbc, &
2841habdc=habdc, &
2842 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2843 END IF
2844 IF (PRESENT(force_a) .AND. &
2845 PRESENT(force_b) .AND. &
2846 .NOT.PRESENT(force_c) .AND. &
2847 .NOT.PRESENT(pabc) .AND. &
2848 PRESENT(mat_dabc) .AND. &
2849 .NOT.PRESENT(mat_adbc) .AND. &
2850 .NOT.PRESENT(mat_abdc)) THEN
2851 CALL integrate_set_3c( &
2852 param%par, potential_parameter, &
2853 la_min(iset), la_max(iset), &
2854 lb_min(jset), lb_max(jset), &
2855 lc_min(kset), lc_max(kset), &
2856 npgfa(iset), npgfb(jset), npgfc(kset), &
2857 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2858 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2859 ra, rb, rc, &
2860 habc, &
2861 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2862 offset_a_start, offset_b_start, offset_c_start, &
2863 0, 0, first_set - 1, &
2864 sphi_a, sphi_b, sphi_c, &
2865 sgfa, sgfb, sgfc, &
2866 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2867 my_eri_method, &
2868 coulomb_context=integral_context, &
2869
2870force_a=force_a(ikind)%forces(:, atom_a), &
2871force_b=force_b(jkind)%forces(:, atom_b), &
2872
2873 do_symmetric=do_symmetric, &
2874 on_diagonal=iatom == jatom, &
2875hdabc=hdabc, &
2876
2877
2878 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2879 END IF
2880 IF (PRESENT(force_a) .AND. &
2881 PRESENT(force_b) .AND. &
2882 .NOT.PRESENT(force_c) .AND. &
2883 .NOT.PRESENT(pabc) .AND. &
2884 PRESENT(mat_dabc) .AND. &
2885 .NOT.PRESENT(mat_adbc) .AND. &
2886 PRESENT(mat_abdc)) THEN
2887 CALL integrate_set_3c( &
2888 param%par, potential_parameter, &
2889 la_min(iset), la_max(iset), &
2890 lb_min(jset), lb_max(jset), &
2891 lc_min(kset), lc_max(kset), &
2892 npgfa(iset), npgfb(jset), npgfc(kset), &
2893 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2894 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2895 ra, rb, rc, &
2896 habc, &
2897 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2898 offset_a_start, offset_b_start, offset_c_start, &
2899 0, 0, first_set - 1, &
2900 sphi_a, sphi_b, sphi_c, &
2901 sgfa, sgfb, sgfc, &
2902 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2903 my_eri_method, &
2904 coulomb_context=integral_context, &
2905
2906force_a=force_a(ikind)%forces(:, atom_a), &
2907force_b=force_b(jkind)%forces(:, atom_b), &
2908
2909 do_symmetric=do_symmetric, &
2910 on_diagonal=iatom == jatom, &
2911hdabc=hdabc, &
2912
2913habdc=habdc, &
2914 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2915 END IF
2916 IF (PRESENT(force_a) .AND. &
2917 PRESENT(force_b) .AND. &
2918 .NOT.PRESENT(force_c) .AND. &
2919 .NOT.PRESENT(pabc) .AND. &
2920 PRESENT(mat_dabc) .AND. &
2921 PRESENT(mat_adbc) .AND. &
2922 .NOT.PRESENT(mat_abdc)) THEN
2923 CALL integrate_set_3c( &
2924 param%par, potential_parameter, &
2925 la_min(iset), la_max(iset), &
2926 lb_min(jset), lb_max(jset), &
2927 lc_min(kset), lc_max(kset), &
2928 npgfa(iset), npgfb(jset), npgfc(kset), &
2929 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2930 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2931 ra, rb, rc, &
2932 habc, &
2933 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2934 offset_a_start, offset_b_start, offset_c_start, &
2935 0, 0, first_set - 1, &
2936 sphi_a, sphi_b, sphi_c, &
2937 sgfa, sgfb, sgfc, &
2938 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2939 my_eri_method, &
2940 coulomb_context=integral_context, &
2941
2942force_a=force_a(ikind)%forces(:, atom_a), &
2943force_b=force_b(jkind)%forces(:, atom_b), &
2944
2945 do_symmetric=do_symmetric, &
2946 on_diagonal=iatom == jatom, &
2947hdabc=hdabc, &
2948hadbc=hadbc, &
2949
2950 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2951 END IF
2952 IF (PRESENT(force_a) .AND. &
2953 PRESENT(force_b) .AND. &
2954 .NOT.PRESENT(force_c) .AND. &
2955 .NOT.PRESENT(pabc) .AND. &
2956 PRESENT(mat_dabc) .AND. &
2957 PRESENT(mat_adbc) .AND. &
2958 PRESENT(mat_abdc)) THEN
2959 CALL integrate_set_3c( &
2960 param%par, potential_parameter, &
2961 la_min(iset), la_max(iset), &
2962 lb_min(jset), lb_max(jset), &
2963 lc_min(kset), lc_max(kset), &
2964 npgfa(iset), npgfb(jset), npgfc(kset), &
2965 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
2966 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
2967 ra, rb, rc, &
2968 habc, &
2969 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
2970 offset_a_start, offset_b_start, offset_c_start, &
2971 0, 0, first_set - 1, &
2972 sphi_a, sphi_b, sphi_c, &
2973 sgfa, sgfb, sgfc, &
2974 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
2975 my_eri_method, &
2976 coulomb_context=integral_context, &
2977
2978force_a=force_a(ikind)%forces(:, atom_a), &
2979force_b=force_b(jkind)%forces(:, atom_b), &
2980
2981 do_symmetric=do_symmetric, &
2982 on_diagonal=iatom == jatom, &
2983hdabc=hdabc, &
2984hadbc=hadbc, &
2985habdc=habdc, &
2986 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
2987 END IF
2988 IF (PRESENT(force_a) .AND. &
2989 PRESENT(force_b) .AND. &
2990 PRESENT(force_c) .AND. &
2991 .NOT.PRESENT(pabc) .AND. &
2992 .NOT.PRESENT(mat_dabc) .AND. &
2993 .NOT.PRESENT(mat_adbc) .AND. &
2994 .NOT.PRESENT(mat_abdc)) THEN
2995 CALL integrate_set_3c( &
2996 param%par, potential_parameter, &
2997 la_min(iset), la_max(iset), &
2998 lb_min(jset), lb_max(jset), &
2999 lc_min(kset), lc_max(kset), &
3000 npgfa(iset), npgfb(jset), npgfc(kset), &
3001 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3002 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3003 ra, rb, rc, &
3004 habc, &
3005 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3006 offset_a_start, offset_b_start, offset_c_start, &
3007 0, 0, first_set - 1, &
3008 sphi_a, sphi_b, sphi_c, &
3009 sgfa, sgfb, sgfc, &
3010 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3011 my_eri_method, &
3012 coulomb_context=integral_context, &
3013
3014force_a=force_a(ikind)%forces(:, atom_a), &
3015force_b=force_b(jkind)%forces(:, atom_b), &
3016force_c=force_c(kkind)%forces(:, atom_c), &
3017 do_symmetric=do_symmetric, &
3018 on_diagonal=iatom == jatom, &
3019
3020
3021
3022 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3023 END IF
3024 IF (PRESENT(force_a) .AND. &
3025 PRESENT(force_b) .AND. &
3026 PRESENT(force_c) .AND. &
3027 .NOT.PRESENT(pabc) .AND. &
3028 .NOT.PRESENT(mat_dabc) .AND. &
3029 .NOT.PRESENT(mat_adbc) .AND. &
3030 PRESENT(mat_abdc)) THEN
3031 CALL integrate_set_3c( &
3032 param%par, potential_parameter, &
3033 la_min(iset), la_max(iset), &
3034 lb_min(jset), lb_max(jset), &
3035 lc_min(kset), lc_max(kset), &
3036 npgfa(iset), npgfb(jset), npgfc(kset), &
3037 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3038 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3039 ra, rb, rc, &
3040 habc, &
3041 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3042 offset_a_start, offset_b_start, offset_c_start, &
3043 0, 0, first_set - 1, &
3044 sphi_a, sphi_b, sphi_c, &
3045 sgfa, sgfb, sgfc, &
3046 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3047 my_eri_method, &
3048 coulomb_context=integral_context, &
3049
3050force_a=force_a(ikind)%forces(:, atom_a), &
3051force_b=force_b(jkind)%forces(:, atom_b), &
3052force_c=force_c(kkind)%forces(:, atom_c), &
3053 do_symmetric=do_symmetric, &
3054 on_diagonal=iatom == jatom, &
3055
3056
3057habdc=habdc, &
3058 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3059 END IF
3060 IF (PRESENT(force_a) .AND. &
3061 PRESENT(force_b) .AND. &
3062 PRESENT(force_c) .AND. &
3063 .NOT.PRESENT(pabc) .AND. &
3064 .NOT.PRESENT(mat_dabc) .AND. &
3065 PRESENT(mat_adbc) .AND. &
3066 .NOT.PRESENT(mat_abdc)) THEN
3067 CALL integrate_set_3c( &
3068 param%par, potential_parameter, &
3069 la_min(iset), la_max(iset), &
3070 lb_min(jset), lb_max(jset), &
3071 lc_min(kset), lc_max(kset), &
3072 npgfa(iset), npgfb(jset), npgfc(kset), &
3073 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3074 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3075 ra, rb, rc, &
3076 habc, &
3077 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3078 offset_a_start, offset_b_start, offset_c_start, &
3079 0, 0, first_set - 1, &
3080 sphi_a, sphi_b, sphi_c, &
3081 sgfa, sgfb, sgfc, &
3082 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3083 my_eri_method, &
3084 coulomb_context=integral_context, &
3085
3086force_a=force_a(ikind)%forces(:, atom_a), &
3087force_b=force_b(jkind)%forces(:, atom_b), &
3088force_c=force_c(kkind)%forces(:, atom_c), &
3089 do_symmetric=do_symmetric, &
3090 on_diagonal=iatom == jatom, &
3091
3092hadbc=hadbc, &
3093
3094 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3095 END IF
3096 IF (PRESENT(force_a) .AND. &
3097 PRESENT(force_b) .AND. &
3098 PRESENT(force_c) .AND. &
3099 .NOT.PRESENT(pabc) .AND. &
3100 .NOT.PRESENT(mat_dabc) .AND. &
3101 PRESENT(mat_adbc) .AND. &
3102 PRESENT(mat_abdc)) THEN
3103 CALL integrate_set_3c( &
3104 param%par, potential_parameter, &
3105 la_min(iset), la_max(iset), &
3106 lb_min(jset), lb_max(jset), &
3107 lc_min(kset), lc_max(kset), &
3108 npgfa(iset), npgfb(jset), npgfc(kset), &
3109 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3110 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3111 ra, rb, rc, &
3112 habc, &
3113 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3114 offset_a_start, offset_b_start, offset_c_start, &
3115 0, 0, first_set - 1, &
3116 sphi_a, sphi_b, sphi_c, &
3117 sgfa, sgfb, sgfc, &
3118 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3119 my_eri_method, &
3120 coulomb_context=integral_context, &
3121
3122force_a=force_a(ikind)%forces(:, atom_a), &
3123force_b=force_b(jkind)%forces(:, atom_b), &
3124force_c=force_c(kkind)%forces(:, atom_c), &
3125 do_symmetric=do_symmetric, &
3126 on_diagonal=iatom == jatom, &
3127
3128hadbc=hadbc, &
3129habdc=habdc, &
3130 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3131 END IF
3132 IF (PRESENT(force_a) .AND. &
3133 PRESENT(force_b) .AND. &
3134 PRESENT(force_c) .AND. &
3135 .NOT.PRESENT(pabc) .AND. &
3136 PRESENT(mat_dabc) .AND. &
3137 .NOT.PRESENT(mat_adbc) .AND. &
3138 .NOT.PRESENT(mat_abdc)) THEN
3139 CALL integrate_set_3c( &
3140 param%par, potential_parameter, &
3141 la_min(iset), la_max(iset), &
3142 lb_min(jset), lb_max(jset), &
3143 lc_min(kset), lc_max(kset), &
3144 npgfa(iset), npgfb(jset), npgfc(kset), &
3145 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3146 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3147 ra, rb, rc, &
3148 habc, &
3149 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3150 offset_a_start, offset_b_start, offset_c_start, &
3151 0, 0, first_set - 1, &
3152 sphi_a, sphi_b, sphi_c, &
3153 sgfa, sgfb, sgfc, &
3154 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3155 my_eri_method, &
3156 coulomb_context=integral_context, &
3157
3158force_a=force_a(ikind)%forces(:, atom_a), &
3159force_b=force_b(jkind)%forces(:, atom_b), &
3160force_c=force_c(kkind)%forces(:, atom_c), &
3161 do_symmetric=do_symmetric, &
3162 on_diagonal=iatom == jatom, &
3163hdabc=hdabc, &
3164
3165
3166 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3167 END IF
3168 IF (PRESENT(force_a) .AND. &
3169 PRESENT(force_b) .AND. &
3170 PRESENT(force_c) .AND. &
3171 .NOT.PRESENT(pabc) .AND. &
3172 PRESENT(mat_dabc) .AND. &
3173 .NOT.PRESENT(mat_adbc) .AND. &
3174 PRESENT(mat_abdc)) THEN
3175 CALL integrate_set_3c( &
3176 param%par, potential_parameter, &
3177 la_min(iset), la_max(iset), &
3178 lb_min(jset), lb_max(jset), &
3179 lc_min(kset), lc_max(kset), &
3180 npgfa(iset), npgfb(jset), npgfc(kset), &
3181 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3182 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3183 ra, rb, rc, &
3184 habc, &
3185 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3186 offset_a_start, offset_b_start, offset_c_start, &
3187 0, 0, first_set - 1, &
3188 sphi_a, sphi_b, sphi_c, &
3189 sgfa, sgfb, sgfc, &
3190 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3191 my_eri_method, &
3192 coulomb_context=integral_context, &
3193
3194force_a=force_a(ikind)%forces(:, atom_a), &
3195force_b=force_b(jkind)%forces(:, atom_b), &
3196force_c=force_c(kkind)%forces(:, atom_c), &
3197 do_symmetric=do_symmetric, &
3198 on_diagonal=iatom == jatom, &
3199hdabc=hdabc, &
3200
3201habdc=habdc, &
3202 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3203 END IF
3204 IF (PRESENT(force_a) .AND. &
3205 PRESENT(force_b) .AND. &
3206 PRESENT(force_c) .AND. &
3207 .NOT.PRESENT(pabc) .AND. &
3208 PRESENT(mat_dabc) .AND. &
3209 PRESENT(mat_adbc) .AND. &
3210 .NOT.PRESENT(mat_abdc)) THEN
3211 CALL integrate_set_3c( &
3212 param%par, potential_parameter, &
3213 la_min(iset), la_max(iset), &
3214 lb_min(jset), lb_max(jset), &
3215 lc_min(kset), lc_max(kset), &
3216 npgfa(iset), npgfb(jset), npgfc(kset), &
3217 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3218 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3219 ra, rb, rc, &
3220 habc, &
3221 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3222 offset_a_start, offset_b_start, offset_c_start, &
3223 0, 0, first_set - 1, &
3224 sphi_a, sphi_b, sphi_c, &
3225 sgfa, sgfb, sgfc, &
3226 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3227 my_eri_method, &
3228 coulomb_context=integral_context, &
3229
3230force_a=force_a(ikind)%forces(:, atom_a), &
3231force_b=force_b(jkind)%forces(:, atom_b), &
3232force_c=force_c(kkind)%forces(:, atom_c), &
3233 do_symmetric=do_symmetric, &
3234 on_diagonal=iatom == jatom, &
3235hdabc=hdabc, &
3236hadbc=hadbc, &
3237
3238 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3239 END IF
3240 IF (PRESENT(force_a) .AND. &
3241 PRESENT(force_b) .AND. &
3242 PRESENT(force_c) .AND. &
3243 .NOT.PRESENT(pabc) .AND. &
3244 PRESENT(mat_dabc) .AND. &
3245 PRESENT(mat_adbc) .AND. &
3246 PRESENT(mat_abdc)) THEN
3247 CALL integrate_set_3c( &
3248 param%par, potential_parameter, &
3249 la_min(iset), la_max(iset), &
3250 lb_min(jset), lb_max(jset), &
3251 lc_min(kset), lc_max(kset), &
3252 npgfa(iset), npgfb(jset), npgfc(kset), &
3253 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3254 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3255 ra, rb, rc, &
3256 habc, &
3257 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3258 offset_a_start, offset_b_start, offset_c_start, &
3259 0, 0, first_set - 1, &
3260 sphi_a, sphi_b, sphi_c, &
3261 sgfa, sgfb, sgfc, &
3262 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3263 my_eri_method, &
3264 coulomb_context=integral_context, &
3265
3266force_a=force_a(ikind)%forces(:, atom_a), &
3267force_b=force_b(jkind)%forces(:, atom_b), &
3268force_c=force_c(kkind)%forces(:, atom_c), &
3269 do_symmetric=do_symmetric, &
3270 on_diagonal=iatom == jatom, &
3271hdabc=hdabc, &
3272hadbc=hadbc, &
3273habdc=habdc, &
3274 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3275 END IF
3276 IF (.NOT.PRESENT(force_a) .AND. &
3277 .NOT.PRESENT(force_b) .AND. &
3278 .NOT.PRESENT(force_c) .AND. &
3279 PRESENT(pabc) .AND. &
3280 .NOT.PRESENT(mat_dabc) .AND. &
3281 .NOT.PRESENT(mat_adbc) .AND. &
3282 .NOT.PRESENT(mat_abdc)) THEN
3283 CALL integrate_set_3c( &
3284 param%par, potential_parameter, &
3285 la_min(iset), la_max(iset), &
3286 lb_min(jset), lb_max(jset), &
3287 lc_min(kset), lc_max(kset), &
3288 npgfa(iset), npgfb(jset), npgfc(kset), &
3289 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3290 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3291 ra, rb, rc, &
3292 habc, &
3293 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3294 offset_a_start, offset_b_start, offset_c_start, &
3295 0, 0, first_set - 1, &
3296 sphi_a, sphi_b, sphi_c, &
3297 sgfa, sgfb, sgfc, &
3298 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3299 my_eri_method, &
3300 coulomb_context=integral_context, &
3301pabc=pabc_block, &
3302
3303
3304
3305 do_symmetric=do_symmetric, &
3306 on_diagonal=iatom == jatom, &
3307
3308
3309
3310 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3311 END IF
3312 IF (.NOT.PRESENT(force_a) .AND. &
3313 .NOT.PRESENT(force_b) .AND. &
3314 .NOT.PRESENT(force_c) .AND. &
3315 PRESENT(pabc) .AND. &
3316 .NOT.PRESENT(mat_dabc) .AND. &
3317 .NOT.PRESENT(mat_adbc) .AND. &
3318 PRESENT(mat_abdc)) THEN
3319 CALL integrate_set_3c( &
3320 param%par, potential_parameter, &
3321 la_min(iset), la_max(iset), &
3322 lb_min(jset), lb_max(jset), &
3323 lc_min(kset), lc_max(kset), &
3324 npgfa(iset), npgfb(jset), npgfc(kset), &
3325 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3326 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3327 ra, rb, rc, &
3328 habc, &
3329 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3330 offset_a_start, offset_b_start, offset_c_start, &
3331 0, 0, first_set - 1, &
3332 sphi_a, sphi_b, sphi_c, &
3333 sgfa, sgfb, sgfc, &
3334 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3335 my_eri_method, &
3336 coulomb_context=integral_context, &
3337pabc=pabc_block, &
3338
3339
3340
3341 do_symmetric=do_symmetric, &
3342 on_diagonal=iatom == jatom, &
3343
3344
3345habdc=habdc, &
3346 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3347 END IF
3348 IF (.NOT.PRESENT(force_a) .AND. &
3349 .NOT.PRESENT(force_b) .AND. &
3350 .NOT.PRESENT(force_c) .AND. &
3351 PRESENT(pabc) .AND. &
3352 .NOT.PRESENT(mat_dabc) .AND. &
3353 PRESENT(mat_adbc) .AND. &
3354 .NOT.PRESENT(mat_abdc)) THEN
3355 CALL integrate_set_3c( &
3356 param%par, potential_parameter, &
3357 la_min(iset), la_max(iset), &
3358 lb_min(jset), lb_max(jset), &
3359 lc_min(kset), lc_max(kset), &
3360 npgfa(iset), npgfb(jset), npgfc(kset), &
3361 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3362 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3363 ra, rb, rc, &
3364 habc, &
3365 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3366 offset_a_start, offset_b_start, offset_c_start, &
3367 0, 0, first_set - 1, &
3368 sphi_a, sphi_b, sphi_c, &
3369 sgfa, sgfb, sgfc, &
3370 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3371 my_eri_method, &
3372 coulomb_context=integral_context, &
3373pabc=pabc_block, &
3374
3375
3376
3377 do_symmetric=do_symmetric, &
3378 on_diagonal=iatom == jatom, &
3379
3380hadbc=hadbc, &
3381
3382 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3383 END IF
3384 IF (.NOT.PRESENT(force_a) .AND. &
3385 .NOT.PRESENT(force_b) .AND. &
3386 .NOT.PRESENT(force_c) .AND. &
3387 PRESENT(pabc) .AND. &
3388 .NOT.PRESENT(mat_dabc) .AND. &
3389 PRESENT(mat_adbc) .AND. &
3390 PRESENT(mat_abdc)) THEN
3391 CALL integrate_set_3c( &
3392 param%par, potential_parameter, &
3393 la_min(iset), la_max(iset), &
3394 lb_min(jset), lb_max(jset), &
3395 lc_min(kset), lc_max(kset), &
3396 npgfa(iset), npgfb(jset), npgfc(kset), &
3397 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3398 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3399 ra, rb, rc, &
3400 habc, &
3401 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3402 offset_a_start, offset_b_start, offset_c_start, &
3403 0, 0, first_set - 1, &
3404 sphi_a, sphi_b, sphi_c, &
3405 sgfa, sgfb, sgfc, &
3406 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3407 my_eri_method, &
3408 coulomb_context=integral_context, &
3409pabc=pabc_block, &
3410
3411
3412
3413 do_symmetric=do_symmetric, &
3414 on_diagonal=iatom == jatom, &
3415
3416hadbc=hadbc, &
3417habdc=habdc, &
3418 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3419 END IF
3420 IF (.NOT.PRESENT(force_a) .AND. &
3421 .NOT.PRESENT(force_b) .AND. &
3422 .NOT.PRESENT(force_c) .AND. &
3423 PRESENT(pabc) .AND. &
3424 PRESENT(mat_dabc) .AND. &
3425 .NOT.PRESENT(mat_adbc) .AND. &
3426 .NOT.PRESENT(mat_abdc)) THEN
3427 CALL integrate_set_3c( &
3428 param%par, potential_parameter, &
3429 la_min(iset), la_max(iset), &
3430 lb_min(jset), lb_max(jset), &
3431 lc_min(kset), lc_max(kset), &
3432 npgfa(iset), npgfb(jset), npgfc(kset), &
3433 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3434 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3435 ra, rb, rc, &
3436 habc, &
3437 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3438 offset_a_start, offset_b_start, offset_c_start, &
3439 0, 0, first_set - 1, &
3440 sphi_a, sphi_b, sphi_c, &
3441 sgfa, sgfb, sgfc, &
3442 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3443 my_eri_method, &
3444 coulomb_context=integral_context, &
3445pabc=pabc_block, &
3446
3447
3448
3449 do_symmetric=do_symmetric, &
3450 on_diagonal=iatom == jatom, &
3451hdabc=hdabc, &
3452
3453
3454 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3455 END IF
3456 IF (.NOT.PRESENT(force_a) .AND. &
3457 .NOT.PRESENT(force_b) .AND. &
3458 .NOT.PRESENT(force_c) .AND. &
3459 PRESENT(pabc) .AND. &
3460 PRESENT(mat_dabc) .AND. &
3461 .NOT.PRESENT(mat_adbc) .AND. &
3462 PRESENT(mat_abdc)) THEN
3463 CALL integrate_set_3c( &
3464 param%par, potential_parameter, &
3465 la_min(iset), la_max(iset), &
3466 lb_min(jset), lb_max(jset), &
3467 lc_min(kset), lc_max(kset), &
3468 npgfa(iset), npgfb(jset), npgfc(kset), &
3469 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3470 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3471 ra, rb, rc, &
3472 habc, &
3473 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3474 offset_a_start, offset_b_start, offset_c_start, &
3475 0, 0, first_set - 1, &
3476 sphi_a, sphi_b, sphi_c, &
3477 sgfa, sgfb, sgfc, &
3478 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3479 my_eri_method, &
3480 coulomb_context=integral_context, &
3481pabc=pabc_block, &
3482
3483
3484
3485 do_symmetric=do_symmetric, &
3486 on_diagonal=iatom == jatom, &
3487hdabc=hdabc, &
3488
3489habdc=habdc, &
3490 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3491 END IF
3492 IF (.NOT.PRESENT(force_a) .AND. &
3493 .NOT.PRESENT(force_b) .AND. &
3494 .NOT.PRESENT(force_c) .AND. &
3495 PRESENT(pabc) .AND. &
3496 PRESENT(mat_dabc) .AND. &
3497 PRESENT(mat_adbc) .AND. &
3498 .NOT.PRESENT(mat_abdc)) THEN
3499 CALL integrate_set_3c( &
3500 param%par, potential_parameter, &
3501 la_min(iset), la_max(iset), &
3502 lb_min(jset), lb_max(jset), &
3503 lc_min(kset), lc_max(kset), &
3504 npgfa(iset), npgfb(jset), npgfc(kset), &
3505 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3506 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3507 ra, rb, rc, &
3508 habc, &
3509 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3510 offset_a_start, offset_b_start, offset_c_start, &
3511 0, 0, first_set - 1, &
3512 sphi_a, sphi_b, sphi_c, &
3513 sgfa, sgfb, sgfc, &
3514 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3515 my_eri_method, &
3516 coulomb_context=integral_context, &
3517pabc=pabc_block, &
3518
3519
3520
3521 do_symmetric=do_symmetric, &
3522 on_diagonal=iatom == jatom, &
3523hdabc=hdabc, &
3524hadbc=hadbc, &
3525
3526 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3527 END IF
3528 IF (.NOT.PRESENT(force_a) .AND. &
3529 .NOT.PRESENT(force_b) .AND. &
3530 .NOT.PRESENT(force_c) .AND. &
3531 PRESENT(pabc) .AND. &
3532 PRESENT(mat_dabc) .AND. &
3533 PRESENT(mat_adbc) .AND. &
3534 PRESENT(mat_abdc)) THEN
3535 CALL integrate_set_3c( &
3536 param%par, potential_parameter, &
3537 la_min(iset), la_max(iset), &
3538 lb_min(jset), lb_max(jset), &
3539 lc_min(kset), lc_max(kset), &
3540 npgfa(iset), npgfb(jset), npgfc(kset), &
3541 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3542 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3543 ra, rb, rc, &
3544 habc, &
3545 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3546 offset_a_start, offset_b_start, offset_c_start, &
3547 0, 0, first_set - 1, &
3548 sphi_a, sphi_b, sphi_c, &
3549 sgfa, sgfb, sgfc, &
3550 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3551 my_eri_method, &
3552 coulomb_context=integral_context, &
3553pabc=pabc_block, &
3554
3555
3556
3557 do_symmetric=do_symmetric, &
3558 on_diagonal=iatom == jatom, &
3559hdabc=hdabc, &
3560hadbc=hadbc, &
3561habdc=habdc, &
3562 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3563 END IF
3564 IF (.NOT.PRESENT(force_a) .AND. &
3565 .NOT.PRESENT(force_b) .AND. &
3566 PRESENT(force_c) .AND. &
3567 PRESENT(pabc) .AND. &
3568 .NOT.PRESENT(mat_dabc) .AND. &
3569 .NOT.PRESENT(mat_adbc) .AND. &
3570 .NOT.PRESENT(mat_abdc)) THEN
3571 CALL integrate_set_3c( &
3572 param%par, potential_parameter, &
3573 la_min(iset), la_max(iset), &
3574 lb_min(jset), lb_max(jset), &
3575 lc_min(kset), lc_max(kset), &
3576 npgfa(iset), npgfb(jset), npgfc(kset), &
3577 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3578 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3579 ra, rb, rc, &
3580 habc, &
3581 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3582 offset_a_start, offset_b_start, offset_c_start, &
3583 0, 0, first_set - 1, &
3584 sphi_a, sphi_b, sphi_c, &
3585 sgfa, sgfb, sgfc, &
3586 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3587 my_eri_method, &
3588 coulomb_context=integral_context, &
3589pabc=pabc_block, &
3590
3591
3592force_c=force_c(kkind)%forces(:, atom_c), &
3593 do_symmetric=do_symmetric, &
3594 on_diagonal=iatom == jatom, &
3595
3596
3597
3598 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3599 END IF
3600 IF (.NOT.PRESENT(force_a) .AND. &
3601 .NOT.PRESENT(force_b) .AND. &
3602 PRESENT(force_c) .AND. &
3603 PRESENT(pabc) .AND. &
3604 .NOT.PRESENT(mat_dabc) .AND. &
3605 .NOT.PRESENT(mat_adbc) .AND. &
3606 PRESENT(mat_abdc)) THEN
3607 CALL integrate_set_3c( &
3608 param%par, potential_parameter, &
3609 la_min(iset), la_max(iset), &
3610 lb_min(jset), lb_max(jset), &
3611 lc_min(kset), lc_max(kset), &
3612 npgfa(iset), npgfb(jset), npgfc(kset), &
3613 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3614 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3615 ra, rb, rc, &
3616 habc, &
3617 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3618 offset_a_start, offset_b_start, offset_c_start, &
3619 0, 0, first_set - 1, &
3620 sphi_a, sphi_b, sphi_c, &
3621 sgfa, sgfb, sgfc, &
3622 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3623 my_eri_method, &
3624 coulomb_context=integral_context, &
3625pabc=pabc_block, &
3626
3627
3628force_c=force_c(kkind)%forces(:, atom_c), &
3629 do_symmetric=do_symmetric, &
3630 on_diagonal=iatom == jatom, &
3631
3632
3633habdc=habdc, &
3634 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3635 END IF
3636 IF (.NOT.PRESENT(force_a) .AND. &
3637 .NOT.PRESENT(force_b) .AND. &
3638 PRESENT(force_c) .AND. &
3639 PRESENT(pabc) .AND. &
3640 .NOT.PRESENT(mat_dabc) .AND. &
3641 PRESENT(mat_adbc) .AND. &
3642 .NOT.PRESENT(mat_abdc)) THEN
3643 CALL integrate_set_3c( &
3644 param%par, potential_parameter, &
3645 la_min(iset), la_max(iset), &
3646 lb_min(jset), lb_max(jset), &
3647 lc_min(kset), lc_max(kset), &
3648 npgfa(iset), npgfb(jset), npgfc(kset), &
3649 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3650 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3651 ra, rb, rc, &
3652 habc, &
3653 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3654 offset_a_start, offset_b_start, offset_c_start, &
3655 0, 0, first_set - 1, &
3656 sphi_a, sphi_b, sphi_c, &
3657 sgfa, sgfb, sgfc, &
3658 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3659 my_eri_method, &
3660 coulomb_context=integral_context, &
3661pabc=pabc_block, &
3662
3663
3664force_c=force_c(kkind)%forces(:, atom_c), &
3665 do_symmetric=do_symmetric, &
3666 on_diagonal=iatom == jatom, &
3667
3668hadbc=hadbc, &
3669
3670 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3671 END IF
3672 IF (.NOT.PRESENT(force_a) .AND. &
3673 .NOT.PRESENT(force_b) .AND. &
3674 PRESENT(force_c) .AND. &
3675 PRESENT(pabc) .AND. &
3676 .NOT.PRESENT(mat_dabc) .AND. &
3677 PRESENT(mat_adbc) .AND. &
3678 PRESENT(mat_abdc)) THEN
3679 CALL integrate_set_3c( &
3680 param%par, potential_parameter, &
3681 la_min(iset), la_max(iset), &
3682 lb_min(jset), lb_max(jset), &
3683 lc_min(kset), lc_max(kset), &
3684 npgfa(iset), npgfb(jset), npgfc(kset), &
3685 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3686 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3687 ra, rb, rc, &
3688 habc, &
3689 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3690 offset_a_start, offset_b_start, offset_c_start, &
3691 0, 0, first_set - 1, &
3692 sphi_a, sphi_b, sphi_c, &
3693 sgfa, sgfb, sgfc, &
3694 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3695 my_eri_method, &
3696 coulomb_context=integral_context, &
3697pabc=pabc_block, &
3698
3699
3700force_c=force_c(kkind)%forces(:, atom_c), &
3701 do_symmetric=do_symmetric, &
3702 on_diagonal=iatom == jatom, &
3703
3704hadbc=hadbc, &
3705habdc=habdc, &
3706 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3707 END IF
3708 IF (.NOT.PRESENT(force_a) .AND. &
3709 .NOT.PRESENT(force_b) .AND. &
3710 PRESENT(force_c) .AND. &
3711 PRESENT(pabc) .AND. &
3712 PRESENT(mat_dabc) .AND. &
3713 .NOT.PRESENT(mat_adbc) .AND. &
3714 .NOT.PRESENT(mat_abdc)) THEN
3715 CALL integrate_set_3c( &
3716 param%par, potential_parameter, &
3717 la_min(iset), la_max(iset), &
3718 lb_min(jset), lb_max(jset), &
3719 lc_min(kset), lc_max(kset), &
3720 npgfa(iset), npgfb(jset), npgfc(kset), &
3721 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3722 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3723 ra, rb, rc, &
3724 habc, &
3725 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3726 offset_a_start, offset_b_start, offset_c_start, &
3727 0, 0, first_set - 1, &
3728 sphi_a, sphi_b, sphi_c, &
3729 sgfa, sgfb, sgfc, &
3730 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3731 my_eri_method, &
3732 coulomb_context=integral_context, &
3733pabc=pabc_block, &
3734
3735
3736force_c=force_c(kkind)%forces(:, atom_c), &
3737 do_symmetric=do_symmetric, &
3738 on_diagonal=iatom == jatom, &
3739hdabc=hdabc, &
3740
3741
3742 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3743 END IF
3744 IF (.NOT.PRESENT(force_a) .AND. &
3745 .NOT.PRESENT(force_b) .AND. &
3746 PRESENT(force_c) .AND. &
3747 PRESENT(pabc) .AND. &
3748 PRESENT(mat_dabc) .AND. &
3749 .NOT.PRESENT(mat_adbc) .AND. &
3750 PRESENT(mat_abdc)) THEN
3751 CALL integrate_set_3c( &
3752 param%par, potential_parameter, &
3753 la_min(iset), la_max(iset), &
3754 lb_min(jset), lb_max(jset), &
3755 lc_min(kset), lc_max(kset), &
3756 npgfa(iset), npgfb(jset), npgfc(kset), &
3757 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3758 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3759 ra, rb, rc, &
3760 habc, &
3761 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3762 offset_a_start, offset_b_start, offset_c_start, &
3763 0, 0, first_set - 1, &
3764 sphi_a, sphi_b, sphi_c, &
3765 sgfa, sgfb, sgfc, &
3766 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3767 my_eri_method, &
3768 coulomb_context=integral_context, &
3769pabc=pabc_block, &
3770
3771
3772force_c=force_c(kkind)%forces(:, atom_c), &
3773 do_symmetric=do_symmetric, &
3774 on_diagonal=iatom == jatom, &
3775hdabc=hdabc, &
3776
3777habdc=habdc, &
3778 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3779 END IF
3780 IF (.NOT.PRESENT(force_a) .AND. &
3781 .NOT.PRESENT(force_b) .AND. &
3782 PRESENT(force_c) .AND. &
3783 PRESENT(pabc) .AND. &
3784 PRESENT(mat_dabc) .AND. &
3785 PRESENT(mat_adbc) .AND. &
3786 .NOT.PRESENT(mat_abdc)) THEN
3787 CALL integrate_set_3c( &
3788 param%par, potential_parameter, &
3789 la_min(iset), la_max(iset), &
3790 lb_min(jset), lb_max(jset), &
3791 lc_min(kset), lc_max(kset), &
3792 npgfa(iset), npgfb(jset), npgfc(kset), &
3793 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3794 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3795 ra, rb, rc, &
3796 habc, &
3797 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3798 offset_a_start, offset_b_start, offset_c_start, &
3799 0, 0, first_set - 1, &
3800 sphi_a, sphi_b, sphi_c, &
3801 sgfa, sgfb, sgfc, &
3802 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3803 my_eri_method, &
3804 coulomb_context=integral_context, &
3805pabc=pabc_block, &
3806
3807
3808force_c=force_c(kkind)%forces(:, atom_c), &
3809 do_symmetric=do_symmetric, &
3810 on_diagonal=iatom == jatom, &
3811hdabc=hdabc, &
3812hadbc=hadbc, &
3813
3814 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3815 END IF
3816 IF (.NOT.PRESENT(force_a) .AND. &
3817 .NOT.PRESENT(force_b) .AND. &
3818 PRESENT(force_c) .AND. &
3819 PRESENT(pabc) .AND. &
3820 PRESENT(mat_dabc) .AND. &
3821 PRESENT(mat_adbc) .AND. &
3822 PRESENT(mat_abdc)) THEN
3823 CALL integrate_set_3c( &
3824 param%par, potential_parameter, &
3825 la_min(iset), la_max(iset), &
3826 lb_min(jset), lb_max(jset), &
3827 lc_min(kset), lc_max(kset), &
3828 npgfa(iset), npgfb(jset), npgfc(kset), &
3829 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3830 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3831 ra, rb, rc, &
3832 habc, &
3833 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3834 offset_a_start, offset_b_start, offset_c_start, &
3835 0, 0, first_set - 1, &
3836 sphi_a, sphi_b, sphi_c, &
3837 sgfa, sgfb, sgfc, &
3838 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3839 my_eri_method, &
3840 coulomb_context=integral_context, &
3841pabc=pabc_block, &
3842
3843
3844force_c=force_c(kkind)%forces(:, atom_c), &
3845 do_symmetric=do_symmetric, &
3846 on_diagonal=iatom == jatom, &
3847hdabc=hdabc, &
3848hadbc=hadbc, &
3849habdc=habdc, &
3850 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3851 END IF
3852 IF (.NOT.PRESENT(force_a) .AND. &
3853 PRESENT(force_b) .AND. &
3854 .NOT.PRESENT(force_c) .AND. &
3855 PRESENT(pabc) .AND. &
3856 .NOT.PRESENT(mat_dabc) .AND. &
3857 .NOT.PRESENT(mat_adbc) .AND. &
3858 .NOT.PRESENT(mat_abdc)) THEN
3859 CALL integrate_set_3c( &
3860 param%par, potential_parameter, &
3861 la_min(iset), la_max(iset), &
3862 lb_min(jset), lb_max(jset), &
3863 lc_min(kset), lc_max(kset), &
3864 npgfa(iset), npgfb(jset), npgfc(kset), &
3865 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3866 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3867 ra, rb, rc, &
3868 habc, &
3869 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3870 offset_a_start, offset_b_start, offset_c_start, &
3871 0, 0, first_set - 1, &
3872 sphi_a, sphi_b, sphi_c, &
3873 sgfa, sgfb, sgfc, &
3874 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3875 my_eri_method, &
3876 coulomb_context=integral_context, &
3877pabc=pabc_block, &
3878
3879force_b=force_b(jkind)%forces(:, atom_b), &
3880
3881 do_symmetric=do_symmetric, &
3882 on_diagonal=iatom == jatom, &
3883
3884
3885
3886 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3887 END IF
3888 IF (.NOT.PRESENT(force_a) .AND. &
3889 PRESENT(force_b) .AND. &
3890 .NOT.PRESENT(force_c) .AND. &
3891 PRESENT(pabc) .AND. &
3892 .NOT.PRESENT(mat_dabc) .AND. &
3893 .NOT.PRESENT(mat_adbc) .AND. &
3894 PRESENT(mat_abdc)) THEN
3895 CALL integrate_set_3c( &
3896 param%par, potential_parameter, &
3897 la_min(iset), la_max(iset), &
3898 lb_min(jset), lb_max(jset), &
3899 lc_min(kset), lc_max(kset), &
3900 npgfa(iset), npgfb(jset), npgfc(kset), &
3901 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3902 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3903 ra, rb, rc, &
3904 habc, &
3905 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3906 offset_a_start, offset_b_start, offset_c_start, &
3907 0, 0, first_set - 1, &
3908 sphi_a, sphi_b, sphi_c, &
3909 sgfa, sgfb, sgfc, &
3910 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3911 my_eri_method, &
3912 coulomb_context=integral_context, &
3913pabc=pabc_block, &
3914
3915force_b=force_b(jkind)%forces(:, atom_b), &
3916
3917 do_symmetric=do_symmetric, &
3918 on_diagonal=iatom == jatom, &
3919
3920
3921habdc=habdc, &
3922 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3923 END IF
3924 IF (.NOT.PRESENT(force_a) .AND. &
3925 PRESENT(force_b) .AND. &
3926 .NOT.PRESENT(force_c) .AND. &
3927 PRESENT(pabc) .AND. &
3928 .NOT.PRESENT(mat_dabc) .AND. &
3929 PRESENT(mat_adbc) .AND. &
3930 .NOT.PRESENT(mat_abdc)) THEN
3931 CALL integrate_set_3c( &
3932 param%par, potential_parameter, &
3933 la_min(iset), la_max(iset), &
3934 lb_min(jset), lb_max(jset), &
3935 lc_min(kset), lc_max(kset), &
3936 npgfa(iset), npgfb(jset), npgfc(kset), &
3937 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3938 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3939 ra, rb, rc, &
3940 habc, &
3941 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3942 offset_a_start, offset_b_start, offset_c_start, &
3943 0, 0, first_set - 1, &
3944 sphi_a, sphi_b, sphi_c, &
3945 sgfa, sgfb, sgfc, &
3946 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3947 my_eri_method, &
3948 coulomb_context=integral_context, &
3949pabc=pabc_block, &
3950
3951force_b=force_b(jkind)%forces(:, atom_b), &
3952
3953 do_symmetric=do_symmetric, &
3954 on_diagonal=iatom == jatom, &
3955
3956hadbc=hadbc, &
3957
3958 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3959 END IF
3960 IF (.NOT.PRESENT(force_a) .AND. &
3961 PRESENT(force_b) .AND. &
3962 .NOT.PRESENT(force_c) .AND. &
3963 PRESENT(pabc) .AND. &
3964 .NOT.PRESENT(mat_dabc) .AND. &
3965 PRESENT(mat_adbc) .AND. &
3966 PRESENT(mat_abdc)) THEN
3967 CALL integrate_set_3c( &
3968 param%par, potential_parameter, &
3969 la_min(iset), la_max(iset), &
3970 lb_min(jset), lb_max(jset), &
3971 lc_min(kset), lc_max(kset), &
3972 npgfa(iset), npgfb(jset), npgfc(kset), &
3973 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
3974 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
3975 ra, rb, rc, &
3976 habc, &
3977 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
3978 offset_a_start, offset_b_start, offset_c_start, &
3979 0, 0, first_set - 1, &
3980 sphi_a, sphi_b, sphi_c, &
3981 sgfa, sgfb, sgfc, &
3982 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
3983 my_eri_method, &
3984 coulomb_context=integral_context, &
3985pabc=pabc_block, &
3986
3987force_b=force_b(jkind)%forces(:, atom_b), &
3988
3989 do_symmetric=do_symmetric, &
3990 on_diagonal=iatom == jatom, &
3991
3992hadbc=hadbc, &
3993habdc=habdc, &
3994 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
3995 END IF
3996 IF (.NOT.PRESENT(force_a) .AND. &
3997 PRESENT(force_b) .AND. &
3998 .NOT.PRESENT(force_c) .AND. &
3999 PRESENT(pabc) .AND. &
4000 PRESENT(mat_dabc) .AND. &
4001 .NOT.PRESENT(mat_adbc) .AND. &
4002 .NOT.PRESENT(mat_abdc)) THEN
4003 CALL integrate_set_3c( &
4004 param%par, potential_parameter, &
4005 la_min(iset), la_max(iset), &
4006 lb_min(jset), lb_max(jset), &
4007 lc_min(kset), lc_max(kset), &
4008 npgfa(iset), npgfb(jset), npgfc(kset), &
4009 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4010 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4011 ra, rb, rc, &
4012 habc, &
4013 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4014 offset_a_start, offset_b_start, offset_c_start, &
4015 0, 0, first_set - 1, &
4016 sphi_a, sphi_b, sphi_c, &
4017 sgfa, sgfb, sgfc, &
4018 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4019 my_eri_method, &
4020 coulomb_context=integral_context, &
4021pabc=pabc_block, &
4022
4023force_b=force_b(jkind)%forces(:, atom_b), &
4024
4025 do_symmetric=do_symmetric, &
4026 on_diagonal=iatom == jatom, &
4027hdabc=hdabc, &
4028
4029
4030 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4031 END IF
4032 IF (.NOT.PRESENT(force_a) .AND. &
4033 PRESENT(force_b) .AND. &
4034 .NOT.PRESENT(force_c) .AND. &
4035 PRESENT(pabc) .AND. &
4036 PRESENT(mat_dabc) .AND. &
4037 .NOT.PRESENT(mat_adbc) .AND. &
4038 PRESENT(mat_abdc)) THEN
4039 CALL integrate_set_3c( &
4040 param%par, potential_parameter, &
4041 la_min(iset), la_max(iset), &
4042 lb_min(jset), lb_max(jset), &
4043 lc_min(kset), lc_max(kset), &
4044 npgfa(iset), npgfb(jset), npgfc(kset), &
4045 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4046 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4047 ra, rb, rc, &
4048 habc, &
4049 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4050 offset_a_start, offset_b_start, offset_c_start, &
4051 0, 0, first_set - 1, &
4052 sphi_a, sphi_b, sphi_c, &
4053 sgfa, sgfb, sgfc, &
4054 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4055 my_eri_method, &
4056 coulomb_context=integral_context, &
4057pabc=pabc_block, &
4058
4059force_b=force_b(jkind)%forces(:, atom_b), &
4060
4061 do_symmetric=do_symmetric, &
4062 on_diagonal=iatom == jatom, &
4063hdabc=hdabc, &
4064
4065habdc=habdc, &
4066 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4067 END IF
4068 IF (.NOT.PRESENT(force_a) .AND. &
4069 PRESENT(force_b) .AND. &
4070 .NOT.PRESENT(force_c) .AND. &
4071 PRESENT(pabc) .AND. &
4072 PRESENT(mat_dabc) .AND. &
4073 PRESENT(mat_adbc) .AND. &
4074 .NOT.PRESENT(mat_abdc)) THEN
4075 CALL integrate_set_3c( &
4076 param%par, potential_parameter, &
4077 la_min(iset), la_max(iset), &
4078 lb_min(jset), lb_max(jset), &
4079 lc_min(kset), lc_max(kset), &
4080 npgfa(iset), npgfb(jset), npgfc(kset), &
4081 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4082 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4083 ra, rb, rc, &
4084 habc, &
4085 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4086 offset_a_start, offset_b_start, offset_c_start, &
4087 0, 0, first_set - 1, &
4088 sphi_a, sphi_b, sphi_c, &
4089 sgfa, sgfb, sgfc, &
4090 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4091 my_eri_method, &
4092 coulomb_context=integral_context, &
4093pabc=pabc_block, &
4094
4095force_b=force_b(jkind)%forces(:, atom_b), &
4096
4097 do_symmetric=do_symmetric, &
4098 on_diagonal=iatom == jatom, &
4099hdabc=hdabc, &
4100hadbc=hadbc, &
4101
4102 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4103 END IF
4104 IF (.NOT.PRESENT(force_a) .AND. &
4105 PRESENT(force_b) .AND. &
4106 .NOT.PRESENT(force_c) .AND. &
4107 PRESENT(pabc) .AND. &
4108 PRESENT(mat_dabc) .AND. &
4109 PRESENT(mat_adbc) .AND. &
4110 PRESENT(mat_abdc)) THEN
4111 CALL integrate_set_3c( &
4112 param%par, potential_parameter, &
4113 la_min(iset), la_max(iset), &
4114 lb_min(jset), lb_max(jset), &
4115 lc_min(kset), lc_max(kset), &
4116 npgfa(iset), npgfb(jset), npgfc(kset), &
4117 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4118 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4119 ra, rb, rc, &
4120 habc, &
4121 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4122 offset_a_start, offset_b_start, offset_c_start, &
4123 0, 0, first_set - 1, &
4124 sphi_a, sphi_b, sphi_c, &
4125 sgfa, sgfb, sgfc, &
4126 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4127 my_eri_method, &
4128 coulomb_context=integral_context, &
4129pabc=pabc_block, &
4130
4131force_b=force_b(jkind)%forces(:, atom_b), &
4132
4133 do_symmetric=do_symmetric, &
4134 on_diagonal=iatom == jatom, &
4135hdabc=hdabc, &
4136hadbc=hadbc, &
4137habdc=habdc, &
4138 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4139 END IF
4140 IF (.NOT.PRESENT(force_a) .AND. &
4141 PRESENT(force_b) .AND. &
4142 PRESENT(force_c) .AND. &
4143 PRESENT(pabc) .AND. &
4144 .NOT.PRESENT(mat_dabc) .AND. &
4145 .NOT.PRESENT(mat_adbc) .AND. &
4146 .NOT.PRESENT(mat_abdc)) THEN
4147 CALL integrate_set_3c( &
4148 param%par, potential_parameter, &
4149 la_min(iset), la_max(iset), &
4150 lb_min(jset), lb_max(jset), &
4151 lc_min(kset), lc_max(kset), &
4152 npgfa(iset), npgfb(jset), npgfc(kset), &
4153 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4154 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4155 ra, rb, rc, &
4156 habc, &
4157 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4158 offset_a_start, offset_b_start, offset_c_start, &
4159 0, 0, first_set - 1, &
4160 sphi_a, sphi_b, sphi_c, &
4161 sgfa, sgfb, sgfc, &
4162 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4163 my_eri_method, &
4164 coulomb_context=integral_context, &
4165pabc=pabc_block, &
4166
4167force_b=force_b(jkind)%forces(:, atom_b), &
4168force_c=force_c(kkind)%forces(:, atom_c), &
4169 do_symmetric=do_symmetric, &
4170 on_diagonal=iatom == jatom, &
4171
4172
4173
4174 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4175 END IF
4176 IF (.NOT.PRESENT(force_a) .AND. &
4177 PRESENT(force_b) .AND. &
4178 PRESENT(force_c) .AND. &
4179 PRESENT(pabc) .AND. &
4180 .NOT.PRESENT(mat_dabc) .AND. &
4181 .NOT.PRESENT(mat_adbc) .AND. &
4182 PRESENT(mat_abdc)) THEN
4183 CALL integrate_set_3c( &
4184 param%par, potential_parameter, &
4185 la_min(iset), la_max(iset), &
4186 lb_min(jset), lb_max(jset), &
4187 lc_min(kset), lc_max(kset), &
4188 npgfa(iset), npgfb(jset), npgfc(kset), &
4189 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4190 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4191 ra, rb, rc, &
4192 habc, &
4193 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4194 offset_a_start, offset_b_start, offset_c_start, &
4195 0, 0, first_set - 1, &
4196 sphi_a, sphi_b, sphi_c, &
4197 sgfa, sgfb, sgfc, &
4198 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4199 my_eri_method, &
4200 coulomb_context=integral_context, &
4201pabc=pabc_block, &
4202
4203force_b=force_b(jkind)%forces(:, atom_b), &
4204force_c=force_c(kkind)%forces(:, atom_c), &
4205 do_symmetric=do_symmetric, &
4206 on_diagonal=iatom == jatom, &
4207
4208
4209habdc=habdc, &
4210 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4211 END IF
4212 IF (.NOT.PRESENT(force_a) .AND. &
4213 PRESENT(force_b) .AND. &
4214 PRESENT(force_c) .AND. &
4215 PRESENT(pabc) .AND. &
4216 .NOT.PRESENT(mat_dabc) .AND. &
4217 PRESENT(mat_adbc) .AND. &
4218 .NOT.PRESENT(mat_abdc)) THEN
4219 CALL integrate_set_3c( &
4220 param%par, potential_parameter, &
4221 la_min(iset), la_max(iset), &
4222 lb_min(jset), lb_max(jset), &
4223 lc_min(kset), lc_max(kset), &
4224 npgfa(iset), npgfb(jset), npgfc(kset), &
4225 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4226 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4227 ra, rb, rc, &
4228 habc, &
4229 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4230 offset_a_start, offset_b_start, offset_c_start, &
4231 0, 0, first_set - 1, &
4232 sphi_a, sphi_b, sphi_c, &
4233 sgfa, sgfb, sgfc, &
4234 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4235 my_eri_method, &
4236 coulomb_context=integral_context, &
4237pabc=pabc_block, &
4238
4239force_b=force_b(jkind)%forces(:, atom_b), &
4240force_c=force_c(kkind)%forces(:, atom_c), &
4241 do_symmetric=do_symmetric, &
4242 on_diagonal=iatom == jatom, &
4243
4244hadbc=hadbc, &
4245
4246 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4247 END IF
4248 IF (.NOT.PRESENT(force_a) .AND. &
4249 PRESENT(force_b) .AND. &
4250 PRESENT(force_c) .AND. &
4251 PRESENT(pabc) .AND. &
4252 .NOT.PRESENT(mat_dabc) .AND. &
4253 PRESENT(mat_adbc) .AND. &
4254 PRESENT(mat_abdc)) THEN
4255 CALL integrate_set_3c( &
4256 param%par, potential_parameter, &
4257 la_min(iset), la_max(iset), &
4258 lb_min(jset), lb_max(jset), &
4259 lc_min(kset), lc_max(kset), &
4260 npgfa(iset), npgfb(jset), npgfc(kset), &
4261 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4262 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4263 ra, rb, rc, &
4264 habc, &
4265 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4266 offset_a_start, offset_b_start, offset_c_start, &
4267 0, 0, first_set - 1, &
4268 sphi_a, sphi_b, sphi_c, &
4269 sgfa, sgfb, sgfc, &
4270 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4271 my_eri_method, &
4272 coulomb_context=integral_context, &
4273pabc=pabc_block, &
4274
4275force_b=force_b(jkind)%forces(:, atom_b), &
4276force_c=force_c(kkind)%forces(:, atom_c), &
4277 do_symmetric=do_symmetric, &
4278 on_diagonal=iatom == jatom, &
4279
4280hadbc=hadbc, &
4281habdc=habdc, &
4282 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4283 END IF
4284 IF (.NOT.PRESENT(force_a) .AND. &
4285 PRESENT(force_b) .AND. &
4286 PRESENT(force_c) .AND. &
4287 PRESENT(pabc) .AND. &
4288 PRESENT(mat_dabc) .AND. &
4289 .NOT.PRESENT(mat_adbc) .AND. &
4290 .NOT.PRESENT(mat_abdc)) THEN
4291 CALL integrate_set_3c( &
4292 param%par, potential_parameter, &
4293 la_min(iset), la_max(iset), &
4294 lb_min(jset), lb_max(jset), &
4295 lc_min(kset), lc_max(kset), &
4296 npgfa(iset), npgfb(jset), npgfc(kset), &
4297 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4298 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4299 ra, rb, rc, &
4300 habc, &
4301 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4302 offset_a_start, offset_b_start, offset_c_start, &
4303 0, 0, first_set - 1, &
4304 sphi_a, sphi_b, sphi_c, &
4305 sgfa, sgfb, sgfc, &
4306 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4307 my_eri_method, &
4308 coulomb_context=integral_context, &
4309pabc=pabc_block, &
4310
4311force_b=force_b(jkind)%forces(:, atom_b), &
4312force_c=force_c(kkind)%forces(:, atom_c), &
4313 do_symmetric=do_symmetric, &
4314 on_diagonal=iatom == jatom, &
4315hdabc=hdabc, &
4316
4317
4318 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4319 END IF
4320 IF (.NOT.PRESENT(force_a) .AND. &
4321 PRESENT(force_b) .AND. &
4322 PRESENT(force_c) .AND. &
4323 PRESENT(pabc) .AND. &
4324 PRESENT(mat_dabc) .AND. &
4325 .NOT.PRESENT(mat_adbc) .AND. &
4326 PRESENT(mat_abdc)) THEN
4327 CALL integrate_set_3c( &
4328 param%par, potential_parameter, &
4329 la_min(iset), la_max(iset), &
4330 lb_min(jset), lb_max(jset), &
4331 lc_min(kset), lc_max(kset), &
4332 npgfa(iset), npgfb(jset), npgfc(kset), &
4333 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4334 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4335 ra, rb, rc, &
4336 habc, &
4337 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4338 offset_a_start, offset_b_start, offset_c_start, &
4339 0, 0, first_set - 1, &
4340 sphi_a, sphi_b, sphi_c, &
4341 sgfa, sgfb, sgfc, &
4342 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4343 my_eri_method, &
4344 coulomb_context=integral_context, &
4345pabc=pabc_block, &
4346
4347force_b=force_b(jkind)%forces(:, atom_b), &
4348force_c=force_c(kkind)%forces(:, atom_c), &
4349 do_symmetric=do_symmetric, &
4350 on_diagonal=iatom == jatom, &
4351hdabc=hdabc, &
4352
4353habdc=habdc, &
4354 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4355 END IF
4356 IF (.NOT.PRESENT(force_a) .AND. &
4357 PRESENT(force_b) .AND. &
4358 PRESENT(force_c) .AND. &
4359 PRESENT(pabc) .AND. &
4360 PRESENT(mat_dabc) .AND. &
4361 PRESENT(mat_adbc) .AND. &
4362 .NOT.PRESENT(mat_abdc)) THEN
4363 CALL integrate_set_3c( &
4364 param%par, potential_parameter, &
4365 la_min(iset), la_max(iset), &
4366 lb_min(jset), lb_max(jset), &
4367 lc_min(kset), lc_max(kset), &
4368 npgfa(iset), npgfb(jset), npgfc(kset), &
4369 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4370 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4371 ra, rb, rc, &
4372 habc, &
4373 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4374 offset_a_start, offset_b_start, offset_c_start, &
4375 0, 0, first_set - 1, &
4376 sphi_a, sphi_b, sphi_c, &
4377 sgfa, sgfb, sgfc, &
4378 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4379 my_eri_method, &
4380 coulomb_context=integral_context, &
4381pabc=pabc_block, &
4382
4383force_b=force_b(jkind)%forces(:, atom_b), &
4384force_c=force_c(kkind)%forces(:, atom_c), &
4385 do_symmetric=do_symmetric, &
4386 on_diagonal=iatom == jatom, &
4387hdabc=hdabc, &
4388hadbc=hadbc, &
4389
4390 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4391 END IF
4392 IF (.NOT.PRESENT(force_a) .AND. &
4393 PRESENT(force_b) .AND. &
4394 PRESENT(force_c) .AND. &
4395 PRESENT(pabc) .AND. &
4396 PRESENT(mat_dabc) .AND. &
4397 PRESENT(mat_adbc) .AND. &
4398 PRESENT(mat_abdc)) THEN
4399 CALL integrate_set_3c( &
4400 param%par, potential_parameter, &
4401 la_min(iset), la_max(iset), &
4402 lb_min(jset), lb_max(jset), &
4403 lc_min(kset), lc_max(kset), &
4404 npgfa(iset), npgfb(jset), npgfc(kset), &
4405 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4406 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4407 ra, rb, rc, &
4408 habc, &
4409 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4410 offset_a_start, offset_b_start, offset_c_start, &
4411 0, 0, first_set - 1, &
4412 sphi_a, sphi_b, sphi_c, &
4413 sgfa, sgfb, sgfc, &
4414 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4415 my_eri_method, &
4416 coulomb_context=integral_context, &
4417pabc=pabc_block, &
4418
4419force_b=force_b(jkind)%forces(:, atom_b), &
4420force_c=force_c(kkind)%forces(:, atom_c), &
4421 do_symmetric=do_symmetric, &
4422 on_diagonal=iatom == jatom, &
4423hdabc=hdabc, &
4424hadbc=hadbc, &
4425habdc=habdc, &
4426 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4427 END IF
4428 IF (PRESENT(force_a) .AND. &
4429 .NOT.PRESENT(force_b) .AND. &
4430 .NOT.PRESENT(force_c) .AND. &
4431 PRESENT(pabc) .AND. &
4432 .NOT.PRESENT(mat_dabc) .AND. &
4433 .NOT.PRESENT(mat_adbc) .AND. &
4434 .NOT.PRESENT(mat_abdc)) THEN
4435 CALL integrate_set_3c( &
4436 param%par, potential_parameter, &
4437 la_min(iset), la_max(iset), &
4438 lb_min(jset), lb_max(jset), &
4439 lc_min(kset), lc_max(kset), &
4440 npgfa(iset), npgfb(jset), npgfc(kset), &
4441 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4442 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4443 ra, rb, rc, &
4444 habc, &
4445 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4446 offset_a_start, offset_b_start, offset_c_start, &
4447 0, 0, first_set - 1, &
4448 sphi_a, sphi_b, sphi_c, &
4449 sgfa, sgfb, sgfc, &
4450 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4451 my_eri_method, &
4452 coulomb_context=integral_context, &
4453pabc=pabc_block, &
4454force_a=force_a(ikind)%forces(:, atom_a), &
4455
4456
4457 do_symmetric=do_symmetric, &
4458 on_diagonal=iatom == jatom, &
4459
4460
4461
4462 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4463 END IF
4464 IF (PRESENT(force_a) .AND. &
4465 .NOT.PRESENT(force_b) .AND. &
4466 .NOT.PRESENT(force_c) .AND. &
4467 PRESENT(pabc) .AND. &
4468 .NOT.PRESENT(mat_dabc) .AND. &
4469 .NOT.PRESENT(mat_adbc) .AND. &
4470 PRESENT(mat_abdc)) THEN
4471 CALL integrate_set_3c( &
4472 param%par, potential_parameter, &
4473 la_min(iset), la_max(iset), &
4474 lb_min(jset), lb_max(jset), &
4475 lc_min(kset), lc_max(kset), &
4476 npgfa(iset), npgfb(jset), npgfc(kset), &
4477 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4478 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4479 ra, rb, rc, &
4480 habc, &
4481 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4482 offset_a_start, offset_b_start, offset_c_start, &
4483 0, 0, first_set - 1, &
4484 sphi_a, sphi_b, sphi_c, &
4485 sgfa, sgfb, sgfc, &
4486 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4487 my_eri_method, &
4488 coulomb_context=integral_context, &
4489pabc=pabc_block, &
4490force_a=force_a(ikind)%forces(:, atom_a), &
4491
4492
4493 do_symmetric=do_symmetric, &
4494 on_diagonal=iatom == jatom, &
4495
4496
4497habdc=habdc, &
4498 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4499 END IF
4500 IF (PRESENT(force_a) .AND. &
4501 .NOT.PRESENT(force_b) .AND. &
4502 .NOT.PRESENT(force_c) .AND. &
4503 PRESENT(pabc) .AND. &
4504 .NOT.PRESENT(mat_dabc) .AND. &
4505 PRESENT(mat_adbc) .AND. &
4506 .NOT.PRESENT(mat_abdc)) THEN
4507 CALL integrate_set_3c( &
4508 param%par, potential_parameter, &
4509 la_min(iset), la_max(iset), &
4510 lb_min(jset), lb_max(jset), &
4511 lc_min(kset), lc_max(kset), &
4512 npgfa(iset), npgfb(jset), npgfc(kset), &
4513 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4514 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4515 ra, rb, rc, &
4516 habc, &
4517 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4518 offset_a_start, offset_b_start, offset_c_start, &
4519 0, 0, first_set - 1, &
4520 sphi_a, sphi_b, sphi_c, &
4521 sgfa, sgfb, sgfc, &
4522 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4523 my_eri_method, &
4524 coulomb_context=integral_context, &
4525pabc=pabc_block, &
4526force_a=force_a(ikind)%forces(:, atom_a), &
4527
4528
4529 do_symmetric=do_symmetric, &
4530 on_diagonal=iatom == jatom, &
4531
4532hadbc=hadbc, &
4533
4534 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4535 END IF
4536 IF (PRESENT(force_a) .AND. &
4537 .NOT.PRESENT(force_b) .AND. &
4538 .NOT.PRESENT(force_c) .AND. &
4539 PRESENT(pabc) .AND. &
4540 .NOT.PRESENT(mat_dabc) .AND. &
4541 PRESENT(mat_adbc) .AND. &
4542 PRESENT(mat_abdc)) THEN
4543 CALL integrate_set_3c( &
4544 param%par, potential_parameter, &
4545 la_min(iset), la_max(iset), &
4546 lb_min(jset), lb_max(jset), &
4547 lc_min(kset), lc_max(kset), &
4548 npgfa(iset), npgfb(jset), npgfc(kset), &
4549 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4550 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4551 ra, rb, rc, &
4552 habc, &
4553 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4554 offset_a_start, offset_b_start, offset_c_start, &
4555 0, 0, first_set - 1, &
4556 sphi_a, sphi_b, sphi_c, &
4557 sgfa, sgfb, sgfc, &
4558 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4559 my_eri_method, &
4560 coulomb_context=integral_context, &
4561pabc=pabc_block, &
4562force_a=force_a(ikind)%forces(:, atom_a), &
4563
4564
4565 do_symmetric=do_symmetric, &
4566 on_diagonal=iatom == jatom, &
4567
4568hadbc=hadbc, &
4569habdc=habdc, &
4570 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4571 END IF
4572 IF (PRESENT(force_a) .AND. &
4573 .NOT.PRESENT(force_b) .AND. &
4574 .NOT.PRESENT(force_c) .AND. &
4575 PRESENT(pabc) .AND. &
4576 PRESENT(mat_dabc) .AND. &
4577 .NOT.PRESENT(mat_adbc) .AND. &
4578 .NOT.PRESENT(mat_abdc)) THEN
4579 CALL integrate_set_3c( &
4580 param%par, potential_parameter, &
4581 la_min(iset), la_max(iset), &
4582 lb_min(jset), lb_max(jset), &
4583 lc_min(kset), lc_max(kset), &
4584 npgfa(iset), npgfb(jset), npgfc(kset), &
4585 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4586 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4587 ra, rb, rc, &
4588 habc, &
4589 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4590 offset_a_start, offset_b_start, offset_c_start, &
4591 0, 0, first_set - 1, &
4592 sphi_a, sphi_b, sphi_c, &
4593 sgfa, sgfb, sgfc, &
4594 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4595 my_eri_method, &
4596 coulomb_context=integral_context, &
4597pabc=pabc_block, &
4598force_a=force_a(ikind)%forces(:, atom_a), &
4599
4600
4601 do_symmetric=do_symmetric, &
4602 on_diagonal=iatom == jatom, &
4603hdabc=hdabc, &
4604
4605
4606 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4607 END IF
4608 IF (PRESENT(force_a) .AND. &
4609 .NOT.PRESENT(force_b) .AND. &
4610 .NOT.PRESENT(force_c) .AND. &
4611 PRESENT(pabc) .AND. &
4612 PRESENT(mat_dabc) .AND. &
4613 .NOT.PRESENT(mat_adbc) .AND. &
4614 PRESENT(mat_abdc)) THEN
4615 CALL integrate_set_3c( &
4616 param%par, potential_parameter, &
4617 la_min(iset), la_max(iset), &
4618 lb_min(jset), lb_max(jset), &
4619 lc_min(kset), lc_max(kset), &
4620 npgfa(iset), npgfb(jset), npgfc(kset), &
4621 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4622 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4623 ra, rb, rc, &
4624 habc, &
4625 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4626 offset_a_start, offset_b_start, offset_c_start, &
4627 0, 0, first_set - 1, &
4628 sphi_a, sphi_b, sphi_c, &
4629 sgfa, sgfb, sgfc, &
4630 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4631 my_eri_method, &
4632 coulomb_context=integral_context, &
4633pabc=pabc_block, &
4634force_a=force_a(ikind)%forces(:, atom_a), &
4635
4636
4637 do_symmetric=do_symmetric, &
4638 on_diagonal=iatom == jatom, &
4639hdabc=hdabc, &
4640
4641habdc=habdc, &
4642 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4643 END IF
4644 IF (PRESENT(force_a) .AND. &
4645 .NOT.PRESENT(force_b) .AND. &
4646 .NOT.PRESENT(force_c) .AND. &
4647 PRESENT(pabc) .AND. &
4648 PRESENT(mat_dabc) .AND. &
4649 PRESENT(mat_adbc) .AND. &
4650 .NOT.PRESENT(mat_abdc)) THEN
4651 CALL integrate_set_3c( &
4652 param%par, potential_parameter, &
4653 la_min(iset), la_max(iset), &
4654 lb_min(jset), lb_max(jset), &
4655 lc_min(kset), lc_max(kset), &
4656 npgfa(iset), npgfb(jset), npgfc(kset), &
4657 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4658 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4659 ra, rb, rc, &
4660 habc, &
4661 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4662 offset_a_start, offset_b_start, offset_c_start, &
4663 0, 0, first_set - 1, &
4664 sphi_a, sphi_b, sphi_c, &
4665 sgfa, sgfb, sgfc, &
4666 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4667 my_eri_method, &
4668 coulomb_context=integral_context, &
4669pabc=pabc_block, &
4670force_a=force_a(ikind)%forces(:, atom_a), &
4671
4672
4673 do_symmetric=do_symmetric, &
4674 on_diagonal=iatom == jatom, &
4675hdabc=hdabc, &
4676hadbc=hadbc, &
4677
4678 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4679 END IF
4680 IF (PRESENT(force_a) .AND. &
4681 .NOT.PRESENT(force_b) .AND. &
4682 .NOT.PRESENT(force_c) .AND. &
4683 PRESENT(pabc) .AND. &
4684 PRESENT(mat_dabc) .AND. &
4685 PRESENT(mat_adbc) .AND. &
4686 PRESENT(mat_abdc)) THEN
4687 CALL integrate_set_3c( &
4688 param%par, potential_parameter, &
4689 la_min(iset), la_max(iset), &
4690 lb_min(jset), lb_max(jset), &
4691 lc_min(kset), lc_max(kset), &
4692 npgfa(iset), npgfb(jset), npgfc(kset), &
4693 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4694 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4695 ra, rb, rc, &
4696 habc, &
4697 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4698 offset_a_start, offset_b_start, offset_c_start, &
4699 0, 0, first_set - 1, &
4700 sphi_a, sphi_b, sphi_c, &
4701 sgfa, sgfb, sgfc, &
4702 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4703 my_eri_method, &
4704 coulomb_context=integral_context, &
4705pabc=pabc_block, &
4706force_a=force_a(ikind)%forces(:, atom_a), &
4707
4708
4709 do_symmetric=do_symmetric, &
4710 on_diagonal=iatom == jatom, &
4711hdabc=hdabc, &
4712hadbc=hadbc, &
4713habdc=habdc, &
4714 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4715 END IF
4716 IF (PRESENT(force_a) .AND. &
4717 .NOT.PRESENT(force_b) .AND. &
4718 PRESENT(force_c) .AND. &
4719 PRESENT(pabc) .AND. &
4720 .NOT.PRESENT(mat_dabc) .AND. &
4721 .NOT.PRESENT(mat_adbc) .AND. &
4722 .NOT.PRESENT(mat_abdc)) THEN
4723 CALL integrate_set_3c( &
4724 param%par, potential_parameter, &
4725 la_min(iset), la_max(iset), &
4726 lb_min(jset), lb_max(jset), &
4727 lc_min(kset), lc_max(kset), &
4728 npgfa(iset), npgfb(jset), npgfc(kset), &
4729 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4730 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4731 ra, rb, rc, &
4732 habc, &
4733 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4734 offset_a_start, offset_b_start, offset_c_start, &
4735 0, 0, first_set - 1, &
4736 sphi_a, sphi_b, sphi_c, &
4737 sgfa, sgfb, sgfc, &
4738 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4739 my_eri_method, &
4740 coulomb_context=integral_context, &
4741pabc=pabc_block, &
4742force_a=force_a(ikind)%forces(:, atom_a), &
4743
4744force_c=force_c(kkind)%forces(:, atom_c), &
4745 do_symmetric=do_symmetric, &
4746 on_diagonal=iatom == jatom, &
4747
4748
4749
4750 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4751 END IF
4752 IF (PRESENT(force_a) .AND. &
4753 .NOT.PRESENT(force_b) .AND. &
4754 PRESENT(force_c) .AND. &
4755 PRESENT(pabc) .AND. &
4756 .NOT.PRESENT(mat_dabc) .AND. &
4757 .NOT.PRESENT(mat_adbc) .AND. &
4758 PRESENT(mat_abdc)) THEN
4759 CALL integrate_set_3c( &
4760 param%par, potential_parameter, &
4761 la_min(iset), la_max(iset), &
4762 lb_min(jset), lb_max(jset), &
4763 lc_min(kset), lc_max(kset), &
4764 npgfa(iset), npgfb(jset), npgfc(kset), &
4765 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4766 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4767 ra, rb, rc, &
4768 habc, &
4769 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4770 offset_a_start, offset_b_start, offset_c_start, &
4771 0, 0, first_set - 1, &
4772 sphi_a, sphi_b, sphi_c, &
4773 sgfa, sgfb, sgfc, &
4774 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4775 my_eri_method, &
4776 coulomb_context=integral_context, &
4777pabc=pabc_block, &
4778force_a=force_a(ikind)%forces(:, atom_a), &
4779
4780force_c=force_c(kkind)%forces(:, atom_c), &
4781 do_symmetric=do_symmetric, &
4782 on_diagonal=iatom == jatom, &
4783
4784
4785habdc=habdc, &
4786 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4787 END IF
4788 IF (PRESENT(force_a) .AND. &
4789 .NOT.PRESENT(force_b) .AND. &
4790 PRESENT(force_c) .AND. &
4791 PRESENT(pabc) .AND. &
4792 .NOT.PRESENT(mat_dabc) .AND. &
4793 PRESENT(mat_adbc) .AND. &
4794 .NOT.PRESENT(mat_abdc)) THEN
4795 CALL integrate_set_3c( &
4796 param%par, potential_parameter, &
4797 la_min(iset), la_max(iset), &
4798 lb_min(jset), lb_max(jset), &
4799 lc_min(kset), lc_max(kset), &
4800 npgfa(iset), npgfb(jset), npgfc(kset), &
4801 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4802 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4803 ra, rb, rc, &
4804 habc, &
4805 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4806 offset_a_start, offset_b_start, offset_c_start, &
4807 0, 0, first_set - 1, &
4808 sphi_a, sphi_b, sphi_c, &
4809 sgfa, sgfb, sgfc, &
4810 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4811 my_eri_method, &
4812 coulomb_context=integral_context, &
4813pabc=pabc_block, &
4814force_a=force_a(ikind)%forces(:, atom_a), &
4815
4816force_c=force_c(kkind)%forces(:, atom_c), &
4817 do_symmetric=do_symmetric, &
4818 on_diagonal=iatom == jatom, &
4819
4820hadbc=hadbc, &
4821
4822 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4823 END IF
4824 IF (PRESENT(force_a) .AND. &
4825 .NOT.PRESENT(force_b) .AND. &
4826 PRESENT(force_c) .AND. &
4827 PRESENT(pabc) .AND. &
4828 .NOT.PRESENT(mat_dabc) .AND. &
4829 PRESENT(mat_adbc) .AND. &
4830 PRESENT(mat_abdc)) THEN
4831 CALL integrate_set_3c( &
4832 param%par, potential_parameter, &
4833 la_min(iset), la_max(iset), &
4834 lb_min(jset), lb_max(jset), &
4835 lc_min(kset), lc_max(kset), &
4836 npgfa(iset), npgfb(jset), npgfc(kset), &
4837 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4838 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4839 ra, rb, rc, &
4840 habc, &
4841 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4842 offset_a_start, offset_b_start, offset_c_start, &
4843 0, 0, first_set - 1, &
4844 sphi_a, sphi_b, sphi_c, &
4845 sgfa, sgfb, sgfc, &
4846 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4847 my_eri_method, &
4848 coulomb_context=integral_context, &
4849pabc=pabc_block, &
4850force_a=force_a(ikind)%forces(:, atom_a), &
4851
4852force_c=force_c(kkind)%forces(:, atom_c), &
4853 do_symmetric=do_symmetric, &
4854 on_diagonal=iatom == jatom, &
4855
4856hadbc=hadbc, &
4857habdc=habdc, &
4858 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4859 END IF
4860 IF (PRESENT(force_a) .AND. &
4861 .NOT.PRESENT(force_b) .AND. &
4862 PRESENT(force_c) .AND. &
4863 PRESENT(pabc) .AND. &
4864 PRESENT(mat_dabc) .AND. &
4865 .NOT.PRESENT(mat_adbc) .AND. &
4866 .NOT.PRESENT(mat_abdc)) THEN
4867 CALL integrate_set_3c( &
4868 param%par, potential_parameter, &
4869 la_min(iset), la_max(iset), &
4870 lb_min(jset), lb_max(jset), &
4871 lc_min(kset), lc_max(kset), &
4872 npgfa(iset), npgfb(jset), npgfc(kset), &
4873 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4874 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4875 ra, rb, rc, &
4876 habc, &
4877 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4878 offset_a_start, offset_b_start, offset_c_start, &
4879 0, 0, first_set - 1, &
4880 sphi_a, sphi_b, sphi_c, &
4881 sgfa, sgfb, sgfc, &
4882 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4883 my_eri_method, &
4884 coulomb_context=integral_context, &
4885pabc=pabc_block, &
4886force_a=force_a(ikind)%forces(:, atom_a), &
4887
4888force_c=force_c(kkind)%forces(:, atom_c), &
4889 do_symmetric=do_symmetric, &
4890 on_diagonal=iatom == jatom, &
4891hdabc=hdabc, &
4892
4893
4894 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4895 END IF
4896 IF (PRESENT(force_a) .AND. &
4897 .NOT.PRESENT(force_b) .AND. &
4898 PRESENT(force_c) .AND. &
4899 PRESENT(pabc) .AND. &
4900 PRESENT(mat_dabc) .AND. &
4901 .NOT.PRESENT(mat_adbc) .AND. &
4902 PRESENT(mat_abdc)) THEN
4903 CALL integrate_set_3c( &
4904 param%par, potential_parameter, &
4905 la_min(iset), la_max(iset), &
4906 lb_min(jset), lb_max(jset), &
4907 lc_min(kset), lc_max(kset), &
4908 npgfa(iset), npgfb(jset), npgfc(kset), &
4909 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4910 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4911 ra, rb, rc, &
4912 habc, &
4913 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4914 offset_a_start, offset_b_start, offset_c_start, &
4915 0, 0, first_set - 1, &
4916 sphi_a, sphi_b, sphi_c, &
4917 sgfa, sgfb, sgfc, &
4918 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4919 my_eri_method, &
4920 coulomb_context=integral_context, &
4921pabc=pabc_block, &
4922force_a=force_a(ikind)%forces(:, atom_a), &
4923
4924force_c=force_c(kkind)%forces(:, atom_c), &
4925 do_symmetric=do_symmetric, &
4926 on_diagonal=iatom == jatom, &
4927hdabc=hdabc, &
4928
4929habdc=habdc, &
4930 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4931 END IF
4932 IF (PRESENT(force_a) .AND. &
4933 .NOT.PRESENT(force_b) .AND. &
4934 PRESENT(force_c) .AND. &
4935 PRESENT(pabc) .AND. &
4936 PRESENT(mat_dabc) .AND. &
4937 PRESENT(mat_adbc) .AND. &
4938 .NOT.PRESENT(mat_abdc)) THEN
4939 CALL integrate_set_3c( &
4940 param%par, potential_parameter, &
4941 la_min(iset), la_max(iset), &
4942 lb_min(jset), lb_max(jset), &
4943 lc_min(kset), lc_max(kset), &
4944 npgfa(iset), npgfb(jset), npgfc(kset), &
4945 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4946 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4947 ra, rb, rc, &
4948 habc, &
4949 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4950 offset_a_start, offset_b_start, offset_c_start, &
4951 0, 0, first_set - 1, &
4952 sphi_a, sphi_b, sphi_c, &
4953 sgfa, sgfb, sgfc, &
4954 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4955 my_eri_method, &
4956 coulomb_context=integral_context, &
4957pabc=pabc_block, &
4958force_a=force_a(ikind)%forces(:, atom_a), &
4959
4960force_c=force_c(kkind)%forces(:, atom_c), &
4961 do_symmetric=do_symmetric, &
4962 on_diagonal=iatom == jatom, &
4963hdabc=hdabc, &
4964hadbc=hadbc, &
4965
4966 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
4967 END IF
4968 IF (PRESENT(force_a) .AND. &
4969 .NOT.PRESENT(force_b) .AND. &
4970 PRESENT(force_c) .AND. &
4971 PRESENT(pabc) .AND. &
4972 PRESENT(mat_dabc) .AND. &
4973 PRESENT(mat_adbc) .AND. &
4974 PRESENT(mat_abdc)) THEN
4975 CALL integrate_set_3c( &
4976 param%par, potential_parameter, &
4977 la_min(iset), la_max(iset), &
4978 lb_min(jset), lb_max(jset), &
4979 lc_min(kset), lc_max(kset), &
4980 npgfa(iset), npgfb(jset), npgfc(kset), &
4981 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
4982 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
4983 ra, rb, rc, &
4984 habc, &
4985 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
4986 offset_a_start, offset_b_start, offset_c_start, &
4987 0, 0, first_set - 1, &
4988 sphi_a, sphi_b, sphi_c, &
4989 sgfa, sgfb, sgfc, &
4990 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
4991 my_eri_method, &
4992 coulomb_context=integral_context, &
4993pabc=pabc_block, &
4994force_a=force_a(ikind)%forces(:, atom_a), &
4995
4996force_c=force_c(kkind)%forces(:, atom_c), &
4997 do_symmetric=do_symmetric, &
4998 on_diagonal=iatom == jatom, &
4999hdabc=hdabc, &
5000hadbc=hadbc, &
5001habdc=habdc, &
5002 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5003 END IF
5004 IF (PRESENT(force_a) .AND. &
5005 PRESENT(force_b) .AND. &
5006 .NOT.PRESENT(force_c) .AND. &
5007 PRESENT(pabc) .AND. &
5008 .NOT.PRESENT(mat_dabc) .AND. &
5009 .NOT.PRESENT(mat_adbc) .AND. &
5010 .NOT.PRESENT(mat_abdc)) THEN
5011 CALL integrate_set_3c( &
5012 param%par, potential_parameter, &
5013 la_min(iset), la_max(iset), &
5014 lb_min(jset), lb_max(jset), &
5015 lc_min(kset), lc_max(kset), &
5016 npgfa(iset), npgfb(jset), npgfc(kset), &
5017 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5018 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5019 ra, rb, rc, &
5020 habc, &
5021 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5022 offset_a_start, offset_b_start, offset_c_start, &
5023 0, 0, first_set - 1, &
5024 sphi_a, sphi_b, sphi_c, &
5025 sgfa, sgfb, sgfc, &
5026 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5027 my_eri_method, &
5028 coulomb_context=integral_context, &
5029pabc=pabc_block, &
5030force_a=force_a(ikind)%forces(:, atom_a), &
5031force_b=force_b(jkind)%forces(:, atom_b), &
5032
5033 do_symmetric=do_symmetric, &
5034 on_diagonal=iatom == jatom, &
5035
5036
5037
5038 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5039 END IF
5040 IF (PRESENT(force_a) .AND. &
5041 PRESENT(force_b) .AND. &
5042 .NOT.PRESENT(force_c) .AND. &
5043 PRESENT(pabc) .AND. &
5044 .NOT.PRESENT(mat_dabc) .AND. &
5045 .NOT.PRESENT(mat_adbc) .AND. &
5046 PRESENT(mat_abdc)) THEN
5047 CALL integrate_set_3c( &
5048 param%par, potential_parameter, &
5049 la_min(iset), la_max(iset), &
5050 lb_min(jset), lb_max(jset), &
5051 lc_min(kset), lc_max(kset), &
5052 npgfa(iset), npgfb(jset), npgfc(kset), &
5053 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5054 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5055 ra, rb, rc, &
5056 habc, &
5057 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5058 offset_a_start, offset_b_start, offset_c_start, &
5059 0, 0, first_set - 1, &
5060 sphi_a, sphi_b, sphi_c, &
5061 sgfa, sgfb, sgfc, &
5062 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5063 my_eri_method, &
5064 coulomb_context=integral_context, &
5065pabc=pabc_block, &
5066force_a=force_a(ikind)%forces(:, atom_a), &
5067force_b=force_b(jkind)%forces(:, atom_b), &
5068
5069 do_symmetric=do_symmetric, &
5070 on_diagonal=iatom == jatom, &
5071
5072
5073habdc=habdc, &
5074 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5075 END IF
5076 IF (PRESENT(force_a) .AND. &
5077 PRESENT(force_b) .AND. &
5078 .NOT.PRESENT(force_c) .AND. &
5079 PRESENT(pabc) .AND. &
5080 .NOT.PRESENT(mat_dabc) .AND. &
5081 PRESENT(mat_adbc) .AND. &
5082 .NOT.PRESENT(mat_abdc)) THEN
5083 CALL integrate_set_3c( &
5084 param%par, potential_parameter, &
5085 la_min(iset), la_max(iset), &
5086 lb_min(jset), lb_max(jset), &
5087 lc_min(kset), lc_max(kset), &
5088 npgfa(iset), npgfb(jset), npgfc(kset), &
5089 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5090 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5091 ra, rb, rc, &
5092 habc, &
5093 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5094 offset_a_start, offset_b_start, offset_c_start, &
5095 0, 0, first_set - 1, &
5096 sphi_a, sphi_b, sphi_c, &
5097 sgfa, sgfb, sgfc, &
5098 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5099 my_eri_method, &
5100 coulomb_context=integral_context, &
5101pabc=pabc_block, &
5102force_a=force_a(ikind)%forces(:, atom_a), &
5103force_b=force_b(jkind)%forces(:, atom_b), &
5104
5105 do_symmetric=do_symmetric, &
5106 on_diagonal=iatom == jatom, &
5107
5108hadbc=hadbc, &
5109
5110 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5111 END IF
5112 IF (PRESENT(force_a) .AND. &
5113 PRESENT(force_b) .AND. &
5114 .NOT.PRESENT(force_c) .AND. &
5115 PRESENT(pabc) .AND. &
5116 .NOT.PRESENT(mat_dabc) .AND. &
5117 PRESENT(mat_adbc) .AND. &
5118 PRESENT(mat_abdc)) THEN
5119 CALL integrate_set_3c( &
5120 param%par, potential_parameter, &
5121 la_min(iset), la_max(iset), &
5122 lb_min(jset), lb_max(jset), &
5123 lc_min(kset), lc_max(kset), &
5124 npgfa(iset), npgfb(jset), npgfc(kset), &
5125 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5126 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5127 ra, rb, rc, &
5128 habc, &
5129 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5130 offset_a_start, offset_b_start, offset_c_start, &
5131 0, 0, first_set - 1, &
5132 sphi_a, sphi_b, sphi_c, &
5133 sgfa, sgfb, sgfc, &
5134 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5135 my_eri_method, &
5136 coulomb_context=integral_context, &
5137pabc=pabc_block, &
5138force_a=force_a(ikind)%forces(:, atom_a), &
5139force_b=force_b(jkind)%forces(:, atom_b), &
5140
5141 do_symmetric=do_symmetric, &
5142 on_diagonal=iatom == jatom, &
5143
5144hadbc=hadbc, &
5145habdc=habdc, &
5146 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5147 END IF
5148 IF (PRESENT(force_a) .AND. &
5149 PRESENT(force_b) .AND. &
5150 .NOT.PRESENT(force_c) .AND. &
5151 PRESENT(pabc) .AND. &
5152 PRESENT(mat_dabc) .AND. &
5153 .NOT.PRESENT(mat_adbc) .AND. &
5154 .NOT.PRESENT(mat_abdc)) THEN
5155 CALL integrate_set_3c( &
5156 param%par, potential_parameter, &
5157 la_min(iset), la_max(iset), &
5158 lb_min(jset), lb_max(jset), &
5159 lc_min(kset), lc_max(kset), &
5160 npgfa(iset), npgfb(jset), npgfc(kset), &
5161 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5162 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5163 ra, rb, rc, &
5164 habc, &
5165 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5166 offset_a_start, offset_b_start, offset_c_start, &
5167 0, 0, first_set - 1, &
5168 sphi_a, sphi_b, sphi_c, &
5169 sgfa, sgfb, sgfc, &
5170 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5171 my_eri_method, &
5172 coulomb_context=integral_context, &
5173pabc=pabc_block, &
5174force_a=force_a(ikind)%forces(:, atom_a), &
5175force_b=force_b(jkind)%forces(:, atom_b), &
5176
5177 do_symmetric=do_symmetric, &
5178 on_diagonal=iatom == jatom, &
5179hdabc=hdabc, &
5180
5181
5182 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5183 END IF
5184 IF (PRESENT(force_a) .AND. &
5185 PRESENT(force_b) .AND. &
5186 .NOT.PRESENT(force_c) .AND. &
5187 PRESENT(pabc) .AND. &
5188 PRESENT(mat_dabc) .AND. &
5189 .NOT.PRESENT(mat_adbc) .AND. &
5190 PRESENT(mat_abdc)) THEN
5191 CALL integrate_set_3c( &
5192 param%par, potential_parameter, &
5193 la_min(iset), la_max(iset), &
5194 lb_min(jset), lb_max(jset), &
5195 lc_min(kset), lc_max(kset), &
5196 npgfa(iset), npgfb(jset), npgfc(kset), &
5197 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5198 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5199 ra, rb, rc, &
5200 habc, &
5201 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5202 offset_a_start, offset_b_start, offset_c_start, &
5203 0, 0, first_set - 1, &
5204 sphi_a, sphi_b, sphi_c, &
5205 sgfa, sgfb, sgfc, &
5206 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5207 my_eri_method, &
5208 coulomb_context=integral_context, &
5209pabc=pabc_block, &
5210force_a=force_a(ikind)%forces(:, atom_a), &
5211force_b=force_b(jkind)%forces(:, atom_b), &
5212
5213 do_symmetric=do_symmetric, &
5214 on_diagonal=iatom == jatom, &
5215hdabc=hdabc, &
5216
5217habdc=habdc, &
5218 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5219 END IF
5220 IF (PRESENT(force_a) .AND. &
5221 PRESENT(force_b) .AND. &
5222 .NOT.PRESENT(force_c) .AND. &
5223 PRESENT(pabc) .AND. &
5224 PRESENT(mat_dabc) .AND. &
5225 PRESENT(mat_adbc) .AND. &
5226 .NOT.PRESENT(mat_abdc)) THEN
5227 CALL integrate_set_3c( &
5228 param%par, potential_parameter, &
5229 la_min(iset), la_max(iset), &
5230 lb_min(jset), lb_max(jset), &
5231 lc_min(kset), lc_max(kset), &
5232 npgfa(iset), npgfb(jset), npgfc(kset), &
5233 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5234 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5235 ra, rb, rc, &
5236 habc, &
5237 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5238 offset_a_start, offset_b_start, offset_c_start, &
5239 0, 0, first_set - 1, &
5240 sphi_a, sphi_b, sphi_c, &
5241 sgfa, sgfb, sgfc, &
5242 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5243 my_eri_method, &
5244 coulomb_context=integral_context, &
5245pabc=pabc_block, &
5246force_a=force_a(ikind)%forces(:, atom_a), &
5247force_b=force_b(jkind)%forces(:, atom_b), &
5248
5249 do_symmetric=do_symmetric, &
5250 on_diagonal=iatom == jatom, &
5251hdabc=hdabc, &
5252hadbc=hadbc, &
5253
5254 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5255 END IF
5256 IF (PRESENT(force_a) .AND. &
5257 PRESENT(force_b) .AND. &
5258 .NOT.PRESENT(force_c) .AND. &
5259 PRESENT(pabc) .AND. &
5260 PRESENT(mat_dabc) .AND. &
5261 PRESENT(mat_adbc) .AND. &
5262 PRESENT(mat_abdc)) THEN
5263 CALL integrate_set_3c( &
5264 param%par, potential_parameter, &
5265 la_min(iset), la_max(iset), &
5266 lb_min(jset), lb_max(jset), &
5267 lc_min(kset), lc_max(kset), &
5268 npgfa(iset), npgfb(jset), npgfc(kset), &
5269 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5270 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5271 ra, rb, rc, &
5272 habc, &
5273 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5274 offset_a_start, offset_b_start, offset_c_start, &
5275 0, 0, first_set - 1, &
5276 sphi_a, sphi_b, sphi_c, &
5277 sgfa, sgfb, sgfc, &
5278 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5279 my_eri_method, &
5280 coulomb_context=integral_context, &
5281pabc=pabc_block, &
5282force_a=force_a(ikind)%forces(:, atom_a), &
5283force_b=force_b(jkind)%forces(:, atom_b), &
5284
5285 do_symmetric=do_symmetric, &
5286 on_diagonal=iatom == jatom, &
5287hdabc=hdabc, &
5288hadbc=hadbc, &
5289habdc=habdc, &
5290 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5291 END IF
5292 IF (PRESENT(force_a) .AND. &
5293 PRESENT(force_b) .AND. &
5294 PRESENT(force_c) .AND. &
5295 PRESENT(pabc) .AND. &
5296 .NOT.PRESENT(mat_dabc) .AND. &
5297 .NOT.PRESENT(mat_adbc) .AND. &
5298 .NOT.PRESENT(mat_abdc)) THEN
5299 CALL integrate_set_3c( &
5300 param%par, potential_parameter, &
5301 la_min(iset), la_max(iset), &
5302 lb_min(jset), lb_max(jset), &
5303 lc_min(kset), lc_max(kset), &
5304 npgfa(iset), npgfb(jset), npgfc(kset), &
5305 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5306 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5307 ra, rb, rc, &
5308 habc, &
5309 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5310 offset_a_start, offset_b_start, offset_c_start, &
5311 0, 0, first_set - 1, &
5312 sphi_a, sphi_b, sphi_c, &
5313 sgfa, sgfb, sgfc, &
5314 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5315 my_eri_method, &
5316 coulomb_context=integral_context, &
5317pabc=pabc_block, &
5318force_a=force_a(ikind)%forces(:, atom_a), &
5319force_b=force_b(jkind)%forces(:, atom_b), &
5320force_c=force_c(kkind)%forces(:, atom_c), &
5321 do_symmetric=do_symmetric, &
5322 on_diagonal=iatom == jatom, &
5323
5324
5325
5326 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5327 END IF
5328 IF (PRESENT(force_a) .AND. &
5329 PRESENT(force_b) .AND. &
5330 PRESENT(force_c) .AND. &
5331 PRESENT(pabc) .AND. &
5332 .NOT.PRESENT(mat_dabc) .AND. &
5333 .NOT.PRESENT(mat_adbc) .AND. &
5334 PRESENT(mat_abdc)) THEN
5335 CALL integrate_set_3c( &
5336 param%par, potential_parameter, &
5337 la_min(iset), la_max(iset), &
5338 lb_min(jset), lb_max(jset), &
5339 lc_min(kset), lc_max(kset), &
5340 npgfa(iset), npgfb(jset), npgfc(kset), &
5341 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5342 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5343 ra, rb, rc, &
5344 habc, &
5345 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5346 offset_a_start, offset_b_start, offset_c_start, &
5347 0, 0, first_set - 1, &
5348 sphi_a, sphi_b, sphi_c, &
5349 sgfa, sgfb, sgfc, &
5350 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5351 my_eri_method, &
5352 coulomb_context=integral_context, &
5353pabc=pabc_block, &
5354force_a=force_a(ikind)%forces(:, atom_a), &
5355force_b=force_b(jkind)%forces(:, atom_b), &
5356force_c=force_c(kkind)%forces(:, atom_c), &
5357 do_symmetric=do_symmetric, &
5358 on_diagonal=iatom == jatom, &
5359
5360
5361habdc=habdc, &
5362 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5363 END IF
5364 IF (PRESENT(force_a) .AND. &
5365 PRESENT(force_b) .AND. &
5366 PRESENT(force_c) .AND. &
5367 PRESENT(pabc) .AND. &
5368 .NOT.PRESENT(mat_dabc) .AND. &
5369 PRESENT(mat_adbc) .AND. &
5370 .NOT.PRESENT(mat_abdc)) THEN
5371 CALL integrate_set_3c( &
5372 param%par, potential_parameter, &
5373 la_min(iset), la_max(iset), &
5374 lb_min(jset), lb_max(jset), &
5375 lc_min(kset), lc_max(kset), &
5376 npgfa(iset), npgfb(jset), npgfc(kset), &
5377 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5378 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5379 ra, rb, rc, &
5380 habc, &
5381 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5382 offset_a_start, offset_b_start, offset_c_start, &
5383 0, 0, first_set - 1, &
5384 sphi_a, sphi_b, sphi_c, &
5385 sgfa, sgfb, sgfc, &
5386 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5387 my_eri_method, &
5388 coulomb_context=integral_context, &
5389pabc=pabc_block, &
5390force_a=force_a(ikind)%forces(:, atom_a), &
5391force_b=force_b(jkind)%forces(:, atom_b), &
5392force_c=force_c(kkind)%forces(:, atom_c), &
5393 do_symmetric=do_symmetric, &
5394 on_diagonal=iatom == jatom, &
5395
5396hadbc=hadbc, &
5397
5398 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5399 END IF
5400 IF (PRESENT(force_a) .AND. &
5401 PRESENT(force_b) .AND. &
5402 PRESENT(force_c) .AND. &
5403 PRESENT(pabc) .AND. &
5404 .NOT.PRESENT(mat_dabc) .AND. &
5405 PRESENT(mat_adbc) .AND. &
5406 PRESENT(mat_abdc)) THEN
5407 CALL integrate_set_3c( &
5408 param%par, potential_parameter, &
5409 la_min(iset), la_max(iset), &
5410 lb_min(jset), lb_max(jset), &
5411 lc_min(kset), lc_max(kset), &
5412 npgfa(iset), npgfb(jset), npgfc(kset), &
5413 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5414 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5415 ra, rb, rc, &
5416 habc, &
5417 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5418 offset_a_start, offset_b_start, offset_c_start, &
5419 0, 0, first_set - 1, &
5420 sphi_a, sphi_b, sphi_c, &
5421 sgfa, sgfb, sgfc, &
5422 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5423 my_eri_method, &
5424 coulomb_context=integral_context, &
5425pabc=pabc_block, &
5426force_a=force_a(ikind)%forces(:, atom_a), &
5427force_b=force_b(jkind)%forces(:, atom_b), &
5428force_c=force_c(kkind)%forces(:, atom_c), &
5429 do_symmetric=do_symmetric, &
5430 on_diagonal=iatom == jatom, &
5431
5432hadbc=hadbc, &
5433habdc=habdc, &
5434 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5435 END IF
5436 IF (PRESENT(force_a) .AND. &
5437 PRESENT(force_b) .AND. &
5438 PRESENT(force_c) .AND. &
5439 PRESENT(pabc) .AND. &
5440 PRESENT(mat_dabc) .AND. &
5441 .NOT.PRESENT(mat_adbc) .AND. &
5442 .NOT.PRESENT(mat_abdc)) THEN
5443 CALL integrate_set_3c( &
5444 param%par, potential_parameter, &
5445 la_min(iset), la_max(iset), &
5446 lb_min(jset), lb_max(jset), &
5447 lc_min(kset), lc_max(kset), &
5448 npgfa(iset), npgfb(jset), npgfc(kset), &
5449 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5450 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5451 ra, rb, rc, &
5452 habc, &
5453 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5454 offset_a_start, offset_b_start, offset_c_start, &
5455 0, 0, first_set - 1, &
5456 sphi_a, sphi_b, sphi_c, &
5457 sgfa, sgfb, sgfc, &
5458 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5459 my_eri_method, &
5460 coulomb_context=integral_context, &
5461pabc=pabc_block, &
5462force_a=force_a(ikind)%forces(:, atom_a), &
5463force_b=force_b(jkind)%forces(:, atom_b), &
5464force_c=force_c(kkind)%forces(:, atom_c), &
5465 do_symmetric=do_symmetric, &
5466 on_diagonal=iatom == jatom, &
5467hdabc=hdabc, &
5468
5469
5470 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5471 END IF
5472 IF (PRESENT(force_a) .AND. &
5473 PRESENT(force_b) .AND. &
5474 PRESENT(force_c) .AND. &
5475 PRESENT(pabc) .AND. &
5476 PRESENT(mat_dabc) .AND. &
5477 .NOT.PRESENT(mat_adbc) .AND. &
5478 PRESENT(mat_abdc)) THEN
5479 CALL integrate_set_3c( &
5480 param%par, potential_parameter, &
5481 la_min(iset), la_max(iset), &
5482 lb_min(jset), lb_max(jset), &
5483 lc_min(kset), lc_max(kset), &
5484 npgfa(iset), npgfb(jset), npgfc(kset), &
5485 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5486 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5487 ra, rb, rc, &
5488 habc, &
5489 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5490 offset_a_start, offset_b_start, offset_c_start, &
5491 0, 0, first_set - 1, &
5492 sphi_a, sphi_b, sphi_c, &
5493 sgfa, sgfb, sgfc, &
5494 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5495 my_eri_method, &
5496 coulomb_context=integral_context, &
5497pabc=pabc_block, &
5498force_a=force_a(ikind)%forces(:, atom_a), &
5499force_b=force_b(jkind)%forces(:, atom_b), &
5500force_c=force_c(kkind)%forces(:, atom_c), &
5501 do_symmetric=do_symmetric, &
5502 on_diagonal=iatom == jatom, &
5503hdabc=hdabc, &
5504
5505habdc=habdc, &
5506 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5507 END IF
5508 IF (PRESENT(force_a) .AND. &
5509 PRESENT(force_b) .AND. &
5510 PRESENT(force_c) .AND. &
5511 PRESENT(pabc) .AND. &
5512 PRESENT(mat_dabc) .AND. &
5513 PRESENT(mat_adbc) .AND. &
5514 .NOT.PRESENT(mat_abdc)) THEN
5515 CALL integrate_set_3c( &
5516 param%par, potential_parameter, &
5517 la_min(iset), la_max(iset), &
5518 lb_min(jset), lb_max(jset), &
5519 lc_min(kset), lc_max(kset), &
5520 npgfa(iset), npgfb(jset), npgfc(kset), &
5521 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5522 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5523 ra, rb, rc, &
5524 habc, &
5525 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5526 offset_a_start, offset_b_start, offset_c_start, &
5527 0, 0, first_set - 1, &
5528 sphi_a, sphi_b, sphi_c, &
5529 sgfa, sgfb, sgfc, &
5530 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5531 my_eri_method, &
5532 coulomb_context=integral_context, &
5533pabc=pabc_block, &
5534force_a=force_a(ikind)%forces(:, atom_a), &
5535force_b=force_b(jkind)%forces(:, atom_b), &
5536force_c=force_c(kkind)%forces(:, atom_c), &
5537 do_symmetric=do_symmetric, &
5538 on_diagonal=iatom == jatom, &
5539hdabc=hdabc, &
5540hadbc=hadbc, &
5541
5542 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5543 END IF
5544 IF (PRESENT(force_a) .AND. &
5545 PRESENT(force_b) .AND. &
5546 PRESENT(force_c) .AND. &
5547 PRESENT(pabc) .AND. &
5548 PRESENT(mat_dabc) .AND. &
5549 PRESENT(mat_adbc) .AND. &
5550 PRESENT(mat_abdc)) THEN
5551 CALL integrate_set_3c( &
5552 param%par, potential_parameter, &
5553 la_min(iset), la_max(iset), &
5554 lb_min(jset), lb_max(jset), &
5555 lc_min(kset), lc_max(kset), &
5556 npgfa(iset), npgfb(jset), npgfc(kset), &
5557 zeta(:, iset), zetb(:, jset), zetc(:, kset), &
5558 rpgfa(:, iset), rpgfb(:, jset), rpgfc(:, kset), &
5559 ra, rb, rc, &
5560 habc, &
5561 nsgfa(iset), nsgfb(jset), last_set - first_set + 1, &
5562 offset_a_start, offset_b_start, offset_c_start, &
5563 0, 0, first_set - 1, &
5564 sphi_a, sphi_b, sphi_c, &
5565 sgfa, sgfb, sgfc, &
5566 nsgfa(iset), nsgfb(jset), nsgfc(kset), &
5567 my_eri_method, &
5568 coulomb_context=integral_context, &
5569pabc=pabc_block, &
5570force_a=force_a(ikind)%forces(:, atom_a), &
5571force_b=force_b(jkind)%forces(:, atom_b), &
5572force_c=force_c(kkind)%forces(:, atom_c), &
5573 do_symmetric=do_symmetric, &
5574 on_diagonal=iatom == jatom, &
5575hdabc=hdabc, &
5576hadbc=hadbc, &
5577habdc=habdc, &
5578 gg_count=gg_count, gr_count=gr_count, rr_count=rr_count)
5579 END IF
5580 END DO
5581 END DO
5582 END DO
5583 END DO
5584
5585 IF (calculate_forces .AND. PRESENT(pabc)) DEALLOCATE (pabc_block)
5586 DO ic = 1, nc
5587 NULLIFY (munu_block)
5588 CALL dbcsr_get_block_p(matrix=mat_ab(ic)%matrix, &
5589 row=irow, col=icol, block=munu_block, found=found)
5590 cpassert(found)
5591 munu_block(:, :) = 0.0_dp
5592 IF (irow == iatom) THEN
5593 to_be_asserted = SIZE(munu_block, 1) == SIZE(habc, 1) .AND. SIZE(munu_block, 2) == SIZE(habc, 2)
5594 cpassert(to_be_asserted)
5595 munu_block(:, :) = habc(:, :, ic)
5596 ELSE
5597 to_be_asserted = SIZE(munu_block, 2) == SIZE(habc, 1) .AND. SIZE(munu_block, 1) == SIZE(habc, 2)
5598 cpassert(to_be_asserted)
5599 munu_block(:, :) = transpose(habc(:, :, ic))
5600 END IF
5601 END DO
5602 DEALLOCATE (habc)
5603 IF (calculate_forces) THEN
5604 DO ic = 1, nc
5605 DO i_xyz = 1, 3
5606 IF (PRESENT(mat_dabc)) THEN
5607 NULLIFY (munu_block)
5608 CALL dbcsr_get_block_p(matrix=mat_dabc(i_xyz, ic)%matrix, &
5609 row=irow, col=icol, block=munu_block, found=found)
5610 cpassert(found)
5611 munu_block(:, :) = 0.0_dp
5612 IF (irow == iatom) THEN
5613 munu_block(:, :) = hdabc(i_xyz, :, :, ic)
5614 ELSE
5615 munu_block(:, :) = transpose(hdabc(i_xyz, :, :, ic))
5616 END IF
5617 END IF
5618 IF (PRESENT(mat_adbc)) THEN
5619 NULLIFY (munu_block)
5620 CALL dbcsr_get_block_p(matrix=mat_adbc(i_xyz, ic)%matrix, &
5621 row=irow, col=icol, block=munu_block, found=found)
5622 cpassert(found)
5623 munu_block(:, :) = 0.0_dp
5624 IF (irow == iatom) THEN
5625 munu_block(:, :) = hadbc(i_xyz, :, :, ic)
5626 ELSE
5627 munu_block(:, :) = transpose(hadbc(i_xyz, :, :, ic))
5628 END IF
5629 END IF
5630 IF (PRESENT(mat_abdc)) THEN
5631 NULLIFY (munu_block)
5632 CALL dbcsr_get_block_p(matrix=mat_abdc(i_xyz, ic)%matrix, &
5633 row=irow, col=icol, block=munu_block, found=found)
5634 cpassert(found)
5635 munu_block(:, :) = 0.0_dp
5636 IF (irow == iatom) THEN
5637 munu_block(:, :) = habdc(i_xyz, :, :, ic)
5638 ELSE
5639 munu_block(:, :) = transpose(habdc(i_xyz, :, :, ic))
5640 END IF
5641 END IF
5642 END DO
5643 END DO
5644 IF (PRESENT(mat_dabc)) DEALLOCATE (hdabc)
5645 IF (PRESENT(mat_adbc)) DEALLOCATE (hadbc)
5646 IF (PRESENT(mat_abdc)) DEALLOCATE (habdc)
5647 END IF
5648 END DO
5649
5650 DEALLOCATE (basis_set_list_a, basis_set_list_b)
5651 CALL neighbor_list_iterator_release(nl_iterator)
5652
5653 IF (my_eri_method == do_eri_os) CALL coulomb_integral_cleanup(integral_context)
5654
5655 CALL cp_eri_mme_update_local_counts(param, para_env, gg_count_3c=gg_count, gr_count_3c=gr_count, rr_count_3c=rr_count)
5656
5657 CALL timestop(handle)
5658 END SUBROUTINE mp2_eri_3c_integrate
5659
5660! **************************************************************************************************
5661!> \brief Integrate set triple and contract with sphi matrix
5662!> \param param ...
5663!> \param potential_parameter ...
5664!> \param la_min ...
5665!> \param la_max ...
5666!> \param lb_min ...
5667!> \param lb_max ...
5668!> \param lc_min ...
5669!> \param lc_max ...
5670!> \param npgfa ...
5671!> \param npgfb ...
5672!> \param npgfc ...
5673!> \param zeta ...
5674!> \param zetb ...
5675!> \param zetc ...
5676!> \param ra ...
5677!> \param rb ...
5678!> \param rc ...
5679!> \param habc ...
5680!> \param n_habc_a ...
5681!> \param n_habc_b ...
5682!> \param n_habc_c ...
5683!> \param offset_habc_a ...
5684!> \param offset_habc_b ...
5685!> \param offset_habc_c ...
5686!> \param offset_set_a ...
5687!> \param offset_set_b ...
5688!> \param offset_set_c ...
5689!> \param sphi_a ...
5690!> \param sphi_b ...
5691!> \param sphi_c ...
5692!> \param sgfa ...
5693!> \param sgfb ...
5694!> \param sgfc ...
5695!> \param nsgfa ...
5696!> \param nsgfb ...
5697!> \param nsgfc ...
5698!> \param eri_method ...
5699!> \param pabc ...
5700!> \param force_a ...
5701!> \param force_b ...
5702!> \param force_c ...
5703!> \param do_symmetric ...
5704!> \param on_diagonal ...
5705!> \param hdabc ...
5706!> \param hadbc ...
5707!> \param habdc ...
5708!> \param GG_count ...
5709!> \param GR_count ...
5710!> \param RR_count ...
5711!> \param coulomb_context context for the selected Coulomb integral library
5712!> \note
5713! **************************************************************************************************
5714 SUBROUTINE integrate_set_3c(param, potential_parameter, &
5715 la_min, la_max, lb_min, lb_max, lc_min, lc_max, &
5716 npgfa, npgfb, npgfc, &
5717 zeta, zetb, zetc, &
5718 rpgfa, rpgfb, rpgfc, &
5719 ra, rb, rc, &
5720 habc, &
5721 n_habc_a, n_habc_b, n_habc_c, &
5722 offset_habc_a, offset_habc_b, offset_habc_c, &
5723 offset_set_a, offset_set_b, offset_set_c, &
5724 sphi_a, sphi_b, sphi_c, &
5725 sgfa, sgfb, sgfc, &
5726 nsgfa, nsgfb, nsgfc, &
5727 eri_method, coulomb_context, &
5728 pabc, &
5729 force_a, force_b, force_c, &
5730 do_symmetric, on_diagonal, &
5731 hdabc, hadbc, habdc, &
5732 GG_count, GR_count, RR_count)
5733
5734 TYPE(eri_mme_param), INTENT(INOUT) :: param
5735 TYPE(libint_potential_type), INTENT(IN) :: potential_parameter
5736 INTEGER, INTENT(IN) :: la_min, la_max, lb_min, lb_max, lc_min, &
5737 lc_max, npgfa, npgfb, npgfc
5738 REAL(kind=dp), DIMENSION(npgfa), INTENT(IN) :: zeta
5739 REAL(kind=dp), DIMENSION(npgfb), INTENT(IN) :: zetb
5740 REAL(kind=dp), DIMENSION(npgfc), INTENT(IN) :: zetc
5741 REAL(kind=dp), DIMENSION(npgfa), INTENT(IN) :: rpgfa
5742 REAL(kind=dp), DIMENSION(npgfb), INTENT(IN) :: rpgfb
5743 REAL(kind=dp), DIMENSION(npgfc), INTENT(IN) :: rpgfc
5744 REAL(kind=dp), DIMENSION(3), INTENT(IN) :: ra, rb, rc
5745 REAL(kind=dp), DIMENSION(:, :, :), INTENT(INOUT) :: habc
5746 INTEGER, INTENT(IN) :: n_habc_a, n_habc_b, n_habc_c, offset_habc_a, offset_habc_b, &
5747 offset_habc_c, offset_set_a, offset_set_b, offset_set_c
5748 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: sphi_a, sphi_b, sphi_c
5749 INTEGER, INTENT(IN) :: sgfa, sgfb, sgfc, nsgfa, nsgfb, nsgfc, &
5750 eri_method
5751 TYPE(coulomb_integral_context_type), INTENT(INOUT), OPTIONAL :: coulomb_context
5752 REAL(kind=dp), DIMENSION(:, :, :), INTENT(IN), &
5753 OPTIONAL :: pabc
5754 REAL(kind=dp), DIMENSION(3), INTENT(INOUT), &
5755 OPTIONAL :: force_a, force_b, force_c
5756 LOGICAL, INTENT(IN) :: do_symmetric
5757 LOGICAL, INTENT(IN), OPTIONAL :: on_diagonal
5758 REAL(kind=dp), DIMENSION(:, :, :, :), &
5759 INTENT(OUT), OPTIONAL :: hdabc, hadbc, habdc
5760 INTEGER, INTENT(INOUT), OPTIONAL :: gg_count, gr_count, rr_count
5761
5762 CHARACTER(len=*), PARAMETER :: routinen = 'integrate_set_3c'
5763
5764 INTEGER :: ax, ay, az, bx, by, bz, cx, cy, cz, habc_a_end, habc_a_start, habc_b_end, &
5765 habc_b_start, habc_c_end, habc_c_start, handle, i_xyz, ico, icoc, icox, icoy, icoz, ipgf, &
5766 jco, jcox, jcoy, jcoz, jpgf, kco, kcox, kcoy, kcoz, kpgf, la, la_max_d, lb, &
5767 lb_max_d, lc, lc_max_d, na, nb, nc, ncoa, ncoa_d, ncob, ncob_d, ncoc, ncoc_d, &
5768 set_a_end, set_a_start, set_b_end, set_b_start, &
5769 set_c_end, set_c_start, sphi_a_start, sphi_b_start, sphi_c_start
5770 INTEGER, DIMENSION(3) :: la_xyz, lb_xyz
5771 LOGICAL :: calculate_forces, do_force_a, do_force_b, &
5772 do_force_c
5773 REAL(kind=dp) :: w
5774 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: pab_hh, pab_hs
5775 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: habc_contr, habc_uncontr, &
5776 habc_uncontr_d, pabc_hhh, &
5777 pabc_hsh, pabc_hss, pabc_sss
5778 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :, :) :: habdc_contr, habdc_uncontr, hadbc_contr, &
5779 hadbc_uncontr, hdabc_contr, hdabc_uncontr
5780
5781 CALL timeset(routinen, handle)
5782
5783 do_force_a = PRESENT(force_a) .OR. PRESENT(hdabc)
5784 do_force_b = PRESENT(force_b) .OR. PRESENT(hadbc)
5785 do_force_c = PRESENT(force_c) .OR. PRESENT(habdc)
5786 calculate_forces = do_force_a .OR. do_force_b .OR. do_force_c
5787
5788 IF (do_symmetric) THEN
5789 cpassert(PRESENT(on_diagonal))
5790 END IF
5791
5792 la_max_d = la_max
5793 lb_max_d = lb_max
5794 lc_max_d = lc_max
5795
5796 IF (calculate_forces) THEN
5797 IF (do_force_a) la_max_d = la_max + 1
5798 IF (do_force_b) lb_max_d = lb_max + 1
5799 IF (do_force_c) lc_max_d = lc_max + 1
5800 END IF
5801
5802 ncoa = npgfa*ncoset(la_max)
5803 ncob = npgfb*ncoset(lb_max)
5804 ncoc = npgfc*ncoset(lc_max)
5805
5806 ncoa_d = npgfa*ncoset(la_max_d)
5807 ncob_d = npgfb*ncoset(lb_max_d)
5808 ncoc_d = npgfc*ncoset(lc_max_d)
5809
5810 ALLOCATE (habc_uncontr_d(ncoset(la_max_d), ncoset(lb_max_d), ncoset(lc_max_d)))
5811 habc_uncontr_d(:, :, :) = 0.0_dp
5812 ALLOCATE (habc_uncontr(ncoa, ncob, ncoc)); habc_uncontr(:, :, :) = 0.0_dp
5813 IF (PRESENT(hdabc)) THEN
5814 ALLOCATE (hdabc_uncontr(3, ncoa, ncob, ncoc)); hdabc_uncontr(:, :, :, :) = 0.0_dp
5815 END IF
5816 IF (PRESENT(hadbc)) THEN
5817 ALLOCATE (hadbc_uncontr(3, ncoa, ncob, ncoc)); hadbc_uncontr(:, :, :, :) = 0.0_dp
5818 END IF
5819 IF (PRESENT(habdc)) THEN
5820 ALLOCATE (habdc_uncontr(3, ncoa, ncob, ncoc)); habdc_uncontr(:, :, :, :) = 0.0_dp
5821 END IF
5822
5823 habc_a_start = offset_habc_a + 1; habc_a_end = offset_habc_a + n_habc_a
5824 habc_b_start = offset_habc_b + 1; habc_b_end = offset_habc_b + n_habc_b
5825 habc_c_start = offset_habc_c + 1; habc_c_end = offset_habc_c + n_habc_c
5826 set_a_start = offset_set_a + 1; set_a_end = offset_set_a + n_habc_a
5827 set_b_start = offset_set_b + 1; set_b_end = offset_set_b + n_habc_b
5828 set_c_start = offset_set_c + 1; set_c_end = offset_set_c + n_habc_c
5829
5830 IF (eri_method == do_eri_mme) THEN
5831 CALL eri_mme_set_potential(param, convert_potential_type(potential_parameter%potential_type), potential_parameter%omega)
5832
5833 IF (calculate_forces .AND. PRESENT(pabc)) THEN
5834 ! uncontracted hermite-gaussian representation of density matrix
5835 sphi_a_start = sgfa - 1 + set_a_start
5836 sphi_b_start = sgfb - 1 + set_b_start
5837 sphi_c_start = sgfc - 1 + set_c_start
5838
5839 ALLOCATE (pabc_sss(n_habc_a, n_habc_b, n_habc_c))
5840 pabc_sss(:, :, :) = pabc(habc_a_start:habc_a_end, habc_b_start:habc_b_end, habc_c_start:habc_c_end)
5841 ALLOCATE (pabc_hss(ncoa, n_habc_b, n_habc_c))
5842 ALLOCATE (pabc_hsh(ncoa, n_habc_b, ncoc))
5843 ALLOCATE (pabc_hhh(ncoa, ncob, ncoc))
5844 ALLOCATE (pab_hs(ncoa, n_habc_b))
5845 ALLOCATE (pab_hh(ncoa, ncob))
5846
5847 CALL dgemm("N", "N", ncoa, n_habc_b*n_habc_c, n_habc_a, 1.0_dp, &
5848 sphi_a(:, sphi_a_start), SIZE(sphi_a, 1), pabc_sss, n_habc_a, 0.0_dp, pabc_hss, ncoa)
5849 CALL dgemm("N", "T", ncoa*n_habc_b, ncoc, n_habc_c, 1.0_dp, &
5850 pabc_hss, ncoa*n_habc_b, sphi_c(:, sphi_c_start), SIZE(sphi_c, 1), 0.0_dp, pabc_hsh, ncoa*n_habc_b)
5851
5852 DO icoc = 1, ncoc
5853 pab_hs(:, :) = pabc_hsh(:, :, icoc)
5854 CALL dgemm("N", "T", ncoa, ncob, n_habc_b, 1.0_dp, &
5855 pab_hs, ncoa, sphi_b(:, sphi_b_start), SIZE(sphi_b, 1), 0.0_dp, pab_hh, ncoa)
5856 pabc_hhh(:, :, icoc) = pab_hh(:, :)
5857 END DO
5858 END IF
5859
5860 DO ipgf = 1, npgfa
5861 na = (ipgf - 1)*ncoset(la_max)
5862 DO jpgf = 1, npgfb
5863 nb = (jpgf - 1)*ncoset(lb_max)
5864 DO kpgf = 1, npgfc
5865 nc = (kpgf - 1)*ncoset(lc_max)
5866 habc_uncontr_d(:, :, :) = 0.0_dp
5867 CALL eri_mme_3c_integrate(param, &
5868 la_min, la_max_d, lb_min, lb_max_d, lc_min, lc_max_d, &
5869 zeta(ipgf), zetb(jpgf), zetc(kpgf), ra, rb, rc, habc_uncontr_d, 0, 0, 0, &
5870 gg_count, gr_count, rr_count)
5871
5872 habc_uncontr(na + 1:na + ncoset(la_max), nb + 1:nb + ncoset(lb_max), nc + 1:nc + ncoset(lc_max)) = &
5873 habc_uncontr_d(:ncoset(la_max), :ncoset(lb_max), :ncoset(lc_max))
5874
5875 IF (calculate_forces) THEN
5876 DO lc = lc_min, lc_max
5877 DO cx = 0, lc
5878 DO cy = 0, lc - cx
5879 cz = lc - cx - cy
5880 kco = coset(cx, cy, cz)
5881 kcox = coset(cx + 1, cy, cz)
5882 kcoy = coset(cx, cy + 1, cz)
5883 kcoz = coset(cx, cy, cz + 1)
5884 DO lb = lb_min, lb_max
5885 DO bx = 0, lb
5886 DO by = 0, lb - bx
5887 bz = lb - bx - by
5888 jco = coset(bx, by, bz)
5889 jcox = coset(bx + 1, by, bz)
5890 jcoy = coset(bx, by + 1, bz)
5891 jcoz = coset(bx, by, bz + 1)
5892 DO la = la_min, la_max
5893 DO ax = 0, la
5894 DO ay = 0, la - ax
5895 az = la - ax - ay
5896 la_xyz = [ax, ay, az]
5897 lb_xyz = [bx, by, bz]
5898 ico = coset(ax, ay, az)
5899 icox = coset(ax + 1, ay, az)
5900 icoy = coset(ax, ay + 1, az)
5901 icoz = coset(ax, ay, az + 1)
5902
5903 w = 1.0_dp
5904 IF (do_symmetric .AND. .NOT. on_diagonal) w = 2.0_dp
5905
5906 IF (PRESENT(force_a)) THEN
5907 force_a = force_a + 2.0_dp*w*zeta(ipgf)* &
5908 [pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(icox, jco, kco), &
5909 pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(icoy, jco, kco), &
5910 pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(icoz, jco, kco)]
5911
5912 END IF
5913 IF (PRESENT(force_b)) THEN
5914 force_b = force_b + 2.0_dp*w*zetb(jpgf)* &
5915 [pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(ico, jcox, kco), &
5916 pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(ico, jcoy, kco), &
5917 pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(ico, jcoz, kco)]
5918 END IF
5919 IF (PRESENT(force_c)) THEN
5920 force_c = force_c + 2.0_dp*w*zetc(kpgf)* &
5921 [pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(ico, jco, kcox), &
5922 pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(ico, jco, kcoy), &
5923 pabc_hhh(na + ico, nb + jco, nc + kco)*habc_uncontr_d(ico, jco, kcoz)]
5924 END IF
5925
5926 IF (PRESENT(hdabc)) THEN
5927 hdabc_uncontr(1:3, na + ico, nb + jco, nc + kco) = 2.0_dp*zeta(ipgf)* &
5928 [habc_uncontr_d(icox, jco, kco), &
5929 habc_uncontr_d(icoy, jco, kco), &
5930 habc_uncontr_d(icoz, jco, kco)]
5931 END IF
5932 IF (PRESENT(hadbc)) THEN
5933 hadbc_uncontr(1:3, na + ico, nb + jco, nc + kco) = 2.0_dp*zetb(jpgf)* &
5934 [habc_uncontr_d(ico, jcox, kco), &
5935 habc_uncontr_d(ico, jcoy, kco), &
5936 habc_uncontr_d(ico, jcoz, kco)]
5937 END IF
5938 IF (PRESENT(habdc)) THEN
5939 habdc_uncontr(1:3, na + ico, nb + jco, nc + kco) = 2.0_dp*zetc(kpgf)* &
5940 [habc_uncontr_d(ico, jco, kcox), &
5941 habc_uncontr_d(ico, jco, kcoy), &
5942 habc_uncontr_d(ico, jco, kcoz)]
5943 END IF
5944 END DO
5945 END DO
5946 END DO
5947 END DO
5948 END DO
5949 END DO
5950 END DO
5951 END DO
5952 END DO
5953 END IF
5954
5955 END DO
5956 END DO
5957 END DO
5958
5959 ELSE IF (eri_method == do_eri_os) THEN
5960
5961 IF (calculate_forces) cpabort("NYI")
5962
5963 cpassert(PRESENT(coulomb_context))
5964 CALL compute_coulomb_3c(coulomb_context, la_min, la_max, lb_min, lb_max, lc_min, lc_max, &
5965 npgfa, npgfb, npgfc, zeta, zetb, zetc, rpgfa, rpgfb, rpgfc, &
5966 ra, rb, rc, habc_uncontr, potential_parameter)
5967
5968 ELSE IF (eri_method == do_eri_gpw) THEN
5969
5970 cpabort("GPW not enabled in the ERI interface.")
5971
5972 END IF
5973
5974 ALLOCATE (habc_contr(nsgfa, nsgfb, nsgfc))
5975 IF (PRESENT(hdabc)) THEN
5976 ALLOCATE (hdabc_contr(3, nsgfa, nsgfb, nsgfc))
5977 END IF
5978 IF (PRESENT(hadbc)) THEN
5979 ALLOCATE (hadbc_contr(3, nsgfa, nsgfb, nsgfc))
5980 END IF
5981 IF (PRESENT(habdc)) THEN
5982 ALLOCATE (habdc_contr(3, nsgfa, nsgfb, nsgfc))
5983 END IF
5984
5985 CALL abc_contract(habc_contr, habc_uncontr, &
5986 sphi_a(:, sgfa:), sphi_b(:, sgfb:), sphi_c(:, sgfc:), &
5987 ncoa, ncob, ncoc, nsgfa, nsgfb, nsgfc)
5988
5989 IF (calculate_forces) THEN
5990 DO i_xyz = 1, 3
5991 IF (PRESENT(hdabc)) THEN
5992 CALL abc_contract(hdabc_contr(i_xyz, :, :, :), hdabc_uncontr(i_xyz, :, :, :), &
5993 sphi_a(:, sgfa:), sphi_b(:, sgfb:), sphi_c(:, sgfc:), &
5994 ncoa, ncob, ncoc, nsgfa, nsgfb, nsgfc)
5995 END IF
5996 IF (PRESENT(hadbc)) THEN
5997 CALL abc_contract(hadbc_contr(i_xyz, :, :, :), hadbc_uncontr(i_xyz, :, :, :), &
5998 sphi_a(:, sgfa:), sphi_b(:, sgfb:), sphi_c(:, sgfc:), &
5999 ncoa, ncob, ncoc, nsgfa, nsgfb, nsgfc)
6000 END IF
6001 IF (PRESENT(habdc)) THEN
6002 CALL abc_contract(habdc_contr(i_xyz, :, :, :), habdc_uncontr(i_xyz, :, :, :), &
6003 sphi_a(:, sgfa:), sphi_b(:, sgfb:), sphi_c(:, sgfc:), &
6004 ncoa, ncob, ncoc, nsgfa, nsgfb, nsgfc)
6005 END IF
6006 END DO
6007 END IF
6008
6009 habc(habc_a_start:habc_a_end, habc_b_start:habc_b_end, habc_c_start:habc_c_end) = &
6010 habc_contr(set_a_start:set_a_end, set_b_start:set_b_end, set_c_start:set_c_end)
6011
6012 IF (calculate_forces) THEN
6013 IF (PRESENT(hdabc)) hdabc(:, habc_a_start:habc_a_end, habc_b_start:habc_b_end, habc_c_start:habc_c_end) = &
6014 hdabc_contr(:, set_a_start:set_a_end, set_b_start:set_b_end, set_c_start:set_c_end)
6015 IF (PRESENT(hadbc)) hadbc(:, habc_a_start:habc_a_end, habc_b_start:habc_b_end, habc_c_start:habc_c_end) = &
6016 hadbc_contr(:, set_a_start:set_a_end, set_b_start:set_b_end, set_c_start:set_c_end)
6017 IF (PRESENT(habdc)) habdc(:, habc_a_start:habc_a_end, habc_b_start:habc_b_end, habc_c_start:habc_c_end) = &
6018 habdc_contr(:, set_a_start:set_a_end, set_b_start:set_b_end, set_c_start:set_c_end)
6019 END IF
6020
6021 CALL timestop(handle)
6022
6023 END SUBROUTINE integrate_set_3c
6024
6025! **************************************************************************************************
6026!> \brief get pointer to atom, pointer to set and offset in a set for each spherical orbital of a
6027!> basis.
6028!> \param qs_env ...
6029!> \param basis_type ...
6030!> \param eri_offsets (:,1) atom numbers
6031!> (:,2) set numbers
6032!> (:,3) set offsets
6033! **************************************************************************************************
6034 SUBROUTINE get_eri_offsets(qs_env, basis_type, eri_offsets)
6035 TYPE(qs_environment_type), INTENT(IN), POINTER :: qs_env
6036 CHARACTER(len=*), INTENT(IN), OPTIONAL :: basis_type
6037 INTEGER, ALLOCATABLE, DIMENSION(:, :), INTENT(OUT) :: eri_offsets
6038
6039 INTEGER :: dimen_basis, iatom, ikind, iset, isgf, &
6040 natom, nkind, nset, nsgf, offset, &
6041 set_offset
6042 INTEGER, ALLOCATABLE, DIMENSION(:) :: kind_of
6043 INTEGER, DIMENSION(:), POINTER :: nsgf_set
6044 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
6045 TYPE(gto_basis_set_type), POINTER :: basis_set
6046 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
6047 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
6048
6049 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set, qs_kind_set=qs_kind_set, &
6050 particle_set=particle_set, natom=natom, nkind=nkind)
6051
6052 CALL get_atomic_kind_set(atomic_kind_set, kind_of=kind_of)
6053
6054 dimen_basis = 0
6055 DO iatom = 1, natom
6056 ikind = kind_of(iatom)
6057 CALL get_qs_kind(qs_kind=qs_kind_set(ikind), nsgf=nsgf, basis_type=basis_type)
6058 dimen_basis = dimen_basis + nsgf
6059 END DO
6060
6061 ALLOCATE (eri_offsets(dimen_basis, 3))
6062
6063 offset = 0
6064 DO iatom = 1, natom
6065 ikind = kind_of(iatom)
6066 CALL get_qs_kind(qs_kind=qs_kind_set(ikind), basis_set=basis_set, basis_type=basis_type)
6067 nset = basis_set%nset
6068 nsgf_set => basis_set%nsgf_set
6069 DO iset = 1, nset
6070 set_offset = 0
6071 DO isgf = 1, nsgf_set(iset)
6072 set_offset = set_offset + 1
6073 eri_offsets(offset + set_offset, :) = [iatom, iset, set_offset]
6074 END DO
6075 offset = offset + nsgf_set(iset)
6076 END DO
6077 END DO
6078 END SUBROUTINE get_eri_offsets
6079
6080! **************************************************************************************************
6081!> \brief ...
6082!> \param force ...
6083!> \param natom_of_kind ...
6084! **************************************************************************************************
6085 PURE SUBROUTINE mp2_eri_allocate_forces(force, natom_of_kind)
6086 TYPE(mp2_eri_force), ALLOCATABLE, &
6087 DIMENSION(:), INTENT(OUT) :: force
6088 INTEGER, DIMENSION(:), INTENT(IN) :: natom_of_kind
6089
6090 INTEGER :: ikind, n, nkind
6091
6092 nkind = SIZE(natom_of_kind)
6093
6094 ALLOCATE (force(nkind))
6095
6096 DO ikind = 1, nkind
6097 n = natom_of_kind(ikind)
6098 ALLOCATE (force(ikind)%forces(3, n))
6099 force(ikind)%forces(:, :) = 0.0_dp
6100 END DO
6101 END SUBROUTINE mp2_eri_allocate_forces
6102
6103! **************************************************************************************************
6104!> \brief ...
6105!> \param force ...
6106! **************************************************************************************************
6107 PURE SUBROUTINE mp2_eri_deallocate_forces(force)
6108 TYPE(mp2_eri_force), ALLOCATABLE, &
6109 DIMENSION(:), INTENT(INOUT) :: force
6110
6111 INTEGER :: ikind, nkind
6112
6113 IF (ALLOCATED(force)) THEN
6114 nkind = SIZE(force)
6115 DO ikind = 1, nkind
6116 IF (ALLOCATED(force(ikind)%forces)) DEALLOCATE (force(ikind)%forces)
6117 END DO
6118
6119 DEALLOCATE (force)
6120 END IF
6121 END SUBROUTINE mp2_eri_deallocate_forces
6122
6123 FUNCTION convert_potential_type(potential_type) RESULT(res)
6124 INTEGER, INTENT(IN) :: potential_type
6125 INTEGER :: res
6126
6127 IF (potential_type == do_potential_coulomb) THEN
6128 res = eri_mme_coulomb
6129 ELSE IF (potential_type == do_potential_long) THEN
6130 res = eri_mme_longrange
6131 ELSE
6132 cpabort("MME potential not implemented!")
6133 END IF
6134
6135 END FUNCTION convert_potential_type
6136
6137END MODULE mp2_eri
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Contraction of integrals over primitive Cartesian Gaussians based on the contraction matrix sphi whic...
subroutine, public abc_contract(abcint, sabc, sphi_a, sphi_b, sphi_c, ncoa, ncob, ncoc, nsgfa, nsgfb, nsgfc)
contract three-center overlap integrals (a,b,c) and transfer to spherical Gaussians
subroutine, public ab_contract(abint, sab, sphi_a, sphi_b, ncoa, ncob, nsgfa, nsgfb)
contract overlap integrals (a,b) and transfer to spherical Gaussians
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
Handles all functions related to the CELL.
Definition cell_types.F:15
Common interface for two- and three-center Coulomb integrals.
subroutine, public coulomb_integral_cleanup(context)
Release the engines initialized in a Coulomb integral context.
subroutine, public compute_coulomb_3c(context, la_min, la_max, lb_min, lb_max, lc_min, lc_max, npgfa, npgfb, npgfc, zeta, zetb, zetc, rpgfa, rpgfb, rpgfc, ra, rb, rc, habc, potential_parameter)
Evaluate one uncontracted three-center Coulomb integral block.
subroutine, public coulomb_integral_init(context, max_am_2c, max_am_3c)
Initialize the engines needed by the requested Coulomb integral operations.
subroutine, public compute_coulomb_2c(context, la_min, la_max, lb_min, lb_max, npgfa, npgfb, zeta, zetb, rpgfa, rpgfb, ra, rb, hab, potential_parameter)
Evaluate one uncontracted two-center Coulomb integral block.
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
Interface to Minimax-Ewald method for periodic ERI's to be used in CP2K.
subroutine, public cp_eri_mme_init_read_input(mme_section, param)
Read input and initialize parameter type.
subroutine, public cp_eri_mme_finalize(param)
Release eri mme data. Prints some statistics on summation methods chosen.
subroutine, public cp_eri_mme_update_local_counts(param, para_env, g_count_2c, r_count_2c, gg_count_3c, gr_count_3c, rr_count_3c)
Update local counters to gather statistics on different paths taken in MME algorithm (each Ewald sum ...
Minimax-Ewald (MME) method for calculating 2-center and 3-center electron repulsion integrals (ERI) o...
subroutine, public eri_mme_3c_integrate(param, la_min, la_max, lb_min, lb_max, lc_min, lc_max, zeta, zetb, zetc, ra, rb, rc, habc, o1, o2, o3, gg_count, gr_count, rr_count)
Low-level integration routine for 3-center ERIs.
subroutine, public eri_mme_2c_integrate(param, la_min, la_max, lb_min, lb_max, zeta, zetb, rab, hab, o1, o2, g_count, r_count, normalize, potential, pot_par)
Low-level integration routine for 2-center ERIs.
Methods for testing / debugging.
subroutine, public eri_mme_3c_perf_acc_test(param, l_max, zet, rabc, nrep, nsample, para_env, iw, potential, pot_par, gg_count, gr_count, rr_count)
...
subroutine, public eri_mme_2c_perf_acc_test(param, l_max, zet, rabc, nrep, test_accuracy, para_env, iw, potential, pot_par, g_count, r_count)
Unit test for performance and accuracy.
Types and initialization / release routines for Minimax-Ewald method for electron repulsion integrals...
subroutine, public eri_mme_set_potential(param, potential, pot_par)
...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_eri_os
integer, parameter, public do_eri_mme
integer, parameter, public do_potential_coulomb
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 dp
Definition kinds.F:34
2- and 3-center electron repulsion integral routines based on libint2 Currently available operators: ...
Interface to the message passing library MPI.
Interface to direct methods for electron repulsion integrals for MP2.
Definition mp2_eri.F:12
subroutine, public mp2_eri_2c_integrate(param, potential_parameter, para_env, qs_env, basis_type_a, basis_type_b, hab, first_b, last_b, eri_method, pab, force_a, force_b, hdab, hadb, reflection_z_a, reflection_z_b, do_reflection_a, do_reflection_b)
high-level integration routine for 2c integrals over CP2K basis sets. Contiguous column-wise distribu...
Definition mp2_eri.F:119
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
integer function, public convert_potential_type(potential_type)
Definition mp2_eri.F:6124
subroutine, public integrate_set_2c(param, potential_parameter, la_min, la_max, lb_min, lb_max, npgfa, npgfb, zeta, zetb, ra, rb, hab, n_hab_a, n_hab_b, offset_hab_a, offset_hab_b, offset_set_a, offset_set_b, sphi_a, sphi_b, sgfa, sgfb, nsgfa, nsgfb, eri_method, pab, force_a, force_b, hdab, hadb, g_count, r_count, do_reflection_a, do_reflection_b, rpgfa, rpgfb, coulomb_context)
Integrate set pair and contract with sphi matrix.
Definition mp2_eri.F:453
pure subroutine, public mp2_eri_deallocate_forces(force)
...
Definition mp2_eri.F:6108
pure subroutine, public mp2_eri_allocate_forces(force, natom_of_kind)
...
Definition mp2_eri.F:6086
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :, :), allocatable, public coset
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, 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.
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.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_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, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, 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, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
Define the neighbor list data types and the corresponding functionality.
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public neighbor_list_iterator_release(iterator_set)
...
subroutine, public get_neighbor_list_set_p(neighbor_list_sets, nlist, symmetric)
Return the components of the first neighbor list set.
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
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
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.