source: sasmodels/sasmodels/models/core_shell_cylinder.py @ d1fe925

gh-pages
Last change on this file since d1fe925 was d1fe925, checked in by ajj, 8 years ago

Creating gh_pages branch for docs

  • Property mode set to 100644
File size: 6.8 KB
Line 
1# core shell cylinder model
2# Note: model title and parameter table are inserted automatically
3r"""
4The form factor is normalized by the particle volume.
5
6Definition
7----------
8
9The output of the 2D scattering intensity function for oriented core-shell
10cylinders is given by (Kline, 2006)
11
12.. math::
13
14    P(Q,\alpha) = {\text{scale} \over V_s} F^2(Q) + \text{background}
15
16where
17
18.. math::
19
20    F(Q) = &\ (\rho_c - \rho_s) V_c
21           {\sin \left( Q \tfrac12 L\cos\alpha \right)
22               \over Q \tfrac12 L\cos\alpha }
23           {2 J_1 \left( QR\sin\alpha \right)
24               \over QR\sin\alpha } \\
25         &\ + (\rho_s - \rho_\text{solv}) V_s
26           {\sin \left( Q \left(\tfrac12 L+T\right) \cos\alpha \right)
27               \over Q \left(\tfrac12 L +T \right) \cos\alpha }
28           { 2 J_1 \left( Q(R+T)\sin\alpha \right)
29               \over Q(R+T)\sin\alpha }
30
31and
32
33.. math::
34
35    V_s = \pi (R + T)^2 (L + 2T)
36
37and $\alpha$ is the angle between the axis of the cylinder and $\vec q$,
38$V_s$ is the volume of the outer shell (i.e. the total volume, including
39the shell), $V_c$ is the volume of the core, $L$ is the length of the core,
40$R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$
41is the scattering length density of the core, $\rho_s$ is the scattering
42length density of the shell, $\rho_\text{solv}$ is the scattering length
43density of the solvent, and *background* is the background level.  The outer
44radius of the shell is given by $R+T$ and the total length of the outer
45shell is given by $L+2T$. $J1$ is the first order Bessel function.
46
47.. _core-shell-cylinder-geometry:
48
49.. figure:: img/core_shell_cylinder_geometry.jpg
50
51    Core shell cylinder schematic.
52
53To provide easy access to the orientation of the core-shell cylinder, we
54define the axis of the cylinder using two angles $\theta$ and $\phi$. As
55for the case of the cylinder, those angles are defined in
56:num:`figure #cylinder-orientation`.
57
58NB: The 2nd virial coefficient of the cylinder is calculated based on
59the radius and 2 length values, and used as the effective radius for
60$S(Q)$ when $P(Q) \cdot S(Q)$ is applied.
61
62The $\theta$ and $\phi$ parameters are not used for the 1D output. Our
63implementation of the scattering kernel and the 1D scattering intensity
64use the c-library from NIST.
65
66Validation
67----------
68
69Validation of our code was done by comparing the output of the 1D model to
70the output of the software provided by the NIST (Kline, 2006).
71:num:`Figure #core-shell-cylinder-1d` shows a comparison
72of the 1D output of our model and the output of the NIST software.
73
74.. _core-shell-cylinder-1d:
75
76.. figure:: img/core_shell_cylinder_1d.jpg
77
78    Comparison of the SasView scattering intensity for a core-shell cylinder
79    with the output of the NIST SANS analysis software. The parameters were
80    set to: *scale* = 1.0 |Ang|, *radius* = 20 |Ang|, *thickness* = 10 |Ang|,
81    *length* =400 |Ang|, *core_sld* =1e-6 |Ang^-2|, *shell_sld* = 4e-6 |Ang^-2|,
82    *solvent_sld* = 1e-6 |Ang^-2|, and *background* = 0.01 |cm^-1|.
83
84Averaging over a distribution of orientation is done by evaluating the
85equation above. Since we have no other software to compare the
86implementation of the intensity for fully oriented cylinders, we can
87compare the result of averaging our 2D output using a uniform
88distribution $p(\theta,\phi) = 1.0$.
89:num:`Figure #core-shell-cylinder-2d` shows the result
90of such a cross-check.
91
92.. _core-shell-cylinder-2d:
93
94.. figure:: img/core_shell_cylinder_2d.jpg
95
96    Comparison of the intensity for uniformly distributed core-shell
97    cylinders calculated from our 2D model and the intensity from the
98    NIST SANS analysis software. The parameters used were: *scale* = 1.0,
99    *radius* = 20 |Ang|, *thickness* = 10 |Ang|, *length* = 400 |Ang|,
100    *core_sld* = 1e-6 |Ang^-2|, *shell_sld* = 4e-6 |Ang^-2|,
101    *solvent_sld* = 1e-6 |Ang^-2|, and *background* = 0.0 |cm^-1|.
102
1032013/11/26 - Description reviewed by Heenan, R.
104"""
105
106from numpy import pi, inf
107
108name = "core_shell_cylinder"
109title = "Right circular cylinder with a core-shell scattering length density profile."
110description = """
111P(q,alpha)= scale/Vs*f(q)^(2) + background,
112      where: f(q)= 2(core_sld - solvant_sld)
113        * Vc*sin[qLcos(alpha/2)]
114        /[qLcos(alpha/2)]*J1(qRsin(alpha))
115        /[qRsin(alpha)]+2(shell_sld-solvent_sld)
116        *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T)
117        *cos(alpha/2)]*J1(q(R+T)sin(alpha))
118        /q(R+T)sin(alpha)]
119
120    alpha:is the angle between the axis of
121        the cylinder and the q-vector
122    Vs: the volume of the outer shell
123    Vc: the volume of the core
124    L: the length of the core
125        shell_sld: the scattering length density of the shell
126    solvent_sld: the scattering length density of the solvent
127    background: the background
128    T: the thickness
129        R+T: is the outer radius
130     L+2T: The total length of the outershell
131    J1: the first order Bessel function
132     theta: axis_theta of the cylinder
133     phi: the axis_phi of the cylinder
134"""
135category = "shape:cylinder"
136
137#             ["name", "units", default, [lower, upper], "type", "description"],
138parameters = [["core_sld", "1e-6/Ang^2", 4, [-inf, inf], "",
139               "Cylinder core scattering length density"],
140              ["shell_sld", "1e-6/Ang^2", 4, [-inf, inf], "",
141               "Cylinder shell scattering length density"],
142              ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "",
143               "Solvent scattering length density"],
144              ["radius", "Ang", 20, [0, inf], "volume",
145               "Cylinder core radius"],
146              ["thickness", "Ang", 20, [0, inf], "volume",
147               "Cylinder shell thickness"],
148              ["length", "Ang", 400, [0, inf], "volume",
149               "Cylinder length"],
150              ["theta", "degrees", 60, [-inf, inf], "orientation",
151               "In plane angle"],
152              ["phi", "degrees", 60, [-inf, inf], "orientation",
153               "Out of plane angle"],
154             ]
155
156source = ["lib/J1.c", "lib/gauss76.c", "core_shell_cylinder.c"]
157
158def ER(radius, thickness, length):
159    radius = radius + thickness
160    length = length + 2 * thickness
161    ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius))
162    return 0.5 * (ddd) ** (1. / 3.)
163
164def VR(radius, thickness, length):
165    whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness)
166    core = pi * radius ** 2 * length
167    return whole, whole - core
168
169demo = dict(scale=1, background=0,
170            core_sld=6, shell_sld=8, solvent_sld=1,
171            radius=45, thickness=25, length=340,
172            theta=30, phi=15,
173            radius_pd=.2, radius_pd_n=1,
174            length_pd=.2, length_pd_n=10,
175            thickness_pd=.2, thickness_pd_n=10,
176            theta_pd=15, theta_pd_n=45,
177            phi_pd=15, phi_pd_n=1)
178oldname = 'CoreShellCylinderModel'
179oldpars = dict(theta='axis_theta', phi='axis_phi')
Note: See TracBrowser for help on using the repository browser.