From 54470a849b8d0d47084b5393c93b0576bb377564 Mon Sep 17 00:00:00 2001
From: Laura Nervo <laura.nervo@esrf.fr>
Date: Wed, 18 Sep 2013 11:52:42 +0200
Subject: [PATCH] gtGetReflections : restored previously deleted function (June
 2013) still used in the code

Signed-off-by: Laura Nervo <laura.nervo@esrf.fr>
---
 4_grains/gtGetReflections.m | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 4_grains/gtGetReflections.m

diff --git a/4_grains/gtGetReflections.m b/4_grains/gtGetReflections.m
new file mode 100644
index 00000000..5171c16e
--- /dev/null
+++ b/4_grains/gtGetReflections.m
@@ -0,0 +1,39 @@
+function hkl_reflections = gtGetReflections(hkl, spacegroup)
+% GTGETREFLECTIONS  Return matrix(n x 3) of all symmetry related reflections
+%                   from input hkl or hkil
+%
+%     hkl_reflections = gtGetReflections(hkl, spacegroup)
+%     ---------------------------------------------------------
+%
+%     INPUT:
+%       hkl        = <double> hkl or hkil vector, depending on crystal system
+%       spacegroup = <int>    Crystal spacegroup
+%
+%     OUTPUT:
+%       hkl_reflections = <double> hkl or hkil reflections, depending on 
+%                                  crystal system
+%     from input hkil [h k i l], return matrix(n x 4) of all symmetry related
+%     reflections.
+%     
+%     Note:
+%       Now, uses gtCrystGetSymmetryOperators.
+%       Before, was using gtGetHexagonalSymOp_sab / GetCubicSymOp modified
+%       from Risoe group
+
+% Get symmetry operators
+symm = gtCrystGetSymmetryOperators([], spacegroup);
+if size(hkl,2) == 4
+    symm = {symm.g};
+elseif size(hkl,2) == 3
+    symm = {symm.g3};
+end
+
+% Apply to input reflection
+for ii=1:length(symm)
+    hkl_reflections(ii,:) = hkl*symm{ii};
+end
+
+% Remove duplicates
+hkl_reflections = unique(hkl_reflections, 'rows');
+
+end % end of function
-- 
GitLab