package sansmodels; public class BE_RPA extends SANSModel{ private double k, Lb, h, b, Cs, alpha, C, background; //Default constructor public BE_RPA() { k = 10.0; Lb = 7.1; h = 12.0; b = 10.0; Cs = 0.0; alpha = 0.05; C = 0.7; background = 0.0; setNumberOfParameters(8); String[] parameters = {"K (barns)","Lb (A)","h (A-3)","b (A)", "Cs (mol/L)","alpha","C (mol/L)","Background (cm-1)"}; setParametersText(parameters); } public BE_RPA(double ink, double inLb, double inh, double inb, double inCs, double inalpha, double inC, double inBackground) { k = ink; Lb = inLb; h = inh; b = inb; Cs = inCs; alpha = inalpha; C = inC; background = inBackground; setNumberOfParameters(8); String[] parameters = {"K (barns)","Lb (A)","h (A-3)","b (A)", "Cs (mol/L)","alpha","C (mol/L)","Background (cm-1)"}; setParametersText(parameters); } public double getFormFactor(double inX) { double Ca, Csa, k2, r02, q2, Sq; Ca = C*6.022136e-4; Csa = Cs*6.022136e-4; k2 = 4.0*Math.PI*Lb*(2.0*Cs + alpha*Ca); r02 = 1./alpha/Math.sqrt(Ca)*(b/Math.sqrt(48.0*Math.PI*Lb)); q2 = inX*inX; Sq = k*1.0/(4.0*Math.PI*Lb*alpha*alpha)*(q2 + k2) / (1.0+ r02*r02*(q2+k2)*(q2-(12.0*h*Ca/b/b))); return Sq*getStructureFactor().calculate(inX) + background; } public void setParameters(double[] inParameters) { k = inParameters[0]; Lb = inParameters[1]; h = inParameters[2]; b = inParameters[3]; Cs = inParameters[4]; alpha = inParameters[5]; C = inParameters[6]; background = inParameters[7]; } public double[] getParameters() { double[] outParameters = new double[8]; outParameters[0] = k; outParameters[1] = Lb; outParameters[2] = h; outParameters[3] = b; outParameters[4] = Cs; outParameters[5] = alpha; outParameters[6] = C; outParameters[7] = background; return outParameters; } }