1 | r""" |
---|
2 | Definition |
---|
3 | ---------- |
---|
4 | |
---|
5 | This model provides the form factor, $P(q)$, for stacked discs (tactoids) |
---|
6 | with a core/layer structure which is constructed itself as $P(q) S(Q)$ |
---|
7 | multiplying a $P(q)$ for individual core/layer disks by a structure factor |
---|
8 | $S(q)$ proposed by Kratky and Porod in 1949\ [#CIT1949]_ assuming the next |
---|
9 | neighbor distance (d-spacing) in the stack of parallel discs obeys a Gaussian |
---|
10 | distribution. As such the normalization of this "composite" form factor is |
---|
11 | relative to the individual disk volume, not the volume of the stack of disks. |
---|
12 | This model is appropriate for example for non non exfoliated clay particles such |
---|
13 | as Laponite. |
---|
14 | |
---|
15 | .. figure:: img/stacked_disks_geometry.png |
---|
16 | |
---|
17 | Geometry of a single core/layer disk |
---|
18 | |
---|
19 | The scattered intensity $I(q)$ is calculated as |
---|
20 | |
---|
21 | .. math:: |
---|
22 | |
---|
23 | I(q) = N\int_{0}^{\pi /2}\left[ \Delta \rho_t |
---|
24 | \left( V_t f_t(q,\alpha) - V_c f_c(q,\alpha)\right) + \Delta |
---|
25 | \rho_c V_c f_c(q,\alpha)\right]^2 S(q,\alpha)\sin{\alpha}\ d\alpha |
---|
26 | + \text{background} |
---|
27 | |
---|
28 | where the contrast |
---|
29 | |
---|
30 | .. math:: |
---|
31 | |
---|
32 | \Delta \rho_i = \rho_i - \rho_\text{solvent} |
---|
33 | |
---|
34 | and $N$ is the number of individual (single) discs per unit volume, $\alpha$ is |
---|
35 | the angle between the axis of the disc and $q$, and $V_t$ and $V_c$ are the |
---|
36 | total volume and the core volume of a single disc, respectively, and |
---|
37 | |
---|
38 | .. math:: |
---|
39 | |
---|
40 | f_t(q,\alpha) = |
---|
41 | \left(\frac{\sin(q(d+h)\cos{\alpha})}{q(d+h)\cos{\alpha}}\right) |
---|
42 | \left(\frac{2J_1(qR\sin{\alpha})}{qR\sin{\alpha}} \right) |
---|
43 | |
---|
44 | f_c(q,\alpha) = |
---|
45 | \left(\frac{\sin(qh)\cos{\alpha})}{qh\cos{\alpha}}\right) |
---|
46 | \left(\frac{2J_1(qR\sin{\alpha})}{qR\sin{\alpha}}\right) |
---|
47 | |
---|
48 | where $d$ = thickness of the layer (*thick_layer*), |
---|
49 | $2h$ = core thickness (*thick_core*), and $R$ = radius of the disc (*radius*). |
---|
50 | |
---|
51 | .. math:: |
---|
52 | |
---|
53 | S(q,\alpha) = 1 + \frac{1}{2}\sum_{k=1}^n(n-k)\cos{(kDq\cos{\alpha})} |
---|
54 | \exp\left[ -k(q)^2(D\cos{\alpha}~\sigma_d)^2/2\right] |
---|
55 | |
---|
56 | where $n$ is the total number of the disc stacked (*n_stacking*), |
---|
57 | $D = 2(d+h)$ is the next neighbor center-to-center distance (d-spacing), |
---|
58 | and $\sigma_d$ = the Gaussian standard deviation of the d-spacing (*sigma_d*). |
---|
59 | Note that $D\cos(\alpha)$ is the component of $D$ parallel to $q$ and the last |
---|
60 | term in the equation above is effectively a Debye-Waller factor term. |
---|
61 | |
---|
62 | .. note:: |
---|
63 | |
---|
64 | 1. Each assembly in the stack is layer/core/layer, so the spacing of the |
---|
65 | cores is core plus two layers. The 2nd virial coefficient of the cylinder |
---|
66 | is calculated based on the *radius* and *length* |
---|
67 | = *n_stacking* * (*thick_core* + 2 * *thick_layer*) |
---|
68 | values, and used as the effective radius for $S(Q)$ when $P(Q) * S(Q)$ |
---|
69 | is applied. |
---|
70 | |
---|
71 | 2. the resolution smearing calculation uses 76 Gaussian quadrature points |
---|
72 | to properly smear the model since the function is HIGHLY oscillatory, |
---|
73 | especially around the q-values that correspond to the repeat distance of |
---|
74 | the layers. |
---|
75 | |
---|
76 | To provide easy access to the orientation of the stacked disks, we define |
---|
77 | the axis of the cylinder using two angles $\theta$ and $\varphi$. |
---|
78 | |
---|
79 | .. figure:: img/cylinder_angle_definition.png |
---|
80 | |
---|
81 | Examples of the angles against the detector plane. |
---|
82 | |
---|
83 | |
---|
84 | Our model is derived from the form factor calculations implemented in a |
---|
85 | c-library provided by the NIST Center for Neutron Research\ [#CIT_Kline]_ |
---|
86 | |
---|
87 | References |
---|
88 | ---------- |
---|
89 | |
---|
90 | .. [#CIT1949] O Kratky and G Porod, *J. Colloid Science*, 4, (1949) 35 |
---|
91 | .. [#CIT_Kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 |
---|
92 | .. [#] J S Higgins and H C Benoit, *Polymers and Neutron Scattering*, |
---|
93 | Clarendon, Oxford, 1994 |
---|
94 | .. [#] A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, |
---|
95 | John Wiley and Sons, New York, 1955 |
---|
96 | |
---|
97 | Authorship and Verification |
---|
98 | ---------------------------- |
---|
99 | |
---|
100 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
101 | * **Last Modified by:** Paul Butler and Paul Kienzle **on:** November 26, 2016 |
---|
102 | * **Last Reviewed by:** Paul Butler and Paul Kienzle **on:** November 26, 2016 |
---|
103 | """ |
---|
104 | |
---|
105 | from numpy import inf, sin, cos, pi |
---|
106 | |
---|
107 | name = "stacked_disks" |
---|
108 | title = "Form factor for a stacked set of non exfoliated core/shell disks" |
---|
109 | description = """\ |
---|
110 | One layer of disk consists of a core, a top layer, and a bottom layer. |
---|
111 | radius = the radius of the disk |
---|
112 | thick_core = thickness of the core |
---|
113 | thick_layer = thickness of a layer |
---|
114 | sld_core = the SLD of the core |
---|
115 | sld_layer = the SLD of the layers |
---|
116 | n_stacking = the number of the disks |
---|
117 | sigma_d = Gaussian STD of d-spacing |
---|
118 | sld_solvent = the SLD of the solvent |
---|
119 | """ |
---|
120 | category = "shape:cylinder" |
---|
121 | |
---|
122 | # pylint: disable=bad-whitespace, line-too-long |
---|
123 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
124 | parameters = [ |
---|
125 | ["thick_core", "Ang", 10.0, [0, inf], "volume", "Thickness of the core disk"], |
---|
126 | ["thick_layer", "Ang", 10.0, [0, inf], "volume", "Thickness of layer each side of core"], |
---|
127 | ["radius", "Ang", 15.0, [0, inf], "volume", "Radius of the stacked disk"], |
---|
128 | ["n_stacking", "", 1.0, [1, inf], "volume", "Number of stacked layer/core/layer disks"], |
---|
129 | ["sigma_d", "Ang", 0, [0, inf], "", "Sigma of nearest neighbor spacing"], |
---|
130 | ["sld_core", "1e-6/Ang^2", 4, [-inf, inf], "sld", "Core scattering length density"], |
---|
131 | ["sld_layer", "1e-6/Ang^2", 0.0, [-inf, inf], "sld", "Layer scattering length density"], |
---|
132 | ["sld_solvent", "1e-6/Ang^2", 5.0, [-inf, inf], "sld", "Solvent scattering length density"], |
---|
133 | ["theta", "degrees", 0, [-360, 360], "orientation", "Orientation of the stacked disk axis w/respect incoming beam"], |
---|
134 | ["phi", "degrees", 0, [-360, 360], "orientation", "Rotation about beam"], |
---|
135 | ] |
---|
136 | # pylint: enable=bad-whitespace, line-too-long |
---|
137 | |
---|
138 | source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "stacked_disks.c"] |
---|
139 | |
---|
140 | demo = dict(background=0.001, |
---|
141 | scale=0.01, |
---|
142 | thick_core=10.0, |
---|
143 | thick_layer=10.0, |
---|
144 | radius=15.0, |
---|
145 | n_stacking=1, |
---|
146 | sigma_d=0, |
---|
147 | sld_core=4, |
---|
148 | sld_layer=0.0, |
---|
149 | sld_solvent=5.0, |
---|
150 | theta=90, |
---|
151 | phi=0) |
---|
152 | # After redefinition of spherical coordinates - |
---|
153 | # tests had in old coords theta=0, phi=0; new coords theta=90, phi=0 |
---|
154 | q = 0.1 |
---|
155 | # april 6 2017, rkh added a 2d unit test, assume correct! |
---|
156 | qx = q*cos(pi/6.0) |
---|
157 | qy = q*sin(pi/6.0) |
---|
158 | tests = [ |
---|
159 | # Accuracy tests based on content in test/utest_extra_models.py. |
---|
160 | # Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB; |
---|
161 | # for which alas q=0.001 values seem closer to n_stacked=1 not 5, |
---|
162 | # changed assuming my 4.1 code OK, RKH |
---|
163 | [{'thick_core': 10.0, |
---|
164 | 'thick_layer': 15.0, |
---|
165 | 'radius': 3000.0, |
---|
166 | 'n_stacking': 1.0, |
---|
167 | 'sigma_d': 0.0, |
---|
168 | 'sld_core': 4.0, |
---|
169 | 'sld_layer': -0.4, |
---|
170 | 'solvent_sd': 5.0, |
---|
171 | 'theta': 90.0, |
---|
172 | 'phi': 0.0, |
---|
173 | 'scale': 0.01, |
---|
174 | 'background': 0.001, |
---|
175 | }, 0.001, 5075.12], |
---|
176 | [{'thick_core': 10.0, |
---|
177 | 'thick_layer': 15.0, |
---|
178 | 'radius': 3000.0, |
---|
179 | 'n_stacking': 5, |
---|
180 | 'sigma_d': 0.0, |
---|
181 | 'sld_core': 4.0, |
---|
182 | 'sld_layer': -0.4, |
---|
183 | 'solvent_sd': 5.0, |
---|
184 | 'theta': 90.0, |
---|
185 | 'phi': 0.0, |
---|
186 | 'scale': 0.01, |
---|
187 | 'background': 0.001, |
---|
188 | # }, 0.001, 5065.12793824], n_stacking=1 not 5 ? slight change in value here 11jan2017, check other cpu types |
---|
189 | # }, 0.001, 5075.11570493], |
---|
190 | }, 0.001, 25325.635693], |
---|
191 | [{'thick_core': 10.0, |
---|
192 | 'thick_layer': 15.0, |
---|
193 | 'radius': 100.0, |
---|
194 | 'n_stacking': 5, |
---|
195 | 'sigma_d': 0.0, |
---|
196 | 'sld_core': 4.0, |
---|
197 | 'sld_layer': -0.4, |
---|
198 | 'solvent_sd': 5.0, |
---|
199 | 'theta': 90.0, |
---|
200 | 'phi': 20.0, |
---|
201 | 'scale': 0.01, |
---|
202 | 'background': 0.001}, |
---|
203 | (qx, qy), 0.0491167089952 ], |
---|
204 | [{'thick_core': 10.0, |
---|
205 | 'thick_layer': 15.0, |
---|
206 | 'radius': 3000.0, |
---|
207 | 'n_stacking': 5, |
---|
208 | 'sigma_d': 0.0, |
---|
209 | 'sld_core': 4.0, |
---|
210 | 'sld_layer': -0.4, |
---|
211 | 'solvent_sd': 5.0, |
---|
212 | 'theta': 90.0, |
---|
213 | 'phi': 0.0, |
---|
214 | 'scale': 0.01, |
---|
215 | 'background': 0.001, |
---|
216 | # }, 0.164, 0.0127673597265], n_stacking=1 not 5 ? slight change in value here 11jan2017, check other cpu types |
---|
217 | # }, 0.164, 0.01480812968], |
---|
218 | }, 0.164, 0.0598367986509], |
---|
219 | |
---|
220 | [{'thick_core': 10.0, |
---|
221 | 'thick_layer': 15.0, |
---|
222 | 'radius': 3000.0, |
---|
223 | 'n_stacking': 1.0, |
---|
224 | 'sigma_d': 0.0, |
---|
225 | 'sld_core': 4.0, |
---|
226 | 'sld_layer': -0.4, |
---|
227 | 'solvent_sd': 5.0, |
---|
228 | 'theta': 90.0, |
---|
229 | 'phi': 0.0, |
---|
230 | 'scale': 0.01, |
---|
231 | 'background': 0.001, |
---|
232 | # second test here was at q=90, changed it to q=5, note I(q) is then just value of flat background |
---|
233 | }, [0.001, 5.0], [5075.12, 0.001]], |
---|
234 | |
---|
235 | [{'thick_core': 10.0, |
---|
236 | 'thick_layer': 15.0, |
---|
237 | 'radius': 3000.0, |
---|
238 | 'n_stacking': 1.0, |
---|
239 | 'sigma_d': 0.0, |
---|
240 | 'sld_core': 4.0, |
---|
241 | 'sld_layer': -0.4, |
---|
242 | 'solvent_sd': 5.0, |
---|
243 | 'theta': 90.0, |
---|
244 | 'phi': 0.0, |
---|
245 | 'scale': 0.01, |
---|
246 | 'background': 0.001, |
---|
247 | }, ([0.4, 0.5]), [0.00105074, 0.00121761]], |
---|
248 | [{'thick_core': 10.0, |
---|
249 | 'thick_layer': 15.0, |
---|
250 | 'radius': 3000.0, |
---|
251 | 'n_stacking': 1.0, |
---|
252 | 'sigma_d': 0.0, |
---|
253 | 'sld_core': 4.0, |
---|
254 | 'sld_layer': -0.4, |
---|
255 | 'solvent_sd': 5.0, |
---|
256 | 'theta': 90.0, |
---|
257 | 'phi': 20.0, |
---|
258 | 'scale': 0.01, |
---|
259 | 'background': 0.001, |
---|
260 | }, (qx, qy), 0.0341738733124 ], |
---|
261 | |
---|
262 | [{'thick_core': 10.0, |
---|
263 | 'thick_layer': 15.0, |
---|
264 | 'radius': 3000.0, |
---|
265 | 'n_stacking': 1.0, |
---|
266 | 'sigma_d': 0.0, |
---|
267 | 'sld_core': 4.0, |
---|
268 | 'sld_layer': -0.4, |
---|
269 | 'solvent_sd': 5.0, |
---|
270 | 'theta': 90.0, |
---|
271 | 'phi': 0.0, |
---|
272 | 'scale': 0.01, |
---|
273 | 'background': 0.001, |
---|
274 | }, ([1.3, 1.57]), [0.0010039, 0.0010038]], |
---|
275 | ] |
---|
276 | # 11Jan2017 RKH checking unit test agai, note they are all 1D, no 2D |
---|
277 | |
---|