Skip to content

Commit 75f613c

Browse files
committed
Function naming issue. Rename boys to gamma_inc.
1 parent dc37596 commit 75f613c

18 files changed

+62
-62
lines changed

code-examples/chap12/analytical_integrals/v1/coulomb_1e_MD.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
import numpy as np
44
from scipy.special import roots_hermite
55
from basis import CGTO, n_cart
6-
from rys_roots import boys as _boys
6+
from rys_roots import gamma_inc as _gamma_inc
77
from overlap_MD import get_E_tensor
88

99

1010
@lru_cache(100)
11-
def boys(n, x):
12-
return _boys(n, x)[n]
11+
def gamma_inc(n, x):
12+
return _gamma_inc(n, x)[n]
1313

1414
def get_R_tensor(l, a, rpq):
1515
@lru_cache(4000)
1616
def get_R(n, t, u, v):
1717
if t == u == v == 0:
18-
return (-2*a)**n * boys(n, a*np.array(rpq).dot(rpq))
18+
return (-2*a)**n * gamma_inc(n, a*np.array(rpq).dot(rpq))
1919
elif t < 0 or u < 0 or v < 0:
2020
return 0.
2121
elif t > 0:

code-examples/chap12/analytical_integrals/v1/eri_OS.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import List
33
import numpy as np
44
from basis import CGTO, n_cart, iter_cart_xyz
5-
from rys_roots import boys as _boys
5+
from rys_roots import gamma_inc as _gamma_inc
66

77

88
def contracted_ERI(bas_i, bas_j, bas_k, bas_l) -> np.ndarray:
@@ -29,8 +29,8 @@ def contracted_ERI(bas_i, bas_j, bas_k, bas_l) -> np.ndarray:
2929
return V
3030

3131
@lru_cache(100)
32-
def boys(n, x):
33-
return _boys(n, x)[n]
32+
def gamma_inc(n, x):
33+
return _gamma_inc(n, x)[n]
3434

3535
def primitive_ERI(li, lj, lk, ll, ai, aj, ak, al, Ra, Rb, Rc, Rd) -> np.ndarray:
3636
aij = ai + aj
@@ -78,7 +78,7 @@ def vrr(n, ix, iy, iz):
7878
val += (ix-1)*.5/aij * (vrr(n, ix-2, iy, iz) - theta/aij*vrr(n+1, ix-2, iy, iz))
7979
return val
8080

81-
return Kabcd * boys(n, theta_r2)
81+
return Kabcd * gamma_inc(n, theta_r2)
8282

8383
@lru_cache()
8484
def trr(ix, iy, iz, kx, ky, kz):
@@ -193,7 +193,7 @@ def vrr(n, ix, iy, iz):
193193
val += (ix-1)*.5/aij * (vrr(n, ix-2, iy, iz) - theta/aij*vrr(n+1, ix-2, iy, iz))
194194
return val
195195

196-
return Kabcd * boys(n, theta_r2)
196+
return Kabcd * gamma_inc(n, theta_r2)
197197

198198
@lru_cache()
199199
def trr(n, ix, iy, iz, kx, ky, kz):

code-examples/chap12/analytical_integrals/v1/rys_roots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import scipy.special
33

4-
def boys(m, t):
4+
def gamma_inc(m, t):
55
# _ 1 2
66
# / 2 m -t u
77
# F (t) = | u e du,
@@ -73,7 +73,7 @@ def schmidt_orth(moments, nroots):
7373
return np.linalg.inv(np.linalg.cholesky(s))
7474

7575
def rys_roots_weights(nroots, x):
76-
moments = boys(nroots*2, x)
76+
moments = gamma_inc(nroots*2, x)
7777
if moments[0] < 1e-16:
7878
return np.zeros(nroots), np.zeros(nroots)
7979

code-examples/chap12/analytical_integrals/v2/coulomb_1e_MD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import List
22
import numpy as np
33
from basis import CGTO, n_cart
4-
from rys_roots import boys
4+
from rys_roots import gamma_inc
55
from overlap_MD import get_E_tensor
66

77

@@ -23,7 +23,7 @@ def get_R_tensor(l, a, rpq):
2323
elif v == 1:
2424
Rt[:-1,t,u,1] = rpq[2] * Rt[1:,t,u,0]
2525
else: # t == u == v == 0
26-
Rt[:,0,0,0] = (-2*a)**np.arange(l*3+1) * boys(l*3, a*np.array(rpq).dot(rpq))
26+
Rt[:,0,0,0] = (-2*a)**np.arange(l*3+1) * gamma_inc(l*3, a*np.array(rpq).dot(rpq))
2727
return Rt[0]
2828

