{
 "metadata": {
  "name": "",
  "signature": "sha256:c896524cb6d8dfdd75df5649979d411984ee380fa5c3cbff49f27851e63b1fb4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:Defects in Solids"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1, Page number 4.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k = 1.38*10**-23   #Boltzmann constant(eV/K)\n",
      "e = 1.6*10**-19    #Electronic charge(C)\n",
      "T1 = 500           #First temperature for metal(K)\n",
      "T2 = 1000          #Second temperature for metal(K)\n",
      "Ev = 1             #Average energy required to create a vacancy in metal(eV)\n",
      "\n",
      "#Calculations\n",
      "x = k/e\n",
      "#n_500 = N*exp(-Ev/T1*k)  ---(1)\n",
      "#n_1000 = N*exp(-Ev/T2*k) ---(2)\n",
      "#Dividing (1) by (2), we get the following expression\n",
      "n = math.exp(Ev/(T2*x))\n",
      "\n",
      "#Result\n",
      "print \"Ratio of vacancies=\",round((n/1E+5),3),\"*10^5\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of vacancies= 1.085 *10^5\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2, Page number 4.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "n1_by_N = 1.*10**-10  #frequency of vacancy sites at 500 C\n",
      "T1 = 500.+273.        #K\n",
      "T2 = 1000.+273.       #K\n",
      "\n",
      "#Calculations\n",
      "x = math.exp((T1/T2)*math.log(n1_by_N))\n",
      "\n",
      "#Result\n",
      "print \"Frequency of vacancy sites at 1000 C =\",round((x/1E-7),4),\"*10^-7\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency of vacancy sites at 1000 C = 8.467 *10^-7\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page number 4.9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "r = 2.82*10**-10  #interionic distance(m)\n",
      "n = 5*10**11      #density of Schottky defect(per m^3)\n",
      "T = 25+273        #temperature(K)\n",
      "k = 8.625*10**-5  #Boltzmann constant(/K)\n",
      "\n",
      "#Calculations\n",
      "v = (2*r)**3       #volume of one unit cell(m^3)\n",
      "N = 4/v           #density of ion pairs\n",
      "Es = 2*k*T*2.303*math.log10(N/n)\n",
      "\n",
      "#Result\n",
      "print \"The average energy required for creation of one Schottky defect is\",round(Es,3),\"eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average energy required for creation of one Schottky defect is 1.971 eV\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page number 4.11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "T1 = 20+273  #K\n",
      "T2 = 300+273 #K\n",
      "Ef = 1.4     #average energy for creating a Freknel defect(eV)\n",
      "k = 8.625*10**-5  #Boltzmann constant(J/K)\n",
      "N = 1             #For simplicity assume total number of metal ions to be unity\n",
      "Ni = 1            #For simplicity assume total number of metal ions to be unity\n",
      "\n",
      "#Calculations\n",
      "n1 = (N*Ni)**0.5*math.exp(-Ef/(2*k*T1)) \n",
      "n2 = (N*Ni)**0.5*math.exp(-Ef/(2*k*T2))      \n",
      "x = n1/n2\n",
      "\n",
      "#Result\n",
      "print \"The ratio of the number of Frenkel defects is\",round((x/1E-6),2),\"*10^-6 or\",round(((1/x)/1E+5),2),\"*10^5\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio of the number of Frenkel defects is 1.32 *10^-6 or 7.56 *10^5\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}