{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#3: Crystal planes, X-ray diffraction and defects in solids" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.1, Page number 3.19" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "glancing angle is 21 degrees\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "lamda=0.071*10**-9; #wavelength(m)\n", "a=0.28*10**-9; #lattice constant(m)\n", "h=1;\n", "k=1;\n", "l=0;\n", "n=2; #order of diffraction\n", "\n", "#Calculation\n", "d=a/math.sqrt(h**2+k**2+l**2);\n", "x=n*lamda/(2*d); \n", "theta=math.asin(x); #angle(radian)\n", "theta=theta*180/math.pi; #glancing angle(degrees)\n", "\n", "#Result\n", "print \"glancing angle is\",int(theta),\"degrees\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.2, Page number 3.19" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "wavelength is 0.0842 nm\n", "maximum order of diffraction is 7.0\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "n=1; #order of diffraction\n", "theta1=8+(35/60); #angle(degrees)\n", "d=0.282; #spacing(nm)\n", "theta2=90;\n", "\n", "#Calculation\n", "theta1=theta1*math.pi/180; #angle(radian)\n", "lamda=2*d*math.sin(theta1)/n; #wavelength(nm)\n", "theta2=theta2*math.pi/180; #angle(radian)\n", "nmax=2*d/lamda; #maximum order of diffraction\n", "\n", "#Result\n", "print \"wavelength is\",round(lamda,4),\"nm\"\n", "print \"maximum order of diffraction is\",round(nmax)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.3, Page number 3.20" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "fraction of vacancy sites is 8.466 *10**-7\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "T1=500+273; #temperature(K)\n", "T2=1000+273; #temperature(K)\n", "f=1*10**-10; #fraction\n", "\n", "#Calculation\n", "x=round(T1/T2,5);\n", "y=round(math.log(f),3);\n", "w=round(x*y,3);\n", "F=math.exp(w); #fraction of vacancy sites\n", "\n", "#Result\n", "print \"fraction of vacancy sites is\",round(F*10**7,3),\"*10**-7\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.4, Page number 3.21" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ratio is math.sqrt( 6.0 ): math.sqrt( 3.0 ): math.sqrt( 2.0 )\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=1; #assume\n", "h1=1;\n", "k1=0;\n", "l1=0;\n", "h2=1;\n", "k2=1;\n", "l2=0;\n", "h3=1;\n", "k3=1;\n", "l3=1;\n", "\n", "#Calculation\n", "d100=a*6/(h1**2+k1**2+l1**2);\n", "d110=a*6/(h2**2+k2**2+l2**2);\n", "d111=a*(6)/(h3**2+k3**2+l3**2);\n", "\n", "#Result\n", "print \"ratio is math.sqrt(\",d100,\"): math.sqrt(\",d110,\"): math.sqrt(\",d111,\")\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.5, Page number 3.21" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "lattice parameter of nickel is 3.522 angstrom\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "n=1; #order of diffraction\n", "theta=38.2; #angle(degrees)\n", "lamda=1.54; #wavelength(angstrom)\n", "h=2;\n", "k=2;\n", "l=0;\n", "\n", "#Calculation\n", "theta=theta*math.pi/180; #angle(radian)\n", "d=n*lamda/(2*math.sin(theta));\n", "a=d*math.sqrt(h**2+k**2+l**2); #lattice parameter of nickel(angstrom)\n", "\n", "#Result\n", "print \"lattice parameter of nickel is\",round(a,3),\"angstrom\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.6, Page number 3.22" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "order of diffraction is 2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "theta=90; #angle(degrees)\n", "lamda=1.5; #wavelength(angstrom)\n", "d=1.6; #spacing(angstrom)\n", "\n", "#Calculation\n", "theta=theta*math.pi/180; #angle(radian)\n", "n=2*d*math.sin(theta)/lamda; #order of diffraction\n", "\n", "#Result\n", "print \"order of diffraction is\",int(n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.7, Page number 3.22" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "length of unit cell is 0.287 *10**-9 m\n", "volume of unit cell is 0.02366 *10**-27 m**3\n", "radius of the atom is 0.1243 *10**-9 m\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "h=1;\n", "k=1;\n", "l=0;\n", "d=0.203*10**-9; #spacing(m)\n", "\n", "#Calculation\n", "a=d*math.sqrt(h**2+k**2+l**2); #length of unit cell(m)\n", "V=a**3; #volume of unit cell(m**3)\n", "r=math.sqrt(3)*a/4; #radius of the atom(m)\n", "\n", "#Result\n", "print \"length of unit cell is\",round(a*10**9,3),\"*10**-9 m\"\n", "print \"volume of unit cell is\",round(V*10**27,5),\"*10**-27 m**3\"\n", "print \"radius of the atom is\",round(r*10**9,4),\"*10**-9 m\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.8, Page number 3.22" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "order of diffraction is 2\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "theta=90; #angle(degrees)\n", "lamda=1.5; #wavelength(angstrom)\n", "d=1.6; #spacing(angstrom)\n", "\n", "#Calculation\n", "theta=theta*math.pi/180; #angle(radian)\n", "n=2*d*math.sin(theta)/lamda; #order of diffraction\n", "\n", "#Result\n", "print \"order of diffraction is\",int(n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.9, Page number 3.23" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "glancing angle is 20 degrees 42 minutes 17 seconds\n", "answer varies due to rounding off errors\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "lamda=0.065; #wavelength(nm)\n", "a=0.26; #edge length(nm)\n", "h=1;\n", "k=1;\n", "l=0;\n", "n=2;\n", "\n", "#Calculation\n", "d=a/math.sqrt(h**2+k**2+l**2); \n", "x=n*lamda/(2*d); \n", "theta=math.asin(x); #glancing angle(radian)\n", "theta=theta*180/math.pi; #glancing angle(degrees)\n", "theta_d=int(theta); \n", "theta_m=(theta-theta_d)*60;\n", "theta_s=(theta_m-int(theta_m))*60;\n", "\n", "#Result\n", "print \"glancing angle is\",theta_d,\"degrees\",int(theta_m),\"minutes\",int(theta_s),\"seconds\"\n", "print \"answer varies due to rounding off errors\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.10, Page number 3.23" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "cube edge of unit cell is 4.055 angstrom\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "lamda=1.54; #wavelength(angstrom)\n", "h=1;\n", "k=1;\n", "l=1;\n", "n=1;\n", "theta=19.2; #angle(degrees)\n", "\n", "#Calculation\n", "theta=theta*math.pi/180; #angle(radian)\n", "d=n*lamda/(2*math.sin(theta)); \n", "a=d*math.sqrt(h**2+k**2+l**2); #cube edge of unit cell(angstrom)\n", "\n", "#Result\n", "print \"cube edge of unit cell is\",round(a,3),\"angstrom\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.11, Page number 3.24" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "lattice parameter of nickel is 3.522 angstrom\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "lamda=1.54; #wavelength(angstrom)\n", "h=2;\n", "k=2;\n", "l=0;\n", "n=1;\n", "theta=38.2; #angle(degrees)\n", "\n", "#Calculation\n", "theta=theta*math.pi/180; #angle(radian)\n", "d=n*lamda/(2*math.sin(theta)); \n", "a=d*math.sqrt(h**2+k**2+l**2); #lattice parameter of nickel(angstrom)\n", "\n", "#Result\n", "print \"lattice parameter of nickel is\",round(a,3),\"angstrom\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.12, Page number 3.24" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "interplanar spacing for (111) is 0.208 nm\n", "interplanar spacing for (321) is 0.096 nm\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=0.36; #edge length(nm)\n", "h1=1;\n", "k1=1;\n", "l1=1;\n", "h2=3;\n", "k2=2;\n", "l2=1;\n", "\n", "#Calculation\n", "d1=a/math.sqrt(h1**2+k1**2+l1**2); #interplanar spacing for (111)(nm)\n", "d2=a/math.sqrt(h2**2+k2**2+l2**2); #interplanar spacing for (321)(nm)\n", "\n", "#Result\n", "print \"interplanar spacing for (111) is\",round(d1,3),\"nm\"\n", "print \"interplanar spacing for (321) is\",round(d2,3),\"nm\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.13, Page number 3.25" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "glancing angle is 16 degrees 27 minutes\n", "answer varies due to rounding off errors\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "lamda=0.675; #wavelength(angstrom)\n", "n=3; #order of diffraction\n", "theta=5+(25/60); #angle(degrees)\n", "\n", "#Calculation\n", "theta=theta*math.pi/180; #angle(radian)\n", "d=lamda/(2*math.sin(theta)); \n", "theta3=math.asin(3*lamda/(2*d)); #glancing angle(radian)\n", "theta3=theta3*180/math.pi; #glancing angle(degrees)\n", "theta_d=int(theta3); \n", "theta_m=(theta3-theta_d)*60;\n", "\n", "#Result\n", "print \"glancing angle is\",theta_d,\"degrees\",int(theta_m),\"minutes\"\n", "print \"answer varies due to rounding off errors\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Example number 3.14, Page number 3.25" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "glancing angle is 22 degrees 56 minutes 31 seconds\n", "answer given in the book is wrong\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "lamda=0.79; #wavelength(angstrom)\n", "n=3; #order of diffraction\n", "d=3.04; #spacing(angstrom)\n", "\n", "#Calculation\n", "x=round(n*lamda/(2*d),4);\n", "theta=math.asin(x); #glancing angle(radian)\n", "theta=theta*180/math.pi; #glancing angle(degrees)\n", "theta_d=int(theta); \n", "theta_m=(theta-theta_d)*60;\n", "theta_s=(theta_m-int(theta_m))*60;\n", "\n", "#Result\n", "print \"glancing angle is\",theta_d,\"degrees\",int(theta_m),\"minutes\",int(theta_s),\"seconds\"\n", "print \"answer given in the book is wrong\"" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }