source: sasmodels/sasmodels/models/raspberry.c @ 925ad6e

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 925ad6e was 925ad6e, checked in by wojciech, 6 years ago

sph_j1c translated to sas_3j1x_x

  • Property mode set to 100644
File size: 2.6 KB
Line 
1double form_volume(double radius_lg);
2
3double Iq(double q, 
4          double sld_lg, double sld_sm, double sld_solvent,
5          double volfraction_lg, double volfraction_sm, double surf_fraction,
6          double radius_lg, double radius_sm, double penetration);
7
8double form_volume(double radius_lg)
9{
10    //Because of the complex structure, volume normalization must
11    //happen in the Iq code below.  Thus the form volume is set to 1.0 here
12    double volume=1.0;
13    return volume;
14}
15
16double Iq(double q,
17          double sld_lg, double sld_sm, double sld_solvent,
18          double volfraction_lg, double volfraction_sm, double surface_fraction,
19          double radius_lg, double radius_sm, double penetration)
20{
21    // Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41.
22
23
24    double vfL, rL, sldL, vfS, rS, sldS, deltaS, delrhoL, delrhoS, sldSolv;
25    double VL, VS, Np, f2, fSs;
26    double psiL,psiS;
27    double sfLS,sfSS;
28    double slT;
29 
30    vfL = volfraction_lg;
31    rL = radius_lg;
32    sldL = sld_lg;
33    vfS = volfraction_sm;
34    fSs = surface_fraction;
35    rS = radius_sm;
36    sldS = sld_sm;
37    deltaS = penetration;
38    sldSolv = sld_solvent;
39   
40    delrhoL = fabs(sldL - sldSolv);
41    delrhoS = fabs(sldS - sldSolv); 
42     
43    VL = M_4PI_3*rL*rL*rL;
44    VS = M_4PI_3*rS*rS*rS;
45
46    //Number of small particles per large particle
47    Np = vfS*fSs*VL/vfL/VS;
48
49    //Total scattering length difference
50    slT = delrhoL*VL + Np*delrhoS*VS;
51
52    //Form factors for each particle
53    psiL = sas_3j1x_x(q*rL);
54    psiS = sas_3j1x_x(q*rS);
55
56    //Cross term between large and small particles
57    sfLS = psiL*psiS*sas_sinx_x(q*(rL+deltaS*rS));
58    //Cross term between small particles at the surface
59    sfSS = psiS*psiS*sas_sinx_x(q*(rL+deltaS*rS))*sas_sinx_x(q*(rL+deltaS*rS));
60
61    //Large sphere form factor term
62    f2 = delrhoL*delrhoL*VL*VL*psiL*psiL;
63    //Small sphere form factor term
64    f2 += Np*delrhoS*delrhoS*VS*VS*psiS*psiS;
65    //Small particle - small particle cross term
66    f2 += Np*(Np-1)*delrhoS*delrhoS*VS*VS*sfSS;
67    //Large-small particle cross term
68    f2 += 2*Np*delrhoL*delrhoS*VL*VS*sfLS;
69    //Normalise by total scattering length difference
70    if (f2 != 0.0){
71        f2 = f2/slT/slT;
72        }
73
74    //I(q) for large-small composite particles
75    f2 = f2*(vfL*delrhoL*delrhoL*VL + vfS*fSs*Np*delrhoS*delrhoS*VS);
76    //I(q) for free small particles
77    f2+= vfS*(1.0-fSs)*delrhoS*delrhoS*VS*psiS*psiS;
78   
79    // normalize to single particle volume and convert to 1/cm
80    f2 *= 1.0e8;        // [=] 1/cm
81    f2 *= 1.0e-12;      // convert for (1/A^-6)^2 to (1/A)^2
82   
83    return f2;
84}
Note: See TracBrowser for help on using the repository browser.