{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 05 : The structure of Solids"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1, Page No 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "n_c = 1.0/8 \t# sharing of corner atom in a unit cell\n",
      "N_c = 8.0 \t\t# Number of corner atoms in unit cell\n",
      "n_b = 1.0 \t\t# sharing of body centered atom in a unit cell\n",
      "N_b = 4.0 \t\t# Number of body centered atoms in unit cell\n",
      "n_f = 0.5\t\t# sharing of face centered atom in a unit cell\n",
      "N_f = 6.0\t\t# Number of face centered atoms in unit cell\n",
      "a = 1.0\t\t\t # let lattice parameter\n",
      "m = 12.0 \t\t# mass of carbon\n",
      "\n",
      "#Calculations\n",
      "N = n_c*N_c+n_b*N_b+n_f*N_f # effective number of atoms\n",
      "r = a*math.sqrt(3.0)/8\n",
      "p_e = N*4/3*math.pi*r**3/a**3 \t\t# packing efficiency\n",
      "print(\"Packing efficiency of diamond is %.2f\" %p_e)\n",
      "a = 3.57 # lattice parameter in angstrom\n",
      "d = m*1.66e-27*N/(a*1e-10)**3\n",
      "\n",
      "#Results\n",
      "print(\"Density of diamond is %d Kg/m^3\" %d)\t\t\t# numerical answer in book is 3500\n",
      "print(\"Density of diamond is %.1f g/cm^3\" %(d/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Packing efficiency of diamond is 0.34\n",
        "Density of diamond is 3502 Kg/m^3\n",
        "Density of diamond is 3.5 g/cm^3\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3, Page No 92"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "a = 1.0 # let\n",
      "PR = a\n",
      "\n",
      "#Calculations\n",
      "RT = a/math.sqrt(3)\n",
      "PT = math.sqrt(PR**2-RT**2)\n",
      "c_a = 2*PT/PR\n",
      "\n",
      "#Results\n",
      "# Calculations are made on the crystal structure drawn in book\n",
      "print(\"c/a ratio for an ideally close packed HCP crystal is %0.3f \" %c_a)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "c/a ratio for an ideally close packed HCP crystal is 1.633 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4, Page No 94"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "r = 1.0 \t\t# let\n",
      "a = 3.0/4.0\n",
      "\n",
      "#Calculations\n",
      "pt = 2*math.sqrt(2/3)*r\n",
      "s = a*pt-r \t\t\t# size of sphere\n",
      "\n",
      "#Results\n",
      "print(\"Size of largest sphere that can fit into a tetrahedral void is %.3f r\" %s)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Size of largest sphere that can fit into a tetrahedral void is -1.000 r\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5 Page No 99"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "theta = 60.0\t # angle in degree\n",
      "\n",
      "#Calculations\n",
      "r_c_a = (2.0/3*2*math.sin(theta*math.pi/180))-1 # ratio calculation\n",
      "\n",
      "#Results\n",
      "print(\"Critical radius ratio for triangular coordination is %0.3f \" %r_c_a)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Critical radius ratio for triangular coordination is 0.155 \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6, Page No 101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "r_mg = 0.78 \t# radius of magnesium cation in angstrom\n",
      "r_o = 1.32 \t\t# radius of oxygen anion in angstrom\n",
      "n = 4.0  \t    # effective number of unit cell\n",
      "m_o = 16.0\t    # mass of oxygen\n",
      "m_mg = 24.3 \t# mass of magnesium\n",
      "\n",
      "#Calculations\n",
      "a = 2*(r_mg+r_o)\t\t\t\t\t\t\t# lattice parameter\n",
      "d = (m_o+m_mg)*1.66e-27*n/(a*1e-10)**3\t\t# density \n",
      "\n",
      "#Results\n",
      "print(\"Density of MgO is %d Kg/m^3\" %d) \t# answer is 3610 kg/m^3\n",
      "print(\"Density of MgO is %0.2f g/cm^3\" %(d/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Density of MgO is 3611 Kg/m^3\n",
        "Density of MgO is 3.61 g/cm^3\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}