{
 "metadata": {
  "name": "",
  "signature": "sha256:7f366d2ca1671042b1f87ae7b598f1c0353e6f5b6feadb85488043da7746af76"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "13: Crystal Structure"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 13.2, Page number 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "rho=9.6*10**2;    #density of Na(kg/m**3)\n",
      "aw=23;    #atomic weight\n",
      "n=2;   #number of atoms in a unit cell\n",
      "N=6.022*10**26;\n",
      "\n",
      "#Calculation\n",
      "a3=n*aw/(N*rho);\n",
      "a=a3**(1/3);      #lattice constant of Na(m)\n",
      "\n",
      "#Result\n",
      "print \"lattice constant of Na is\",round(a*10**10,1),\"angstrom\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "lattice constant of Na is 4.3 angstrom\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 13.3, Page number 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "rho=4*10**3;    #density of CsCl(kg/m**3)\n",
      "aw1=132.9;    #atomic weight of Cs\n",
      "aw2=35.5;    #atomic weight of Cl\n",
      "a=4.12*10**-10;   #lattice constant(m)\n",
      "n=1;   #number of atoms in a unit cell\n",
      "\n",
      "#Calculation\n",
      "m=rho*(a**3);   #mass of CsCl unit cell(kg)\n",
      "N=n*(aw1+aw2)/m;   #avagadro constant(per kg mole)\n",
      "\n",
      "#Result\n",
      "print \"avagadro constant is\",round(N/10**26,4),\"*10**26 per kg mole\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "avagadro constant is 6.0199 *10**26 per kg mole\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 13.8, Page number 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "a=4.12*10**-10;   #lattice constant(m)\n",
      "h1=1;\n",
      "k1=1;\n",
      "l1=1;   #for (111) plane\n",
      "h2=1;\n",
      "k2=1;\n",
      "l2=2;   #for (112) plane\n",
      "h3=1;\n",
      "k3=2;\n",
      "l3=3;   #for (123) plane\n",
      "\n",
      "#Calculation\n",
      "d111=a/math.sqrt(h1**2+k1**2+l1**2);   #lattice spacing for plane (111)(m)\n",
      "d112=a/math.sqrt(h2**2+k2**2+l2**2);   #lattice spacing for plane (112)(m)\n",
      "d123=a/math.sqrt(h3**2+k3**2+l3**2);   #lattice spacing for plane (123)(m)\n",
      "\n",
      "#Result\n",
      "print \"lattice spacing for plane (111) is\",round(d111*10**10,4),\"*10**-10 m\"\n",
      "print \"lattice spacing for plane (112) is\",round(d112*10**10,3),\"*10**-10 m\"\n",
      "print \"lattice spacing for plane (123) is\",round(d123*10**10,4),\"*10**-10 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "lattice spacing for plane (111) is 2.3787 *10**-10 m\n",
        "lattice spacing for plane (112) is 1.682 *10**-10 m\n",
        "lattice spacing for plane (123) is 1.1011 *10**-10 m\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 13.9, Page number 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#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;   #for (100) plane\n",
      "h2=1;\n",
      "k2=1;\n",
      "l2=0;   #for (110) plane\n",
      "h3=1;\n",
      "k3=1;\n",
      "l3=1;   #for (111) plane\n",
      "\n",
      "#Calculation\n",
      "d100=a/math.sqrt(h1**2+k1**2+l1**2);   #lattice spacing for plane (100)\n",
      "d110=a/math.sqrt(h2**2+k2**2+l2**2);   #lattice spacing for plane (110)\n",
      "d111=a/math.sqrt(h3**2+k3**2+l3**2);   #lattice spacing for plane (111)\n",
      "\n",
      "#Result\n",
      "print \"ratio of lattice spacing is d100:d110:d111=\",d100,\":\",round(d110,2),\":\",round(d111,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ratio of lattice spacing is d100:d110:d111= 1.0 : 0.71 : 0.58\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}