39#include "../base/base_uses.f90"
45 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'ai_overlap_ppl'
102 lb_max_set, lb_min_set, npgfb, rpgfb, zetb, nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, &
103 rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, &
104 hab2, hab2_work, deltaR, iatom, jatom, katom)
105 INTEGER,
INTENT(IN) :: la_max_set, la_min_set, npgfa
106 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa,
zeta
107 INTEGER,
INTENT(IN) :: lb_max_set, lb_min_set, npgfb
108 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb, zetb
109 INTEGER,
INTENT(IN) :: nexp_ppl
110 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: alpha_ppl
111 INTEGER,
DIMENSION(:),
INTENT(IN) :: nct_ppl
112 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: cexp_ppl
113 REAL(kind=
dp),
INTENT(IN) :: rpgfc
114 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
115 REAL(kind=
dp),
INTENT(IN) :: dab
116 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rac
117 REAL(kind=
dp),
INTENT(IN) :: dac
118 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rbc
119 REAL(kind=
dp),
INTENT(IN) :: dbc
120 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: vab
121 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT) :: s
122 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
124 REAL(kind=
dp),
DIMENSION(3),
INTENT(OUT),
OPTIONAL :: force_a, force_b
125 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
126 OPTIONAL :: fs, hab2, hab2_work
127 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
129 INTEGER,
INTENT(IN),
OPTIONAL :: iatom, jatom, katom
131 INTEGER :: iexp, ij, ipgf, jpgf, mmax, nexp
132 REAL(kind=
dp) :: rho, sab, t, zetc
133 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: auxint
134 REAL(kind=
dp),
DIMENSION(3) :: pci
136 IF (
PRESENT(pab))
THEN
137 cpassert(
PRESENT(force_a))
138 cpassert(
PRESENT(force_b))
139 cpassert(
PRESENT(fs))
140 mmax = la_max_set + lb_max_set + 2
143 ELSE IF (
PRESENT(hab2))
THEN
144 mmax = la_max_set + lb_max_set + 2
146 mmax = la_max_set + lb_max_set
149 ALLOCATE (auxint(0:mmax, npgfa*npgfb))
156 IF (rpgfa(ipgf) + rpgfc < dac) cycle
159 IF ((rpgfb(jpgf) + rpgfc < dbc) .OR. &
160 (rpgfa(ipgf) + rpgfb(jpgf) < dab)) cycle
161 ij = (ipgf - 1)*npgfb + jpgf
162 rho =
zeta(ipgf) + zetb(jpgf)
163 pci(:) = -(
zeta(ipgf)*rac(:) + zetb(jpgf)*rbc(:))/rho
164 sab = exp(-(
zeta(ipgf)*zetb(jpgf)/rho*dab*dab))
165 t = rho*sum(pci(:)*pci(:))
167 DO iexp = 1, nexp_ppl
169 zetc = alpha_ppl(iexp)
170 CALL ppl_aux(auxint(0:mmax, ij), mmax, t, rho, nexp, cexp_ppl(:, iexp), zetc)
173 auxint(0:mmax, ij) = sab*auxint(0:mmax, ij)
179 lb_max_set, lb_min_set, npgfb, rpgfb, zetb, auxint, rpgfc, &
180 rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, &
181 vab2=hab2, vab2_work=hab2_work, &
182 deltar=deltar, iatom=iatom, jatom=jatom, katom=katom)
234 lb_max_set, lb_min_set, npgfb, rpgfb, zetb, &
235 nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, &
236 rab, dab, rac, dac, rbc, dbc, vab, s, pab, &
237 force_a, force_b, fs, hab2, hab2_work, &
238 deltaR, iatom, jatom, katom)
239 INTEGER,
INTENT(IN) :: la_max_set, la_min_set, npgfa
240 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa,
zeta
241 INTEGER,
INTENT(IN) :: lb_max_set, lb_min_set, npgfb
242 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb, zetb
243 INTEGER,
INTENT(IN) :: nexp_ppl
244 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: alpha_ppl
245 INTEGER,
DIMENSION(:),
INTENT(IN) :: nct_ppl
246 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: cexp_ppl
247 REAL(kind=
dp),
INTENT(IN) :: rpgfc
248 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
249 REAL(kind=
dp),
INTENT(IN) :: dab
250 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rac
251 REAL(kind=
dp),
INTENT(IN) :: dac
252 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rbc
253 REAL(kind=
dp),
INTENT(IN) :: dbc
254 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: vab
255 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT) :: s
256 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
258 REAL(kind=
dp),
DIMENSION(3),
INTENT(OUT),
OPTIONAL :: force_a, force_b
259 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
260 OPTIONAL :: fs, hab2, hab2_work
261 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
263 INTEGER,
INTENT(IN),
OPTIONAL :: iatom, jatom, katom
265 INTEGER :: iexp, ij, ipgf, jpgf, mmax, nexp
266 REAL(kind=
dp) :: rho, sab, t, zetc
267 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: auxint
268 REAL(kind=
dp),
DIMENSION(3) :: pci
270 IF (
PRESENT(pab))
THEN
271 cpassert(
PRESENT(force_a))
272 cpassert(
PRESENT(force_b))
273 cpassert(
PRESENT(fs))
274 mmax = la_max_set + lb_max_set + 2
277 ELSE IF (
PRESENT(hab2))
THEN
278 mmax = la_max_set + lb_max_set + 2
280 mmax = la_max_set + lb_max_set
283 ALLOCATE (auxint(0:mmax, npgfa*npgfb))
290 IF (rpgfa(ipgf) + rpgfc < dac) cycle
293 IF ((rpgfb(jpgf) + rpgfc < dbc) .OR. &
294 (rpgfa(ipgf) + rpgfb(jpgf) < dab)) cycle
295 ij = (ipgf - 1)*npgfb + jpgf
296 rho =
zeta(ipgf) + zetb(jpgf)
297 pci(:) = -(
zeta(ipgf)*rac(:) + zetb(jpgf)*rbc(:))/rho
298 sab = exp(-(
zeta(ipgf)*zetb(jpgf)/rho*dab*dab))
299 t = rho*sum(pci(:)*pci(:))
301 DO iexp = 1, nexp_ppl
303 zetc = alpha_ppl(iexp)
304 CALL ecploc_aux(auxint(0:mmax, ij), mmax, t, rho, nexp, cexp_ppl(1, iexp), zetc)
307 auxint(0:mmax, ij) = sab*auxint(0:mmax, ij)
313 lb_max_set, lb_min_set, npgfb, rpgfb, zetb, auxint, rpgfc, &
314 rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, &
315 vab2=hab2, vab2_work=hab2_work, &
316 deltar=deltar, iatom=iatom, jatom=jatom, katom=katom)
350 nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, &
352 INTEGER,
INTENT(IN) :: la_max_set, la_min_set, npgfa
353 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa,
zeta
354 INTEGER,
INTENT(IN) :: nexp_ppl
355 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: alpha_ppl
356 INTEGER,
DIMENSION(:),
INTENT(IN) :: nct_ppl
357 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: cexp_ppl
358 REAL(kind=
dp),
INTENT(IN) :: rpgfc
359 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rac
360 REAL(kind=
dp),
INTENT(IN) :: dac
361 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: va
362 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT), &
365 INTEGER :: i, iexp, ipgf, iw, mmax, na, nexp
366 INTEGER,
DIMENSION(3) :: ani, anm, anp
368 REAL(kind=
dp) :: oint, oref, rho, t, zetc
369 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: auxint
370 REAL(kind=
dp),
DIMENSION(3) :: doint, doref
374 IF (
PRESENT(dva))
THEN
375 mmax = la_max_set + 1
380 ALLOCATE (auxint(0:mmax, npgfa))
385 IF (rpgfa(ipgf) + rpgfc < dac) cycle
389 DO iexp = 1, nexp_ppl
391 zetc = alpha_ppl(iexp)
392 CALL ppl_aux(auxint(0:mmax, ipgf), mmax, t, rho, nexp, cexp_ppl(:, iexp), zetc)
397 IF (
PRESENT(dva))
THEN
399 auxint, rpgfc, rac, dac, va, dva)
402 auxint, rpgfc, rac, dac, va)
411 IF (rpgfa(ipgf) + rpgfc < dac)
THEN
412 na = na +
ncoset(la_max_set)
418 ani(1:3) =
indco(1:3, i)
419 oint = ppl_ri_test(rho, ani, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl)
421 IF (abs(oint - oref) > 1.0e-12_dp)
THEN
422 WRITE (iw,
'(A,3i2,i5,F10.4,2G24.12)')
"PPL int error ", ani, la_max_set, dac, oint, oref
424 IF (
PRESENT(dva))
THEN
425 anp = ani + (/1, 0, 0/)
426 anm = ani - (/1, 0, 0/)
427 doint(1) = 2._dp*rho*ppl_ri_test(rho, anp, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl) &
428 - ani(1)*ppl_ri_test(rho, anm, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl)
429 anp = ani + (/0, 1, 0/)
430 anm = ani - (/0, 1, 0/)
431 doint(2) = 2._dp*rho*ppl_ri_test(rho, anp, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl) &
432 - ani(2)*ppl_ri_test(rho, anm, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl)
433 anp = ani + (/0, 0, 1/)
434 anm = ani - (/0, 0, 1/)
435 doint(3) = 2._dp*rho*ppl_ri_test(rho, anp, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl) &
436 - ani(3)*ppl_ri_test(rho, anm, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl)
437 doref(1:3) = dva(na + i, 1:3)
438 IF (any(abs(doint - doref) > 1.0e-6_dp))
THEN
439 WRITE (iw,
'(A,3i2,i5,F10.4,2G24.12)')
" PPL dint error ", &
440 ani, la_max_set, dac, sum(abs(doint)), sum(abs(doref))
444 na = na +
ncoset(la_max_set)
461 FUNCTION ppl_ri_test(rho, ani, rac, nexp_ppl, nct_ppl, alpha_ppl, cexp_ppl)
RESULT(oint)
462 REAL(kind=
dp),
INTENT(IN) :: rho
463 INTEGER,
DIMENSION(3),
INTENT(IN) :: ani
464 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rac
465 INTEGER,
INTENT(IN) :: nexp_ppl
466 INTEGER,
DIMENSION(:),
INTENT(IN) :: nct_ppl
467 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: alpha_ppl
468 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: cexp_ppl
469 REAL(kind=
dp) :: oint
471 INTEGER :: iexp, nexp, ni
472 REAL(kind=
dp) :: cn, zetc
473 REAL(kind=
dp),
DIMENSION(3) :: ra
477 DO iexp = 1, nexp_ppl
479 zetc = alpha_ppl(iexp)
482 cn = cexp_ppl(ni, iexp)
494 oint = oint + 2.0_dp*cn*
os_overlap2(ani, (/2, 2, 0/))
495 oint = oint + 2.0_dp*cn*
os_overlap2(ani, (/0, 2, 2/))
496 oint = oint + 2.0_dp*cn*
os_overlap2(ani, (/2, 0, 2/))
501 oint = oint + 3.0_dp*cn*
os_overlap2(ani, (/4, 2, 0/))
502 oint = oint + 3.0_dp*cn*
os_overlap2(ani, (/4, 0, 2/))
503 oint = oint + 3.0_dp*cn*
os_overlap2(ani, (/2, 4, 0/))
504 oint = oint + 3.0_dp*cn*
os_overlap2(ani, (/0, 4, 2/))
505 oint = oint + 3.0_dp*cn*
os_overlap2(ani, (/2, 0, 4/))
506 oint = oint + 3.0_dp*cn*
os_overlap2(ani, (/0, 2, 4/))
507 oint = oint + 6.0_dp*cn*
os_overlap2(ani, (/2, 2, 2/))
509 cpabort(
"OVERLAP_PPL")
514 END FUNCTION ppl_ri_test
526 SUBROUTINE ppl_aux(auxint, mmax, t, rho, nexp_ppl, cexp_ppl, zetc)
527 INTEGER,
INTENT(IN) :: mmax
528 REAL(kind=
dp),
DIMENSION(0:mmax) :: auxint
529 REAL(kind=
dp),
INTENT(IN) :: t, rho
530 INTEGER,
INTENT(IN) :: nexp_ppl
531 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: cexp_ppl
532 REAL(kind=
dp),
INTENT(IN) :: zetc
534 INTEGER :: i, j, ke, kp, pmax
535 REAL(kind=
dp) :: a2, a3, a4, cc, f, q, q2, q4, q6, rho2, &
537 REAL(kind=
dp),
DIMENSION(0:6) :: polder
538 REAL(kind=
dp),
DIMENSION(0:mmax) :: expder
540 cpassert(nexp_ppl > 0)
544 IF (nexp_ppl > 0)
THEN
545 polder(0) = polder(0) + cexp_ppl(1)
548 IF (nexp_ppl > 1)
THEN
550 a2 = 0.5_dp/q2*cexp_ppl(2)
551 polder(0) = polder(0) + a2*(2._dp*rho*t + 3._dp*q)
552 polder(1) = polder(1) - a2*2._dp*rho
555 IF (nexp_ppl > 2)
THEN
559 a3 = 0.25_dp/q4*cexp_ppl(3)
560 polder(0) = polder(0) + a3*(4._dp*rho2*t2 + 20._dp*rho*t*q + 15._dp*q2)
561 polder(1) = polder(1) - a3*(8._dp*rho2*t + 20._dp*rho*q)
562 polder(2) = polder(2) + a3*8._dp*rho2
565 IF (nexp_ppl > 3)
THEN
569 a4 = 0.125_dp/q6*cexp_ppl(4)
570 polder(0) = polder(0) + a4*(8._dp*rho3*t3 + 84._dp*rho2*t2*q + 210._dp*rho*t*q2 + 105._dp*q*q2)
571 polder(1) = polder(1) - a4*(24._dp*rho3*t2 + 168._dp*rho2*t*q + 210._dp*rho*q2)
572 polder(2) = polder(2) + a4*(48._dp*rho3*t + 168._dp*rho2*q)
573 polder(3) = polder(3) - a4*48_dp*rho3
576 IF (nexp_ppl > 4)
THEN
577 cpabort(
"nexp_ppl > 4")
581 cc = (
pi/q)**1.5_dp*exp(-t*f)
583 IF (mmax >= 0) expder(0) = cc
585 expder(i) = f*expder(i - 1)
589 DO j = 0, min(i, pmax)
592 auxint(i) = auxint(i) + expder(ke)*polder(kp)*
binomial(i, j)
596 END SUBROUTINE ppl_aux
607 SUBROUTINE ecploc_aux(auxint, mmax, t, rho, nexp, cexp, zetc)
608 INTEGER,
INTENT(IN) :: mmax
609 REAL(kind=
dp),
DIMENSION(0:mmax) :: auxint
610 REAL(kind=
dp),
INTENT(IN) :: t, rho
611 INTEGER,
INTENT(IN) :: nexp
612 REAL(kind=
dp),
INTENT(IN) :: cexp, zetc
614 INTEGER :: i, j, ke, kf
615 REAL(kind=
dp) :: c0, c1, cc, cval, fa, fr, q, ts
616 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: expder, fdiff, funder, gfund
622 ALLOCATE (expder(0:mmax), funder(0:mmax + 1))
626 cval = 2.0_dp*cexp/sqrt(q)*
pi**1.5_dp*exp(-t*fa)
629 expder(i) = fa*expder(i - 1)
632 ALLOCATE (gfund(0:mmax))
639 funder(i) = funder(i) + (-1)**j*
binomial(i, j)*gfund(j)
645 funder(i) = fr**i*funder(i)
651 auxint(i) = auxint(i) + expder(ke)*funder(kf)*
binomial(i, j)
655 cval = cexp*2._dp*
pi/q*exp(-t*fa)
658 expder(i) = fa*expder(i - 1)
661 CALL fgamma(mmax, ts, funder)
663 funder(i) = fr**i*funder(i)
669 auxint(i) = auxint(i) + expder(ke)*funder(kf)*
binomial(i, j)
673 cval = cexp*(
pi/q)**1.5_dp*exp(-t*fa)
676 expder(i) = fa*expder(i - 1)
678 auxint(0:mmax) = auxint(0:mmax) + expder(0:mmax)
680 cval = 2.*
pi*cexp/q**2*exp(-t*fa)
683 expder(i) = fa*expder(i - 1)
686 CALL fgamma(mmax + 1, ts, funder)
687 ALLOCATE (fdiff(0:mmax))
688 fdiff(0) = (1.0_dp + ts)*funder(0) - ts*funder(1)
690 fdiff(i) = fr**i*(-i*funder(i - 1) + (1.0_dp + ts)*funder(i) &
691 + i*funder(i) - ts*funder(i + 1))
697 auxint(i) = auxint(i) + expder(ke)*fdiff(kf)*
binomial(i, j)
702 cval = cexp/(4._dp*q**2)*(
pi/q)**1.5_dp*exp(-t*fa)
705 expder(i) = fa*expder(i - 1)
708 c1 = 6._dp*q + 4._dp*rho*t
711 expder(i) = cc*expder(i)
713 auxint(0:mmax) = auxint(0:mmax) + expder(0:mmax)
715 cpabort(
"nexp out of range [1..4]")
718 DEALLOCATE (expder, funder)
720 END SUBROUTINE ecploc_aux
Calculation of general three-center integrals over Cartesian Gaussian-type functions and a spherical ...
subroutine, public os_3center(la_max_set, la_min_set, npgfa, rpgfa, zeta, lb_max_set, lb_min_set, npgfb, rpgfb, zetb, auxint, rpgfc, rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, vab2, vab2_work, deltar, iatom, jatom, katom)
Calculation of three-center integrals <a|c|b> over Cartesian Gaussian functions and a spherical poten...
subroutine, public os_2center(la_max_set, la_min_set, npgfa, rpgfa, zeta, auxint, rpgfc, rac, dac, va, dva)
Calculation of two-center integrals <a|c> over Cartesian Gaussian functions and a spherical potential...
Two-center overlap integrals over Cartesian Gaussian-type functions.
subroutine, public init_os_overlap2(ya, yb, ra, rb)
Calculation of overlap integrals over Cartesian Gaussian-type functions.
recursive real(dp) function, public os_overlap2(an, bn)
...
Calculation of three-center overlap integrals over Cartesian Gaussian-type functions for the second t...
subroutine, public ppl_integral(la_max_set, la_min_set, npgfa, rpgfa, zeta, lb_max_set, lb_min_set, npgfb, rpgfb, zetb, nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, hab2, hab2_work, deltar, iatom, jatom, katom)
Calculation of three-center overlap integrals <a|c|b> over Cartesian Gaussian functions for the local...
subroutine, public ecploc_integral(la_max_set, la_min_set, npgfa, rpgfa, zeta, lb_max_set, lb_min_set, npgfb, rpgfb, zetb, nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, hab2, hab2_work, deltar, iatom, jatom, katom)
Calculation of three-center potential integrals <a|V(r)|b> over Cartesian Gaussian functions for the ...
subroutine, public ppl_integral_ri(la_max_set, la_min_set, npgfa, rpgfa, zeta, nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, rac, dac, va, dva)
Calculation of two-center overlap integrals <a|c> over Cartesian Gaussian functions for the local par...
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
subroutine, public fgamma_0(nmax, t, f)
Calculation of the incomplete Gamma function F(t) for multicenter integrals over Gaussian functions....
Calculation of the G function G_n(t) for 1/R^2 operators.
subroutine, public gfun_values(nmax, t, g)
...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Collection of simple mathematical functions and subroutines.
elemental real(kind=dp) function, public binomial(n, k)
The binomial coefficient n over k for 0 <= k <= n is calculated, otherwise zero is returned.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :), allocatable, public indco