1 | r""" |
---|
2 | Definition |
---|
3 | ---------- |
---|
4 | |
---|
5 | The output of the 2D scattering intensity function for oriented core-shell |
---|
6 | cylinders is given by (Kline, 2006 [#kline]_). The form factor is normalized |
---|
7 | by the particle volume. Note that in this model the shell envelops the entire |
---|
8 | core so that besides a "sleeve" around the core, the shell also provides two |
---|
9 | flat end caps of thickness = shell thickness. In other words the length of the |
---|
10 | total cyclinder is the length of the core cylinder plus twice the thickness of |
---|
11 | the shell. If no end caps are desired one should use the |
---|
12 | :ref:`core-shell-bicelle` and set the thickness of the end caps (in this case |
---|
13 | the "thick_face") to zero. |
---|
14 | |
---|
15 | .. math:: |
---|
16 | |
---|
17 | I(q,\alpha) = \frac{\text{scale}}{V_s} F^2(q,\alpha).sin(\alpha) + \text{background} |
---|
18 | |
---|
19 | where |
---|
20 | |
---|
21 | .. math:: |
---|
22 | |
---|
23 | F(q,\alpha) = &\ (\rho_c - \rho_s) V_c |
---|
24 | \frac{\sin \left( q \tfrac12 L\cos\alpha \right)} |
---|
25 | {q \tfrac12 L\cos\alpha} |
---|
26 | \frac{2 J_1 \left( qR\sin\alpha \right)} |
---|
27 | {qR\sin\alpha} \\ |
---|
28 | &\ + (\rho_s - \rho_\text{solv}) V_s |
---|
29 | \frac{\sin \left( q \left(\tfrac12 L+T\right) \cos\alpha \right)} |
---|
30 | {q \left(\tfrac12 L +T \right) \cos\alpha} |
---|
31 | \frac{ 2 J_1 \left( q(R+T)\sin\alpha \right)} |
---|
32 | {q(R+T)\sin\alpha} |
---|
33 | |
---|
34 | and |
---|
35 | |
---|
36 | .. math:: |
---|
37 | |
---|
38 | V_s = \pi (R + T)^2 (L + 2T) |
---|
39 | |
---|
40 | and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, |
---|
41 | $V_s$ is the total volume (i.e. including both the core and the outer shell), |
---|
42 | $V_c$ is the volume of the core, $L$ is the length of the core, |
---|
43 | $R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ |
---|
44 | is the scattering length density of the core, $\rho_s$ is the scattering |
---|
45 | length density of the shell, $\rho_\text{solv}$ is the scattering length |
---|
46 | density of the solvent, and *background* is the background level. The outer |
---|
47 | radius of the shell is given by $R+T$ and the total length of the outer |
---|
48 | shell is given by $L+2T$. $J1$ is the first order Bessel function. |
---|
49 | |
---|
50 | .. _core-shell-cylinder-geometry: |
---|
51 | |
---|
52 | .. figure:: img/core_shell_cylinder_geometry.jpg |
---|
53 | |
---|
54 | Core shell cylinder schematic. |
---|
55 | |
---|
56 | To provide easy access to the orientation of the core-shell cylinder, we |
---|
57 | define the axis of the cylinder using two angles $\theta$ and $\phi$. |
---|
58 | (see :ref:`cylinder model <cylinder-angle-definition>`) |
---|
59 | |
---|
60 | NB: The 2nd virial coefficient of the cylinder is calculated based on |
---|
61 | the radius and 2 length values, and used as the effective radius for |
---|
62 | $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
63 | |
---|
64 | The $\theta$ and $\phi$ parameters are not used for the 1D output. |
---|
65 | |
---|
66 | Reference |
---|
67 | --------- |
---|
68 | |
---|
69 | .. [#] see, for example, Ian Livsey J. Chem. Soc., Faraday Trans. 2, 1987,83, |
---|
70 | 1445-1452 |
---|
71 | .. [#kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 |
---|
72 | |
---|
73 | Authorship and Verification |
---|
74 | ---------------------------- |
---|
75 | |
---|
76 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
77 | * **Last Modified by:** Paul Kienzle **Date:** Aug 8, 2016 |
---|
78 | * **Last Reviewed by:** Richard Heenan **Date:** March 18, 2016 |
---|
79 | """ |
---|
80 | |
---|
81 | import numpy as np |
---|
82 | from numpy import pi, inf, sin, cos |
---|
83 | |
---|
84 | name = "core_shell_cylinder" |
---|
85 | title = "Right circular cylinder with a core-shell scattering length density profile." |
---|
86 | description = """ |
---|
87 | P(q,alpha)= scale/Vs*f(q)^(2) + background, |
---|
88 | where: f(q)= 2(sld_core - solvant_sld) |
---|
89 | * Vc*sin[qLcos(alpha/2)] |
---|
90 | /[qLcos(alpha/2)]*J1(qRsin(alpha)) |
---|
91 | /[qRsin(alpha)]+2(sld_shell-sld_solvent) |
---|
92 | *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T) |
---|
93 | *cos(alpha/2)]*J1(q(R+T)sin(alpha)) |
---|
94 | /q(R+T)sin(alpha)] |
---|
95 | |
---|
96 | alpha:is the angle between the axis of |
---|
97 | the cylinder and the q-vector |
---|
98 | Vs: the volume of the outer shell |
---|
99 | Vc: the volume of the core |
---|
100 | L: the length of the core |
---|
101 | sld_shell: the scattering length density of the shell |
---|
102 | sld_solvent: the scattering length density of the solvent |
---|
103 | background: the background |
---|
104 | T: the thickness |
---|
105 | R+T: is the outer radius |
---|
106 | L+2T: The total length of the outershell |
---|
107 | J1: the first order Bessel function |
---|
108 | theta: axis_theta of the cylinder |
---|
109 | phi: the axis_phi of the cylinder |
---|
110 | """ |
---|
111 | category = "shape:cylinder" |
---|
112 | |
---|
113 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
114 | parameters = [["sld_core", "1e-6/Ang^2", 4, [-inf, inf], "sld", |
---|
115 | "Cylinder core scattering length density"], |
---|
116 | ["sld_shell", "1e-6/Ang^2", 4, [-inf, inf], "sld", |
---|
117 | "Cylinder shell scattering length density"], |
---|
118 | ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", |
---|
119 | "Solvent scattering length density"], |
---|
120 | ["radius", "Ang", 20, [0, inf], "volume", |
---|
121 | "Cylinder core radius"], |
---|
122 | ["thickness", "Ang", 20, [0, inf], "volume", |
---|
123 | "Cylinder shell thickness"], |
---|
124 | ["length", "Ang", 400, [0, inf], "volume", |
---|
125 | "Cylinder length"], |
---|
126 | ["theta", "degrees", 60, [-360, 360], "orientation", |
---|
127 | "cylinder axis to beam angle"], |
---|
128 | ["phi", "degrees", 60, [-360, 360], "orientation", |
---|
129 | "rotation about beam"], |
---|
130 | ] |
---|
131 | |
---|
132 | source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "core_shell_cylinder.c"] |
---|
133 | have_Fq = True |
---|
134 | effective_radius_type = [ |
---|
135 | "equivalent sphere", "outer radius", "half outer length", |
---|
136 | "half min outer dimension", "half max outer dimension", |
---|
137 | "half outer diagonal", |
---|
138 | ] |
---|
139 | |
---|
140 | def random(): |
---|
141 | outer_radius = 10**np.random.uniform(1, 4.7) |
---|
142 | # Use a distribution with a preference for thin shell or thin core |
---|
143 | # Avoid core,shell radii < 1 |
---|
144 | radius = np.random.beta(0.5, 0.5)*(outer_radius-2) + 1 |
---|
145 | thickness = outer_radius - radius |
---|
146 | length = np.random.uniform(1, 4.7) |
---|
147 | pars = dict( |
---|
148 | radius=radius, |
---|
149 | thickness=thickness, |
---|
150 | length=length, |
---|
151 | ) |
---|
152 | return pars |
---|
153 | |
---|
154 | demo = dict(scale=1, background=0, |
---|
155 | sld_core=6, sld_shell=8, sld_solvent=1, |
---|
156 | radius=45, thickness=25, length=340, |
---|
157 | theta=30, phi=15, |
---|
158 | radius_pd=.2, radius_pd_n=1, |
---|
159 | length_pd=.2, length_pd_n=10, |
---|
160 | thickness_pd=.2, thickness_pd_n=10, |
---|
161 | theta_pd=15, theta_pd_n=45, |
---|
162 | phi_pd=15, phi_pd_n=1) |
---|
163 | q = 0.1 |
---|
164 | # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! |
---|
165 | qx = q*cos(pi/6.0) |
---|
166 | qy = q*sin(pi/6.0) |
---|
167 | tests = [ |
---|
168 | [{}, 0.075, 10.8552692237], |
---|
169 | [{}, (qx, qy), 0.444618752741], |
---|
170 | ] |
---|
171 | del qx, qy # not necessary to delete, but cleaner |
---|