source: sasmodels/sasmodels/models/multilayer_vesicle.py @ 68f45cb

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 68f45cb was 68f45cb, checked in by Paul Kienzle <pkienzle@…>, 7 years ago

multilayer vesicle: add doc on how to use array distribution

  • Property mode set to 100644
File size: 5.3 KB
RevLine 
[c6ca41e]1r"""
2Definition
3----------
4
5This model is a trivial extension of the core_shell_sphere function to include
6*N* shells where the core is filled with solvent and the shells are interleaved
[68f45cb]7with layers of solvent. For $N = 1$, this returns the same as the vesicle model,
[e77872e]8except for the normalisation, which here is to outermost volume.
9The shell thicknessess and SLD are constant for all shells as expected for
[c6ca41e]10a multilayer vesicle.
11
12.. figure:: img/multi_shell_geometry.jpg
13
14    Geometry of the multilayer_vesicle model.
15
[9f60c06]16See the :ref:`core-shell-sphere` model for more documentation.
[c6ca41e]17
[041bc75]18The 1D scattering intensity is calculated in the following way (Guinier, 1955)
19
20.. math::
[7e4a633]21    P(q) = \text{scale} \cdot \frac{\phi}{V(R_N)} F^2(q) + \text{background}
[041bc75]22
23where
24
25.. math::
[ec1d4bc]26     F(q) = (\rho_\text{shell}-\rho_\text{solv}) \sum_{i=1}^{N} \left[
27     3V(r_i)\frac{\sin(qr_i) - qr_i\cos(qr_i)}{(qr_i)^3}
28     - 3V(R_i)\frac{\sin(qR_i) - qR_i\cos(qR_i)}{(qR_i)^3}
[041bc75]29     \right]
30
[ec1d4bc]31for
[041bc75]32
[ec1d4bc]33.. math::
34
35     r_i &= r_c + (i-1)(t_s + t_w) && \text{ solvent radius before shell } i \\
36     R_i &= r_i + t_s && \text{ shell radius for shell } i
[041bc75]37
[ec1d4bc]38$\phi$ is the volume fraction of particles, $V(r)$ is the volume of a sphere
39of radius $r$, $r_c$ is the radius of the core, $t_s$ is the thickness of
40the shell, $t_w$ is the thickness of the solvent layer between the shells,
41$\rho_\text{shell}$ is the scattering length density of a shell, and
42$\rho_\text{solv}$ is the scattering length density of the solvent.
[041bc75]43
[7e4a633]44The outer-most shell radius $R_N$ is used as the effective radius
45for $P(Q)$ when $P(Q) * S(Q)$ is applied.
[041bc75]46
[68f45cb]47For mixed systems in which some vesicles have 1 shell, some have 2,
48etc., use polydispersity on $N$ to model the data.  For example,
49create a file such as *shell_dist.txt* containing the relative portion
50of each vesicle size::
51
52    1 20
53    2  4
54    3  1
55
56Turn on polydispersity and select an array distribution for the *n_shells*
57parameter.  Choose the above *shell_dist.txt* file, and the model will be
58computed with 80% 1-shell vesicles, 16% 2-shell vesicles and 4%
593-shell vesicles.
[041bc75]60
[c6ca41e]61The 2D scattering intensity is the same as 1D, regardless of the orientation
62of the q vector which is defined as:
63
64.. math::
65
66    q = \sqrt{q_x^2 + q_y^2}
67
[40a87fa]68For information about polarised and magnetic scattering, see
[9a4811a]69the :ref:`magnetism` documentation.
[c6ca41e]70
71This code is based on the form factor calculations implemented in the NIST
72Center for Neutron Research provided c-library (Kline, 2006).
73
74References
75----------
76
77B Cabane, *Small Angle Scattering Methods*,
78in *Surfactant Solutions: New Methods of Investigation*,
79Ch.2, Surfactant Science Series Vol. 22, Ed. R Zana and M Dekker,
80New York, (1987).
81
82**Author:** NIST IGOR/DANSE **on:** pre 2010
83
[41b1edd]84**Last Modified by:** Piotr Rozyczko **on:** Feb 24, 2016
[c6ca41e]85
86**Last Reviewed by:** Paul Butler **on:** March 20, 2016
87
88"""
89
90from numpy import inf
91
92name = "multilayer_vesicle"
93title = "P(Q) for a Multi-lamellar vesicle"
94description = """
95    multilayer_vesicle model parameters;
96    scale : scale factor for abs intensity if needed else 1.0
97    volfraction: volume fraction
98    radius : Core radius of the multishell
99    thick_shell: shell thickness
100    thick_solvent: water thickness
101    sld_solvent: solvent scattering length density
102    sld: shell scattering length density
[ec1d4bc]103    n_shells:number of "shell plus solvent" layer pairs
[c6ca41e]104    background: incoherent background
105        """
106category = "shape:sphere"
107
108# pylint: disable=bad-whitespace, line-too-long
109#   ["name", "units", default, [lower, upper], "type","description"],
110parameters = [
111    ["volfraction", "",  0.05, [0.0, 1],  "", "volume fraction of vesicles"],
[ec1d4bc]112    ["radius", "Ang", 60.0, [0.0, inf],  "volume", "radius of solvent filled core"],
113    ["thick_shell", "Ang",        10.0, [0.0, inf],  "volume", "thickness of one shell"],
114    ["thick_solvent", "Ang",        10.0, [0.0, inf],  "volume", "solvent thickness between shells"],
[e77872e]115    ["sld_solvent",    "1e-6/Ang^2",  6.4, [-inf, inf], "sld", "solvent scattering length density"],
[42356c8]116    ["sld",   "1e-6/Ang^2",  0.4, [-inf, inf], "sld", "Shell scattering length density"],
[ec1d4bc]117    ["n_shells",     "",            2.0, [1.0, inf],  "volume", "Number of shell plus solvent layer pairs"],
[c6ca41e]118    ]
119# pylint: enable=bad-whitespace, line-too-long
120
[7e4a633]121# TODO: proposed syntax for specifying which parameters can be polydisperse
122#polydispersity = ["radius", "thick_shell"]
123
[925ad6e]124source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"]
[c6ca41e]125
[ec1d4bc]126def ER(radius, thick_shell, thick_solvent, n_shells):
127    n_shells = int(n_shells+0.5)
128    return radius + n_shells * (thick_shell + thick_solvent) - thick_solvent
[c6ca41e]129
130demo = dict(scale=1, background=0,
131            volfraction=0.05,
132            radius=60.0,
133            thick_shell=10.0,
134            thick_solvent=10.0,
135            sld_solvent=6.4,
136            sld=0.4,
[ec1d4bc]137            n_shells=2.0)
[c6ca41e]138
139tests = [
140    # Accuracy tests based on content in test/utest_other_models.py
141    [{'radius': 60.0,
142      'thick_shell': 10.0,
143      'thick_solvent': 10.0,
144      'sld_solvent': 6.4,
145      'sld': 0.4,
[ec1d4bc]146      'n_shells': 2.0,
[c6ca41e]147      'scale': 1.0,
148      'background': 0.001,
149     }, 0.001, 122.1405],
150
151    [{'volfraction': 1.0,
152      'radius': 60.0,
153      'thick_shell': 10.0,
154      'thick_solvent': 10.0,
155      'sld_solvent': 6.4,
156      'sld': 0.4,
[ec1d4bc]157      'n_shells': 2.0,
[c6ca41e]158      'scale': 1.0,
159      'background': 0.001,
160     }, (0.001, 0.30903), 1.61873],
161    ]
Note: See TracBrowser for help on using the repository browser.