[58f41fe] | 1 | #barbell model |
---|
| 2 | # Note: model title and parameter table are inserted automatically |
---|
| 3 | r""" |
---|
[eb69cce] | 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. |
---|
[58f41fe] | 9 | |
---|
| 10 | Definition |
---|
| 11 | ---------- |
---|
| 12 | |
---|
[eb69cce] | 13 | .. figure:: img/barbell_geometry.jpg |
---|
[58f41fe] | 14 | |
---|
[eb69cce] | 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}$ |
---|
[58f41fe] | 19 | |
---|
[eb69cce] | 20 | The scattered intensity $I(q)$ is calculated as |
---|
[58f41fe] | 21 | |
---|
| 22 | .. math:: |
---|
| 23 | |
---|
[eb69cce] | 24 | I(q) = \frac{\Delta \rho^2}{V} \left<A^2(q)\right> |
---|
[58f41fe] | 25 | |
---|
[eb69cce] | 26 | where the amplitude $A(q)$ is given as |
---|
[58f41fe] | 27 | |
---|
| 28 | .. math:: |
---|
| 29 | |
---|
[eb69cce] | 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} \\ |
---|
[58f41fe] | 34 | &\ + 4 \pi R^3 \int_{-h/R}^1 dt |
---|
[eb69cce] | 35 | \cos\left[ q\cos\theta |
---|
[58f41fe] | 36 | \left(Rt + h + {\tfrac12} L\right)\right] |
---|
| 37 | \times (1-t^2) |
---|
[eb69cce] | 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}} |
---|
[58f41fe] | 40 | |
---|
[eb69cce] | 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. |
---|
[58f41fe] | 46 | |
---|
| 47 | The 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 | |
---|
[eb69cce] | 54 | and its radius of gyration is |
---|
[58f41fe] | 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 | |
---|
[eb69cce] | 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. |
---|
[58f41fe] | 69 | |
---|
[eb69cce] | 70 | .. figure:: img/barbell_1d.jpg |
---|
[58f41fe] | 71 | |
---|
[eb69cce] | 72 | 1D plot using the default values (w/256 data point). |
---|
[58f41fe] | 73 | |
---|
[eb69cce] | 74 | For 2D data, the scattering intensity is calculated similar to the 2D |
---|
| 75 | cylinder model. |
---|
[58f41fe] | 76 | |
---|
[eb69cce] | 77 | .. figure:: img/barbell_2d.jpg |
---|
[58f41fe] | 78 | |
---|
[eb69cce] | 79 | 2D plot (w/(256X265) data points) for $\theta = 45^\circ$ and |
---|
| 80 | $\phi = 0^\circ$ with default values for the remaining parameters. |
---|
[58f41fe] | 81 | |
---|
[eb69cce] | 82 | .. figure:: img/orientation.jpg |
---|
[58f41fe] | 83 | |
---|
[eb69cce] | 84 | Definition of the angles for oriented 2D barbells. |
---|
[58f41fe] | 85 | |
---|
[eb69cce] | 86 | .. figure:: img/orientation2.jpg |
---|
[58f41fe] | 87 | |
---|
[eb69cce] | 88 | Examples of the angles for oriented pp against the detector plane. |
---|
[58f41fe] | 89 | |
---|
[eb69cce] | 90 | References |
---|
| 91 | ---------- |
---|
[58f41fe] | 92 | |
---|
| 93 | H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 |
---|
| 94 | |
---|
| 95 | H Kaya and N R deSouza, *J. Appl. Cryst.*, 37 (2004) 508-509 (addenda and errata) |
---|
| 96 | """ |
---|
[3c56da87] | 97 | from numpy import inf |
---|
[58f41fe] | 98 | |
---|
| 99 | name = "barbell" |
---|
| 100 | title = "Cylinder with spherical end caps" |
---|
| 101 | description = """ |
---|
[dcdf29d] | 102 | Calculates the scattering from a barbell-shaped cylinder. |
---|
| 103 | That is a sphereocylinder with spherical end caps that have a radius larger |
---|
| 104 | than that of the cylinder and the center of the end cap radius lies outside |
---|
| 105 | of the cylinder. |
---|
| 106 | Note: As the length of cylinder(bar) -->0,it becomes a dumbbell. And when |
---|
| 107 | rad_bar = rad_bell, it is a spherocylinder. |
---|
| 108 | It must be that rad_bar <(=) rad_bell. |
---|
[58f41fe] | 109 | """ |
---|
[a5d0d00] | 110 | category = "shape:cylinder" |
---|
[dcdf29d] | 111 | # pylint: disable=bad-whitespace, line-too-long |
---|
[5ef0633] | 112 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
[dcdf29d] | 113 | parameters = [["sld", "4e-6/Ang^2", 4, [-inf, inf], "", "Barbell scattering length density"], |
---|
| 114 | ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Solvent scattering length density"], |
---|
| 115 | ["bell_radius", "Ang", 40, [0, inf], "volume", "Spherical bell radius"], |
---|
| 116 | ["radius", "Ang", 20, [0, inf], "volume", "Cylindrical bar radius"], |
---|
| 117 | ["length", "Ang", 400, [0, inf], "volume", "Cylinder bar length"], |
---|
| 118 | ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"], |
---|
| 119 | ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"], |
---|
[5ef0633] | 120 | ] |
---|
[dcdf29d] | 121 | # pylint: enable=bad-whitespace, line-too-long |
---|
[58f41fe] | 122 | |
---|
[5ef0633] | 123 | source = ["lib/J1.c", "lib/gauss76.c", "barbell.c"] |
---|
[58f41fe] | 124 | |
---|
| 125 | # parameters for demo |
---|
[5ef0633] | 126 | demo = dict(scale=1, background=0, |
---|
| 127 | sld=6, solvent_sld=1, |
---|
| 128 | bell_radius=40, radius=20, length=400, |
---|
| 129 | theta=60, phi=60, |
---|
| 130 | radius_pd=.2, radius_pd_n=5, |
---|
| 131 | length_pd=.2, length_pd_n=5, |
---|
| 132 | theta_pd=15, theta_pd_n=0, |
---|
| 133 | phi_pd=15, phi_pd_n=0, |
---|
| 134 | ) |
---|
[58f41fe] | 135 | |
---|
| 136 | # For testing against the old sasview models, include the converted parameter |
---|
| 137 | # names and the target sasview model name. |
---|
[5ef0633] | 138 | oldname = 'BarBellModel' |
---|
| 139 | oldpars = dict(sld='sld_barbell', |
---|
| 140 | solvent_sld='sld_solv', bell_radius='rad_bell', |
---|
| 141 | radius='rad_bar', length='len_bar') |
---|