Changeset 0f113fb in sasmodels for sasmodels/models/core_shell_parallelepiped.py
- Timestamp:
- Dec 4, 2017 8:18:21 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c11d09f, a189283
- Parents:
- 10ee838 (diff), 791281c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_parallelepiped.py
r2d81cfe r10ee838 5 5 Calculates the form factor for a rectangular solid with a core-shell structure. 6 6 The thickness and the scattering length density of the shell or 7 "rim" can be different on each (pair) of faces. However at this time the 1D 8 calculation does **NOT** actually calculate a c face rim despite the presence 9 of the parameter. Some other aspects of the 1D calculation may be wrong. 10 11 .. note:: 12 This model was originally ported from NIST IGOR macros. However, it is not 13 yet fully understood by the SasView developers and is currently under review. 7 "rim" can be different on each (pair) of faces. 14 8 15 9 The form factor is normalized by the particle volume $V$ such that … … 21 15 where $\langle \ldots \rangle$ is an average over all possible orientations 22 16 of the rectangular solid. 23 24 17 25 18 The function calculated is the form factor of the rectangular solid below. … … 41 34 V = ABC + 2t_ABC + 2t_BAC + 2t_CAB 42 35 43 **meaning that there are "gaps" at the corners of the solid.** Again note that 44 $t_C = 0$ currently. 36 **meaning that there are "gaps" at the corners of the solid.** 45 37 46 38 The intensity calculated follows the :ref:`parallelepiped` model, with the 47 39 core-shell intensity being calculated as the square of the sum of the 48 amplitudes of the core and shell, in the same manner as a core-shell model. 49 50 .. math:: 51 52 F_{a}(Q,\alpha,\beta)= 53 \left[\frac{\sin(\tfrac{1}{2}Q(L_A+2t_A)\sin\alpha \sin\beta) 54 }{\tfrac{1}{2}Q(L_A+2t_A)\sin\alpha\sin\beta} 55 - \frac{\sin(\tfrac{1}{2}QL_A\sin\alpha \sin\beta) 56 }{\tfrac{1}{2}QL_A\sin\alpha \sin\beta} \right] 57 \left[\frac{\sin(\tfrac{1}{2}QL_B\sin\alpha \sin\beta) 58 }{\tfrac{1}{2}QL_B\sin\alpha \sin\beta} \right] 59 \left[\frac{\sin(\tfrac{1}{2}QL_C\sin\alpha \sin\beta) 60 }{\tfrac{1}{2}QL_C\sin\alpha \sin\beta} \right] 61 62 .. note:: 63 64 Why does t_B not appear in the above equation? 65 For the calculation of the form factor to be valid, the sides of the solid 66 MUST (perhaps not any more?) be chosen such that** $A < B < C$. 67 If this inequality is not satisfied, the model will not report an error, 68 but the calculation will not be correct and thus the result wrong. 40 amplitudes of the core and the slabs on the edges. 41 42 the scattering amplitude is computed for a particular orientation of the 43 core-shell parallelepiped with respect to the scattering vector and then 44 averaged over all possible orientations, where $\alpha$ is the angle between 45 the $z$ axis and the $C$ axis of the parallelepiped, $\beta$ is 46 the angle between projection of the particle in the $xy$ detector plane 47 and the $y$ axis. 48 49 .. math:: 50 51 F(Q) 52 &= (\rho_\text{core}-\rho_\text{solvent}) 53 S(Q_A, A) S(Q_B, B) S(Q_C, C) \\ 54 &+ (\rho_\text{A}-\rho_\text{solvent}) 55 \left[S(Q_A, A+2t_A) - S(Q_A, Q)\right] S(Q_B, B) S(Q_C, C) \\ 56 &+ (\rho_\text{B}-\rho_\text{solvent}) 57 S(Q_A, A) \left[S(Q_B, B+2t_B) - S(Q_B, B)\right] S(Q_C, C) \\ 58 &+ (\rho_\text{C}-\rho_\text{solvent}) 59 S(Q_A, A) S(Q_B, B) \left[S(Q_C, C+2t_C) - S(Q_C, C)\right] 60 61 with 62 63 .. math:: 64 65 S(Q, L) = L \frac{\sin \tfrac{1}{2} Q L}{\tfrac{1}{2} Q L} 66 67 and 68 69 .. math:: 70 71 Q_A &= \sin\alpha \sin\beta \\ 72 Q_B &= \sin\alpha \cos\beta \\ 73 Q_C &= \cos\alpha 74 75 76 where $\rho_\text{core}$, $\rho_\text{A}$, $\rho_\text{B}$ and $\rho_\text{C}$ 77 are the scattering length of the parallelepiped core, and the rectangular 78 slabs of thickness $t_A$, $t_B$ and $t_C$, respectively. $\rho_\text{solvent}$ 79 is the scattering length of the solvent. 69 80 70 81 FITTING NOTES 82 ~~~~~~~~~~~~~ 83 71 84 If the scale is set equal to the particle volume fraction, $\phi$, the returned 72 value is the scattered intensity per unit volume, $I(q) = \phi P(q)$. 73 However, **no interparticle interference effects are included in this 74 calculation.** 85 value is the scattered intensity per unit volume, $I(q) = \phi P(q)$. However, 86 **no interparticle interference effects are included in this calculation.** 75 87 76 88 There are many parameters in this model. Hold as many fixed as possible with 77 89 known values, or you will certainly end up at a solution that is unphysical. 78 90 79 Constraints must be applied during fitting to ensure that the inequality80 $A < B < C$ is not violated. The calculation will not report an error,81 but the results will not be correct.82 83 91 The returned value is in units of |cm^-1|, on absolute scale. 84 92 85 93 NB: The 2nd virial coefficient of the core_shell_parallelepiped is calculated 86 94 based on the the averaged effective radius $(=\sqrt{(A+2t_A)(B+2t_B)/\pi})$ 87 and length $(C+2t_C)$ values, after appropriately 88 sorting the three dimensions to give an oblate or prolate particle, to give an 89 effective radius,for $S(Q)$ when $P(Q) * S(Q)$ is applied.95 and length $(C+2t_C)$ values, after appropriately sorting the three dimensions 96 to give an oblate or prolate particle, to give an effective radius, 97 for $S(Q)$ when $P(Q) * S(Q)$ is applied. 90 98 91 99 For 2d data the orientation of the particle is required, described using 92 angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below, for further details93 of the calculation and angular dispersions see :ref:`orientation`.100 angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below, for further 101 details of the calculation and angular dispersions see :ref:`orientation`. 94 102 The angle $\Psi$ is the rotational angle around the *long_c* axis. For example, 95 103 $\Psi = 0$ when the *short_b* axis is parallel to the *x*-axis of the detector. 104 105 For 2d, constraints must be applied during fitting to ensure that the 106 inequality $A < B < C$ is not violated, and hence the correct definition 107 of angles is preserved. The calculation will not report an error, 108 but the results may be not correct. 96 109 97 110 .. figure:: img/parallelepiped_angle_definition.png … … 114 127 Equations (1), (13-14). (in German) 115 128 .. [#] D Singh (2009). *Small angle scattering studies of self assembly in 116 lipid mixtures*, John 's Hopkins University Thesis (2009) 223-225. `Available129 lipid mixtures*, Johns Hopkins University Thesis (2009) 223-225. `Available 117 130 from Proquest <http://search.proquest.com/docview/304915826?accountid 118 131 =26379>`_ … … 175 188 Return equivalent radius (ER) 176 189 """ 177 178 # surface average radius (rough approximation) 179 surf_rad = sqrt((length_a + 2.0*thick_rim_a) * (length_b + 2.0*thick_rim_b) / pi) 180 181 height = length_c + 2.0*thick_rim_c 182 183 ddd = 0.75 * surf_rad * (2 * surf_rad * height + (height + surf_rad) * (height + pi * surf_rad)) 184 return 0.5 * (ddd) ** (1. / 3.) 190 from .parallelepiped import ER as ER_p 191 192 a = length_a + 2*thick_rim_a 193 b = length_b + 2*thick_rim_b 194 c = length_c + 2*thick_rim_c 195 return ER_p(a, b, c) 185 196 186 197 # VR defaults to 1.0 … … 216 227 psi_pd=10, psi_pd_n=1) 217 228 218 # rkh 7/4/17 add random unit test for 2d, note make all params different, 2d values not tested against other codes or models 229 # rkh 7/4/17 add random unit test for 2d, note make all params different, 230 # 2d values not tested against other codes or models 219 231 if 0: # pak: model rewrite; need to update tests 220 232 qx, qy = 0.2 * cos(pi/6.), 0.2 * sin(pi/6.)
Note: See TracChangeset
for help on using the changeset viewer.