Skip to content
Snippets Groups Projects
Commit 252591b1 authored by Laura Nervo's avatar Laura Nervo
Browse files

gtCrystSignedHKLs : given input 'symm' if needed; sorted hkls according to h > k > l


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent dbd35b3f
No related branches found
No related tags found
No related merge requests found
function [allshkls, allhklinds, mult] = gtCrystSignedHKLs(hkl,spacegroup)
function [allshkls, allhklinds, mult] = gtCrystSignedHKLs(hkl, symm)
% GTCRYSTSIGNEDHKLS Gives a complete list of signed hkl planes, by
% applying symmetry operators of the specified spacegroup to the input
% list of plane families.
......@@ -6,20 +6,21 @@ function [allshkls, allhklinds, mult] = gtCrystSignedHKLs(hkl,spacegroup)
% 'lattice_system' and 'crystal_system' instead of spacegroups should
% be considered.
%
% [allshkls, allhklinds, mult] = gtCrystSignedHKLs(hkl,spacegroup)
% ----------------------------------------------------------------
% [allshkls, allhklinds, mult] = gtCrystSignedHKLs(hkl,symm)
% ----------------------------------------------------------
%
% INPUT:
% hkl = plane families (one in a row)
% nx3,class double for cubic lattices
% nx4,class double for hexagonal lattices
% spacegroup = space group
% hkl = <double> plane families (one in a column)
% (3,n) for cubic lattices
% (4,n) for hexagonal lattices
% symm = <struct> structure containing .g3/.g with symmetry
% operators
%
% OUTPUT:
% allshkls = complete list of signed hkl planes
% (including Friedel pairs)
% allhklinds = indices in allshkls according to input hkl
% mult = multiplicity of hkl families
% allshkls = complete list of signed hkl planes
% (including Friedel pairs)
% allhklinds = indices in allshkls according to input hkl
% mult = <int8> multiplicity of hkl families (1,k)
%
% Version 002 10-07-2013 by LNervo
% Added check of class for hkl list
......@@ -28,15 +29,26 @@ function [allshkls, allhklinds, mult] = gtCrystSignedHKLs(hkl,spacegroup)
if ~isa(hkl,'double')
hkl = double(hkl);
end
% reflections in rows
hkl = hkl';
if ~exist('symm','var') || isempty(symm)
load parameters
spacegroup = parameters.cryst.spacegroup;
[~,crystal_system,~] = gtReadSpaceGroup(spacegroup);
% Get symmetry operators
symm = gtCrystGetSymmetryOperators(crystal_system, spacegroup);
end
% Get symmetry operators
symm = gtCrystGetSymmetryOperators([], spacegroup);
if size(hkl,2) == 4
symm = {symm.g};
elseif size(hkl,2) == 3
symm = {symm.g3};
end
ncols = size(hkl,2);
allshkls = [];
allhklinds = [];
......@@ -51,8 +63,11 @@ for ii = 1:size(hkl,1)
shkls(2*jj,:) = -shkls(2*jj-1,:); % Friedel pair of previous one
end
% Remove duplicates and add to the complete list
% Remove duplicates and add to the complete list
newshkls = unique(shkls, 'rows');
% sort according to h > k > l
newshkls = sortrows(newshkls, [-1 -2 -ncols]);
allshkls = [allshkls; newshkls];
mult(ii,1) = size(newshkls,1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment