source: sasmodels/sasmodels/models/multilayer_vesicle.c @ 3a48772

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

use predefined constants for fractions of pi

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