source: sasmodels/sasmodels/models/vesicle.py @ fa8011eb

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since fa8011eb was fa8011eb, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

doc cleanup

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