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

Conversion from Miller to Miller-Bravais indexes : using lower case options:...

Conversion from Miller to Miller-Bravais indexes : using lower case options: 'plane','pl','p' for planes; 'direction','dir','d' for directions.

Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent 6dddf7a1
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ function hkl = gtCrystFourIndexes2Miller(hkil, miller_type)
%
% hkl = gtCrystFourIndexes2Miller(hkil, miller_type)
% --------------------------------------------------
% From 4-index notation to 3-index notation (only hexagonal unit cell)
% INPUT:
% hkil = <double> plane normal Miller-Bravais indexes (Nx4)
% miller_type = <string> 'plane' / 'direction'
......@@ -18,13 +19,13 @@ function hkl = gtCrystFourIndexes2Miller(hkil, miller_type)
hkl = zeros(size(hkil,1), 3);
switch miller_type
case 'direction'
switch lower(miller_type)
case {'direction','dir','d'}
hkl(:,1) = hkil(:,1) - hkil(:,3);
hkl(:,2) = hkil(:,2) - hkil(:,3);
hkl(:,3) = hkil(:,4);
case 'plane'
case {'plane','pl','p'}
hkl(:,1) = hkil(:,1);
hkl(:,2) = hkil(:,2);
hkl(:,3) = hkil(:,4);
......
......@@ -4,6 +4,7 @@ function [hkil, hkil_int] = gtCrystMiller2FourIndexes(hkl, miller_type)
%
% [hkil, hkil_int] = gtCrystMiller2FourIndexes(hkl, miller_type)
% --------------------------------------------------------------
% From 3-index notation to 4-index notation (only hexagonal unit cell)
% INPUT:
% hkl = <double> plane normal Miller indexes (Nx3)
% miller_type = <string> 'plane' / 'direction'
......@@ -21,14 +22,14 @@ function [hkil, hkil_int] = gtCrystMiller2FourIndexes(hkl, miller_type)
hkil = zeros(size(hkl,1), 4);
switch miller_type
case 'direction'
switch lower(miller_type)
case {'direction','dir','d'}
hkil(:,1) = 2*hkl(:,1) - hkl(:,2);
hkil(:,2) = 2*hkl(:,2) - hkl(:,1);
hkil(:,3) = - (hkl(:,1) + hkl(:,2));
hkil(:,4) = 3*hkl(:,3);
case 'plane'
case {'plane','pl','p'}
hkil(:,1) = hkl(:,1);
hkil(:,2) = hkl(:,2);
hkil(:,3) = - (hkl(:,1) + hkl(:,2));
......@@ -40,7 +41,7 @@ if nargout > 1
tmp = hkil(ii,:);
tmp((tmp > 10^-9 & tmp <= 0.1) | tmp == 0)=[];
minimum(ii) = max(min(abs(tmp)), 0);
hkil_int(ii,:) = hkil(ii,:) ./minimum(ii);
hkil_int(ii,:) = hkil(ii,:) ./ minimum(ii);
hkil_int(ii,:) = fix(hkil_int(ii,:));
end
end
......
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