# source:sasmodels/sasmodels/models/multilayer_vesicle.py@c3ccaec

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since c3ccaec was c3ccaec, checked in by GitHub <noreply@…>, 3 years ago

Merge branch 'master' into ticket-815

• Property mode set to 100644
File size: 4.5 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{V_f}{V_t} F^2(q) + \text{background}
22
23for
24
25.. math::
26    F(q) = (\rho_\text{shell}-\rho_\text{solv}) \sum_{i=1}^{n_\text{pairs}}
27        \left[
28          3V(R_i)\frac{\sin(qR_i)-qR_i\cos(qR_i)}{(qR_i)^3} \\
29          - 3V(R_i+t_s)\frac{\sin(q(R_i+t_s))-q(R_i+t_s)\cos(q(R_i+t_s))}{(q(R_i+t_s))^3}
30        \right]
31
32and
33
34.. math::
35     R_i = r_c + (i-1)(t_s + t_w)
36
37where $V_f$ is the volume fraction of particles, $V_t$ is the volume of the
38whole particle, $V(r)$ is the volume of a sphere of radius $r$, $r_c$ is the
39radius of the core, $\rho_\text{shell}$ is the scattering length density of a
40shell, $\rho_\text{solv}$ is the scattering length density of the solvent.
41
42The outer most radius, $r_o = R_n + t_s$, is used for both the volume fraction
43normalization and for the effective radius for *S(Q)* when $P(Q) * S(Q)$
44is applied.
45
46The 2D scattering intensity is the same as 1D, regardless of the orientation
47of the q vector which is defined as:
48
49.. math::
50
51    q = \sqrt{q_x^2 + q_y^2}
52
53For information about polarised and magnetic scattering, see
54the :ref:magnetism documentation.
55
56This code is based on the form factor calculations implemented in the NIST
57Center for Neutron Research provided c-library (Kline, 2006).
58
59References
60----------
61
62B Cabane, *Small Angle Scattering Methods*,
63in *Surfactant Solutions: New Methods of Investigation*,
64Ch.2, Surfactant Science Series Vol. 22, Ed. R Zana and M Dekker,
65New York, (1987).
66
67**Author:** NIST IGOR/DANSE **on:** pre 2010
68
70
71**Last Reviewed by:** Paul Butler **on:** March 20, 2016
72
73"""
74
75from numpy import inf
76
77name = "multilayer_vesicle"
78title = "P(Q) for a Multi-lamellar vesicle"
79description = """
80    multilayer_vesicle model parameters;
81    scale : scale factor for abs intensity if needed else 1.0
82    volfraction: volume fraction
84    thick_shell: shell thickness
85    thick_solvent: water thickness
86    sld_solvent: solvent scattering length density
87    sld: shell scattering length density
88    n_pairs:number of "shell plus solvent" layer pairs
89    background: incoherent background
90        """
91category = "shape:sphere"
92
94#   ["name", "units", default, [lower, upper], "type","description"],
95parameters = [
96    ["volfraction", "",  0.05, [0.0, 1],  "", "volume fraction of vesicles"],
97    ["radius", "Ang", 60.0, [0.0, inf],  "", "radius of solvent filled core"],
98    ["thick_shell", "Ang",        10.0, [0.0, inf],  "", "thickness of one shell"],
99    ["thick_solvent", "Ang",        10.0, [0.0, inf],  "", "solvent thickness between shells"],
100    ["sld_solvent",    "1e-6/Ang^2",  6.4, [-inf, inf], "sld", "solvent scattering length density"],
101    ["sld",   "1e-6/Ang^2",  0.4, [-inf, inf], "sld", "Shell scattering length density"],
102    ["n_pairs",     "",            2.0, [1.0, inf],  "", "Number of shell plus solvent layer pairs"],
103    ]
105
106source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"]
107
108# TODO: the following line does nothing
110
111demo = dict(scale=1, background=0,
112            volfraction=0.05,
114            thick_shell=10.0,
115            thick_solvent=10.0,
116            sld_solvent=6.4,
117            sld=0.4,
118            n_pairs=2.0)
119
120tests = [
121    # Accuracy tests based on content in test/utest_other_models.py
123      'thick_shell': 10.0,
124      'thick_solvent': 10.0,
125      'sld_solvent': 6.4,
126      'sld': 0.4,
127      'n_pairs': 2.0,
128      'scale': 1.0,
129      'background': 0.001,
130     }, 0.001, 122.1405],
131
132    [{'volfraction': 1.0,