source: sasmodels/sasmodels/models/stacked_disks.py @ 42356c8

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

label all sld parameters

  • Property mode set to 100644
File size: 7.8 KB
Line 
1r"""
2This model provides the form factor, $P(q)$, for stacked discs (tactoids)
3with a core/layer structure where the form factor is normalized by the volume
4of the cylinder. Assuming the next neighbor distance (d-spacing) in a stack
5of parallel discs obeys a Gaussian distribution, a structure factor $S(q)$
6proposed by Kratky and Porod in 1949 is used in this function.
7
8Note that the resolution smearing calculation uses 76 Gauss quadrature points
9to properly smear the model since the function is HIGHLY oscillatory,
10especially around the q-values that correspond to the repeat distance of
11the layers.
12
13The 2D scattering intensity is the same as 1D, regardless of the orientation
14of the q vector which is defined as
15
16.. math::
17
18    q = \sqrt{q_x^2 + q_y^2}
19
20Definition
21----------
22
23.. figure:: img/stacked_disks_geometry.png
24
25The scattered intensity $I(q)$ is calculated as
26
27.. math::
28
29    I(q) = N\int_{0}^{\pi /2}\left[ \Delta \rho_t
30    \left( V_tf_t(q) - V_cf_c(q)\right) + \Delta \rho_cV_cf_c(q)
31    \right]^2S(q)\sin{\alpha d\alpha} + background
32
33where the contrast
34
35.. math::
36
37    \Delta \rho_i = \rho_i - \rho_{solvent}
38
39and *N* is the number of discs per unit volume,
40$\alpha$ is the angle between the axis of the disc and *q*,
41and $V_t$ and $V_c$ are the total volume and the core volume of
42a single disc, respectively.
43
44.. math::
45
46    \left\langle f_{t}^2(q)\right\rangle_{\alpha} =
47    \int_{0}^{\pi/2}\left[
48    \left(\frac{sin(q(d+h)\cos{\alpha})}{q(d+h)\cos{\alpha}}\right)
49    \left(\frac{2J_1(qR\sin{\alpha})}{qR\sin{\alpha}} \right)
50    \right]^2 \sin{\alpha d\alpha}
51
52    \left\langle f_{c}^2(q)\right\rangle_{\alpha} =
53    \int_{0}^{\pi/2}\left[
54    \left(\frac{sin(qh)\cos{\alpha})}{qh\cos{\alpha}}\right)
55    \left(\frac{2J_1(qR\sin{\alpha})}{qR\sin{\alpha}} \right)
56    \right]^2 \sin{\alpha d\alpha}
57
58where *d* = thickness of the layer (layer_thick),
59*2h* = core thickness (core_thick), and *R* = radius of the disc (radius).
60
61.. math::
62
63    S(q) = 1 + \frac{1}{2}\sum_{k=1}^n(n-k)\cos{(kDq\cos{\alpha})}
64    exp\left[ -k(q\cos{\alpha})^2\sigma_D/2\right]
65
66where *n* = the total number of the disc stacked (n_stacking),
67*D* = 2*(*d*+*h*)the next neighbor center-to-center distance (d-spacing),
68and $\sigma_D$ = the Gaussian standard deviation of the d-spacing (sigma_d).
69
70.. note::
71    Each assmebly in the stack is layer/core/layer, so the spacing of the cores
72    is core plus two layers. The 2nd virial coefficient of the cylinder is
73    calculated based on the
74    *radius* and *length* = *n_stacking* * (*core_thick* + 2 * *layer_thick*)
75    values, and used as the effective radius for $S(Q)$ when $P(Q) * S(Q)$
76    is applied.
77
78To provide easy access to the orientation of the stacked disks, we define
79the axis of the cylinder using two angles $\theta$ and $\varphi$.
80
81.. figure:: img/stacked_disks_angle_definition.jpg
82
83    Examples of the angles for oriented stacked disks against
84    the detector plane.
85
86.. figure:: img/stacked_disks_angle_projection.jpg
87
88    Examples of the angles for oriented pp against the detector plane.
89
90Our model uses the form factor calculations implemented in a c-library provided
91by the NIST Center for Neutron Research (Kline, 2006)
92
93References
94----------
95
96A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, 1955
97
98O Kratky and G Porod, *J. Colloid Science*, 4, (1949) 35
99
100J S Higgins and H C Benoit, *Polymers and Neutron Scattering*, Clarendon, Oxford, 1994
101
102**Author:** NIST IGOR/DANSE **on:** pre 2010
103
104**Last Modified by:** Piotr Rozyczko **on:** February 18, 2016
105
106**Last Reviewed by:** Richard Heenan **on:** March 22, 2016
107"""
108
109from numpy import inf
110
111name = "stacked_disks"
112title = ""
113description = """\
114    One layer of disk consists of a core, a top layer, and a bottom layer.
115    radius =  the radius of the disk
116    core_thick = thickness of the core
117    layer_thick = thickness of a layer
118    sld_core = the SLD of the core
119    sld_layer = the SLD of the layers
120    n_stacking = the number of the disks
121    sigma_d =  Gaussian STD of d-spacing
122    sld_solvent = the SLD of the solvent
123    """
124category = "shape:cylinder"
125
126# pylint: disable=bad-whitespace, line-too-long
127#   ["name", "units", default, [lower, upper], "type","description"],
128parameters = [
129    ["core_thick",  "Ang",        10.0, [0, inf],    "volume",      "Thickness of the core disk"],
130    ["layer_thick", "Ang",        10.0, [0, inf],    "volume",      "Thickness of layer each side of core"],
131    ["radius",      "Ang",        15.0, [0, inf],    "volume",      "Radius of the stacked disk"],
132    ["n_stacking",  "",            1.0, [0, inf],    "volume",      "Number of stacked layer/core/layer disks"],
133    ["sigma_d",     "Ang",         0,   [0, inf],    "",            "GSD of disks sigma_d"],
134    ["sld_core",    "1e-6/Ang^2",  4,   [-inf, inf], "sld",         "Core scattering length density"],
135    ["sld_layer",   "1e-6/Ang^2",  0.0, [-inf, inf], "sld",         "Layer scattering length density"],
136    ["sld_solvent", "1e-6/Ang^2",  5.0, [-inf, inf], "sld",         "Solvent scattering length density"],
137    ["theta",       "degrees",     0,   [-inf, inf], "orientation", "Orientation of the stacked disk axis w/respect incoming beam"],
138    ["phi",         "degrees",     0,   [-inf, inf], "orientation", "Orientation of the stacked disk in the plane of the detector"],
139    ]
140# pylint: enable=bad-whitespace, line-too-long
141
142source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "stacked_disks.c"]
143
144demo = dict(background=0.001,
145            scale=0.01,
146            core_thick=10.0,
147            layer_thick=10.0,
148            radius=15.0,
149            n_stacking=1,
150            sigma_d=0,
151            sld_core=4,
152            sld_layer=0.0,
153            sld_solvent=5.0,
154            theta=0,
155            phi=0)
156
157tests = [
158    # Accuracy tests based on content in test/utest_extra_models.py.
159    # Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB
160    [{'core_thick': 10.0,
161      'layer_thick': 15.0,
162      'radius': 3000.0,
163      'n_stacking': 1.0,
164      'sigma_d': 0.0,
165      'sld_core': 4.0,
166      'sld_layer': -0.4,
167      'solvent_sd': 5.0,
168      'theta': 0.0,
169      'phi': 0.0,
170      'scale': 0.01,
171      'background': 0.001,
172     }, 0.001, 5075.12],
173
174    [{'core_thick': 10.0,
175      'layer_thick': 15.0,
176      'radius': 3000.0,
177      'n_stacking': 5.0,
178      'sigma_d': 0.0,
179      'sld_core': 4.0,
180      'sld_layer': -0.4,
181      'solvent_sd': 5.0,
182      'theta': 0.0,
183      'phi': 0.0,
184      'scale': 0.01,
185      'background': 0.001,
186     }, 0.001, 5065.12793824],
187
188    [{'core_thick': 10.0,
189      'layer_thick': 15.0,
190      'radius': 3000.0,
191      'n_stacking': 5.0,
192      'sigma_d': 0.0,
193      'sld_core': 4.0,
194      'sld_layer': -0.4,
195      'solvent_sd': 5.0,
196      'theta': 0.0,
197      'phi': 0.0,
198      'scale': 0.01,
199      'background': 0.001,
200     }, 0.164, 0.0127673597265],
201
202    [{'core_thick': 10.0,
203      'layer_thick': 15.0,
204      'radius': 3000.0,
205      'n_stacking': 1.0,
206      'sigma_d': 0.0,
207      'sld_core': 4.0,
208      'sld_layer': -0.4,
209      'solvent_sd': 5.0,
210      'theta': 0.0,
211      'phi': 0.0,
212      'scale': 0.01,
213      'background': 0.001,
214     }, [0.001, 90.0], [5075.12, 0.001]],
215
216    [{'core_thick': 10.0,
217      'layer_thick': 15.0,
218      'radius': 3000.0,
219      'n_stacking': 1.0,
220      'sigma_d': 0.0,
221      'sld_core': 4.0,
222      'sld_layer': -0.4,
223      'solvent_sd': 5.0,
224      'theta': 0.0,
225      'phi': 0.0,
226      'scale': 0.01,
227      'background': 0.001,
228     }, ([0.4, 0.5]), [0.00105074, 0.00121761]],
229
230    [{'core_thick': 10.0,
231      'layer_thick': 15.0,
232      'radius': 3000.0,
233      'n_stacking': 1.0,
234      'sigma_d': 0.0,
235      'sld_core': 4.0,
236      'sld_layer': -0.4,
237      'solvent_sd': 5.0,
238      'theta': 0.0,
239      'phi': 0.0,
240      'scale': 0.01,
241      'background': 0.001,
242     }, ([1.3, 1.57]), [0.0010039, 0.0010038]],
243    ]
244# 21Mar2016   RKH notes that unit tests all have n_stacking=1, ought to test other values
245
Note: See TracBrowser for help on using the repository browser.