source: sasmodels/sasmodels/models/core_shell_bicelle_elliptical.py @ a53bf6b

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since a53bf6b was a53bf6b, checked in by wojciech, 7 years ago

small latex fixes to core_shell_bicelle_elliptical

  • Property mode set to 100644
File size: 6.9 KB
Line 
1r"""
2Definition
3----------
4
5This model provides the form factor for an elliptical cylinder with a
6core-shell scattering length density profile. Thus this is a variation
7of the core-shell bicelle model, but with an elliptical cylinder for the core.
8Outer shells on the rims and flat ends may be of different thicknesses and
9scattering length densities. The form factor is normalized by the total particle volume.
10
11
12.. figure:: img/core_shell_bicelle_geometry.png
13
14    Schematic cross-section of bicelle. Note however that the model here
15    calculates for rectangular, not curved, rims as shown below.
16
17.. figure:: img/core_shell_bicelle_parameters.png
18
19   Cross section of model used here. Users will have
20   to decide how to distribute "heads" and "tails" between the rim, face
21   and core regions in order to estimate appropriate starting parameters.
22
23Given the scattering length densities (sld) $\rho_c$, the core sld, $\rho_f$,
24the face sld, $\rho_r$, the rim sld and $\rho_s$ the solvent sld, the
25scattering length density variation along the bicelle axis is:
26
27.. math::
28
29    \rho(r) =
30      \begin{cases}
31      &\rho_c \text{ for } 0 \lt r \lt R; -L \lt z\lt L \\[1.5ex]
32      &\rho_f \text{ for } 0 \lt r \lt R; -(L+2t) \lt z\lt -L;
33      L \lt z\lt (L+2t) \\[1.5ex]
34      &\rho_r\text{ for } 0 \lt r \lt R; -(L+2t) \lt z\lt -L; L \lt z\lt (L+2t)
35      \end{cases}
36
37The 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 angle
39for the ellipsoidal cross section core, to give:
40
41.. math::
42
43    I(Q,\alpha,\psi) = \frac{\text{scale}}{V_t} \cdot
44        F(Q,\alpha, \psi)^2 \cdot sin(\alpha) + \text{background}
45
46where a numerical integration of $F(Q,\alpha, \psi)^2 \cdot sin(\alpha)$ is carried out over \alpha and \psi for:
47
48.. math::
49    :nowrap:
50
51    \begin{align}
52    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}
56    \bigg]
57    \end{align}
58
59where
60
61.. math::
62
63    R'=\frac{R}{\sqrt{2}}\sqrt{(1+X_{core}^{2}) + (1-X_{core}^{2})cos(\psi)}
64   
65   
66and $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)$
68the volume of the core plus the volume of the faces, $R$ is the radius
69of 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
71first order bessel function. The core has radii $R$ and $Xcore.R$ so is circular,
72as for the core_shell_bicelle model, for $Xcore$ =1. Note that you may need to
73limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, as
74setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an equivalent solution!
75
76The output of the 1D scattering intensity function for randomly oriented
77bicelles is then given by integrating over all possible $\alpha$ and $\psi$.
78
79For oriented bicellles the *theta*, *phi* and *psi* orientation parameters only appear when fitting 2D data,
80see the :ref:`elliptical-cylinder` model for further information.
81
82
83.. figure:: img/elliptical_cylinder_angle_definition.jpg
84
85    Definition of the angles for the oriented core_shell_bicelle_elliptical model.
86    Note that *theta* and *phi* are currently defined differently to those for the core_shell_bicelle model.
87
88
89References
90----------
91
92.. [#]
93
94Authorship and Verification
95----------------------------
96
97* **Author:** Richard Heenan **Date:** December 14, 2016
98* **Last Modified by:**  Richard Heenan **Date:** December 14, 2016
99* **Last Reviewed by:**  Richard Heenan BEWARE 2d data yet to be checked **Date:** December 14, 2016
100"""
101
102from numpy import inf, sin, cos
103
104name = "core_shell_bicelle_elliptical"
105title = "Elliptical cylinder with a core-shell scattering length density profile.."
106description = """
107    core_shell_bicelle_elliptical
108    Elliptical cylinder core, optional shell on the two flat faces, and shell of
109    uniform thickness on its rim (extending around the end faces).   
110    Please see full documentation for equations and further details.
111    Involves a double numerical integral around the ellipsoid diameter
112    and the angle of the cylinder axis to Q.
113    Compare also the core_shell_bicelle and elliptical_cylinder models.
114      """
115category = "shape:cylinder"
116
117# pylint: disable=bad-whitespace, line-too-long
118#             ["name", "units", default, [lower, upper], "type", "description"],
119parameters = [
120    ["radius",         "Ang",       30, [0, inf],    "volume",      "Cylinder core radius"],
121    ["x_core",        "None",       3,  [0, inf],    "volume",      "axial ratio of core, X = r_polar/r_equatorial"],
122    ["thick_rim",  "Ang",        8, [0, inf],    "volume",      "Rim shell thickness"],
123    ["thick_face", "Ang",       14, [0, inf],    "volume",      "Cylinder face thickness"],
124    ["length",         "Ang",      50, [0, inf],    "volume",      "Cylinder length"],
125    ["sld_core",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder core scattering length density"],
126    ["sld_face",       "1e-6/Ang^2", 7, [-inf, inf], "sld",         "Cylinder face scattering length density"],
127    ["sld_rim",        "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder rim scattering length density"],
128    ["sld_solvent",    "1e-6/Ang^2", 6, [-inf, inf], "sld",         "Solvent scattering length density"],
129    ["theta",          "degrees",   90, [-360, 360], "orientation", "In plane angle"],
130    ["phi",            "degrees",    0, [-360, 360], "orientation", "Out of plane angle"],
131    ["psi",            "degrees",    0, [-360, 360], "orientation", "Major axis angle relative to Q"],
132    ]
133
134# pylint: enable=bad-whitespace, line-too-long
135
136source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c",
137          "core_shell_bicelle_elliptical.c"]
138
139demo = dict(scale=1, background=0,
140            radius=30.0,
141            x_core=3.0,
142            thick_rim=8.0,
143            thick_face=14.0,
144            length=50.0,
145            sld_core=4.0,
146            sld_face=7.0,
147            sld_rim=1.0,
148            sld_solvent=6.0,
149            theta=90,
150            phi=0,
151            psi=0)
152
153#qx, qy = 0.4 * cos(pi/2.0), 0.5 * sin(0)
154
155tests = [
156    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'ER', 1],
157    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'VR', 1],
158
159    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0,
160    'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0},
161    0.015, 286.540286],
162]
Note: See TracBrowser for help on using the repository browser.