# 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, 9 months ago

• Property mode set to 100644
File size: 8.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.
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.. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659
114
115Source
116------
117
118core_shell_bicelle_elliptical_belt_rough.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py>_
119
120core_shell_bicelle_elliptical_belt_rough.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c>_
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
128* **Source added by :**  Steve King **Date:** March 25, 2019
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
137    Elliptical cylinder core, optional shell on the two flat faces, and "belt" shell of
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
148#             ["name", "units", default, [lower, upper], "type", "description"],
149parameters = [
151    ["x_core",        "None",       3,  [0, inf],    "volume",      "Axial ratio of core, X = r_major/r_minor"],
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"],
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"],
163    ]
164
166
167source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c",
168          "core_shell_bicelle_elliptical_belt_rough.c"]
169have_Fq = True
171    "equivalent cylinder excluded volume", "equivalent volume sphere",
173    "outer max radius", "half outer thickness", "half diagonal",
174    ]
175
176# TODO: No random() for core-shell bicelle elliptical belt rough
177
178demo = dict(scale=1, background=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 = [
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],
201
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},
205     0.015, 189.328],
206    #[{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ],
207]
208
209del qx, qy  # not necessary to delete, but cleaner
Note: See TracBrowser for help on using the repository browser.