{
 "metadata": {
  "name": "",
  "signature": "sha256:cbd11433a31785853e9886e91140f1df1e44a2e02ec46a10cd5dc4781d714654"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8: Atomic Physics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3, Page 285"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "delta_E = 0.0021;    # Energy difference for the 3p subshell of sodium, eV\n",
      "h = 6.62e-034;    # Planck's constant, Js\n",
      "h_bar = h/(2*math.pi);    # Reduced Planck's constant, Js\n",
      "e = 1.602e-019;    # Energy equivalent of 1 eV, J\n",
      "m = 9.11e-031;    # Rest of an an electron, kg\n",
      "g_s = 2;    # Gyromagnetic ratio due to spin splitting\n",
      "\n",
      "#Calculations\n",
      "# As delta_E = g_s*e*h_bar/(2*m)*B, solving for B\n",
      "B = m*delta_E/h_bar;    # Internal magnetic field causing the LS splitting, T\n",
      "\n",
      "#Result\n",
      "print \"The internal magnetic field causing the LS splitting = %2d T\"%B"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The internal magnetic field causing the LS splitting = 18 T\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5, Page 289"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "\n",
      "l1 = 1;    # Orbital angular momentum quantum number for first electron\n",
      "l2 = 2;    # Orbital angular momentum quantum number for second electron\n",
      "s1 = 1./2;    # Spin angular momentum quantum number for first electron\n",
      "s2 = 1./2;    # Spin angular momentum quantum number for second electron\n",
      "temp_j = numpy.zeros(15);\n",
      "cnt = 0;\n",
      "print (\"\\nThe all possibe values of the total angular momentum quantum number of J are:\");\n",
      "for L in range(int(abs(l1 - l2)),int(abs(l1 + l2))+1):\n",
      "    for S in range(int(abs(s1 - s2)),int(abs(s1 + s2))+1):\n",
      "        for j in range(abs(L - S),abs(L + S)+1):\n",
      "            temp_j[cnt] = j;\n",
      "            cnt = cnt + 1;\n",
      "\n",
      "\n",
      "J = -1;\n",
      "temp_J = sorted(temp_j)\n",
      "for i in range(len(temp_J)):\n",
      "    if temp_J[i] > J:\n",
      "        J = temp_J[i];\n",
      "        print \"%d  \"%temp_J[i],;\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The all possibe values of the total angular momentum quantum number of J are:\n",
        "0   1   2   3   4  \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8, Page 291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "delta_E = 0.0021;    # Energy difference for the 3p subshell of sodium, eV\n",
      "h = 6.62e-034;    # Planck's constant, Js\n",
      "h_bar = h/(2*math.pi);    # Reduced Planck's constant, Js\n",
      "e = 1.602e-019;    # Energy equivalent of 1 eV, J\n",
      "m = 9.11e-031;    # Rest of an an electron, kg\n",
      "g_s = 2;    # Gyromagnetic ratio due to spin splitting\n",
      "\n",
      "#Calculations\n",
      "# As delta_E = g_s*e*h_bar/(2*m)*B, solving for B\n",
      "B = m*delta_E/h_bar;    # Internal magnetic field causing the LS splitting, T\n",
      "\n",
      "#Result\n",
      "print \"The internal magnetic field causing the LS splitting = %2d T\"%B"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The internal magnetic field causing the LS splitting = 18 T\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}