{
 "metadata": {
  "name": "",
  "signature": "sha256:64e1fbee0e1d9b8157cae12a98a7773b847a3c5e842a9d3f124a5485fe931875"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2: Crystal Structure"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page number 2.16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import sqrt \n",
      "\n",
      "#Variable declaration\n",
      "#Assuming r=1 for simpliciy in calculations\n",
      "r = 1\n",
      "\n",
      "#Calculations\n",
      "a = (4*r)/sqrt(3)\n",
      "#Let R be the radius of interstitial sphere that can fit into the void,therefore,\n",
      "R = (a-2*r)/2     \n",
      "\n",
      "#Result\n",
      "print \"The maximum radius of interstitial sphere is\",round(R,3),\"r\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum radius of interstitial sphere is 0.155 r\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, Page number 2.17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "r1 = 1.258*10**-10   #atomic radius(m)\n",
      "r2 = 1.292*10**-10   #atomic radius(m)\n",
      "\n",
      "#Calculations\n",
      "#In BCC\n",
      "a_bcc = (4*r1)/sqrt(3)\n",
      "v_bcc = a_bcc**3          #volume of unit cell(m^3)\n",
      "n1 = ((1./8.)*8.)+1\n",
      "V1 = v_bcc/n1             #volume occupied by 1 atom(m^3)\n",
      "\n",
      "#In FCC\n",
      "a_fcc = 2*sqrt(2)*r2\n",
      "v_fcc = a_fcc**3          #volume of unit cell(m^3)\n",
      "n2 = ((1./2.)*6.)+((1./8.)*8.)\n",
      "V2 = v_fcc/n2             #volume occupied by 1 atom(m^3)\n",
      "\n",
      "del_v = ((V1-V2)/V1)*100  #change in volume\n",
      "\n",
      "#Result\n",
      "print \"During the conversion of iron from BCC to FCC, the decrease in volume is\",round(del_v,1),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "During the conversion of iron from BCC to FCC, the decrease in volume is 0.5 %\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3, Page number 2.17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "a = 0.27*10**-9   #nearest neighbour distance(m)\n",
      "c = 0.494*10**-9  #height of unit cell(m)\n",
      "M = 65.37         #atomic weight of zinc\n",
      "N = 6.023*10**26  #Avogadro's number(k/mol)\n",
      "\n",
      "#Calculations\n",
      "V = (3*sqrt(3)*a**2*c)/2  #volume of unit cell\n",
      "rho = (6*M)/(N*V)         #density of crystal\n",
      "\n",
      "#Results\n",
      "print \"Volume of unit cell =\",round((V/1E-29),2),\"*10^29 m^3\"\n",
      "print \"Density of zinc =\",round(rho),\"kg/m^3\"\n",
      "print \"\\nThe solution differs because of rounding-off of the digits in the textbook\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume of unit cell = 9.36 *10^29 m^3\n",
        "Density of zinc = 6960.0 kg/m^3\n",
        "\n",
        "The solution differs because of rounding-off of the digits in the textbook\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4, Page number 2.18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import sqrt\n",
      "\n",
      "#Varaible declaration\n",
      "#Let r be the radius of atom and R be the radius of sphere\n",
      "#For simplicity in calculations, let us assume r =1\n",
      "r = 1\n",
      "\n",
      "#Calculations\n",
      "#For FCC structure\n",
      "a = (4*r)/sqrt(2)\n",
      "R = (a/2)-r\n",
      "\n",
      "print \"Maximum radius of sphere =\",round(R,3),\"r\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum radius of sphere = 0.414 r\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5, Page number 2.19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "a = 0.356*10**-9  #cube edge(m)\n",
      "M = 12.01         #atomic weight of carbon\n",
      "N = 6.023*10**26  #Avogadro's number(k/mol)\n",
      "na = 1.77*10**29  #no. of atoms per meter cube\n",
      "\n",
      "#Calculations\n",
      "#Diamond has 2 interpenetrating FCC lattices. Since each FCC unit cell has 4 atoms, the total no. of atoms per unit cell is 8\n",
      "n = 8/a**3\n",
      "m = M/N\n",
      "rho = m*na\n",
      "\n",
      "#Result\n",
      "print \"Number of atoms =\",round((n/1E+29),3),\"*10^29\"\n",
      "print \"The density of diamond is\",round(rho,1),\"kg/m^3(Calculation mistake in the textbook)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of atoms = 1.773 *10^29\n",
        "The density of diamond is 3529.4 kg/m^3(Calculation mistake in the textbook)\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.6, Page number 2.19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "rho = 2.18  #density of NaCl(gm/cm^3)\n",
      "N = 6.023*10**23  #Avogadro's number(/mol)\n",
      "\n",
      "#Caculations\n",
      "w = 23+35.5  #molecular weight of NaCl\n",
      "m = w/N      #mass of NaCl molecule\n",
      "nm = rho/m    #no. of molecules per unit volume(molecule/cm^3)\n",
      "#Since NaCl is diatomic\n",
      "n = 2*nm\n",
      "#Let a be the distance between adjacent atoms in NaCl and\n",
      "#    n be the no. of atoms along the edge of the cube\n",
      "#length of an edge = na\n",
      "#volume of unit cube = n^3*a^3\n",
      "a = (1/n)**(1./3.)\n",
      "\n",
      "#Result\n",
      "print \"The distance between two adjacent atoms is\",round((a/1E-8),2),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between two adjacent atoms is 2.81 A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7, Page number 2.20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "w = 63.5           #atomic weight of copper\n",
      "r = 1.278*10**-8   #atomic rdius(m)\n",
      "N = 6.023*10**23   #Avogadro's number(/mol)\n",
      "\n",
      "#Calculations\n",
      "m = w/N    #mass of each copper atom(gm)\n",
      "#Since copper has FCC structure lattice constant\n",
      "a = (4*r)/sqrt(2) \n",
      "n = 4      #no. of atoms in unit cell of FCC structure\n",
      "M = n*m    #mass of unit cell\n",
      "rho = M/a**3  #density\n",
      "\n",
      "#Result\n",
      "print \"Density of copper =\",round(rho,2),\"gm/cm^3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Density of copper = 8.93 gm/cm^3\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}