diff options
Diffstat (limited to 'sample_notebooks/AjayTheetla')
-rwxr-xr-x | sample_notebooks/AjayTheetla/Chapter_1.ipynb | 208 | ||||
-rwxr-xr-x | sample_notebooks/AjayTheetla/Chapter_1_1.ipynb | 208 |
2 files changed, 416 insertions, 0 deletions
diff --git a/sample_notebooks/AjayTheetla/Chapter_1.ipynb b/sample_notebooks/AjayTheetla/Chapter_1.ipynb new file mode 100755 index 00000000..328727e3 --- /dev/null +++ b/sample_notebooks/AjayTheetla/Chapter_1.ipynb @@ -0,0 +1,208 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:628a3355094b4b8d081efb2e248a73ea4bad0a7cd7bbbadfae2b2aceebecc70b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1 - Molecular distances"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Angle required\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "l=0.71 *10**-8 #cm\n",
+ "n=200. #lines/cm\n",
+ "v=0.00145 #radian\n",
+ "#calculations\n",
+ "d=1/n\n",
+ "phi2=2*l/d +v**2\n",
+ "phi=math.sqrt(phi2)\n",
+ "#results\n",
+ "print '%s %.2e %s' %('Angle required =',phi,'radian')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Angle required = 2.22e-03 radian\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Interplanar distance\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "angle=37.25 #degrees\n",
+ "l=1.539 #A\n",
+ "n=1. #order\n",
+ "#calculations\n",
+ "d=n*l/(2*math.sin(angle/180.*math.pi))\n",
+ "#results\n",
+ "print '%s %.3f %s' %(\"Interplanar distance =\",d,\"A\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Interplanar distance = 1.271 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - pg 9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the ratio of radii\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "r1=math.sqrt(3.)\n",
+ "r2=1\n",
+ "#calculations\n",
+ "ratio=r1-r2\n",
+ "#results\n",
+ "print '%s %.3f' %('Ratio of radii =',ratio)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ratio of radii = 0.732\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Avagadro number\n",
+ "#Initialization of variables\n",
+ "d=2.64 #g/cc\n",
+ "l=4.016*10**-8 #cm\n",
+ "n=4\n",
+ "M=25.94 #g/mol\n",
+ "#calculations\n",
+ "m=d*l**3 /n\n",
+ "N0=M/m\n",
+ "#results\n",
+ "print '%s %.3e %s' %(\"Avagadro number =\",N0,\" molecule/mol\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Avagadro number = 6.068e+23 molecule/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - pg 15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the angle required\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "A=numpy.array([-1, -1, -1 ])\n",
+ "B=numpy.array([1, 1, -1])\n",
+ "#calculations\n",
+ "Ad=math.sqrt(1+1+1)\n",
+ "Bd=math.sqrt(1+1+1)\n",
+ "dot=numpy.dot(A,B) /(Ad*Bd) \n",
+ "theta=math.acos(dot) *180./math.pi\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Angle =\",theta,\" degrees\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Angle = 109.47 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/sample_notebooks/AjayTheetla/Chapter_1_1.ipynb b/sample_notebooks/AjayTheetla/Chapter_1_1.ipynb new file mode 100755 index 00000000..328727e3 --- /dev/null +++ b/sample_notebooks/AjayTheetla/Chapter_1_1.ipynb @@ -0,0 +1,208 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:628a3355094b4b8d081efb2e248a73ea4bad0a7cd7bbbadfae2b2aceebecc70b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1 - Molecular distances"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Angle required\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "l=0.71 *10**-8 #cm\n",
+ "n=200. #lines/cm\n",
+ "v=0.00145 #radian\n",
+ "#calculations\n",
+ "d=1/n\n",
+ "phi2=2*l/d +v**2\n",
+ "phi=math.sqrt(phi2)\n",
+ "#results\n",
+ "print '%s %.2e %s' %('Angle required =',phi,'radian')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Angle required = 2.22e-03 radian\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Interplanar distance\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "angle=37.25 #degrees\n",
+ "l=1.539 #A\n",
+ "n=1. #order\n",
+ "#calculations\n",
+ "d=n*l/(2*math.sin(angle/180.*math.pi))\n",
+ "#results\n",
+ "print '%s %.3f %s' %(\"Interplanar distance =\",d,\"A\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Interplanar distance = 1.271 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - pg 9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the ratio of radii\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "r1=math.sqrt(3.)\n",
+ "r2=1\n",
+ "#calculations\n",
+ "ratio=r1-r2\n",
+ "#results\n",
+ "print '%s %.3f' %('Ratio of radii =',ratio)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ratio of radii = 0.732\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Avagadro number\n",
+ "#Initialization of variables\n",
+ "d=2.64 #g/cc\n",
+ "l=4.016*10**-8 #cm\n",
+ "n=4\n",
+ "M=25.94 #g/mol\n",
+ "#calculations\n",
+ "m=d*l**3 /n\n",
+ "N0=M/m\n",
+ "#results\n",
+ "print '%s %.3e %s' %(\"Avagadro number =\",N0,\" molecule/mol\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Avagadro number = 6.068e+23 molecule/mol\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - pg 15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the angle required\n",
+ "#Initialization of variables\n",
+ "import math\n",
+ "import numpy\n",
+ "A=numpy.array([-1, -1, -1 ])\n",
+ "B=numpy.array([1, 1, -1])\n",
+ "#calculations\n",
+ "Ad=math.sqrt(1+1+1)\n",
+ "Bd=math.sqrt(1+1+1)\n",
+ "dot=numpy.dot(A,B) /(Ad*Bd) \n",
+ "theta=math.acos(dot) *180./math.pi\n",
+ "#results\n",
+ "print '%s %.2f %s' %(\"Angle =\",theta,\" degrees\")\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Angle = 109.47 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |