210 n_a, n_b, n_c, n_d, &
211 ncoa, ncob, ncoc, ncod, &
212 nsgfa, nsgfb, nsgfc, nsgfd, &
213 primitives, max_contraction, tmp_max_all, &
214 eps_schwarz, neris, &
215 s_offset_a, s_offset_b, s_offset_c, s_offset_d, &
216 nl_a, nl_b, nl_c, nl_d, nsoa, nsob, nsoc, nsod, &
217 sphi_a, sphi_b, sphi_c, sphi_d, &
218 work, work2, work_forces, buffer1, buffer2, primitives_tmp, &
219 use_virial, work_virial, work2_virial, primitives_tmp_virial, &
220 primitives_virial, cell, tmp_max_all_virial)
223 INTEGER,
INTENT(IN) :: nproducts
224 TYPE(eri4_pgf_product_type),
DIMENSION(nproducts) :: pgf_product_list
225 INTEGER,
INTENT(IN) :: n_a, n_b, n_c, n_d, ncoa, ncob, ncoc, &
226 ncod, nsgfa, nsgfb, nsgfc, nsgfd
228 DIMENSION(nsgfa, nsgfb, nsgfc, nsgfd, 12) :: primitives
229 REAL(
dp) :: max_contraction, tmp_max_all, eps_schwarz
230 INTEGER(int_8) :: neris
231 INTEGER :: s_offset_a, s_offset_b, s_offset_c, &
232 s_offset_d, nl_a, nl_b, nl_c, nl_d, &
233 nsoa, nsob, nsoc, nsod
234 REAL(
dp),
DIMENSION(ncoa, nsoa*nl_a) :: sphi_a
235 REAL(
dp),
DIMENSION(ncob, nsob*nl_b) :: sphi_b
236 REAL(
dp),
DIMENSION(ncoc, nsoc*nl_c) :: sphi_c
237 REAL(
dp),
DIMENSION(ncod, nsod*nl_d) :: sphi_d
238 REAL(
dp) :: work(ncoa*ncob*ncoc*ncod, 12), work2(ncoa, ncob, ncoc, ncod, 12), &
239 work_forces(ncoa*ncob*ncoc*ncod, 12)
240 REAL(
dp),
DIMENSION(ncoa*ncob*ncoc*ncod) :: buffer1, buffer2
241 REAL(
dp),
DIMENSION(nsoa*nl_a, nsob*nl_b, nsoc*&
nl_c, nsod*nl_d) :: primitives_tmp
242 LOGICAL,
INTENT(IN) :: use_virial
243 REAL(
dp) :: work_virial(ncoa*ncob*ncoc*ncod, 12, 3), &
244 work2_virial(ncoa, ncob, ncoc, ncod, 12, 3)
245 REAL(
dp),
DIMENSION(nsoa*nl_a, nsob*nl_b, nsoc*&
nl_c, nsod*nl_d) :: primitives_tmp_virial
247 DIMENSION(nsgfa, nsgfb, nsgfc, nsgfd, 12, 3) :: primitives_virial
249 REAL(
dp) :: tmp_max_all_virial
251 INTEGER :: a_mysize(1), angular_momenta(4), i, j, &
252 k, m, m_max, mysize, n, permutation(4)
253 LOGICAL :: direct_contract
254 REAL(
dp) :: scoord(12), tmp_max, tmp_max_virial
256 m_max = n_a + n_b + n_c + n_d
258 mysize = ncoa*ncob*ncoc*ncod
267 CALL get_eri_permutation(n_a, n_b, n_c, n_d, permutation)
268 angular_momenta = [n_a, n_b, n_c, n_d]
269 angular_momenta = angular_momenta(permutation)
274 angular_momenta(1), context%deriv, work_forces, a_mysize)
277 work(j, k) = work(j, k) + work_forces(j, k)
280 neris = neris + 12*mysize
283 CALL real_to_scaled(scoord(3*j - 2:3*j), pgf_product_list(i)%centers(:, permutation(j)), cell)
288 work_virial(j, k, m) = work_virial(j, k, m) + work_forces(j, k)*scoord(int((k - 1)/3)*3 + m)
298 tmp_max = max(tmp_max, abs(work(i, n)))
300 tmp_max = tmp_max*max_contraction
301 tmp_max_all = max(tmp_max_all, tmp_max)
303 CALL reorder_eri_block(work, work2, [ncoa, ncob, ncoc, ncod], permutation, 12, 1)
306 tmp_max_virial = 0.0_dp
308 tmp_max_virial = max(tmp_max_virial, &
309 abs(work_virial(i, n, 1)), abs(work_virial(i, n, 2)), abs(work_virial(i, n, 3)))
311 tmp_max_virial = tmp_max_virial*max_contraction
312 tmp_max_all_virial = max(tmp_max_all_virial, tmp_max_virial)
314 CALL reorder_eri_block(work_virial, work2_virial, [ncoa, ncob, ncoc, ncod], permutation, 12, 3)
317 IF (.NOT. use_virial)
THEN
318 IF (tmp_max_all < eps_schwarz)
RETURN
321 direct_contract = (s_offset_a == 0 .AND. s_offset_b == 0 .AND. &
322 s_offset_c == 0 .AND. s_offset_d == 0 .AND. &
323 nsgfa == nsoa*nl_a .AND. nsgfb == nsob*nl_b .AND. &
324 nsgfc == nsoc*nl_c .AND. nsgfd == nsod*nl_d)
326 IF (tmp_max_all >= eps_schwarz)
THEN
327 IF (direct_contract)
THEN
329 CALL contract(ncoa, ncob, ncoc, ncod, nsoa, nsob, nsoc, nsod, &
330 n_a, n_b, n_c, n_d, nl_a, nl_b, nl_c, nl_d, work2(1, 1, 1, 1, i), &
335 primitives(1, 1, 1, 1, i), &
340 primitives_tmp(:, :, :, :) = 0.0_dp
341 CALL contract(ncoa, ncob, ncoc, ncod, nsoa, nsob, nsoc, nsod, &
342 n_a, n_b, n_c, n_d, nl_a, nl_b, nl_c, nl_d, work2(1, 1, 1, 1, i), &
347 primitives_tmp(1, 1, 1, 1), &
350 primitives(s_offset_a + 1:s_offset_a + nsoa*nl_a, &
351 s_offset_b + 1:s_offset_b + nsob*nl_b, &
352 s_offset_c + 1:s_offset_c + nsoc*nl_c, &
353 s_offset_d + 1:s_offset_d + nsod*nl_d, i) = &
354 primitives(s_offset_a + 1:s_offset_a + nsoa*nl_a, &
355 s_offset_b + 1:s_offset_b + nsob*nl_b, &
356 s_offset_c + 1:s_offset_c + nsoc*nl_c, &
357 s_offset_d + 1:s_offset_d + nsod*nl_d, i) + primitives_tmp(:, :, :, :)
362 IF (use_virial .AND. tmp_max_all_virial >= eps_schwarz)
THEN
363 IF (direct_contract)
THEN
366 CALL contract(ncoa, ncob, ncoc, ncod, nsoa, nsob, nsoc, nsod, &
367 n_a, n_b, n_c, n_d, nl_a, nl_b, nl_c, nl_d, work2_virial(1, 1, 1, 1, i, m), &
372 primitives_virial(1, 1, 1, 1, i, m), &
379 primitives_tmp_virial(:, :, :, :) = 0.0_dp
380 CALL contract(ncoa, ncob, ncoc, ncod, nsoa, nsob, nsoc, nsod, &
381 n_a, n_b, n_c, n_d, nl_a, nl_b, nl_c, nl_d, work2_virial(1, 1, 1, 1, i, m), &
386 primitives_tmp_virial(1, 1, 1, 1), &
389 primitives_virial(s_offset_a + 1:s_offset_a + nsoa*nl_a, &
390 s_offset_b + 1:s_offset_b + nsob*nl_b, &
391 s_offset_c + 1:s_offset_c + nsoc*nl_c, &
392 s_offset_d + 1:s_offset_d + nsod*nl_d, i, m) = &
393 primitives_virial(s_offset_a + 1:s_offset_a + nsoa*nl_a, &
394 s_offset_b + 1:s_offset_b + nsob*nl_b, &
395 s_offset_c + 1:s_offset_c + nsoc*nl_c, &
396 s_offset_d + 1:s_offset_d + nsod*nl_d, i, m) + primitives_tmp_virial(:, :, :, :)
430 max_val, potential_parameter, R1, R2)
433 REAL(
dp),
INTENT(IN) :: a(3), b(3), c(3), d(3), zeta_a, zeta_b, &
435 INTEGER,
INTENT(IN) :: n_a, n_b, n_c, n_d
436 REAL(
dp),
INTENT(INOUT) :: max_val
440 INTEGER :: a_mysize(1), angular_momenta(4), i, &
441 m_max, mysize, permutation(4)
442 REAL(
dp) :: centers(3, 4), exponents(4), pq(3), pq2, &
444 REAL(
dp),
DIMENSION(:),
POINTER :: p_work
447 TYPE(eri4_pgf_product_type) :: params, product
449 m_max = n_a + n_b + n_c + n_d
453 CALL get_eri_permutation(n_a, n_b, n_c, n_d, permutation)
454 angular_momenta = [n_a, n_b, n_c, n_d]
455 angular_momenta = angular_momenta(permutation)
460 centers = centers(:, permutation)
461 exponents = [zeta_a, zeta_b, zeta_c, zeta_d]
462 exponents = exponents(permutation)
464 pq = centers(:, 1) - centers(:, 2)
465 CALL prepare_eri4_pair(centers(:, 1), centers(:, 2), exponents(1), exponents(2), &
466 dot_product(pq, pq), pair_a, image_a)
467 pq = centers(:, 3) - centers(:, 4)
468 CALL prepare_eri4_pair(centers(:, 3), centers(:, 4), exponents(3), exponents(4), &
469 dot_product(pq, pq), pair_b, image_b)
470 pq = image_a%P - image_b%P
471 pq2 = dot_product(pq, pq)
472 SELECT CASE (potential_parameter%potential_type)
474 IF (pq2 > (r1 + r2 + potential_parameter%cutoff_radius)**2)
RETURN
478 s1234 = exp(image_a%S1234 + image_b%S1234)
483 angular_momenta(1), context%eri, p_work, a_mysize)
485 max_val = max(max_val, abs(p_work(i)))
488 max_val = abs(params%Fm(1))
543 ncoa, ncob, ncoc, ncod, &
544 nsgfa, nsgfb, nsgfc, nsgfd, &
545 primitives, max_contraction, tmp_max, &
546 eps_schwarz, neris, &
547 s_offset_a, s_offset_b, s_offset_c, s_offset_d, &
548 nl_a, nl_b, nl_c, nl_d, nsoa, nsob, nsoc, nsod, &
549 sphi_a, sphi_b, sphi_c, sphi_d, work, work2, buffer1, buffer2, &
553 INTEGER,
INTENT(IN) :: nproducts
554 TYPE(eri4_pgf_product_type),
DIMENSION(nproducts) :: pgf_product_list
555 INTEGER,
INTENT(IN) :: n_a, n_b, n_c, n_d, ncoa, ncob, ncoc, &
556 ncod, nsgfa, nsgfb, nsgfc, nsgfd
557 REAL(
dp),
DIMENSION(nsgfa, nsgfb, nsgfc, nsgfd) :: primitives
558 REAL(
dp) :: max_contraction, tmp_max, eps_schwarz
559 INTEGER(int_8) :: neris
560 INTEGER :: s_offset_a, s_offset_b, s_offset_c, &
561 s_offset_d, nl_a, nl_b, nl_c, nl_d, &
562 nsoa, nsob, nsoc, nsod
563 REAL(
dp),
DIMENSION(ncoa, nsoa*nl_a),
INTENT(IN) :: sphi_a
564 REAL(
dp),
DIMENSION(ncob, nsob*nl_b),
INTENT(IN) :: sphi_b
565 REAL(
dp),
DIMENSION(ncoc, nsoc*nl_c),
INTENT(IN) :: sphi_c
566 REAL(
dp),
DIMENSION(ncod, nsod*nl_d),
INTENT(IN) :: sphi_d
567 REAL(
dp),
TARGET :: work(ncoa*ncob*ncoc*ncod)
568 REAL(
dp) :: work2(ncoa, ncob, ncoc, ncod)
569 REAL(
dp),
DIMENSION(ncoa*ncob*ncoc*ncod) :: buffer1, buffer2
570 REAL(
dp),
DIMENSION(nsoa*nl_a, nsob*nl_b, nsoc*&
nl_c, nsod*nl_d) :: primitives_tmp
572 INTEGER :: a_mysize(1), angular_momenta(4), i, &
573 m_max, mysize, permutation(4)
574 LOGICAL :: direct_contract
575 REAL(
dp),
DIMENSION(:),
POINTER :: eri_src, p_work
577 IF (nproducts == 0)
RETURN
579 m_max = n_a + n_b + n_c + n_d
580 mysize = ncoa*ncob*ncoc*ncod
584 IF (nproducts > 1) work(1:mysize) = 0.0_dp
585 CALL get_eri_permutation(n_a, n_b, n_c, n_d, permutation)
586 angular_momenta = [n_a, n_b, n_c, n_d]
587 angular_momenta = angular_momenta(permutation)
592 angular_momenta(1), context%eri, p_work, a_mysize)
593 IF (nproducts > 1) work(1:mysize) = work(1:mysize) + p_work(1:mysize)
594 neris = neris + mysize
596 IF (nproducts == 1)
THEN
602 tmp_max = max(tmp_max, abs(eri_src(i)))
604 tmp_max = tmp_max*max_contraction
605 IF (tmp_max < eps_schwarz)
RETURN
606 CALL reorder_eri_block(eri_src, work2, [ncoa, ncob, ncoc, ncod], permutation, 1, 1)
610 work(1) = work(1) + pgf_product_list(i)%Fm(1)
611 neris = neris + mysize
613 work2(1, 1, 1, 1) = work(1)
614 tmp_max = max_contraction*abs(work(1))
615 IF (tmp_max < eps_schwarz)
RETURN
618 direct_contract = (s_offset_a == 0 .AND. s_offset_b == 0 .AND. &
619 s_offset_c == 0 .AND. s_offset_d == 0 .AND. &
620 nsgfa == nsoa*nl_a .AND. nsgfb == nsob*nl_b .AND. &
621 nsgfc == nsoc*nl_c .AND. nsgfd == nsod*nl_d)
622 IF (direct_contract)
THEN
623 CALL contract(ncoa, ncob, ncoc, ncod, nsoa, nsob, nsoc, nsod, &
624 n_a, n_b, n_c, n_d, nl_a, nl_b, nl_c, nl_d, work2, &
632 primitives_tmp = 0.0_dp
634 CALL contract(ncoa, ncob, ncoc, ncod, nsoa, nsob, nsoc, nsod, &
635 n_a, n_b, n_c, n_d, nl_a, nl_b, nl_c, nl_d, work2, &
643 primitives(s_offset_a + 1:s_offset_a + nsoa*nl_a, &
644 s_offset_b + 1:s_offset_b + nsob*nl_b, &
645 s_offset_c + 1:s_offset_c + nsoc*nl_c, &
646 s_offset_d + 1:s_offset_d + nsod*nl_d) = &
647 primitives(s_offset_a + 1:s_offset_a + nsoa*nl_a, &
648 s_offset_b + 1:s_offset_b + nsob*nl_b, &
649 s_offset_c + 1:s_offset_c + nsoc*nl_c, &
650 s_offset_d + 1:s_offset_d + nsod*nl_d) + primitives_tmp(:, :, :, :)
subroutine, public evaluate_deriv_eri(context, nproducts, pgf_product_list, n_a, n_b, n_c, n_d, ncoa, ncob, ncoc, ncod, nsgfa, nsgfb, nsgfc, nsgfd, primitives, max_contraction, tmp_max_all, eps_schwarz, neris, s_offset_a, s_offset_b, s_offset_c, s_offset_d, nl_a, nl_b, nl_c, nl_d, nsoa, nsob, nsoc, nsod, sphi_a, sphi_b, sphi_c, sphi_d, work, work2, work_forces, buffer1, buffer2, primitives_tmp, use_virial, work_virial, work2_virial, primitives_tmp_virial, primitives_virial, cell, tmp_max_all_virial)
Evaluates derivatives of electron repulsion integrals for a primitive quartet.