source: sasmodels/sasmodels/models/surface_fractal.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: 1.5 KB
Line 
1// Don't need invalid test since fractal_dim_surf is not polydisperse
2// #define INVALID(v) (v.fractal_dim_surf <= 1.0 || v.fractal_dim_surf >= 3.0)
3
4double form_volume(double radius);
5
6double Iq(double q,
7          double radius,
8          double fractal_dim_surf,
9          double cutoff_length);
10
11static double _surface_fractal_kernel(double q,
12    double radius,
13    double fractal_dim_surf,
14    double cutoff_length)
15{
16    // calculate P(q)
17    const double pq = square(sas_3j1x_x(q*radius));
18
19    // calculate S(q)
20    // Note: lim q->0 S(q) = -gamma(mmo) cutoff_length^mmo (mmo cutoff_length)
21    // however, the surface fractal formula is invalid outside the range
22    const double mmo = 5.0 - fractal_dim_surf;
23    const double sq = sas_gamma(mmo) * pow(cutoff_length, mmo)
24           * pow(1.0 + square(q*cutoff_length), -0.5*mmo)
25           * sin(-mmo * atan(q*cutoff_length)) / q;
26
27    // Empirically determined that the results are valid within this range.
28    // Above 1/r, the form starts to oscillate;  below
29    //const double result = (q > 5./(3-fractal_dim_surf)/cutoff_length) && q < 1./radius
30    //                      ? pq * sq : 0.);
31
32    double result = pq * sq;
33
34    // exclude negative results
35    return result > 0. ? result : 0.;
36}
37double form_volume(double radius)
38{
39    return M_4PI_3*cube(radius);
40}
41
42double Iq(double q,
43    double radius,
44    double fractal_dim_surf,
45    double cutoff_length
46    )
47{
48    return _surface_fractal_kernel(q, radius, fractal_dim_surf, cutoff_length);
49}
Note: See TracBrowser for help on using the repository browser.