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