package sansmodels; public class Cylinder extends SANSModel{ private double scale, radius, length, deltaRho, background; //Default constructor public Cylinder() { scale = 1.0; radius = 20.0; length = 400.0; deltaRho = 3.e-6; background = 0.0; setNumberOfParameters(5); String[] parameters = {"Scale", "Radius (A)", "Length (A)", "Contrast (A-2)", "Background (cm-1)"}; setParametersText(parameters); } public Cylinder(double inScale, double inRadius, double inLength, double inContrast, double inBackground) { scale = inScale; radius = inRadius; length = inLength; deltaRho = inContrast; background = inBackground; setNumberOfParameters(5); String[] parameters = {"Scale", "Radius (A)", "Length (A)", "Contrast (A-2)", "Background (cm-1)"}; setParametersText(parameters); } private double cylinderFunc(double inQ, double inZ) { double bessarg, bj, d1, t1, b1, t2, b2; bessarg = inQ * radius * Math.sin(inZ); bj = SpecialFunction.j1(bessarg); d1 = Math.sin(inQ * length/2.0 * Math.cos(inZ)); t1 = d1 * d1; d1 = bj; t2 = d1 * d1 * 4.0 * Math.sin(inZ); d1 = inQ * length/2.0 * Math.cos(inZ); b1 = d1 *d1; d1 = inQ * radius * Math.sin(inZ); b2 = d1 * d1; return t1*t2/b1/b2; } public double getFormFactor(double inX) { int nord = 76; double va, vb, summ, zi, answer, yyy; double vol; va = 0.0; vb = Math.PI/2.0; summ = 0.0; for(int i=0;i