source: sasmodels/sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py @ 0507e09

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 0507e09 was 0507e09, checked in by smk78, 5 years ago

Added link to source code to each model. Closes #883

  • Property mode set to 100644
File size: 8.9 KB
RevLine 
[129bdc4]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.
[110f69c]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.
[129bdc4]12This version includes an approximate "interfacial roughness".
13
14
15.. figure:: img/core_shell_bicelle_belt_geometry.png
16
[110f69c]17    Schematic cross-section of bicelle with belt. Note however that the model
18    here calculates for rectangular, not curved, rims as shown below.
[129bdc4]19
20.. figure:: img/core_shell_bicelle_belt_parameters.png
21
[110f69c]22   Cross section of model used here. Users will have
23   to decide how to distribute "heads" and "tails" between the rim, face
[129bdc4]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
[110f69c]32    \rho(r) =
33      \begin{cases}
[129bdc4]34      &\rho_c \text{ for } 0 \lt r \lt R;   -L/2 \lt z\lt L/2 \\[1.5ex]
[110f69c]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
[129bdc4]38      \end{cases}
39
40The form factor for the bicelle is calculated in cylindrical coordinates, where
[110f69c]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:
[129bdc4]43
44.. math::
45
[110f69c]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}
[129bdc4]49
[110f69c]50where a numerical integration of $F(Q,\alpha, \psi)^2\sin(\alpha)$ is
51carried out over $\alpha$ and $\psi$ for:
[129bdc4]52
53.. math::
54
[110f69c]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}
[129bdc4]65    \bigg]
66
67where
68
69.. math::
70
[110f69c]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.
[129bdc4]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
[110f69c]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` .
[129bdc4]102
103.. figure:: img/elliptical_cylinder_angle_definition.png
104
[110f69c]105    Definition of the angles for the oriented core_shell_bicelle_elliptical
106    particles.
[129bdc4]107
108
109
110References
111----------
112
[0507e09]113.. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659
114
115Source
116------
117
118`core_shell_bicelle_elliptical_belt_rough.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py>`_
119
120`core_shell_bicelle_elliptical_belt_rough.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c>`_
[129bdc4]121
122Authorship and Verification
123----------------------------
124
125* **Author:** Richard Heenan **Date:** October 5, 2017
126* **Last Modified by:**  Richard Heenan new 2d orientation **Date:** October 5, 2017
127* **Last Reviewed by:**  Richard Heenan 2d calc seems agree with 1d **Date:** Nov 2, 2017
[0507e09]128* **Source added by :**  Steve King **Date:** March 25, 2019
[129bdc4]129"""
130
131from numpy import inf, sin, cos, pi
132
133name = "core_shell_bicelle_elliptical_belt_rough"
134title = "Elliptical cylinder with a core-shell scattering length density profile.."
135description = """
136    core_shell_bicelle_elliptical_belt_rough
[110f69c]137    Elliptical cylinder core, optional shell on the two flat faces, and "belt" shell of
[129bdc4]138    uniform thickness on its rim (in this case NOT extending around the end faces).
139    with approximate interfacial roughness.
140    Please see full documentation for equations and further details.
141    Involves a double numerical integral around the ellipsoid diameter
142    and the angle of the cylinder axis to Q.
143    Compare also the core_shell_bicelle and elliptical_cylinder models.
144      """
145category = "shape:cylinder"
146
147# pylint: disable=bad-whitespace, line-too-long
148#             ["name", "units", default, [lower, upper], "type", "description"],
149parameters = [
[fc3ae1b]150    ["radius",         "Ang",       30, [0, inf],    "volume",      "Cylinder core radius r_minor"],
151    ["x_core",        "None",       3,  [0, inf],    "volume",      "Axial ratio of core, X = r_major/r_minor"],
[129bdc4]152    ["thick_rim",  "Ang",            8, [0, inf],    "volume",      "Rim or belt shell thickness"],
153    ["thick_face", "Ang",           14, [0, inf],    "volume",      "Cylinder face thickness"],
154    ["length",         "Ang",       50, [0, inf],    "volume",      "Cylinder length"],
155    ["sld_core",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder core scattering length density"],
156    ["sld_face",       "1e-6/Ang^2", 7, [-inf, inf], "sld",         "Cylinder face scattering length density"],
157    ["sld_rim",        "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder rim scattering length density"],
158    ["sld_solvent",    "1e-6/Ang^2", 6, [-inf, inf], "sld",         "Solvent scattering length density"],
[fc3ae1b]159    ["sigma",       "Ang",        0,    [0, inf],    "",            "Interfacial roughness"],
160    ["theta",       "degrees",    90.0, [-360, 360], "orientation", "Cylinder axis to beam angle"],
161    ["phi",         "degrees",    0,    [-360, 360], "orientation", "Rotation about beam"],
162    ["psi",         "degrees",    0,    [-360, 360], "orientation", "Rotation about cylinder axis"],
[129bdc4]163    ]
164
165# pylint: enable=bad-whitespace, line-too-long
166
167source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c",
168          "core_shell_bicelle_elliptical_belt_rough.c"]
[71b751d]169have_Fq = True
[ee60aa7]170effective_radius_type = [
[b297ba9]171    "equivalent cylinder excluded volume", "equivalent volume sphere",
172    "outer rim average radius", "outer rim min radius",
[ee60aa7]173    "outer max radius", "half outer thickness", "half diagonal",
174    ]
[129bdc4]175
[b297ba9]176# TODO: No random() for core-shell bicelle elliptical belt rough
177
[129bdc4]178demo = dict(scale=1, background=0,
179            radius=30.0,
180            x_core=3.0,
181            thick_rim=8.0,
182            thick_face=14.0,
183            length=50.0,
184            sld_core=4.0,
185            sld_face=7.0,
186            sld_rim=1.0,
187            sld_solvent=6.0,
188            theta=90,
189            phi=0,
190            psi=0,
191            sigma=0)
192
193q = 0.1
194# april 6 2017, rkh added a 2d unit test, NOT READY YET pull #890 branch assume correct!
195qx = q*cos(pi/6.0)
196qy = q*sin(pi/6.0)
197
198tests = [
[304c775]199    #[{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'ER', 1],
200    #[{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'VR', 1],
[129bdc4]201
[b297ba9]202    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim': 8.0, 'thick_face': 14.0,
203      'length': 50.0, 'sld_core': 4.0, 'sld_face': 7.0, 'sld_rim': 1.0,
204      'sld_solvent': 6.0, 'background': 0.0},
[110f69c]205     0.015, 189.328],
206    #[{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ],
207]
[129bdc4]208
209del qx, qy  # not necessary to delete, but cleaner
Note: See TracBrowser for help on using the repository browser.