source: sasmodels/sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py @ 99658f6

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 99658f6 was 99658f6, checked in by grethevj, 8 months ago

updated ER functions including cylinder excluded volume, to match 4.x

  • Property mode set to 100644
File size: 8.5 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.
8In this version the "rim" or "belt" does NOT extend the full length of
9the particle, but has the same length as the core. Outer shells on the
10rims and flat ends may be of different thicknesses and scattering length
11densities. The form factor is normalized by the total particle volume.
12This version includes an approximate "interfacial roughness".
13
14
15.. figure:: img/core_shell_bicelle_belt_geometry.png
16
17    Schematic cross-section of bicelle with belt. Note however that the model
18    here calculates for rectangular, not curved, rims as shown below.
19
20.. figure:: img/core_shell_bicelle_belt_parameters.png
21
22   Cross section of model used here. Users will have
23   to decide how to distribute "heads" and "tails" between the rim, face
24   and core regions in order to estimate appropriate starting parameters.
25
26Given the scattering length densities (sld) $\rho_c$, the core sld, $\rho_f$,
27the face sld, $\rho_r$, the rim sld and $\rho_s$ the solvent sld, the
28scattering length density variation along the bicelle axis is:
29
30.. math::
31
32    \rho(r) =
33      \begin{cases}
34      &\rho_c \text{ for } 0 \lt r \lt R;   -L/2 \lt z\lt L/2 \\[1.5ex]
35      &\rho_f \text{ for } 0 \lt r \lt R;   -(L/2 +t_\text{face}) \lt z\lt -L/2;
36      L/2 \lt z\lt (L/2+t_\text{face}) \\[1.5ex]
37      &\rho_r\text{ for } R \lt r \lt R+t_\text{rim}; -L/2 \lt z\lt L/2
38      \end{cases}
39
40The form factor for the bicelle is calculated in cylindrical coordinates, where
41$\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$
42is the angle for the ellipsoidal cross section core, to give:
43
44.. math::
45
46    I(Q,\alpha,\psi) = \frac{\text{scale}}{V_t}
47        \cdot F(Q,\alpha, \psi)^2 \cdot \sin(\alpha)
48        \cdot\exp\left\{ -\frac{1}{2}Q^2\sigma^2 \right\} + \text{background}
49
50where a numerical integration of $F(Q,\alpha, \psi)^2\sin(\alpha)$ is
51carried out over $\alpha$ and $\psi$ for:
52
53.. math::
54
55    F(Q,\alpha,\psi) = &\bigg[
56      (\rho_c -\rho_r - \rho_f + \rho_s) V_c
57      \frac{2J_1(QR'\sin \alpha)}{QR'\sin\alpha}
58      \frac{\sin(QL\cos\alpha/2)}{Q(L/2)\cos\alpha} \\
59    &+(\rho_f - \rho_s) V_{c+f}
60      \frac{2J_1(QR'\sin\alpha)}{QR'\sin\alpha}
61      \frac{\sin(Q(L/2+t_f)\cos\alpha)}{Q(L/2+t_f)\cos\alpha} \\
62    &+(\rho_r - \rho_s) V_{c+r}
63      \frac{2J_1(Q(R'+t_r)\sin\alpha)}{Q(R'+t_r)\sin\alpha}
64      \frac{\sin(Q(L/2)\cos\alpha)}{Q(L/2)\cos\alpha}
65    \bigg]
66
67where
68
69.. math::
70
71    R' = \frac{R}{\sqrt{2}}
72        \sqrt{(1+X_\text{core}^{2}) + (1-X_\text{core}^{2})\cos(\psi)}
73
74
75and $V_t = \pi (R+t_r)(X_\text{core} R+t_r) L + 2 \pi X_\text{core} R^2 t_f$ is
76the total volume of the bicelle, $V_c = \pi X_\text{core} R^2 L$ the volume of
77the core, $V_{c+f} = \pi X_\text{core} R^2 (L+2 t_f)$ the volume of the core
78plus the volume of the faces, $V_{c+r} = \pi (R+t_r)(X_\text{core} R+t_r) L$
79the volume of the core plus the rim, $R$ is the radius of the core,
80$X_\text{core}$ is the axial ratio of the core, $L$ the length of the core,
81$t_f$ the thickness of the face, $t_r$ the thickness of the rim and $J_1$ the
82usual first order bessel function. The core has radii $R$ and $X_\text{core} R$
83so is circular, as for the core_shell_bicelle model, for $X_\text{core}=1$.
84Note that you may need to limit the range of $X_\text{core}$, especially if
85using the Monte-Carlo algorithm, as setting radius to $R/X_\text{core}$ and
86axial ratio to $1/X_\text{core}$ gives an equivalent solution!
87
88An approximation for the effects of "Gaussian interfacial roughness" $\sigma$
89is included, by multiplying $I(Q)$ by
90$\exp\left \{ -\frac{1}{2}Q^2\sigma^2 \right \}$. This applies, in some way, to
91all interfaces in the model not just the external ones. (Note that for a one
92dimensional system convolution of the scattering length density profile with
93a Gaussian of standard deviation $\sigma$ does exactly this multiplication.)
94Leave $\sigma$ set to zero for the usual sharp interfaces.
95
96The output of the 1D scattering intensity function for randomly oriented
97bicelles is then given by integrating over all possible $\alpha$ and $\psi$.
98
99For oriented bicelles the *theta*, *phi* and *psi* orientation parameters
100will appear when fitting 2D data, for further details of the calculation
101and angular dispersions  see :ref:`orientation` .
102
103.. figure:: img/elliptical_cylinder_angle_definition.png
104
105    Definition of the angles for the oriented core_shell_bicelle_elliptical
106    particles.
107
108
109
110References
111----------
112
113.. [#]
114L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949).
115
116Authorship and Verification
117----------------------------
118
119* **Author:** Richard Heenan **Date:** October 5, 2017
120* **Last Modified by:**  Richard Heenan new 2d orientation **Date:** October 5, 2017
121* **Last Reviewed by:**  Richard Heenan 2d calc seems agree with 1d **Date:** Nov 2, 2017
122"""
123
124from numpy import inf, sin, cos, pi
125
126name = "core_shell_bicelle_elliptical_belt_rough"
127title = "Elliptical cylinder with a core-shell scattering length density profile.."
128description = """
129    core_shell_bicelle_elliptical_belt_rough
130    Elliptical cylinder core, optional shell on the two flat faces, and "belt" shell of
131    uniform thickness on its rim (in this case NOT extending around the end faces).
132    with approximate interfacial roughness.
133    Please see full documentation for equations and further details.
134    Involves a double numerical integral around the ellipsoid diameter
135    and the angle of the cylinder axis to Q.
136    Compare also the core_shell_bicelle and elliptical_cylinder models.
137      """
138category = "shape:cylinder"
139
140# pylint: disable=bad-whitespace, line-too-long
141#             ["name", "units", default, [lower, upper], "type", "description"],
142parameters = [
143    ["radius",         "Ang",       30, [0, inf],    "volume",      "Cylinder core radius r_minor"],
144    ["x_core",        "None",       3,  [0, inf],    "volume",      "Axial ratio of core, X = r_major/r_minor"],
145    ["thick_rim",  "Ang",            8, [0, inf],    "volume",      "Rim or belt shell thickness"],
146    ["thick_face", "Ang",           14, [0, inf],    "volume",      "Cylinder face thickness"],
147    ["length",         "Ang",       50, [0, inf],    "volume",      "Cylinder length"],
148    ["sld_core",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder core scattering length density"],
149    ["sld_face",       "1e-6/Ang^2", 7, [-inf, inf], "sld",         "Cylinder face scattering length density"],
150    ["sld_rim",        "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder rim scattering length density"],
151    ["sld_solvent",    "1e-6/Ang^2", 6, [-inf, inf], "sld",         "Solvent scattering length density"],
152    ["sigma",       "Ang",        0,    [0, inf],    "",            "Interfacial roughness"],
153    ["theta",       "degrees",    90.0, [-360, 360], "orientation", "Cylinder axis to beam angle"],
154    ["phi",         "degrees",    0,    [-360, 360], "orientation", "Rotation about beam"],
155    ["psi",         "degrees",    0,    [-360, 360], "orientation", "Rotation about cylinder axis"],
156    ]
157
158# pylint: enable=bad-whitespace, line-too-long
159
160source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c",
161          "core_shell_bicelle_elliptical_belt_rough.c"]
162have_Fq = True
163effective_radius_type = [
164    "equivalent cylinder excluded volume", "equivalent volume sphere", "outer rim average radius", "outer rim min radius",
165    "outer max radius", "half outer thickness", "half diagonal",
166    ]
167
168demo = dict(scale=1, background=0,
169            radius=30.0,
170            x_core=3.0,
171            thick_rim=8.0,
172            thick_face=14.0,
173            length=50.0,
174            sld_core=4.0,
175            sld_face=7.0,
176            sld_rim=1.0,
177            sld_solvent=6.0,
178            theta=90,
179            phi=0,
180            psi=0,
181            sigma=0)
182
183q = 0.1
184# april 6 2017, rkh added a 2d unit test, NOT READY YET pull #890 branch assume correct!
185qx = q*cos(pi/6.0)
186qy = q*sin(pi/6.0)
187
188tests = [
189    #[{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'ER', 1],
190    #[{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'VR', 1],
191
192    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0,
193      'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0},
194     0.015, 189.328],
195    #[{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ],
196]
197
198del qx, qy  # not necessary to delete, but cleaner
Note: See TracBrowser for help on using the repository browser.