1 | r""" |
---|
2 | Definition |
---|
3 | ---------- |
---|
4 | |
---|
5 | The 1D scattering intensity is calculated in the following way (Guinier, 1955) |
---|
6 | |
---|
7 | .. math:: |
---|
8 | |
---|
9 | P(q) = \frac{\text{scale}}{V_\text{shell}} \left[ |
---|
10 | \frac{3V_{\text{core}}({\rho_{\text{solvent}} |
---|
11 | - \rho_{\text{shell}})j_1(qR_{\text{core}})}}{qR_{\text{core}}} |
---|
12 | + \frac{3V_{\text{tot}}(\rho_{\text{shell}} |
---|
13 | - \rho_{\text{solvent}}) j_1(qR_{\text{tot}})}{qR_{\text{tot}}} |
---|
14 | \right]^2 + \text{background} |
---|
15 | |
---|
16 | |
---|
17 | where scale is a scale factor equivalent to the volume fraction of shell |
---|
18 | material if the data is on an absolute scale, $V_{shell}$ is the volume of the |
---|
19 | shell, $V_{\text{cor}}$ is the volume of the core, $V_{\text{tot}}$ is the |
---|
20 | total volume, $R_{\text{core}}$ is the radius of the core, $R_{\text{tot}}$ is |
---|
21 | the outer radius of the shell, $\rho_{\text{solvent}}$ is the scattering length |
---|
22 | density of the solvent (which is the same as for the core in this case), |
---|
23 | $\rho_{\text{scale}}$ is the scattering length density of the shell, background |
---|
24 | is a flat background level (due for example to incoherent scattering in the |
---|
25 | case of neutrons), and $j_1$ is the spherical bessel function |
---|
26 | $j_1 = (sin(x) - x cos(x))/ x^2$. |
---|
27 | |
---|
28 | The functional form is identical to a "typical" core-shell structure, except |
---|
29 | that the scattering is normalized by the volume that is contributing to the |
---|
30 | scattering, namely the volume of the shell alone, the scattering length density |
---|
31 | of the core is fixed the same as that of the solvent, the scale factor when the |
---|
32 | data are on an absolute scale is equivalent to the volume fraction of material |
---|
33 | in the shell rather than the entire core+shell sphere, and the parameterization |
---|
34 | is done in terms of the core radius = $R_{\text{core}}$ and the shell |
---|
35 | thickness = $R_{\text{tot}} - R_{\text{core}}$. |
---|
36 | |
---|
37 | .. figure: img/vesicle_geometry.jpg |
---|
38 | |
---|
39 | The 2D scattering intensity is the same as *P(q)* above, regardless of the |
---|
40 | orientation of the *q* vector which is defined as |
---|
41 | |
---|
42 | .. math:: |
---|
43 | |
---|
44 | q = \sqrt{q_x^2 + q_y^2} |
---|
45 | |
---|
46 | |
---|
47 | NB: The outer most radius (= *radius* + *thickness*) is used as the effective |
---|
48 | radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied. |
---|
49 | |
---|
50 | .. image:: img/vesicle_1d.jpg |
---|
51 | |
---|
52 | *Figure. 1D plot using the default values given in the table |
---|
53 | (w/200 data point). Polydispersity and instrumental resolution normally |
---|
54 | will smear out most of the rapidly oscillating features.* |
---|
55 | |
---|
56 | REFERENCE |
---|
57 | |
---|
58 | A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and |
---|
59 | Sons, New York, (1955) |
---|
60 | """ |
---|
61 | |
---|
62 | import numpy as np |
---|
63 | from numpy import pi, inf |
---|
64 | |
---|
65 | name = "vesicle" |
---|
66 | title = "This model provides the form factor, *P(q)*, for an unilamellar \ |
---|
67 | vesicle. This is model is effectively identical to the hollow sphere \ |
---|
68 | reparameterized to be more intuitive for a vesicle and normalizing the \ |
---|
69 | form factor by the volume of the shell." |
---|
70 | description = """ |
---|
71 | Model parameters: |
---|
72 | radius : the core radius of the vesicle |
---|
73 | thickness: the shell thickness |
---|
74 | sld: the shell SLD |
---|
75 | solvent_sld: the solvent (and core) SLD |
---|
76 | background: incoherent background |
---|
77 | scale : scale factor = shell volume fraction if on absolute scale""" |
---|
78 | category = "shape:sphere" |
---|
79 | |
---|
80 | # [ "name", "units", default, [lower, upper], "type", "description"], |
---|
81 | parameters = [["sld", "1e-6/Ang^2", 0.5, [-inf, inf], "", |
---|
82 | "vesicle shell scattering length density"], |
---|
83 | ["solvent_sld", "1e-6/Ang^2", 6.36, [-inf, inf], "", |
---|
84 | "solvent scattering length density"], |
---|
85 | ["radius", "Ang", 100, [0, inf], "volume", |
---|
86 | "vesicle core radius"], |
---|
87 | ["thickness", "Ang", 30, [0, inf], "volume", |
---|
88 | "vesicle shell thickness"], |
---|
89 | ] |
---|
90 | |
---|
91 | source = ["lib/sph_j1c.c", "vesicle.c"] |
---|
92 | |
---|
93 | def ER(radius, thickness): |
---|
94 | ''' |
---|
95 | returns the effective radius used in the S*P calculation |
---|
96 | |
---|
97 | :param radius: core radius |
---|
98 | :param thickness: shell thickness |
---|
99 | ''' |
---|
100 | return radius + thickness |
---|
101 | |
---|
102 | def VR(radius, thickness): |
---|
103 | ''' |
---|
104 | returns the volumes of the shell and of the whole sphere including the |
---|
105 | core plus shell - is used to normalize when including polydispersity. |
---|
106 | |
---|
107 | :param radius: core radius |
---|
108 | :param thickness: shell thickness |
---|
109 | :return whole: volume of core and shell |
---|
110 | :return whole-core: volume of the shell |
---|
111 | ''' |
---|
112 | |
---|
113 | whole = 4. * pi * (radius + thickness) ** 3. / 3. |
---|
114 | core = 4. * pi * radius ** 3. / 3. |
---|
115 | return whole, whole - core |
---|
116 | |
---|
117 | |
---|
118 | # parameters for demo |
---|
119 | demo = dict(scale=1, background=0, |
---|
120 | sld=0.5, solvent_sld=6.36, |
---|
121 | radius=100, thickness=30, |
---|
122 | radius_pd=.2, radius_pd_n=10, |
---|
123 | thickness_pd=.2, thickness_pd_n=10) |
---|
124 | |
---|
125 | # For testing against the old sasview models, include the converted parameter |
---|
126 | # names and the target sasview model name. |
---|
127 | oldname = 'VesicleModel' |
---|
128 | oldpars = dict(sld='shell_sld', solvent_sld='solv_sld') |
---|
129 | |
---|
130 | |
---|
131 | # NOTE: test results taken from values returned by SasView 3.1.2 |
---|
132 | tests = [[{}, 0.0010005303255, 17139.8268799], |
---|
133 | [{}, 0.200027832249, 0.130387268704 ], |
---|
134 | [{}, 'ER', 130.], |
---|
135 | [{}, 'VR', 0.54483386436], |
---|
136 | ] |
---|