This is an old revision of the document!


Some various peak shapes that I've found useful in doing things like crystallite size distributions, solid solutions and the like.

Peak shape is defined by a FWHM, not a standard deviation. The lognormal peak is defined by a peak position (being the point of maximum intensity) and a FWHM, which is naturally asymmetric. All peak areas are normalised to 1 and allow for scaling. They will work with v5; some more work on them is required to back them in to v4.

Gaussian

macro & Gau(& int,& posn,& fwhm,& x)	{
	int (2 Sqrt(Ln(2)/Pi)/fwhm) Exp(-4 Ln(2) ((x-posn)/fwhm)^2)
}

Lorenztian

macro & Lor(& int,& posn,& fwhm,& x)	{
	int (1/(2 Pi)) (fwhm / ((fwhm/2)^2 + (x-posn)^2))
}

Pearson VII

macro & PeaVII(& int,& posn,& fwhm,& m,& x)	{
	int (2 Sqrt((2^(1/m)-1)/(fwhm^2)) Gamma_Approx(m)/(Sqrt(Pi) Gamma_Approx(m-1/2))) ((fwhm/2)^(2 m)/((fwhm/2)^2 + (2^(1/m) - 1)*(x-posn)^2)^m)
}

Lognormal

macro & lognormal(& int, & posn, & fwhm, & x)	{
	int/(Sqrt(2 Pi) LN_sigma(posn,fwhm) x) Exp(-((Ln(x)-LN_mu(posn,fwhm))/(Sqrt(2) LN_sigma(posn,fwhm)))^2)
}
 
macro & LN_r(& p, & w) {
	(w + Sqrt(4 p^2 + w^2)) / (2 p)
}
macro & LN_mu(& p, & w) {
	LN_r(p,w)^2/(2 Ln(2)) + Ln(p)
}
macro & LN_sigma(& p, & w) {
	LN_r(p,w)/Sqrt(2 Ln(2))
}

pseudo-Voigt

macro & PV(& int,& posn,& fwhm, & mix, & x)	{
	mix Gau(int, posn, fwhm,x) + (1 - mix) Lor(int, posn, fwhm,x)
}

Split functions

'all are normalised to unit area'
macro & split_Gaussian(& int,& posn,& hwL,& hwR,& x)	{
	If(x < posn, 2 Gau(int,posn,2 hwL,x) / (1 + hwR/hwL), 
	             2 Gau(int,posn,2 hwR,x) (hwR/hwL) / (1 + hwR/hwL)
	  )
}
 
macro & split_Lorentzian(& int,& posn,& hwL,& hwR,& x)	{
	If(x < posn, 2 Lor(int,posn,2 hwL,x) / (1 + hwR/hwL), 
	             2 Lor(int,posn,2 hwR,x) (hwR/hwL) / (1 + hwR/hwL)
	  )
}
 
macro & split_PV(& int,& posn,& hwL,& hwR, & mixL, & mixR, & x)	{
	If(x < posn, 2 PV(int,posn,2 hwL, mixL, x) / (1 + (PV(int,posn,2 hwL,mixL,posn)/PV(int,posn,2 hwR,mixR,posn))), 
	             2 PV(int,posn,2 hwR, mixR, x) (PV(int,posn,2 hwL,mixL,posn)/PV(int,posn,2 hwR,mixR,posn)) / (1 + (PV(int,posn,2 hwL,mixL,posn)/PV(int,posn,2 hwR,mixR,posn)))
	  )
}
 
 
macro & split_PeaVII(& int,& posn,& hwL,& hwR, & mL, & mR, & x)	{
	If(x < posn, 2 PeaVII(int,posn,2 hwL, mL, x) / (1 + (PeaVII(int,posn,2 hwL,mL,posn)/PeaVII(int,posn,2 hwR,mR,posn))), 
	             2 PeaVII(int,posn,2 hwR, mR, x) (PeaVII(int,posn,2 hwL,mL,posn)/PeaVII(int,posn,2 hwR,mR,posn)) / (1 + (PeaVII(int,posn,2 hwL,mL,posn)/PeaVII(int,posn,2 hwR,mR,posn)))
 
	  )
}
 
macro & split_Lognormal(& int,& posn,& hwL,& hwR,& x)	{
	If(x < posn, 2 lognormal(int,posn,2 hwL,x) / (1 + (lognormal(int,posn,2 hwL,posn)/lognormal(int,posn,2 hwR,posn))), 
	             2 lognormal(int,posn,2 hwR,x) (lognormal(int,posn,2 hwL,posn)/lognormal(int,posn,2 hwR,posn)) / (1 + (lognormal(int,posn,2 hwL,posn)/lognormal(int,posn,2 hwR,posn)))
	  )
}

Personal Tools