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

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since d277229 was d277229, checked in by grethevj, 6 years ago

Models updated to include choices for effective interaction radii

  • Property mode set to 100644
File size: 2.0 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 double
50effective_radius(int mode, double radius, double thick_shell, double thick_solvent, double fp_n_shells)
51{
52    return radius + fp_n_shells*thick_shell + (fp_n_shells - 1.0)*thick_solvent;
53}
54
55static void
56Fq(double q,
57          double *F1,
58          double *F2,
59          double volfraction,
60          double radius,
61          double thick_shell,
62          double thick_solvent,
63          double sld_solvent,
64          double sld,
65          double fp_n_shells)
66{
67    int n_shells = (int)(fp_n_shells + 0.5);
68    const double fq = multilayer_vesicle_kernel(q,
69           radius,
70           thick_shell,
71           thick_solvent,
72           sld_solvent,
73           sld,
74           n_shells);
75    // See comment in vesicle.c regarding volfraction normalization.
76    *F1 = 1.0e-2 * sqrt(volfraction)*fq;
77    *F2 = 1.0e-4 * volfraction*fq*fq;
78}
79
Note: See TracBrowser for help on using the repository browser.