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

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

doc fixups: add doc category to model def, convert equations to latex for barbell and bcc

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