summaryrefslogtreecommitdiff
path: root/Materials_Science_and_Engineering/Chapter3.ipynb
diff options
context:
space:
mode:
authorhardythe12015-06-03 15:27:17 +0530
committerhardythe12015-06-03 15:27:17 +0530
commitdf60071cf1d1c18822d34f943ab8f412a8946b69 (patch)
treeab059cf19bad4a1233a464ccf5d72cf8b3fb323c /Materials_Science_and_Engineering/Chapter3.ipynb
parentfba055ce5aa0955e22bac2413c33493b10ae6532 (diff)
downloadPython-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.tar.gz
Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.tar.bz2
Python-Textbook-Companions-df60071cf1d1c18822d34f943ab8f412a8946b69.zip
add books
Diffstat (limited to 'Materials_Science_and_Engineering/Chapter3.ipynb')
-rwxr-xr-xMaterials_Science_and_Engineering/Chapter3.ipynb218
1 files changed, 218 insertions, 0 deletions
diff --git a/Materials_Science_and_Engineering/Chapter3.ipynb b/Materials_Science_and_Engineering/Chapter3.ipynb
new file mode 100755
index 00000000..6aa9a60d
--- /dev/null
+++ b/Materials_Science_and_Engineering/Chapter3.ipynb
@@ -0,0 +1,218 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 03 : Crystalgeometry and Structure Determination"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.2, Page No 25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "sc_n = 1.0/8 \t\t# sharing of one lattice point in a unit cell\n",
+ "sc_N = 8.0\t\t \t# Number of lattice points in Simple cubic \n",
+ "bcc_n_e = 1.0/4\t\t# sharing of one edge lattice point in a BCC \n",
+ "bcc_N_e = 4.0\t\t# Number of edge lattice point in a BCC \n",
+ "bcc_n_c = 1.0\t\t# sharing of one body center lattice point in a BCC \n",
+ "bcc_N_c = 1.0\t\t# Number of body center lattice point in a BCC \n",
+ "fcc_n_e = 1.0/8 \t# sharing of one corner lattice point in a FCC \n",
+ "fcc_N_e = 8.0\t\t# Number of corner lattice point in a FCC \n",
+ "fcc_n_f = 1.0/2 \t# sharing of one face center lattice point in a FCC \n",
+ "fcc_N_f = 6.0\t\t# Number of face center lattice point in a FCC \n",
+ "\n",
+ "#Calculations\n",
+ "sc_net = sc_n*sc_N\n",
+ "bcc_net = bcc_n_e*bcc_N_e+bcc_n_c*bcc_N_c\n",
+ "fcc_net = fcc_n_e*fcc_N_e+fcc_n_f*fcc_N_f\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print(\"Effective number of lattice points are as:\")\n",
+ "print(\"Space lattice \\t Abbreviation \\t Effective number of lattice point in unit cell \\n\")\n",
+ "print(\"Simple cubic \\t\\tSC \\t\\t %.2f \" %sc_net)\n",
+ "print(\"Body center cubic\\tBCC \\t\\t %.2f \" %bcc_net)\n",
+ "print(\"Face centered cubic\\tFCC \\t\\t %.2f \" %fcc_net)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Effective number of lattice points are as:\n",
+ "Space lattice \t Abbreviation \t Effective number of lattice point in unit cell \n",
+ "\n",
+ "Simple cubic \t\tSC \t\t 1.00 \n",
+ "Body center cubic\tBCC \t\t 2.00 \n",
+ "Face centered cubic\tFCC \t\t 4.00 \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.7, Page No 40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "a = 3.16 #lattice parameter in angstrom\n",
+ "l1 = 1.0 # line number\n",
+ "l2 = 2.0 # line number\n",
+ "l3 = 3.0 # line number\n",
+ "l4 = 4.0 # line number\n",
+ "theta1 = 20.3 # angle for line 1\n",
+ "theta2 = 29.2 # angle for line 2\n",
+ "theta3 = 36.7 # angle for line 3\n",
+ "theta4 = 43.6 # angle for line 4\n",
+ "n = 1 # order \n",
+ "lambda1 = 1.54 # wavelength in angstrom\n",
+ "\n",
+ "#Calculations\n",
+ "d1 = lambda1/(2*math.sin(theta1*math.pi/180))\n",
+ "d2 = lambda1/(2*math.sin(theta2*math.pi/180))\n",
+ "d3 = lambda1/(2*math.sin(theta3*math.pi/180))\n",
+ "d4 = lambda1/(2*math.sin(theta4*math.pi/180))\n",
+ "x1 = a**2/d1**2 \n",
+ "x2 = a**2/d2**2 \n",
+ "x3 = a**2/d3**2 \n",
+ "x4 = a**2/d4**2 \t\t# where x is function of h,k and l\n",
+ "\n",
+ "#Results\n",
+ "print(\"Interplanar spacing is %.3f angstrom \" %x1) # answer in book is 2.220 angstrom\n",
+ "if math.floor(x1) == 2 :\n",
+ " print(\"For a^2/d^2 = %.2f \\t Reflection plane is 110\" %math.floor(x1))\n",
+ "\n",
+ "if math.floor(x2) == 4 :\n",
+ "\tprint(\"For a^2/d^2 = %.2f \\t Reflection plane is 200\" %math.floor(x2))\n",
+ "\n",
+ "if math.floor(x3) == 6 :\n",
+ " print(\"For a^2/d^2 = %.2f \\t Reflection plane is 211\" %math.floor(x3))\n",
+ "\n",
+ "if math.floor(x4) == 8 :\n",
+ "\tprint(\"For a^2/d^2 = %.2f \\t Reflection plane is 220\" %math.floor(x4))\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Interplanar spacing is 2.027 angstrom \n",
+ "For a^2/d^2 = 2.00 \t Reflection plane is 110\n",
+ "For a^2/d^2 = 4.00 \t Reflection plane is 200\n",
+ "For a^2/d^2 = 6.00 \t Reflection plane is 211\n",
+ "For a^2/d^2 = 8.00 \t Reflection plane is 220\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3.8, Page No 45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#initialisation of variables\n",
+ "d = 114.6 # diameter of power camera in angstrom\n",
+ "lambda1 = 1.54 # wavelength in angstrom\n",
+ "s1 = 86.0\n",
+ "s2 = 100.0\n",
+ "s3 = 148.0\n",
+ "s4 = 180.0\n",
+ "s5 = 188.0\n",
+ "s6 = 232.0 \n",
+ "s7 = 272.0\n",
+ "\n",
+ "#Calculations\n",
+ "R = d/2 # Radius \n",
+ "if R==57.3 :\n",
+ " k = 1.0/4 \t\t\t# Bragg angle factor\n",
+ "a1 = (math.sin(s1*k*math.pi/180))**2\n",
+ "a2 = (math.sin(s2*k*math.pi/180))**2\n",
+ "a3 = (math.sin(s3*k*math.pi/180))**2\n",
+ "a4 = (math.sin(s4*k*math.pi/180))**2\n",
+ "a5 = (math.sin(s5*k*math.pi/180))**2\n",
+ "a6 = (math.sin(s6*k*math.pi/180))**2\n",
+ "a7 = (math.sin(s7*k*math.pi/180))**2\n",
+ "\n",
+ "c = 22 # constant to convert into integral number\n",
+ "\n",
+ "#Results\n",
+ "print(\"Within experimental error, values are as in integral ratio are as:\")\n",
+ "print(\"%.2f \" %math.ceil(c*a1))\n",
+ "print(\"%.2f \" %math.ceil(c*a2))\n",
+ "print(\"%.2f \" %math.ceil(c*a3))\n",
+ "print(\"%.2f \" %math.ceil(c*a4))\n",
+ "print(\"%.2f \" %math.ceil(c*a5))\n",
+ "print(\"%.2f \" %math.ceil(c*a6))\n",
+ "print(\"%.2f \" %math.ceil(c*a7))\n",
+ "\n",
+ "print(\"\\n So, this structure is FCC and material is copper with 3.62 angstrom lattice parameter\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Within experimental error, values are as in integral ratio are as:\n",
+ "3.00 \n",
+ "4.00 \n",
+ "8.00 \n",
+ "11.00 \n",
+ "12.00 \n",
+ "16.00 \n",
+ "19.00 \n",
+ "\n",
+ " So, this structure is FCC and material is copper with 3.62 angstrom lattice parameter\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file