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

ticket-1257-vesicle-productticket_1156ticket_822_more_unit_tests
Last change on this file since a34b811 was a34b811, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

use radius_effective/radius_effective_mode/radius_effective_modes consistently throughout the code

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