{ "cells": [ { "cell_type": "markdown", "metadata": { "nbsphinx": "hidden" }, "source": [ "This notebook is part of the orix documentation https://orix.readthedocs.io. Links to the documentation wonâ€™t work from the notebook." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Visualizing point groups\n", "\n", "This tutorial shows point group symmetry operations in the stereographic projection.\n", "\n", "Vectors located on the upper (z >= 0) hemisphere are displayed as points (o), whereas vectors on the lower hemisphere are reprojected onto the upper hemisphere and shown as crosses (+) by default.\n", "For more information about plot formatting and visualization, see [Vector3d.scatter()](../reference/generated/orix.vector.Vector3d.scatter.rst).\n", "\n", "Further explanation of these figures is provided at http://xrayweb.chem.ou.edu/notes/symmetry.html#point." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "from matplotlib import pyplot as plt\n", "import numpy as np\n", "\n", "from orix import plot\n", "from orix.quaternion import Rotation, symmetry\n", "from orix.vector import Vector3d\n", "\n", "plt.rcParams.update({\"font.size\": 15})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For example, the O (432) point group:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "nbsphinx-thumbnail": { "tooltip": "Point group symmetry operations visualized in the stereographic projection" }, "tags": [ "nbsphinx-thumbnail" ] }, "outputs": [], "source": [ "symmetry.O.plot()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$(\\mathbf{e_1}, \\mathbf{e_2}, \\mathbf{e_3})$ are the unit vectors of the standard Cartesian (orthonormal) reference frame (see the [crystal reference frame tutorial](../tutorials/crystal_reference_frame.ipynb) for more details).\n", "\n", "The stereographic projection of all point groups is shown below:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# fmt: off\n", "schoenflies = [\n", " \"C1\", \"Ci\", # triclinic,\n", " \"C2x\", \"C2y\", \"C2z\", \"Csx\", \"Csy\", \"Csz\", \"C2h\", # monoclinic\n", " \"D2\", \"C2v\", \"D2h\", # orthorhombic\n", " \"C4\", \"S4\", \"C4h\", \"D4\", \"C4v\", \"D2d\", \"D4h\", # tetragonal\n", " \"C3\", \"S6\", \"D3x\", \"D3y\", \"D3\", \"C3v\", \"D3d\", \"C6\", # trigonal\n", " \"C3h\", \"C6h\", \"D6\", \"C6v\", \"D3h\", \"D6h\", # hexagonal\n", " \"T\", \"Th\", \"O\", \"Td\", \"Oh\", # cubic\n", "]\n", "# fmt: on\n", "\n", "assert len(symmetry._groups) == len(schoenflies)\n", "\n", "schoenflies = [\n", " s for s in schoenflies if not (s.endswith(\"x\") or s.endswith(\"y\"))\n", "]\n", "\n", "assert len(schoenflies) == 32\n", "\n", "orientation = Rotation.from_axes_angles((-1, 8, 1), 65, degrees=True)\n", "\n", "fig, ax = plt.subplots(\n", " nrows=8,\n", " ncols=4,\n", " figsize=(10, 20),\n", " subplot_kw=dict(projection=\"stereographic\"),\n", ")\n", "ax = ax.ravel()\n", "\n", "for i, s in enumerate(schoenflies):\n", " sym = getattr(symmetry, s)\n", "\n", " ori_sym = sym.outer(orientation)\n", " v = ori_sym * Vector3d.zvector()\n", "\n", " # reflection in the projection plane (x-y) is performed internally in\n", " # Symmetry.plot() or when using the reproject=True argument for\n", " # Vector3d.scatter()\n", " v_reproject = Vector3d(v.data.copy())\n", " v_reproject.z *= -1\n", "\n", " # the Symmetry marker formatting for vectors on the upper and lower\n", " # hemisphere can be set using kwargs and reproject_scatter_kwargs,\n", " # respectively, for Symmetry.plot()\n", "\n", " # vectors on the upper hemisphere are shown as open circles\n", " ax[i].scatter(v, marker=\"o\", fc=\"None\", ec=\"k\", s=150)\n", " # vectors on the lower hemisphere are reprojected onto the upper\n", " # hemisphere and shown as crosses\n", " ax[i].scatter(v_reproject, marker=\"+\", ec=\"C0\", s=150)\n", "\n", " ax[i].set_title(f\"${s}$ $({sym.name})$\")\n", " ax[i].set_labels(\"$e_1$\", \"$e_2$\", None)\n", "\n", "fig.tight_layout()" ] } ], "metadata": { "interpreter": { "hash": "4396f389b93e7269692bd3bea4c62813bbe379469bde939b058805f538feec11" }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" } }, "nbformat": 4, "nbformat_minor": 4 }