[group] [eFit] [Weight] 3 [Algorithm] 1 MODE=3 ITERS=1000 REL=0 DER=1e-4 Form Factors [name] cylinder-efit [number parameters] 7, [description]

Form Factor of Cylinder with Radius R and Length L:


I(Q) = I0 x P(Q);

P(Q) = [0..π/2] F2(Q,R,L,α) sin(α)dα;

F(Q,R,L,a) => 2J1[QRsin(α)] / [QRsin(α)] x sin(QLcos(α)/2) / (QLcos(α)/2);

J1(x) - the regular cylindrical Bessel function of first order .


efit-ready

v. 2019-10-09


[x] Q [y] I [parameter names] L,R,I0,bgd,sldCylinder,sldSolvent,phi, [initial values] 500[1..10000],20[1..1000],1[0..1E6],0[0..10],3e+10,-5.6e+09,0.01[0.001..1] [adjustibility] 1,1,0,0,0,0,1 [parameter description] Length of Cylinder [A],Radius of Cylinder [A],Forward Scattering calculated [1/cm],Background [1/cm],SLD [1/cm/cm],SLD [1/cm/cm],volume fraction [0..1], [h-headers] #include #include [included functions] struct data {double QL; double QR;}; //--- double cylinder_under_integral(double alfa, void * data) { double QL = ((struct data *)data)->QL; double QR = ((struct data *)data)->QR; double result; //--- result= 2*gsl_sf_bessel_J1(QR*sin(alfa))/(QR*sin(alfa)); result*=sin(QL*cos(alfa)/2)/(QL*cos(alfa)/2); result=result*result*sin(alfa); //--- return result; }; double cylinder_form_factor(double Q, double R, double L) { if (Q==0) return 1.0; if (R*L==0) return 0.0; //+++ integral control parameters double IntegralAbs=0; double IntegralRel=0.001; int maxNumber=1000; //--- double QL=Q*L; double QR=Q*R; gsl_integration_workspace * w = gsl_integration_workspace_alloc (maxNumber); double result, error; data data={QL, QR}; gsl_function F; F.function = &cylinder_under_integral; F.params = &data; gsl_integration_qags (&F, 0.0001, M_PI/2, IntegralAbs, IntegralRel, maxNumber, w, &result, &error); gsl_integration_workspace_free(w); return result; } void beforeFiting(void * ParaM) { if (!beforeFit) return; int minPoint=currentFirstPoint; double min=YYY[minPoint]; int maxPoint=currentFirstPoint; double max=YYY[maxPoint]; for(int i=currentFirstPoint; imax) {max=YYY[i];maxPoint=i;} } double VolumeCylinder=M_PI*R*R*L; phi=max/(VolumeCylinder*1.0E-24*(sldCylinder-sldSolvent)*(sldCylinder-sldSolvent)); //bgd=0.75*min; } [code] double VolumeCylinder=M_PI*R*R*L; // volume in A^3 I0=phi*VolumeCylinder*1.0E-24*(sldCylinder-sldSolvent)*(sldCylinder-sldSolvent); I=I0 * cylinder_form_factor(Q, R, L)+bgd; beforeFiting(ParaM); //+++ eFit [fortran] 0, [end]