source: sasmodels/sasmodels/models/capped_cylinder.py @ 19dcb933

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

build docs for models

  • Property mode set to 100644
File size: 5.4 KB
Line 
1r"""
2Calculates the scattering from a cylinder with spherical section end-caps.
3This model simply becomes the a convex lens when the length of the cylinder
4$L=0$, that is, a sphereocylinder with end caps that have a radius larger
5than that of the cylinder and the center of the end cap radius lies within
6the cylinder. See the diagram for the details of the geometry and
7restrictions on parameter values.
8
9Definitions
10-----------
11
12The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
13
14The capped cylinder geometry is defined as
15
16.. image:: img/capped_cylinder_geometry.jpg
17
18where $r$ is the radius of the cylinder. All other parameters are as defined
19in the diagram. Since the end cap radius $R \ge r$ and by definition for this
20geometry $h < 0$, $h$ is then defined by $r$ and $R$ as
21
22.. math::
23
24    h = - \sqrt{R^2 - r^2}
25
26The scattered intensity $I(Q)$ is calculated as
27
28.. math::
29
30    I(Q) = \frac{(\Delta \rho)^2}{V} \left< A^2(Q)\right>
31
32where the amplitude $A(Q)$ is given as
33
34.. math::
35
36    A(Q) =&\ \pi r^2L
37        {\sin\left(\tfrac12 QL\cos\theta\right)
38            \over \tfrac12 QL\cos\theta}
39        {2 J_1(Qr\sin\theta) \over Qr\sin\theta} \\
40        &\ + 4 \pi R^3 \int_{-h/R}^1 dt
41        \cos\left[ Q\cos\theta
42            \left(Rt + h + {\tfrac12} L\right)\right]
43        \times (1-t^2)
44        {J_1\left[QR\sin\theta \left(1-t^2\right)^{1/2}\right]
45             \over QR\sin\theta \left(1-t^2\right)^{1/2}}
46
47The $\left< \ldots \right>$ brackets denote an average of the structure over
48all orientations. $\left< A^2(Q)\right>$ is then the form factor, $P(Q)$.
49The scale factor is equivalent to the volume fraction of cylinders, each of
50volume, $V$. Contrast is the difference of scattering length densities of
51the cylinder and the surrounding solvent.
52
53The volume of the capped cylinder is (with $h$ as a positive value here)
54
55.. math::
56
57    V = \pi r_c^2 L + \tfrac{2\pi}{3}(R-h)^2(2R + h)
58
59
60and its radius-of-gyration is
61
62.. math::
63
64    R_g^2 =&\ \left[ \tfrac{12}{5}R^5
65        + R^4\left(6h+\tfrac32 L\right)
66        + R^2\left(4h^2 + L^2 + 4Lh\right)
67        + R^2\left(3Lh^2 + \tfrac32 L^2h\right) \right. \\
68        &\ \left. + \tfrac25 h^5 - \tfrac12 Lh^4 - \tfrac12 L^2h^3
69        + \tfrac14 L^3r^2 + \tfrac32 Lr^4 \right]
70        \left( 4R^3 6R^2h - 2h^3 + 3r^2L \right)^{-1}
71
72
73.. note::
74
75    The requirement that $R \ge r$ is not enforced in the model!
76    It is up to you to restrict this during analysis.
77
78:num:`Figure #capped-cylinder-1d` shows the output produced by
79a running the 1D capped cylinder model, using *qmin* = 0.001 |Ang^-1|,
80*qmax* = 0.7 |Ang^-1| and  the default values of the parameters.
81
82.. _capped-cylinder-1d:
83
84.. figure:: img/capped_cylinder_1d.jpg
85
86    1D plot using the default values (w/256 data point).
87
88The 2D scattering intensity is calculated similar to the 2D cylinder model.
89:num:`Figure #capped-cylinder-2d` shows the output for $\theta=45^\circ$
90and $\phi=0^\circ$ with default values for the other parameters.
91
92.. _capped-cylinder-2d:
93
94.. figure:: img/capped_cylinder_2d.jpg
95
96    2D plot (w/(256X265) data points).
97
98.. figure:: img/orientation.jpg
99
100    Definition of the angles for oriented 2D cylinders.
101
102.. figure:: img/orientation2.jpg
103
104    Examples of the angles for oriented pp against the detector plane.
105
106REFERENCE
107
108H Kaya, *J. Appl. Cryst.*, 37 (2004) 223-230
109
110H Kaya and N-R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata)
111"""
112from numpy import inf
113
114name = "capped_cylinder"
115title = "Right circular cylinder with spherical end caps and uniform SLD"
116description = """That is, a sphereocylinder
117        with end caps that have a radius larger than
118        that of the cylinder and the center of the
119        end cap radius lies within the cylinder.
120        Note: As the length of cylinder -->0,
121        it becomes a ConvexLens.
122        It must be that radius <(=) cap_radius.
123        [Parameters];
124        scale: volume fraction of spheres,
125        background:incoherent background,
126        radius: radius of the cylinder,
127        length: length of the cylinder,
128        cap_radius: radius of the semi-spherical cap,
129        sld: SLD of the capped cylinder,
130        solvent_sld: SLD of the solvent.
131"""
132
133parameters = [
134    #   [ "name", "units", default, [lower, upper], "type",
135    #     "description" ],
136    [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "",
137      "Cylinder 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 radius" ],
142    # TODO: use an expression for cap radius with fixed bounds.
143    # The current form requires cap radius R bigger than cylinder radius r.
144    # Could instead use R/r in [1,inf], r/R in [0,1], or the angle between
145    # cylinder and cap in [0,90].  The problem is similar for the barbell
146    # model.  Propose r/R in [0,1] in both cases, with the model specifying
147    # cylinder radius in the capped cylinder model and sphere radius in the
148    # barbell model.  This leads to the natural value of zero for no cap
149    # in the capped cylinder, and zero for no bar in the barbell model.  In
150    # both models, one would be a pill.
151    [ "cap_radius", "Ang", 20, [0, inf], "volume",
152      "Cap radius" ],
153    [ "length", "Ang",  400, [0, inf], "volume",
154      "Cylinder length" ],
155    [ "theta", "degrees", 60, [-inf, inf], "orientation",
156      "In plane angle" ],
157    [ "phi", "degrees", 60, [-inf, inf], "orientation",
158      "Out of plane angle" ],
159    ]
160
161source = [ "lib/J1.c", "lib/gauss76.c", "capped_cylinder.c" ]
162
163
164
Note: See TracBrowser for help on using the repository browser.