1 | r""" |
---|
2 | This model provides the form factor, $P(q)$, for a monodisperse hollow right |
---|
3 | angle circular cylinder (rigid tube) where the form factor is normalized by the |
---|
4 | volume of the tube (i.e. not by the external volume). |
---|
5 | |
---|
6 | .. math:: |
---|
7 | |
---|
8 | P(q) = \text{scale} \left<F^2\right>/V_\text{shell} + \text{background} |
---|
9 | |
---|
10 | where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation. |
---|
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 | |
---|
21 | P(q) &= (\text{scale})V_\text{shell}\Delta\rho^2 |
---|
22 | \int_0^{1}\Psi^2 |
---|
23 | \left[q_z, R_\text{outer}(1-x^2)^{1/2}, |
---|
24 | R_\text{core}(1-x^2)^{1/2}\right] |
---|
25 | \left[\frac{\sin(qHx)}{qHx}\right]^2 dx \\ |
---|
26 | \Psi[q,y,z] &= \frac{1}{1-\gamma^2} |
---|
27 | \left[ \Lambda(qy) - \gamma^2\Lambda(qz) \right] \\ |
---|
28 | \Lambda(a) &= 2 J_1(a) / a \\ |
---|
29 | \gamma &= R_\text{core} / R_\text{outer} \\ |
---|
30 | V_\text{shell} &= \pi \left(R_\text{outer}^2 - R_\text{core}^2 \right)L \\ |
---|
31 | J_1(x) &= (\sin(x)-x\cdot \cos(x)) / x^2 |
---|
32 | |
---|
33 | where *scale* is a scale factor, $H = L/2$ and $J_1$ is the 1st order |
---|
34 | Bessel function. |
---|
35 | |
---|
36 | **NB**: The 2nd virial coefficient of the cylinder is calculated |
---|
37 | based on the outer radius and full length, which give an the effective radius |
---|
38 | for structure factor $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
39 | |
---|
40 | In the parameters,the *radius* is $R_\text{core}$ while *thickness* is $R_\text{outer} - R_\text{core}$. |
---|
41 | |
---|
42 | To provide easy access to the orientation of the core-shell cylinder, we define |
---|
43 | the axis of the cylinder using two angles $\theta$ and $\phi$ |
---|
44 | (see :ref:`cylinder model <cylinder-angle-definition>`). |
---|
45 | |
---|
46 | References |
---|
47 | ---------- |
---|
48 | |
---|
49 | L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and |
---|
50 | Neutron Scattering*, Plenum Press, New York, (1987) |
---|
51 | |
---|
52 | Authorship and Verification |
---|
53 | ---------------------------- |
---|
54 | |
---|
55 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
56 | * **Last Modified by:** Richard Heenan **Date:** October 06, 2016 |
---|
57 | (reparametrised to use thickness, not outer radius) |
---|
58 | * **Last Reviewed by:** Richard Heenan **Date:** October 06, 2016 |
---|
59 | |
---|
60 | """ |
---|
61 | |
---|
62 | from numpy import pi, inf |
---|
63 | |
---|
64 | name = "hollow_cylinder" |
---|
65 | title = "" |
---|
66 | description = """ |
---|
67 | P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude. |
---|
68 | radius = the radius of core |
---|
69 | thickness = the thickness of shell |
---|
70 | length = the total length of the cylinder |
---|
71 | sld = SLD of the shell |
---|
72 | sld_solvent = SLD of the solvent |
---|
73 | background = incoherent background |
---|
74 | """ |
---|
75 | category = "shape:cylinder" |
---|
76 | # pylint: disable=bad-whitespace, line-too-long |
---|
77 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
78 | parameters = [ |
---|
79 | ["radius", "Ang", 20.0, [0, inf], "volume", "Cylinder core radius"], |
---|
80 | ["thickness", "Ang", 10.0, [0, inf], "volume", "Cylinder wall thickness"], |
---|
81 | ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder total length"], |
---|
82 | ["sld", "1/Ang^2", 6.3, [-inf, inf], "sld", "Cylinder sld"], |
---|
83 | ["sld_solvent", "1/Ang^2", 1, [-inf, inf], "sld", "Solvent sld"], |
---|
84 | ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], |
---|
85 | ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], |
---|
86 | ] |
---|
87 | # pylint: enable=bad-whitespace, line-too-long |
---|
88 | |
---|
89 | source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "hollow_cylinder.c"] |
---|
90 | |
---|
91 | # pylint: disable=W0613 |
---|
92 | def ER(radius, thickness, length): |
---|
93 | """ |
---|
94 | :param radius: Cylinder core radius |
---|
95 | :param thickness: Cylinder wall thickness |
---|
96 | :param length: Cylinder length |
---|
97 | :return: Effective radius |
---|
98 | """ |
---|
99 | router = radius + thickness |
---|
100 | if router == 0 or length == 0: |
---|
101 | return 0.0 |
---|
102 | len1 = router |
---|
103 | len2 = length/2.0 |
---|
104 | term1 = len1*len1*2.0*len2/2.0 |
---|
105 | term2 = 1.0 + (len2/len1)*(1.0 + 1/len2/2.0)*(1.0 + pi*len1/len2/2.0) |
---|
106 | ddd = 3.0*term1*term2 |
---|
107 | diam = pow(ddd, (1.0/3.0)) |
---|
108 | return diam |
---|
109 | |
---|
110 | def VR(radius, thickness, length): |
---|
111 | """ |
---|
112 | :param radius: Cylinder radius |
---|
113 | :param thickness: Cylinder wall thickness |
---|
114 | :param length: Cylinder length |
---|
115 | :return: Volf ratio for P(q)*S(q) |
---|
116 | """ |
---|
117 | router = radius + thickness |
---|
118 | vol_core = pi*radius*radius*length |
---|
119 | vol_total = pi*router*router*length |
---|
120 | vol_shell = vol_total - vol_core |
---|
121 | return vol_shell, vol_total |
---|
122 | |
---|
123 | # parameters for demo |
---|
124 | demo = dict(scale=1.0, background=0.0, length=400.0, radius=20.0, |
---|
125 | thickness=10, sld=6.3, sld_solvent=1, theta=90, phi=0, |
---|
126 | thickness_pd=0.2, thickness_pd_n=9, |
---|
127 | length_pd=.2, length_pd_n=10, |
---|
128 | radius_pd=.2, radius_pd_n=9, |
---|
129 | theta_pd=10, theta_pd_n=5, |
---|
130 | ) |
---|
131 | |
---|
132 | # Parameters for unit tests |
---|
133 | tests = [ |
---|
134 | [{}, 0.00005, 1764.926], |
---|
135 | [{}, 'VR', 1.8], |
---|
136 | [{}, 0.001, 1756.76] |
---|
137 | ] |
---|