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

ticket-1257-vesicle-productticket_1156ticket_822_more_unit_tests
Last change on this file since a34b811 was a34b811, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

use radius_effective/radius_effective_mode/radius_effective_modes consistently throughout the code

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