{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1 CRYSTAL STRUCTURES"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_4 pgno:10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1.0\n",
      "r=a/2 =  0.5\n",
      "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)=  0.523598775598\n",
      "Total Volume of the cube ,V=aˆ3 =  1.0\n",
      "Fp(S.C)=(v∗100/V)=  52.3598775598\n"
     ]
    }
   ],
   "source": [
    "#exa 1.4\n",
    "from math import pi\n",
    "a=1.\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=a/2.\n",
    "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n",
    "v=((4*pi*(r**3))/3)\n",
    "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n",
    "V=a**3\n",
    "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_5 pgno:11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1.0\n",
      "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) =  0.433012701892\n",
      "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 =  0.680174761588\n",
      "Total Volume of the cube ,V=aˆ3 =  1.0\n",
      "Fp(B.C.C)=(v∗100/V)=  68.0174761588 %\n"
     ]
    }
   ],
   "source": [
    "#exa 1.5\n",
    "from math import sqrt\n",
    "a=1.\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=(sqrt(3)*(a**2/4))\n",
    "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n",
    "v=((4*pi*(r**3))/3)*2\n",
    "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n",
    "V=a**3\n",
    "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_6 pgno:12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1\n",
      "Radius of the atom,r=(a/(2∗sqrt(2)))=  0.353553390593\n",
      "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)=  0.740480489693\n",
      "Total volume of the cube ,V=aˆ3=  2\n",
      "Fp(F.C.C)=(v∗100/V)=  37.0240244847 %\n"
     ]
    }
   ],
   "source": [
    "#exa 1.6\n",
    "a=1\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=(a/(2*sqrt(2)))\n",
    "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r  # initializing value of radius of atom for FCC .\n",
    "v=(((4*pi*(r**3))/3)*4)\n",
    "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n",
    "V=a^3\n",
    "print \"Total volume of the cube ,V=aˆ3= \",V  #  calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\"  # calculation\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_8 pgno:14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1\n",
      "Radius of the atom , r=(sqrt (3)∗a/8))=  0.216506350946\n",
      "v=(((4∗pi∗(rˆ3))/3)∗8) =  0.340087380794\n",
      "V=aˆ3=  2\n",
      "Fp(Diamond)=(v∗100/V) =  17.0043690397 %\n"
     ]
    }
   ],
   "source": [
    "#Exa 1.8 \n",
    "a=1\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=((sqrt(3)*a/8))\n",
    "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n",
    "v=(((4*pi*(r**3))/3)*8)\n",
    "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n",
    "V=a^3\n",
    "print \"V=aˆ3= \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_9 pgno:14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a =  5e-08  cm\n",
      "Radius of the atom,r=(sqrt(3)∗(a/4))=  2.16506350946e-08\n",
      "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2=  8.50218451985e-23\n",
      "Total Volume of the cube ,V=aˆ3 =  1.25e-22\n",
      "Fp(B.C.C)=(v∗100/V) =  68.0174761588 %\n"
     ]
    }
   ],
   "source": [
    "#exa 1.9\n",
    "a=5*10**-8\n",
    "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n",
    "r=(sqrt(3)*(a/4))\n",
    "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r  # initializing value of radius of atom for BCC.\n",
    "v=((4*pi*(r**3))/3)*2\n",
    "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n",
    "V=a**3\n",
    "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\"  #  calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_10 pgno:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x intercept =  1\n",
      "y intercept =  inf\n",
      "z intercept =  inf\n",
      "miller indices ,h=(1/x )=  [1]\n",
      "k=(1/y)=  [0.0]\n",
      "l=(1/z) =  [0.0]\n"
     ]
    }
   ],
   "source": [
    "#exa 1.10\n",
    "x=1\n",
    "print \"x intercept = \",x # initializing value of x intercept .\n",
    "y=float('inf')\n",
    "print \"y intercept = \",y # initializing value of y intercept .\n",
    "z=float('inf')\n",
    "print \"z intercept = \",z # initializing value of z intercept .\n",
    "h=[1/x]\n",
    "print \"miller indices ,h=(1/x )= \",h # calculation\n",
    "k=[1/y]\n",
    "print \"k=(1/y)= \",k # calculation\n",
    "l=[1/z]\n",
    "print \"l=(1/z) = \",l # calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_11 pgno:15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x intercept =  inf\n",
      "y intercept =  inf\n",
      "z intercept =  1\n",
      "miller indices ,h=[1/x] =  [0.0]\n",
      "k=[1/y] =  [0.0]\n",
      "l=[1/z] =  [1]\n"
     ]
    }
   ],
   "source": [
    "#exa 1.11\n",
    "x=float('inf')\n",
    "print \"x intercept = \",x # initializing of x intercept .\n",
    "y=float('inf') \n",
    "print\"y intercept = \",y # initializing of Y intercept .\n",
    "z=1\n",
    "print \"z intercept = \",z # initializing of Z intercept .\n",
    "h=[1/x]\n",
    "print \"miller indices ,h=[1/x] = \",h # calculation\n",
    "k=[1/y]\n",
    "print \"k=[1/y] = \",k # calculation \n",
    "l=[1/z]\n",
    "print \"l=[1/z] = \",l # calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_12 pgno: 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x intercept =  inf\n",
      "y intercept =  1\n",
      "z intercept =  inf\n",
      "miller indices ,h=[1/x] =  [0.0]\n",
      "k=[1/y] =  [1]\n",
      "l=[1/z] =  [0.0]\n"
     ]
    }
   ],
   "source": [
    "#exa 1.12\n",
    "x=float('inf') \n",
    "print \"x intercept = \",x  # initializing of X intercept .\n",
    "y=1\n",
    "print \"y intercept = \",y  # initializing of X intercept .\n",
    "z=float('inf') \n",
    "print \"z intercept = \",z  # initializing of X intercept .\n",
    "h=[1/x]\n",
    "print \"miller indices ,h=[1/x] = \",h # calculation\n",
    "k=[1/y]\n",
    "print \"k=[1/y] = \",k  # calculation \n",
    "l=[1/z]\n",
    "print \"l=[1/z] = \",l #calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_13 pgno:16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x intercept =  1\n",
      "y intercept =  1\n",
      "z intercept =  inf\n",
      "miller indices ,h=[1/x] =  [1]\n",
      "k=[1/y] =  [1]\n",
      "l=[1/z] =  [0.0]\n"
     ]
    }
   ],
   "source": [
    "#exa 1.13\n",
    "x=1\n",
    "print \"x intercept = \",x  # initializing of X intercept .\n",
    "y=1\n",
    "print \"y intercept = \",y  # initializing of X intercept .\n",
    "z=float('inf') \n",
    "print \"z intercept = \",z  # initializing of X intercept .\n",
    "h=[1/x]\n",
    "print \"miller indices ,h=[1/x] = \",h # calculation\n",
    "k=[1/y]\n",
    "print \"k=[1/y] = \",k  # calculation \n",
    "l=[1/z]\n",
    "print \"l=[1/z] = \",l #calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_14 pgno:17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x intercept =  inf\n",
      "y intercept =  1\n",
      "z intercept =  1\n",
      "miller indices ,h=[1/x] =  [0.0]\n",
      "k=[1/y] =  [1]\n",
      "l=[1/z] =  [1]\n"
     ]
    }
   ],
   "source": [
    "#exa 1.14\n",
    "x=float('inf') \n",
    "print \"x intercept = \",x  # initializing of X intercept .\n",
    "y=1\n",
    "print \"y intercept = \",y  # initializing of X intercept .\n",
    "z=1\n",
    "print \"z intercept = \",z  # initializing of X intercept .\n",
    "h=[1/x]\n",
    "print \"miller indices ,h=[1/x] = \",h # calculation\n",
    "k=[1/y]\n",
    "print \"k=[1/y] = \",k  # calculation \n",
    "l=[1/z]\n",
    "print \"l=[1/z] = \",l #calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_15 pgno:18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x intercept =  2\n",
      "y intercept =  2\n",
      "z intercept =  2\n",
      "common factor of all the intercept=  2\n",
      "miller indices ,h=[c/x] =  [1]\n",
      "k=[c/y] =  [1]\n",
      "l=[c/z] =  [1]\n"
     ]
    }
   ],
   "source": [
    "x=2\n",
    "print \"x intercept = \",x  # initializing of X intercept .\n",
    "y=2\n",
    "print \"y intercept = \",y  # initializing of X intercept .\n",
    "z=2\n",
    "print \"z intercept = \",z  # initializing of X intercept .\n",
    "c=2\n",
    "print \"common factor of all the intercept= \",c  # initializing value of common factor of all the intercepts .\n",
    "h=[c/x]\n",
    "print \"miller indices ,h=[c/x] = \",h # calculation\n",
    "k=[c/y]\n",
    "print \"k=[c/y] = \",k  # calculation \n",
    "l=[c/z]\n",
    "print \"l=[c/z] = \",l #calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_16 pgno: 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wa =  28.1\n",
      "D =  2.33 ram/cmˆ3\n",
      "Na =  6.02e+23 atoms/mole\n",
      "na =(Na∗D)/(Wa)=  4.99167259786e+22  atoms/cmˆ3\n"
     ]
    }
   ],
   "source": [
    "#exa 1.16\n",
    "Wa =28.1\n",
    "print \"Wa = \",Wa # initializing value of atomic weight .\n",
    "D=2.33\n",
    "print \"D = \",D,\"ram/cmˆ3\" # initializing value of density .\n",
    "Na=6.02*10**23\n",
    "print \"Na = \",Na,\"atoms/mole\" # initializing value of avagadro number .\n",
    "na =(Na*D)/(Wa)\n",
    "print \"na =(Na∗D)/(Wa)= \",na,\" atoms/cmˆ3\" # calculation\n",
    "# the value of na (number of atoms in 1 cmˆ3 of silicon ) , provided after calculation in the book is wrong."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_17 pgno: 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  5e-08 cm\n",
      "N=  2\n",
      "V=aˆ3 =  1.25e-22 cmˆ3\n",
      "na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))=  1.6e+22\n"
     ]
    }
   ],
   "source": [
    "#exa 1.17\n",
    "a=5*10**-8\n",
    "print \"a= \",a,\"cm\" # initializing value of lattice constant .\n",
    "N=2\n",
    "print \"N= \",N # initializing value of no. of atoms in unit cell .\n",
    "V=a**3\n",
    "print \"V=aˆ3 = \",V,\"cmˆ3\" # initializing value of total Volume of the unit cell.\n",
    "na =(N/(V))\n",
    "print \"na=(no.of atoms in unit cell/Volume of theunit cell) =(N/(V))= \",na # calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_18 pgno: 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a =  5.43e-08 cm\n",
      "N =  8\n",
      "Number of atom in the cmˆ3,ns =(N/(aˆ3))=  4.99678310227e+22\n"
     ]
    }
   ],
   "source": [
    "#exa 1.18\n",
    "a=5.43*10**-8\n",
    "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n",
    "N=8\n",
    "print \"N = \",N # initializing value of no. of atoms in a unit cell .\n",
    "ns =(N/(a**3))\n",
    "print \"Number of atom in the cmˆ3,ns =(N/(aˆ3))= \",ns #  calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_19 pgno: 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a =  5.43e-08 cm\n",
      "Wa =  28.1\n",
      "Na =  6.02e+23\n",
      "ns =  50000000000000000000000 atoms/cmˆ3\n",
      "Density of silicon ,D =(ns∗Wa)/(Na)=  2.33388704319  gm/cmˆ2\n"
     ]
    }
   ],
   "source": [
    "#exa 1.19\n",
    "a=5.43*10**-8\n",
    "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n",
    "Wa =28.1\n",
    "print \"Wa = \",Wa # initializing value of atomic weight .\n",
    "Na=6.02*10**23\n",
    "print \"Na = \",Na # initializing value of avagdro number .\n",
    "ns =5*10**22\n",
    "print \"ns = \",ns,\"atoms/cmˆ3\" # initializing value of atoms/cmˆ3.\n",
    "D =(ns*Wa)/(Na)\n",
    "print \"Density of silicon ,D =(ns∗Wa)/(Na)= \",D,\" gm/cmˆ2\" # calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_20 pgno: 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a =  4.75e-08 cm\n",
      "N =  4\n",
      "na =(N/(aˆ3))= 3.73232249599e+22\n"
     ]
    }
   ],
   "source": [
    "#exa 1.20\n",
    "a=4.75*10**-8\n",
    "print \"a = \",a,\"cm\" # initializing value of lattice constant .\n",
    "N=4\n",
    "print \"N = \",N # initializing value of number of atoms in the unit cell .\n",
    "na =(N/(a**3))\n",
    "print \"na =(N/(aˆ3))=\",na  #  calculation"
   ]
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}