.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/crystal/crystal_systems/plot_01_crystal_systems.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_crystal_crystal_systems_plot_01_crystal_systems.py: Weiss's crystal systems: classifying a unit cell by its axes ============================================================= Christian Samuel Weiss (1815) sorted crystals into *systems* by the lengths of, and angles between, their crystallographic axes -- the idea that survives as today's 7 crystal systems. :func:`~chemistrykit.crystal.systems.crystal_systems.classify_crystal_system` classifies a unit cell purely from the equalities/inequalities among its six lattice parameters :math:`(a,b,c,\alpha,\beta,\gamma)`, and :func:`~chemistrykit.crystal.systems.crystal_systems.unit_cell_volume` gives the general-cell volume formula that reduces to familiar shortcuts (:math:`abc`, :math:`\frac{\sqrt3}{2}a^2c`) in special cases. .. GENERATED FROM PYTHON SOURCE LINES 17-30 .. code-block:: Python import numpy as np from chemistrykit.crystal.systems.crystal_systems import classify_crystal_system, unit_cell_volume cells = { "NaCl (rock salt)": (5.640, 5.640, 5.640, 90.0, 90.0, 90.0), "TiO2 (rutile)": (4.593, 4.593, 2.959, 90.0, 90.0, 90.0), "alpha-quartz": (4.913, 4.913, 5.405, 90.0, 90.0, 120.0), "calcite (rhombohedral setting)": (6.375, 6.375, 6.375, 46.08, 46.08, 46.08), "gypsum": (5.679, 15.202, 6.522, 90.0, 113.83, 90.0), "K2Cr2O7 (potassium dichromate)": (7.418, 7.318, 13.379, 98.6, 90.4, 95.5), } .. GENERATED FROM PYTHON SOURCE LINES 31-36 .. code-block:: Python for name, (a, b, c, alpha, beta, gamma) in cells.items(): system = classify_crystal_system(a, b, c, alpha, beta, gamma) V = unit_cell_volume(a, b, c, alpha, beta, gamma) print(f"{name:35s} -> {system:14s} V = {V:8.2f} A^3") .. rst-class:: sphx-glr-script-out .. code-block:: none NaCl (rock salt) -> cubic V = 179.41 A^3 TiO2 (rutile) -> tetragonal V = 62.42 A^3 alpha-quartz -> hexagonal V = 112.98 A^3 calcite (rhombohedral setting) -> trigonal V = 122.63 A^3 gypsum -> monoclinic V = 515.06 A^3 K2Cr2O7 (potassium dichromate) -> triclinic V = 714.64 A^3 .. GENERATED FROM PYTHON SOURCE LINES 37-39 A right-angle (orthorhombic/tetragonal/cubic) cell's volume is exactly a*b*c -- the general formula's simplest special case: .. GENERATED FROM PYTHON SOURCE LINES 39-44 .. code-block:: Python V_general = unit_cell_volume(4.593, 4.593, 2.959, 90.0, 90.0, 90.0) V_shortcut = 4.593 * 4.593 * 2.959 print(f"\nRutile: general formula = {V_general:.4f}, a*b*c shortcut = {V_shortcut:.4f}") assert np.isclose(V_general, V_shortcut) .. rst-class:: sphx-glr-script-out .. code-block:: none Rutile: general formula = 62.4220, a*b*c shortcut = 62.4220 .. GENERATED FROM PYTHON SOURCE LINES 45-47 The hexagonal shortcut (sqrt(3)/2 * a^2 * c) matches the general formula too, for quartz's hexagonal cell: .. GENERATED FROM PYTHON SOURCE LINES 47-52 .. code-block:: Python a, c = 4.913, 5.405 V_general = unit_cell_volume(a, a, c, 90.0, 90.0, 120.0) V_shortcut = (np.sqrt(3.0) / 2.0) * a**2 * c print(f"Quartz: general formula = {V_general:.4f}, hexagonal shortcut = {V_shortcut:.4f}") assert np.isclose(V_general, V_shortcut) .. rst-class:: sphx-glr-script-out .. code-block:: none Quartz: general formula = 112.9848, hexagonal shortcut = 112.9848 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.001 seconds) .. _sphx_glr_download_api_gallery_crystal_crystal_systems_plot_01_crystal_systems.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_crystal_systems.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_crystal_systems.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_crystal_systems.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_