Skip to content
Snippets Groups Projects
Commit 7c3150a6 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

Twin variants and forward simulation code : not ready but running..... not finished!!!


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@965 4c865b51-4357-4376-afb4-474e03ccb993
parent e8c86a8d
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ crossa2a3 = [a2(2)*a3(3)-a2(3)*a3(2); a2(3)*a3(1)-a2(1)*a3(3); a2(1)*a3(2)-a2(2)
avol = a1*crossa2a3;
% for output
Amat=[a1 a2 a3];
Amat=[a1' a2' a3'];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Reciprocal lattice vectors in the Cartesian basis
......@@ -66,4 +66,4 @@ b3 = [a1(2)*a2(3)-a1(3)*a2(2); a1(3)*a2(1)-a1(1)*a2(3); a1(1)*a2(2)-a1(2)*a2(1)]
Bmat = [b1 b2 b3];
end % of function
\ No newline at end of file
end % of function
function grain = gtCalculateTwinVariants(grain, parameters, variant, varargin)
% GTCALCULATETWINVARIANTS Calulate diffraction vectors and detector intersection points
function grain = gtTwinCalculateVariants(grain, parameters, varargin)
% GTTWINCALCULATEVARIANTS Calulate diffraction vectors and detector intersection points
%
% grain = gtCalculateTwinVariants(grain, parameters, variant, varargin)
% grain = gtTwinCalculateVariants(grain, parameters, varargin)
% ---------------------------------------------------------------------
% Input and output arguments description, variable type (in <>) and default value (in {}) are written below.
%
......@@ -25,37 +25,36 @@ function grain = gtCalculateTwinVariants(grain, parameters, variant, varargin)
% OUTPUT:
% grain = grain of interest (<struct>)
% added fields:
% - twins.allblobs{variant}
% - g_twins(variant).allblobs
if ~exist('parameters','var') || isempty(parameters)
parameters = load('parameters.mat');
parameters = parameters.parameters;
end
if ~exist('variant','var') || isempty(variant)
variant = 1;
end
%% set default values for optional arguments
app.color = 0;
app.showfigure = 0;
app.axis = 0;
app.color = false;
app.showfigure = false;
app.axis = false;
app.Markersize = 15;
app.Grayscale = [-300 500];
app.overlay = zeros(parameters.acq.ydet, parameters.acq.xdet);
app.usestrain = 0;
app.usestrain = false;
app = parse_pv_pairs(app,varargin);
% If strain data is not available, disable strain
if ~isfield(grain,'strain') || ~isfield(grain.strain,'strainT') || ...
isnan(grain.strain.strainT(1,1))
app.usestrain = 0;
if ( ~isfield(grain,'strain') || ...
~isfield(grain.strain,'strainT') || ...
isnan(grain.strain.strainT(1,1)) )
app.usestrain = false;
else
app.usestrain = true;
end
% Rodrigues vector (grain orientation)
% Rvec = grain.R_vector;
%disp(['grain.center: ' num2str(grain.center)]);
......@@ -101,22 +100,23 @@ for ii = 1:size(hklsp,2)
pl_cry(ii, :) = gtCrystHKL2Cartesian(hklsp(:, ii), Bmat)';
end
for kkk = 1 : length(grain.g_twins)
% Coordinate transformation matrix from CRYSTAL to SAMPLE
% cry2sam = Rod2g(Rvec);
% Rodrigues vector (grain orientation)
if ~isfield(grain.g_twins(kkk),'R_vector')
Rvec = gtMathsRotMat2Rod(grain.g_twins(kkk).g);
grain.g_twins(kkk).R_vector = Rvec;
end
% [g, g_twins] = gtTwinOrientations(Rvec)
cry2sam = grain.g_twins(variant).g;
cry2sam = grain.g_twins(kkk).g;
% pl_sam = [];
% % Plane normals in SAMPLE coordinates
% for jj =1 : size(cry2sam,2)
pl_sam = (cry2sam*pl_cry')';
pl_sam = (cry2sam*pl_cry')';
% pl_sam = [pl_sam; pl_sam_tmp];
% end
%% Initialse output variables
%% Initialyze output variables
allblobs.pl = [];
allblobs.pllab = [];
allblobs.hkl = [];
......@@ -385,8 +385,10 @@ if app.showfigure
end % showfigure
grain.twins.allblobs{variant} = allblobs;
grain.g_twins(kkk).allblobs = allblobs;
end
end % end of function
This diff is collapsed.
......@@ -70,6 +70,7 @@ elseif spacegroup==194 % hexagonal case
cry2twin = gtMathsRotationTensor(twin_angle, rotcomp);
g_twins(ii).g = cry2sam*cry2twin;
g_twins(ii).R_vector = gtMathsRotMat2Rod( g_twins(ii).g );
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