From b9764929ad35facec0dc5cc6b3157244fc10dc3f Mon Sep 17 00:00:00 2001 From: Laura Nervo <laura.nervo@esrf.fr> Date: Thu, 1 Aug 2013 18:09:30 +0200 Subject: [PATCH] gtCrystFindFamilies : given a list of signed hkls, finds the family for each reflection, with thetatype, dspacing and multiplicity. It uses the symmetry operators. Signed-off-by: Laura Nervo <laura.nervo@esrf.fr> --- zUtil_Cryst/gtCrystFindFamilies.m | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 zUtil_Cryst/gtCrystFindFamilies.m diff --git a/zUtil_Cryst/gtCrystFindFamilies.m b/zUtil_Cryst/gtCrystFindFamilies.m new file mode 100644 index 00000000..b815cb3e --- /dev/null +++ b/zUtil_Cryst/gtCrystFindFamilies.m @@ -0,0 +1,71 @@ +function list = gtCrystFindFamilies(hklsp, cryst) +% GTCRYSTFINDFAMILIES +% list = gtCrystFindFamilies(hklsp, cryst) +% ---------------------------------------- +% From the hkl list, finds the unique families by calculating the d-spacing +% and then sorting in descending order +% +% INPUT: +% hklsp = <double> hk(i)l of reflections (n,3) or (n,4) +% Bmat = <double> B matrix (3,3) +% +% OUTPUT: +% list = <struct> information about d-spacing, theta +% .hkl +% .hklsp +% .thetatype +% .thetatypesp +% .dspacing +% .dspacingsp +% .mult +% .indfam +% .table +% .tablesp + +% each row one reflection +if size(hklsp,2) > size(hklsp,1) + hklsp = hklsp'; +end + +% use symmetry operators +Bmat = gtCrystHKL2CartesianMatrix(cryst.latticepar); + +symm = gtCrystGetSymmetryOperators(cryst.crystal_system, cryst.spacegroup); +[allshkls, allhklinds, mult] = gtCrystSignedHKLs(hklsp', symm); + +[hklind,ind,~] = unique(allhklinds,'stable'); +hkl = allshkls(ind,:); + +% calculate d-spacing +dspacingsp = gtCrystDSpacing(allshkls', Bmat)'; + +[dspacingfam, indfam, thetatypesp] = unique(dspacingsp, 'stable'); + +tablesp = [allshkls allhklinds dspacingsp thetatypesp]; +table = [hklsp hklind ind mult hkl]; + +thetatype = thetatypesp(ind); +dspacing = dspacingsp(ind); + + +list.hkl = hkl'; +list.hklsp = hklsp'; +list.thetatype = thetatype'; +list.dspacing = dspacing'; +list.mult = mult'; +list.allshkls = allshkls'; +list.allhklinds = allhklinds'; +list.allthetatype = thetatypesp'; +list.alldspacing = dspacingsp'; + + +for ii=1:length(list.thetatype) + if size(hkl,2)==3 + fprintf( '%3d %3d %3d %5d %5d\n',list.hkl(:,ii),list.thetatype(ii),list.mult(ii) ); + elseif size(hkl,2)==4 + fprintf( '%3d %3d %3d %3d %5d %5d\n',list.hkl(:,ii),list.thetatype(ii),list.mult(ii) ); + end +end + + +end -- GitLab