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

gtCalculateDist : removing lattice_system calculation

(implemented in gtSetup directly)

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

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@379 4c865b51-4357-4376-afb4-474e03ccb993
parent c9c552db
No related branches found
No related tags found
No related merge requests found
function [dsp,twotheta,crystal_system,lattice_system] = gtCalculateDist(hkl,cryst,energy) function [dsp,twotheta,crystal_system] = gtCalculateDist(hkl,cryst,energy)
% GTCALCULATEDIST Calculates d-spacing and twice the Bragg angle for a % GTCALCULATEDIST Calculates d-spacing and twice the Bragg angle for a
% given hkl. Also gives crystal and lattice system of the spacegroup. % given hkl. Also gives crystal and lattice system of the spacegroup.
% [dsp,twotheta,crystal_system,lattice_system] = gtCalculateDist(hkl,cryst,energy) % [dsp,twotheta,crystal_system] = gtCalculateDist(hkl,cryst,energy)
% -------------------------------------------------------------- % -----------------------------------------------------------------
% %
% INPUT % INPUT
% hkl - row vector of Miller indices; % hkl - row vector of Miller indices;
...@@ -18,8 +18,6 @@ function [dsp,twotheta,crystal_system,lattice_system] = gtCalculateDist(hkl,crys ...@@ -18,8 +18,6 @@ function [dsp,twotheta,crystal_system,lattice_system] = gtCalculateDist(hkl,crys
% twotheta - twice the Bragg angle of the specified hkl family % twotheta - twice the Bragg angle of the specified hkl family
% crystal_system - crystallographic crystal system of the specified % crystal_system - crystallographic crystal system of the specified
% spacegroup % spacegroup
% lattice_system - crystallographic lattice system of the specified
% spacegroup
% %
% Version 004 14-03-2012 by PReischig % Version 004 14-03-2012 by PReischig
% Addition of lattice system as output; formatting. % Addition of lattice system as output; formatting.
...@@ -37,8 +35,10 @@ function [dsp,twotheta,crystal_system,lattice_system] = gtCalculateDist(hkl,crys ...@@ -37,8 +35,10 @@ function [dsp,twotheta,crystal_system,lattice_system] = gtCalculateDist(hkl,crys
%[use]- gtConvEnergyToWavelength %[use]- gtConvEnergyToWavelength
if ~exist('hkl','var') || isempty(hkl) if ~exist('hkl','var') || isempty(hkl)
hkl = [0 0 0]; hkl = input('Insert the Miller indeces as row vector: ');
disp('Verifying only the crystal and lattice systems.') end
if ~exist('energy','var') || isempty(energy)
energy = input('Insert the beam energy in keV: ');
end end
latticepar = cryst.latticepar; latticepar = cryst.latticepar;
...@@ -70,8 +70,7 @@ end ...@@ -70,8 +70,7 @@ end
% Spacegroups % Spacegroups
if between(spacegroup,1,2) if between(spacegroup,1,2)
crystal = 'triclinic'; crystal = 'triclinic'; % a ~= b ~= c; alpha ~= beta ~= gamma ~= 90
lattice = 'triclinic'; % a ~= b ~= c; alpha ~= beta ~= gamma ~= 90
Y = h^2/a^2*(sind(alpha))^2 + k^2/b^2*(sind(beta))^2 + l^2/c^2*(sind(gamma))^2; Y = h^2/a^2*(sind(alpha))^2 + k^2/b^2*(sind(beta))^2 + l^2/c^2*(sind(gamma))^2;
Z = 2*k*l/b/c*(cosd(beta) *cosd(gamma) - cosd(alpha)) + ... Z = 2*k*l/b/c*(cosd(beta) *cosd(gamma) - cosd(alpha)) + ...
...@@ -83,23 +82,20 @@ if between(spacegroup,1,2) ...@@ -83,23 +82,20 @@ if between(spacegroup,1,2)
end end
if between(spacegroup,3,15) if between(spacegroup,3,15)
crystal = 'monoclinic'; crystal = 'monoclinic'; % a ~= b ~= c; alpha = gamma = 90 ~= beta
lattice = 'monoclinic'; % a ~= b ~= c; alpha = gamma = 90 ~= beta
invdsp2 = h^2/(a*sind(beta))^2 + k^2/b^2 + l^2/(c*sind(beta))^2 - ... invdsp2 = h^2/(a*sind(beta))^2 + k^2/b^2 + l^2/(c*sind(beta))^2 - ...
(2*h*l*cosd(beta)) / (a*c*(sind(beta))^2); (2*h*l*cosd(beta)) / (a*c*(sind(beta))^2);
end end
if between(spacegroup,16,74) if between(spacegroup,16,74)
crystal = 'orthorhombic'; crystal = 'orthorhombic'; % a ~= b ~= c; alpha = beta = gamma = 90
lattice = 'orthorhombic'; % a ~= b ~= c; alpha = beta = gamma = 90
invdsp2 = h^2/a^2 + k^2/b^2 + l^2/c^2; invdsp2 = h^2/a^2 + k^2/b^2 + l^2/c^2;
end end
if between(spacegroup,75,142) if between(spacegroup,75,142)
crystal = 'tetragonal'; crystal = 'tetragonal'; % a = b ~= c; alpha = beta = gamma = 90
lattice = 'tetragonal'; % a = b ~= c; alpha = beta = gamma = 90
invdsp2=(h^2+k^2)/a^2+l^2/c^2; invdsp2=(h^2+k^2)/a^2+l^2/c^2;
end end
...@@ -108,12 +104,12 @@ if between(spacegroup,143,167) ...@@ -108,12 +104,12 @@ if between(spacegroup,143,167)
crystal = 'trigonal'; crystal = 'trigonal';
if ~isempty(strfind(hermann,'P')) % hexagonal lattice if ~isempty(strfind(hermann,'P')) % hexagonal lattice
lattice = 'hexagonal'; % a1 = a2 = a3 ~= c; alpha = beta = 90; gamma = 120 % a1 = a2 = a3 ~= c; alpha = beta = 90; gamma = 120
invdsp2 = 4/(3*a^2) * (h^2 + k^2 + h*k) + l^2/c^2; invdsp2 = 4/(3*a^2) * (h^2 + k^2 + h*k) + l^2/c^2;
elseif ~isempty(strfind(hermann,'R')) % rhombohedral lattice elseif ~isempty(strfind(hermann,'R')) % rhombohedral lattice
lattice = 'rhombohedral'; % a = b = c; alpha = beta = gamma ~= 90 % a = b = c; alpha = beta = gamma ~= 90
Y1 = h^2 + k^2 + h*k; Y1 = h^2 + k^2 + h*k;
Y2 = 2*(h*k + h*l + k*l); Y2 = 2*(h*k + h*l + k*l);
...@@ -126,15 +122,13 @@ if between(spacegroup,143,167) ...@@ -126,15 +122,13 @@ if between(spacegroup,143,167)
end end
if between(spacegroup,168,194) || spacegroup==663 % snow case if between(spacegroup,168,194) || spacegroup==663 % snow case
crystal = 'hexagonal'; crystal = 'hexagonal'; % a1 = a2 = a3 ~= c; alpha = beta = 90; gamma = 120
lattice = 'hexagonal'; % a1 = a2 = a3 ~= c; alpha = beta = 90; gamma = 120
invdsp2 = 4/(3*a^2)*(h^2 + k^2 + h*k) + l^2/c^2; invdsp2 = 4/(3*a^2)*(h^2 + k^2 + h*k) + l^2/c^2;
end end
if between(spacegroup,195,230) if between(spacegroup,195,230)
crystal = 'cubic'; crystal = 'cubic'; % a = b = c; alpha = beta = gamma = 90
lattice = 'cubic'; % a = b = c; alpha = beta = gamma = 90
invdsp2 = (h^2+k^2+l^2)/a^2; invdsp2 = (h^2+k^2+l^2)/a^2;
end end
...@@ -147,7 +141,5 @@ dsp = 1/(invdsp2)^0.5; ...@@ -147,7 +141,5 @@ dsp = 1/(invdsp2)^0.5;
twotheta = 2*asind(lambda/(2*dsp)); twotheta = 2*asind(lambda/(2*dsp));
crystal_system = crystal; crystal_system = crystal;
lattice_system = lattice;
end % end of function end % end of function
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