Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic plotting of symmetry elements for a point group (Symmetry) in the stereographic projection #456

Open
6 tasks
hakonanes opened this issue Aug 14, 2023 · 5 comments
Labels
documentation Relates to the documentation documentation-examples Consider making into a documentation example enhancement New feature or request help-wanted A little help with this would be nice

Comments

@hakonanes
Copy link
Member

hakonanes commented Aug 14, 2023

We get the Cartesian coordinates of a direct [uvw] or reciprocal lattice vector (hkl) in any of the seven crystal systems (triclinic, monoclinic, orthorhombic, trigonal, tetragonal, hexagonal, and cubic) by using the structure matrix A. This matrix is constructed by aligning the reference frames of the direct (a, b, c) and reciprocal lattices (a*, b*, c*) with an orthonormal Cartesian reference frame (e1, e2, e3). In orix, we only support one alignment, namely e1 || a, e2 || e3 x e1, and e3 || c*. Details are given in this tutorial: https://orix.readthedocs.io/en/stable/tutorials/crystal_reference_frame.html. I suggest we allow any alignment, e.g. e1 || a*, e2 || e3 x e1, and e3 || c, which is used by diffpy.structure. This is a convenience for the user and for developers of other packages relying or planning to rely on orix.

To understand this alignment, the convention, and to debug this addition, we should have automatic plotting of symmetry elements for a point group. There is already functionality for plotting symmetry elements (see this example), but it is not automatic. I've started working on this in a branch in my fork, but haven't found time to continue. I haven't figured out the algorithm yet, either. It would be best if we figure out the visualization based on the symmetry elements dynamically and not by hard-coding... Any help with this would be much appreciated.

My plan is to:

  • Use the style of the stereograms in the book "Structure of Materials" by De Graef and McHenry (similar to this one)
  • Change the default of Symmetry.plot() to this representation and have the current representation (see this tutorial) be an option
  • Add the point groups in steps based on type of symmetry elements:
    • rotations (n-fold)
    • reflections (mirror planes as bold lines)
    • inversions
  • Use this functionality in the docs by adding some examples, update the tutorials, and perhaps add a new one
@hakonanes hakonanes added enhancement New feature or request documentation Relates to the documentation documentation-examples Consider making into a documentation example help-wanted A little help with this would be nice labels Aug 14, 2023
@rbjorge
Copy link

rbjorge commented Aug 18, 2023

Does mtex do this automatically? https://mtex-toolbox.github.io/CrystalReferenceSystem.html

@hakonanes
Copy link
Member Author

Yes, and as you can see from that tutorial, it is very useful to understand crystal axes alignments.

However, if possible, I don't want us to just copy MTEX as this further reduces our chances of re-licensing orix (see #389).

@CSSFrancis
Copy link
Member

Yea I think some sort of visualization would be very helpful (especially for someone like me who is pretty crystallographically illiterate). It's also on my list of things to do. :) Something like a html representation similar to how dask shows chunks would be nice. Most of that is just fancy html and jinja. I've looked into it a bit and I don't think it would too difficult. We could also just plot with Matplotlib which would be nice as well and would be potentially much easier.

If we wanted to be very fancy I've thought about playing around with ipywidgets as well. That would give us more of an interactive 3d representation.

@hakonanes
Copy link
Member Author

Yea I think some sort of visualization would be very helpful

Note that we already have this tutorial (linked above) for visualizing point groups. It doesn't show which symmetry element rotated which point to where, though, which is what I want with the suggested new plot.

Something like a html representation

I think changing the default of Symmetry.plot(), as I suggested above, is the easiest choice at the moment. We have a stereographic projection that is used in many parts of the code (and for classes in diffsims and in kikuchipy) and we should use this. We already have plotting of symmetry elements, we just need to find the right visualization (elipse, triangle, square, hexagon, mirror plane, or inversion) and position for each element in a group...

That would give us more of an interactive 3d representation.

Real 3D would be nice (and not pseudo-3D as with Matplotlib). I've used PyVista for this in kikuchipy, which works great. Time will tell if anyone finds the time to consider real 3D plotting for orix.

@hakonanes
Copy link
Member Author

Here's a figure I've made of the representation of the eleven Laue classes I'd like (based on the visualization by De Graef and McHenry). The figure has the same licensing as orix as of August 30 2023.

laue_groups_symmetry_elements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Relates to the documentation documentation-examples Consider making into a documentation example enhancement New feature or request help-wanted A little help with this would be nice
Projects
None yet
Development

No branches or pull requests

3 participants