From 7efd4ee6274b75661e072091d90d3bb39d85fd72 Mon Sep 17 00:00:00 2001 From: Carter Francis Date: Tue, 6 Feb 2024 21:09:23 -0600 Subject: [PATCH] BugFix: Fix hexagonal issues. --- diffsims/simulations/simulation2d.py | 5 ++++- diffsims/utils/sim_utils.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/diffsims/simulations/simulation2d.py b/diffsims/simulations/simulation2d.py index 726dc1b3..313b912d 100644 --- a/diffsims/simulations/simulation2d.py +++ b/diffsims/simulations/simulation2d.py @@ -507,7 +507,10 @@ def plot( if show_labels: millers = np.round( - np.matmul(coords.hkl, self.get_current_rotation().T) + np.matmul( + np.matmul(coords.data, self.get_current_rotation().T), + coords.phase.structure.lattice.base.T, + ) ).astype(np.int16) # only label the points inside the axes xlim = ax.get_xlim() diff --git a/diffsims/utils/sim_utils.py b/diffsims/utils/sim_utils.py index b6f5c19e..9eabc2a7 100644 --- a/diffsims/utils/sim_utils.py +++ b/diffsims/utils/sim_utils.py @@ -278,7 +278,7 @@ def _get_kinematical_structure_factor( # Express the atom positions in the same reference frame as the # Miller indices - mat = np.linalg.inv(np.dot(structure.lattice.stdbase, structure.lattice.recbase)) + mat = np.linalg.inv(np.dot(structure.lattice.stdbase, structure.lattice.recbase.T)) xyz = np.dot(xyz, mat) # Calculate the complex structure factor