[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 | |
---|
[01eece6] | 33 | where *scale* is a scale factor, $H = L/2$ and $J_1$ is the 1st order |
---|
[d138d43] | 34 | Bessel function. |
---|
[84e6942] | 35 | |
---|
[d138d43] | 36 | **NB**: The 2nd virial coefficient of the cylinder is calculated |
---|
| 37 | based on the radius and 2 length values, and used as the effective radius |
---|
[eb69cce] | 38 | for $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
[84e6942] | 39 | |
---|
| 40 | In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` |
---|
[d138d43] | 41 | and the *radius* is $R_\text{shell}$ while *core_radius* is $R_\text{core}$. |
---|
[84e6942] | 42 | |
---|
[2f0c07d] | 43 | To provide easy access to the orientation of the core-shell cylinder, we define |
---|
| 44 | the axis of the cylinder using two angles $\theta$ and $\phi$ |
---|
| 45 | (see :ref:`cylinder model <cylinder-angle-definition>`). |
---|
[84e6942] | 46 | |
---|
[eb69cce] | 47 | References |
---|
| 48 | ---------- |
---|
[84e6942] | 49 | |
---|
| 50 | L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and |
---|
| 51 | Neutron Scattering*, Plenum Press, New York, (1987) |
---|
| 52 | """ |
---|
| 53 | |
---|
[0420af7] | 54 | from numpy import pi, inf |
---|
[84e6942] | 55 | |
---|
| 56 | name = "hollow_cylinder" |
---|
| 57 | title = "" |
---|
| 58 | description = """ |
---|
| 59 | P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude. |
---|
| 60 | core_radius = the radius of core |
---|
| 61 | radius = the radius of shell |
---|
| 62 | length = the total length of the cylinder |
---|
| 63 | sld = SLD of the shell |
---|
[01eece6] | 64 | sld_solvent = SLD of the solvent |
---|
[84e6942] | 65 | background = incoherent background |
---|
| 66 | """ |
---|
| 67 | category = "shape:cylinder" |
---|
[ec2ca99] | 68 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 69 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
[84e6942] | 70 | parameters = [ |
---|
[ec2ca99] | 71 | ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], |
---|
| 72 | ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], |
---|
| 73 | ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], |
---|
[42356c8] | 74 | ["sld", "1/Ang^2", 6.3, [-inf, inf], "sld", "Cylinder sld"], |
---|
| 75 | ["sld_solvent", "1/Ang^2", 1, [-inf, inf], "sld", "Solvent sld"], |
---|
[ec2ca99] | 76 | ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], |
---|
| 77 | ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], |
---|
| 78 | ] |
---|
| 79 | # pylint: enable=bad-whitespace, line-too-long |
---|
[84e6942] | 80 | |
---|
[58210db] | 81 | source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "hollow_cylinder.c"] |
---|
[84e6942] | 82 | |
---|
[e0fd913] | 83 | # pylint: disable=W0613 |
---|
[0420af7] | 84 | def ER(radius, core_radius, length): |
---|
[ec2ca99] | 85 | """ |
---|
| 86 | :param radius: Cylinder radius |
---|
| 87 | :param core_radius: Hollow core radius, UNUSED |
---|
| 88 | :param length: Cylinder length |
---|
| 89 | :return: Effective radius |
---|
| 90 | """ |
---|
[0420af7] | 91 | if radius == 0 or length == 0: |
---|
| 92 | return 0.0 |
---|
| 93 | len1 = radius |
---|
| 94 | len2 = length/2.0 |
---|
| 95 | term1 = len1*len1*2.0*len2/2.0 |
---|
| 96 | term2 = 1.0 + (len2/len1)*(1.0 + 1/len2/2.0)*(1.0 + pi*len1/len2/2.0) |
---|
| 97 | ddd = 3.0*term1*term2 |
---|
| 98 | diam = pow(ddd, (1.0/3.0)) |
---|
| 99 | return diam |
---|
| 100 | |
---|
| 101 | def VR(radius, core_radius, length): |
---|
[ec2ca99] | 102 | """ |
---|
| 103 | :param radius: Cylinder radius |
---|
| 104 | :param core_radius: Hollow core radius |
---|
| 105 | :param length: Cylinder length |
---|
| 106 | :return: Volf ratio for P(q)*S(q) |
---|
| 107 | """ |
---|
[0420af7] | 108 | vol_core = pi*core_radius*core_radius*length |
---|
| 109 | vol_total = pi*radius*radius*length |
---|
| 110 | vol_shell = vol_total - vol_core |
---|
| 111 | return vol_shell, vol_total |
---|
| 112 | |
---|
[84e6942] | 113 | # parameters for demo |
---|
[ec2ca99] | 114 | demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, |
---|
[01eece6] | 115 | core_radius=20.0, sld=6.3, sld_solvent=1, theta=90, phi=0, |
---|
[6cf1cb3] | 116 | radius_pd=.2, radius_pd_n=9, |
---|
| 117 | length_pd=.2, length_pd_n=10, |
---|
[0420af7] | 118 | core_radius_pd=.2, core_radius_pd_n=9, |
---|
[6cf1cb3] | 119 | theta_pd=10, theta_pd_n=5, |
---|
[ec2ca99] | 120 | ) |
---|
[84e6942] | 121 | |
---|
[66ebdd6] | 122 | # Parameters for unit tests |
---|
| 123 | tests = [ |
---|
[ec2ca99] | 124 | [{"radius": 30.0}, 0.00005, 1764.926], |
---|
| 125 | [{}, 'VR', 1.8], |
---|
| 126 | [{}, 0.001, 1756.76] |
---|
| 127 | ] |
---|