{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter : 1 - Semiconductor Materials And Crystal Properties"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.18.3 - Page No : 1-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "At = 28;# Atomic weight\n",
      "n = 4;\n",
      "N_A = 6.023*10**23;\n",
      "a = 5.3;# in \u00c5\n",
      "a = a * 10**-10;# in m\n",
      "m = At/N_A;# in gm\n",
      "m = m*10**-3;# in kg\n",
      "V = (a)**3;# in m**3\n",
      "Rho = (m*n)/V;# in gm/m**3\n",
      "Rho = Rho * 10**-3;# in kg/m**3\n",
      "print \"The volume density = %0.3f kg/m**3 \" %Rho"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume density = 1.249 kg/m**3 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.18.4 - Page No : 1-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "r = 1.278;# in \u00c5\n",
      "a = (4*r)/(sqrt(2));# in \u00c5\n",
      "a = a * 10**-10;# in m\n",
      "V = (a)**3;# in m**3\n",
      "At = 63.5;# atomic weight\n",
      "N_A = 6.023*10**23;\n",
      "m = At/N_A;# in gm\n",
      "m = m * 10**-3;# in kg\n",
      "n = 4;\n",
      "Rho = (m*n)/V;# in gm/m**3\n",
      "Rho = Rho * 10**-3;# in kg/m**3\n",
      "print \"The density of copper crystal = %0.3f kg/m**3\" %Rho"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The density of copper crystal = 8.929 kg/m**3\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.1 - Page No : 1-50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin, pi\n",
      "# Given data\n",
      "d = 2.82;# in \u00c5\n",
      "d = d * 10**-10;# in m\n",
      "n = 1;\n",
      "theta = 10;# in degree \n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "lembda = 2*d*sin(theta*pi/180);# in m\n",
      "lembda = lembda * 10**10;# in \u00c5\n",
      "print \"The wavelength of X-ray = %0.3f \u00c5\" %lembda"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of X-ray = 0.979 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.2 - Page No : 1-51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin\n",
      "from numpy import pi\n",
      "# Given data\n",
      "lembda = 1.6;# in \u00c5\n",
      "lembda = lembda * 10**-10;# in m\n",
      "theta = 14.2;# in degree\n",
      "n = 1;\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "d = (n*lembda)/(2*sin(theta*pi/180));# in m\n",
      "d = d * 10**10;# in \u00c5\n",
      "print \"The spacing of atomic layer in the crystal = %0.2f \u00c5\" %d\n",
      "# Note : In the book the unit of the answer is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The spacing of atomic layer in the crystal = 3.26 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.3 - Page No : 1-51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin\n",
      "# Given data\n",
      "n = 1;\n",
      "theta = 30;# in degree \n",
      "lembda = 1.78;# in \u00c5\n",
      "lembda = lembda * 10**-10;# in m\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "d = (n*lembda)/(2*sin(theta*pi/180));# in m\n",
      "d = d * 10**10;# in \u00c5\n",
      "print \"The interplaner spacing = %0.2f \u00c5\" %d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The interplaner spacing = 1.78 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.4 - Page No : 1-51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin\n",
      "# Given data\n",
      "lembda = 0.58;# in \u00c5\n",
      "n = 1;\n",
      "theta1 = 6.45;# in degree\n",
      "d = (n*lembda)/(2*sin(theta1*pi/180));# in \u00c5 \n",
      "print \"Part (i) : At angle of 6.45\u00b0, Interplaner spacing of the crystal = %0.3f \u00c5\" %d\n",
      "theta2 = 9.15;# in degree\n",
      "d1 = (n*lembda)/(2*sin(theta2*pi/180));# in \u00c5 \n",
      "print \"Part(ii) : At angle of 9.15\u00b0, Interplaner spacing of the crystal = %0.3f \u00c5\" %d1\n",
      "theta3 = 13;# in degree\n",
      "n2 = 1;\n",
      "d2 = (n2*lembda)/(2*sin(theta3*pi/180));# in \u00c5 \n",
      "print \"Part(iii) : At angle of 13\u00b0, Interplaner spacing of the crystal = %0.3f \u00c5\" %d2\n",
      "# For \n",
      "n=2;\n",
      "d2 = (n*lembda)/(2*sin(theta3*pi/180));# in \u00c5 \n",
      "print \"Part (iv) : The interplaner spacing = %0.3f \u00c5\" %d2\n",
      "print \"The interplaner spacing for some other set of reflecting = %0.3f \u00c5\" %d1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (i) : At angle of 6.45\u00b0, Interplaner spacing of the crystal = 2.582 \u00c5\n",
        "Part(ii) : At angle of 9.15\u00b0, Interplaner spacing of the crystal = 1.824 \u00c5\n",
        "Part(iii) : At angle of 13\u00b0, Interplaner spacing of the crystal = 1.289 \u00c5\n",
        "Part (iv) : The interplaner spacing = 2.578 \u00c5\n",
        "The interplaner spacing for some other set of reflecting = 1.824 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.5 - Page No : 1-52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "from math import asin\n",
      "# Given data\n",
      "a = 2.814;# in \u00c5\n",
      "h = 1;\n",
      "k = 0;\n",
      "l = 0;\n",
      "d = a/(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));# in \u00c5\n",
      "n = 2;\n",
      "lembda = 0.710;# in \u00c5\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "theta = asin(n*lembda/(2*d) )*180/pi;# in degree\n",
      "print \"The glacing angle = %0.2f degree\" %theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The glacing angle = 14.61 degree\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.6 - Page No : 1-52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# Given data\n",
      "a = 3.65;# in \u00c5\n",
      "h = 1;\n",
      "k = 0;\n",
      "l = 0;\n",
      "d = a/(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));# in \u00c5\n",
      "n = 1;\n",
      "theta = 60;# in degree\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "lembda = 2*d*sin(theta*pi/180);# in \u00c5\n",
      "print \"Wavelength of X ray = %0.4f \u00c5\" %lembda"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength of X ray = 6.3220 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.7 - Page No : 1-53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "lembda = 1.54;# in \u00c5\n",
      "lembda= lembda*10**-8;# in cm\n",
      "At = 63.54;# atomic weight\n",
      "density = 9.024;# in gm/cc\n",
      "n = 1;\n",
      "N_A = 6.023*10**23;\n",
      "m = At/N_A;# mass\n",
      "a =(density*m)**(1/3);# in cm\n",
      "h = 1;\n",
      "k = 0;\n",
      "l = 0;\n",
      "d = a/(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));# in cm\n",
      "n = 1;\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "theta = asin( (lembda)/(2*d) )*180/pi;# in degree\n",
      "print \"The glancing angle = %0.4f degree\" %theta\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The glancing angle = 4.4893 degree\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.8 - Page No : 1-53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "a = 3.615;# in \u00c5\n",
      "theta = 22;# in degree\n",
      "n = 1;\n",
      "h = 1;\n",
      "k = 1;\n",
      "l = 1;\n",
      "d = a/(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));# in \u00c5\n",
      "# 2*d*sin(theta) = n*lembda;\n",
      "lembda = 2*d*sin(theta*pi/180);# in \u00c5\n",
      "print \"The wavelength = %0.3f \u00c5\" %lembda\n",
      "n = 2;\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "theta = asin(n*lembda/(2*d) )*180/pi;# in degree\n",
      "print \"The glacing angle for second order = %0.2f degree\" %theta\n",
      "print \"To get the 2nd order spectrum the position of the detector should be %0.2f \u00b0\" %(2*theta)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength = 1.564 \u00c5\n",
        "The glacing angle for second order = 48.52 degree\n",
        "To get the 2nd order spectrum the position of the detector should be 97.04 \u00b0\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.21.9 - Page No : 1-54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin\n",
      "# Given data\n",
      "n = 1;\n",
      "lembda = 1.54;# in \u00c5\n",
      "theta = 21.7;# in degree\n",
      "#Formula 2*d*sin(theta) = n*lembda;\n",
      "d = (lembda*n)/(2*sin(theta*pi/180));# in \u00c5\n",
      "h = 1;\n",
      "k = 1;\n",
      "l = 1;\n",
      "# Formula d = a/(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));\n",
      "a =  d*(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));# in \u00c5\n",
      "print \"Lattice constant = %0.3f \u00c5\" %a"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lattice constant = 3.607 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.1 - Page No : 1-56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "a = 4.8;# in \u00c5\n",
      "h = 2;\n",
      "k = 1;\n",
      "l = 1;\n",
      "d = a/(sqrt( ((h)**2) + ((k)**2) + ((l)**2) ));# in \u00c5\n",
      "print \"The distance between d_211 plains = %0.2f \u00c5\" %d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between d_211 plains = 1.96 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.2 - Page No : 1-56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "r = 1.28;# in \u00c5\n",
      "#Formula r = (a*sqrt(2))/4;\n",
      "a = (4*r)/(sqrt(2));# in \u00c5\n",
      "a = a * 10**-8;# in cm\n",
      "n = 4;\n",
      "M = 63.5;\n",
      "N_A = 6.023*10**23;\n",
      "Rho = (n*M)/(N_A*((a)**3));# in gm/cc\n",
      "print \"The density = %0.2f gm/cc\" %Rho"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The density = 8.89 gm/cc\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.3 - Page No : 1-57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "a = 2.9;# in \u00c5\n",
      "a = a * 10**-8;# in cm\n",
      "Rho = 7.87;# in gm/cc\n",
      "N_A = 6.023*10**23;\n",
      "M = 55.85\n",
      "# Rho = (n*M)/(N_A*((a)**3))\n",
      "n = (Rho*N_A*((a)**3))/M;# in atoms per unit cell\n",
      "print \"The number of atoms per unit cell = %0.f \" %n\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of atoms per unit cell = 2 \n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.4 - Page No : 1-57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "M =60;# in gm/mole\n",
      "Rho = 6.23;# in gm/cc\n",
      "n = 4;\n",
      "N_A = 6.023*10**23;\n",
      "# Rho = (n*M)/(N_A*((a)**3));\n",
      "a = ( (n*M)/(N_A*Rho) )**(1/3);# in cm\n",
      "r = (a*sqrt(2))/4;# in cm\n",
      "r = r * 10**8;# in \u00c5\n",
      "print \"The radius = %0.3f \u00c5\" %r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radius = 1.414 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.5 - Page No : 1-57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "Rho = 5.96;# in gm/cc\n",
      "M = 50;\n",
      "n = 2;\n",
      "N_A = 6.023*10**23;\n",
      "#Formula Rho = (n*M)/(N_A*((a)**3));\n",
      "a = ( (n*M)/(N_A*Rho) )**(1/3);# in cm\n",
      "r = (a*sqrt(3))/4;# in cm\n",
      "P_F = (2*(4/3)*pi*((r)**3))/((a)**3);# Packing factor\n",
      "print \"The Packing factor = %0.2f\" %P_F"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Packing factor = 0.68\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.6 - Page No : 1-58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "d = 5.2;# in gm/cc\n",
      "n = 2;\n",
      "M = 120;\n",
      "N_A = 6.023*10**23;\n",
      "m = M/N_A;#mass of 1 atom in gm\n",
      "m = n*m;#mass of unit cell in gm\n",
      "g = 20;# in gm\n",
      "m = g/m;# in unit cells\n",
      "print \"The number of unit cell in its 20 gm = %0.3e\" %m"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of unit cell in its 20 gm = 5.019e+22\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 1.22.7 - Page No : 1-58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "Rho = 2.48;# in gm/cc\n",
      "K = 39;# molecular weight of K\n",
      "F = 19; # molecular weight of F\n",
      "M = K+F;# molecular weight of KF\n",
      "n = 4;\n",
      "N_A = 6.023*10**23;\n",
      "#Formula Rho = (n*M)/(N_A*((a)**3));\n",
      "a = ( (n*M)/(N_A*Rho) )**(1/3);# in cm\n",
      "a = a * 10**8;# in \u00c5\n",
      "r = (a*sqrt(2))/4;# in \u00c5\n",
      "r = 2*r;# in \u00c5\n",
      "print \"The distance between ions = %0.1f \u00c5\" %r\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between ions = 3.8 \u00c5\n"
       ]
      }
     ],
     "prompt_number": 34
    }
   ],
   "metadata": {}
  }
 ]
}