-
Notifications
You must be signed in to change notification settings - Fork 26
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
get_rotation_from_z_to_direction + calculate_ed_data don't work together for monoclinic (and likely most non-orthonormal) unit cells #177
Comments
Just had a look, and I don't think align_vectors solves the problem, since 110 is still not right after, so wouldn't recommend the fix. Will delve into it a bit deeper. edit: I wonder if it might be an issue with how the rotations are applied to the monoclinic cell? |
I've had a deeper look, and actually think the error comes in calculate_ed_data rather than in get_rotation, as the rotated |
Just be careful with the plotting, I would be inclined to use the properties of the simulations (specifically the indexes of the vectors to check) - for example I think the top one from diffsims might be okay?! Will leave it with you for now... |
Thank you for pointing this out @JoonatanL. I haven't touched that part of diffsims, so I cannot say if this is a bug or not. But, we have a new >>> from diffpy.structure import Lattice, Structure
>>> import numpy as np
>>> from orix.crystal_map import Phase
>>> from orix.quaternion import Rotation
>>> from orix.vector import AxAngle, Miller, Vector3d
>>> monoclinic = Phase(
... point_group="2/m",
... structure=Structure(lattice=Lattice(1, 2, 3, 90, 85, 90))
... )
>>> monoclinic
<name: . space group: None. point group: 2/m. proper point group: 112. color: tab:blue>
>>> uvw = Miller(uvw=(0, 1, 0), phase=monoclinic)
>>> uvw
Miller (1,), point group 2/m, uvw
[[0. 1. 0.]]
>>> uvw.data # Vector with respect to cartesian coordinate system stored and used internally
array([[0., 2., 0.]])
>>> vz = Vector3d.zvector()
>>> axis = vz.cross(uvw).data
>>> angle = vz.angle_with(uvw).data
>>> r_axangle = Rotation.from_neo_euler(AxAngle.from_axes_angles(axis, angle))
>>> r_axangle
Rotation (1,)
[[ 0.7071 -0.7071 0. 0. ]]
>>> np.degrees(r_axangle.to_euler())
array([[-0., 90., 0.]]) Note that using |
@JoonatanL, what are your lattice parameters? |
|
Hm, OK, I can't seem to get the correct answer with the above approach either... |
I think I may have figured it out. Might be why this has never shown up before, since I'm guessing it's basically -a pointing in the a direction and -b pointing in b. That would only cause problems in non-orthonormal systems. Will still double check. |
OK, so there might be a misalignment of crystal axes between |
Yeah I imagine so, I'm not sure which one should be changed though, since I imagine this might not be the only function it comes up in. Any thoughts? |
Is the issue here perhaps related to pyxem/orix#236? The issue there was not getting the expected symmetrically equivalent Miller indices from (311), which was "solved" by switching the b and c axes when setting the lattice parameters. |
Both, been thinking about sweeping this up for the next release. It looks like it's two things:
Also, could you both check that what I've said makes sense? Ta. |
Rewriting using orix sounds very good, don't have any other comments besides that. |
I don't know the chosen convention in CrystalMaker for aligning the crystal's lattice vectors (a, b, c) with the cartesian reference frame (e1, e2, e3), but diffsims uses See orix' documentation for the definition chosen in orix, which uses |
I'm working on a monoclinic cocrystal. Running get_rotation_from_z_to_direction in zap_map_generators does not return the correct structure when u (in [uvw]) is nonzero. For example, for 100:
when plotted with calculate_ed_data as follows:
gives:
whereas
from CrystalMaker is correct. This is not present for rotations where u=0, such as 010:
in diffsims versus:
in CrystalMaker.
I wrote my own check for the Euler angles using scipy.Rotation.align_vectors, which gives a different orientation that seems equivalent but is not for the plots on calculate_ed_data.
For 100:
diffsims: 90, 99.526, -90 versus mine (which gives the correct diffraction): 90, 99.526,90.
For 010:
diffsims: 180, 90, -180 versus mine 0, 90, 0. (results are identical as we are rotating perpendicular to the monoclinic axis).
Working on this as I discover more of the problem.
The text was updated successfully, but these errors were encountered: