pyxem / orix

Analysing crystal orientations and symmetry in Python
https://orix.readthedocs.io
GNU General Public License v3.0
83 stars 50 forks source link

Symmetry distinct rotations giving identical (diffsims) patterns. #19

Closed pc494 closed 5 years ago

pc494 commented 5 years ago

Quote from #17:

The Euler angles (10,10,0) and (-80,10,0) have a non-zero distance. I would expect them to have zero distance but their distance is the same as for (0,0,0) and (10,10,0). I am not sure if this is correct, as at least the diffraction patterns, as simulated in DiffractionLibraryGenerator.get_diffraction_library() are equal for the two for an FCC structure.

End quote

Reproduction of the first result is again possible with:

from orix.quaternion.symmetry import O
from orix.quaternion.orientation import Misorientation, Orientation
ori = Orientation.from_euler([np.radians(np.asarray([10,10,0]))]).set_symmetry(O)
ori2 = Orientation.from_euler(np.radians(np.asarray([-80,10,0]))).set_symmetry(O)
misori_base = Misorientation(~ori * ori2)
misori = misori_base.set_symmetry(O, O)
np.rad2deg(misori_base.angle.data)
EirikOpheim commented 5 years ago

For the code to run, the necessary imports are:

from orix.quaternion.symmetry import O
from orix.quaternion.orientation import Misorientation, Orientation
import numpy as np

UPD (now included, although as per most of StackOverflow, np is implied)

pc494 commented 5 years ago

Note that using the "RAM wrecking" solution from the notebook we arrive at a sensible endpoint.

>>> mismisori_equiv = O.outer(~misori).outer(O).outer(O).outer(misori).outer(O)
>>> distance = mismisori_equiv.angle.data.min(axis=(0, 2, 3, 5))
>>> distance
array([[0.]])

Will continue to think/work on this.

EirikOpheim commented 5 years ago

Ok, I thought the RAM wrecking was the first step of identifying grains. I will try to find a way to use one of the solutions. Even the slower one seems to be killing my RAM at the moment, but maybe I can free up some RAM and try again.

EirikOpheim commented 5 years ago

It is working for me now, thanks a lot!

pc494 commented 5 years ago

The Euler angles (10,10,0) and (-80,10,0) have a non-zero distance. I would expect them to have zero distance

a) Euler angles (in rzxz) (10,10,0) & (-80,10,0) should have a non-zero distance. For an Orientation one side of the symmetry relation is a C1 (no symmetry) - the lab frame. In the lab frame, I can tell the difference between a rotation about the axis 10 degrees from x and the one 80 degrees (other way) from x.

but their distance is the same as for (0,0,0) and (10,10,0).

True (according to the code in the snippet, with appropriate extension), but I'm not sure if that's surprising. Also as the solution above hints at:

misori_base = Misorientation(~ori * ori2) #not true, needs sym elements either side
misori = misori_base.set_symmetry(O, O) #only makes sure we are in the FZ
np.rad2deg(misori_base.angle.data)

isn't valid.

I am not sure if this is correct, as at least the diffraction patterns, as simulated in DiffractionLibraryGenerator.get_diffraction_library() are equal for the two for an FCC structure.

This is probably a bug with diffsims, as these patterns should look different. Diffsims may well be using static axes somewhere it shouldn't, could be related to https://github.com/pyxem/diffsims/issues/28

I am going to close this, as most of the things raised here are well suited to discussion in #20