source: sasmodels/sasmodels/models/core_shell_cylinder.py @ 5d4777d

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 5d4777d was 5d4777d, checked in by Paul Kienzle <pkienzle@…>, 10 years ago

reorganize, check and update models

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