summaryrefslogtreecommitdiff
path: root/Engineering_Physics_-_I_by_G._SenthilKumar/chapter5.ipynb
blob: 78a1015e64769483514a764527b482fdf6f6d0e2 (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
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
{
 "metadata": {
  "name": "Chapter5(s)"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Chapter 5: Crystal Physics"
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 1, Page no:5.72"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n\n#Copper has FCC structure\nr       = 1.273;            # Atomic radius in angstrom\nN       = 6.023*10**26;     # Avagadros number in atoms/kilomole\nA       = 63.5;             # Atomic weight of copper in grams\nn       = 4;                # No. of atoms per unit cell for FCC\n\n# Calculations\nr1      = r*10**-10;           # Radius conversion from angstrom to m\na       = (4*r1)/math.sqrt(2); # lattice parameter for FCC\np       = (n*A)/(N*a**3);      # Density of copper\n\n# Result\nprint 'Lattice Constant a = %3.1e' %a,' m','\\n', 'Density of copper = %3.1f' %p,' kg/m^3';\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Lattice Constant a = 3.6e-10  m \nDensity of copper = 9034.4  kg/m^3\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 2, Page no:5.73"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# given intercepts 3,4 and \u221e, the recipocals of intercepts is\n# (1/3):(1/4):(1/\u221e)\n# LCM = 12\n# multiplying by LCM we get miller indices\n# miller indices of a plane are the smallest integers of the reciprocals of its intercerpts\n# therefore miller indices(h k l) is (4 3 0);\n\nh   = 4;       # miller indice\nk   = 3;       # miller indice\nl   = 0;       # miller indice\na   = 2;       # primitive vector of lattice in angstrom\n\n#Calculations\n\ndhkl    = a/math.sqrt((h**2)+(k**2)+(l**2));   #interplanar distance\n\n# Result\nprint 'Miller indices = (4 3 0)';\nprint 'The interplanar distance d = %3.1f' %dhkl,' \u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Miller indices = (4 3 0)\nThe interplanar distance d = 0.4  \u00c5\n"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 3, Page no:5.74"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# \u03b1-Iron solidifies to BCC structure\n\nr       = 1.273;             # Atomic radius in angstrom\nN       = 6.023*10**26;      # Avagadros number in atoms/kilomole\nA       = 55.85;             # Atomic weight of \u03b1-Iron in kilograms\nn       = 2;                 # No. of atoms per unit cell for BCC\np       = 7860;              # density in kg/m^-3\n\n#Calculations\n\n# p    = (n*A)/(N*a^3);    density\n\na       = ((n*A)/(N*p))**(0.333);  # lattice constant\na1      = a*10**10;              # m to angstrom conversion\nr       = (a1*math.sqrt(3))/4    #  atomic radius for BCC\n\n#Output\nprint 'The Radius of the atom = %3.5f' %r,' \u00c5'\nprint 'Note : atomic wt taken as 55.58*10^-3 instead of 55.85 in calculation'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "The Radius of the atom = 1.26955  \u00c5\nNote : atomic wt taken as 55.58*10^-3 instead of 55.85 in calculation\n"
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 4, Page no:5.75"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nlamda   = 1.5418;       # wavelength in \u00c5\nh       = 1;            # miller indice\nk       = 1;            # miller indice\nl       = 1;            # miller indice\nn       = 1;            # given first order\ntheta   = 30;           # diffraction angle in degrees\n\n# Calculations\ntheta1   = theta*math.pi/180;   # degree to radian conversion\n# d     = (n*lamda)/(2*sin\u03b8);    by Braggs law               ------------- 1\n# d     = a/sqrt((h^2)+(k^2)+(l^2));  interplanar distance    ------------ 2\n# equating 1 and 2\n\na       = (n*lamda*math.sqrt((h**2)+(k**2)+(l**2))/(2*math.sin(theta1)))\n\n# Result\nprint 'Interatomic spacing a = %f \u00c5' %a;",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Interatomic spacing a = 2.670476 \u00c5\n"
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 5, page no:5.76"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# variable Declaration\nh1       = 1;            # miller indice\nk1       = 1;            # miller indice\nl1       = 1;            # miller indice\nh0       = 0;            # miller indice\nk0       = 0;            # miller indice\nl0       = 0;            # miller indice\n\n# Calculations\n# dhkl    = a/sqrt((h^2)+(k^2)+(l^2)); // interplanar distance\n# assume a = 1(constant) for easier calculation in scilab\n\na        = 1;\nd100     = a/math.sqrt((h1**2)+(k0**2)+(l0**2)); # interplanar distance\nd110     = a/math.sqrt((h1**2)+(k1**2)+(l0**2)); # interplanar distance\nd111     = a/math.sqrt((h1**2)+(k1**2)+(l1**2)); # interplanar distance\n\n# Result\nprint 'd100 : d110 : d111 = ','%d ' %d100,':','%3.2f' %d110,':', '%3.2f' %d111;",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "d100 : d110 : d111 =  1  : 0.71 : 0.58\n"
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6, page no:5.76"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# Aluminium is FCC\n\na       = 0.405*10**-9;          # lattice constant of aluminium\nt       = 0.005*10**-2;          # thickness of aluminium foil in m\ns       = 25*10**-2;             # side of square in m\n\n# Calculations\nVUC     = a**3;                  # volume of unit cell\nVal     = (s**2)*t               # volume of aluminium foil (area*thickness)\nN       = Val/VUC                # Number if unit cells\n\n# Result\nprint 'Number of unit cells = %3.3e' %N",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Number of unit cells = 4.704e+22\n"
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 7, page no:5.77"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# variable declaration\n# metallic iron changes from  BCC to FCC form at 910 degress\nrb      = 0.1258*10**-9;     # atomic radius of BCC iron atom\nrf      = 0.1292*10**-9;     # atomic radius of FCC iron atom\n\n# Calculations\n\nab      = (4*rb)/(math.sqrt(3));      # lattice constant for BCC\nVbcc    = (ab**3)/2;                  # volume occupied by one BCC atom\naf      = (4*rf)/(math.sqrt(2))       # lattice constant for FCC\nVfcc    = (af**3)/4;                  # volume occupied by one FCC atom\ndv      = ((Vbcc-Vfcc)/Vbcc)*100      # percentage change in volume\n\n# Result\nprint 'During the structural change the percentage change in volume = %3.4f' %dv;",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "During the structural change the percentage change in volume = 0.4933\n"
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 8, page no:5.78"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n#variable declaration\n#Copper Crystallines in  FCC structure\n\np       = 8960;             # Density of copper in kg/m^3\nN       = 6.023*10**26;      # Avagadros number in atoms/kilomole\nA       = 63.5;             # Atomic weight of copper in kg/mol\nn       = 4;                # No. of atoms per unit cell for FCC\n\n# Calculations\n\na       = ((n*A)/(N*p))**(0.333);\n\n# Result\n\nprint 'Lattice Constant a = %3.4f' %(a*10**10),' \u00c5';\nprint 'atomic wt of copper is taken as 63.5*10^-3 instead of 63.5 in textbook';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Lattice Constant a = 3.6899  \u00c5\natomic wt of copper is taken as 63.5*10^-3 instead of 63.5 in textbook\n"
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 9, page no:5.79"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable declaration\n# (100) planes in rock crystal\nh       = 1;            # miller indice\nk       = 0;            # miller indice\nl       = 0;            # miller indice\na       = 2.814         # lattice constant in \u00c5\n\n# Calculations\ndhkl    = a/math.sqrt((h**2)+(k**2)+(l**2)); # interplanar distance\n\n#Result\nprint 'd-spacing for (100) plane in rock salt = %3.3f' %dhkl,' \u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "d-spacing for (100) plane in rock salt = 2.814  \u00c5\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 10, page no:5.79"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# FCC structured crystal\n\np       = 6250;             # Density of crystal in kg/m^3\nN       = 6.023*10**26;      # Avagadros number in atoms/kilomole\nA       = 60.2;             # molecular weight\nn       = 4;                # No. of atoms per unit cell for FCC\n\n# Calculations\n\na       = ((n*A)/(N*p))**(0.333);\n\n# Result\n\nprint 'Lattice Constant a = %3.3e' %a, 'm';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Lattice Constant a = 4.087e-10 m\n"
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 11, page no:5.80"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# (321) plane in simple cubic lattice\nh       = 3;            # miller indice\nk       = 2;            # miller indice\nl       = 1;            # miller indice\na       = 4.12          # inter atomic space \u00c5\n\n# Calculations\ndhkl    = a/math.sqrt((h**2)+(k**2)+(l**2)); #interplanar distance\n\n# Result\nprint 'd = %3.2f' %dhkl,' \u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "d = 1.10  \u00c5\n"
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 12, page no:5.81"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# BCC structured crystal\n\np       = 7860;             # Density of iron in kg/m^3\nN       = 6.023*10**26;     # Avagadros number in atoms/kilomole\nA       = 55.85;            # Atomic weight\nn       = 2;                # No. of atoms per unit cell for BCC\n\n# Calculations\n\na       = ((n*A)/(N*p))**(0.333); #lattice constant\n\n# Result\n\nprint 'Lattice Constant of Fe = %3.3f' %(a*10**10),' \u00c5 ';\nprint 'Note: density of iron is taken as 7.86 instead of 7860 in calculation'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Lattice Constant of Fe = 2.932  \u00c5 \nNote: density of iron is taken as 7.86 instead of 7860 in calculation\n"
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 14, page no:5.82"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# variable Declaration\nr       = 0.123*10**-10;         # Radius of the atom\n\n# Calculations\na       = (4*r)/math.sqrt(3);        # Lattice constant in m For a BCC structure\nV       = a*a*a;                     # Volume of BCC\n\n# Result\nprint 'Volume of the unit cell = %3.4e' %V,' m^3';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Volume of the unit cell = 2.2920e-32  m^3\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 15, page no:5.82"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable declaration\na   = 0.05;     # unit cell edge of an orthorhombic crystal in nm\nb   = 0.05;     # unit cell edge of an orthorhombic crystal in nm\nc   = 0.03;     # unit cell edge of an orthorhombic crystal in nm\nIa  = 0.025     # intercept on 'a' in nm\nIb  = 0.02      # intercept on 'b' in nm\nIc  = 0.01      # intercept on 'c' in nm\n\n# Calculations\n\nh   = a/Ia;     # miller indice h\nk   = b/Ib;     # miller indice k\nl   = c/Ic      # miller indice l\n\n# Result\nprint 'Miller indices (h k l) =', '%d' %h,'%d' %k, '%d' %l; ",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Miller indices (h k l) = 2 2 3\n"
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 16, page no:5.83"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Magnesium has HCP structure\n# for HCF(Hexagonal closed packed structure) consider the relation between 'c' and 'a';\n# c/a = sqrt(8/3) = 1.6329 \n\n# Variable Declaration\nr   = 0.1605*10**-9;     # radius of magnesium atom in m\n\n# Calculations\n\na   = 2*r               # lattice constant of HCP\nc   = a*math.sqrt(float(8)/3);      # relation b/w c and a in HCP\nV   = (3*(3**0.5))*(a*a*c)/2;         #Volume of unit cell in m^3\n\n# Result\nprint 'Volume of the unit cell of magnesium = %g' %V,' m^3';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Volume of the unit cell of magnesium = 1.4033e-28  m^3\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 17, page no:5.84"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n# Variable Declaration\n#  (101),(221) planes in simple cubic lattice\nh1       = 1;            # miller indice\nk0       = 0;            # miller indice\nl1       = 1;            # miller indice\nh2       = 2;            # miller indice\nk2       = 2;            # miller indice\nl1       = 1;            # miller indice\na        = 4.2           # inter atomic space \u00c5\n\n# Calculations\n\nd101    = a/math.sqrt((h1**2)+(k0**2)+(l1**2)); # interplanar distance\nd221    = a/math.sqrt((h2**2)+(k2**2)+(l1**2)); # interplanar distance\n\n\n# Result\nprint 'd(101) = %3.4f' %d101,' \u00c5','\\n','d(221) = %3.1f' %d221,' \u00c5 ';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "d(101) = 2.9698  \u00c5 \nd(221) = 1.4  \u00c5 \n"
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 1, page no:5.85"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable declaration\n\n# Copper has FCC structure\na   = 3.6;      #lattice parameter of copper in \u00c5\n\n# Calculations\n\nr   = a*math.sqrt(2)/4;      # atomic radius of copper\n\n# Result\nprint 'Atomic Radius of copper = %3.3f' %r,'\u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Atomic Radius of copper = 1.273 \u00c5\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 2, page no:5.85"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# variable Declaration\n\n# Copper has FCC structure\n\nr       = 1.278;            # Atomic radius in angstrom\nN       = 6.023*10**26;     # Avagadros number in atoms/kilomole\nA       = 63.54;            # Atomic weight of copper \nn       = 4;                # No. of atoms per unit cell for FCC\n\n# Calculations\nr1      = r*10**-10;           # Radius conversion from angstrom to m\na       = (4*r1)/math.sqrt(2); # lattice parameter for FCC\np       = (n*A)/(N*a**3);      # Density of copper\n\n# Result\n\nprint ' Density of copper = %3.2f' %p,' kg/m^3';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": " Density of copper = 8934.43  kg/m^3\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 3, page no:5.86"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nANa     = 23;               # atomic wt of sodiim\nACl     = 35.45             # atomic wt of chlorine\nN       = 6.023*10**26;     # Avagadros number in atoms/kilomole\nn       = 4                 # No. of atoms per unit cell for FCC\np       = 2180;             # density in kg/m^-3\n\n# Calculations\n\n# p    = (n*A)/(N*a^3);    density\nA       = ANa+ACl;              # atomic wt of NaCl\na       = ((n*A)/(N*p))**(0.33333); # lattice constant\nr       = a/2                   # Distance b/w two adjacent atoms\n\n# Result\nprint 'Distance between two adjacent atoms is r = %3.2e' %r,' m';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Distance between two adjacent atoms is r = 2.81e-10  m\n"
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 4, page no:5.87"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nr       = 1.273;            # Atomic radius in angstrom\nN       = 6.023*10**26;      # Avagadros number in atoms/kilomole\nA       = 55.85      ;      # Atomic weight of Fe \nn       = 2;                # No. of atoms per unit cell for BCC\np       = 7860;             # density in kg/m^-3\n\n# Calculations\n\n#  p    = (n*A)/(N*a^3);    density\n\na       = ((n*A)/(N*p))**(0.33333);      # lattice constant\na1      = a*10**10;                      #  m to angstrom conversion\nr       = (a1*math.sqrt(3))/4                 # atomic radius for BCC\n\n# Result\nprint 'The Radius of the Fe = %3.3f' %r,' \u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "The Radius of the Fe = 1.242  \u00c5\n"
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 5, page no:5.88"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nN       = 6.023*10**26;      # Avagadros number in atoms/kilomole\nA       = 119;               # Atomic weight of pottasium bromide\nn       = 4;                 # No. of atoms per unit cell for FCC\np       = 2700;              # density in kg/m^-3\n\n# Calculations\n\n# p    = (n*A)/(N*a^3);    density\n\na       = ((n*A)/(N*p))**(0.33333);  # lattice constant\na1      = a*10**10;                   # m to angstrom conversion\n\n# Output\nprint 'Lattice constant = %3.1f' %a1,' \u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Lattice constant = 6.6  \u00c5\n"
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 6, page no:5.88"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\na       = 4.3*10**-10;      # Lattice constant in \u00c5\np       = 960;              # Density of crystal in kg/m^3\nA       = 23;               # Atomic wt\nN       = 6.023*10**26;     # avogadros no in atoms/kilomole\n\n# Calculations\n\nn       = (p*N*(a**3))/A;      # No. of atoms per unit cell\n\n# result\nprint 'No. of atoms per unit cell = %3.0f' %n,' (BCC)';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "No. of atoms per unit cell =   2  (BCC)\n"
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 7, page no:5.89"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration \n\n# given crystal has BCC structure\nr   = 1.2*10**-10;       # atomic radius in m\n\n# Calculations\n\na   = (4*r)/math.sqrt(3);    # lattice constant\nV   = a**3;                  #  volume of cell\n\n# Result\nprint 'Volume of the cell = %3.3e' %V,' m^3';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Volume of the cell = 2.128e-29  m^3\n"
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 8, page no:5.89"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\na   = 4*10**-10;     # lattice constant of the crystal\nh   = 1              # miller indice\nk   = 0              # miller indice\nl   = 0              # miller indice\n\n# Calculations\n\n# in fig consider (100) plane. the no of atoms in plane ABCD\nN   = 4*(float(1)/4);      # Number of atoms\np   = N/(a*a);      # planar atomic density in atoms/m^2\np1  = p*10**-6      # planar atomic density in atoms/mm^2\n\n# Result\nprint 'planar atomic density = %3.2e' %p1,' atoms/mm^2';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "planar atomic density = 6.25e+12  atoms/mm^2\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 9, page no:5.90"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n# in fig 5(b) the given plane is parallel to X and Z axes.Thus,its numerical intercepts on these axes is infinity\n#The numerical intercept on y axis is 1/2. Thus the numerical intercepts of plane is (\u221e 1/2 \u221e)\nprint ' Miller indices of plane shown in fig 5.(b) = (0 2 0)';\n# in fig 5(c) the given plane is parallel to Z axis.Thus its numerical intercept on z axis is infinity\n# The numerical intercept on x axis is 1 and y axis is 1/2. this numerical intercepts on plane is (1 1/2 \u221e )\nprint ' Miller indices of plane shown in fig 5.(c) = (1 2 0)'\n# in fig 5(d) the given plane is parallel to Z axis.Thus its numerical intercept on z axis is infinity\n# The numerical intercept on x axis is 1/2 and y axis is 1/2. this numerical intercepts on plane is (1/2 1/2 \u221e )\nprint ' Miller indices of plane shown in fig 5.(d) = (2 2 0)'",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": " Miller indices of plane shown in fig 5.(b) = (0 2 0)\n Miller indices of plane shown in fig 5.(c) = (1 2 0)\n Miller indices of plane shown in fig 5.(d) = (2 2 0)\n"
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 11, page no:5.91"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n\n# (311) plane in simple cubic lattice\nh       = 3;            # miller indice\nk       = 1;            # miller indice\nl       = 1;            # miller indice\na       = 2.109*10**-10 # lattice constant in m\n\n# Calculations\ndhkl    = a/math.sqrt((h**2)+(k**2)+(l**2)); # interplanar distance\n\n# Result\nprint 'd = %3.3e' %dhkl,' m';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "d = 6.359e-11  m\n"
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 12, page no:5.92"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nh       = 1;            # miller indice\nk       = 1;            # miller indice\nl       = 0;            # miller indice\nd       = 2.86*10**-10  # interplanar distance in m\n\n# Calculations\na       = d*math.sqrt((h**2)+(k**2)+(l**2));   # interplanar distance\n\n# Result\nprint 'Lattice constant a = %3.3e' %a,' m';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Lattice constant a = 4.045e-10  m\n"
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 13, page no:5.93"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nh1      = 1;\nh0      = 0;\nk0      = 0;\nl0      = 0;\nl1      = 1;\n\n# Calculations\n\n# we know that dhkl = a/sqrt( h^2 + k^2 + l^2)\n# let sqrt( h^2 + k^2 + l^2) = p\np101    = math.sqrt( h1**2 + k0**2 + l1**2);\np100    = math.sqrt( h1**2 + k0**2 + l0**2);\np001    = math.sqrt( h0**2 + k0**2 + l1**2);\n\n# Result\nprint 'd101 : d100 : d001 :: a/%3.4f' %p101,' : ','a/%d' %p100,':',' a/%d ' %p001;",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": " d101 : d100 : d001 :: a/1.4142  :  a/1 :  a/1 \n"
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 14, page no:5.93"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# if a plane cut intercepts of lengths l1,l2,l3 the on three crystal axes ,then\n# l1 : l2 : l3 = pa : pq :rc\n# where a,b and c are primitive vectors of the unit cell and p,q and r are numbers related to miller indices (hkl) of plane by relation\n# 1/p : 1/q : 1/r = h : k : l\n# since, the crystal is simple cubic a = b = c and given that h = 1, k = 1 and l = 1\n# p : q : r = 1/h : 1/k : 1/l = 1/1 : 1/1 : 1/1 \n# p : q : r = 1 : 1 : 1\n# similarly l1 : l2 : l3 = 1a : 1a : 1a\nprint 'ratio of intercepts on the three axes by (111) plane is l1 : l2 : l3 = 1 : 1 : 1';\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "ratio of intercepts on the three axes by (111) plane is l1 : l2 : l3 = 1 : 1 : 1\n"
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 15, page no:5.94"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\n\nr   = 1.246*10**-10;     # atomic radius in m\nh1  = 1                  # miller indice\nh2  = 2                  # miller indice\nk0  = 0                  # miller indice\nk1  = 1                  # miller indice\nk2  = 2                  # miller indice\nl0  = 0                  # miller indice\nl1  = 1                  # miller indice\n\n# Calculations\na    = (4*r)/math.sqrt(2);    # lattice constant\nd111 = a/math.sqrt((h1**2)+(k1**2)+(l1**2)); # interplanar distance\nd200 = a/math.sqrt((h2**2)+(k0**2)+(l0**2)); # interplanar distance\nd220 = a/math.sqrt((h2**2)+(k2**2)+(l0**2)); # interplanar distance\n\n# Result\nprint 'd111 = %3.3e' %d111,' m','\\n' 'd200 = %3.4e' %d200,' m','\\n''d220 = %3.3e' %d220,' m';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "d111 = 2.035e-10  m \nd200 = 1.7621e-10  m \nd220 = 1.246e-10  m\n"
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 16, page no:5.95"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# variable Declaration\n# the intercept along X-axis be c1 = a\n# the intercept along Y-axis be c2 = b/2 and\n# the intercept along Z-axis be c3 = 3c\n# Therefore, p = c1/a = a/a = 1\n# q = c2/b = (b/2)/b = 1/2\n# r = c3/c = (3c)/c  = 3\n# therefore h = 1/p = 1\n# k = 1/q = 2\n# l = 1/r = 1/3\n# lcm of 1 1 and 3 = 3\nh = 1\nk = 2\nl = float(1)/3\ns = 3 ;   # lcm\nh1= s*h\nk1= s*k\nl1= s*l;\n\n# Result\nprint '(h k l) =', '%d' %h1,' %d' %k1,'%3.0f' %l1;",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "(h k l) = 3  6   1\n"
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Addl_Example 17, page no:5.96"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math;\n\n# Variable Declaration\nd       = 1.3*10**-10    # interplanar distance\nn       = 1;             # given first order\ntheta   = 23;            # Bragg reflection angle in degrees\n\n# Calculations\ntheta1   = theta*math.pi/180;   # degree to radian conversion\n# d     = (n*lamda)/(2*sin\u03b8);    by Braggs law               ------------- 1\nlamda    = (2*d*math.sin(theta1)/n)\n\n# Result\nprint 'Wavelength of X-ray = %3.4f' %(lamda*10**10),' \u00c5';",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Wavelength of X-ray = 1.0159  \u00c5\n"
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "",
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}