{
 "metadata": {
  "name": "Chapter 7"
 },
 "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": "#To calculate the number of vacancies and vacancy fraction\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nEv=0.98;    #energy in eV/atom\nT1=900;      #temperature in C\nT2=1000;\nA=6.022*10**26;       #avagadro's constant\nw=196.9;       #atomic weight in g/mol\nd=18.63;         #density in g/cm^3\n\n#Calculation\nEv=Ev*1.6*10**-19;     #converting eV to J\nd=d*10**3;    #converting g/cm^3 into kg/m^3\nN=(A*d)/w;\nn=N*math.exp(-Ev/(k*T1));\n#let valency fraction n/N be V\nV=math.exp(-Ev/(k*T2));\n\n#Result\nprint(\"concentration of atoms per m^3 is\",N);\nprint(\"number of vacancies per m^3 is\",n);\nprint(\"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": "#To calculate the energy for vacancy formation\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nA=6.022*10**26;       #avagadro's constant\nT=1073;     #temperature in K\nn=3.6*10**23;     #number of vacancies\nd=9.5;        #density in g/cm^3\nw=107.9;       #atomic weight in g/mol\n\n#Calculation\nd=d*10**3;     #converting g/cm^3 into kg/m^3\nN=(A*d)/w;    #concentration of atoms\nE=k*T*math.log((N/n), );     #energy in J\nEeV=E/(1.602176565*10**-19);    #energy in eV\nEeV=math.ceil(EeV*10**2)/10**2;   #rounding off to 2 decimals\n\n#Result\nprint(\"concentration of atoms per m^3 is\",N);\nprint(\"energy for vacancy formation in J\",E);\nprint(\"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": "#To calculate the number of Schotky defect\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**26;       #avagadro's constant\nk=1.38*10**-23;\nw1=39.1;       #atomic weight of K\nw2=35.45;       #atomic weight of Cl\nEs=2.6;       #energy formation in eV\nT=500;      #temperature in C\nd=1.955;        #density in g/cm^3\n\n#Calculation\nEs=Es*1.6*10**-19;        #converting eV to J\nT=T+273;      #temperature in K\nd=d*10**3;     #converting g/cm^3 into kg/m^3\nN=(A*d)/(w1+w2);\nn=N*math.exp(-Es/(2*k*T));\n\n#Result\nprint(\"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": {}
  }
 ]
}