There are lots of ways of doing this.
One excellent approach (sometimes with fewer parameters than a spherical harmonic function) is to use the Stephens approach (P.W. Stephens, J. Appl. Cryst. (1999) 32, 281-9) as coded in gsas. Peter, Robert Dinnebier and Andreas Leineweber have worked out the macros for this. eta term allows mixture of Gauss/Lorentz broadening:
prm s400 11769.84126` prm s004 153.55044` prm s220 28029.32854` prm s202 -1067.03124` ........ prm eta 0.52180` min 0 max 1 Stephens_tetragonal(s400, s004, s220, s202, eta)
The macros you'll need are below. You need to define the correct parameters to refine for each macro. Somebody could automate this if they have time!
macro Stephens_tetragonal(s400, s004, s220, s202, eta) { prm mhkl = Abs(S400 (H^4+ K^4)+ S004 L^4+ S220 H^2 K^2 + S202 (H^2 L^2 + K^2 L^2) ); prm pp = D_spacing^2 * Sqrt(Max(mhkl,0)) / 1000; gauss_fwhm = 1.8/3.1415927 pp (1-eta) Tan(Th) + 0.0001; lor_fwhm = 1.8/3.1415927 pp eta Tan(Th) + 0.0001; }
macro Stephens_monoclinic(s400, s040, s004, s220, s202, s022, s301, s121, s103, eta) { prm mhkl = H^4 s400 + K^4 s040 + L^4 s004 + H^2 K^2 s220 + H^2 L^2 s202 + K^2 L^2 s022 + H K^2 L s121 + H L^3 s103 + H^3 L s301; prm pp = D_spacing^2 * Sqrt(Max(mhkl,0)) / 1000; gauss_fwhm = 1.8/3.1415927 pp (1-eta) Tan(Th) + 0.0001; lor_fwhm = 1.8/3.1415927 pp eta Tan(Th) + 0.0001; }
macro Stephens_hexagonal(s400, s202, s004, eta) { prm mhkl = H^4 s400 + K^4 s400 + L^4 s004 + H^2 K^2 3 s400 + H^2 L^2 s202 + K^2 L^2 s202 + H K L^2 s202 + H^3 K 2 s400 + H K^3 2 s400; prm pp = D_spacing^2 * Sqrt(Max(mhkl,0)) / 1000; gauss_fwhm = 1.8/3.1415927 pp (1-eta) Tan(Th) + 0.0001; lor_fwhm = 1.8/3.1415927 pp eta Tan(Th) + 0.0001; }
macro Stephens_orthorhombic(s400, s040, s004, s220, s202, s022, eta) { prm mhkl = H^4 s400 + K^4 s040 + L^4 s004 + H^2 K^2 s220 + H^2 L^2 s202 + K^2 L^2 s022; prm pp = D_spacing^2 * Sqrt(Max(mhkl,0)) / 1000; gauss_fwhm = 1.8/3.1415927 pp (1-eta) Tan(Th) + 0.0001; lor_fwhm = 1.8/3.1415927 pp eta Tan(Th) + 0.0001; }