Changeset eb69cce in sasmodels for sasmodels/models/barbell.py
- Timestamp:
- Nov 30, 2015 7:18:41 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- d18f8a8
- Parents:
- d138d43
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.py
r5ef0633 reb69cce 1 1 #barbell model 2 # cylinder model3 2 # Note: model title and parameter table are inserted automatically 4 3 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. 4 Calculates the scattering from a barbell-shaped cylinder. Like 5 :ref:`capped-cylinder`, this is a sphereocylinder with spherical end 6 caps that have a radius larger than that of the cylinder, but with the center 7 of the end cap radius lying outside of the cylinder. See the diagram for 8 the details of the geometry and restrictions on parameter values. 13 9 14 10 Definition 15 11 ---------- 16 12 17 The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. 13 .. figure:: img/barbell_geometry.jpg 18 14 19 The barbell geometry is defined as 15 Barbell geometry, where $r$ is *radius*, $R$ is *bell_radius* 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}$ 20 19 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 20 The scattered intensity $I(q)$ is calculated as 33 21 34 22 .. math:: 35 23 36 I( Q) = \frac{(\Delta \rho)^2}{V} \left< A^2(Q)\right>24 I(q) = \frac{\Delta \rho^2}{V} \left<A^2(q)\right> 37 25 38 where the amplitude *A(q)*is given as26 where the amplitude $A(q)$ is given as 39 27 40 28 .. math:: 41 29 42 A( Q) =&\ \pi r^2L43 {\sin\left(\tfrac12 QL\cos\theta\right)44 \over \tfrac12 QL\cos\theta}45 {2 J_1(Qr\sin\theta) \over Qr\sin\theta} \\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} \\ 46 34 &\ + 4 \pi R^3 \int_{-h/R}^1 dt 47 \cos\left[ Q\cos\theta35 \cos\left[ q\cos\theta 48 36 \left(Rt + h + {\tfrac12} L\right)\right] 49 37 \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}}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}} 52 40 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.41 The $\left<\ldots\right>$ brackets denote an average of the structure over 42 all orientations. $\left<A^2(q)\right>$ is then the form factor, $P(q)$. 43 The scale factor is equivalent to the volume fraction of cylinders, each of 44 volume, $V$. Contrast $\Delta\rho$ is the difference of scattering length 45 densities of the cylinder and the surrounding solvent. 58 46 59 47 The volume of the barbell is … … 64 52 65 53 66 and its radius -of-gyration is54 and its radius of gyration is 67 55 68 56 .. math:: … … 76 64 \left( 4R^3 6R^2h - 2h^3 + 3r^2L \right)^{-1} 77 65 78 **The requirement that** *R* >= *r* **is not enforced in the model!** It is 79 up to you to restrict this during analysis. 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. 80 69 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. 70 .. figure:: img/barbell_1d.jpg 84 71 85 .. image:: img/barbell_1d.jpg 72 1D plot using the default values (w/256 data point). 86 73 87 *Figure. 1D plot using the default values (w/256 data point).* 74 For 2D data, the scattering intensity is calculated similar to the 2D 75 cylinder model. 88 76 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 77 .. figure:: img/barbell_2d.jpg 92 78 93 .. image:: img/barbell_2d.jpg 79 2D plot (w/(256X265) data points) for $\theta = 45^\circ$ and 80 $\phi = 0^\circ$ with default values for the remaining parameters. 94 81 95 *Figure. 2D plot (w/(256X265) data points).* 82 .. figure:: img/orientation.jpg 96 83 97 .. image:: img/orientation.jpg 84 Definition of the angles for oriented 2D barbells. 98 85 99 Figure. Definition of the angles for oriented 2D barbells. 86 .. figure:: img/orientation2.jpg 100 87 101 .. image:: img/orientation2.jpg 88 Examples of the angles for oriented pp against the detector plane. 102 89 103 *Figure. Examples of the angles for oriented pp against the detector plane.* 104 105 REFERENCE 106 --------- 90 References 91 ---------- 107 92 108 93 H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 109 94 110 95 H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata) 111 112 96 """ 113 97 from numpy import inf … … 124 108 125 109 # ["name", "units", default, [lower, upper], "type","description"], 126 parameters = [["sld", " 1e-6/Ang^2", 4, [-inf, inf], "", "Barbell scattering length density"],110 parameters = [["sld", "4e-6/Ang^2", 4, [-inf, inf], "", "Barbell scattering length density"], 127 111 ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Solvent scattering length density"], 128 112 ["bell_radius", "Ang", 40, [0, inf], "volume", "Spherical bell radius"],
Note: See TracChangeset
for help on using the changeset viewer.