Newer
Older
Laura Nervo
committed
function list = gtCrystFindFamilies(hklsp, cryst)
% GTCRYSTFINDFAMILIES
% list = gtCrystFindFamilies(hklsp, cryst)
% ----------------------------------------
Laura Nervo
committed
% From the hklsp list, finds the unique families by calculating the d-spacing
Laura Nervo
committed
% and then sorting in descending order
%
% INPUT:
% hklsp = <double> hk(i)l of reflections (n,3) or (n,4)
Laura Nervo
committed
% cryst = <struct> parameters.cryst
Laura Nervo
committed
%
% OUTPUT:
% list = <struct> information about d-spacing, theta
% .hkl
% .hklsp
% .thetatypesp
% .dspacingsp
% .mult
Laura Nervo
committed
% .allshkls
% .allhklinds
% .allthetatype
% .alldspacing
% .ind
% .hklind
% .dspacingfam
% .hklfam
Laura Nervo
committed
% each row one reflection
Laura Nervo
committed
if ~isrow(hklsp)
Laura Nervo
committed
hklsp = hklsp';
end
% use symmetry operators
Bmat = gtCrystHKL2CartesianMatrix(cryst.latticepar);
symm = gtCrystGetSymmetryOperators(cryst.crystal_system, cryst.spacegroup);
Laura Nervo
committed
[allshkls, allhklinds, mult] = gtCrystSignedHKLs(hklsp', symm); % column reflections
Laura Nervo
committed
[hklind,ind,~] = unique(allhklinds,'stable');
hkl = allshkls(ind,:);
% calculate d-spacing
Laura Nervo
committed
alldspacing = gtCrystDSpacing(allshkls', Bmat)';
alldspacing = single(alldspacing); % needed to do unique
Laura Nervo
committed
Laura Nervo
committed
[dspacingfam, ~, allthetatype] = unique(alldspacing, 'stable');
Laura Nervo
committed
Laura Nervo
committed
list.hkl = double(hkl');
list.hklsp = double(hklsp');
list.thetatypesp = allthetatype(ind)';
list.dspacingsp = double(alldspacing(ind)');
Laura Nervo
committed
list.mult = mult';
list.allshkls = allshkls';
list.allhklinds = allhklinds';
Laura Nervo
committed
list.allthetatype = allthetatype';
list.alldspacing = alldspacing';
list.ind = ind';
list.hklind = hklind';
list.dspacingfam = double(dspacingfam');
list.hklfam = unique(hkl, 'rows', 'stable')';
Laura Nervo
committed
end % end of function