1 | r""" |
---|
2 | Definition |
---|
3 | ---------- |
---|
4 | |
---|
5 | Calculates the form factor for a rectangular solid with a core-shell structure. |
---|
6 | **The thickness and the scattering length density of the shell or "rim" |
---|
7 | can be different on all three (pairs) of faces.** |
---|
8 | |
---|
9 | The form factor is normalized by the particle volume $V$ such that |
---|
10 | |
---|
11 | .. math:: |
---|
12 | |
---|
13 | I(q) = \text{scale}\frac{\langle f^2 \rangle}{V} + \text{background} |
---|
14 | |
---|
15 | where $\langle \ldots \rangle$ is an average over all possible orientations |
---|
16 | of the rectangular solid. |
---|
17 | |
---|
18 | |
---|
19 | The function calculated is the form factor of the rectangular solid below. |
---|
20 | The core of the solid is defined by the dimensions $A$, $B$, $C$ such that |
---|
21 | $A < B < C$. |
---|
22 | |
---|
23 | .. image:: img/core_shell_parallelepiped_geometry.jpg |
---|
24 | |
---|
25 | There are rectangular "slabs" of thickness $t_A$ that add to the $A$ dimension |
---|
26 | (on the $BC$ faces). There are similar slabs on the $AC$ $(=t_B)$ and $AB$ |
---|
27 | $(=t_C)$ faces. The projection in the $AB$ plane is then |
---|
28 | |
---|
29 | .. image:: img/core_shell_parallelepiped_projection.jpg |
---|
30 | |
---|
31 | The volume of the solid is |
---|
32 | |
---|
33 | .. math:: |
---|
34 | |
---|
35 | V = ABC + 2t_ABC + 2t_BAC + 2t_CAB |
---|
36 | |
---|
37 | **meaning that there are "gaps" at the corners of the solid.** |
---|
38 | |
---|
39 | The intensity calculated follows the :ref:`parallelepiped` model, with the |
---|
40 | core-shell intensity being calculated as the square of the sum of the |
---|
41 | amplitudes of the core and shell, in the same manner as a core-shell model. |
---|
42 | |
---|
43 | .. math:: |
---|
44 | |
---|
45 | F_{a}(Q,\alpha,\beta)= |
---|
46 | \Bigg(\frac{sin(Q(L_A+2t_A)/2sin\alpha sin\beta)}{Q(L_A+2t_A)/2sin\alpha |
---|
47 | sin\beta)} |
---|
48 | - \frac{sin(QL_A/2sin\alpha sin\beta)}{QL_A/2sin\alpha sin\beta)} \Bigg) |
---|
49 | + \frac{sin(QL_B/2sin\alpha sin\beta)}{QL_B/2sin\alpha sin\beta)} |
---|
50 | + \frac{sin(QL_C/2sin\alpha sin\beta)}{QL_C/2sin\alpha sin\beta)} |
---|
51 | |
---|
52 | .. note:: |
---|
53 | |
---|
54 | For the calculation of the form factor to be valid, the sides of the solid |
---|
55 | MUST be chosen such that** $A < B < C$. |
---|
56 | If this inequality is not satisfied, the model will not report an error, |
---|
57 | but the calculation will not be correct and thus the result wrong. |
---|
58 | |
---|
59 | FITTING NOTES |
---|
60 | If the scale is set equal to the particle volume fraction, |phi|, the returned |
---|
61 | value is the scattered intensity per unit volume, $I(q) = \phi P(q)$. |
---|
62 | However, **no interparticle interference effects are included in this |
---|
63 | calculation.** |
---|
64 | |
---|
65 | There are many parameters in this model. Hold as many fixed as possible with |
---|
66 | known values, or you will certainly end up at a solution that is unphysical. |
---|
67 | |
---|
68 | Constraints must be applied during fitting to ensure that the inequality |
---|
69 | $A < B < C$ is not violated. The calculation will not report an error, |
---|
70 | but the results will not be correct. |
---|
71 | |
---|
72 | The returned value is in units of |cm^-1|, on absolute scale. |
---|
73 | |
---|
74 | NB: The 2nd virial coefficient of the core_shell_parallelepiped is calculated |
---|
75 | based on the the averaged effective radius $(=\sqrt{(A+2t_A)(B+2t_B)/\pi})$ |
---|
76 | and length $(C+2t_C)$ values, and used as the effective radius |
---|
77 | for $S(Q)$ when $P(Q) * S(Q)$ is applied. |
---|
78 | |
---|
79 | To provide easy access to the orientation of the parallelepiped, we define the |
---|
80 | axis of the cylinder using three angles $\theta$, $\phi$ and $\Psi$. |
---|
81 | (see :ref:`cylinder orientation <cylinder-angle-definition>`). |
---|
82 | The angle $\Psi$ is the rotational angle around the *long_c* axis against the |
---|
83 | $q$ plane. For example, $\Psi = 0$ when the *short_b* axis is parallel to the |
---|
84 | *x*-axis of the detector. |
---|
85 | |
---|
86 | .. figure:: img/parallelepiped_angle_definition.jpg |
---|
87 | |
---|
88 | Definition of the angles for oriented core-shell parallelepipeds. |
---|
89 | |
---|
90 | .. figure:: img/parallelepiped_angle_projection.jpg |
---|
91 | |
---|
92 | Examples of the angles for oriented core-shell parallelepipeds against the |
---|
93 | detector plane. |
---|
94 | |
---|
95 | Validation |
---|
96 | ---------- |
---|
97 | |
---|
98 | The model uses the form factor calculations implemented in a c-library provided |
---|
99 | by the NIST Center for Neutron Research (Kline, 2006). |
---|
100 | |
---|
101 | References |
---|
102 | ---------- |
---|
103 | |
---|
104 | .. [#] P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211 |
---|
105 | Equations (1), (13-14). (in German) |
---|
106 | .. [#] D Singh (2009). *Small angle scattering studies of self assembly in |
---|
107 | lipid mixtures*, John's Hopkins University Thesis (2009) 223-225. `Available |
---|
108 | from Proquest <http://search.proquest.com/docview/304915826?accountid |
---|
109 | =26379>`_ |
---|
110 | |
---|
111 | Authorship and Verification |
---|
112 | ---------------------------- |
---|
113 | |
---|
114 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
115 | * **Last Modified by:** Paul Butler **Date:** September 30, 2016 |
---|
116 | * **Last Reviewed by:** Miguel Gonzales **Date:** March 21, 2016 |
---|
117 | """ |
---|
118 | |
---|
119 | import numpy as np |
---|
120 | from numpy import pi, inf, sqrt |
---|
121 | |
---|
122 | name = "core_shell_parallelepiped" |
---|
123 | title = "Rectangular solid with a core-shell structure." |
---|
124 | description = """ |
---|
125 | P(q)= |
---|
126 | """ |
---|
127 | category = "shape:parallelepiped" |
---|
128 | |
---|
129 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
130 | parameters = [["sld_core", "1e-6/Ang^2", 1, [-inf, inf], "sld", |
---|
131 | "Parallelepiped core scattering length density"], |
---|
132 | ["sld_a", "1e-6/Ang^2", 2, [-inf, inf], "sld", |
---|
133 | "Parallelepiped A rim scattering length density"], |
---|
134 | ["sld_b", "1e-6/Ang^2", 4, [-inf, inf], "sld", |
---|
135 | "Parallelepiped B rim scattering length density"], |
---|
136 | ["sld_c", "1e-6/Ang^2", 2, [-inf, inf], "sld", |
---|
137 | "Parallelepiped C rim scattering length density"], |
---|
138 | ["sld_solvent", "1e-6/Ang^2", 6, [-inf, inf], "sld", |
---|
139 | "Solvent scattering length density"], |
---|
140 | ["length_a", "Ang", 35, [0, inf], "volume", |
---|
141 | "Shorter side of the parallelepiped"], |
---|
142 | ["length_b", "Ang", 75, [0, inf], "volume", |
---|
143 | "Second side of the parallelepiped"], |
---|
144 | ["length_c", "Ang", 400, [0, inf], "volume", |
---|
145 | "Larger side of the parallelepiped"], |
---|
146 | ["thick_rim_a", "Ang", 10, [0, inf], "volume", |
---|
147 | "Thickness of A rim"], |
---|
148 | ["thick_rim_b", "Ang", 10, [0, inf], "volume", |
---|
149 | "Thickness of B rim"], |
---|
150 | ["thick_rim_c", "Ang", 10, [0, inf], "volume", |
---|
151 | "Thickness of C rim"], |
---|
152 | ["theta", "degrees", 0, [-inf, inf], "orientation", |
---|
153 | "In plane angle"], |
---|
154 | ["phi", "degrees", 0, [-inf, inf], "orientation", |
---|
155 | "Out of plane angle"], |
---|
156 | ["psi", "degrees", 0, [-inf, inf], "orientation", |
---|
157 | "Rotation angle around its own c axis against q plane"], |
---|
158 | ] |
---|
159 | |
---|
160 | source = ["lib/gauss76.c", "core_shell_parallelepiped.c"] |
---|
161 | |
---|
162 | |
---|
163 | def ER(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c): |
---|
164 | """ |
---|
165 | Return equivalent radius (ER) |
---|
166 | """ |
---|
167 | |
---|
168 | # surface average radius (rough approximation) |
---|
169 | surf_rad = sqrt((length_a + 2.0*thick_rim_a) * (length_b + 2.0*thick_rim_b) / pi) |
---|
170 | |
---|
171 | height = length_c + 2.0*thick_rim_c |
---|
172 | |
---|
173 | ddd = 0.75 * surf_rad * (2 * surf_rad * height + (height + surf_rad) * (height + pi * surf_rad)) |
---|
174 | return 0.5 * (ddd) ** (1. / 3.) |
---|
175 | |
---|
176 | # VR defaults to 1.0 |
---|
177 | |
---|
178 | # parameters for demo |
---|
179 | demo = dict(scale=1, background=0.0, |
---|
180 | sld_core=1, sld_a=2, sld_b=4, sld_c=2, sld_solvent=6, |
---|
181 | length_a=35, length_b=75, length_c=400, |
---|
182 | thick_rim_a=10, thick_rim_b=10, thick_rim_c=10, |
---|
183 | theta=0, phi=0, psi=0, |
---|
184 | length_a_pd=0.1, length_a_pd_n=1, |
---|
185 | length_b_pd=0.1, length_b_pd_n=1, |
---|
186 | length_c_pd=0.1, length_c_pd_n=1, |
---|
187 | thick_rim_a_pd=0.1, thick_rim_a_pd_n=1, |
---|
188 | thick_rim_b_pd=0.1, thick_rim_b_pd_n=1, |
---|
189 | thick_rim_c_pd=0.1, thick_rim_c_pd_n=1, |
---|
190 | theta_pd=10, theta_pd_n=1, |
---|
191 | phi_pd=10, phi_pd_n=1, |
---|
192 | psi_pd=10, psi_pd_n=1) |
---|
193 | |
---|
194 | qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) |
---|
195 | tests = [[{}, 0.2, 0.533149288477], |
---|
196 | [{}, [0.2], [0.533149288477]], |
---|
197 | [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.032102135569], |
---|
198 | [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.032102135569]], |
---|
199 | ] |
---|
200 | del qx, qy # not necessary to delete, but cleaner |
---|