source: sasmodels/sasmodels/models/linear_pearls.c @ 925ad6e

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 925ad6e was 925ad6e, checked in by wojciech, 6 years ago

sph_j1c translated to sas_3j1x_x

  • Property mode set to 100644
File size: 1.9 KB
Line 
1double form_volume(double radius, double num_pearls);
2
3double Iq(double q,
4            double radius,
5            double edge_sep,
6            double num_pearls,
7            double pearl_sld,
8            double solvent_sld);
9
10double linear_pearls_kernel(double q,
11            double radius,
12            double edge_sep,
13            double num_pearls,
14            double pearl_sld,
15            double solvent_sld);
16
17
18double form_volume(double radius, double num_pearls)
19{
20    // Pearl volume
21    double pearl_vol = M_4PI_3 * cube(radius);
22    // Return total volume
23    return num_pearls * pearl_vol;;
24}
25
26double linear_pearls_kernel(double q,
27            double radius,
28            double edge_sep,
29            double num_pearls,
30            double pearl_sld,
31            double solvent_sld)
32{
33    double n_contrib;
34    //relative sld
35    double contrast_pearl = pearl_sld - solvent_sld;
36    //each volume
37    double pearl_vol = M_4PI_3 * cube(radius);
38    //total volume
39    double tot_vol = num_pearls * pearl_vol;
40    //mass
41    double m_s = contrast_pearl * pearl_vol;
42    //center to center distance between the neighboring pearls
43    double separation = edge_sep + 2.0 * radius;
44
45    //sine functions of a pearl
46    double psi = sas_3j1x_x(q * radius);
47
48    // N pearls contribution
49    int n_max = num_pearls - 1;
50    n_contrib = num_pearls;
51    for(int num=1; num<=n_max; num++) {
52        n_contrib += (2.0*(num_pearls-num)*sas_sinx_x(q*separation*num));
53    }
54    // form factor for num_pearls
55    double form_factor = 1.0e-4 * n_contrib * square(m_s*psi) / tot_vol;
56
57    return form_factor;
58}
59
60double Iq(double q,
61            double radius,
62            double edge_sep,
63            double num_pearls,
64            double pearl_sld,
65            double solvent_sld)
66{
67
68        double result = linear_pearls_kernel(q,
69                    radius,
70                    edge_sep,
71                    num_pearls,
72                    pearl_sld,
73                    solvent_sld);
74
75        return result;
76}
Note: See TracBrowser for help on using the repository browser.