source: sasmodels/sasmodels/models/multilayer_vesicle.c @ 2c74c11

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 2c74c11 was 2c74c11, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

implicit Iqxy; fix divide by 0 for q=0

  • Property mode set to 100644
File size: 1.4 KB
Line 
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
21        voli = 4.0*M_PI/3.0*ri*ri*ri;
22        fval += voli*sldi*sph_j1c(ri*q);
23
24        ri += thick_shell;
25
26        // layer 2
27        voli = 4.0*M_PI/3.0*ri*ri*ri;
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.