source: sasmodels/sasmodels/models/mass_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.2 KB
Line 
1double form_volume(double radius);
2
3double Iq(double q,
4          double mass_dim,
5          double surface_dim,
6          double cluster_rg,
7          double primary_rg);
8
9static double _mass_surface_fractal_kernel(double q,
10          double mass_dim,
11          double surface_dim,
12          double cluster_rg,
13          double primary_rg)
14{
15     //computation
16    double tot_dim = 6.0 - surface_dim - mass_dim;
17    mass_dim /= 2.0;
18    tot_dim /= 2.0;
19
20    double rc_norm = cluster_rg * cluster_rg / (3.0 * mass_dim);
21    double rp_norm = primary_rg * primary_rg / (3.0 * tot_dim);
22
23    //x for P
24    double x_val1 = 1.0 +  q * q * rc_norm;
25    double x_val2 = 1.0 +  q * q * rp_norm;
26
27    double inv_form = pow(x_val1, mass_dim) * pow(x_val2, tot_dim);
28
29    //another singular
30    if (inv_form == 0.0) return 0.0;
31
32    double form_factor = 1.0;
33    form_factor /= inv_form;
34
35    return (form_factor);
36}
37double form_volume(double radius){
38
39    return 1.333333333333333*M_PI*radius*radius*radius;
40}
41
42double Iq(double q,
43          double mass_dim,
44          double surface_dim,
45          double cluster_rg,
46          double primary_rg)
47{
48    return _mass_surface_fractal_kernel(q,
49            mass_dim,
50            surface_dim,
51            cluster_rg,
52            primary_rg);
53}
Note: See TracBrowser for help on using the repository browser.