{
 "metadata": {
  "name": "",
  "signature": "sha256:f1c728f94d30127360e83c10a55164d3b256772685ed9e2e28ae6d78b3f4a0ae"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Crystal Imperfections"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.1, Page number 207 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k=1.38*10**-23;\n",
      "Ev=0.98;    #energy in eV/atom\n",
      "T1=900;      #temperature in C\n",
      "T2=1000;\n",
      "A=6.022*10**26;       #avagadro's constant\n",
      "w=196.9;       #atomic weight in g/mol\n",
      "d=18.63;         #density in g/cm^3\n",
      "\n",
      "#Calculation\n",
      "Ev=Ev*1.6*10**-19;     #converting eV to J\n",
      "d=d*10**3;    #converting g/cm^3 into kg/m^3\n",
      "N=(A*d)/w;\n",
      "n=N*math.exp(-Ev/(k*T1));\n",
      "#let valency fraction n/N be V\n",
      "V=math.exp(-Ev/(k*T2));\n",
      "\n",
      "#Result\n",
      "print(\"concentration of atoms per m^3 is\",N);\n",
      "print(\"number of vacancies per m^3 is\",n);\n",
      "print(\"valency fraction is\",V);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n",
        "('number of vacancies per m^3 is', 1.8742498047705634e+23)\n",
        "('valency fraction is', 1.1625392535344139e-05)\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.2, Page number 208 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k=1.38*10**-23;\n",
      "A=6.022*10**26;       #avagadro's constant\n",
      "T=1073;     #temperature in K\n",
      "n=3.6*10**23;     #number of vacancies\n",
      "d=9.5;        #density in g/cm^3\n",
      "w=107.9;       #atomic weight in g/mol\n",
      "\n",
      "#Calculation\n",
      "d=d*10**3;     #converting g/cm^3 into kg/m^3\n",
      "N=(A*d)/w;    #concentration of atoms\n",
      "E=k*T*math.log((N/n), );     #energy in J\n",
      "EeV=E/(1.602176565*10**-19);    #energy in eV\n",
      "EeV=math.ceil(EeV*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print(\"concentration of atoms per m^3 is\",N);\n",
      "print(\"energy for vacancy formation in J\",E);\n",
      "print(\"energy for vacancy formation in eV\",EeV);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n",
        "('energy for vacancy formation in J', 1.762092900344914e-19)\n",
        "('energy for vacancy formation in eV', 1.1)\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.3, Page number 209 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "A=6.022*10**26;       #avagadro's constant\n",
      "k=1.38*10**-23;\n",
      "w1=39.1;       #atomic weight of K\n",
      "w2=35.45;       #atomic weight of Cl\n",
      "Es=2.6;       #energy formation in eV\n",
      "T=500;      #temperature in C\n",
      "d=1.955;        #density in g/cm^3\n",
      "\n",
      "#Calculation\n",
      "Es=Es*1.6*10**-19;        #converting eV to J\n",
      "T=T+273;      #temperature in K\n",
      "d=d*10**3;     #converting g/cm^3 into kg/m^3\n",
      "N=(A*d)/(w1+w2);\n",
      "n=N*math.exp(-Es/(2*k*T));\n",
      "\n",
      "#Result\n",
      "print(\"number of Schotky defect per m^3 is\",n);\n",
      "\n",
      "#answer given in the book is wrong by 3rd decimal point"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}