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@…>, 7 years ago

fix multilayer vesicle polydispersity, docs and parameter names

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[ec1d4bc]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,
[c6ca41e]14          double volfraction,
15          double radius,
16          double thick_shell,
17          double thick_solvent,
18          double sld_solvent,
19          double sld,
[ec1d4bc]20          int n_shells)
[c6ca41e]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
[3a48772]32        voli = M_4PI_3*ri*ri*ri;
[925ad6e]33        fval += voli*sldi*sas_3j1x_x(ri*q);
[c6ca41e]34
35        ri += thick_shell;
36
37        // layer 2
[3a48772]38        voli = M_4PI_3*ri*ri*ri;
[925ad6e]39        fval -= voli*sldi*sas_3j1x_x(ri*q);
[c6ca41e]40
41        //do 2 layers at a time
[ec1d4bc]42        ii++;
[c6ca41e]43
[ec1d4bc]44    } while(ii <= n_shells-1);  //change to make 0 < n_shells < 2 correspond to
[c6ca41e]45                               //unilamellar vesicles (C. Glinka, 11/24/03)
46
[ec1d4bc]47    return 1.0e-4*volfraction*fval*fval;  // Volume normalization happens in caller
[c6ca41e]48}
49
[ec1d4bc]50static double
51Iq(double q,
[c6ca41e]52          double volfraction,
53          double radius,
54          double thick_shell,
55          double thick_solvent,
56          double sld_solvent,
57          double sld,
[ec1d4bc]58          double fp_n_shells)
[c6ca41e]59{
[ec1d4bc]60    int n_shells = (int)(fp_n_shells + 0.5);
[c6ca41e]61    return multilayer_vesicle_kernel(q,
62           volfraction,
63           radius,
64           thick_shell,
65           thick_solvent,
66           sld_solvent,
67           sld,
[ec1d4bc]68           n_shells);
[c6ca41e]69}
70
Note: See TracBrowser for help on using the repository browser.