[group] [Superpositional] 4 [Algorithm] -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 17 16 Form Structure [name] pq---ellipsoid-of-revolution---sq---hayter-penfold-msa [number parameters] 17, [description]

v. 2021-02-24

Form Factor :: Ellipsoid of Revolution with Semi-Axes R,R,eR

Structure factor :: Hayter-Penfold

____________________________________________________________

I(Q) = I0 x [ <F2(Q)> + <F(Q )>2 ( S(Q)-1 ) ] + bgd;

____________________________________________________________

F(Q,r) = 3 ( sin( rQ ) - rQ cos( rQ ) ) / ( rQ )3;

r(a,R,e) = R[ sin2(a) + e2cos2(a) ]1/2;

< ...(a) > =

= integral [0 ... p/2] ...(a) sin(a) da

= [ t=cos(a) ] = integral [0 ... 1] ...( a(t) ) dt

I0= eta * volume * contrast ... ( could be adopted to a task)

integration: Gauss-Legendre-Quadrature: nodes = fixed number of nodes

______________________________________________________________

S(q) :: Hayter and Penfold structure factor for macroion solutions.

Routine to calculate S(Q) for a screened Coulomb potential between finite particles of diameter 2xR_SQ

at any volume fraction eta.

Reference:

J.B. Hayter And J. Penfold, Mol. Phys., 1981, 42, pp.109-118.

Code History:

1. Fortran Code: J.B. Hayter And J.F. Billman;

2. Convertation To C-Code [For Sasfit]: J. Kohlbrecher & I. Bressler

3. Adoption To Qtikws : V. Pipich


[x] Q [y] I [parameter names] R,epsilon,nodes,R_SQ,Z,salt,dielectric_constant,T,eta,rhoE,rhoS,I0,N,V,bgd,currentOutput,numberOutputs, [initial values] 50[10..10000],5[0.001..1000],50[10..1000],125[1..10000],2[0..100],0[0..1000],78[0..100],298[0..1000],0.4[0..1],3e+10[-0.6e+10..7e+10],6.33e+10[-0.6e+10..7e+10],1,1,1,0[0..2],0[0..3],2 [adjustibility] 1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0 [parameter description] PQ :: Semi-Axe Length [A],PQ :: Semi-Axes Ratio [1],PQ :: Gauss-Legendre quadrature :: control parameter [1],SQ :: effective radious of interaction [A],SQ :: Effective charge [1],SQ :: Salt concentration [M],SQ :: Dielectric constant [1],SQ :: Temperature [K],I0 :: volume fraction of ellipsoids [1],I0 :: SLD of solvent [cm^-2],I0 :: SLD of solvent [cm^-2],I0 :: [calculated] forward scattering I(Q=0)=eta V contrast [cm^-1],I0 :: [calculated] number density of ellipsoids N=eta/V [cm^-3],I0 :: [calculated] volume of ellipsoids [A^3] V=4Pi/3 epsilon R^3 [A^3],bgd :: background [cm^-1] ,output: 0 - full function; 1 - formFactor; 2-structureFactor; 3 - SQ=1,number of individual outputs, [h-headers] #include "IncludedFunctions/gauss-legendre-quadrature.h" #include "IncludedFunctions/sq-hayter-penfold-msa.h" #include "IncludedFunctions/pq-sphere.h" [included functions] //+++++++++++++++++++++++++++++++++++++ //+++ init Gauss-Legendre-Quadrature //+++++++++++++++++++++++++++++++++++++ void initGaussLegendreQuadrature(void * ParaM, int no, gsl_vector *&x, gsl_vector *&w) { // Gauss-Legendre quadrature :: weight and position of the quadrature // defined as "static", survive between calls of function if (beforeIter || beforeFit || afterFit) { x=gsl_vector_alloc(no); w=gsl_vector_alloc(no); GaussLegendreQuadrature(no, x,w); // x,w-arrays calculation } return; } //+++++++++++++++++++++++++++++++++++++ //+++ init Gauss-Legendre-Quadrature //+++++++++++++++++++++++++++++++++++++ void cleanGaussLegendreQuadrature(void * ParaM, gsl_vector *&x, gsl_vector *&w) { if (afterIter) { if (x->size >0) gsl_vector_free(x); if (w->size>0) gsl_vector_free(w); } return; } //+++++++++++++++++++++++++++++++++++++++++++++++++ //+++ Function under integral :: ellipsoidRevolution :: F^2(Q) //+++++++++++++++++++++++++++++++++++++++++++++++++ double ellipsoidRevolution_under_integral_form_factor(double t, void * ParaM) { // t=cos(alfa) // dt=-sin(alfa) dalfa //+++ getting of Q from data structure double Q = XXX [currentPoint]; double tt=t*t; //+++ double r = R*sqrt( 1 - tt + epsilon*epsilon*tt); //+++ return sphere_form_factor (Q, r); }; //+++++++++++++++++++++++++++++++++++++++++++++++++ //+++ Function under integral :: ellipsoidRevolution :: F(Q) //+++++++++++++++++++++++++++++++++++++++++++++++++ double ellipsoidRevolution_under_integral_scattering_amplitude(double t, void * ParaM) { // t=cos(alfa) // dt=-sin(alfa) dalfa //+++ getting of Q from data structure double Q = XXX [currentPoint]; double tt=t*t; //+++ double r = R*sqrt( 1 - tt + epsilon*epsilon*tt); //+++ return sphere_scattering_amplitude (Q, r); }; [code] //+++ [integrals--preparation] :: we calulate nodes of Gauss-Legendre quadrature nodes int no=int(nodes); // number nodes of Gauss-Legendre quadrature static gsl_vector *x; // x-array of Gauss-Legendre quadrature static gsl_vector *w; // weigh-array of Gauss-Legendre quadrature initGaussLegendreQuadrature(ParaM, no, x,w); //+++ [I0-part] :: I0 ::some constant calculations V= 4*M_PI/3*epsilon*pow(R,3); // calculation of Volume :: V if (V!=0) N=eta/V*1e24; // calculation of number density :: N I0=eta*V*pow(rhoE-rhoS,2.0)*1e-24; // calculation of forward scattering :: I0 //+++ [main-part] :: actially calculation of function here double SQ = sasfit_sq_HayterPenfoldMSA(Q, R_SQ, Z, eta, T, salt, dielectric_constant); double PQ; if (fabs(epsilon-1) < 1e-4) { // case :: sphere epsilon ->1 PQ= sphere_form_factor (Q,R) ; // Form-factor of Sphere I = I0 * PQ * SQ + bgd; // PQ and SQ coupling :: isotropic case } else { // case :: elipsoid of revolusion double F2Q=integral_GLI_fast (ellipsoidRevolution_under_integral_form_factor,ParaM, no, x, w, 0.0,1.0); double FQ=integral_GLI_fast (ellipsoidRevolution_under_integral_scattering_amplitude,ParaM, no, x, w, 0.0,1.0); PQ=F2Q; // Formfactor of elipsoid of revolusion I= I0 * ( F2Q + FQ*FQ*( SQ - 1 ) ) + bgd; // PQ and SQ coupling :: un-isotropic case } //+++ Output switcher (standard currentOutput=0) if (currentOutput==1 || currentFunction==1) I=I0*PQ ; // output :: form-factor x I(0) if (currentOutput==2 || currentFunction==2) I=SQ ; // output :: pure structure factor S(Q) if (currentOutput==3 || currentFunction==3) I=PQ ; // output ::pure form-factor //+++ [cleanning] :: we clean memory after Gauss-Legendre quadrature cleanGaussLegendreQuadrature(ParaM,x,w); [fortran] 0, [end]