I want to calculate the overlap integral (S), I made the code, but it is only worked when I use a basis function that describe 1s and when I include 2s orbital, I start to get error. The First Problem is solved as Tyberius said in the comments, But I still got wrong overlap integral. I noticed that the error is because that part of my equation is not like what I should get. In details, Here what I have for example in zeta.txt.
#it is the zeta from the basis function description
18.7311370000
2.8253937000
0.6401217000
0.1612778000
18.7311370000
2.8253937000
0.6401217000
0.1612778000
My code below when I print(float(zetas[k])), I got most of the number correct but some of them are wrong, so what should be the error ?
nb = 4
S = np.zeros([nb,nb]) # nb is the number of basis set and I have it in the code
print(distancess) # where distancess is an array that contains the coordinate
# here is the shape of distancess = [[0.0, 0.0, 0.0], [0.0, 0.0, 1.3999091131307069]]
print(nprim) #is an array that contains the number of primitive for each basis function
# nprim = [3, 1, 3, 1]
with open("zeta.txt","r") as z_inp:
with open("cijk.txt","r") as cijk_inp:
zetas = z_inp.readlines()
cijk = cijk_inp.readlines()
for i in range(nb):
for j in range(nb):
n_prim_i = nprim[i]
n_prim_j = nprim[j]
for k in range(n_prim_i):
for l in range(n_prim_j):
Q = distancess[atom_for_basis[i]] -
distancess[atom_for_basis[j]]
Q2 = np.dot(Q,Q)
zetazeta = float(zetas[k]) + float(zetas[l])
print(float(zetas[k]))
zi = float(zetas[k]) *
float(zetas[l]) / zetazeta
c1c2 = float(cijk[k]) *
float(cijk[l])
gaussint = ((math.pi/zetazeta))**(3/2)
prefac = math.exp(-zi*Q2)
S[i,j] += c1c2 * prefac * gaussint
print(S)
The output from my code for print(float(zetas[k])) is,
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
18.731137
The output that should I get for print(float(zetas[k])).
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
18.731137
18.731137
18.731137
2.8253937
2.8253937
2.8253937
0.6401217
0.6401217
0.6401217
18.731137
2.8253937
0.6401217
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778
0.1612778