{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#1: Bonding in Solids"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.1, Page number 1.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bond energy is -4.6 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;   #charge of electron(c)\n",
    "epsilon0=8.85*10**-12;    #permittivity(C/Nm)\n",
    "r0=236*10**-12;     #seperation(m)\n",
    "IE=5.14;     #ionisation energy of Na(eV)\n",
    "Ea=-3.65;     #electron affinity(eV)\n",
    "\n",
    "#Calculation\n",
    "V=-e**2/(4*e*math.pi*epsilon0*r0);     \n",
    "BE=IE+Ea+round(V,2);       #bond energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"bond energy is\",round(BE,1),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.2, Page number 1.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total cohesive energy per atom is -3.0684 eV\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.602*10**-19;   #charge of electron(c)\n",
    "epsilon0=8.85*10**-12;    #permittivity(C/Nm)\n",
    "r0=0.314*10**-9;     #seperation(m)\n",
    "A=1.75;    #madelung constant\n",
    "n=5.77;    #repulsive exponent value\n",
    "IE=4.1;     #ionisation energy of K(eV)\n",
    "Ea=3.6;     #electron affinity(eV)\n",
    "\n",
    "#Calculation\n",
    "E=-A*e**2*(1-(1/n))/(4*e*math.pi*epsilon0*r0);      #energy(eV)\n",
    "Ce=E/2;      #cohesive energy per atom(eV)\n",
    "x=IE-Ea;     #energy(eV)\n",
    "CE=Ce+(x/2);    #total cohesive energy per atom(eV)\n",
    "\n",
    "#Result\n",
    "print \"total cohesive energy per atom is\",round(CE,4),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.3, Page number 1.12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy is -7.965 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.602*10**-19;   #charge of electron(c)\n",
    "epsilon0=8.85*10**-12;    #permittivity(C/Nm)\n",
    "r0=0.281*10**-9;     #seperation(m)\n",
    "alpham=1.748;    #madelung constant\n",
    "n=9;    #repulsive exponent value\n",
    "\n",
    "#Calculation\n",
    "E=-alpham*e**2*(1-(1/n))/(4*e*math.pi*epsilon0*r0);      #cohesive energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy is\",round(E,3),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.4, Page number 1.12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential energy is 5.755 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;   #charge of electron(c)\n",
    "epsilon0=8.85*10**-12;    #permittivity(C/Nm)\n",
    "r0=2.5*10**-10;     #seperation(m)\n",
    "\n",
    "#Calculation\n",
    "PE=e**2/(4*e*math.pi*epsilon0*r0);     #potential energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"potential energy is\",round(PE,3),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.5, Page number 1.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy is -3.46 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=1;\n",
    "n=9;     #repulsive exponent value\n",
    "a=1.748*10**-28;     \n",
    "r0=0.281*10**-9;     #seperation(m)\n",
    "\n",
    "#Calculation\n",
    "Ur0=-a*(1-(m/n))/(e*r0**m);    #cohesive energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy is\",round(Ur0,2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.6, Page number 1.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy is -3.59 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;   #charge of electron(c)\n",
    "epsilon0=8.85*10**-12;    #permittivity(C/Nm)\n",
    "r0=0.281*10**-9;     #seperation(m)\n",
    "IE=5.14;     #ionisation energy of Na(eV)\n",
    "Ea=-3.61;     #electron affinity(eV)\n",
    "\n",
    "#Calculation\n",
    "V=-e**2/(4*e*math.pi*epsilon0*r0);     \n",
    "CE=IE+Ea+round(V,2);       #cohesive energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy is\",CE,\"eV\""
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}