1 | #barbell model |
---|
2 | # cylinder model |
---|
3 | # Note: model title and parameter table are inserted automatically |
---|
4 | r""" |
---|
5 | |
---|
6 | Calculates the scattering from a barbell-shaped cylinder (This model simply |
---|
7 | becomes the DumBellModel when the length of the cylinder, *L*, is set to zero). |
---|
8 | That is, a sphereocylinder with spherical end caps that have a radius larger |
---|
9 | than that of the cylinder and the center of the end cap radius lies outside |
---|
10 | of the cylinder. All dimensions of the BarBell are considered to be |
---|
11 | monodisperse. See the diagram for the details of the geometry and restrictions |
---|
12 | on parameter values. |
---|
13 | |
---|
14 | Definition |
---|
15 | ---------- |
---|
16 | |
---|
17 | The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. |
---|
18 | |
---|
19 | The barbell geometry is defined as |
---|
20 | |
---|
21 | .. image:: img/barbell_geometry.jpg |
---|
22 | |
---|
23 | where *r* is the radius of the cylinder. All other parameters are as defined |
---|
24 | in the diagram. |
---|
25 | |
---|
26 | Since the end cap radius |
---|
27 | *R* >= *r* and by definition for this geometry *h* < 0, *h* is then |
---|
28 | defined by *r* and *R* as |
---|
29 | |
---|
30 | *h* = -1 \* sqrt(*R*\ :sup:`2` - *r*\ :sup:`2`) |
---|
31 | |
---|
32 | The 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 | |
---|
38 | where 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 | |
---|
53 | The < > 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 |
---|
55 | equivalent to the volume fraction of cylinders, each of volume, *V*. Contrast |
---|
56 | is the difference of scattering length densities of the cylinder and the |
---|
57 | surrounding solvent. |
---|
58 | |
---|
59 | The 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 | |
---|
66 | and 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 |
---|
79 | up to you to restrict this during analysis. |
---|
80 | |
---|
81 | This example dataset is produced by running the Macro PlotBarbell(), |
---|
82 | using 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 | |
---|
89 | For 2D data: The 2D scattering intensity is calculated similar to the 2D |
---|
90 | cylinder model. For example, for |theta| = 45 deg and |phi| = 0 deg with |
---|
91 | default 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 | |
---|
99 | Figure. 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 | |
---|
105 | REFERENCE |
---|
106 | --------- |
---|
107 | |
---|
108 | H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 |
---|
109 | |
---|
110 | H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata) |
---|
111 | |
---|
112 | """ |
---|
113 | from numpy import inf |
---|
114 | |
---|
115 | name = "barbell" |
---|
116 | title = "Cylinder with spherical end caps" |
---|
117 | description = """ |
---|
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 | """ |
---|
123 | category = "shape:cylinder" |
---|
124 | |
---|
125 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
126 | parameters = [["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 | |
---|
135 | source = ["lib/J1.c", "lib/gauss76.c", "barbell.c"] |
---|
136 | |
---|
137 | # parameters for demo |
---|
138 | demo = 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. |
---|
150 | oldname = 'BarBellModel' |
---|
151 | oldpars = dict(sld='sld_barbell', |
---|
152 | solvent_sld='sld_solv', bell_radius='rad_bell', |
---|
153 | radius='rad_bar', length='len_bar') |
---|