Skip to content
Snippets Groups Projects
Commit c9642142 authored by Yoann Guilhem's avatar Yoann Guilhem Committed by Nicola Vigano
Browse files

Cleaning: switch to a single function for hkl/hkil reflections -> gtGetReflections

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@901 4c865b51-4357-4376-afb4-474e03ccb993
parent 7757f3d1
No related branches found
No related tags found
No related merge requests found
function hkl_reflections = gtGetReflections(hkl)
% from input hkl [h k l], return matrix(n x 3) of all symmetry related
% reflections. Uses Riso script GetCubicSymOp
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
% Why only cubic crystals?
symm = gtCrystGetSymmetryOperators('cubic');
symm = gtCrystGetSymmetryOperators([], spacegroup);
%apply to input reflection
for i=1:length(symm)
hkl_reflections(i,:) = hkl*symm(i).g;
% Apply to input reflection
if size(hkl,2) == 4
for ii=1:length(symm)
hkl_reflections(ii,:) = hkl*symm(ii).g;
end
elseif size(hkl,2) == 3
for ii=1:length(symm)
hkl_reflections(ii,:) = hkl*symm(ii).g3;
end
end
% Remove duplicates
hkl_reflections = unique(hkl_reflections, 'rows');
% %remove duplicates
hkl_reflections=unique(hkl_reflections, 'rows');
end
end % end of function
function hkil_reflections = gtGetReflections_sab(hkil, spacegroup)
% hkil_reflections = gtGetReflections_sab(hkil, spacegroup)
% ---------------------------------------------------------
% from input hkil [h k i l], return matrix(n x 4) of all symmetry related
% reflections.
% BEFORE: Was using gtGetHexagonalSymOp_sab modified from Risoe group
% NOW : Now uses gtCrystGetSymmetryOperators
% Get symmetry operators
symm = gtCrystGetSymmetryOperators([], spacegroup);
% Apply to input reflection
if size(hkil,2) == 4
for ii=1:length(symm)
hkil_reflections(ii,:) = hkil*symm(ii).g;
end
elseif size(hkil,2) == 3
for ii=1:length(symm)
hkil_reflections(ii,:) = hkil*symm(ii).g3;
end
end
hkil_reflections = unique(hkil_reflections, 'rows');
end % end of function
......@@ -41,7 +41,7 @@ switch spacegroup
%gtnewGetReflections returns matrix of all reflections related by symmetry
%to hkl, using Riso GetCubicSymOp.m
hkl_reflections = gtGetReflections(hkl(j,:));
hkl_reflections = gtGetReflections(hkl(j,:), spacegroup);
if size(hkl_reflections,1)~=1%skip if hkl = [0 0 0]
for i=1:size(hkl_reflections,1) % loop of hkl reflections
h = hkl_reflections(i,:);
......@@ -131,7 +131,7 @@ switch spacegroup
%gtnewGetReflections returns matrix of all reflections related by symmetry
%to hkl, using Riso GetCubicSymOp.m
hkil_reflections_hex = gtGetReflections_sab(hkl(j,:), spacegroup);
hkil_reflections_hex = gtGetReflections(hkl(j,:), spacegroup);
if size(hkil_reflections_hex,1)~=1%skip if hkl = [0 0 0]
for i=1:size(hkil_reflections_hex,1) % loop of hkil reflections
......
......@@ -63,7 +63,7 @@ switch spacegroup
%gtnewGetReflections returns matrix of all reflections related by symmetry
%to hkl, using Riso GetCubicSymOp.m
hkl_reflections = gtGetReflections(hkl(j,:));
hkl_reflections = gtGetReflections(hkl(j,:), spacegroup);
if size(hkl_reflections,1)~=1%skip if hkl = [0 0 0]
for i=1:size(hkl_reflections,1) % loop of hkl reflections
h = hkl_reflections(i,:);
......@@ -168,7 +168,7 @@ switch spacegroup
%gtnewGetReflections returns matrix of all reflections related by symmetry
%to hkl, using Riso GetCubicSymOp.m
hkil_reflections_hex = gtGetReflections_sab(hkl(j,:), spacegroup);
hkil_reflections_hex = gtGetReflections(hkl(j,:), spacegroup);
hkil_reflections_hex=[hkil_reflections_hex; -hkil_reflections_hex];
if size(hkil_reflections_hex,1)~=1%skip if hkl = [0 0 0]
......
......@@ -35,7 +35,7 @@ load(fullfile('4_grains',sprintf('phase_%02d',phaseid),'r_vectors.mat'));
all_hkils=[];
hkil = reflection;
for i = 1:size(hkil,1)
all_hkils = [all_hkils ; gtGetReflections_sab(hkil(i,:), parameters.cryst(phaseid).spacegroup)];
all_hkils = [all_hkils ; gtGetReflections(hkil(i,:), parameters.cryst(phaseid).spacegroup)];
end
% normalise hkls vector
% going to cartesian reciprocal space + normalisation of the cartesian
......
......@@ -35,7 +35,7 @@ load(fullfile('4_grains',sprintf('phase_%02d',phaseid),'r_vectors.mat'));
all_hkils=[];
hkil = reflection;
for i = 1:size(hkil,1)
all_hkils = [all_hkils ; gtGetReflections_sab(hkil(i,:), parameters.cryst(phaseid).spacegroup)];
all_hkils = [all_hkils ; gtGetReflections(hkil(i,:), parameters.cryst(phaseid).spacegroup)];
end
% normalise hkls vector
% going to cartesian reciprocal space + normalisation of the cartesian
......
......@@ -238,7 +238,7 @@ if app.plot_figure
% permute
uvw_poles_hex2=[];
for i = 1:size(uvw_poles_hex,1)
uvw_poles_hex2 = [uvw_poles_hex2 ; gtGetReflections_sab(uvw_poles_hex(i,:), spacegroup)];
uvw_poles_hex2 = [uvw_poles_hex2 ; gtGetReflections(uvw_poles_hex(i,:), spacegroup)];
end
uvw_poles_hex=uvw_poles_hex2;
......
......@@ -25,16 +25,20 @@ end
cry2sam = Rod2g(Rvec);
g_twin = [];
% Just look for sigma 3 case (cubic)
%twin_angle=60
%twin_axis=[1 1 1]
% Just the tensile twin case (hexagonal)
%twin_angle=85
%twin_axis=[1 1 -2 0]
% Normalize twin_axis
twin_axis = twin_axis/norm(twin_axis);
% Symmetry equivilents
twin_axis = gtGetReflections(twin_axis, spacegroup);
if spacegroup==225 % fcc case
% just look for sigma 3 case
%twin_angle=60
%twin_axis=[1 1 1]
% symmetry equivilents
twin_axis=twin_axis/norm(twin_axis);
twin_axis=gtGetReflections(twin_axis);
% in crystal system, parent to twin transformation
for ii=1:size(twin_axis, 1)
......@@ -52,15 +56,6 @@ if spacegroup==225 % fcc case
elseif spacegroup==194 % hexagonal case
% just the tensile twin case
%twin_angle=85
%twin_axis=[1 1 -2 0]
% normalize
twin_axis=twin_axis/norm(twin_axis);
% symmetry equivilents symm = gtCrystGetSymmetryOperators([], spacegroup); hkil_reflections(i,:) = hkil*symm(i).g;
twin_axis = gtGetReflections_sab(twin_axis, spacegroup);
% convert from hex to cart - A matrix for a UVW DIRECTION (A matrix for a
% UVW direction)
......
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