29#include "../base/base_uses.f90"
35 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'ai_overlap'
70 SUBROUTINE overlap(la_max_set, la_min_set, npgfa, rpgfa, zeta, &
71 lb_max_set, lb_min_set, npgfb, rpgfb, zetb, &
72 rab, dab, sab, da_max_set, return_derivatives, s, lds, &
74 INTEGER,
INTENT(IN) :: la_max_set, la_min_set, npgfa
75 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa, zeta
76 INTEGER,
INTENT(IN) :: lb_max_set, lb_min_set, npgfb
77 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb, zetb
78 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
79 REAL(kind=
dp),
INTENT(IN) :: dab
80 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: sab
81 INTEGER,
INTENT(IN) :: da_max_set
82 LOGICAL,
INTENT(IN) :: return_derivatives
83 INTEGER,
INTENT(IN) :: lds
84 REAL(kind=
dp),
DIMENSION(lds, lds, *), &
86 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
88 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
90 REAL(kind=
dp),
DIMENSION(3),
INTENT(OUT),
OPTIONAL :: force_a
92 INTEGER :: ax, ay, az, bx, by, bz, cda, cdax, cday, cdaz, coa, coamx, coamy, coamz, coapx, &
93 coapy, coapz, cob, cobm2x, cobm2y, cobm2z, cobmx, cobmy, cobmz, da, da_max, dax, day, &
94 daz, i, ipgf, j, jk, jpgf, jstart, k, la, la_max, la_min, la_start, lb, lb_max, lb_min, &
96 LOGICAL :: calculate_force_a
97 REAL(kind=
dp) :: f0, f1, f2, f3, f4, fax, fay, faz, ftz, &
99 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
101 IF (
PRESENT(pab) .AND.
PRESENT(force_a))
THEN
102 calculate_force_a = .true.
105 calculate_force_a = .false.
108 IF (
PRESENT(sdab) .OR. calculate_force_a)
THEN
109 IF (da_max_set == 0)
THEN
111 la_max = la_max_set + 1
112 la_min = max(0, la_min_set - 1)
115 la_max = la_max_set + da_max_set + 1
116 la_min = max(0, la_min_set - da_max_set - 1)
120 la_max = la_max_set + da_max_set
121 la_min = max(0, la_min_set - da_max_set)
140 IF (rpgfa(ipgf) + rpgfb(jpgf) < dab)
THEN
141 DO j = nb + 1, nb +
ncoset(lb_max_set)
142 DO i = na + 1, na +
ncoset(la_max_set)
146 IF (return_derivatives)
THEN
147 DO k = 2,
ncoset(da_max_set)
148 jstart = (k - 1)*
SIZE(sab, 1)
149 DO j = jstart + nb + 1, jstart + nb +
ncoset(lb_max_set)
150 DO i = na + 1, na +
ncoset(la_max_set)
156 nb = nb +
ncoset(lb_max_set)
162 zetp = 1.0_dp/(zeta(ipgf) + zetb(jpgf))
164 f0 = sqrt((
pi*zetp)**3)
170 s(1, 1, 1) = f0*exp(-zeta(ipgf)*f1*dab*dab)
182 s(2, 1, 1) = rap(1)*s(1, 1, 1)
183 s(3, 1, 1) = rap(2)*s(1, 1, 1)
184 s(4, 1, 1) = rap(3)*s(1, 1, 1)
192 s(5, 1, 1) = rap(1)*s(2, 1, 1) + f3
193 s(6, 1, 1) = rap(1)*s(3, 1, 1)
194 s(7, 1, 1) = rap(1)*s(4, 1, 1)
195 s(8, 1, 1) = rap(2)*s(3, 1, 1) + f3
196 s(9, 1, 1) = rap(2)*s(4, 1, 1)
197 s(10, 1, 1) = rap(3)*s(4, 1, 1) + f3
205 s(11, 1, 1) = rap(1)*s(5, 1, 1) + f3*s(2, 1, 1)
206 s(12, 1, 1) = rap(1)*s(6, 1, 1) + f2*s(3, 1, 1)
207 s(13, 1, 1) = rap(1)*s(7, 1, 1) + f2*s(4, 1, 1)
208 s(14, 1, 1) = rap(1)*s(8, 1, 1)
209 s(15, 1, 1) = rap(1)*s(9, 1, 1)
210 s(16, 1, 1) = rap(1)*s(10, 1, 1)
211 s(17, 1, 1) = rap(2)*s(8, 1, 1) + f3*s(3, 1, 1)
212 s(18, 1, 1) = rap(2)*s(9, 1, 1) + f2*s(4, 1, 1)
213 s(19, 1, 1) = rap(2)*s(10, 1, 1)
214 s(20, 1, 1) = rap(3)*s(10, 1, 1) + f3*s(4, 1, 1)
222 s(21, 1, 1) = rap(1)*s(11, 1, 1) + f4*s(5, 1, 1)
223 s(22, 1, 1) = rap(1)*s(12, 1, 1) + f3*s(6, 1, 1)
224 s(23, 1, 1) = rap(1)*s(13, 1, 1) + f3*s(7, 1, 1)
225 s(24, 1, 1) = rap(1)*s(14, 1, 1) + f2*s(8, 1, 1)
226 s(25, 1, 1) = rap(1)*s(15, 1, 1) + f2*s(9, 1, 1)
227 s(26, 1, 1) = rap(1)*s(16, 1, 1) + f2*s(10, 1, 1)
228 s(27, 1, 1) = rap(1)*s(17, 1, 1)
229 s(28, 1, 1) = rap(1)*s(18, 1, 1)
230 s(29, 1, 1) = rap(1)*s(19, 1, 1)
231 s(30, 1, 1) = rap(1)*s(20, 1, 1)
232 s(31, 1, 1) = rap(2)*s(17, 1, 1) + f4*s(8, 1, 1)
233 s(32, 1, 1) = rap(2)*s(18, 1, 1) + f3*s(9, 1, 1)
234 s(33, 1, 1) = rap(2)*s(19, 1, 1) + f2*s(10, 1, 1)
235 s(34, 1, 1) = rap(2)*s(20, 1, 1)
236 s(35, 1, 1) = rap(3)*s(20, 1, 1) + f4*s(10, 1, 1)
244 s(
coset(0, 0, la), 1, 1) = &
245 rap(3)*s(
coset(0, 0, la - 1), 1, 1) + &
246 f2*real(la - 1,
dp)*s(
coset(0, 0, la - 2), 1, 1)
251 s(
coset(0, 1, az), 1, 1) = rap(2)*s(
coset(0, 0, az), 1, 1)
254 s(
coset(0, ay, az), 1, 1) = &
255 rap(2)*s(
coset(0, ay - 1, az), 1, 1) + &
256 f2*real(ay - 1,
dp)*s(
coset(0, ay - 2, az), 1, 1)
263 s(
coset(1, ay, az), 1, 1) = rap(1)*s(
coset(0, ay, az), 1, 1)
266 f3 = f2*real(ax - 1,
dp)
269 s(
coset(ax, ay, az), 1, 1) = &
270 rap(1)*s(
coset(ax - 1, ay, az), 1, 1) + &
271 f3*s(
coset(ax - 2, ay, az), 1, 1)
295 rbp(:) = rap(:) - rab(:)
299 IF (lb_max == 1)
THEN
302 la_start = max(0, la_min - 1)
305 DO la = la_start, la_max - 1
309 coa =
coset(ax, ay, az)
310 coapx =
coset(ax + 1, ay, az)
311 coapy =
coset(ax, ay + 1, az)
312 coapz =
coset(ax, ay, az + 1)
313 s(coa, 2, 1) = s(coapx, 1, 1) - rab(1)*s(coa, 1, 1)
314 s(coa, 3, 1) = s(coapy, 1, 1) - rab(2)*s(coa, 1, 1)
315 s(coa, 4, 1) = s(coapz, 1, 1) - rab(3)*s(coa, 1, 1)
325 fax = f2*real(ax,
dp)
326 DO ay = 0, la_max - ax
327 fay = f2*real(ay,
dp)
328 az = la_max - ax - ay
329 faz = f2*real(az,
dp)
330 coa =
coset(ax, ay, az)
331 coamx =
coset(ax - 1, ay, az)
332 coamy =
coset(ax, ay - 1, az)
333 coamz =
coset(ax, ay, az - 1)
334 s(coa, 2, 1) = rbp(1)*s(coa, 1, 1) + fax*s(coamx, 1, 1)
335 s(coa, 3, 1) = rbp(2)*s(coa, 1, 1) + fay*s(coamy, 1, 1)
336 s(coa, 4, 1) = rbp(3)*s(coa, 1, 1) + faz*s(coamz, 1, 1)
348 IF (lb == lb_max)
THEN
351 la_start = max(0, la_min - 1)
354 DO la = la_start, la_max - 1
358 coa =
coset(ax, ay, az)
359 coapx =
coset(ax + 1, ay, az)
360 coapy =
coset(ax, ay + 1, az)
361 coapz =
coset(ax, ay, az + 1)
365 cob =
coset(0, 0, lb)
366 cobmz =
coset(0, 0, lb - 1)
367 s(coa, cob, 1) = s(coapz, cobmz, 1) - rab(3)*s(coa, cobmz, 1)
373 cob =
coset(0, by, bz)
374 cobmy =
coset(0, by - 1, bz)
375 s(coa, cob, 1) = s(coapy, cobmy, 1) - rab(2)*s(coa, cobmy, 1)
383 cob =
coset(bx, by, bz)
384 cobmx =
coset(bx - 1, by, bz)
385 s(coa, cob, 1) = s(coapx, cobmx, 1) - rab(1)*s(coa, cobmx, 1)
399 fax = f2*real(ax,
dp)
400 DO ay = 0, la_max - ax
401 fay = f2*real(ay,
dp)
402 az = la_max - ax - ay
403 faz = f2*real(az,
dp)
404 coa =
coset(ax, ay, az)
405 coamx =
coset(ax - 1, ay, az)
406 coamy =
coset(ax, ay - 1, az)
407 coamz =
coset(ax, ay, az - 1)
411 f3 = f2*real(lb - 1,
dp)
412 cob =
coset(0, 0, lb)
413 cobmz =
coset(0, 0, lb - 1)
414 cobm2z =
coset(0, 0, lb - 2)
415 s(coa, cob, 1) = rbp(3)*s(coa, cobmz, 1) + &
416 faz*s(coamz, cobmz, 1) + &
422 cob =
coset(0, 1, bz)
423 cobmy =
coset(0, 0, bz)
424 s(coa, cob, 1) = rbp(2)*s(coa, cobmy, 1) + &
425 fay*s(coamy, cobmy, 1)
428 f3 = f2*real(by - 1,
dp)
429 cob =
coset(0, by, bz)
430 cobmy =
coset(0, by - 1, bz)
431 cobm2y =
coset(0, by - 2, bz)
432 s(coa, cob, 1) = rbp(2)*s(coa, cobmy, 1) + &
433 fay*s(coamy, cobmy, 1) + &
441 cob =
coset(1, by, bz)
442 cobmx =
coset(0, by, bz)
443 s(coa, cob, 1) = rbp(1)*s(coa, cobmx, 1) + &
444 fax*s(coamx, cobmx, 1)
447 f3 = f2*real(bx - 1,
dp)
450 cob =
coset(bx, by, bz)
451 cobmx =
coset(bx - 1, by, bz)
452 cobm2x =
coset(bx - 2, by, bz)
453 s(coa, cob, 1) = rbp(1)*s(coa, cobmx, 1) + &
454 fax*s(coamx, cobmx, 1) + &
472 rbp(:) = (f1 - 1.0_dp)*rab(:)
476 s(1, 2, 1) = rbp(1)*s(1, 1, 1)
477 s(1, 3, 1) = rbp(2)*s(1, 1, 1)
478 s(1, 4, 1) = rbp(3)*s(1, 1, 1)
486 s(1, 5, 1) = rbp(1)*s(1, 2, 1) + f3
487 s(1, 6, 1) = rbp(1)*s(1, 3, 1)
488 s(1, 7, 1) = rbp(1)*s(1, 4, 1)
489 s(1, 8, 1) = rbp(2)*s(1, 3, 1) + f3
490 s(1, 9, 1) = rbp(2)*s(1, 4, 1)
491 s(1, 10, 1) = rbp(3)*s(1, 4, 1) + f3
499 s(1,
coset(0, 0, lb), 1) = &
500 rbp(3)*s(1,
coset(0, 0, lb - 1), 1) + &
501 f2*real(lb - 1,
dp)*s(1,
coset(0, 0, lb - 2), 1)
506 s(1,
coset(0, 1, bz), 1) = rbp(2)*s(1,
coset(0, 0, bz), 1)
509 s(1,
coset(0, by, bz), 1) = &
510 rbp(2)*s(1,
coset(0, by - 1, bz), 1) + &
511 f2*real(by - 1,
dp)*s(1,
coset(0, by - 2, bz), 1)
518 s(1,
coset(1, by, bz), 1) = rbp(1)*s(1,
coset(0, by, bz), 1)
521 f3 = f2*real(bx - 1,
dp)
524 s(1,
coset(bx, by, bz), 1) = &
525 rbp(1)*s(1,
coset(bx - 1, by, bz), 1) + &
526 f3*s(1,
coset(bx - 2, by, bz), 1)
540 DO j = 1,
ncoset(lb_max_set)
541 DO i = 1,
ncoset(la_max_set)
542 sab(na + i, nb + j) = s(i, j, 1)
549 IF (
PRESENT(sdab) .OR. return_derivatives)
THEN
553 la_start = la_min_set
554 lb_start = lb_min_set
557 DO da = 0, da_max - 1
558 ftz = 2.0_dp*zeta(ipgf)
562 cda =
coset(dax, day, daz)
563 cdax =
coset(dax + 1, day, daz)
564 cday =
coset(dax, day + 1, daz)
565 cdaz =
coset(dax, day, daz + 1)
569 DO la = la_start, la_max - da - 1
576 coa =
coset(ax, ay, az)
577 coamx =
coset(ax - 1, ay, az)
578 coamy =
coset(ax, ay - 1, az)
579 coamz =
coset(ax, ay, az - 1)
580 coapx =
coset(ax + 1, ay, az)
581 coapy =
coset(ax, ay + 1, az)
582 coapz =
coset(ax, ay, az + 1)
583 DO lb = lb_start, lb_max_set
587 cob =
coset(bx, by, bz)
588 s(coa, cob, cdax) = ftz*s(coapx, cob, cda) - &
589 fax*s(coamx, cob, cda)
590 s(coa, cob, cday) = ftz*s(coapy, cob, cda) - &
591 fay*s(coamy, cob, cda)
592 s(coa, cob, cdaz) = ftz*s(coapz, cob, cda) - &
593 faz*s(coamz, cob, cda)
608 IF (return_derivatives)
THEN
609 DO k = 2,
ncoset(da_max_set)
610 jstart = (k - 1)*
SIZE(sab, 1)
611 DO j = 1,
ncoset(lb_max_set)
613 DO i = 1,
ncoset(la_max_set)
614 sab(na + i, nb + jk) = s(i, j, k)
622 IF (calculate_force_a)
THEN
626 force_a(k) = force_a(k) + pab(na + i, nb + j)*s(i, j, k + 1)
636 IF (
PRESENT(sdab))
THEN
637 sdab(nda + 1, nb + 1, 1) = s(1, 1, 1)
639 DO j = 1,
ncoset(lb_max_set)
640 DO i = 1,
ncoset(la_max - 1)
641 sdab(nda + i, nb + j, k) = s(i, j, k)
647 nb = nb +
ncoset(lb_max_set)
651 na = na +
ncoset(la_max_set)
652 nda = nda +
ncoset(la_max - 1)
679 lb_max, lb_min, npgfb, rpgfb, zetb, &
681 INTEGER,
INTENT(IN) :: la_max, la_min, npgfa
682 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa, zeta
683 INTEGER,
INTENT(IN) :: lb_max, lb_min, npgfb
684 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb, zetb
685 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
686 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT), &
688 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
689 OPTIONAL :: dab, ddab
691 INTEGER :: ax, ay, az, bx, by, bz, coa, cob, ia, &
692 ib, ipgf, jpgf, la, lb, ldrr, lma, &
693 lmb, ma, mb, na, nb, ofa, ofb
694 REAL(kind=
dp) :: a, ambm, ambp, apbm, apbp, b, dumx, &
695 dumy, dumz, f0, rab2, tab, xhi, zet
696 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: rr
697 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
701 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
705 IF (
PRESENT(sab))
THEN
709 IF (
PRESENT(dab))
THEN
713 IF (
PRESENT(ddab))
THEN
717 ldrr = max(lma, lmb) + 1
720 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3))
727 IF (
PRESENT(sab))
THEN
728 cpassert((
SIZE(sab, 1) >= na*npgfa))
729 cpassert((
SIZE(sab, 2) >= nb*npgfb))
731 IF (
PRESENT(dab))
THEN
732 cpassert((
SIZE(dab, 1) >= na*npgfa))
733 cpassert((
SIZE(dab, 2) >= nb*npgfb))
734 cpassert((
SIZE(dab, 3) >= 3))
736 IF (
PRESENT(ddab))
THEN
737 cpassert((
SIZE(ddab, 1) >= na*npgfa))
738 cpassert((
SIZE(ddab, 2) >= nb*npgfb))
739 cpassert((
SIZE(ddab, 3) >= 6))
748 IF (rpgfa(ipgf) + rpgfb(jpgf) < tab)
THEN
749 IF (
PRESENT(sab)) sab(ma + 1:ma + na, mb + 1:mb + nb) = 0.0_dp
750 IF (
PRESENT(dab)) dab(ma + 1:ma + na, mb + 1:mb + nb, 1:3) = 0.0_dp
751 IF (
PRESENT(ddab)) ddab(ma + 1:ma + na, mb + 1:mb + nb, 1:6) = 0.0_dp
765 f0 = (
pi/zet)**(1.5_dp)*exp(-xhi*rab2)
768 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
770 DO lb = lb_min, lb_max
774 cob =
coset(bx, by, bz) - ofb
776 DO la = la_min, la_max
780 coa =
coset(ax, ay, az) - ofa
783 IF (
PRESENT(sab))
THEN
784 sab(ia, ib) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*rr(az, bz, 3)
787 IF (
PRESENT(dab))
THEN
790 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
791 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
792 dab(ia, ib, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
794 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
795 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
796 dab(ia, ib, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
798 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
799 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
800 dab(ia, ib, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
803 IF (
PRESENT(ddab))
THEN
807 apbp = f0*rr(ax + 1, bx + 1, 1)*rr(ay, by, 2)*rr(az, bz, 3)
809 apbm = f0*rr(ax + 1, bx - 1, 1)*rr(ay, by, 2)*rr(az, bz, 3)
814 ambp = f0*rr(ax - 1, bx + 1, 1)*rr(ay, by, 2)*rr(az, bz, 3)
818 IF (ax > 0 .AND. bx > 0)
THEN
819 ambm = f0*rr(ax - 1, bx - 1, 1)*rr(ay, by, 2)*rr(az, bz, 3)
823 ddab(ia, ib, 1) = -4.0_dp*a*b*apbm + 2.0_dp*a*real(bx,
dp)*apbm &
824 + 2.0_dp*b*real(ax,
dp)*ambp - real(ax,
dp)*real(bx,
dp)*ambm
826 apbp = f0*rr(ax + 1, bx, 1)*rr(ay, by + 1, 2)*rr(az, bz, 3)
828 apbm = f0*rr(ax + 1, bx, 1)*rr(ay, by - 1, 2)*rr(az, bz, 3)
833 ambp = f0*rr(ax - 1, bx, 1)*rr(ay, by + 1, 2)*rr(az, bz, 3)
837 IF (ax > 0 .AND. by > 0)
THEN
838 ambm = f0*rr(ax - 1, bx, 1)*rr(ay, by - 1, 2)*rr(az, bz, 3)
842 ddab(ia, ib, 2) = -4.0_dp*a*b*apbm + 2.0_dp*a*real(by,
dp)*apbm &
843 + 2.0_dp*b*real(ax,
dp)*ambp - real(ax,
dp)*real(by,
dp)*ambm
845 apbp = f0*rr(ax + 1, bx, 1)*rr(ay, by, 2)*rr(az, bz + 1, 3)
847 apbm = f0*rr(ax + 1, bx, 1)*rr(ay, by, 2)*rr(az, bz - 1, 3)
852 ambp = f0*rr(ax - 1, bx, 1)*rr(ay, by, 2)*rr(az, bz + 1, 3)
856 IF (ax > 0 .AND. bz > 0)
THEN
857 ambm = f0*rr(ax - 1, bx, 1)*rr(ay, by, 2)*rr(az, bz - 1, 3)
861 ddab(ia, ib, 3) = -4.0_dp*a*b*apbm + 2.0_dp*a*real(bz,
dp)*apbm &
862 + 2.0_dp*b*real(ax,
dp)*ambp - real(ax,
dp)*real(bz,
dp)*ambm
864 apbp = f0*rr(ax, bx, 1)*rr(ay + 1, by + 1, 2)*rr(az, bz, 3)
866 apbm = f0*rr(ax, bx, 1)*rr(ay + 1, by - 1, 2)*rr(az, bz, 3)
871 ambp = f0*rr(ax, bx, 1)*rr(ay - 1, by + 1, 2)*rr(az, bz, 3)
875 IF (ay > 0 .AND. by > 0)
THEN
876 ambm = f0*rr(ax, bx, 1)*rr(ay - 1, by - 1, 2)*rr(az, bz, 3)
880 ddab(ia, ib, 4) = -4.0_dp*a*b*apbm + 2.0_dp*a*real(by,
dp)*apbm &
881 + 2.0_dp*b*real(ay,
dp)*ambp - real(ay,
dp)*real(by,
dp)*ambm
883 apbp = f0*rr(ax, bx, 1)*rr(ay + 1, by, 2)*rr(az, bz + 1, 3)
885 apbm = f0*rr(ax, bx, 1)*rr(ay + 1, by, 2)*rr(az, bz - 1, 3)
890 ambp = f0*rr(ax, bx, 1)*rr(ay - 1, by, 2)*rr(az, bz + 1, 3)
894 IF (ay > 0 .AND. bz > 0)
THEN
895 ambm = f0*rr(ax, bx, 1)*rr(ay - 1, by, 2)*rr(az, bz - 1, 3)
899 ddab(ia, ib, 5) = -4.0_dp*a*b*apbm + 2.0_dp*a*real(bz,
dp)*apbm &
900 + 2.0_dp*b*real(ay,
dp)*ambp - real(ay,
dp)*real(bz,
dp)*ambm
902 apbp = f0*rr(ax, bx, 1)*rr(ay, by, 2)*rr(az + 1, bz + 1, 3)
904 apbm = f0*rr(ax, bx, 1)*rr(ay, by, 2)*rr(az + 1, bz - 1, 3)
909 ambp = f0*rr(ax, bx, 1)*rr(ay, by, 2)*rr(az - 1, bz + 1, 3)
913 IF (az > 0 .AND. bz > 0)
THEN
914 ambm = f0*rr(ax, bx, 1)*rr(ay, by, 2)*rr(az - 1, bz - 1, 3)
918 ddab(ia, ib, 6) = -4.0_dp*a*b*apbm + 2.0_dp*a*real(bz,
dp)*apbm &
919 + 2.0_dp*b*real(az,
dp)*ambp - real(az,
dp)*real(bz,
dp)*ambm
965 la2_max, la2_min, npgfa2, rpgfa2, zeta2, &
966 lb_max, lb_min, npgfb, rpgfb, zetb, &
967 rab, saab, daab, saba, daba)
968 INTEGER,
INTENT(IN) :: la1_max, la1_min, npgfa1
969 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa1, zeta1
970 INTEGER,
INTENT(IN) :: la2_max, la2_min, npgfa2
971 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa2, zeta2
972 INTEGER,
INTENT(IN) :: lb_max, lb_min, npgfb
973 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb, zetb
974 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
975 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
977 REAL(kind=
dp),
DIMENSION(:, :, :, :), &
978 INTENT(INOUT),
OPTIONAL :: daab
979 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
981 REAL(kind=
dp),
DIMENSION(:, :, :, :), &
982 INTENT(INOUT),
OPTIONAL :: daba
984 INTEGER :: ax, ax1, ax2, ay, ay1, ay2, az, az1, az2, bx, by, bz, coa1, coa2, cob, i1pgf, &
985 i2pgf, ia1, ia2, ib, jpgf, la1, la2, lb, ldrr, lma, lmb, ma1, ma2, mb, na1, na2, nb, &
987 REAL(kind=
dp) :: a, b, dumx, dumy, dumz, f0, rab2, rpgfa, &
989 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: rr
990 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
994 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
998 IF (
PRESENT(saab) .OR.
PRESENT(saba))
THEN
999 lma = la1_max + la2_max
1002 IF (
PRESENT(daab) .OR.
PRESENT(daba))
THEN
1003 lma = la1_max + la2_max + 1
1006 ldrr = max(lma, lmb) + 1
1009 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3))
1012 ofa1 =
ncoset(la1_min - 1)
1013 ofa2 =
ncoset(la2_min - 1)
1015 na1 =
ncoset(la1_max) - ofa1
1016 na2 =
ncoset(la2_max) - ofa2
1017 nb =
ncoset(lb_max) - ofb
1018 IF (
PRESENT(saab))
THEN
1019 cpassert((
SIZE(saab, 1) >= na1*npgfa1))
1020 cpassert((
SIZE(saab, 2) >= na2*npgfa2))
1021 cpassert((
SIZE(saab, 3) >= nb*npgfb))
1023 IF (
PRESENT(daab))
THEN
1024 cpassert((
SIZE(daab, 1) >= na1*npgfa1))
1025 cpassert((
SIZE(daab, 2) >= na2*npgfa2))
1026 cpassert((
SIZE(daab, 3) >= nb*npgfb))
1027 cpassert((
SIZE(daab, 4) >= 3))
1029 IF (
PRESENT(saba))
THEN
1030 cpassert((
SIZE(saba, 1) >= na1*npgfa1))
1031 cpassert((
SIZE(saba, 2) >= nb*npgfb))
1032 cpassert((
SIZE(saba, 3) >= na2*npgfa2))
1034 IF (
PRESENT(daba))
THEN
1035 cpassert((
SIZE(daba, 1) >= na1*npgfa1))
1036 cpassert((
SIZE(daba, 2) >= nb*npgfb))
1037 cpassert((
SIZE(daba, 3) >= na2*npgfa2))
1038 cpassert((
SIZE(daba, 4) >= 3))
1043 DO i1pgf = 1, npgfa1
1045 DO i2pgf = 1, npgfa2
1046 rpgfa = min(rpgfa1(i1pgf), rpgfa2(i2pgf))
1050 IF (rpgfa + rpgfb(jpgf) < tab)
THEN
1051 IF (
PRESENT(saab)) saab(ma1 + 1:ma1 + na1, ma2 + 1:ma2 + na2, mb + 1:mb + nb) = 0.0_dp
1052 IF (
PRESENT(daab)) daab(ma1 + 1:ma1 + na1, ma2 + 1:ma2 + na2, mb + 1:mb + nb, 1:3) = 0.0_dp
1053 IF (
PRESENT(saba)) saba(ma1 + 1:ma1 + na1, mb + 1:mb + nb, ma2 + 1:ma2 + na2) = 0.0_dp
1054 IF (
PRESENT(daba)) daba(ma1 + 1:ma1 + na1, mb + 1:mb + nb, ma2 + 1:ma2 + na2, 1:3) = 0.0_dp
1060 a = zeta1(i1pgf) + zeta2(i2pgf)
1068 f0 = (
pi/zet)**(1.5_dp)*exp(-xhi*rab2)
1071 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
1073 DO lb = lb_min, lb_max
1077 cob =
coset(bx, by, bz) - ofb
1079 DO la2 = la2_min, la2_max
1081 DO ay2 = 0, la2 - ax2
1082 az2 = la2 - ax2 - ay2
1083 coa2 =
coset(ax2, ay2, az2) - ofa2
1085 DO la1 = la1_min, la1_max
1087 DO ay1 = 0, la1 - ax1
1088 az1 = la1 - ax1 - ay1
1089 coa1 =
coset(ax1, ay1, az1) - ofa1
1092 IF (
PRESENT(saab))
THEN
1093 saab(ia1, ia2, ib) = f0*rr(ax1 + ax2, bx, 1)*rr(ay1 + ay2, by, 2)*rr(az1 + az2, bz, 3)
1095 IF (
PRESENT(saba))
THEN
1096 saba(ia1, ib, ia2) = f0*rr(ax1 + ax2, bx, 1)*rr(ay1 + ay2, by, 2)*rr(az1 + az2, bz, 3)
1099 IF (
PRESENT(daab))
THEN
1105 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
1106 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
1107 daab(ia1, ia2, ib, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
1109 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
1110 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
1111 daab(ia1, ia2, ib, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
1113 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
1114 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
1115 daab(ia1, ia2, ib, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
1117 IF (
PRESENT(daba))
THEN
1123 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
1124 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
1125 daba(ia1, ib, ia2, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
1127 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
1128 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
1129 daba(ia1, ib, ia2, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
1131 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
1132 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
1133 daba(ia1, ib, ia2, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
1182 lb1_max, lb1_min, npgfb1, rpgfb1, zetb1, &
1183 lb2_max, lb2_min, npgfb2, rpgfb2, zetb2, &
1185 INTEGER,
INTENT(IN) :: la_max, la_min, npgfa
1186 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa, zeta
1187 INTEGER,
INTENT(IN) :: lb1_max, lb1_min, npgfb1
1188 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb1, zetb1
1189 INTEGER,
INTENT(IN) :: lb2_max, lb2_min, npgfb2
1190 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb2, zetb2
1191 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
1192 REAL(kind=
dp),
DIMENSION(:, :, :),
INTENT(INOUT), &
1194 REAL(kind=
dp),
DIMENSION(:, :, :, :), &
1195 INTENT(INOUT),
OPTIONAL :: dabb
1197 INTEGER :: ax, ay, az, bx, bx1, bx2, by, by1, by2, bz, bz1, bz2, coa, cob1, cob2, ia, ib1, &
1198 ib2, ipgf, j1pgf, j2pgf, la, lb1, lb2, ldrr, lma, lmb, ma, mb1, mb2, na, nb1, nb2, ofa, &
1200 REAL(kind=
dp) :: a, b, dumx, dumy, dumz, f0, rab2, rpgfb, &
1202 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: rr
1203 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
1207 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
1211 IF (
PRESENT(sabb))
THEN
1213 lmb = lb1_max + lb2_max
1215 IF (
PRESENT(dabb))
THEN
1217 lmb = lb1_max + lb2_max
1219 ldrr = max(lma, lmb) + 1
1222 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3))
1226 ofb1 =
ncoset(lb1_min - 1)
1227 ofb2 =
ncoset(lb2_min - 1)
1228 na =
ncoset(la_max) - ofa
1229 nb1 =
ncoset(lb1_max) - ofb1
1230 nb2 =
ncoset(lb2_max) - ofb2
1231 IF (
PRESENT(sabb))
THEN
1232 cpassert((
SIZE(sabb, 1) >= na*npgfa))
1233 cpassert((
SIZE(sabb, 2) >= nb1*npgfb1))
1234 cpassert((
SIZE(sabb, 3) >= nb2*npgfb2))
1236 IF (
PRESENT(dabb))
THEN
1237 cpassert((
SIZE(dabb, 1) >= na*npgfa))
1238 cpassert((
SIZE(dabb, 2) >= nb1*npgfb1))
1239 cpassert((
SIZE(dabb, 3) >= nb2*npgfb2))
1240 cpassert((
SIZE(dabb, 4) >= 3))
1247 DO j1pgf = 1, npgfb1
1249 DO j2pgf = 1, npgfb2
1251 rpgfb = min(rpgfb1(j1pgf), rpgfb2(j2pgf))
1252 IF (rpgfa(ipgf) + rpgfb < tab)
THEN
1253 IF (
PRESENT(sabb)) sabb(ma + 1:ma + na, mb1 + 1:mb1 + nb1, mb2 + 1:mb2 + nb2) = 0.0_dp
1254 IF (
PRESENT(dabb)) dabb(ma + 1:ma + na, mb1 + 1:mb1 + nb1, mb2 + 1:mb2 + nb2, 1:3) = 0.0_dp
1261 b = zetb1(j1pgf) + zetb2(j2pgf)
1268 f0 = (
pi/zet)**(1.5_dp)*exp(-xhi*rab2)
1271 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
1273 DO lb2 = lb2_min, lb2_max
1275 DO by2 = 0, lb2 - bx2
1276 bz2 = lb2 - bx2 - by2
1277 cob2 =
coset(bx2, by2, bz2) - ofb2
1279 DO lb1 = lb1_min, lb1_max
1281 DO by1 = 0, lb1 - bx1
1282 bz1 = lb1 - bx1 - by1
1283 cob1 =
coset(bx1, by1, bz1) - ofb1
1285 DO la = la_min, la_max
1289 coa =
coset(ax, ay, az) - ofa
1292 IF (
PRESENT(sabb))
THEN
1293 sabb(ia, ib1, ib2) = f0*rr(ax, bx1 + bx2, 1)*rr(ay, by1 + by2, 2)*rr(az, bz1 + bz2, 3)
1296 IF (
PRESENT(dabb))
THEN
1302 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
1303 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
1304 dabb(ia, ib1, ib2, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
1306 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
1307 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
1308 dabb(ia, ib1, ib2, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
1310 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
1311 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
1312 dabb(ia, ib1, ib2, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
1365 SUBROUTINE overlap_aaab(la1_max, la1_min, npgfa1, rpgfa1, zeta1, &
1366 la2_max, la2_min, npgfa2, rpgfa2, zeta2, &
1367 la3_max, la3_min, npgfa3, rpgfa3, zeta3, &
1368 lb_max, lb_min, npgfb, rpgfb, zetb, &
1370 INTEGER,
INTENT(IN) :: la1_max, la1_min, npgfa1
1371 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa1, zeta1
1372 INTEGER,
INTENT(IN) :: la2_max, la2_min, npgfa2
1373 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa2, zeta2
1374 INTEGER,
INTENT(IN) :: la3_max, la3_min, npgfa3
1375 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa3, zeta3
1376 INTEGER,
INTENT(IN) :: lb_max, lb_min, npgfb
1377 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb, zetb
1378 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
1379 REAL(kind=
dp),
DIMENSION(:, :, :, :), &
1380 INTENT(INOUT),
OPTIONAL :: saaab
1381 REAL(kind=
dp),
DIMENSION(:, :, :, :, :), &
1382 INTENT(INOUT),
OPTIONAL :: daaab
1384 INTEGER :: ax, ax1, ax2, ax3, ay, ay1, ay2, ay3, az, az1, az2, az3, bx, by, bz, coa1, coa2, &
1385 coa3, cob, i1pgf, i2pgf, i3pgf, ia1, ia2, ia3, ib, jpgf, la1, la2, la3, lb, ldrr, lma, &
1386 lmb, ma1, ma2, ma3, mb, na1, na2, na3, nb, ofa1, ofa2, ofa3, ofb
1387 REAL(kind=
dp) :: a, b, dumx, dumy, dumz, f0, rab2, rpgfa, &
1389 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: rr
1390 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
1394 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
1398 IF (
PRESENT(saaab))
THEN
1399 lma = la1_max + la2_max + la3_max
1402 IF (
PRESENT(daaab))
THEN
1403 lma = la1_max + la2_max + la3_max + 1
1406 ldrr = max(lma, lmb) + 1
1409 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3))
1412 ofa1 =
ncoset(la1_min - 1)
1413 ofa2 =
ncoset(la2_min - 1)
1414 ofa3 =
ncoset(la3_min - 1)
1416 na1 =
ncoset(la1_max) - ofa1
1417 na2 =
ncoset(la2_max) - ofa2
1418 na3 =
ncoset(la3_max) - ofa3
1419 nb =
ncoset(lb_max) - ofb
1420 IF (
PRESENT(saaab))
THEN
1421 cpassert((
SIZE(saaab, 1) >= na1*npgfa1))
1422 cpassert((
SIZE(saaab, 2) >= na2*npgfa2))
1423 cpassert((
SIZE(saaab, 3) >= na3*npgfa3))
1424 cpassert((
SIZE(saaab, 4) >= nb*npgfb))
1426 IF (
PRESENT(daaab))
THEN
1427 cpassert((
SIZE(daaab, 1) >= na1*npgfa1))
1428 cpassert((
SIZE(daaab, 2) >= na2*npgfa2))
1429 cpassert((
SIZE(daaab, 3) >= na3*npgfa3))
1430 cpassert((
SIZE(daaab, 4) >= nb*npgfb))
1431 cpassert((
SIZE(daaab, 5) >= 3))
1436 DO i1pgf = 1, npgfa1
1438 DO i2pgf = 1, npgfa2
1440 DO i3pgf = 1, npgfa3
1441 rpgfa = min(rpgfa1(i1pgf), rpgfa2(i2pgf), rpgfa3(i3pgf))
1445 IF (rpgfa + rpgfb(jpgf) < tab)
THEN
1446 IF (
PRESENT(saaab)) saaab(ma1 + 1:ma1 + na1, ma2 + 1:ma2 + na2, ma3 + 1:ma3 + na3, mb + 1:mb + nb) = 0.0_dp
1447 IF (
PRESENT(daaab)) daaab(ma1 + 1:ma1 + na1, ma2 + 1:ma2 + na2, ma3 + 1:ma3 + na3, mb + 1:mb + nb, 1:3) = 0.0_dp
1453 a = zeta1(i1pgf) + zeta2(i2pgf) + zeta3(i3pgf)
1461 f0 = (
pi/zet)**(1.5_dp)*exp(-xhi*rab2)
1464 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
1466 DO lb = lb_min, lb_max
1470 cob =
coset(bx, by, bz) - ofb
1472 DO la3 = la3_min, la3_max
1474 DO ay3 = 0, la3 - ax3
1475 az3 = la3 - ax3 - ay3
1476 coa3 =
coset(ax3, ay3, az3) - ofa3
1478 DO la2 = la2_min, la2_max
1480 DO ay2 = 0, la2 - ax2
1481 az2 = la2 - ax2 - ay2
1482 coa2 =
coset(ax2, ay2, az2) - ofa2
1484 DO la1 = la1_min, la1_max
1486 DO ay1 = 0, la1 - ax1
1487 az1 = la1 - ax1 - ay1
1488 coa1 =
coset(ax1, ay1, az1) - ofa1
1491 IF (
PRESENT(saaab))
THEN
1492 saaab(ia1, ia2, ia3, ib) = f0*rr(ax1 + ax2 + ax3, bx, 1)* &
1493 rr(ay1 + ay2 + ay3, by, 2)*rr(az1 + az2 + az3, bz, 3)
1496 IF (
PRESENT(daaab))
THEN
1497 ax = ax1 + ax2 + ax3
1498 ay = ay1 + ay2 + ay3
1499 az = az1 + az2 + az3
1502 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
1503 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
1504 daaab(ia1, ia2, ia3, ib, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
1506 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
1507 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
1508 daaab(ia1, ia2, ia3, ib, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
1510 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
1511 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
1512 daaab(ia1, ia2, ia3, ib, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
1539 END SUBROUTINE overlap_aaab
1569 SUBROUTINE overlap_aabb(la1_max, la1_min, npgfa1, rpgfa1, zeta1, &
1570 la2_max, la2_min, npgfa2, rpgfa2, zeta2, &
1571 lb1_max, lb1_min, npgfb1, rpgfb1, zetb1, &
1572 lb2_max, lb2_min, npgfb2, rpgfb2, zetb2, &
1574 INTEGER,
INTENT(IN) :: la1_max, la1_min, npgfa1
1575 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa1, zeta1
1576 INTEGER,
INTENT(IN) :: la2_max, la2_min, npgfa2
1577 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa2, zeta2
1578 INTEGER,
INTENT(IN) :: lb1_max, lb1_min, npgfb1
1579 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb1, zetb1
1580 INTEGER,
INTENT(IN) :: lb2_max, lb2_min, npgfb2
1581 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb2, zetb2
1582 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
1583 REAL(kind=
dp),
DIMENSION(:, :, :, :), &
1584 INTENT(INOUT),
OPTIONAL :: saabb
1585 REAL(kind=
dp),
DIMENSION(:, :, :, :, :), &
1586 INTENT(INOUT),
OPTIONAL :: daabb
1588 INTEGER :: ax, ax1, ax2, ay, ay1, ay2, az, az1, az2, bx, bx1, bx2, by, by1, by2, bz, bz1, &
1589 bz2, coa1, coa2, cob1, cob2, i1pgf, i2pgf, ia1, ia2, ib1, ib2, j1pgf, j2pgf, la1, la2, &
1590 lb1, lb2, ldrr, lma, lmb, ma1, ma2, mb1, mb2, na1, na2, nb1, nb2, ofa1, ofa2, ofb1, ofb2
1591 REAL(kind=
dp) :: a, b, dumx, dumy, dumz, f0, rab2, rpgfa, &
1592 rpgfb, tab, xhi, zet
1593 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: rr
1594 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
1598 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
1602 IF (
PRESENT(saabb))
THEN
1603 lma = la1_max + la2_max
1604 lmb = lb1_max + lb2_max
1606 IF (
PRESENT(daabb))
THEN
1607 lma = la1_max + la2_max + 1
1608 lmb = lb1_max + lb2_max
1610 ldrr = max(lma, lmb) + 1
1613 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3))
1616 ofa1 =
ncoset(la1_min - 1)
1617 ofa2 =
ncoset(la2_min - 1)
1618 ofb1 =
ncoset(lb1_min - 1)
1619 ofb2 =
ncoset(lb2_min - 1)
1620 na1 =
ncoset(la1_max) - ofa1
1621 na2 =
ncoset(la2_max) - ofa2
1622 nb1 =
ncoset(lb1_max) - ofb1
1623 nb2 =
ncoset(lb2_max) - ofb2
1624 IF (
PRESENT(saabb))
THEN
1625 cpassert((
SIZE(saabb, 1) >= na1*npgfa1))
1626 cpassert((
SIZE(saabb, 2) >= na2*npgfa2))
1627 cpassert((
SIZE(saabb, 3) >= nb1*npgfb1))
1628 cpassert((
SIZE(saabb, 4) >= nb2*npgfb2))
1630 IF (
PRESENT(daabb))
THEN
1631 cpassert((
SIZE(daabb, 1) >= na1*npgfa1))
1632 cpassert((
SIZE(daabb, 2) >= na2*npgfa2))
1633 cpassert((
SIZE(daabb, 3) >= nb1*npgfb1))
1634 cpassert((
SIZE(daabb, 4) >= nb2*npgfb2))
1635 cpassert((
SIZE(daabb, 5) >= 3))
1640 DO i1pgf = 1, npgfa1
1642 DO i2pgf = 1, npgfa2
1644 rpgfa = min(rpgfa1(i1pgf), rpgfa2(i2pgf))
1645 DO j1pgf = 1, npgfb1
1647 DO j2pgf = 1, npgfb2
1648 rpgfb = min(rpgfb1(j1pgf), rpgfb2(j2pgf))
1650 IF (rpgfa + rpgfb < tab)
THEN
1651 IF (
PRESENT(saabb)) saabb(ma1 + 1:ma1 + na1, ma2 + 1:ma2 + na2, mb1 + 1:mb1 + nb1, mb2 + 1:mb2 + nb2) = 0.0_dp
1652 IF (
PRESENT(daabb)) daabb(ma1 + 1:ma1 + na1, ma2 + 1:ma2 + na2, mb1 + 1:mb1 + nb1, mb2 + 1:mb2 + nb2, 1:3) = 0.0_dp
1658 a = zeta1(i1pgf) + zeta2(i2pgf)
1659 b = zetb1(j1pgf) + zetb2(j2pgf)
1666 f0 = (
pi/zet)**(1.5_dp)*exp(-xhi*rab2)
1669 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
1671 DO lb2 = lb2_min, lb2_max
1673 DO by2 = 0, lb2 - bx2
1674 bz2 = lb2 - bx2 - by2
1675 cob2 =
coset(bx2, by2, bz2) - ofb2
1677 DO lb1 = lb1_min, lb1_max
1679 DO by1 = 0, lb1 - bx1
1680 bz1 = lb1 - bx1 - by1
1681 cob1 =
coset(bx1, by1, bz1) - ofb1
1683 DO la2 = la2_min, la2_max
1685 DO ay2 = 0, la2 - ax2
1686 az2 = la2 - ax2 - ay2
1687 coa2 =
coset(ax2, ay2, az2) - ofa2
1689 DO la1 = la1_min, la1_max
1691 DO ay1 = 0, la1 - ax1
1692 az1 = la1 - ax1 - ay1
1693 coa1 =
coset(ax1, ay1, az1) - ofa1
1696 IF (
PRESENT(saabb))
THEN
1697 saabb(ia1, ia2, ib1, ib2) = f0*rr(ax1 + ax2, bx1 + bx2, 1)* &
1698 rr(ay1 + ay2, by1 + by2, 2)*rr(az1 + az2, bz1 + bz2, 3)
1701 IF (
PRESENT(daabb))
THEN
1710 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
1711 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
1712 daabb(ia1, ia2, ib1, ib2, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
1714 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
1715 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
1716 daabb(ia1, ia2, ib1, ib2, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
1718 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
1719 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
1720 daabb(ia1, ia2, ib1, ib2, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
1747 END SUBROUTINE overlap_aabb
1777 SUBROUTINE overlap_abbb(la_max, la_min, npgfa, rpgfa, zeta, &
1778 lb1_max, lb1_min, npgfb1, rpgfb1, zetb1, &
1779 lb2_max, lb2_min, npgfb2, rpgfb2, zetb2, &
1780 lb3_max, lb3_min, npgfb3, rpgfb3, zetb3, &
1782 INTEGER,
INTENT(IN) :: la_max, la_min, npgfa
1783 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfa, zeta
1784 INTEGER,
INTENT(IN) :: lb1_max, lb1_min, npgfb1
1785 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb1, zetb1
1786 INTEGER,
INTENT(IN) :: lb2_max, lb2_min, npgfb2
1787 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb2, zetb2
1788 INTEGER,
INTENT(IN) :: lb3_max, lb3_min, npgfb3
1789 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rpgfb3, zetb3
1790 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
1791 REAL(kind=
dp),
DIMENSION(:, :, :, :), &
1792 INTENT(INOUT),
OPTIONAL :: sabbb
1793 REAL(kind=
dp),
DIMENSION(:, :, :, :, :), &
1794 INTENT(INOUT),
OPTIONAL :: dabbb
1796 INTEGER :: ax, ay, az, bx, bx1, bx2, bx3, by, by1, by2, by3, bz, bz1, bz2, bz3, coa, cob1, &
1797 cob2, cob3, ia, ib1, ib2, ib3, ipgf, j1pgf, j2pgf, j3pgf, la, lb1, lb2, lb3, ldrr, lma, &
1798 lmb, ma, mb1, mb2, mb3, na, nb1, nb2, nb3, ofa, ofb1, ofb2, ofb3
1799 REAL(kind=
dp) :: a, b, dumx, dumy, dumz, f0, rab2, rpgfb, &
1801 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: rr
1802 REAL(kind=
dp),
DIMENSION(3) :: rap, rbp
1806 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
1810 IF (
PRESENT(sabbb))
THEN
1812 lmb = lb1_max + lb2_max + lb3_max
1814 IF (
PRESENT(dabbb))
THEN
1816 lmb = lb1_max + lb2_max + lb3_max
1818 ldrr = max(lma, lmb) + 1
1821 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3))
1825 ofb1 =
ncoset(lb1_min - 1)
1826 ofb2 =
ncoset(lb2_min - 1)
1827 ofb3 =
ncoset(lb3_min - 1)
1828 na =
ncoset(la_max) - ofa
1829 nb1 =
ncoset(lb1_max) - ofb1
1830 nb2 =
ncoset(lb2_max) - ofb2
1831 nb3 =
ncoset(lb3_max) - ofb3
1832 IF (
PRESENT(sabbb))
THEN
1833 cpassert((
SIZE(sabbb, 1) >= na*npgfa))
1834 cpassert((
SIZE(sabbb, 2) >= nb1*npgfb1))
1835 cpassert((
SIZE(sabbb, 3) >= nb2*npgfb2))
1836 cpassert((
SIZE(sabbb, 4) >= nb3*npgfb3))
1838 IF (
PRESENT(dabbb))
THEN
1839 cpassert((
SIZE(dabbb, 1) >= na*npgfa))
1840 cpassert((
SIZE(dabbb, 2) >= nb1*npgfb1))
1841 cpassert((
SIZE(dabbb, 3) >= nb2*npgfb2))
1842 cpassert((
SIZE(dabbb, 4) >= nb3*npgfb3))
1843 cpassert((
SIZE(dabbb, 5) >= 3))
1850 DO j1pgf = 1, npgfb1
1852 DO j2pgf = 1, npgfb2
1854 DO j3pgf = 1, npgfb3
1856 rpgfb = min(rpgfb1(j1pgf), rpgfb2(j2pgf), rpgfb3(j3pgf))
1857 IF (rpgfa(ipgf) + rpgfb < tab)
THEN
1858 IF (
PRESENT(sabbb)) sabbb(ma + 1:ma + na, mb1 + 1:mb1 + nb1, mb2 + 1:mb2 + nb2, mb3 + 1:mb3 + nb3) = 0.0_dp
1859 IF (
PRESENT(dabbb)) dabbb(ma + 1:ma + na, mb1 + 1:mb1 + nb1, mb2 + 1:mb2 + nb2, mb3 + 1:mb3 + nb3, 1:3) = 0.0_dp
1866 b = zetb1(j1pgf) + zetb2(j2pgf) + zetb3(j3pgf)
1873 f0 = (
pi/zet)**(1.5_dp)*exp(-xhi*rab2)
1876 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
1878 DO lb3 = lb3_min, lb3_max
1880 DO by3 = 0, lb3 - bx3
1881 bz3 = lb3 - bx3 - by3
1882 cob3 =
coset(bx3, by3, bz3) - ofb3
1884 DO lb2 = lb2_min, lb2_max
1886 DO by2 = 0, lb2 - bx2
1887 bz2 = lb2 - bx2 - by2
1888 cob2 =
coset(bx2, by2, bz2) - ofb2
1890 DO lb1 = lb1_min, lb1_max
1892 DO by1 = 0, lb1 - bx1
1893 bz1 = lb1 - bx1 - by1
1894 cob1 =
coset(bx1, by1, bz1) - ofb1
1896 DO la = la_min, la_max
1900 coa =
coset(ax, ay, az) - ofa
1903 IF (
PRESENT(sabbb))
THEN
1904 sabbb(ia, ib1, ib2, ib3) = f0*rr(ax, bx1 + bx2 + bx3, 1)* &
1905 rr(ay, by1 + by2 + by3, 2)*rr(az, bz1 + bz2 + bz3, 3)
1908 IF (
PRESENT(dabbb))
THEN
1909 bx = bx1 + bx2 + bx3
1910 by = by1 + by2 + by3
1911 bz = bz1 + bz2 + bz3
1914 dumx = 2.0_dp*a*rr(ax + 1, bx, 1)
1915 IF (ax > 0) dumx = dumx - real(ax,
dp)*rr(ax - 1, bx, 1)
1916 dabbb(ia, ib1, ib2, ib3, 1) = f0*dumx*rr(ay, by, 2)*rr(az, bz, 3)
1918 dumy = 2.0_dp*a*rr(ay + 1, by, 2)
1919 IF (ay > 0) dumy = dumy - real(ay,
dp)*rr(ay - 1, by, 2)
1920 dabbb(ia, ib1, ib2, ib3, 2) = f0*rr(ax, bx, 1)*dumy*rr(az, bz, 3)
1922 dumz = 2.0_dp*a*rr(az + 1, bz, 3)
1923 IF (az > 0) dumz = dumz - real(az,
dp)*rr(az - 1, bz, 3)
1924 dabbb(ia, ib1, ib2, ib3, 3) = f0*rr(ax, bx, 1)*rr(ay, by, 2)*dumz
1951 END SUBROUTINE overlap_abbb
1966 INTEGER,
INTENT(IN) :: la
1967 REAL(kind=
dp),
INTENT(IN) :: zeta
1968 INTEGER,
INTENT(IN) :: lb
1969 REAL(kind=
dp),
INTENT(IN) :: zetb
1970 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
1971 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: sab
1973 REAL(kind=
dp),
PARAMETER :: huge4 = huge(1._dp)/4._dp
1975 INTEGER :: nca, ncb, nsa, nsb
1976 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: cab
1977 REAL(kind=
dp),
DIMENSION(1) :: rpgf, za, zb
1978 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: c2sa, c2sb
1986 ALLOCATE (cab(nca, ncb))
1990 CALL overlap_ab(la, la, 1, rpgf, za, lb, lb, 1, rpgf, zb, rab, cab)
1994 sab(1:nsa, 1:nsb) = matmul(c2sa(1:nsa, 1:nca), &
1995 matmul(cab(1:nca, 1:ncb), transpose(c2sb(1:nsb, 1:ncb))))
2014 INTEGER,
INTENT(IN) :: la
2015 REAL(kind=
dp),
INTENT(IN) :: zeta
2016 INTEGER,
INTENT(IN) :: lb
2017 REAL(kind=
dp),
INTENT(IN) :: zetb, alat
2018 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: sab
2020 COMPLEX(KIND=dp) :: zfg
2021 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: fun, gun
2022 INTEGER :: ax, ay, az, bx, by, bz, i, ia, ib, l, &
2023 l1, l2, na, nb, nca, ncb, nmax, nsa, &
2025 REAL(kind=
dp) :: oa, ob, ovol, zm
2026 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: fexp, gexp, gval
2027 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: cab
2028 REAL(kind=
dp),
DIMENSION(0:3, 0:3) :: fgsum
2029 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: c2sa, c2sb
2033 ALLOCATE (cab(nca, ncb))
2038 zm = min(zeta, zetb)
2039 nmax = nint(1.81_dp*alat*sqrt(zm) + 1.0_dp)
2040 ALLOCATE (fun(-nmax:nmax, 0:la), gun(-nmax:nmax, 0:lb), &
2041 fexp(-nmax:nmax), gexp(-nmax:nmax), gval(-nmax:nmax))
2046 gval(i) =
twopi/alat*real(i, kind=
dp)
2047 fexp(i) = sqrt(oa*
pi)*exp(-0.25_dp*oa*gval(i)**2)
2048 gexp(i) = sqrt(ob*
pi)*exp(-0.25_dp*ob*gval(i)**2)
2053 ELSEIF (l == 1)
THEN
2054 fun(:, l) = cmplx(0.0_dp, 0.5_dp*oa*gval(:), kind=
dp)
2055 ELSEIF (l == 2)
THEN
2056 fun(:, l) = cmplx(-(0.5_dp*oa*gval(:))**2, 0.0_dp, kind=
dp)
2057 fun(:, l) = fun(:, l) + cmplx(0.5_dp*oa, 0.0_dp, kind=
dp)
2058 ELSEIF (l == 3)
THEN
2059 fun(:, l) = cmplx(0.0_dp, -(0.5_dp*oa*gval(:))**3, kind=
dp)
2060 fun(:, l) = fun(:, l) + cmplx(0.0_dp, 0.75_dp*oa*oa*gval(:), kind=
dp)
2062 cpabort(
"l value too high")
2068 ELSEIF (l == 1)
THEN
2069 gun(:, l) = cmplx(0.0_dp, 0.5_dp*ob*gval(:), kind=
dp)
2070 ELSEIF (l == 2)
THEN
2071 gun(:, l) = cmplx(-(0.5_dp*ob*gval(:))**2, 0.0_dp, kind=
dp)
2072 gun(:, l) = gun(:, l) + cmplx(0.5_dp*ob, 0.0_dp, kind=
dp)
2073 ELSEIF (l == 3)
THEN
2074 gun(:, l) = cmplx(0.0_dp, -(0.5_dp*ob*gval(:))**3, kind=
dp)
2075 gun(:, l) = gun(:, l) + cmplx(0.0_dp, 0.75_dp*ob*ob*gval(:), kind=
dp)
2077 cpabort(
"l value too high")
2084 zfg = sum(conjg(fun(:, l1))*fexp(:)*gun(:, l2)*gexp(:))
2085 fgsum(l1, l2) = real(zfg, kind=
dp)
2094 ia =
coset(ax, ay, az) - na
2098 ib =
coset(bx, by, bz) - nb
2099 cab(ia, ib) = fgsum(ax, bx)*fgsum(ay, by)*fgsum(az, bz)
2107 sab(1:nsa, 1:nsb) = matmul(c2sa(1:nsa, 1:nca), &
2108 matmul(cab(1:nca, 1:ncb), transpose(c2sb(1:nsb, 1:ncb))))
2109 ovol = 1._dp/(alat**3)
2110 sab(1:nsa, 1:nsb) = ovol*sab(1:nsa, 1:nsb)
2112 DEALLOCATE (cab, fun, gun, fexp, gexp, gval)
subroutine, public os_rr_ovlp(rap, la_max, rbp, lb_max, zet, ldrr, rr)
Calculation of the basic Obara-Saika recurrence relation.
Calculation of the overlap integrals over Cartesian Gaussian-type functions.
subroutine, public overlap_ab(la_max, la_min, npgfa, rpgfa, zeta, lb_max, lb_min, npgfb, rpgfb, zetb, rab, sab, dab, ddab)
Calculation of the two-center overlap integrals [a|b] over Cartesian Gaussian-type functions....
subroutine, public overlap(la_max_set, la_min_set, npgfa, rpgfa, zeta, lb_max_set, lb_min_set, npgfb, rpgfb, zetb, rab, dab, sab, da_max_set, return_derivatives, s, lds, sdab, pab, force_a)
Purpose: Calculation of the two-center overlap integrals [a|b] over Cartesian Gaussian-type functions...
subroutine, public overlap_ab_s(la, zeta, lb, zetb, rab, sab)
Calculation of the two-center overlap integrals [a|b] over Spherical Gaussian-type functions.
subroutine, public overlap_ab_sp(la, zeta, lb, zetb, alat, sab)
Calculation of the overlap integrals [a|b] over cubic periodic Spherical Gaussian-type functions.
subroutine, public overlap_aab(la1_max, la1_min, npgfa1, rpgfa1, zeta1, la2_max, la2_min, npgfa2, rpgfa2, zeta2, lb_max, lb_min, npgfb, rpgfb, zetb, rab, saab, daab, saba, daba)
Calculation of the two-center overlap integrals [aa|b] over Cartesian Gaussian-type functions.
subroutine, public overlap_abb(la_max, la_min, npgfa, rpgfa, zeta, lb1_max, lb1_min, npgfb1, rpgfb1, zetb1, lb2_max, lb2_min, npgfb2, rpgfb2, zetb2, rab, sabb, dabb)
Calculation of the two-center overlap integrals [a|bb] over Cartesian Gaussian-type functions.
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
complex(kind=dp), parameter, public z_one
real(kind=dp), parameter, public twopi
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :, :), allocatable, public coset
integer, dimension(:), allocatable, public nso