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

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since cc3fac6 was d507c3a, checked in by piotr, 8 years ago

Fixed deg→rad conversion

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