.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/structure/point_group/plot_01_point_groups.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_structure_point_group_plot_01_point_groups.py: Schoenflies point-group symbols for water, ammonia, methane, and carbon dioxide ================================================================================ Arthur Schoenflies named every point group after the symmetry elements that generate it: a principal axis :math:`C_n`, extra :math:`C_2` axes (:math:`D_n`), mirror planes :math:`\sigma_v` or :math:`\sigma_h`, an inversion centre :math:`i`, and the special cubic groups :math:`T_d` and :math:`O_h`. This example builds four molecules from their real 3D geometry, lets :func:`~chemistrykit.structure.systems.point_group.determine_point_group` find the symmetry elements by testing the coordinates directly, and shows how the elements it finds spell out each Schoenflies symbol: :math:`C_{2v}`, :math:`C_{3v}`, :math:`T_d` and :math:`D_{\infty h}`. .. GENERATED FROM PYTHON SOURCE LINES 18-59 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from chemistrykit.structure.core.base_system import Molecule from chemistrykit.structure.systems.point_group import determine_point_group from chemistrykit.structure.visualizers.structure_plots import plot_molecule_3d # Water: r(O-H) = 0.958 A, angle(H-O-H) = 104.5 deg. angle = np.radians(104.5) r = 0.958 water = Molecule( symbols=["O", "H", "H"], coordinates=[ [0.0, 0.0, 0.0], [r * np.sin(angle / 2), 0.0, r * np.cos(angle / 2)], [-r * np.sin(angle / 2), 0.0, r * np.cos(angle / 2)], ], bonds=[(0, 1), (0, 2)], ) # Ammonia: trigonal pyramid, r(N-H) = 1.012 A, the three H atoms 0.38 A # below the nitrogen. r_nh, drop = 1.012, 0.38 rho = np.sqrt(r_nh**2 - drop**2) phis = np.radians([90.0, 210.0, 330.0]) ammonia = Molecule( symbols=["N", "H", "H", "H"], coordinates=np.vstack([[0.0, 0.0, 0.0], np.column_stack([rho * np.cos(phis), rho * np.sin(phis), -drop * np.ones(3)])]), bonds=[(0, 1), (0, 2), (0, 3)], ) # Methane: regular tetrahedron, r(C-H) = 1.09 A. verts = np.array([[1.0, 1.0, 1.0], [1.0, -1.0, -1.0], [-1.0, 1.0, -1.0], [-1.0, -1.0, 1.0]]) verts = verts / np.linalg.norm(verts[0]) * 1.09 methane = Molecule(symbols=["C", "H", "H", "H", "H"], coordinates=np.vstack([[0.0, 0.0, 0.0], verts]), bonds=[(0, k) for k in range(1, 5)]) # Carbon dioxide: linear, r(C=O) = 1.16 A. co2 = Molecule(symbols=["O", "C", "O"], coordinates=[[0.0, 0.0, -1.16], [0.0, 0.0, 0.0], [0.0, 0.0, 1.16]], bonds=[(0, 1), (1, 2)]) molecules = {"water": water, "ammonia": ammonia, "methane": methane, "carbon dioxide": co2} .. GENERATED FROM PYTHON SOURCE LINES 60-64 Read the Schoenflies symbol off the elements that were found. The subscript number is the order of the principal axis, ``v`` means mirror planes that contain that axis, and ``d`` / ``h`` mark the diagonal and horizontal planes of the higher groups: .. GENERATED FROM PYTHON SOURCE LINES 64-77 .. code-block:: Python results = {} for name, molecule in molecules.items(): res = determine_point_group(molecule) results[name] = res print( f"{name:15s} -> {res.group_name:8s} principal C_n: n={res.principal_axis_order}, " f"mirror planes: {res.n_mirror_planes}, sigma_v: {res.has_sigma_v}, " f"sigma_h: {res.has_sigma_h}, inversion centre: {res.has_inversion_center}, C3 axes: {res.n_c3_axes}" ) assert [results[k].group_name for k in molecules] == ["C2v", "C3v", "Td", "D_inf_h"] .. rst-class:: sphx-glr-script-out .. code-block:: none water -> C2v principal C_n: n=2, mirror planes: 2, sigma_v: True, sigma_h: False, inversion centre: False, C3 axes: 0 ammonia -> C3v principal C_n: n=3, mirror planes: 3, sigma_v: True, sigma_h: False, inversion centre: False, C3 axes: 1 methane -> Td principal C_n: n=3, mirror planes: 6, sigma_v: True, sigma_h: False, inversion centre: False, C3 axes: 4 carbon dioxide -> D_inf_h principal C_n: n=0, mirror planes: 0, sigma_v: False, sigma_h: True, inversion centre: True, C3 axes: 0 .. GENERATED FROM PYTHON SOURCE LINES 78-79 Plot each molecule with the symbol :func:`determine_point_group` assigned: .. GENERATED FROM PYTHON SOURCE LINES 79-88 .. code-block:: Python fig = plt.figure(figsize=(14, 4)) for i, (name, molecule) in enumerate(molecules.items(), start=1): ax = fig.add_subplot(1, 4, i, projection="3d") plot_molecule_3d(molecule, ax=ax) ax.set_title(f"{name}: {results[name].group_name}", fontsize=10) fig.suptitle("Schoenflies symbols found from the geometry") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/structure/point_group/images/sphx_glr_plot_01_point_groups_001.png :alt: Schoenflies symbols found from the geometry, water: C2v, ammonia: C3v, methane: Td, carbon dioxide: D_inf_h :srcset: /api/gallery/structure/point_group/images/sphx_glr_plot_01_point_groups_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.145 seconds) .. _sphx_glr_download_api_gallery_structure_point_group_plot_01_point_groups.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_point_groups.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_point_groups.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_point_groups.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_