{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1: Bonding in Solids"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1, Page number 1-11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bond energy of molecule 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(coulomb)\n",
    "epsilon0=8.85*10**-12;   \n",
    "r0=236*10**-12;     #equilibrium distance(m)\n",
    "I=5.14;             #ionisation energy(eV)\n",
    "EA=-3.65;           #electron affinity(eV)\n",
    "\n",
    "#Calculation\n",
    "V=-(e**2)/(4*e*math.pi*epsilon0*r0);   #potential(eV)\n",
    "BE=I+EA+V;          #bond energy of molecule(eV)\n",
    "\n",
    "#Result\n",
    "print \"bond energy of molecule is\",round(BE,1),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2, Page number 1-11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy per atom is -3.0684 eV\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.602*10**-19;      #charge(coulomb)\n",
    "epsilon0=8.85*10**-12;   \n",
    "r0=0.314*10**-9;      #equilibrium distance(m)\n",
    "A=1.75;               #madelung constant\n",
    "n=5.77;               #born constant\n",
    "I=4.1;                #ionisation energy(eV)\n",
    "EA=3.6;               #electron affinity(eV)\n",
    "\n",
    "#Calculation\n",
    "V=-A*e**2*((n-1)/n)/(4*e*math.pi*epsilon0*r0);\n",
    "CE=round(V,4)/2;    #potential energy per ion(eV)\n",
    "x=(I-EA)/2;\n",
    "TCE=CE+x;           #cohesive energy per atom(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy per atom is\",TCE,\"eV\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3, Page number 1-12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy per atom 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(coulomb)\n",
    "epsilon0=8.85*10**-12;   \n",
    "r0=0.281*10**-9;      #equilibrium distance(m)\n",
    "alphaM=1.748;         #madelung constant\n",
    "n=9;                  #born constant\n",
    "\n",
    "#Calculation\n",
    "CE=-alphaM*e**2*((n-1)/n)/(4*e*math.pi*epsilon0*r0);    #cohesive energy per molecule(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy per atom is\",round(CE,3),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4, Page number 1-12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential energy of system is 5.75 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;      #charge(coulomb)\n",
    "epsilon0=8.85*10**-12;   \n",
    "r0=2.5*10**-10;     #equilibrium distance(m)\n",
    "\n",
    "#Calculation\n",
    "PE=e**2/(4*e*math.pi*epsilon0*r0);\n",
    "\n",
    "#Result\n",
    "print \"potential energy of system is\",round(PE,2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5, Page number 1-13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy of NaCl is -3.46 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "e=1.6*10**-19;      #charge(coulomb)\n",
    "r0=0.281*10**-9;    #equilibrium distance(m)\n",
    "a=1.748*10**-28;    #madelung constant(J m**2)\n",
    "n=9;                #repulsive exponent value\n",
    "m=1;\n",
    "\n",
    "#Calculations\n",
    "Ur0=-a*(1-m/n)/(e*r0**m);      #cohesive energy of NaCl(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy of NaCl is\",round(Ur0,2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 6, Page number 1-13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cohesive energy of molecule 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(coulomb)\n",
    "epsilon0=8.85*10**-12;   \n",
    "r0=0.281*10**-9;    #equilibrium distance(m)\n",
    "I=5.14;             #ionisation energy(eV)\n",
    "EA=-3.61;           #electron affinity(eV)\n",
    "\n",
    "#Calculation\n",
    "V=-(e**2)/(4*e*math.pi*epsilon0*r0);   #potential(eV)\n",
    "CE=I+EA+V;          #cohesive energy of molecule(eV)\n",
    "\n",
    "#Result\n",
    "print \"cohesive energy of molecule is\",round(CE,2),\"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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}