source: sasmodels/sasmodels/models/barbell.py @ 2222134

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 2222134 was 2222134, checked in by butler, 7 years ago

Updating parameter names regarding #649

  • Property mode set to 100644
File size: 4.6 KB
Line 
1#barbell model
2# Note: model title and parameter table are inserted automatically
3r"""
4Calculates the scattering from a barbell-shaped cylinder.  Like
5:ref:`capped-cylinder`, this is a sphereocylinder with spherical end
6caps that have a radius larger than that of the cylinder, but with the center
7of the end cap radius lying outside of the cylinder. See the diagram for
8the details of the geometry and restrictions on parameter values.
9
10Definition
11----------
12
13.. figure:: img/barbell_geometry.jpg
14
15    Barbell geometry, where $r$ is *radius*, $R$ is *radius_bell* and
16    $L$ is *length*. Since the end cap radius $R \geq r$ and by definition
17    for this geometry $h < 0$, $h$ is then defined by $r$ and $R$ as
18    $h = - \sqrt{R^2 - r^2}$
19
20The scattered intensity $I(q)$ is calculated as
21
22.. math::
23
24    I(q) = \frac{\Delta \rho^2}{V} \left<A^2(q)\right>
25
26where the amplitude $A(q)$ is given as
27
28.. math::
29
30    A(q) =&\ \pi r^2L
31        \frac{\sin\left(\tfrac12 qL\cos\theta\right)}
32             {\tfrac12 qL\cos\theta}
33        \frac{2 J_1(qr\sin\theta)}{qr\sin\theta} \\
34        &\ + 4 \pi R^3 \int_{-h/R}^1 dt
35        \cos\left[ q\cos\theta
36            \left(Rt + h + {\tfrac12} L\right)\right]
37        \times (1-t^2)
38        \frac{J_1\left[qR\sin\theta \left(1-t^2\right)^{1/2}\right]}
39             {qR\sin\theta \left(1-t^2\right)^{1/2}}
40
41The $\left<\ldots\right>$ brackets denote an average of the structure over
42all orientations. $\left<A^2(q)\right>$ is then the form factor, $P(q)$.
43The scale factor is equivalent to the volume fraction of cylinders, each of
44volume, $V$. Contrast $\Delta\rho$ is the difference of scattering length
45densities of the cylinder and the surrounding solvent.
46
47The volume of the barbell is
48
49.. math::
50
51    V = \pi r_c^2 L + 2\pi\left(\tfrac23R^3 + R^2h-\tfrac13h^3\right)
52
53
54and its radius of gyration is
55
56.. math::
57
58    R_g^2 =&\ \left[ \tfrac{12}{5}R^5
59        + R^4\left(6h+\tfrac32 L\right)
60        + R^2\left(4h^2 + L^2 + 4Lh\right)
61        + R^2\left(3Lh^2 + \tfrac32 L^2h\right) \right. \\
62        &\ \left. + \tfrac25 h^5 - \tfrac12 Lh^4 - \tfrac12 L^2h^3
63        + \tfrac14 L^3r^2 + \tfrac32 Lr^4 \right]
64        \left( 4R^3 6R^2h - 2h^3 + 3r^2L \right)^{-1}
65
66.. note::
67    The requirement that $R \geq r$ is not enforced in the model! It is
68    up to you to restrict this during analysis.
69
70The 2D scattering intensity is calculated similar to the 2D cylinder model.
71
72.. figure:: img/cylinder_angle_definition.jpg
73
74    Definition of the angles for oriented 2D barbells.
75
76.. figure:: img/cylinder_angle_projection.jpg
77
78    Examples of the angles for oriented pp against the detector plane.
79
80References
81----------
82
83H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230
84
85H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata)
86"""
87from numpy import inf
88
89name = "barbell"
90title = "Cylinder with spherical end caps"
91description = """
92    Calculates the scattering from a barbell-shaped cylinder.
93    That is a sphereocylinder with spherical end caps that have a radius larger
94    than that of the cylinder and the center of the end cap radius lies outside
95    of the cylinder.
96    Note: As the length of cylinder(bar) -->0,it becomes a dumbbell. And when
97    rad_bar = rad_bell, it is a spherocylinder.
98    It must be that rad_bar <(=) rad_bell.
99"""
100category = "shape:cylinder"
101# pylint: disable=bad-whitespace, line-too-long
102#             ["name", "units", default, [lower, upper], "type","description"],
103parameters = [["sld",         "1e-6/Ang^2",   4, [-inf, inf], "sld",         "Barbell scattering length density"],
104              ["sld_solvent", "1e-6/Ang^2",   1, [-inf, inf], "sld",         "Solvent scattering length density"],
105              ["radius_bell", "Ang",         40, [0, inf],    "volume",      "Spherical bell radius"],
106              ["radius",      "Ang",         20, [0, inf],    "volume",      "Cylindrical bar radius"],
107              ["length",      "Ang",        400, [0, inf],    "volume",      "Cylinder bar length"],
108              ["theta",       "degrees",     60, [-inf, inf], "orientation", "In plane angle"],
109              ["phi",         "degrees",     60, [-inf, inf], "orientation", "Out of plane angle"],
110             ]
111# pylint: enable=bad-whitespace, line-too-long
112
113source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "barbell.c"]
114
115# parameters for demo
116demo = dict(scale=1, background=0,
117            sld=6, sld_solvent=1,
118            radius_bell=40, radius=20, length=400,
119            theta=60, phi=60,
120            radius_pd=.2, radius_pd_n=5,
121            length_pd=.2, length_pd_n=5,
122            theta_pd=15, theta_pd_n=0,
123            phi_pd=15, phi_pd_n=0,
124           )
Note: See TracBrowser for help on using the repository browser.