Exp CCL2
Exp CCL2
Hydrogen atom
Name: Vedika (696)
import numpy as np
import pandas as pd
#coulamb potential
def H_atom_coulomb_potential(l,N):
x = np.linspace(10**-10,l,N)
n = len(x)
h = x[1]-x[0]
V = np.diag(-1/x)
D = -1/(2*h**2)*(np.diag(np.ones(n-1),1)+np.diag(np.ones(n-1),-1)+np.diag(-2*np.ones(n)))
H = D+V
evalue,evector = eigh(H)
return x,evalue*27.22,evector
x,ev,evec = H_atom_coulomb_potential(40,200)
for i in range(1,4):
plt.figure(figsize=(8,5))
for i in range(1,5):
plt.subplot(2,2,i)
plt.plot(x,evec[:,i],label=f"n={i}")
plt.xlabel("x(a0)")
plt.ylabel(r"$\psi(x)$"
plt.grid()
plt.legend()
OUTPUT:
plt.figure(figsize=(8,5))
for i in range(1,5):
plt.subplot(2,2,i)
plt.plot(x,evec[:,i]**2,label=f"n={i}")
plt.xlabel("x(a0)")
plt.ylabel(r"$\psi(x)^2$")
plt.grid()
plt.legend()
plt.tight_layout()
YUKAWA POTENTIAL
def H_atom_yukawa_potential(l,N,a):
x = np.linspace(10**-10,l,N)
n = len(x)
h = x[1]-x[0]
V = np.diag(-np.exp(-x/a)/x)
D = -1/(2*h**2)*(np.diag(np.ones(n-1),1)+np.diag(np.ones(n-1),-1)+np.diag(-2*np.ones(n)))
H = D+V
evalue,evector = eigh(H)
return x,evalue*27.22,evector
a1 = np.array([3,5,7])
a = a1/0.529
evv = []
n = np.array([1,2,3])
for i in range(3):
evv.append(evalue[1:4])
dictio = {"n":n,"a=3":evv[0],"a=5":evv[1],"a=7":evv[2]}
df = pd.DataFrame(dictio)
df = df.to_string(index=False)
print(df)
OUTPUT:
plt.figure(figsize=(12,5))
for i in range(3):
plt.subplot(1,3,i+1)
plt.plot(x,evector[:,1],label = f"n={1}")
plt.plot(x,evector[:,2],label = f"n={2}")
plt.plot(x,evector[:,3],label = f"n={3}")
plt.legend()
plt.xlabel("r(a0)")
plt.ylabel(r"$\psi(x)$")
plt.title(f"a={np.round(a[i]*0.529,2)}")
plt.grid()
plt.figure(figsize=(15,6))
plt.tight_layout()
plt.figure(figsize=(12,5))
for i in range(3):
plt.subplot(1,3,i+1)
plt.plot(x,evector[:,1]**2,label = f"n={1}")
plt.plot(x,evector[:,2]**2,label = f"n={2}")
plt.plot(x,evector[:,3]**2,label = f"n={3}")
plt.legend()
plt.xlabel("r(a0)")
plt.ylabel(r"$\psi(x)^2$")
plt.title(f"a={np.round(a[i]*0.529,2)}")
plt.grid()
plt.tight_layout()