source: sasmodels/sasmodels/models/linear_pearls.c @ c3ccaec

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since c3ccaec was c3ccaec, checked in by GitHub <noreply@…>, 3 years ago

Merge branch 'master' into ticket-815

  • Property mode set to 100644
File size: 2.0 KB
Line 
1double form_volume(double radius, double num_pearls);
2
3double Iq(double q,
4            double radius,
5            double edge_sep,
6            double fp_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            int num_pearls,
14            double pearl_sld,
15            double solvent_sld);
16
17
18double form_volume(double radius, double fp_num_pearls)
19{
20    int num_pearls = (int)(fp_num_pearls + 0.5);
21    // Pearl volume
22    double pearl_vol = M_4PI_3 * cube(radius);
23    // Return total volume
24    return num_pearls * pearl_vol;;
25}
26
27double linear_pearls_kernel(double q,
28            double radius,
29            double edge_sep,
30            int num_pearls,
31            double pearl_sld,
32            double solvent_sld)
33{
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 interaction terms
49    double structure_factor = (double)num_pearls;
50    for(int num=1; num<num_pearls; num++) {
51        structure_factor += 2.0*(num_pearls-num)*sas_sinx_x(q*separation*num);
52    }
53    // form factor for num_pearls
54    double form_factor = 1.0e-4 * structure_factor * square(m_s*psi) / tot_vol;
55
56    return form_factor;
57}
58
59double Iq(double q,
60            double radius,
61            double edge_sep,
62            double fp_num_pearls,
63            double pearl_sld,
64            double solvent_sld)
65{
66
67    int num_pearls = (int)(fp_num_pearls + 0.5);
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.