source: sasmodels/sasmodels/models/multilayer_vesicle.py @ 7e4a633

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

Merge branch 'master' into ticket-843

  • Property mode set to 100644
File size: 4.8 KB
Line 
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
7with layers of solvent. For *N = 1*, this returns the same as the vesicle model,
8except for the normalisation, which here is to outermost volume.
9The shell thicknessess and SLD are constant for all shells as expected for
10a multilayer vesicle.
11
12.. figure:: img/multi_shell_geometry.jpg
13
14    Geometry of the multilayer_vesicle model.
15
16See the :ref:`core-shell-sphere` model for more documentation.
17
18The 1D scattering intensity is calculated in the following way (Guinier, 1955)
19
20.. math::
21    P(q) = \text{scale} \cdot \frac{\phi}{V(R_N)} F^2(q) + \text{background}
22
23where
24
25.. math::
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}
29     \right]
30
31for
32
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
37
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.
43
44The outer-most shell radius $R_N$ is used as the effective radius
45for $P(Q)$ when $P(Q) * S(Q)$ is applied.
46
47
48The 2D scattering intensity is the same as 1D, regardless of the orientation
49of the q vector which is defined as:
50
51.. math::
52
53    q = \sqrt{q_x^2 + q_y^2}
54
55For information about polarised and magnetic scattering, see
56the :ref:`magnetism` documentation.
57
58This code is based on the form factor calculations implemented in the NIST
59Center for Neutron Research provided c-library (Kline, 2006).
60
61References
62----------
63
64B Cabane, *Small Angle Scattering Methods*,
65in *Surfactant Solutions: New Methods of Investigation*,
66Ch.2, Surfactant Science Series Vol. 22, Ed. R Zana and M Dekker,
67New York, (1987).
68
69**Author:** NIST IGOR/DANSE **on:** pre 2010
70
71**Last Modified by:** Piotr Rozyczko **on:** Feb 24, 2016
72
73**Last Reviewed by:** Paul Butler **on:** March 20, 2016
74
75"""
76
77from numpy import inf
78
79name = "multilayer_vesicle"
80title = "P(Q) for a Multi-lamellar vesicle"
81description = """
82    multilayer_vesicle model parameters;
83    scale : scale factor for abs intensity if needed else 1.0
84    volfraction: volume fraction
85    radius : Core radius of the multishell
86    thick_shell: shell thickness
87    thick_solvent: water thickness
88    sld_solvent: solvent scattering length density
89    sld: shell scattering length density
90    n_shells:number of "shell plus solvent" layer pairs
91    background: incoherent background
92        """
93category = "shape:sphere"
94
95# pylint: disable=bad-whitespace, line-too-long
96#   ["name", "units", default, [lower, upper], "type","description"],
97parameters = [
98    ["volfraction", "",  0.05, [0.0, 1],  "", "volume fraction of vesicles"],
99    ["radius", "Ang", 60.0, [0.0, inf],  "volume", "radius of solvent filled core"],
100    ["thick_shell", "Ang",        10.0, [0.0, inf],  "volume", "thickness of one shell"],
101    ["thick_solvent", "Ang",        10.0, [0.0, inf],  "volume", "solvent thickness between shells"],
102    ["sld_solvent",    "1e-6/Ang^2",  6.4, [-inf, inf], "sld", "solvent scattering length density"],
103    ["sld",   "1e-6/Ang^2",  0.4, [-inf, inf], "sld", "Shell scattering length density"],
104    ["n_shells",     "",            2.0, [1.0, inf],  "volume", "Number of shell plus solvent layer pairs"],
105    ]
106# pylint: enable=bad-whitespace, line-too-long
107
108# TODO: proposed syntax for specifying which parameters can be polydisperse
109#polydispersity = ["radius", "thick_shell"]
110
111source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"]
112
113def ER(radius, thick_shell, thick_solvent, n_shells):
114    n_shells = int(n_shells+0.5)
115    return radius + n_shells * (thick_shell + thick_solvent) - thick_solvent
116
117demo = dict(scale=1, background=0,
118            volfraction=0.05,
119            radius=60.0,
120            thick_shell=10.0,
121            thick_solvent=10.0,
122            sld_solvent=6.4,
123            sld=0.4,
124            n_shells=2.0)
125
126tests = [
127    # Accuracy tests based on content in test/utest_other_models.py
128    [{'radius': 60.0,
129      'thick_shell': 10.0,
130      'thick_solvent': 10.0,
131      'sld_solvent': 6.4,
132      'sld': 0.4,
133      'n_shells': 2.0,
134      'scale': 1.0,
135      'background': 0.001,
136     }, 0.001, 122.1405],
137
138    [{'volfraction': 1.0,
139      'radius': 60.0,
140      'thick_shell': 10.0,
141      'thick_solvent': 10.0,
142      'sld_solvent': 6.4,
143      'sld': 0.4,
144      'n_shells': 2.0,
145      'scale': 1.0,
146      'background': 0.001,
147     }, (0.001, 0.30903), 1.61873],
148    ]
Note: See TracBrowser for help on using the repository browser.