source: sasmodels/sasmodels/models/multilayer_vesicle.c @ ec1d4bc

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since ec1d4bc was ec1d4bc, checked in by Paul Kienzle <pkienzle@…>, 3 years ago

fix multilayer vesicle polydispersity, docs and parameter names

  • Property mode set to 100644
File size: 1.7 KB
Line 
1static double
2form_volume(double radius,
3          double thick_shell,
4          double thick_solvent,
5          double fp_n_shells)
6{
7    int n_shells = (int)(fp_n_shells + 0.5);
8    double R_N = radius + n_shells*(thick_shell+thick_solvent) - thick_solvent;
9    return M_4PI_3*cube(R_N);
10}
11
12static double
13multilayer_vesicle_kernel(double q,
14          double volfraction,
15          double radius,
16          double thick_shell,
17          double thick_solvent,
18          double sld_solvent,
19          double sld,
20          int n_shells)
21{
22    //calculate with a loop, two shells at a time
23    int ii = 0;
24    double fval = 0.0;
25    double voli = 0.0;
26    const double sldi = sld_solvent-sld;
27
28    do {
29        double ri = radius + (double)ii*(thick_shell + thick_solvent);
30
31        // layer 1
32        voli = M_4PI_3*ri*ri*ri;
33        fval += voli*sldi*sas_3j1x_x(ri*q);
34
35        ri += thick_shell;
36
37        // layer 2
38        voli = M_4PI_3*ri*ri*ri;
39        fval -= voli*sldi*sas_3j1x_x(ri*q);
40
41        //do 2 layers at a time
42        ii++;
43
44    } while(ii <= n_shells-1);  //change to make 0 < n_shells < 2 correspond to
45                               //unilamellar vesicles (C. Glinka, 11/24/03)
46
47    return 1.0e-4*volfraction*fval*fval;  // Volume normalization happens in caller
48}
49
50static double
51Iq(double q,
52          double volfraction,
53          double radius,
54          double thick_shell,
55          double thick_solvent,
56          double sld_solvent,
57          double sld,
58          double fp_n_shells)
59{
60    int n_shells = (int)(fp_n_shells + 0.5);
61    return multilayer_vesicle_kernel(q,
62           volfraction,
63           radius,
64           thick_shell,
65           thick_solvent,
66           sld_solvent,
67           sld,
68           n_shells);
69}
70
Note: See TracBrowser for help on using the repository browser.