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

gtHex2Cart : Transforms from direct hexagonal to cartesian coordinates and...

gtHex2Cart : Transforms from direct hexagonal to cartesian coordinates and normalize. Same as the old function gtCrystHKL2Cart

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

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@981 4c865b51-4357-4376-afb4-474e03ccb993
parent 4ef5204a
No related branches found
No related tags found
No related merge requests found
function cartesian = gtHex2Cart(hkil, latticepar) function normalised_hkls = gtHex2Cart(all_hkils, latticepar)
% GTHEX2CART % GTHEX2CART
% cartesian = gtHex2Cart(hkil, latticepar) % normalised_hkls = gtHex2Cart(all_hkils, latticepar)
% ---------------------------------------- % ---------------------------------------------------
% Transforms from direct hexagonal to cartesian coordinates % Transforms from direct hexagonal to cartesian coordinates
% and normalise % and normalise
% %
% Same as the old function gtCrystHKL2Cart % Same as the old function gtCrystHKL2Cart
for i=1:size(hkil,1) % going to cartesian reciprocal space + normalisation of the cartesian
cartesian(i,1) = hkil(i,1) + 0.5 * hkil(i,2); % space
cartesian(i,2) = 3^0.5/2 *hkil(i,2); all_hkls(:, 1) = all_hkils(:, 1) + 0.5 * all_hkils(:, 2);
cartesian(i,3) = hkil(i,4); all_hkls(:, 2) = sqrt(3)/2 * all_hkils(:, 2);
all_hkls(:, 3) = all_hkils(:, 4);
% allow lattice parameters
cartesian(i,1) = cartesian(i,1)*2/(sqrt(3)*latticepar(1));
cartesian(i,2) = cartesian(i,2)*2/(sqrt(3)*latticepar(1));
cartesian(i,3) = cartesian(i,3)/latticepar(3);
end
all_hkls(:, 1) = all_hkls(:, 1)*2/(sqrt(3)*latticepar(1));
all_hkls(:, 2) = all_hkls(:, 2)*2/(sqrt(3)*latticepar(1));
all_hkls(:, 3) = all_hkls(:, 3)/latticepar(3);
% normalise % normalise hkls vector
tmp = sqrt(sum((cartesian.*cartesian),2)); tmp = sqrt(sum((all_hkls.*all_hkls),2));
cartesian = cartesian./(repmat(tmp,1,3)); normalised_hkls = all_hkls./(repmat(tmp,1,3));
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