source: sasmodels/sasmodels/models/fractal_core_shell.c @ 6d96b66

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 6d96b66 was 6d96b66, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

fractal models: handle limits of q=0 and dim=1

  • Property mode set to 100644
File size: 1.6 KB
Line 
1double form_volume(double radius, double thickness);
2
3double Iq(double q,
4          double radius,
5          double thickness,
6          double core_sld,
7          double shell_sld,
8          double solvent_sld,
9          double volfraction,
10          double fractal_dim,
11          double cor_length);
12
13double form_volume(double radius, double thickness)
14{
15    return M_4PI_3 * cube(radius + thickness);
16}
17
18double Iq(double q,
19          double radius,
20          double thickness,
21          double core_sld,
22          double shell_sld,
23          double solvent_sld,
24          double volfraction,
25          double fractal_dim,
26          double cor_length) {
27
28
29    const double pq = core_shell_kernel(q, radius, thickness,
30                                        core_sld, shell_sld, solvent_sld);
31
32
33    //calculate S(q)
34    double sq;
35    if (q > 0. && fractal_dim > 1.) {
36        // q>0, D>0
37        const double D = fractal_dim;
38        const double Dm1 = fractal_dim - 1.0;
39        const double t1 = D*sas_gamma(Dm1)*sin((Dm1)*atan(q*cor_length));
40        const double t2 = pow(q*radius, -D);
41        const double t3 = pow(1.0 + 1.0/square(q*cor_length), -0.5*Dm1);
42        sq = 1.0 + t1 * t2 * t3;
43    } else if (q > 0.) {
44        // q>0, D=1
45        sq = 1.0 + atan(q*cor_length) / (q*radius);
46    } else if (fractal_dim > 1.) {
47        // q=0, D>1
48        const double D = fractal_dim;
49        sq = 1.0 + pow(cor_length/radius, D)*sas_gamma(D+1.0);
50    } else {
51        // q=0, D=1
52        sq = 1.0 + cor_length/radius;
53    }
54
55    // Note: core_shell_kernel already performs the 1e-4 unit conversion
56    return volfraction * sq * pq;
57}
58
Note: See TracBrowser for help on using the repository browser.