2929
def get_matrix(gtos: List[CGTO], Rc) -> np.ndarray:

code-examples/chap12/analytical_integrals/v2/eri_OS.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import List
33
import numpy as np
44
from basis import CGTO, n_cart, iter_cart_xyz
5-
from rys_roots import boys
5+
from rys_roots import gamma_inc
66

77

88
def contracted_ERI(bas_i, bas_j, bas_k, bas_l) -> np.ndarray:
@@ -49,15 +49,15 @@ def primitive_ERI(li, lj, lk, ll, ai, aj, ak, al, Ra, Rb, Rc, Rd) -> np.ndarray:
4949
lij = li + lj
5050
lkl = lk + ll
5151
n = lij + lkl
52-
_boys = boys(n, theta_r2)
52+
_gamma_inc = gamma_inc(n, theta_r2)
5353

5454
Xab, Yab, Zab = Rab
5555
Xcd, Ycd, Zcd = Rcd
5656
Xpq, Ypq, Zpq = Rpq
5757
Xpa, Ypa, Zpa = Rp - Ra
5858

5959
vrr = np.empty((n+1, n+1,n+1,n+1))
60-
vrr[:,0,0,0] = Kabcd * _boys
60+
vrr[:,0,0,0] = Kabcd * _gamma_inc
6161
for ix in range(n+1):
6262
for iy in range(n+1):
6363
for iz in range(n+1):

code-examples/chap12/analytical_integrals/v2/rys_roots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import math
22
import numpy as np
33

4-
def boys(m, t):
4+
def gamma_inc(m, t):
55
# _ 1 2
66
# / 2 m -t u
77
# F (t) = | u e du,
@@ -73,7 +73,7 @@ def schmidt_orth(moments, nroots):
7373
return np.linalg.inv(np.linalg.cholesky(s))
7474

7575
def rys_roots_weights(nroots, x):
76-
moments = boys(nroots*2, x)
76+
moments = gamma_inc(nroots*2, x)
7777
if moments[0] < 1e-16:
7878
return np.zeros(nroots), np.zeros(nroots)
7979

code-examples/chap12/analytical_integrals/v3/coulomb_1e_MD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import List
22
import numpy as np
33
from basis import CGTO, n_cart
4-
from rys_roots import boys
4+
from rys_roots import gamma_inc
55
from overlap_MD import get_E_tensor, reduced_cart_iter
66

77

@@ -10,7 +10,7 @@ def get_R_tensor(l, a, rpq):
1010
Rt = np.zeros((l+1, l+1, l+1, l+1))
1111
r2 = rx*rx + ry*ry + rz*rz
1212

13-
Rt[:,0,0,0] = (-2*a)**np.arange(l+1) * boys(l, a*r2)
13+
Rt[:,0,0,0] = (-2*a)**np.arange(l+1) * gamma_inc(l, a*r2)
1414
if l == 0:
1515
return Rt[0]
1616

code-examples/chap12/analytical_integrals/v3/eri_MD.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33
from basis import CGTO, n_cart, gto_offsets
44
from coulomb_1e_MD import get_R_tensor, get_E_tensor, reduced_cart_iter
5-
from rys_roots import boys
5+
from rys_roots import gamma_inc
66

77
def contracted_ERI(bas_i: CGTO, bas_j: CGTO, bas_k: CGTO, bas_l: CGTO) -> np.ndarray:
88
li, lj = bas_i.angular_momentum, bas_j.angular_momentum
@@ -46,8 +46,8 @@ def primitive_ERI(li, lj, lk, ll, ai, aj, ak, al, Ra, Rb, Rc, Rd) -> np.ndarray:
4646
theta_r2 = theta * Rpq.dot(Rpq)
4747
Kabcd = 2*np.pi**2.5/(aij*akl*(aij+akl)**.5)
4848
Kabcd *= np.exp(-theta_ij*Rab.dot(Rab) - theta_kl*Rcd.dot(Rcd))
49-
_boys = boys(0, theta_r2)
50-
return Kabcd * _boys.reshape(1,1,1,1)
49+
_gamma_inc = gamma_inc(0, theta_r2)
50+
return Kabcd * _gamma_inc.reshape(1,1,1,1)
5151

5252
Rt = get_R_tensor(l4, theta, Rpq)
5353
nfi = n_cart(li)

code-examples/chap12/analytical_integrals/v3/eri_OS.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from functools import lru_cache
22
import numpy as np
33
from basis import CGTO, n_cart, iter_cart_xyz
4-
from rys_roots import boys
4+
from rys_roots import gamma_inc
55

