N=20 #no, of particles
N1=4 #no. of particles in E1 energy level
N2=4 #no. of particles in E2 energy level
N3=6 #no. of particles in E3 energy level
N4=3 #no. of particles in E4 energy level
N5=3 #no. of particles in E5 energy level
import math
Nf=math.factorial(N)
N1f=math.factorial(N1)
N2f=math.factorial(N2)
N3f=math.factorial(N3)
N4f=math.factorial(N4)
N5f=math.factorial(N5)
n=N1f*N2f*N3f*N4f*N5f
W=Nf/n #no. of ways of distributing
print"The no. of ways of distributing the particles is",W
T=298.0 #Temperature [K]
v=6.5*10**13 #Frequency in [sec-1]
#Consider zero point energy = 0.
h=6.627*10**-34 #planck's constant[J.s]
k=1.381*10**-23 #Boltzmann constant
N=1.0 #Since N=summation(gj*exp(-Ej/kT))
E1=h*v #for energy level 1[J]
E2=2*h*v #for energy level 2[J]
x=k*T
g1=1.0
g2=1.0
import math
N1=(g1*math.exp(-E1/x)) #molecules present in energy level 1
N2=(g2*math.exp(-E2/x)) #molecules present in energy level 2
n1=N1/N #fraction of molecules present in energy level 1
n2=N2/N #fraction of molecules present in energy level 2
print"The fraction of molecule s present in energy level 1 is",'{0:.7f}'.format(round(n1,7))
print"The fraction of molecules present in energy level 2 is",round(n2,10)
dE=4.3*10**-20 #difference in energy levels[J]
T1=0.000001 #Initial Temperature[K](approximately zero , needed for execution)
T2=300 #Final Temperature[K]
k=1.381*10**-23 #Boltzmann constant [J/K]
import math
x1=k*T1
r1=math.exp(-dE/x1)
x2=k*T2
r2=math.exp(-dE/x2)
print"The ratio of no. of particles per state at 0K is",r1
print"The ratio of no. of particles per state at 300K is",round(r2,6)
T1=273.0 #[K]
T2=14273.0 #[K]
E1=-13.6 #Energy of ground state [eV]
k=8.617*10.0**-5.0 #Boltzmann constant[eV/K]
g2=8.0 #total no. of states with energy E2
g1=2.0 #total no. of states with energy E1
import math
E2=E1/(2.0**2) #Energy for n=2 (i.e.E2=E1/n2)
x1=k*T1
r1=(g2/g1)*math.exp(-(E2-E1)/x1)
x2=k*T2
r2=(g2/g1)*math.exp(-(E2-E1)/x2)
print"The fraction of atoms present in level n=2 at 273K is", round(r1,190)
print"Therefore total 3*10**25 atoms we say that all are present at ground state"
print"\n\nThe fraction of atoms present in level n=2 at 14273 is",round(r2,3)
x=r2*3.0*10**25.0
print"Therefore no. of atoms in level n=2 is",x
r1=0.001 #the population of the states at a higher energy to that at a lower energy
dE=8*10**-20 #The difference in energy[J]
k=1.381*10**-23 #Boltzmann constant [J/K]
x=k*math.log(r1)
T=-dE/x #[K]
print"The Temperature at this condition is",round(T,1),"K"
w=1 #no. of ways of distributing the molecules
k=1.381*10**-23 #Boltzmann constant[J/K]
import math
S1=k*math.log(w) #Entropy of system at 0K
print"The Entropy of System at 0K and non-degenerate eng level is",S1,"J/K/mol"
n=2
R=8.314 #Universal gas constant[J/K/mol]
S2=R*math.log(n) #Entropy of the system[J/K/mol]
print"\nThe Entropy of system at 0K and degenerete eng level is",round(S2,2),"J/K/mol"
V=0.001 #Volume of vessel[m3]
T=300 #Temperature [K]
k=1.381*10**-23 #Boltzmann constant[J/K]
mol_wt=32 #molecular mass of oxygen molecule
h=6.626*10**-34 #planck's constant[J.s}
m=32*1.66*(10**-27) #mass of oxygen molecule[Kg]
x=((2*3.14*m*k*T)**(3.0/2.0))*V
y=h**3
zt=x/y #Transitional partition function of an oxygen molecule
print"The Transitional partition function of an oxygen molecule confined in a 1-litre vessel at 300K is",zt
print"Wrongly calculated in book as 5.328*10^33"
R=1.99 #Universal gas constant [cal/K]
e=2.718
V=22414 #volume[cm3]
L=6.023*10**23
h=6.626*10**-27 #Planck's constant [erg.sec]
m=6.63*10**-23 #mass[gm]
k=1.381*10**-16 #Boltzmann constant[erg/K]
T=273.2 #Temperature[K]
import math
x=V*(e**2.5)
y=L*(h**3)
z=(2*3.14*m*k*T)**1.5
S=R*math.log(x*z/y) #Entropy [cal/degree/mol]
print"The Entropy of argon at 273K and 1 atm is",round(S,1),"cal/degree/mol"
T=298 #Temperature[K]
I=1.9373*10**-46 #moment of inertia of O2 gas [Kg/m2]
h=6.626*10**-34 #Planck's constant[J.s]
k=1.381*10**-23 #Boltzmann constant[J/K]
R=8.314 #Universal gas constant[J/K/mol]
u=2 #Homonuclear diatomic molecule
import math
Sr=R+R*math.log(8*3.14*3.14*I*k*T/(u*h*h)) #[J/K/mol]
Gr=-R*0.001*T*math.log(8*3.14*3.14*I*k*T/(u*h*h)) #[KJ/mol]
print"The rotational entropy for O2 gas is",round(Sr,3),"J/K/mol"
print"The rotational free energy for O2 gas is",round(Gr,3),"KJ/mol"
T=298 #Temperature[K]
v=892.1*3*10**10 #frequency[sec-1]
h=6.626*10**-27 #Planck's constant [J.s]
k=1.381*10**-16 #Boltzmann constant[erg/K]
e=2.718
R=1.998 #Universal gas constant[cal/K]
import math
x=h*v/(k*T)
a=R*x*e**-x/(1-e**-x) #a=E-Eo/T
b=R*math.log(1-e**-x) #b=G-Eo/T
S=a-b #[cal/deg]
print"The vibrational contribution to the entropy of F2 is",round(S,4),"cal/deg APPROX"
T=1273 #Temperature[K]
h=6.26*10**-27 #Planck's constant[J.s]
k=1.381*10**-16 #Boltzmann constant[erg/K]
T=1000 #Temperature[degrees]
m=3.82*10**-23 #mass of Na [gm]
I=(1.91*10**-23)*(3.078*10**-8)**2 #moment of inertia[gm.cm2]
dE=0.73*1.602*10**-12 #[erg]
v=159.23*(3*10**10) #frequency [s-1]
R=82 #universal gas constant[cm3.atm/deg]
u=2 #symmetry number
L=6.023*10**23 #avogadro's number
import math
p=((3.14*m*k*T)**1.5)/h/h/h
s=R*u*h*h/L/8/3.14/3.14/I/k
q=1-(math.exp(-h*v/k/T))
r=math.exp(-dE/k/T)
Kp=p*s*q*r #Equilibrium constant
print"The equilibrium constant is",round(Kp,3)
T=298.0 #Temperature[K]
m1=32.0
m2=36.0
m3=34.0
u1=8.0
u2=9.0
u3=16.0*18.0/34.0
z1=0.99924
z2=0.99951
z3=0.99940
h=6.26*10**-27 #Planck's constant[J.s]
c=3.0*10**10 #Speed of light[m/s]
k=1.38*10**-16 #Boltzman's constant[erg/K]
vo1=1535.8 #vibration frequency of 16O18O [cm-1]
vo2=1580.4 #vibration frequency of 16O2 [cm-1]
vo3=1490.0 #vibration frequency of 18O2 [cm-1]
dE=0.5*h*c*(2*vo1-vo2-vo3) #[erg]
r=dE/k/T
import math
a=m3**3/m2**1.5/m1**1.5
b=(u3**2)*4/u2/u1
c=z3**2/z2/z1
Kp=a*b*c*math.exp(-r)
print"The value of equilibrium constant for isotopic exchange reaction is",round(Kp,3)