source: sasmodels/sasmodels/models/mass_fractal.c @ 58c3367

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 58c3367 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.0 KB
Line 
1double form_volume(double radius);
2
3double Iq(double q,
4          double radius,
5          double mass_dim,
6          double cutoff_length);
7
8static double _mass_fractal_kernel(double q,
9          double radius,
10          double mass_dim,
11          double cutoff_length)
12{
13    // Actively check the argument.
14    if (mass_dim <= 1.0){
15       return 0.0;
16    }
17
18    //calculate P(q)
19    double pq = sph_j1c(q*radius);
20    pq = pq*pq;
21
22    //calculate S(q)
23    double mmo = mass_dim-1.0;
24    double sq = sas_gamma(mmo)*sin((mmo)*atan(q*cutoff_length));
25    sq *= pow(cutoff_length, mmo);
26    sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0));
27    sq /= q;
28
29    //combine and return
30    double result = pq * sq;
31
32    return result;
33}
34double form_volume(double radius){
35
36    return 1.333333333333333*M_PI*radius*radius*radius;
37}
38
39double Iq(double q,
40          double radius,
41          double mass_dim,
42          double cutoff_length)
43{
44    return _mass_fractal_kernel(q,
45           radius,
46           mass_dim,
47           cutoff_length);
48}
Note: See TracBrowser for help on using the repository browser.