function fofQ=ff(a,b,c,Q)
%
% MATLAB function from:
% "Elements of Modern X-ray Physics" by Jens Als-Nielsen and Des McMorrow
%
% Calculates: X-ray form factor as a function of Q 
% Inputs: (a,b,c), coeffics. from ITC, Q
% Outputs: fofQ, form factor
% Note: Q is given by 4*pi*sin(theta)/lambda.

%----- Convert Q to be compatible with the definition
%      in the International Tables of Crystallography

Q=Q/(4*pi);
fofQ=a(1)*exp(-b(1)*Q.^2)+...
     a(2)*exp(-b(2)*Q.^2)+a(3)*exp(-b(3)*Q.^2)+a(4)*exp(-b(4)*Q.^2)+c;