66
def contracted_ERI(bas_i, bas_j, bas_k, bas_l) -> np.ndarray:
77
li, lj = bas_i.angular_momentum, bas_j.angular_momentum
@@ -47,17 +47,17 @@ def primitive_ERI(li, lj, lk, ll, ai, aj, ak, al, Ra, Rb, Rc, Rd) -> np.ndarray:
4747
lij = li + lj
4848
lkl = lk + ll
4949
n = lij + lkl
50-
_boys = boys(n, theta_r2)
50+
_gamma_inc = gamma_inc(n, theta_r2)
5151
if n == 0:
52-
return Kabcd * _boys.reshape(1,1,1,1)
52+
return Kabcd * _gamma_inc.reshape(1,1,1,1)
5353

5454
Xab, Yab, Zab = Rab
5555
Xcd, Ycd, Zcd = Rcd
5656
Xpq, Ypq, Zpq = Rpq
5757
Xpa, Ypa, Zpa = Rp - Ra
5858

5959
vrr = np.empty((n+1, n+1,n+1,n+1))
60-
vrr[:,0,0,0] = Kabcd * _boys
60+
vrr[:,0,0,0] = Kabcd * _gamma_inc
6161
ix = 0
6262
iy = 0
6363
if n > 0:

code-examples/chap12/analytical_integrals/v3/rys_roots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import math
22
import numpy as np
33

4-
def boys(m, t):
4+
def gamma_inc(m, t):
55
# _ 1 2
66
# / 2 m -t u
77
# F (t) = | u e du,
@@ -82,7 +82,7 @@ def schmidt_orth(moments, nroots):
8282
return cs
8383

8484
def rys_roots_weights(nroots, x):
85-
moments = boys(nroots*2, x)
85+
moments = gamma_inc(nroots*2, x)
8686
if moments[0] < 1e-16:
8787
return np.zeros(nroots), np.zeros(nroots)
8888

code-examples/chap12/analytical_integrals/v4_cython/_tensors.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ cdef double[::1] upward(int m, double t):
4747
out[i+1] = f
4848
return out
4949

50-
cdef double[::1] boys(int m, double t):
50+
cdef double[::1] gamma_inc(int m, double t):
5151
assert m >= 0
5252
assert t >= 0
5353
if (t < m + 1.5):
@@ -109,7 +109,7 @@ cdef find_roots(double[:,::1] cs, int nroots):
109109
return roots
110110

111111
cdef rys_roots_weights(int nroots, double x):
112-
cdef double[::1] moments = boys(nroots*2, x)
112+
cdef double[::1] moments = gamma_inc(nroots*2, x)
113113
if moments[0] < 1e-16:
114114
return np.zeros(nroots), np.zeros(nroots)
115115

@@ -229,10 +229,10 @@ def get_R_tensor(int l, double a, double[:] rpq):
229229
Rt = np.zeros((l+1, l+1, l+1, l+1))
230230
cdef double [:,:,:,::1] _Rt = Rt
231231
cdef int t, u, v, m
232-
cdef double[::1] _boys = boys(l, a*r2)
232+
cdef double[::1] _gamma_inc = gamma_inc(l, a*r2)
233233

234234
for m in range(l+1):
235-
_Rt[m,0,0,0] = (-2*a)**m * _boys[m]
235+
_Rt[m,0,0,0] = (-2*a)**m * _gamma_inc[m]
236236

