Skip to content

Miller dunder methods silently discards the phase #501

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

Open
hakonanes opened this issue May 8, 2024 · 1 comment
Open

Miller dunder methods silently discards the phase #501

hakonanes opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@hakonanes
Copy link
Member

As reported by @viljarjf in pyxem/diffsims#211, negating a Miller instance silently discards the phase. His example here shows the problem:

from orix.vector import Miller
from orix.crystal_map import Phase

p = Phase(point_group="m-3m")
v = Miller([1, 0, 0], phase=p)

print(v)
print(-v)

>>> Miller (1,), point group m-3m, xyz
[[1 0 0]]
>>> Miller (1,), point group None, xyz
[[-1  0  0]]
@argerlt
Copy link
Collaborator

argerlt commented May 19, 2025

I was going to try addressing this, but to add to the topic,

from orix.vector import Miller, Vector3d
from orix.crystal_map import Phase

p = Phase(point_group="m-3m")
m = Miller([1, 0, 0], phase=p)
v = Vector3d([1,2,3])

print(m)
>>> Miller (1,), point group m-3m, xyz
>>> [[1 0 0]]

print(v)
>>> Vector3d (1,)
>>> [[1 2 3]]

x = v+m
y = m+v

print(x)
>>> Vector3d (1,)
>>> [[2 2 3]]

print(y)
>>> Miller (1,), point group None, xyz
>>> [[2 2 3]]

What's the proper procedure here? I don't think you should be able to combine reciprocal and direct vectors without at least a warning, maybe not at all, but perhaps there is a valid edge case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants