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

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

fix multilayer vesicle polydispersity, docs and parameter names

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