(git:9ccafda)
Loading...
Searching...
No Matches
ai_kinetic.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 the kinetic energy integrals over Cartesian
10!> Gaussian-type functions.
11!>
12!> [a|T|b] = [a|-nabla**2/2|b]
13!> \par Literature
14!> S. Obara and A. Saika, J. Chem. Phys. 84, 3963 (1986)
15!> \par History
16!> - Derivatives added (10.05.2002,MK)
17!> - Fully refactored (07.07.2014,JGH)
18!> \author Matthias Krack (31.07.2000)
19! **************************************************************************************************
22 USE ai_os_rr, ONLY: os_rr_ovlp
23 USE kinds, ONLY: dp
24 USE mathconstants, ONLY: pi
25 USE orbital_pointers, ONLY: indco,&
26 ncoset
27#include "../base/base_uses.f90"
28
29 IMPLICIT NONE
30
31 PRIVATE
32
33 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'ai_kinetic'
34
35! *** Public subroutines ***
36
37 PUBLIC :: kinetic
38
39CONTAINS
40
41! **************************************************************************************************
42!> \brief Calculation of the two-center kinetic energy integrals [a|T|b] over
43!> Cartesian Gaussian-type functions.
44!> \param la_max Maximum L of basis on A
45!> \param la_min Minimum L of basis on A
46!> \param npgfa Number of primitive functions in set of basis on A
47!> \param rpgfa Range of functions on A (used for prescreening)
48!> \param zeta Exponents of basis on center A
49!> \param lb_max Maximum L of basis on A
50!> \param lb_min Minimum L of basis on A
51!> \param npgfb Number of primitive functions in set of basis on B
52!> \param rpgfb Range of functions on B (used for prescreening)
53!> \param zetb Exponents of basis on center B
54!> \param rab Distance vector between centers A and B
55!> \param kab Kinetic energy integrals, optional
56!> \param dab First derivatives of Kinetic energy integrals, optional
57!> \date 07.07.2014
58!> \author JGH
59! **************************************************************************************************
60 SUBROUTINE kinetic(la_max, la_min, npgfa, rpgfa, zeta, &
61 lb_max, lb_min, npgfb, rpgfb, zetb, &
62 rab, kab, dab)
63 INTEGER, INTENT(IN) :: la_max, la_min, npgfa
64 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: rpgfa, zeta
65 INTEGER, INTENT(IN) :: lb_max, lb_min, npgfb
66 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: rpgfb, zetb
67 REAL(kind=dp), DIMENSION(3), INTENT(IN) :: rab
68 REAL(kind=dp), DIMENSION(:, :), INTENT(INOUT), &
69 OPTIONAL :: kab
70 REAL(kind=dp), DIMENSION(:, :, :), INTENT(INOUT), &
71 OPTIONAL :: dab
72
73 INTEGER :: avec(3), bvec(3), coa, cob, ia, ib, &
74 idir, ipgf, jdir, jpgf, kdir, ldrr, &
75 lma, lmb, ma, mb, na, nb, ofa, ofb
76 REAL(kind=dp) :: a, b, f0, rab2, tab, xhi, zet
77 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: drr, dtt, rr, tt
78 REAL(kind=dp), DIMENSION(3) :: rap, rbp
79
80 cpassert(PRESENT(kab) .OR. PRESENT(dab))
81
82! Distance of the centers a and b
83
84 rab2 = rab(1)*rab(1) + rab(2)*rab(2) + rab(3)*rab(3)
85 tab = sqrt(rab2)
86
87 ! Maximum l for auxiliary integrals
88 IF (PRESENT(kab)) THEN
89 lma = la_max + 1
90 lmb = lb_max + 1
91 END IF
92 IF (PRESENT(dab)) THEN
93 lma = la_max + 2
94 lmb = lb_max + 1
95 END IF
96 ldrr = max(lma, lmb) + 1
97
98 ! Allocate space for auxiliary integrals
99 ALLOCATE (rr(0:ldrr - 1, 0:ldrr - 1, 3), tt(0:ldrr - 1, 0:ldrr - 1, 3), &
100 drr(0:ldrr - 1, 0:ldrr - 1, 3))
101 IF (PRESENT(dab)) ALLOCATE (dtt(0:ldrr - 1, 0:ldrr - 1, 3))
102
103 ! Number of integrals, check size of arrays
104 ofa = ncoset(la_min - 1)
105 ofb = ncoset(lb_min - 1)
106 na = ncoset(la_max) - ofa
107 nb = ncoset(lb_max) - ofb
108 IF (PRESENT(kab)) THEN
109 cpassert((SIZE(kab, 1) >= na*npgfa))
110 cpassert((SIZE(kab, 2) >= nb*npgfb))
111 END IF
112 IF (PRESENT(dab)) THEN
113 cpassert((SIZE(dab, 1) >= na*npgfa))
114 cpassert((SIZE(dab, 2) >= nb*npgfb))
115 cpassert((SIZE(dab, 3) >= 3))
116 END IF
117
118 ! Loops over all pairs of primitive Gaussian-type functions
119 ma = 0
120 DO ipgf = 1, npgfa
121 mb = 0
122 DO jpgf = 1, npgfb
123 ! Distance Screening
124 IF (rpgfa(ipgf) + rpgfb(jpgf) < tab) THEN
125 IF (PRESENT(kab)) kab(ma + 1:ma + na, mb + 1:mb + nb) = 0.0_dp
126 IF (PRESENT(dab)) dab(ma + 1:ma + na, mb + 1:mb + nb, 1:3) = 0.0_dp
127 mb = mb + nb
128 cycle
129 END IF
130
131 ! Calculate some prefactors
132 a = zeta(ipgf)
133 b = zetb(jpgf)
134 zet = a + b
135 xhi = a*b/zet
136 rap = b*rab/zet
137 rbp = -a*rab/zet
138
139 ! [s|s] integral
140 f0 = 0.5_dp*(pi/zet)**(1.5_dp)*exp(-xhi*rab2)
141
142 ! Calculate the recurrence relation, overlap
143 CALL os_rr_ovlp(rap, lma, rbp, lmb, zet, ldrr, rr)
144
145 ! Mixed center derivatives give the overlap of the two electronic gradients.
146 CALL apply_cartesian_1d(rr, drr, lma - 1, lmb, .false., .true., a, [0.0_dp, 0.0_dp, 0.0_dp])
147 CALL apply_cartesian_1d(drr, tt, lma - 1, lmb - 1, .true., .true., b, [0.0_dp, 0.0_dp, 0.0_dp])
148 IF (PRESENT(dab)) THEN
149 CALL apply_cartesian_1d(tt, dtt, la_max, lb_max, .false., .true., a, [0.0_dp, 0.0_dp, 0.0_dp])
150 END IF
151
152 DO cob = ofb + 1, ncoset(lb_max)
153 bvec = indco(:, cob)
154 ib = mb + cob - ofb
155 DO coa = ofa + 1, ncoset(la_max)
156 avec = indco(:, coa)
157 ia = ma + coa - ofa
158 IF (PRESENT(kab)) kab(ia, ib) = 0.0_dp
159 DO idir = 1, 3
160 jdir = mod(idir, 3) + 1
161 kdir = mod(idir + 1, 3) + 1
162 IF (PRESENT(kab)) THEN
163 kab(ia, ib) = kab(ia, ib) + tt(avec(idir), bvec(idir), idir)* &
164 rr(avec(jdir), bvec(jdir), jdir)*rr(avec(kdir), bvec(kdir), kdir)
165 END IF
166 IF (PRESENT(dab)) THEN
167 dab(ia, ib, idir) = dtt(avec(idir), bvec(idir), idir)* &
168 rr(avec(jdir), bvec(jdir), jdir)*rr(avec(kdir), bvec(kdir), kdir) + &
169 drr(avec(idir), bvec(idir), idir)* &
170 (tt(avec(jdir), bvec(jdir), jdir)*rr(avec(kdir), bvec(kdir), kdir) + &
171 rr(avec(jdir), bvec(jdir), jdir)*tt(avec(kdir), bvec(kdir), kdir))
172 END IF
173 END DO
174 IF (PRESENT(kab)) kab(ia, ib) = f0*kab(ia, ib)
175 IF (PRESENT(dab)) dab(ia, ib, 1:3) = f0*dab(ia, ib, 1:3)
176 END DO
177 END DO
178
179 mb = mb + nb
180 END DO
181 ma = ma + na
182 END DO
183
184 DEALLOCATE (rr, tt)
185
186 END SUBROUTINE kinetic
187
188END MODULE ai_kinetic
Coordinate and basis-center derivative ladders for Cartesian Gaussian integrals. Derivatives act on a...
Calculation of the kinetic energy integrals over Cartesian Gaussian-type functions.
Definition ai_kinetic.F:20
subroutine, public kinetic(la_max, la_min, npgfa, rpgfa, zeta, lb_max, lb_min, npgfb, rpgfb, zetb, rab, kab, dab)
Calculation of the two-center kinetic energy integrals [a|T|b] over Cartesian Gaussian-type functions...
Definition ai_kinetic.F:63
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
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :), allocatable, public indco