source: sasmodels/sasmodels/models/raspberry.c @ d277229

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since d277229 was d277229, checked in by grethevj, 6 years ago

Models updated to include choices for effective interaction radii

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