summaryrefslogtreecommitdiff
path: root/Thermodynamics,_Statistical_Thermodynamics,_&_Kinetics/Chapter14.ipynb
blob: daf732e9a9a7675b5b1d7dc8af1a4bde409928ab (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:1671a89ef38b6b7afbc72d0d6b374367e1ac4b1abd5ab2d480c98bd2b6a92ca8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14: Ensemble and Molecular Partition Function"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.1, Page Number 332"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "l = 0.01           #Box length, m \n",
      "n1,n2 = 2,1        #Energy levels states\n",
      "m = 5.31e-26       #mass of oxygen molecule, kg\n",
      "\n",
      "#Calculations \n",
      "dE = (n1+n2)*h**2/(8*m*l**2)\n",
      "dEcm = dE/(h*c*1e2)\n",
      "#Results\n",
      "print 'Difference in energy levels is %3.2e J or %3.2e 1/cm'%(dE,dEcm)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Difference in energy levels is 3.10e-38 J or 1.56e-15\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.2, Page Number 333"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi, sqrt\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "v = 1.0            #Volume, L\n",
      "T = 298.0          #Temeprature of Ar, K\n",
      "m = 6.63e-26       #Mass of Argon molecule, kg \n",
      "\n",
      "#Calculations \n",
      "GAMA = h/sqrt(2*pi*m*k*T)\n",
      "v = v*1e-3\n",
      "qT3D = v/GAMA**3\n",
      "\n",
      "#Results\n",
      "print 'Thermal wave length is %3.2e m and\\nTranslational partition function is %3.2e'%(GAMA,qT3D)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal wave length is 1.60e-11 m and\n",
        "Translational partition function is 2.44e+29\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.4, Page Number 338"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi, sqrt\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "J = 4              #Rotational energy level\n",
      "B = 8.46           #Spectrum, 1/cm\n",
      "\n",
      "#Calculations \n",
      "T = (2*J+1)**2*h*c*100*B/(2*k)\n",
      "#Results\n",
      "print 'Spectrum will be observed at %4.0f K'%(T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Spectrum will be observed at  494 K\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.5, Page Number 340"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "B = 60.589         #Spectrum for H2, 1/cm\n",
      "T = 1000           #Temperture of Hydrogen, K\n",
      "#Calculations \n",
      "qR = k*T/(2*h*c*100*B)\n",
      "qRs = 0.0\n",
      "#for J in range(101):\n",
      "#    print J\n",
      "#    if (J%2 == 0):\n",
      "#        qRs = qRs + (2*J+1)*exp(-h*c*100*B*J*(J+1)/(k*T)\n",
      "#    else:\n",
      "#        qRs = qRs + 3*(2*J+1)*exp(-h*c*100*B*J*(J+1)/(k*T))\n",
      "#print qRs/4\n",
      "\n",
      "#Results\n",
      "print 'Rotation partition function of H2 at %4.0f is %4.3f'%(T,qR)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rotation partition function of H2 at 1000 is 5.729\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.6, Page Number 341"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "B = 0.0374         #Spectrum for H2, 1/cm\n",
      "T = 100.0          #Temperture of Hydrogen, K\n",
      "sigma = 2.\n",
      "#Calculations\n",
      "ThetaR = h*c*100*B/k\n",
      "qR = T/(sigma*ThetaR)\n",
      "\n",
      "#Results\n",
      "print 'Rotation partition function of H2 at %4.0f K is %4.3f'%(T,qR)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rotation partition function of H2 at  100 K is 928.121\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.7, Page Number 342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi, sqrt\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "Ba = 1.48                        #Spectrum for OCS, 1/cm\n",
      "Bb = [2.84,0.191,0.179]          #Spectrum for ONCI, 1/cm\n",
      "Bc = [9.40,1.29,1.13]            #Spectrum for CH2O, 1/cm\n",
      "T = 298.0                        #Temperture of Hydrogen, K\n",
      "sigmab = 1\n",
      "sigmac = 2\n",
      "\n",
      "#Calculations\n",
      "qRa = k*T/(h*c*100*Ba)\n",
      "qRb = (sqrt(pi)/sigmab)*(k*T/(h*c*100))**(3./2)*sqrt(1/Bb[0])*sqrt(1/Bb[1])*sqrt(1/Bb[2])\n",
      "qRc = (sqrt(pi)/sigmac)*(k*T/(h*c*100))**(3./2)*sqrt(1/Bc[0])*sqrt(1/Bc[1])*sqrt(1/Bc[2])\n",
      "\n",
      "#Results\n",
      "print 'Rotation partition function for OCS, ONCI, CH2O at %4.0f K are %4.0f, %4.0f, and %4.0f respectively'%(T,qRa,qRb,qRc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rotation partition function for OCS, ONCI, CH2O at  298 K are  140, 16926, and  712 respectively\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.8, Page Number 344"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi, exp\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "Ba = 1.48                        #Frequency for OCS, 1/cm\n",
      "Bb = [2.84,0.191,0.179]          #Frequency for ONCI, 1/cm\n",
      "Bc = [9.40,1.29,1.13]            #Frequency for CH2O, 1/cm\n",
      "T298 = 298.0                     #Temperture of Hydrogen, K\n",
      "T1000 = 1000                     #Temperture of Hydrogen, K\n",
      "nubar  =  208\n",
      "\n",
      "#Calculations\n",
      "qv298 = 1./(1.-exp(-h*c*100*nubar/(k*T298)))\n",
      "qv1000 = 1./(1.-exp(-h*c*100*nubar/(k*T1000)))\n",
      "\n",
      "#Results\n",
      "print 'Vibrational partition function for I2 at %4d and %4d are %4.2f K and %4.2f respectively'%(T298, T1000,qv298, qv1000)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vibrational partition function for I2 at  298 and 1000 are 1.58 K and 3.86 respectively\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.9, Page Number 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "T = 298            #Temeprature, K\n",
      "nubar = [450, 945, 1100]   #Vibrational mode frequencies for OClO, 1/cm\n",
      "\n",
      "#Calculations\n",
      "Qv = 1.\n",
      "for i in nubar:\n",
      "    qv = 1./(1.-exp(-h*c*100*i/(k*T)))\n",
      "    print 'At %4.0f 1/cm the q = %4.3f'%(i,qv)\n",
      "    Qv = Qv*qv\n",
      "#Results\n",
      "print 'Total Vibrational partition function for OClO at %4.1f K is %4.3f'%(T, Qv)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "At  450 1/cm the q = 1.128\n",
        "At  945 1/cm the q = 1.010\n",
        "At 1100 1/cm the q = 1.005\n",
        "Total Vibrational partition function for OClO at 298.0 K is 1.146 respectively\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.10, Page Number 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "T = 298            #Temeprature, K\n",
      "nubar = 917        #Vibrational mode frequencies for F2, 1/cm\n",
      "\n",
      "#Calculations\n",
      "ThetaV = h*c*100*nubar/k\n",
      "Th = 10*ThetaV\n",
      "qv = 1/(1.-exp(-ThetaV/Th))\n",
      "\n",
      "#Results\n",
      "print 'Vibrational partition function for F2 at %4.1f K is %4.3f'%(T, qv)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vibrational partition function for F2 at 298.0 K is 10.508\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.11, Page Number 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "T = 1000           #Temeprature, K\n",
      "nubar = [1388, 667.4,667.4,2349]   #Vibrational mode frequencies for CO2, 1/cm\n",
      "\n",
      "#Calculations\n",
      "Qv = 1.\n",
      "for i in nubar:\n",
      "    qv = 1./(1.-exp(-h*c*100*i/(k*T)))\n",
      "    print 'At %4.0f 1/cm the q = %4.3f'%(i,qv)\n",
      "    Qv = Qv*qv\n",
      "#Results\n",
      "print 'Total Vibrational partition function for OClO at %4.1f K is %4.3f'%(T, Qv)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "At 1388 1/cm the q = 1.157\n",
        "At  667 1/cm the q = 1.619\n",
        "At  667 1/cm the q = 1.619\n",
        "At 2349 1/cm the q = 1.035\n",
        "Total Vibrational partition function for OClO at 1000.0 K is 3.139\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 14.12, Page Number 352"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "\n",
      "#Variable Declarations\n",
      "h = 6.626e-34      #Planks constant, J.s\n",
      "k = 1.38e-23       #Boltzman constant, J/K\n",
      "c = 3.0e8          #speed of light, m/s\n",
      "\n",
      "T = 298.           #Temeprature, K\n",
      "n = [0,1,2,3,4,5,6,7,8]   #Energy levels\n",
      "E0 = [0,137.38,323.46,552.96,2112.28,2153.21,2220.11,2311.36,2424.78]      #Energies, 1/cm\n",
      "g0 = [4,6,8,10,2,4,6,8,10]\n",
      "\n",
      "#Calculations\n",
      "qE = 0.0\n",
      "for i in range(9):\n",
      "    a =g0[i]*exp(-h*c*100*E0[i]/(k*T))\n",
      "    qE = qE + a\n",
      "\n",
      "#Results\n",
      "print 'Electronic partition function for F2 at %4.1f K is %4.2f'%(T, qE)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electronic partition function for F2 at 298.0 K is 9.45\n"
       ]
      }
     ],
     "prompt_number": 26
    }
   ],
   "metadata": {}
  }
 ]
}