source: sasmodels/sasmodels/models/multilayer_vesicle.c @ 71b751d

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 71b751d was 71b751d, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

update remaining form factors to use Fq interface

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