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
RevLine 
[ec1d4bc]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,
[c6ca41e]14          double radius,
15          double thick_shell,
16          double thick_solvent,
17          double sld_solvent,
18          double sld,
[ec1d4bc]19          int n_shells)
[c6ca41e]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
[3a48772]31        voli = M_4PI_3*ri*ri*ri;
[925ad6e]32        fval += voli*sldi*sas_3j1x_x(ri*q);
[c6ca41e]33
34        ri += thick_shell;
35
36        // layer 2
[3a48772]37        voli = M_4PI_3*ri*ri*ri;
[925ad6e]38        fval -= voli*sldi*sas_3j1x_x(ri*q);
[c6ca41e]39
40        //do 2 layers at a time
[ec1d4bc]41        ii++;
[c6ca41e]42
[ec1d4bc]43    } while(ii <= n_shells-1);  //change to make 0 < n_shells < 2 correspond to
[c6ca41e]44                               //unilamellar vesicles (C. Glinka, 11/24/03)
45
[71b751d]46    return fval;  // Volume normalization happens in caller
[c6ca41e]47}
48
[d277229]49static double
[a34b811]50radius_effective(int mode, double radius, double thick_shell, double thick_solvent, double fp_n_shells)
[d277229]51{
[ee60aa7]52    // case 1: outer radius
[d277229]53    return radius + fp_n_shells*thick_shell + (fp_n_shells - 1.0)*thick_solvent;
54}
55
[71b751d]56static void
57Fq(double q,
58          double *F1,
59          double *F2,
[c6ca41e]60          double volfraction,
61          double radius,
62          double thick_shell,
63          double thick_solvent,
64          double sld_solvent,
65          double sld,
[ec1d4bc]66          double fp_n_shells)
[c6ca41e]67{
[ec1d4bc]68    int n_shells = (int)(fp_n_shells + 0.5);
[71b751d]69    const double fq = multilayer_vesicle_kernel(q,
[c6ca41e]70           radius,
71           thick_shell,
72           thick_solvent,
73           sld_solvent,
74           sld,
[ec1d4bc]75           n_shells);
[71b751d]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;
[c6ca41e]79}
80
Note: See TracBrowser for help on using the repository browser.