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, 7 years ago

sph_j1c translated to sas_3j1x_x

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[b716cc6]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
[da84551]4double form_volume(double radius);
5
[513efc5]6double Iq(double q,
7          double radius,
[a807206]8          double fractal_dim_surf,
[513efc5]9          double cutoff_length);
10
11static double _surface_fractal_kernel(double q,
[da84551]12    double radius,
[a807206]13    double fractal_dim_surf,
[da84551]14    double cutoff_length)
15{
[b716cc6]16    // calculate P(q)
[925ad6e]17    const double pq = square(sas_3j1x_x(q*radius));
[b716cc6]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.;
[da84551]36}
[b716cc6]37double form_volume(double radius)
38{
39    return M_4PI_3*cube(radius);
[da84551]40}
41
42double Iq(double q,
43    double radius,
[a807206]44    double fractal_dim_surf,
[da84551]45    double cutoff_length
46    )
47{
[a807206]48    return _surface_fractal_kernel(q, radius, fractal_dim_surf, cutoff_length);
[da84551]49}
Note: See TracBrowser for help on using the repository browser.