source: sasmodels/sasmodels/models/vesicle.c @ ee60aa7

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

clean up effective radius functions; improve mono_gauss_coil accuracy; start moving VR into C

  • Property mode set to 100644
File size: 1.9 KB
Line 
1// TODO: interface to form_volume/shell_volume not yet settled
2static double
3shell_volume(double *total, double radius, double thickness)
4{
5    //note that for the vesicle model, the volume is ONLY the shell volume
6    *total = M_4PI_3 * cube(radius+thickness);
7    return *total - M_4PI_3*cube(radius);
8}
9
10static double
11form_volume(double radius, double thickness)
12{
13    //note that for the vesicle model, the volume is ONLY the shell volume
14    double total;
15    return shell_volume(&total, radius, thickness);
16}
17
18static double
19effective_radius(int mode, double radius, double thickness)
20{
21    // case 1: outer radius
22    return radius + thickness;
23}
24
25static void
26Fq(double q,
27    double *F1,
28    double *F2,
29    double sld,
30    double sld_solvent,
31    double volfraction,
32    double radius,
33    double thickness)
34
35/*
36   scattering from a unilamellar vesicle.
37   same functional form as the core-shell sphere, but more intuitive for
38   a vesicle
39*/
40
41{
42    double vol,contrast,f,f2;
43
44    // core first, then add in shell
45    contrast = sld_solvent-sld;
46    vol = M_4PI_3*cube(radius);
47    f = vol * sas_3j1x_x(q*radius) * contrast;
48
49    //now the shell. No volume normalization as this is done by the caller
50    contrast = sld-sld_solvent;
51    vol = M_4PI_3*cube(radius+thickness);
52    f += vol * sas_3j1x_x(q*(radius+thickness)) * contrast;
53
54    //rescale to [cm-1].
55    // With volume fraction as part of the model in the dilute limit need
56    // to return F2 = Vf <fq^2>.  In order for beta approx. to work correctly
57    // need F1^2/F2 equal to <fq>^2 / <fq^2>.  By returning F1 = sqrt(Vf) <fq>
58    // and F2 = Vf <fq^2> both conditions are satisfied.
59    // Since Vf is the volume fraction of vesicles of all radii, it is
60    // constant when averaging F1 and F2 over radii and so pops out of the
61    // polydispersity loop, so it is safe to apply it inside the model
62    // (albeit conceptually ugly).
63    *F1 = 1e-2 * sqrt(volfraction) * f;
64    *F2 = 1.0e-4 * volfraction * f * f;
65}
Note: See TracBrowser for help on using the repository browser.