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