(git:3f0d10b)
Loading...
Searching...
No Matches
ai_operator_ra2m.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 Calculation of integrals over Cartesian Gaussian-type functions for [a|(r-Ra)^(2m)|b]
10!> Ra is the position of center a
11!> \par Literature
12!> S. Obara and A. Saika, J. Chem. Phys. 84, 3963 (1986)
13!> \par History
14!> none
15!> \par Parameters
16!> - ax,ay,az : Angular momentum index numbers of orbital a.
17!> - cx,cy,cz : Angular momentum index numbers of orbital c.
18!> - coset : Cartesian orbital set pointer.
19!> - dac : Distance between the atomic centers a and c.
20!> - l{a,c} : Angular momentum quantum number of shell a or c.
21!> - l{a,c}_max : Maximum angular momentum quantum number of shell a or c.
22!> - l{a,c}_min : Minimum angular momentum quantum number of shell a or c.
23!> - ncoset : Number of orbitals in a Cartesian orbital set.
24!> - npgf{a,c} : Degree of contraction of shell a or c.
25!> - rac : Distance vector between the atomic centers a and c.
26!> - rac2 : Square of the distance between the atomic centers a and c.
27!> - zet{a,c} : Exponents of the Gaussian-type functions a or c.
28!> - zetp : Reciprocal of the sum of the exponents of orbital a and b.
29!> - zetw : Reciprocal of the sum of the exponents of orbital a and c.
30!> \author Dorothea Golze (08.2016)
31! **************************************************************************************************
33
36 USE ai_os_rr, ONLY: os_rr_ovlp
37 USE kinds, ONLY: dp
38 USE mathconstants, ONLY: fac,&
39 pi
40 USE orbital_pointers, ONLY: indco,&
41 ncoset
42#include "../base/base_uses.f90"
43
44 IMPLICIT NONE
45 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'ai_operator_ra2m'
46
47 PRIVATE
48
49 ! *** Public subroutines ***
50
51 PUBLIC :: operator_ra2m
52
53! **************************************************************************************************
54
55CONTAINS
56
57! **************************************************************************************************
58!> \brief Calculation of the primitive two-center [a|(r-Ra)^(2m)|b] integrals over Cartesian
59!> Gaussian-type functions; operator is here (r-Ra)^(2m)
60!> \param la_max ...
61!> \param la_min ...
62!> \param npgfa ...
63!> \param zeta ...
64!> \param lb_max ...
65!> \param lb_min ...
66!> \param npgfb ...
67!> \param zetb ...
68!> \param m exponent in (r-Ra)^(2m) operator
69!> \param rab ...
70!> \param sab ...
71!> \param dsab ...
72!> \param calculate_forces ...
73! **************************************************************************************************
74 SUBROUTINE operator_ra2m(la_max, la_min, npgfa, zeta, &
75 lb_max, lb_min, npgfb, zetb, m, rab, sab, dsab, calculate_forces)
76 INTEGER, INTENT(IN) :: la_max, la_min, npgfa
77 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: zeta
78 INTEGER, INTENT(IN) :: lb_max, lb_min, npgfb
79 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: zetb
80 INTEGER, INTENT(IN) :: m
81 REAL(kind=dp), DIMENSION(3), INTENT(IN) :: rab
82 REAL(kind=dp), DIMENSION(:, :), INTENT(INOUT) :: sab
83 REAL(kind=dp), DIMENSION(:, :, :), INTENT(INOUT) :: dsab
84 LOGICAL, INTENT(IN) :: calculate_forces
85
86 CHARACTER(LEN=*), PARAMETER :: routinen = 'operator_ra2m'
87
88 INTEGER :: ax, ay, az, bx, by, bz, coa, cob, &
89 handle, i, ia, ib, ipgf, j, jpgf, k, &
90 ldrr, lma, ma, mb, na, nb, ofa, ofb, &
91 powers(0:m)
92 REAL(kind=dp) :: a, b, f0, prefac, rab2, rap(3), rbp(3), &
93 weights(0:m, 0:m), zet
94 REAL(kind=dp), ALLOCATABLE :: dpolynomial(:, :, :, :), drr(:, :, :), &
95 polynomial(:, :, :, :), rr(:, :, :)
96
97 CALL timeset(routinen, handle)
98 sab = 0.0_dp
99 IF (calculate_forces) dsab = 0.0_dp
100 rab2 = norm2(rab)**2
101 lma = la_max + 2*m
102 IF (calculate_forces) lma = lma + 1
103 ldrr = max(lma, lb_max) + 1
104 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3), polynomial(0:la_max, 0:lb_max, 0:m, 3))
105 IF (calculate_forces) THEN
106 ALLOCATE (drr(0:ldrr - 1, 0:ldrr - 1, 3), dpolynomial(0:la_max, 0:lb_max, 0:m, 3))
107 END IF
108 powers = [(2*i, i=0, m)]
109 DO i = 0, m
110 DO j = 0, m - i
111 k = m - i - j
112 weights(i, j) = fac(m)/fac(i)/fac(j)/fac(k)
113 END DO
114 END DO
115 ofa = ncoset(la_min - 1)
116 ofb = ncoset(lb_min - 1)
117 na = ncoset(la_max) - ofa
118 nb = ncoset(lb_max) - ofb
119 cpassert(SIZE(sab, 1) >= na*npgfa .AND. SIZE(sab, 2) >= nb*npgfb)
120
121 DO ipgf = 1, npgfa
122 ma = (ipgf - 1)*na
123 DO jpgf = 1, npgfb
124 mb = (jpgf - 1)*nb
125 a = zeta(ipgf)
126 b = zetb(jpgf)
127 zet = a + b
128 rap = b*rab/zet
129 rbp = -a*rab/zet
130 f0 = (pi/zet)**1.5_dp*exp(-a*b*rab2/zet)
131 CALL os_rr_ovlp(rap, lma, rbp, lb_max, zet, ldrr, rr)
132 CALL cartesian_polynomial_1d(rr, polynomial, la_max, lb_max, powers, [0.0_dp, 0.0_dp, 0.0_dp])
133 IF (calculate_forces) THEN
134 ! The origin moves with A: differentiate the combined Gaussian degree first.
135 ! Raising that derivative includes both basis and operator-origin contributions.
136 CALL apply_cartesian_1d(rr, drr, la_max + 2*m, lb_max, .false., .true., a, &
137 [0.0_dp, 0.0_dp, 0.0_dp])
138 CALL cartesian_polynomial_1d(drr, dpolynomial, la_max, lb_max, powers, [0.0_dp, 0.0_dp, 0.0_dp])
139 END IF
140
141 DO cob = ofb + 1, ncoset(lb_max)
142 bx = indco(1, cob)
143 by = indco(2, cob)
144 bz = indco(3, cob)
145 ib = mb + cob - ofb
146 DO coa = ofa + 1, ncoset(la_max)
147 ax = indco(1, coa)
148 ay = indco(2, coa)
149 az = indco(3, coa)
150 ia = ma + coa - ofa
151 DO i = 0, m
152 DO j = 0, m - i
153 k = m - i - j
154 prefac = weights(i, j)*f0
155 sab(ia, ib) = sab(ia, ib) + prefac*polynomial(ax, bx, i, 1)* &
156 polynomial(ay, by, j, 2)*polynomial(az, bz, k, 3)
157 IF (calculate_forces) THEN
158 dsab(ia, ib, 1) = dsab(ia, ib, 1) + prefac*dpolynomial(ax, bx, i, 1)* &
159 polynomial(ay, by, j, 2)*polynomial(az, bz, k, 3)
160 dsab(ia, ib, 2) = dsab(ia, ib, 2) + prefac*polynomial(ax, bx, i, 1)* &
161 dpolynomial(ay, by, j, 2)*polynomial(az, bz, k, 3)
162 dsab(ia, ib, 3) = dsab(ia, ib, 3) + prefac*polynomial(ax, bx, i, 1)* &
163 polynomial(ay, by, j, 2)*dpolynomial(az, bz, k, 3)
164 END IF
165 END DO
166 END DO
167 END DO
168 END DO
169 END DO
170 END DO
171 CALL timestop(handle)
172 END SUBROUTINE operator_ra2m
173
174END MODULE ai_operator_ra2m
Coordinate and basis-center derivative ladders for Cartesian Gaussian integrals. Derivatives act on a...
subroutine, public cartesian_polynomial_1d(source, values, la_max, lb_max, powers, origin)
Form requested coordinate powers from separable Cartesian integral tables. Only requested powers are ...
Calculation of integrals over Cartesian Gaussian-type functions for [a|(r-Ra)^(2m)|b] Ra is the posit...
subroutine, public operator_ra2m(la_max, la_min, npgfa, zeta, lb_max, lb_min, npgfb, zetb, m, rab, sab, dsab, calculate_forces)
Calculation of the primitive two-center [a|(r-Ra)^(2m)|b] integrals over Cartesian Gaussian-type func...
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), dimension(0:maxfac), parameter, public fac
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :), allocatable, public indco