function Iout=cuFS(hp,k)
%
% MATLAB function from:
% "Elements of Modern X-ray Physics" by Jens Als-Nielsen and Des McMorrow
%
% Calculates: In-plane Bragg peak intensities for O on Cu(110) 
% Inputs: (hp,k), Miller indices of Bragg peak 
% Outputs: Iout, Intensity
% Calls to: ff

%----- Cu real and reciprocal lattice parameters

ac=3.615; ar=2*pi/(2*ac/sqrt(2)); br=2*pi/ac; cr=2*pi/(ac/sqrt(2));

l=0; Q=sqrt(hp^2*ar^2+k^2*br^2+l.^2*cr^2);

%----- Cu form factor

a=[13.338 7.1676 5.6158 1.6735]; b=[3.5828 0.2470 11.3966 64.82]; c=[1.1910];
f_Cu=ff(a,b,c,Q);

%----- Cu Debye-Waller factor for bulk and surface

DW_Cu_B=exp(-0.55*(Q/4/pi).^2);
DW_Cu_S=exp(-1.70*(Q/4/pi).^2);

%----- O form factor

a=[3.0485 2.2868 1.5463 0.8670]; b=[13.2771 5.7011 0.3239 32.9089]; c=[0.2508];
f_O=ff(a,b,c,Q);

delta=0.031/(2*ac/sqrt(2));

F_1=f_Cu.*DW_Cu_S+f_O*exp(i*pi*k);
F_2=(-1)^(hp/2+k+0.5)*2.*f_Cu.*DW_Cu_B*sin(2*pi*hp*delta);
F_S=F_1+F_2;
Iout=1.047539547173480e-002*abs(F_S).^2;