{ "metadata": { "name": "", "signature": "sha256:201c0242c8a2063b9a355e5a7deec7582a5a21b0e1187464be6b9fa32a384889" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3:Crystal planes and X-ray diffraction" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.2, Page number 3.5" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "from sympy import *\n", "\n", "#Variable declaration\n", "'''In a simple cubic structure, there are three types of atomic arrangement\n", "(i)(100)\n", "(ii)(110)\n", "(iii)(111)'''\n", "\n", "#Calculations and results\n", "\n", "#Consider (100) plane\n", "n = (1./4.)*4 #no. of atoms in this plane\n", "#Let a be the lattice constant in mm\n", "a = Symbol('a')\n", "A1 = a**2\n", "nm = n/A1 #no. of atoms per mm^2\n", "print \"The number of atoms per square millimeter for (100) plane is\",nm\n", "\n", "#Consider (110) plane\n", "n2 = 1 \n", "A2 = math.sqrt(2)*a**2\n", "nm2 = n2/A2\n", "print \"The number of atoms per square millimeter for (110) plane is\",nm2\n", "\n", "#Consider (111) plane\n", "n3 = (1./360.)*60*3\n", "EO = a*math.sqrt(2)*math.cos(math.pi/6)\n", "A3 = (a*math.sqrt(2)*EO)/2\n", "nm3 = n3/A3\n", "print \"The number of atoms per square millimeter for (111) plane is\",nm3" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The number of atoms per square millimeter for (100) plane is 1.0/a**2\n", "The number of atoms per square millimeter for (110) plane is 0.707106781186547/a**2\n", "The number of atoms per square millimeter for (111) plane is 0.577350269189626/a**2\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.3, Page number 3.6" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from math import sqrt\n", "\n", "#Variable declartion\n", "r = 0.1278*10**-9 #atomic radius(m)\n", "\n", "#Calculations\n", "#For FCC structure,\n", "a = (4*r)/sqrt(2)\n", "\n", "#For (110) plane,\n", "h1 = 1\n", "k1 = 1\n", "l1 = 0\n", "d1 = a/((h1**2+k1**2+l1**2)**0.5) \n", "\n", "#For (212) plane,\n", "h2 = 2\n", "k2 = 1\n", "l2 = 2\n", "d2 = a/((h2**2+k2**2+l2**2)**0.5)\n", "\n", "#Results\n", "print \"Interplanar spacing for (110) plane =\",d1/1E-9,\"nm\"\n", "print \"Interplanar spacing for (212) plane =\",round((d2/1E-9),4),\"nm\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Interplanar spacing for (110) plane = 0.2556 nm\n", "Interplanar spacing for (212) plane = 0.1205 nm\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.4, Page number 3.7" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from sympy import *\n", "\n", "#Variable declaration\n", "#Let a be the lattice constant\n", "#For calculations, let us assume a = 1\n", "a = 1\n", "\n", "#Calculations\n", "\n", "#For (100) plane,\n", "h1 = 1\n", "k1 = 0\n", "l1 = 0\n", "d1 = 1/((h1**2+k1**2+l1**2)**0.5) \n", "\n", "#For (110) plane,\n", "h2 = 1\n", "k2 = 1\n", "l2 = 0\n", "d2 = 1/((h2**2+k2**2+l2**2)**0.5)\n", "\n", "#For (111) plane,\n", "h3 = 1\n", "k3 = 1\n", "l3 = 1\n", "d3 = 1/((h3**2+k3**2+l3**2)**0.5)\n", "\n", "#Result\n", "print \"d100:d110:d111 =\",d1,\":\",d2,\":\",d3" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "d100:d110:d111 = 1.0 : 0.707106781187 : 0.57735026919\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.5, Page number 3.7" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "#Coefficients of intercepts along three axes\n", "m = 1.\n", "n = 1./2.\n", "p = 3.\n", "\n", "#Calculations\n", "m_inv = 1/m \n", "n_inv = 1/n\n", "p_inv = 1/p\n", "\n", "def gcd(a, b):\n", " while b: \n", " a, b = b, a % b\n", " return a\n", "\n", "def lcm(a, b):\n", " return (a * b)/ gcd(a, b)\n", "\n", "def lcmm(*args): \n", " return reduce(lcm, args)\n", "\n", "mul_fact = lcmm(1,1,3)\n", "m1 = m_inv*mul_fact #Clear the first fraction\n", "m2 = n_inv*mul_fact #Clear the second fraction\n", "m3 = p_inv*mul_fact #Clear the third fraction\n", "print \"The required miller indices are\", m1,m2,m3\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The required miller indices are 3.0 6.0 1.0\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.6, Page number 3.14" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "d = 0.282*10**-9 #lattice spacing(m)\n", "n = 1 #first order\n", "theta = 8.35 #glancing angle(degrees)\n", "\n", "#Calculations\n", "lamda = (2*d*math.sin(math.radians(theta)))/n\n", "\n", "#For maximum value possible,\n", "theta = 90\n", "n = (2*d)/lamda\n", "\n", "#Results\n", "print \"Wavelength of X-rays =\",round((lamda/1E-9),4),\"nm\"\n", "print \"Maximum order of diffraction possible =\",round(n,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Wavelength of X-rays = 0.0819 nm\n", "Maximum order of diffraction possible = 6.89\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.8, Page number 3.15" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "lamda = 1.5418*10**-10 #wavelength(m)\n", "theta = 30 #angle(degrees)\n", "n = 1 #first order\n", "#For (111) plane\n", "h = 1\n", "k = 1\n", "l = 1\n", "\n", "#Calculations\n", "d = (n*lamda)/(2*math.sin(math.radians(theta)))\n", "a = d*((h**2+k**2+l**2)**0.5)\n", "\n", "#Result\n", "print \"Interatomic spacing =\",round((a/1E-10),3),\"A\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Interatomic spacing = 2.67 A\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.9, Page number 3.15" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from math import sqrt, pi \n", "\n", "#Variable declaration\n", "d = 0.28 #lattice spacing\n", "lamda = 0.074*10**-9 #Wavelength(m)\n", "n = 2 #2nd order\n", "\n", "#Calculations\n", "d110 = d/sqrt(2)\n", "theta = math.asin((n*lamda)/(2*d110))*180/pi\n", "\n", "#Result\n", "print \"Glancing angle =\",round(theta/1E-9),\"degrees\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Glancing angle = 21.0 degrees\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.10, Page number 3.16" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "a = 0.38*10**-9 #lattice constant\n", "h = 1\n", "k = 1\n", "l = 0\n", "\n", "#Calculations\n", "d = a/math.sqrt(h**2+k**2+l**2)\n", "\n", "#Result\n", "print \"Distance =\",round((d/1E-9),2),\"nm\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Distance = 0.27 nm\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3.11, Page number 3.16" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "from sympy import *\n", "\n", "#Variable declaration\n", "a = Symbol('a')\n", "\n", "#Calculations\n", "#For (110) plane\n", "a1 = math.sqrt(2)*a**2 #area of plane\n", "n1 = (1./4 )*4 #no. of atoms in this plane\n", "rho1 = n1/a1\n", "\n", "#For (111) plane\n", "EO = (a*math.sqrt(3))/math.sqrt(2)\n", "a2 = (a*EO)/math.sqrt(2)\n", "n2 = 3*(1./6.)\n", "rho2 = n2/a2\n", "\n", "#Result\n", "print \"Density of lattice points (111) plane:density of lattice points (110) plane =\",rho2,\":\",rho1" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Density of lattice points (111) plane:density of lattice points (110) plane = 0.577350269189626/a**2 : 0.707106781186547/a**2\n" ] } ], "prompt_number": 12 } ], "metadata": {} } ] }