summaryrefslogtreecommitdiff
path: root/Thermodynamics:_A_Core_Course/CH7.ipynb
blob: 71226c1e5d33a53d4d85cf288b9e86a66a560e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7:Statistical Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.1,Page number:193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.1\n",
      "\n",
      "#To find the number of ways of distributing N particles\n",
      "#Variable declaration\n",
      "N=20 \t\t\t\t#no, of particles\n",
      "N1=4 \t\t\t\t#no. of particles in E1 energy level\n",
      "N2=4 \t\t\t\t#no. of particles in E2 energy level\n",
      "N3=6 \t\t\t\t#no. of particles in E3 energy level\n",
      "N4=3 \t\t\t\t#no. of particles in E4 energy level\n",
      "N5=3 \t\t\t\t#no. of particles in E5 energy level\n",
      "import math\n",
      "#Calculation\n",
      "\t\n",
      "Nf=math.factorial(N) \n",
      "N1f=math.factorial(N1) \n",
      "N2f=math.factorial(N2) \n",
      "N3f=math.factorial(N3) \n",
      "N4f=math.factorial(N4) \n",
      "N5f=math.factorial(N5) \n",
      "n=N1f*N2f*N3f*N4f*N5f \n",
      "W=Nf/n \t\t\t#no. of ways of distributing\n",
      "#Result\n",
      "print\"The no. of ways of distributing the particles is\",W"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The no. of ways of distributing the particles is 162954792000\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2,Page number:194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.2\n",
      "#To find the fraction of molecules present in vibrational level\n",
      "#Variable declaration\n",
      "T=298.0 \t\t\t#Temperature [K]\n",
      "v=6.5*10**13 \t\t#Frequency in [sec-1]\n",
      "\t#Consider zero point energy = 0.\n",
      "h=6.627*10**-34 \t#planck's constant[J.s]\n",
      "k=1.381*10**-23 \t#Boltzmann constant \n",
      "N=1.0 \t\t\t#Since N=summation(gj*exp(-Ej/kT))\n",
      "#Calculation\n",
      "\n",
      "E1=h*v \t\t\t#for energy level 1[J]\n",
      "E2=2*h*v \t\t#for energy level 2[J]\n",
      "x=k*T \n",
      "g1=1.0 \n",
      "g2=1.0 \n",
      "import math\n",
      "N1=(g1*math.exp(-E1/x)) #molecules present in energy level 1\n",
      "N2=(g2*math.exp(-E2/x)) #molecules present in energy level 2\n",
      "n1=N1/N \t\t#fraction of molecules present in energy level 1\n",
      "n2=N2/N \t\t#fraction of molecules present in energy level 2\n",
      "#Result\n",
      "print\"The fraction of molecule  s present in energy level 1 is\",'{0:.7f}'.format(round(n1,7)) \n",
      "\n",
      "\n",
      "print\"The fraction of molecules present in energy level 2 is\",round(n2,10)   \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fraction of molecule  s present in energy level 1 is 0.0000285\n",
        "The fraction of molecules present in energy level 2 is 8e-10\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3,Page number:194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.3\n",
      "#To find the ratio of no. of particle per state for two states separated by an energy dE\n",
      "#Variable declaration\n",
      "dE=4.3*10**-20 \t\t\t#difference in energy levels[J]\n",
      "T1=0.000001 \t\t\t#Initial Temperature[K](approximately zero , needed for \t\t\t\texecution)\n",
      "T2=300 \t\t\t\t#Final Temperature[K]\n",
      "k=1.381*10**-23 \t\t#Boltzmann constant [J/K]\n",
      "import math\n",
      "#Calculation\n",
      "\t\n",
      "x1=k*T1 \n",
      "r1=math.exp(-dE/x1) \n",
      "x2=k*T2 \n",
      "r2=math.exp(-dE/x2) \n",
      "#Result\n",
      "print\"The ratio of no. of particles per state at 0K is\",r1 \n",
      "print\"The ratio of no. of particles per state at 300K is\",round(r2,6) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio of no. of particles per state at 0K is 0.0\n",
        "The ratio of no. of particles per state at 300K is 3.1e-05\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.4,Page number:195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.4\n",
      "#To find the no. of atoms in first-excited singlet state\n",
      "#Variable declaration\n",
      "T1=273.0 \t\t\t\t#[K]\n",
      "T2=14273.0 \t\t\t#[K]\n",
      "E1=-13.6 \t\t\t#Energy of ground state [eV]\n",
      "k=8.617*10.0**-5.0 \t\t\t#Boltzmann constant[eV/K]\n",
      "g2=8.0 \t\t\t\t#total no. of states with energy E2\n",
      "g1=2.0 \t\t\t\t#total no. of states with energy E1\n",
      "#Calculation\n",
      "import math\n",
      "\t\n",
      "E2=E1/(2.0**2) \t\t#Energy for n=2 (i.e.E2=E1/n2)\n",
      "x1=k*T1 \n",
      "r1=(g2/g1)*math.exp(-(E2-E1)/x1) \n",
      "x2=k*T2 \n",
      "r2=(g2/g1)*math.exp(-(E2-E1)/x2) \n",
      "#Result\n",
      "print\"The fraction of atoms present in level n=2 at 273K is\", round(r1,190)   \n",
      "print\"Therefore total 3*10**25 atoms we say   that all are present at ground state\" \n",
      "print\"\\n\\nThe fraction of atoms present in level n=2 at 14273 is\",round(r2,3) \n",
      "x=r2*3.0*10**25.0 \n",
      "print\"Therefore no. of atoms in level n=2 is\",x  \n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fraction of atoms present in level n=2 at 273K is 1.97e-188\n",
        "Therefore total 3*10**25 atoms we say   that all are present at ground state\n",
        "\n",
        "\n",
        "The fraction of atoms present in level n=2 at 14273 is 0.001\n",
        "Therefore no. of atoms in level n=2 is 3.0021673634e+22\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5,Page number:195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.5\n",
      "#To find the Temperature at this condition \n",
      "\n",
      "#Variable declaration\n",
      "r1=0.001 \t\t\t#the population of the states at a higher energy to that at a \t\t\t\tlower energy \n",
      "dE=8*10**-20 \t\t\t#The difference in energy[J]\n",
      "k=1.381*10**-23 \t\t\t#Boltzmann constant [J/K]\n",
      "\n",
      "#Calculation\n",
      "\n",
      "x=k*math.log(r1) \n",
      "T=-dE/x #[K]\n",
      "#Result\n",
      "print\"The Temperature at this condition is\",round(T,1),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Temperature at this condition is 838.6 K\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.6,Page number:196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.6\n",
      "#To find the entropy of the system\n",
      "\n",
      "#section(1)\n",
      "#Variable declaration\n",
      "#The energy levels are not degenerate \n",
      "w=1 \t\t\t#no. of ways of distributing the molecules\n",
      "k=1.381*10**-23 \t#Boltzmann constant[J/K]\n",
      "#Calculation\n",
      "import math\n",
      "\t\n",
      "S1=k*math.log(w) \t\t#Entropy of system at 0K\n",
      "print\"The Entropy of System at 0K and non-degenerate eng level is\",S1,\"J/K/mol\"\n",
      "\n",
      "#section(2)\n",
      "#Here the energy levels are degenerate\n",
      "n=2 \n",
      "R=8.314 #Universal gas constant[J/K/mol]\n",
      "\n",
      "#To find the entropy of the system\n",
      "#S=kmath.log(n**N)=>S=R*math.log(n)\n",
      "S2=R*math.log(n) #Entropy of the system[J/K/mol]\n",
      "#Result\n",
      "print\"\\nThe Entropy of system at 0K and degenerete eng level is\",round(S2,2),\"J/K/mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Entropy of System at 0K and non-degenerate eng level is 0.0 J/K/mol\n",
        "\n",
        "The Entropy of system at 0K and degenerete eng level is 5.76 J/K/mol\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.9,Page number:202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.9\n",
      "\n",
      "#To find the Transitional partition function of an oxygen molecule confined in a 1-litre \tvessel at 300K\n",
      "#Variable declaration\n",
      "V=0.001 \t\t\t#Volume of vessel[m3]\n",
      "T=300 \t\t\t\t#Temperature [K]\n",
      "k=1.381*10**-23 \t\t#Boltzmann constant[J/K]\n",
      "mol_wt=32 \t\t\t#molecular mass of oxygen molecule\n",
      "h=6.626*10**-34 \t\t#planck's constant[J.s}\n",
      "\n",
      "\n",
      "#Calculation\n",
      "\t\n",
      "m=32*1.66*(10**-27) \t\t#mass of oxygen molecule[Kg]\n",
      "x=((2*3.14*m*k*T)**(3.0/2.0))*V \n",
      "y=h**3 \n",
      "zt=x/y \t\t\t\t#Transitional partition function of an oxygen molecule\n",
      "#Result\n",
      "print\"The Transitional partition function of an oxygen molecule confined in a 1-litre vessel at 300K is\",zt\n",
      "print\"Wrongly calculated in book as 5.328*10^33\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Transitional partition function of an oxygen molecule confined in a 1-litre vessel at 300K is 1.76621948031e+29\n",
        "Wrongly calculated in book as 5.328*10^33\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.12,Page number:204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.12\n",
      "#To find the Entropy of argon at 273K and 1 atmospheric pressure\n",
      "#Variable declaration\n",
      "R=1.99 \t\t\t#Universal gas constant [cal/K]\n",
      "e=2.718 \n",
      "V=22414 \t\t#volume[cm3]\n",
      "L=6.023*10**23 \n",
      "h=6.626*10**-27 \t#Planck's constant [erg.sec]\n",
      "m=6.63*10**-23 \t\t#mass[gm]\n",
      "k=1.381*10**-16 \t#Boltzmann constant[erg/K]\n",
      "T=273.2 \t\t#Temperature[K]\n",
      "import math\n",
      "#Calculation\n",
      "\t\n",
      "x=V*(e**2.5) \n",
      "y=L*(h**3) \n",
      "z=(2*3.14*m*k*T)**1.5 \n",
      "S=R*math.log(x*z/y) #Entropy [cal/degree/mol]\n",
      "#Result\n",
      "print\"The Entropy of argon at 273K and 1 atm is\",round(S,1),\"cal/degree/mol\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Entropy of argon at 273K and 1 atm is 36.6 cal/degree/mol\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.14,Page number:207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.14\n",
      "\n",
      "#To find the rotational entropy and free energy for O2 gas\n",
      "#Variable declaration\n",
      "T=298 \t\t\t\t#Temperature[K]\n",
      "I=1.9373*10**-46 \t\t#moment of inertia of O2 gas [Kg/m2]\n",
      "h=6.626*10**-34 \t\t\t#Planck's constant[J.s]\n",
      "k=1.381*10**-23 \t\t\t#Boltzmann constant[J/K]\n",
      "R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
      "u=2 \t\t\t\t#Homonuclear diatomic molecule\n",
      "import math\n",
      "#Calculation\n",
      "\t\n",
      "Sr=R+R*math.log(8*3.14*3.14*I*k*T/(u*h*h)) #[J/K/mol]\n",
      "Gr=-R*0.001*T*math.log(8*3.14*3.14*I*k*T/(u*h*h)) #[KJ/mol]\n",
      "#Result\n",
      "print\"The rotational entropy for O2 gas is\",round(Sr,3),\"J/K/mol\"\n",
      "print\"The rotational free energy for O2 gas is\",round(Gr,3),\"KJ/mol\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rotational entropy for O2 gas is 43.826 J/K/mol\n",
        "The rotational free energy for O2 gas is -10.583 KJ/mol\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.15,Page number:208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.15\n",
      "#To find the vibrational contribution to the entropy of F2 at 298K\n",
      "#Variable declaration\n",
      "T=298 \t\t\t\t#Temperature[K]\n",
      "v=892.1*3*10**10 \t\t#frequency[sec-1]\n",
      "h=6.626*10**-27 \t\t#Planck's constant [J.s]\n",
      "k=1.381*10**-16 \t\t#Boltzmann constant[erg/K]\n",
      "e=2.718 \n",
      "R=1.998 \t\t\t#Universal gas constant[cal/K]\n",
      "\t\n",
      "#Calculation\n",
      "import math\n",
      "x=h*v/(k*T) \n",
      "a=R*x*e**-x/(1-e**-x) \t\t#a=E-Eo/T\n",
      "b=R*math.log(1-e**-x) \t\t#b=G-Eo/T\n",
      "S=a-b \t\t\t\t#[cal/deg]\n",
      "#Result\n",
      "print\"The vibrational contribution to the entropy of F2 is\",round(S,4),\"cal/deg APPROX\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The vibrational contribution to the entropy of F2 is 0.1445 cal/deg APPROX\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.16,Page number:211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.16\n",
      "#To find the equilibrium constant\n",
      "#Variable declaration\n",
      "T=1273 \t\t\t\t#Temperature[K]\n",
      "h=6.26*10**-27 \t\t\t#Planck's constant[J.s]\n",
      "k=1.381*10**-16 \t\t\t#Boltzmann constant[erg/K]\n",
      "T=1000 \t\t\t\t#Temperature[degrees]\n",
      "m=3.82*10**-23 \t\t\t#mass of Na [gm]\n",
      "I=(1.91*10**-23)*(3.078*10**-8)**2 \t#moment of inertia[gm.cm2]\n",
      "dE=0.73*1.602*10**-12 \t\t\t#[erg]\n",
      "v=159.23*(3*10**10)\t \t\t#frequency [s-1]\n",
      "R=82 \t\t\t\t\t#universal gas constant[cm3.atm/deg]\n",
      "u=2 \t\t\t\t\t#symmetry number\n",
      "L=6.023*10**23 \t\t\t\t#avogadro's number\n",
      "import math\n",
      "#Calculation\n",
      "\t\n",
      "p=((3.14*m*k*T)**1.5)/h/h/h \n",
      "s=R*u*h*h/L/8/3.14/3.14/I/k \n",
      "q=1-(math.exp(-h*v/k/T)) \n",
      "r=math.exp(-dE/k/T) \n",
      "Kp=p*s*q*r \t\t\t\t#Equilibrium constant \n",
      "#Result\n",
      "print\"The equilibrium constant is\",round(Kp,3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equilibrium constant is 0.608\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.17,Page number:212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 7.17\n",
      "#To find the equilibrium constant for isotopic exchange reaction\n",
      "#Variable declaration\n",
      "T=298.0 #Temperature[K]\n",
      "m1=32.0 \n",
      "m2=36.0 \n",
      "m3=34.0 \n",
      "u1=8.0 \n",
      "u2=9.0 \n",
      "u3=16.0*18.0/34.0 \n",
      "z1=0.99924 \n",
      "z2=0.99951 \n",
      "z3=0.99940 \n",
      "h=6.26*10**-27 #Planck's constant[J.s]\n",
      "c=3.0*10**10 #Speed of light[m/s]\n",
      "k=1.38*10**-16 #Boltzman's constant[erg/K]\n",
      "vo1=1535.8 #vibration frequency of 16O18O [cm-1]\n",
      "vo2=1580.4 #vibration frequency of 16O2 [cm-1]\n",
      "vo3=1490.0 #vibration frequency of 18O2 [cm-1]\n",
      "dE=0.5*h*c*(2*vo1-vo2-vo3) #[erg]\n",
      "r=dE/k/T \n",
      "#Calculation\n",
      "import math\n",
      "\n",
      "a=m3**3/m2**1.5/m1**1.5 \n",
      "b=(u3**2)*4/u2/u1 \n",
      "c=z3**2/z2/z1 \n",
      "Kp=a*b*c*math.exp(-r) \n",
      "#Result\n",
      "print\"The value of equilibrium constant for isotopic exchange reaction is\",round(Kp,3) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of equilibrium constant for isotopic exchange reaction is 3.996\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}