Skip to content
Snippets Groups Projects
gtCrystDSpacing.m 989 B
Newer Older
function dsp = gtCrystDSpacing(hkl, Bmat)
Laura Nervo's avatar
Laura Nervo committed
%     dsp = gtCrystDSpacing(hkl, Bmat)
%     --------------------------------
%     Calculates d-spacing for given hkl-s and lattice parameters.
Laura Nervo's avatar
Laura Nervo committed
%     INPUT:
%       hkl  = <double>     set of Miller indices (3,n) or (4,n)
%       Bmat = <double>     'B matrix' - (hkl) to Cartesian matrix (3,3)
Laura Nervo's avatar
Laura Nervo committed
%     OUTPUT:
%       dsp  = <single>     row vector of d-spacings (1,n)
Laura Nervo's avatar
Laura Nervo committed
% Lattice vectors in real space, in a Cartesian basis
% If hexagonal material, transform the four indices into three
% Reciprocal lattice point in the Cartesian basis (a vector normal to hkl plane)
Yoann Guilhem's avatar
Yoann Guilhem committed
% TODO: work around the single problem
%dsp = single(dsp);

% % To be checked against:
% % Lattice base vectors in rows:
% av = [a1; a2; a3]
% % Reciprocal space vectors in coloumns:
% bv = inv(av)
% ghkl = bv*hkl
% dsp = 1/norm(ghkl)