237237
if l == 0:
238238
return Rt[0]
@@ -299,7 +299,7 @@ def primitive_ERI_MD(int li, int lj, int lk, int ll,
299299
Kabcd = 2*M_PI**2.5/(aij*akl*(aij+akl)**.5)
300300
Kabcd *= exp(-theta_ij * square(Rab) - theta_kl * square(Rcd))
301301
eri = np.empty((1,1,1,1))
302-
eri[0,0,0,0] = Kabcd * boys(l4, theta_r2)[0]
302+
eri[0,0,0,0] = Kabcd * gamma_inc(l4, theta_r2)[0]
303303
return eri
304304

305305
cdef double[:,:,::1] Rt = get_R_tensor(l4, theta, Rpq)
@@ -358,11 +358,11 @@ def primitive_ERI_OS(int li, int lj, int lk, int ll,
358358
cdef int lij = li + lj
359359
cdef int lkl = lk + ll
360360
cdef int n = lij + lkl
361-
cdef double[::1] _boys = boys(n, theta_r2)
361+
cdef double[::1] _gamma_inc = gamma_inc(n, theta_r2)
362362

363363
if n == 0:
364364
out = np.empty((1,1,1,1))
365-
out[0,0,0,0] = Kabcd * _boys[0]
365+
out[0,0,0,0] = Kabcd * _gamma_inc[0]
366366
return out
367367

368368
cdef double Xab = Rab[0]
@@ -387,7 +387,7 @@ def primitive_ERI_OS(int li, int lj, int lk, int ll,
387387
cdef double val
388388
cdef double[:,:,:,::1] vrr = np.empty((n+1, n+1,n+1,n+1))
389389
for ni in range(n+1):
390-
vrr[ni,0,0,0] = Kabcd * _boys[ni]
390+
vrr[ni,0,0,0] = Kabcd * _gamma_inc[ni]
391391

392392
ix = 0
393393
iy = 0

code-examples/chap12/analytical_integrals/v4_numba/coulomb_1e_MD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33
import numba
44
from basis import CGTO, n_cart
5-
from rys_roots import boys
5+
from rys_roots import gamma_inc
66
from overlap_MD import get_E_tensor
77

88

@@ -12,7 +12,7 @@ def get_R_tensor(l, a, rpq):
1212
Rt = np.zeros((l+1, l+1, l+1, l+1))
1313
r2 = rx*rx + ry*ry + rz*rz
1414

15-
Rt[:,0,0,0] = (-2*a)**np.arange(l+1) * boys(l, a*r2)
15+
Rt[:,0,0,0] = (-2*a)**np.arange(l+1) * gamma_inc(l, a*r2)
1616
if l == 0:
1717
return Rt[0]
1818

code-examples/chap12/analytical_integrals/v4_numba/eri_MD.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numba
33
from basis import jitCGTO, CGTO, n_cart
44
from coulomb_1e_MD import get_R_tensor, get_E_tensor
5-
from rys_roots import boys
5+
from rys_roots import gamma_inc
66

77

88
@numba.njit
@@ -86,8 +86,8 @@ def primitive_ERI(li, lj, lk, ll, ai, aj, ak, al, Ra, Rb, Rc, Rd) -> np.ndarray:
8686
theta_r2 = theta * Rpq.dot(Rpq)
8787
Kabcd = 2*np.pi**2.5/(aij*akl*(aij+akl)**.5)
8888
Kabcd *= np.exp(-theta_ij*Rab.dot(Rab) - theta_kl*Rcd.dot(Rcd))
89-
_boys = boys(0, theta_r2)
90-
return Kabcd * _boys.reshape(1,1,1,1)
89+
_gamma_inc = gamma_inc(0, theta_r2)
90+
return Kabcd * _gamma_inc.reshape(1,1,1,1)
9191

9292
Rt = get_R_tensor(l4, theta, Rpq)
9393
nfi = n_cart(li)

code-examples/chap12/analytical_integrals/v4_numba/eri_OS.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33
import numba
44
from basis import CGTO, n_cart
5-
from rys_roots import boys
5+
from rys_roots import gamma_inc
66

77

88
def contracted_ERI(bas_i, bas_j, bas_k, bas_l) -> np.ndarray:
@@ -49,17 +49,17 @@ def primitive_ERI(li, lj, lk, ll, ai, aj, ak, al, Ra, Rb, Rc, Rd) -> np.ndarray:
4949
lij = li + lj
5050
lkl = lk + ll
5151
n = lij + lkl
52-
_boys = boys(n, theta_r2)
52+
_gamma_inc = gamma_inc(n, theta_r2)
5353
if n == 0:
54-
return _boys[:1].reshape(1,1,1,1) * Kabcd
54+
return _gamma_inc[:1].reshape(1,1,1,1) * Kabcd
5555

5656
Xab, Yab, Zab = Rab
5757
Xcd, Ycd, Zcd = Rcd
5858
Xpq, Ypq, Zpq = Rpq
5959
Xpa, Ypa, Zpa = Rp - Ra
6060

6161
vrr = np.empty((n+1, n+1,n+1,n+1))
62-
vrr[:,0,0,0] = Kabcd * _boys
62+
vrr[:,0,0,0] = Kabcd * _gamma_inc
6363
ix = 0
6464
iy = 0
6565
if n > 0:

code-examples/chap12/analytical_integrals/v4_numba/rys_roots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numba
44

55
@numba.njit(cache=True)
6-
def boys(m, t):
6+
def gamma_inc(m, t):
77
# _ 1 2
88
# / 2 m -t u
99
# F (t) = | u e du,
@@ -96,7 +96,7 @@ def poly_value1(a, order, x):
9696

9797
@numba.njit(cache=True)
9898
def rys_roots_weights(nroots, x):
99-
moments = boys(nroots*2, x)
99+
moments = gamma_inc(nroots*2, x)
100100
if moments[0] < 1e-16:
101101
return np.zeros(nroots), np.zeros(nroots)
102102

0 commit comments

Comments
 (0)