source: sasmodels/sasmodels/models/surface_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.0 KB
Line 
1double form_volume(double radius);
2
3double Iq(double q,
4          double radius,
5          double surface_dim,
6          double cutoff_length);
7
8static double _surface_fractal_kernel(double q,
9    double radius,
10    double surface_dim,
11    double cutoff_length)
12{
13    double pq, sq, mmo, result;
14
15    //Replaced the original formula with Taylor expansion near zero.
16    //pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2);
17
18    pq = sph_j1c(q*radius);
19    pq = pq*pq;
20
21    //calculate S(q)
22    mmo = 5.0 - surface_dim;
23    sq  = sas_gamma(mmo)*sin(-(mmo)*atan(q*cutoff_length));
24    sq *= pow(cutoff_length, mmo);
25    sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0));
26    sq /= q;
27
28    //combine and return
29    result = pq * sq;
30
31    return result;
32}
33double form_volume(double radius){
34
35    return 1.333333333333333*M_PI*radius*radius*radius;
36}
37
38double Iq(double q,
39    double radius,
40    double surface_dim,
41    double cutoff_length
42    )
43{
44    return _surface_fractal_kernel(q, radius, surface_dim, cutoff_length);
45}
Note: See TracBrowser for help on using the repository browser.