{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# NANO106 - Symmetry Computations on $mmm (D_{2h})$ Point Group\n", "*by Shyue Ping Ong*\n", "\n", "This notebook demonstrates the computation of orbits in the mmm point group. It is part of course material for UCSD's NANO106 - Crystallography of Materials. Unlike the $m\\overline{3}m (O_h)$ version, this duplicates relevant code from the symmetry package to explicitly demonstrate the priniciples of generating point group symmetry operations. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Preliminaries\n", "\n", "Let's start by importing the numpy, sympy and other packages we need." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n", "import itertools\n", "from sympy import symbols" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will now define a useful function for checking existence of np.arrays in a list of arrays. It is not the most efficient implementation, but would suffice for our purposes." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def in_array_list(array_list, a):\n", " for i in array_list:\n", " if np.all(np.equal(a, i)):\n", " return True\n", " return False" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Generating the Symmetry Operations\n", "\n", "Next, we specify the generators for mmm point group, which are the three mirror planes. Note that the existence of the three two-fold rotation axes is implied by the existence of the three mirror planes." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "generators = []\n", "for i in xrange(3):\n", " g = np.eye(3).astype(np.int)\n", " g[i, i] = -1\n", " generators.append(g)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will now generate all the group symmetry operation matrices from the generators." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The order of the group is 8. The group matrices are:\n", "[[-1 0 0]\n", " [ 0 1 0]\n", " [ 0 0 1]]\n", "[[ 1 0 0]\n", " [ 0 -1 0]\n", " [ 0 0 1]]\n", "[[ 1 0 0]\n", " [ 0 1 0]\n", " [ 0 0 -1]]\n", "[[1 0 0]\n", " [0 1 0]\n", " [0 0 1]]\n", "[[-1 0 0]\n", " [ 0 -1 0]\n", " [ 0 0 1]]\n", "[[-1 0 0]\n", " [ 0 1 0]\n", " [ 0 0 -1]]\n", "[[ 1 0 0]\n", " [ 0 -1 0]\n", " [ 0 0 -1]]\n", "[[-1 0 0]\n", " [ 0 -1 0]\n", " [ 0 0 -1]]\n" ] } ], "source": [ "symm_ops = []\n", "symm_ops.extend(generators)\n", "new_ops = generators\n", "\n", "while len(new_ops) > 0:\n", " gen_ops = []\n", " for g1, g2 in itertools.product(new_ops, symm_ops):\n", " #Note that we cast the op to int to improve presentation of the results.\n", " #This is fine in crystallographic reference frame.\n", " op = np.dot(g1, g2)\n", " if not in_array_list(symm_ops, op):\n", " gen_ops.append(op)\n", " symm_ops.append(op)\n", " op = np.dot(g2, g1)\n", " if not in_array_list(symm_ops, op):\n", " gen_ops.append(op)\n", " symm_ops.append(op)\n", " new_ops = gen_ops\n", "print \"The order of the group is %d. The group matrices are:\" % len(symm_ops)\n", "for op in symm_ops:\n", " print op" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Computing Orbits\n", "\n", "Using sympy, we specify the symbolic symbols x, y, z to represent position coordinates. We also define a function to generate the orbit given a set of symmetry operations and a point p." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [], "source": [ "x, y, z = symbols(\"x y z\")\n", "\n", "def get_orbit(symm_ops, p):\n", " \"\"\"Given a set of symmops and a point p, this function returns the orbit\"\"\"\n", " orbit = []\n", " for o in symm_ops:\n", " pp = np.dot(o, p)\n", " if not in_array_list(orbit, pp):\n", " orbit.append(pp)\n", " return orbit" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Orbit for General Position" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "For the general position [x y z], the orbit is \n", "[-x y z] [x -y z] [x y -z] [x y z] [-x -y z] [-x y -z] [x -y -z] [-x -y -z]\n" ] } ], "source": [ "p = np.array([x, y, z])\n", "print \"For the general position %s, the orbit is \" % str(p)\n", "for o in get_orbit(symm_ops, p):\n", " print o," ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Orbit for Special Position on two-fold rotation axes" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "For the special position [0 0 z] on the two-fold axis, the orbit comprise 2 points:\n", "[0 0 z] [0 0 -z]\n" ] } ], "source": [ "p = np.array([0, 0, z])\n", "orb = get_orbit(symm_ops, p)\n", "print \"For the special position %s on the two-fold axis, the orbit comprise %d points:\" % (str(p), len(orb))\n", "for o in orb:\n", " print o," ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The orbit is similar for the other two-fold axes on the a and b axes are similar." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Orbit for Special Position on mirror planes\n", "\n", "Positions on the mirror on the a-b plane have coordinates (x, y, 0)." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "For the special position [x y 0] on the two-fold axis, the orbit comprise 4 points:\n", "[-x y 0] [x -y 0] [x y 0] [-x -y 0]\n" ] } ], "source": [ "p = np.array([x, y, 0])\n", "orb = get_orbit(symm_ops, p)\n", "print \"For the special position %s on the two-fold axis, the orbit comprise %d points:\" % (str(p), len(orb))\n", "for o in orb:\n", " print o," ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The orbit is similar for the other two mirror planes on the a-c and b-c planes are similar." ] } ], "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.9" } }, "nbformat": 4, "nbformat_minor": 0 }