source: sasmodels/sasmodels/models/mass_fractal.c @ 9c461c7

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 9c461c7 was 9c461c7, checked in by piotr, 8 years ago
  1. Code review from PK: renamed J1c to sph_j1c
  2. Fixed mass_fractal
  • Property mode set to 100644
File size: 1.4 KB
Line 
1double form_volume(double radius);
2
3double Iq(double q,
4          double radius,
5          double mass_dim,
6          double cutoff_length);
7
8double Iqxy(double qx, double qy,
9          double radius,
10          double mass_dim,
11          double cutoff_length);
12
13
14static double _mass_fractal_kernel(double q,
15          double radius,
16          double mass_dim,
17          double cutoff_length)
18{
19    //calculate P(q)
20    double pq = sph_j1c(q*radius);
21    pq = pq*pq;
22
23    //calculate S(q)
24    double mmo = mass_dim-1.0;
25    double sq = exp(lanczos_gamma(mmo))*sin((mmo)*atan(q*cutoff_length));
26    sq *= pow(cutoff_length, mmo);
27    sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0));
28    sq /= q;
29
30    //combine and return
31    double result = pq * sq;
32
33    return result;
34}
35double form_volume(double radius){
36
37    return 1.333333333333333*M_PI*radius*radius*radius;
38}
39
40double Iq(double q,
41          double radius,
42          double mass_dim,
43          double cutoff_length)
44{
45    return _mass_fractal_kernel(q,
46           radius,
47           mass_dim,
48           cutoff_length);
49}
50
51// Iqxy is never called since no orientation or magnetic parameters.
52double Iqxy(double qx, double qy,
53          double radius,
54          double mass_dim,
55          double cutoff_length)
56{
57    double q = sqrt(qx*qx + qy*qy);
58    return _mass_fractal_kernel(q,
59           radius,
60           mass_dim,
61           cutoff_length);
62}
63
Note: See TracBrowser for help on using the repository browser.