page2
In [6]:
#Cálculo de Hamiltoniano Hij=<xi| H |xj>
#Cálculo de Energía Cinética
Tij=<xi|-1/2 D^2|xj>
def Tkin(Alpha,p,q):
rnum =3 *pi**(3./2.) *Alpha[p] *Alpha[q]
rden=
(Alpha[p] + Alpha[q] )**(5./2.)
Tpq =rnum/rden
return Tpq
#Cálculo de Energía Potencial
Vij=<xi|-Z/r |xj>
def Vpot(Alpha,p,q):
Vpq=
( -2*pi)
/
(Alpha[p] + Alpha[q])
return Vpq
for i in range(0,nsize):
for jin range(i,nsize):
H[i,j]=Tkin(Alpha,i,j) + Vpot(Alpha,i,j)
H[j,i]=H[i,j]
In [7]:H
Out[7]: array([[
0.57726847,
0.07200247,
-0.3215405,
-0.43612626],
[
0.07200247,
0.50704993,
-0.98918483,
-2.37741992],
[-0.3215405,
-0.98918483,
-2.63808243,
-7.34221693],
[-0.43612626,
-2.37741992,
-7.34221693, -17.30516271]])
In [8]: # Solución autovalores generalizados (H-ES)(C)=0
#Sólo Autovalores!
Ener = eigvalsh(H,S,type=1)
Ener
Out[8]: array([ -0.49927841,
0.11321392,
2.59229957,
21.14436519])
In [9]: Ener[0]
Out[9]: -0.49927840566748505
2