[5d4777d] | 1 | # core shell cylinder model |
---|
| 2 | # Note: model title and parameter table are inserted automatically |
---|
| 3 | r""" |
---|
| 4 | The form factor is normalized by the particle volume. |
---|
| 5 | |
---|
| 6 | Definition |
---|
| 7 | ---------- |
---|
| 8 | |
---|
| 9 | The output of the 2D scattering intensity function for oriented core-shell |
---|
| 10 | cylinders is given by (Kline, 2006) |
---|
| 11 | |
---|
| 12 | .. math:: |
---|
| 13 | |
---|
[eb69cce] | 14 | P(q,\alpha) = \frac{\text{scale}}{V_s} F^2(q) + \text{background} |
---|
[5d4777d] | 15 | |
---|
| 16 | where |
---|
| 17 | |
---|
| 18 | .. math:: |
---|
| 19 | |
---|
[eb69cce] | 20 | F(q) = &\ (\rho_c - \rho_s) V_c |
---|
| 21 | \frac{\sin \left( q \tfrac12 L\cos\alpha \right)} |
---|
| 22 | {q \tfrac12 L\cos\alpha} |
---|
| 23 | \frac{2 J_1 \left( qR\sin\alpha \right)} |
---|
| 24 | {qR\sin\alpha} \\ |
---|
[19dcb933] | 25 | &\ + (\rho_s - \rho_\text{solv}) V_s |
---|
[eb69cce] | 26 | \frac{\sin \left( q \left(\tfrac12 L+T\right) \cos\alpha \right)} |
---|
| 27 | {q \left(\tfrac12 L +T \right) \cos\alpha} |
---|
| 28 | \frac{ 2 J_1 \left( q(R+T)\sin\alpha \right)} |
---|
| 29 | {q(R+T)\sin\alpha} |
---|
[5d4777d] | 30 | |
---|
| 31 | and |
---|
| 32 | |
---|
| 33 | .. math:: |
---|
| 34 | |
---|
[19dcb933] | 35 | V_s = \pi (R + T)^2 (L + 2T) |
---|
[5d4777d] | 36 | |
---|
| 37 | and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, |
---|
| 38 | $V_s$ is the volume of the outer shell (i.e. the total volume, including |
---|
| 39 | the shell), $V_c$ is the volume of the core, $L$ is the length of the core, |
---|
| 40 | $R$ is the radius of the core, $T$ is the thickness of the shell, $\rho_c$ |
---|
| 41 | is the scattering length density of the core, $\rho_s$ is the scattering |
---|
| 42 | length density of the shell, $\rho_\text{solv}$ is the scattering length |
---|
| 43 | density of the solvent, and *background* is the background level. The outer |
---|
| 44 | radius of the shell is given by $R+T$ and the total length of the outer |
---|
| 45 | shell is given by $L+2T$. $J1$ is the first order Bessel function. |
---|
| 46 | |
---|
[19dcb933] | 47 | .. _core-shell-cylinder-geometry: |
---|
| 48 | |
---|
| 49 | .. figure:: img/core_shell_cylinder_geometry.jpg |
---|
[5d4777d] | 50 | |
---|
| 51 | Core shell cylinder schematic. |
---|
| 52 | |
---|
| 53 | To provide easy access to the orientation of the core-shell cylinder, we |
---|
| 54 | define the axis of the cylinder using two angles $\theta$ and $\phi$. As |
---|
| 55 | for the case of the cylinder, those angles are defined in |
---|
[19dcb933] | 56 | :num:`figure #cylinder-orientation`. |
---|
[5d4777d] | 57 | |
---|
| 58 | NB: The 2nd virial coefficient of the cylinder is calculated based on |
---|
| 59 | the radius and 2 length values, and used as the effective radius for |
---|
[eb69cce] | 60 | $S(q)$ when $P(q) \cdot S(q)$ is applied. |
---|
[5d4777d] | 61 | |
---|
[eb69cce] | 62 | The $\theta$ and $\phi$ parameters are not used for the 1D output. |
---|
[5d4777d] | 63 | |
---|
| 64 | Validation |
---|
| 65 | ---------- |
---|
| 66 | |
---|
| 67 | Validation of our code was done by comparing the output of the 1D model to |
---|
| 68 | the output of the software provided by the NIST (Kline, 2006). |
---|
[19dcb933] | 69 | :num:`Figure #core-shell-cylinder-1d` shows a comparison |
---|
[5d4777d] | 70 | of the 1D output of our model and the output of the NIST software. |
---|
| 71 | |
---|
[19dcb933] | 72 | .. _core-shell-cylinder-1d: |
---|
[5d4777d] | 73 | |
---|
[19dcb933] | 74 | .. figure:: img/core_shell_cylinder_1d.jpg |
---|
[5d4777d] | 75 | |
---|
| 76 | Comparison of the SasView scattering intensity for a core-shell cylinder |
---|
| 77 | with the output of the NIST SANS analysis software. The parameters were |
---|
[19dcb933] | 78 | set to: *scale* = 1.0 |Ang|, *radius* = 20 |Ang|, *thickness* = 10 |Ang|, |
---|
| 79 | *length* =400 |Ang|, *core_sld* =1e-6 |Ang^-2|, *shell_sld* = 4e-6 |Ang^-2|, |
---|
| 80 | *solvent_sld* = 1e-6 |Ang^-2|, and *background* = 0.01 |cm^-1|. |
---|
[5d4777d] | 81 | |
---|
| 82 | Averaging over a distribution of orientation is done by evaluating the |
---|
| 83 | equation above. Since we have no other software to compare the |
---|
| 84 | implementation of the intensity for fully oriented cylinders, we can |
---|
| 85 | compare the result of averaging our 2D output using a uniform |
---|
[19dcb933] | 86 | distribution $p(\theta,\phi) = 1.0$. |
---|
| 87 | :num:`Figure #core-shell-cylinder-2d` shows the result |
---|
[5d4777d] | 88 | of such a cross-check. |
---|
| 89 | |
---|
[19dcb933] | 90 | .. _core-shell-cylinder-2d: |
---|
[5d4777d] | 91 | |
---|
[19dcb933] | 92 | .. figure:: img/core_shell_cylinder_2d.jpg |
---|
[5d4777d] | 93 | |
---|
| 94 | Comparison of the intensity for uniformly distributed core-shell |
---|
| 95 | cylinders calculated from our 2D model and the intensity from the |
---|
[19dcb933] | 96 | NIST SANS analysis software. The parameters used were: *scale* = 1.0, |
---|
| 97 | *radius* = 20 |Ang|, *thickness* = 10 |Ang|, *length* = 400 |Ang|, |
---|
| 98 | *core_sld* = 1e-6 |Ang^-2|, *shell_sld* = 4e-6 |Ang^-2|, |
---|
| 99 | *solvent_sld* = 1e-6 |Ang^-2|, and *background* = 0.0 |cm^-1|. |
---|
[5d4777d] | 100 | |
---|
| 101 | 2013/11/26 - Description reviewed by Heenan, R. |
---|
| 102 | """ |
---|
| 103 | |
---|
| 104 | from numpy import pi, inf |
---|
| 105 | |
---|
[19dcb933] | 106 | name = "core_shell_cylinder" |
---|
[5d4777d] | 107 | title = "Right circular cylinder with a core-shell scattering length density profile." |
---|
| 108 | description = """ |
---|
| 109 | P(q,alpha)= scale/Vs*f(q)^(2) + background, |
---|
| 110 | where: f(q)= 2(core_sld - solvant_sld) |
---|
[485aee2] | 111 | * Vc*sin[qLcos(alpha/2)] |
---|
| 112 | /[qLcos(alpha/2)]*J1(qRsin(alpha)) |
---|
| 113 | /[qRsin(alpha)]+2(shell_sld-solvent_sld) |
---|
| 114 | *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T) |
---|
| 115 | *cos(alpha/2)]*J1(q(R+T)sin(alpha)) |
---|
| 116 | /q(R+T)sin(alpha)] |
---|
| 117 | |
---|
| 118 | alpha:is the angle between the axis of |
---|
| 119 | the cylinder and the q-vector |
---|
| 120 | Vs: the volume of the outer shell |
---|
| 121 | Vc: the volume of the core |
---|
| 122 | L: the length of the core |
---|
| 123 | shell_sld: the scattering length density of the shell |
---|
| 124 | solvent_sld: the scattering length density of the solvent |
---|
| 125 | background: the background |
---|
| 126 | T: the thickness |
---|
| 127 | R+T: is the outer radius |
---|
| 128 | L+2T: The total length of the outershell |
---|
| 129 | J1: the first order Bessel function |
---|
| 130 | theta: axis_theta of the cylinder |
---|
| 131 | phi: the axis_phi of the cylinder |
---|
[5d4777d] | 132 | """ |
---|
[a5d0d00] | 133 | category = "shape:cylinder" |
---|
[5d4777d] | 134 | |
---|
[485aee2] | 135 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 136 | parameters = [["core_sld", "1e-6/Ang^2", 4, [-inf, inf], "", |
---|
| 137 | "Cylinder core scattering length density"], |
---|
| 138 | ["shell_sld", "1e-6/Ang^2", 4, [-inf, inf], "", |
---|
| 139 | "Cylinder shell scattering length density"], |
---|
| 140 | ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", |
---|
| 141 | "Solvent scattering length density"], |
---|
| 142 | ["radius", "Ang", 20, [0, inf], "volume", |
---|
| 143 | "Cylinder core radius"], |
---|
| 144 | ["thickness", "Ang", 20, [0, inf], "volume", |
---|
| 145 | "Cylinder shell thickness"], |
---|
| 146 | ["length", "Ang", 400, [0, inf], "volume", |
---|
| 147 | "Cylinder length"], |
---|
| 148 | ["theta", "degrees", 60, [-inf, inf], "orientation", |
---|
| 149 | "In plane angle"], |
---|
| 150 | ["phi", "degrees", 60, [-inf, inf], "orientation", |
---|
| 151 | "Out of plane angle"], |
---|
| 152 | ] |
---|
| 153 | |
---|
| 154 | source = ["lib/J1.c", "lib/gauss76.c", "core_shell_cylinder.c"] |
---|
[5d4777d] | 155 | |
---|
| 156 | def ER(radius, thickness, length): |
---|
| 157 | radius = radius + thickness |
---|
[485aee2] | 158 | length = length + 2 * thickness |
---|
| 159 | ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius)) |
---|
| 160 | return 0.5 * (ddd) ** (1. / 3.) |
---|
[5d4777d] | 161 | |
---|
| 162 | def VR(radius, thickness, length): |
---|
[485aee2] | 163 | whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) |
---|
| 164 | core = pi * radius ** 2 * length |
---|
| 165 | return whole, whole - core |
---|
| 166 | |
---|
| 167 | demo = dict(scale=1, background=0, |
---|
| 168 | core_sld=6, shell_sld=8, solvent_sld=1, |
---|
| 169 | radius=45, thickness=25, length=340, |
---|
| 170 | theta=30, phi=15, |
---|
| 171 | radius_pd=.2, radius_pd_n=1, |
---|
| 172 | length_pd=.2, length_pd_n=10, |
---|
| 173 | thickness_pd=.2, thickness_pd_n=10, |
---|
| 174 | theta_pd=15, theta_pd_n=45, |
---|
| 175 | phi_pd=15, phi_pd_n=1) |
---|
[a503bfd] | 176 | oldname = 'CoreShellCylinderModel' |
---|
| 177 | oldpars = dict(theta='axis_theta', phi='axis_phi') |
---|