[84e6942] | 1 | r""" |
---|
[d138d43] | 2 | This model provides the form factor, $P(q)$, for a monodisperse hollow right |
---|
[84e6942] | 3 | angle circular cylinder (tube) where the form factor is normalized by the |
---|
| 4 | volume of the tube |
---|
| 5 | |
---|
[d138d43] | 6 | .. math:: |
---|
| 7 | |
---|
[eb69cce] | 8 | P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} |
---|
[84e6942] | 9 | |
---|
[eb69cce] | 10 | where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. |
---|
[84e6942] | 11 | |
---|
| 12 | The inside and outside of the hollow cylinder are assumed have the same SLD. |
---|
| 13 | |
---|
| 14 | Definition |
---|
| 15 | ---------- |
---|
| 16 | |
---|
| 17 | The 1D scattering intensity is calculated in the following way (Guinier, 1955) |
---|
| 18 | |
---|
| 19 | .. math:: |
---|
| 20 | |
---|
[eb69cce] | 21 | P(q) &= (\text{scale})V_\text{shell}\Delta\rho^2 |
---|
[d138d43] | 22 | \int_0^{1}\Psi^2 |
---|
| 23 | \left[q_z, R_\text{shell}(1-x^2)^{1/2}, |
---|
| 24 | R_\text{core}(1-x^2)^{1/2}\right] |
---|
| 25 | \left[\frac{\sin(qHx)}{qHx}\right]^2 dx \\ |
---|
[eb69cce] | 26 | \Psi[q,y,z] &= \frac{1}{1-\gamma^2} |
---|
[d138d43] | 27 | \left[ \Lambda(qy) - \gamma^2\Lambda(qz) \right] \\ |
---|
[eb69cce] | 28 | \Lambda(a) &= 2 J_1(a) / a \\ |
---|
| 29 | \gamma &= R_\text{core} / R_\text{shell} \\ |
---|
| 30 | V_\text{shell} &= \pi \left(R_\text{shell}^2 - R_\text{core}^2 \right)L \\ |
---|
[d18f8a8] | 31 | J_1(x) &= (\sin(x)-x\cdot \cos(x)) / x^2 |
---|
[84e6942] | 32 | |
---|
[d138d43] | 33 | where *scale* is a scale factor and $J_1$ is the 1st order |
---|
| 34 | Bessel function. |
---|
[84e6942] | 35 | |
---|
| 36 | To provide easy access to the orientation of the core-shell cylinder, we define |
---|
[d138d43] | 37 | the axis of the cylinder using two angles $\theta$ and $\phi$. As for the case |
---|
[84e6942] | 38 | of the cylinder, those angles are defined in Figure 2 of the CylinderModel. |
---|
| 39 | |
---|
[d138d43] | 40 | **NB**: The 2nd virial coefficient of the cylinder is calculated |
---|
| 41 | based on the radius and 2 length values, and used as the effective radius |
---|
[eb69cce] | 42 | for $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
[84e6942] | 43 | |
---|
| 44 | In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` |
---|
[d138d43] | 45 | and the *radius* is $R_\text{shell}$ while *core_radius* is $R_\text{core}$. |
---|
[84e6942] | 46 | |
---|
[d138d43] | 47 | .. figure:: img/hollow_cylinder_1d.jpg |
---|
[84e6942] | 48 | |
---|
[d138d43] | 49 | 1D plot using the default values (w/1000 data point). |
---|
[84e6942] | 50 | |
---|
[d138d43] | 51 | .. figure:: img/orientation.jpg |
---|
[84e6942] | 52 | |
---|
[d138d43] | 53 | Definition of the angles for the oriented hollow_cylinder model. |
---|
[84e6942] | 54 | |
---|
[d138d43] | 55 | .. figure:: img/orientation2.jpg |
---|
[84e6942] | 56 | |
---|
[d138d43] | 57 | Examples of the angles for oriented pp against the detector plane. |
---|
[84e6942] | 58 | |
---|
[eb69cce] | 59 | References |
---|
| 60 | ---------- |
---|
[84e6942] | 61 | |
---|
| 62 | L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and |
---|
| 63 | Neutron Scattering*, Plenum Press, New York, (1987) |
---|
| 64 | """ |
---|
| 65 | |
---|
[0420af7] | 66 | from numpy import pi, inf |
---|
[84e6942] | 67 | |
---|
| 68 | name = "hollow_cylinder" |
---|
| 69 | title = "" |
---|
| 70 | description = """ |
---|
| 71 | P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude. |
---|
| 72 | core_radius = the radius of core |
---|
| 73 | radius = the radius of shell |
---|
| 74 | length = the total length of the cylinder |
---|
| 75 | sld = SLD of the shell |
---|
| 76 | solvent_sld = SLD of the solvent |
---|
| 77 | background = incoherent background |
---|
| 78 | """ |
---|
| 79 | category = "shape:cylinder" |
---|
| 80 | |
---|
| 81 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 82 | parameters = [ |
---|
[6cf1cb3] | 83 | ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], |
---|
| 84 | ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], |
---|
| 85 | ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], |
---|
[84e6942] | 86 | ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], |
---|
| 87 | ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], |
---|
[eb69cce] | 88 | ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], |
---|
| 89 | ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], |
---|
[84e6942] | 90 | ] |
---|
| 91 | |
---|
| 92 | source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"] |
---|
| 93 | |
---|
[0420af7] | 94 | def ER(radius, core_radius, length): |
---|
| 95 | if radius == 0 or length == 0: |
---|
| 96 | return 0.0 |
---|
| 97 | len1 = radius |
---|
| 98 | len2 = length/2.0 |
---|
| 99 | term1 = len1*len1*2.0*len2/2.0 |
---|
| 100 | term2 = 1.0 + (len2/len1)*(1.0 + 1/len2/2.0)*(1.0 + pi*len1/len2/2.0) |
---|
| 101 | ddd = 3.0*term1*term2 |
---|
| 102 | diam = pow(ddd, (1.0/3.0)) |
---|
| 103 | return diam |
---|
| 104 | |
---|
| 105 | def VR(radius, core_radius, length): |
---|
| 106 | vol_core = pi*core_radius*core_radius*length |
---|
| 107 | vol_total = pi*radius*radius*length |
---|
| 108 | vol_shell = vol_total - vol_core |
---|
| 109 | return vol_shell, vol_total |
---|
| 110 | |
---|
[84e6942] | 111 | # parameters for demo |
---|
| 112 | demo = dict(scale=1.0,background=0.0,length=400.0,radius=30.0,core_radius=20.0, |
---|
[6cf1cb3] | 113 | sld=6.3,solvent_sld=1,theta=90,phi=0, |
---|
| 114 | radius_pd=.2, radius_pd_n=9, |
---|
| 115 | length_pd=.2, length_pd_n=10, |
---|
[0420af7] | 116 | core_radius_pd=.2, core_radius_pd_n=9, |
---|
[6cf1cb3] | 117 | theta_pd=10, theta_pd_n=5, |
---|
| 118 | ) |
---|
[84e6942] | 119 | |
---|
| 120 | # For testing against the old sasview models, include the converted parameter |
---|
| 121 | # names and the target sasview model name. |
---|
| 122 | oldname = 'HollowCylinderModel' |
---|
| 123 | oldpars = dict(scale='scale',background='background',radius='radius', |
---|
| 124 | core_radius='core_radius',sld='sldCyl',length='length', |
---|
[6cf1cb3] | 125 | solvent_sld='sldSolv',phi='axis_phi',theta='axis_theta') |
---|
[66ebdd6] | 126 | |
---|
| 127 | # Parameters for unit tests |
---|
| 128 | tests = [ |
---|
[0420af7] | 129 | [{"radius" : 30.0},0.00005,1764.926], |
---|
| 130 | [{},'VR',1.8], |
---|
| 131 | [{},0.001,1756.76] |
---|
[66ebdd6] | 132 | ] |
---|