source:
sasmodels/sasmodels/models/surface_fractal.c
@
aad336c
Last change on this file since aad336c was 6794301, checked in by wojciech, 8 years ago | |
---|---|
|
|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[da84551] | 1 | double form_volume(double radius); |
2 | ||
[513efc5] | 3 | double Iq(double q, |
4 | double radius, | |
5 | double surface_dim, | |
6 | double cutoff_length); | |
7 | ||
8 | double Iqxy(double qx, double qy, | |
9 | double radius, | |
10 | double surface_dim, | |
11 | double cutoff_length); | |
[da84551] | 12 | |
[513efc5] | 13 | static double _surface_fractal_kernel(double q, |
[da84551] | 14 | double radius, |
15 | double surface_dim, | |
16 | double cutoff_length) | |
17 | { | |
18 | double pq, sq, mmo, result; | |
19 | ||
[513efc5] | 20 | //Replaced the original formula with Taylor expansion near zero. |
21 | //pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2); | |
22 | ||
[9c461c7] | 23 | pq = sph_j1c(q*radius); |
[513efc5] | 24 | pq = pq*pq; |
[da84551] | 25 | |
26 | //calculate S(q) | |
27 | mmo = 5.0 - surface_dim; | |
[6794301] | 28 | sq = sas_gamma(mmo)*sin(-(mmo)*atan(q*cutoff_length)); |
[da84551] | 29 | sq *= pow(cutoff_length, mmo); |
30 | sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0)); | |
31 | sq /= q; | |
32 | ||
33 | //combine and return | |
34 | result = pq * sq; | |
35 | ||
36 | return result; | |
37 | } | |
38 | double form_volume(double radius){ | |
39 | ||
40 | return 1.333333333333333*M_PI*radius*radius*radius; | |
41 | } | |
42 | ||
43 | double Iq(double q, | |
44 | double radius, | |
45 | double surface_dim, | |
46 | double cutoff_length | |
47 | ) | |
48 | { | |
[513efc5] | 49 | return _surface_fractal_kernel(q, radius, surface_dim, cutoff_length); |
[da84551] | 50 | } |
51 | ||
52 | // Iqxy is never called since no orientation or magnetic parameters. | |
53 | double Iqxy(double qx, double qy, | |
54 | double radius, | |
55 | double surface_dim, | |
56 | double cutoff_length) | |
57 | { | |
58 | double q = sqrt(qx*qx + qy*qy); | |
[513efc5] | 59 | return _surface_fractal_kernel(q, radius, surface_dim, cutoff_length); |
[da84551] | 60 | } |
61 |
Note: See TracBrowser
for help on using the repository browser.