source: sasmodels/sasmodels/models/barbell.py @ 5ef0633

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 5ef0633 was 5ef0633, checked in by Doucet, Mathieu <doucetm@…>, 9 years ago

update pylint.rc to match design

  • Property mode set to 100644
File size: 5.3 KB
Line 
1#barbell model
2# cylinder model
3# Note: model title and parameter table are inserted automatically
4r"""
5
6Calculates the scattering from a barbell-shaped cylinder (This model simply
7becomes the DumBellModel when the length of the cylinder, *L*, is set to zero).
8That is, a sphereocylinder with spherical end caps that have a radius larger
9than that of the cylinder and the center of the end cap radius lies outside
10of the cylinder. All dimensions of the BarBell are considered to be
11monodisperse. See the diagram for the details of the geometry and restrictions
12on parameter values.
13
14Definition
15----------
16
17The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale.
18
19The barbell geometry is defined as
20
21.. image:: img/barbell_geometry.jpg
22
23where *r* is the radius of the cylinder. All other parameters are as defined
24in the diagram.
25
26Since the end cap radius
27*R* >= *r* and by definition for this geometry *h* < 0, *h* is then
28defined by *r* and *R* as
29
30*h* = -1 \* sqrt(*R*\ :sup:`2` - *r*\ :sup:`2`)
31
32The scattered intensity *I(q)* is calculated as
33
34.. math::
35
36    I(Q) = \frac{(\Delta \rho)^2}{V} \left< A^2(Q)\right>
37
38where the amplitude *A(q)* is given as
39
40.. math::
41
42    A(Q) =&\ \pi r^2L
43        {\sin\left(\tfrac12 QL\cos\theta\right)
44            \over \tfrac12 QL\cos\theta}
45        {2 J_1(Qr\sin\theta) \over Qr\sin\theta} \\
46        &\ + 4 \pi R^3 \int_{-h/R}^1 dt
47        \cos\left[ Q\cos\theta
48            \left(Rt + h + {\tfrac12} L\right)\right]
49        \times (1-t^2)
50        {J_1\left[QR\sin\theta \left(1-t^2\right)^{1/2}\right]
51             \over QR\sin\theta \left(1-t^2\right)^{1/2}}
52
53The < > brackets denote an average of the structure over all orientations.
54<*A* :sup:`2`\ *(q)*> is then the form factor, *P(q)*. The scale factor is
55equivalent to the volume fraction of cylinders, each of volume, *V*. Contrast
56is the difference of scattering length densities of the cylinder and the
57surrounding solvent.
58
59The volume of the barbell is
60
61.. math::
62
63    V = \pi r_c^2 L + 2\pi\left(\tfrac23R^3 + R^2h-\tfrac13h^3\right)
64
65
66and its radius-of-gyration is
67
68.. math::
69
70    R_g^2 =&\ \left[ \tfrac{12}{5}R^5
71        + R^4\left(6h+\tfrac32 L\right)
72        + R^2\left(4h^2 + L^2 + 4Lh\right)
73        + R^2\left(3Lh^2 + \tfrac32 L^2h\right) \right. \\
74        &\ \left. + \tfrac25 h^5 - \tfrac12 Lh^4 - \tfrac12 L^2h^3
75        + \tfrac14 L^3r^2 + \tfrac32 Lr^4 \right]
76        \left( 4R^3 6R^2h - 2h^3 + 3r^2L \right)^{-1}
77
78**The requirement that** *R* >= *r* **is not enforced in the model!** It is
79up to you to restrict this during analysis.
80
81This example dataset is produced by running the Macro PlotBarbell(),
82using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1|,
83*sld* = 4e-6 |Ang^-2| and the default model values.
84
85.. image:: img/barbell_1d.jpg
86
87*Figure. 1D plot using the default values (w/256 data point).*
88
89For 2D data: The 2D scattering intensity is calculated similar to the 2D
90cylinder model. For example, for |theta| = 45 deg and |phi| = 0 deg with
91default values for other parameters
92
93.. image:: img/barbell_2d.jpg
94
95*Figure. 2D plot (w/(256X265) data points).*
96
97.. image:: img/orientation.jpg
98
99Figure. Definition of the angles for oriented 2D barbells.
100
101.. image:: img/orientation2.jpg
102
103*Figure. Examples of the angles for oriented pp against the detector plane.*
104
105REFERENCE
106---------
107
108H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230
109
110H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata)
111
112"""
113from numpy import inf
114
115name = "barbell"
116title = "Cylinder with spherical end caps"
117description = """
118        Calculates the scattering from a barbell-shaped cylinder. That is a sphereocylinder with spherical end caps that have a radius larger than that of the cylinder and the center of the end cap
119        radius lies outside of the cylinder.
120        Note: As the length of cylinder(bar) -->0,it becomes a dumbbell. And when rad_bar = rad_bell, it is a spherocylinder.
121        It must be that rad_bar <(=) rad_bell.
122"""
123category = "shape:cylinder"
124
125#             ["name", "units", default, [lower, upper], "type","description"],
126parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", "Barbell scattering length density"],
127              ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Solvent scattering length density"],
128              ["bell_radius", "Ang", 40, [0, inf], "volume", "Spherical bell radius"],
129              ["radius", "Ang", 20, [0, inf], "volume", "Cylindrical bar radius"],
130              ["length", "Ang", 400, [0, inf], "volume", "Cylinder bar length"],
131              ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"],
132              ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"],
133             ]
134
135source = ["lib/J1.c", "lib/gauss76.c", "barbell.c"]
136
137# parameters for demo
138demo = dict(scale=1, background=0,
139            sld=6, solvent_sld=1,
140            bell_radius=40, radius=20, length=400,
141            theta=60, phi=60,
142            radius_pd=.2, radius_pd_n=5,
143            length_pd=.2, length_pd_n=5,
144            theta_pd=15, theta_pd_n=0,
145            phi_pd=15, phi_pd_n=0,
146           )
147
148# For testing against the old sasview models, include the converted parameter
149# names and the target sasview model name.
150oldname = 'BarBellModel'
151oldpars = dict(sld='sld_barbell',
152               solvent_sld='sld_solv', bell_radius='rad_bell',
153               radius='rad_bar', length='len_bar')
Note: See TracBrowser for help on using the repository browser.