function theta = gtCrystTheta(dsp,energy)
% GTCRYSTTHETA  Calculates theta angle given a list of d-spacing
%     theta = gtCrystTheta(dsp,energy)
%     --------------------------------
%    
%     INPUT:
%       dsp    = d-spacing (Angstron)
%       energy = beam energy in keV 
% 
%     OUTPUT:
%       theta = the Bragg angle of the specified hkl family by given the
%               d-spacing list
%
%
%     Version 001 10-07-2013 by LNervo


if ~exist('energy','var') || isempty(energy)
    load parameters
    energy = parameters.acq.energy;
end

lambda = gtConvEnergyToWavelength(energy);

% theta from the Bragg's law
theta = asind(lambda./(2*dsp));

end % end of function
