source: sasmodels/sasmodels/models/core_shell_bicelle.py @ 64eecf7

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 64eecf7 was 64eecf7, checked in by Paul Kienzle <pkienzle@…>, 7 years ago

Merge branch 'master' into ticket-510

  • Property mode set to 100644
File size: 6.8 KB
Line 
1r"""
2Definition
3----------
4
5This model provides the form factor for a circular cylinder with a
6core-shell scattering length density profile. Thus this is a variation
7of a core-shell cylinder or disc where the shell on the walls and ends
8may be of different thicknesses and scattering length densities. The form
9factor is normalized by the 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 cylindrical symmetry 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 cylinder axis is:
26
27..
28
29  .. math::
30
31    \rho(r) =
32      \begin{cases}
33      &\rho_c \text{ for } 0 \lt r \lt R; -L \lt z\lt L \\[1.5ex]
34      &\rho_f \text{ for } 0 \lt r \lt R; -(L+2t) \lt z\lt -L;
35      L \lt z\lt (L+2t) \\[1.5ex]
36      &\rho_r\text{ for } 0 \lt r \lt R; -(L+2t) \lt z\lt -L; L \lt z\lt (L+2t)
37      \end{cases}
38
39The form factor for the bicelle is calculated in cylindrical coordinates, where
40$\alpha$ is the angle between the $Q$ vector and the cylinder axis, to give:
41
42.. math::
43
44    I(Q,\alpha) = \frac{\text{scale}}{V_t} \cdot
45        F(Q,\alpha)^2 \cdot sin(\alpha) + \text{background}
46
47where
48
49.. math::
50    :nowrap:
51
52    \begin{align}
53    F(Q,\alpha) = &\bigg[
54    (\rho_c - \rho_f) V_c \frac{2J_1(QRsin \alpha)}{QRsin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\
55    &+(\rho_f - \rho_r) V_{c+f} \frac{2J_1(QRsin\alpha)}{QRsin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\
56    &+(\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}
57    \bigg]
58    \end{align}
59
60where $V_t$ is the total volume of the bicelle, $V_c$ the volume of the core,
61$V_{c+f}$ the volume of the core plus the volume of the faces, $R$ is the radius
62of the core, $L$ the length of the core, $t_f$ the thickness of the face, $t_r$
63the thickness of the rim and $J_1$ the usual first order bessel function.
64
65The output of the 1D scattering intensity function for randomly oriented
66cylinders is then given by integrating over all possible $\theta$ and $\phi$.
67
68For oriented bicelles the *theta*, and *phi* orientation parameters will appear when fitting 2D data,
69see the :ref:`cylinder` model for further information.
70Our implementation of the scattering kernel and the 1D scattering intensity
71use the c-library from NIST.
72
73.. figure:: img/cylinder_angle_definition.png
74
75    Definition of the angles for the oriented core shell bicelle model,
76    note that the cylinder axis of the bicelle starts along the beam direction
77    when $\theta  = \phi = 0$.
78
79
80References
81----------
82
83.. [#] D Singh (2009). *Small angle scattering studies of self assembly in
84   lipid mixtures*, John's Hopkins University Thesis (2009) 223-225. `Available
85   from Proquest <http://search.proquest.com/docview/304915826?accountid
86   =26379>`_
87
88Authorship and Verification
89----------------------------
90
91* **Author:** NIST IGOR/DANSE **Date:** pre 2010
92* **Last Modified by:** Paul Butler **Date:** September 30, 2016
93* **Last Reviewed by:** Richard Heenan **Date:** January 4, 2017
94"""
95
96from numpy import inf, sin, cos, pi
97
98name = "core_shell_bicelle"
99title = "Circular cylinder with a core-shell scattering length density profile.."
100description = """
101    P(q,alpha)= (scale/Vs)*f(q)^(2) + bkg,  where:
102    f(q)= Vt(sld_rim - sld_solvent)* sin[qLt.cos(alpha)/2]
103    /[qLt.cos(alpha)/2]*J1(qRout.sin(alpha))
104    /[qRout.sin(alpha)]+
105    (sld_core-sld_face)*Vc*sin[qLcos(alpha)/2][[qL
106    *cos(alpha)/2]*J1(qRc.sin(alpha))
107    /qRc.sin(alpha)]+
108    (sld_face-sld_rim)*(Vc+Vf)*sin[q(L+2.thick_face).
109    cos(alpha)/2][[q(L+2.thick_face)*cos(alpha)/2]*
110    J1(qRc.sin(alpha))/qRc.sin(alpha)]
111
112    alpha:is the angle between the axis of
113    the cylinder and the q-vector
114    Vt = pi.(Rc + thick_rim)^2.Lt : total volume
115    Vc = pi.Rc^2.L :the volume of the core
116    Vf = 2.pi.Rc^2.thick_face
117    Rc = radius: is the core radius
118    L: the length of the core
119    Lt = L + 2.thick_face: total length
120    Rout = radius + thick_rim
121    sld_core, sld_rim, sld_face:scattering length
122    densities within the particle
123    sld_solvent: the scattering length density
124    of the solvent
125    bkg: the background
126    J1: the first order Bessel function
127    theta: axis_theta of the cylinder
128    phi: the axis_phi of the cylinder...
129        """
130category = "shape:cylinder"
131
132# pylint: disable=bad-whitespace, line-too-long
133#             ["name", "units", default, [lower, upper], "type", "description"],
134parameters = [
135    ["radius",         "Ang",       80, [0, inf],    "volume",      "Cylinder core radius"],
136    ["thick_rim",  "Ang",       10, [0, inf],    "volume",      "Rim shell thickness"],
137    ["thick_face", "Ang",       10, [0, inf],    "volume",      "Cylinder face thickness"],
138    ["length",         "Ang",      50, [0, inf],    "volume",      "Cylinder length"],
139    ["sld_core",       "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder core scattering length density"],
140    ["sld_face",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder face scattering length density"],
141    ["sld_rim",        "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder rim scattering length density"],
142    ["sld_solvent",    "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Solvent scattering length density"],
143    ["theta",          "degrees",   90, [-360, 360], "orientation", "cylinder axis to beam angle"],
144    ["phi",            "degrees",    0, [-360, 360], "orientation", "rotation about beam"]
145    ]
146
147# pylint: enable=bad-whitespace, line-too-long
148
149source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c",
150          "core_shell_bicelle.c"]
151
152def random():
153    import numpy as np
154    pars = dict(
155        radius=10**np.random.uniform(1.3, 3),
156        length=10**np.random.uniform(1.3, 4),
157        thick_rim=10**np.random.uniform(0, 1.7),
158        thick_face=10**np.random.uniform(0, 1.7),
159    )
160    return pars
161
162demo = dict(scale=1, background=0,
163            radius=20.0,
164            thick_rim=10.0,
165            thick_face=10.0,
166            length=400.0,
167            sld_core=1.0,
168            sld_face=4.0,
169            sld_rim=4.0,
170            sld_solvent=1.0,
171            theta=90,
172            phi=0)
173q = 0.1
174# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct!
175qx = q*cos(pi/6.0)
176qy = q*sin(pi/6.0)
177tests = [[{}, 0.05, 7.4883545957],
178        [{'theta':80., 'phi':10.}, (qx, qy), 2.81048892474 ]
179        ]
180del qx, qy  # not necessary to delete, but cleaner
181
Note: See TracBrowser for help on using the repository browser.