source: sasmodels/sasmodels/models/fractal.c @ 6cefbc9

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 6cefbc9 was 2c74c11, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

implicit Iqxy; fix divide by 0 for q=0

  • Property mode set to 100644
File size: 1.5 KB
Line 
1double Iq(double q,
2          double volfraction,
3          double radius,
4          double fractal_dim,
5          double cor_length,
6          double sld_block,
7          double sld_solvent);
8
9double Iq(double q,
10          double volfraction,
11          double radius,
12          double fractal_dim,
13          double cor_length,
14          double sld_block,
15          double sld_solvent)
16{
17    double qr,r0,Df,corr,phi,sldp,sldm;
18    double pq,sq,inten;
19   
20     // Actively check the argument - needed for mass fractal - is it needie
21     //here?
22    if (fractal_dim <= 0.0){
23       return 0.0;
24    }
25   
26    phi = volfraction;        // volume fraction of building block spheres...
27    r0 = radius;     //  radius of building block
28    Df = fractal_dim;     //  fractal dimension
29    corr = cor_length;       //  correlation length of fractal-like aggregates
30    sldp = sld_block;       // SLD of building block
31    sldm = sld_solvent;       // SLD of matrix or solution
32 
33     qr=q*r0;
34   
35    //calculate P(q) for the spherical subunits
36    pq = phi*M_4PI_3*r0*r0*r0*(sldp-sldm)*(sldp-sldm)*sph_j1c(qr)*sph_j1c(qr);
37   
38    //calculate S(q)
39    sq = Df*sas_gamma(Df-1.0)*sin((Df-1.0)*atan(q*corr));
40    sq /= pow(qr,Df) * pow((1.0 + 1.0/(q*corr)/(q*corr)),((Df-1.0)/2.0));
41    sq += 1.0;
42   
43    //combine, scale to units cm-1 sr-1 (assuming data on absolute scale)
44    //and return
45    inten = pq*sq;
46    // convert I(1/A) to (1/cm)
47    inten *= 1.0e8;
48    //convert rho^2 in 10^-6 1/A to 1/A
49    inten *= 1.0e-12;   
50   
51   
52    return(inten);
53}
54
Note: See TracBrowser for help on using the repository browser.