source: sasmodels/sasmodels/models/stacked_disks.py @ 5111921

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

replace gifs so that we can build pdf

  • Property mode set to 100644
File size: 6.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* = 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    The 2nd virial coefficient of the cylinder is calculated based on the
72    *radius* and *length* = *n_stacking* * (*core_thick* + 2 * *layer_thick*)
73    values, and used as the effective radius for $S(Q)$ when $P(Q) * S(Q)$
74    is applied.
75
76To provide easy access to the orientation of the stacked disks, we define
77the axis of the cylinder using two angles $\theta$ and $\varphi$.
78
79.. figure:: img/stacked_disks_angle_definition.jpg
80
81    Examples of the angles for oriented stacked disks against
82    the detector plane.
83
84.. figure:: img/stacked_disks_angle_projection.jpg
85
86    Examples of the angles for oriented pp against the detector plane.
87
88Our model uses the form factor calculations implemented in a c-library provided
89by the NIST Center for Neutron Research (Kline, 2006)
90
91Reference
92---------
93
94A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and Sons, New York, 1955
95
96O Kratky and G Porod, *J. Colloid Science*, 4, (1949) 35
97
98J S Higgins and H C Benoit, *Polymers and Neutron Scattering*, Clarendon, Oxford, 1994
99
100"""
101
102from numpy import inf
103
104name = "stacked_disks"
105title = ""
106description = """\
107    One layer of disk consists of a core, a top layer, and a bottom layer.
108    radius =  the radius of the disk
109    core_thick = thickness of the core
110    layer_thick = thickness of a layer
111    core_sld = the SLD of the core
112    layer_sld = the SLD of the layers
113    n_stacking = the number of the disks
114    sigma_d =  Gaussian STD of d-spacing
115    solvent_sld = the SLD of the solvent
116    """
117category = "shape:cylinder"
118
119# pylint: disable=bad-whitespace, line-too-long
120#   ["name", "units", default, [lower, upper], "type","description"],
121parameters = [
122    ["core_thick",  "Ang",        10.0, [0, inf],    "volume",      "Thickness of the core disk"],
123    ["layer_thick", "Ang",        10.0, [0, inf],    "volume",      "Thickness of the stacked disk"],
124    ["radius",      "Ang",        15.0, [0, inf],    "volume",      "Radius of the stacked disk"],
125    ["n_stacking",  "",            1.0, [0, inf],    "volume",      "Number of stacking"],
126    ["sigma_d",     "Ang",         0,   [0, inf],    "",            "GSD of disks sigma_d"],
127    ["core_sld",    "1e-6/Ang^2",  4,   [-inf, inf], "",            "Core scattering length density"],
128    ["layer_sld",   "1e-6/Ang^2",  0.0, [-inf, inf], "",            "Layer scattering length density"],
129    ["solvent_sld", "1e-6/Ang^2",  5.0, [-inf, inf], "",            "Solvent scattering length density"],
130    ["theta",       "degrees",     0,   [-inf, inf], "orientation", "Orientation of the stacked disk axis w/respect incoming beam"],
131    ["phi",         "degrees",     0,   [-inf, inf], "orientation", "Orientation of the stacked disk in the plane of the detector"],
132    ]
133# pylint: enable=bad-whitespace, line-too-long
134
135source = ["lib/gauss76.c", "lib/J1.c", "stacked_disks.c"]
136
137demo = dict(background=0.001,
138            scale=0.01,
139            core_thick=10.0,
140            layer_thick=10.0,
141            radius=15.0,
142            n_stacking=1,
143            sigma_d=0,
144            core_sld=4,
145            layer_sld=0.0,
146            solvent_sld=5.0,
147            theta=0,
148            phi=0)
149
150
151oldname = 'StackedDisksModel'
152
153oldpars = dict(theta='axis_theta',
154               phi='axis_phi')
155
156tests = [
157    # Accuracy tests based on content in test/utest_extra_models.py
158    [{'core_thick': 10.0,
159      'layer_thick': 15.0,
160      'radius': 3000.0,
161      'n_stacking': 1.0,
162      'sigma_d': 0.0,
163      'core_sld': 4.0,
164      'layer_sld': -0.4,
165      'solvent_sd': 5.0,
166      'theta': 0.0,
167      'phi': 0.0,
168      'scale': 0.01,
169      'background': 0.001,
170     }, 0.001, 5075.12],
171
172    [{'core_thick': 10.0,
173      'layer_thick': 15.0,
174      'radius': 3000.0,
175      'n_stacking': 1.0,
176      'sigma_d': 0.0,
177      'core_sld': 4.0,
178      'layer_sld': -0.4,
179      'solvent_sd': 5.0,
180      'theta': 0.0,
181      'phi': 0.0,
182      'scale': 0.01,
183      'background': 0.001,
184     }, [0.001, 90.0], [5075.12, 0.001]],
185
186    [{'core_thick': 10.0,
187      'layer_thick': 15.0,
188      'radius': 3000.0,
189      'n_stacking': 1.0,
190      'sigma_d': 0.0,
191      'core_sld': 4.0,
192      'layer_sld': -0.4,
193      'solvent_sd': 5.0,
194      'theta': 0.0,
195      'phi': 0.0,
196      'scale': 0.01,
197      'background': 0.001,
198     }, ([0.4, 0.5]), [0.00105074, 0.00121761]],
199
200    [{'core_thick': 10.0,
201      'layer_thick': 15.0,
202      'radius': 3000.0,
203      'n_stacking': 1.0,
204      'sigma_d': 0.0,
205      'core_sld': 4.0,
206      'layer_sld': -0.4,
207      'solvent_sd': 5.0,
208      'theta': 0.0,
209      'phi': 0.0,
210      'scale': 0.01,
211      'background': 0.001,
212     }, ([1.3, 1.57]), [0.0010039, 0.0010038]],
213    ]
214
215
Note: See TracBrowser for help on using the repository browser.