Changeset 2d81cfe in sasmodels for sasmodels/models/core_shell_bicelle_elliptical.py
- Timestamp:
- Nov 29, 2017 11:13:23 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:
- 237b800f
- Parents:
- a839b22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_bicelle_elliptical.py
r30b60d2 r2d81cfe 7 7 of the core-shell bicelle model, but with an elliptical cylinder for the core. 8 8 Outer shells on the rims and flat ends may be of different thicknesses and 9 scattering length densities. The form factor is normalized by the total particle volume. 9 scattering length densities. The form factor is normalized by the total 10 particle volume. 10 11 11 12 … … 36 37 37 38 The form factor for the bicelle is calculated in cylindrical coordinates, where 38 $\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ is the angle39 for the ellipsoidal cross section core, to give:39 $\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ 40 is the angle for the ellipsoidal cross section core, to give: 40 41 41 42 .. math:: … … 44 45 F(Q,\alpha, \psi)^2 \cdot sin(\alpha) + \text{background} 45 46 46 where a numerical integration of $F(Q,\alpha, \psi)^2 \cdot sin(\alpha)$ is carried out over \alpha and \psi for: 47 where a numerical integration of $F(Q,\alpha, \psi)^2 \cdot sin(\alpha)$ 48 is carried out over \alpha and \psi for: 47 49 48 50 .. math:: … … 51 53 \begin{align*} 52 54 F(Q,\alpha,\psi) = &\bigg[ 53 (\rho_c - \rho_f) V_c \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 54 &+(\rho_f - \rho_r) V_{c+f} \frac{2J_1(QR'sin\alpha)}{QR'sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\ 55 &+(\rho_r - \rho_s) V_t \frac{2J_1(Q(R'+t_r)sin\alpha)}{Q(R'+t_r)sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 55 (\rho_c - \rho_f) V_c 56 \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha} 57 \frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 58 &+(\rho_f - \rho_r) V_{c+f} 59 \frac{2J_1(QR'sin\alpha)}{QR'sin\alpha} 60 \frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\ 61 &+(\rho_r - \rho_s) V_t 62 \frac{2J_1(Q(R'+t_r)sin\alpha)}{Q(R'+t_r)sin\alpha} 63 \frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 56 64 \bigg] 57 65 \end{align*} … … 64 72 65 73 66 and $V_t = \pi.(R+t_r)(Xcore.R+t_r)^2.(L+2.t_f)$ is the total volume of the bicelle, 67 $V_c = \pi.Xcore.R^2.L$ the volume of the core, $V_{c+f} = \pi.Xcore.R^2.(L+2.t_f)$ 68 the volume of the core plus the volume of the faces, $R$ is the radius 69 of the core, $Xcore$ is the axial ratio of the core, $L$ the length of the core, 70 $t_f$ the thickness of the face, $t_r$ the thickness of the rim and $J_1$ the usual 71 first order bessel function. The core has radii $R$ and $Xcore.R$ so is circular, 72 as for the core_shell_bicelle model, for $Xcore$ =1. Note that you may need to 73 limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, as 74 setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an equivalent solution! 74 and $V_t = \pi.(R+t_r)(Xcore.R+t_r)^2.(L+2.t_f)$ is the total volume of 75 the bicelle, $V_c = \pi.Xcore.R^2.L$ the volume of the core, 76 $V_{c+f} = \pi.Xcore.R^2.(L+2.t_f)$ the volume of the core plus the volume 77 of the faces, $R$ is the radius of the core, $Xcore$ is the axial ratio of 78 the core, $L$ the length of the core, $t_f$ the thickness of the face, $t_r$ 79 the thickness of the rim and $J_1$ the usual first order bessel function. 80 The core has radii $R$ and $Xcore.R$ so is circular, as for the 81 core_shell_bicelle model, for $Xcore$ =1. Note that you may need to 82 limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, 83 as setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an 84 equivalent solution! 75 85 76 86 The output of the 1D scattering intensity function for randomly oriented 77 87 bicelles is then given by integrating over all possible $\alpha$ and $\psi$. 78 88 79 For oriented bicelles the *theta*, *phi* and *psi* orientation parameters will appear when fitting 2D data, 80 see the :ref:`elliptical-cylinder` model for further information. 89 For oriented bicelles the *theta*, *phi* and *psi* orientation parameters will 90 appear when fitting 2D data, see the :ref:`elliptical-cylinder` model 91 for further information. 81 92 82 93 … … 100 111 """ 101 112 113 import numpy as np 102 114 from numpy import inf, sin, cos, pi 103 115 … … 138 150 139 151 def random(): 140 import numpy as np141 152 outer_major = 10**np.random.uniform(1, 4.7) 142 153 outer_minor = 10**np.random.uniform(1, 4.7) … … 170 181 171 182 tests = [ 172 [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'ER', 1], 173 [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'VR', 1], 183 [{'radius': 30.0, 'x_core': 3.0, 184 'thick_rim': 8.0, 'thick_face': 14.0, 'length': 50.0}, 'ER', 1], 185 [{'radius': 30.0, 'x_core': 3.0, 186 'thick_rim': 8.0, 'thick_face': 14.0, 'length': 50.0}, 'VR', 1], 174 187 175 [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0, 176 'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0}, 177 0.015, 286.540286], 178 # [{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ], 179 ] 188 [{'radius': 30.0, 'x_core': 3.0, 189 'thick_rim': 8.0, 'thick_face': 14.0, 'length': 50.0, 190 'sld_core': 4.0, 'sld_face': 7.0, 'sld_rim': 1.0, 191 'sld_solvent': 6.0, 'background': 0.0}, 192 0.015, 286.540286], 193 #[{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001], 194 ] 180 195 181 196 del qx, qy # not necessary to delete, but cleaner
Note: See TracChangeset
for help on using the changeset viewer.