0% found this document useful (0 votes)
9 views5 pages

Exp CCL2

Python code

Uploaded by

xyz294480
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Exp CCL2

Python code

Uploaded by

xyz294480
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment 2

Hydrogen atom
Name: Vedika (696)

import numpy as np

import matplotlib.pyplot as plt

from scipy.linalg import eig,eigh

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):

print(f"The energy eigen value for n = {i} is {ev[i]}")

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()

plt.suptitle("Wave function for different n")


plt.tight_layout()

OUTPUT:

The energy eigen value for n = 1 is -13.475237635509727

The energy eigen value for n = 2 is -3.3939511641549958

The energy eigen value for n = 3 is -1.5104957635260499

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.suptitle("Probability density for different n")

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):

x, evalue, evector = H_atom_yukawa_potential(30,1000,a[i])

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:

n a=3 a=5 a=7

1 -9.381083 -10.941449 -11.661147

2 -0.500372 -1.275352 -1.748101

3 0.257992 0.002825 -0.222768

plt.figure(figsize=(12,5))

for i in range(3):

x, evalue, evector = H_atom_yukawa_potential(10,1000,a[i])

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.suptitle("Wave function for Yukawa potential")

plt.tight_layout()
plt.figure(figsize=(12,5))

for i in range(3):

x, evalue, evector = H_atom_yukawa_potential(10,1000,a[i])

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.suptitle("Probability density for Yukawa potential")

plt.tight_layout()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy