{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1 CRYSTAL STRUCTURES"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_4 pgno:22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1.0\n",
      "r=a/2 =  0.5\n",
      "Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)=  0.523598775598\n",
      "Total Volume of the cube ,V=aˆ3 =  1.0\n",
      "Fp(S.C)=(v∗100/V)=  52.3598775598\n"
     ]
    }
   ],
   "source": [
    "#exa 1.4\n",
    "from math import pi\n",
    "a=1.\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=a/2.\n",
    "print \"r=a/2 = \",r # initializing value of radius of atom for simple cubic .\n",
    "v=((4*pi*(r**3))/3)\n",
    "print \"Volume of one atom ,v=((4∗%pi∗(rˆ3))/3)= \",v # calcuation . \n",
    "V=a**3\n",
    "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(S.C)=(v∗100/V)= \",Fp,# calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1_5 pgno:24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1.0\n",
      "Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) =  0.433012701892\n",
      "Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 =  0.680174761588\n",
      "Total Volume of the cube ,V=aˆ3 =  1.0\n",
      "Fp(B.C.C)=(v∗100/V)=  68.0174761588 %\n"
     ]
    }
   ],
   "source": [
    "#exa 1.5\n",
    "from math import sqrt\n",
    "a=1.\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=(sqrt(3)*(a**2/4))\n",
    "print \"Radius of the atoms,r=(sqrt(3)∗(aˆ2/4)) = \",r # initializing value of radius of atom for BCC.\n",
    "v=((4*pi*(r**3))/3)*2\n",
    "print \"Volume of two atom,v=((4∗pi∗(rˆ3))/3)∗2 = \",v # calcuation \n",
    "V=a**3\n",
    "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(B.C.C)=(v∗100/V)= \",Fp,\"%\" # calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_6 pgno:25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1\n",
      "Radius of the atom,r=(a/(2∗sqrt(2)))=  0.353553390593\n",
      "Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)=  0.740480489693\n",
      "Total volume of the cube ,V=aˆ3=  2\n",
      "Fp(F.C.C)=(v∗100/V)=  37.0240244847 %\n"
     ]
    }
   ],
   "source": [
    "#exa 1.6\n",
    "a=1\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=(a/(2*sqrt(2)))\n",
    "print \"Radius of the atom,r=(a/(2∗sqrt(2)))= \",r  # initializing value of radius of atom for FCC .\n",
    "v=(((4*pi*(r**3))/3)*4)\n",
    "print \"Volume of the four atom,v=(((4∗pi∗(rˆ3))/3)∗4)= \",v # calcuation \n",
    "V=a^3\n",
    "print \"Total volume of the cube ,V=aˆ3= \",V  #  calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(F.C.C)=(v∗100/V)= \",Fp,\"%\"  # calculation\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_8 pgno:26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a=  1\n",
      "Radius of the atom , r=(sqrt (3)∗a/8))=  0.216506350946\n",
      "v=(((4∗pi∗(rˆ3))/3)∗8) =  0.340087380794\n",
      "V=aˆ3=  2\n",
      "Fp(Diamond)=(v∗100/V) =  17.0043690397 %\n"
     ]
    }
   ],
   "source": [
    "#Exa 1.8 \n",
    "a=1\n",
    "print \"a= \",a # initializing value of lattice constant(a)=1.\n",
    "r=((sqrt(3)*a/8))\n",
    "print \"Radius of the atom , r=(sqrt (3)∗a/8))= \",r # initializing value of radius of atom for diamond .\n",
    "v=(((4*pi*(r**3))/3)*8)\n",
    "print \"v=(((4∗pi∗(rˆ3))/3)∗8) = \",v # calcuation .\n",
    "V=a^3\n",
    "print \"V=aˆ3= \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(Diamond)=(v∗100/V) = \",Fp,\"%\" # calculation\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## example 1_9 pgno:28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a =  5e-08  cm\n",
      "Radius of the atom,r=(sqrt(3)∗(a/4))=  2.16506350946e-08\n",
      "Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2=  8.50218451985e-23\n",
      "Total Volume of the cube ,V=aˆ3 =  1.25e-22\n",
      "Fp(B.C.C)=(v∗100/V) =  68.0174761588 %\n"
     ]
    }
   ],
   "source": [
    "#exa 1.9\n",
    "a=5*10**-8\n",
    "print \"a = \",a,\" cm\" # initializing value of lattice constant .\n",
    "r=(sqrt(3)*(a/4))\n",
    "print \"Radius of the atom,r=(sqrt(3)∗(a/4))= \",r  # initializing value of radius of atom for BCC.\n",
    "v=((4*pi*(r**3))/3)*2\n",
    "print \"Volume of the two atoms ,v=((4∗pi∗(rˆ3))/3)∗2= \",v # calcuation .\n",
    "V=a**3\n",
    "print \"Total Volume of the cube ,V=aˆ3 = \",V # calcuation .\n",
    "Fp=(v*100/V)\n",
    "print \"Fp(B.C.C)=(v∗100/V) = \",Fp,\"%\"  #  calculation"
   ]
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}