{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 3: X-Ray Diffraction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 1, Page number 3.9" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "maximum order of diffraction is 1.53\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "d=1.181; #lattice spacing(angstrom)\n", "theta=90*math.pi/180; #glancing angle(radian)\n", "lamda=1.540; #wavelength of X-rays(angstrom)\n", "\n", "#Calculation\n", "n=2*d*math.sin(theta)/lamda; #maximum order of diffraction \n", "\n", "#Result\n", "print \"maximum order of diffraction is\",round(n,2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 2, Page number 3.9" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "cube edge of unit cell is 3.514 angstrom\n", "answer given in the book varies due to rounding off errors\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "n=1; #order\n", "theta=9.5*math.pi/180; #glancing angle(radian)\n", "lamda=0.58; #wavelength(angstrom)\n", "h=2;\n", "k=0;\n", "l=0;\n", "\n", "#Calculation\n", "d=n*lamda/(2*math.sin(theta)); #lattice parameter(angstrom)\n", "a=d*math.sqrt(h**2+k**2+l**2); #cube edge of unit cell(angstrom)\n", "\n", "#Result\n", "print \"cube edge of unit cell is\",round(a,3),\"angstrom\"\n", "print \"answer given in the book varies due to rounding off errors\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 3, Page number 3.10" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "glancing angle for 3rd order is 26 degrees 35 minutes\n", "answer for minutes given in the book is wrong\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "theta=(8+(35/60))*math.pi/180; #glancing angle(radian)\n", "lamda=0.842; #wavelength of X-rays(angstrom)\n", "n1=1; #order\n", "n3=3; #order \n", "\n", "#Calculation\n", "theta3=math.asin(n3*lamda*math.sin(theta)/(n1*lamda))*180/math.pi; #glancing angle for 3rd order(degrees)\n", "theta3d=int(theta3); #glancing angle for 3rd order(degrees) \n", "theta3m=(theta3-theta3d)*60; #glancing angle for 3rd order(minutes)\n", "\n", "#Result\n", "print \"glancing angle for 3rd order is\",theta3d,\"degrees\",int(theta3m),\"minutes\"\n", "print \"answer for minutes given in the book is wrong\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 4, Page number 3.10" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "interplanar spacing is 2.22 angstrom\n", "value of h**2+k**2+l**2 is 2\n", "miller indices are (110) or (011) or (101)\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "theta=20.3*math.pi/180; #glancing angle(radian)\n", "lamda=1.54; #wavelength of X-rays(angstrom)\n", "n=1; #order\n", "a=3.16; #lattice parameter(angstrom)\n", "\n", "#Calculation\n", "d=n*lamda/(2*math.sin(theta)); #interplanar spacing(angstrom)\n", "x=(a/d)**2; #assume x=(h**2+k**2+l**2)\n", "\n", "#Result\n", "print \"interplanar spacing is\",round(d,2),\"angstrom\"\n", "print \"value of h**2+k**2+l**2 is\",int(x)\n", "print \"miller indices are (110) or (011) or (101)\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 5, Page number 3.11" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "wavelength is 1.553 angstrom\n", "energy of X-rays is 8 *10**3 eV\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "n=4; #order\n", "A=107.87; #atomic weight(kg)\n", "theta=(19+(12/60))*math.pi/180; #glancing angle(radian)\n", "h=1;\n", "k=1;\n", "l=1;\n", "N=6.02*10**26; #avagadro number\n", "rho=10500; #density(kg/m**3)\n", "H=6.625*10**-34; #plancks constant(Js)\n", "c=3*10**8; #velocity of light(m/s)\n", "e=1.6*10**-19; #charge(coulomb)\n", "\n", "#Calculation\n", "a=round(((n*A/(N*rho))**(1/3))*10**10,2); #lattice parameter(angstrom)\n", "d=a/math.sqrt((h**2)+(k**2)+(l**2)); #lattice parameter(angstrom)\n", "lamda=2*d*math.sin(theta); #wavelength(angstrom)\n", "E=H*c/(lamda*10**-10*e); #energy of X-rays(eV)\n", "\n", "#Result\n", "print \"wavelength is\",round(lamda,3),\"angstrom\"\n", "print \"energy of X-rays is\",int(round(E/10**3)),\"*10**3 eV\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 6, Page number 3.12" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "specimen distance is 7.559 cm\n", "answer given in the book varies due to rounding off errors\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "h=1;\n", "k=1;\n", "l=1;\n", "a=4.57; #lattice parameter(angstrom)\n", "lamda=1.52; #wavelength(angstrom)\n", "r=5; #radius(cm)\n", "\n", "#Calculation\n", "d=a/math.sqrt(h**2+k**2+l**2); #lattice parameter(angstrom)\n", "theta=math.asin(lamda/(2*d)); #glancing angle(degrees)\n", "X=r/math.tan(2*theta); #specimen distance(cm)\n", "\n", "#Result\n", "print \"specimen distance is\",round(X,3),\"cm\"\n", "print \"answer given in the book varies due to rounding off errors\"" ] } ], "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 }