[81dd619] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | |
---|
[b99734a] | 5 | Parameters for this model are the core axial ratio X and a shell thickness, |
---|
| 6 | which are more often what we would like to determine and makes the model |
---|
| 7 | better behaved, particularly when polydispersity is applied than the four |
---|
| 8 | independent radii used in the original parameterization of this model. |
---|
| 9 | |
---|
| 10 | |
---|
[5031ca3] | 11 | .. figure:: img/core_shell_ellipsoid_geometry.png |
---|
[81dd619] | 12 | |
---|
[9272cbd] | 13 | The geometric parameters of this model are shown in the diagram above, which |
---|
[416f5c7] | 14 | shows (a) a cut through at the circular equator and (b) a cross section through |
---|
[9272cbd] | 15 | the poles, of a prolate ellipsoid. |
---|
[81dd619] | 16 | |
---|
[5031ca3] | 17 | When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate. |
---|
| 18 | *X_core = 1* is a spherical core. |
---|
[81dd619] | 19 | |
---|
[5031ca3] | 20 | For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness |
---|
[416f5c7] | 21 | pro-rata with the radius set or constrain *XpolarShell = X_core*. |
---|
[81dd619] | 22 | |
---|
[5031ca3] | 23 | When including an $S(q)$, the radius in $S(q)$ is calculated to be that of |
---|
| 24 | a sphere with the same 2nd virial coefficient of the outer surface of the |
---|
| 25 | ellipsoid. This may have some undesirable effects if the aspect ratio of the |
---|
| 26 | ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$ |
---|
[2a0b2b1] | 27 | - which assumes spheres - will not in any case be valid. Generating a |
---|
| 28 | custom product model will enable separate effective volume fraction and effective |
---|
[9272cbd] | 29 | radius in the $S(q)$. |
---|
[81dd619] | 30 | |
---|
[5031ca3] | 31 | If SAS data are in absolute units, and the SLDs are correct, then scale should |
---|
| 32 | be the total volume fraction of the "outer particle". When $S(q)$ is introduced |
---|
| 33 | this moves to the $S(q)$ volume fraction, and scale should then be 1.0, |
---|
| 34 | or contain some other units conversion factor (for example, if you have SAXS data). |
---|
[81dd619] | 35 | |
---|
[416f5c7] | 36 | The calculation of intensity follows that for the solid ellipsoid, but with separate |
---|
| 37 | terms for the core-shell and shell-solvent boundaries. |
---|
| 38 | |
---|
| 39 | .. math:: |
---|
| 40 | |
---|
| 41 | P(q,\alpha) = \frac{\text{scale}}{V} F^2(q,\alpha) + \text{background} |
---|
| 42 | |
---|
| 43 | where |
---|
| 44 | |
---|
| 45 | .. math:: |
---|
[2a0b2b1] | 46 | \begin{align} |
---|
[416f5c7] | 47 | F(q,\alpha) = &f(q,radius\_equat\_core,radius\_equat\_core.x\_core,\alpha) \\ |
---|
| 48 | &+ f(q,radius\_equat\_core + thick\_shell,radius\_equat\_core.x\_core + thick\_shell.x\_polar\_shell,\alpha) |
---|
[2a0b2b1] | 49 | \end{align} |
---|
[416f5c7] | 50 | |
---|
| 51 | where |
---|
[2a0b2b1] | 52 | |
---|
[416f5c7] | 53 | .. math:: |
---|
| 54 | |
---|
| 55 | f(q,R_e,R_p,\alpha) = \frac{3 \Delta \rho V (\sin[qr(R_p,R_e,\alpha)] |
---|
| 56 | - \cos[qr(R_p,R_e,\alpha)])} |
---|
| 57 | {[qr(R_p,R_e,\alpha)]^3} |
---|
| 58 | |
---|
| 59 | and |
---|
| 60 | |
---|
| 61 | .. math:: |
---|
| 62 | |
---|
| 63 | r(R_e,R_p,\alpha) = \left[ R_e^2 \sin^2 \alpha |
---|
| 64 | + R_p^2 \cos^2 \alpha \right]^{1/2} |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | $\alpha$ is the angle between the axis of the ellipsoid and $\vec q$, |
---|
| 68 | $V = (4/3)\pi R_pR_e^2$ is the volume of the ellipsoid , $R_p$ is the polar radius along the |
---|
| 69 | rotational axis of the ellipsoid, $R_e$ is the equatorial radius perpendicular |
---|
| 70 | to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the |
---|
| 71 | scattering length density difference, either $(sld\_core - sld\_shell)$ or $(sld\_shell - sld\_solvent)$. |
---|
| 72 | |
---|
| 73 | For randomly oriented particles: |
---|
| 74 | |
---|
| 75 | .. math:: |
---|
| 76 | |
---|
| 77 | F^2(q)=\int_{0}^{\pi/2}{F^2(q,\alpha)\sin(\alpha)d\alpha} |
---|
| 78 | |
---|
[2a0b2b1] | 79 | For oriented ellipsoids the *theta*, *phi* and *psi* orientation parameters will appear when fitting 2D data, |
---|
[9802ab3] | 80 | see the :ref:`elliptical-cylinder` model for further information. |
---|
[416f5c7] | 81 | |
---|
[81dd619] | 82 | References |
---|
| 83 | ---------- |
---|
[9272cbd] | 84 | see for example: |
---|
| 85 | Kotlarchyk, M.; Chen, S.-H. J. Chem. Phys., 1983, 79, 2461. |
---|
| 86 | Berr, S. J. Phys. Chem., 1987, 91, 4760. |
---|
| 87 | |
---|
| 88 | Authorship and Verification |
---|
| 89 | ---------------------------- |
---|
[81dd619] | 90 | |
---|
[9272cbd] | 91 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
| 92 | * **Last Modified by:** Richard Heenan (reparametrised model) **Date:** 2015 |
---|
| 93 | * **Last Reviewed by:** Richard Heenan **Date:** October 6, 2016 |
---|
[81dd619] | 94 | |
---|
| 95 | """ |
---|
| 96 | |
---|
| 97 | from numpy import inf, sin, cos, pi |
---|
| 98 | |
---|
[b99734a] | 99 | name = "core_shell_ellipsoid" |
---|
[81dd619] | 100 | title = "Form factor for an spheroid ellipsoid particle with a core shell structure." |
---|
| 101 | description = """ |
---|
[b99734a] | 102 | [core_shell_ellipsoid] Calculates the form factor for an spheroid |
---|
[5031ca3] | 103 | ellipsoid particle with a core_shell structure. |
---|
| 104 | The form factor is averaged over all possible |
---|
| 105 | orientations of the ellipsoid such that P(q) |
---|
| 106 | = scale*<f^2>/Vol + bkg, where f is the |
---|
| 107 | single particle scattering amplitude. |
---|
| 108 | [Parameters]: |
---|
| 109 | radius_equat_core = equatorial radius of core, |
---|
| 110 | x_core = ratio of core polar/equatorial radii, |
---|
| 111 | thick_shell = equatorial radius of outer surface, |
---|
| 112 | x_polar_shell = ratio of polar shell thickness to equatorial shell thickness, |
---|
| 113 | sld_core = SLD_core |
---|
| 114 | sld_shell = SLD_shell |
---|
| 115 | sld_solvent = SLD_solvent |
---|
| 116 | background = Incoherent bkg |
---|
| 117 | scale =scale |
---|
| 118 | Note:It is the users' responsibility to ensure |
---|
| 119 | that shell radii are larger than core radii. |
---|
| 120 | oblate: polar radius < equatorial radius |
---|
| 121 | prolate : polar radius > equatorial radius - this new model will make this easier |
---|
| 122 | and polydispersity integrals more logical (as previously the shell could disappear). |
---|
[81dd619] | 123 | """ |
---|
| 124 | category = "shape:ellipsoid" |
---|
| 125 | |
---|
| 126 | # pylint: disable=bad-whitespace, line-too-long |
---|
[5031ca3] | 127 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
[81dd619] | 128 | parameters = [ |
---|
[73e08ae] | 129 | ["radius_equat_core","Ang", 20, [0, inf], "volume", "Equatorial radius of core"], |
---|
[5031ca3] | 130 | ["x_core", "None", 3, [0, inf], "volume", "axial ratio of core, X = r_polar/r_equatorial"], |
---|
| 131 | ["thick_shell", "Ang", 30, [0, inf], "volume", "thickness of shell at equator"], |
---|
| 132 | ["x_polar_shell", "", 1, [0, inf], "volume", "ratio of thickness of shell at pole to that at equator"], |
---|
| 133 | ["sld_core", "1e-6/Ang^2", 2, [-inf, inf], "sld", "Core scattering length density"], |
---|
| 134 | ["sld_shell", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Shell scattering length density"], |
---|
| 135 | ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent scattering length density"], |
---|
[9b79f29] | 136 | ["theta", "degrees", 0, [-360, 360], "orientation", "elipsoid axis to beam angle"], |
---|
| 137 | ["phi", "degrees", 0, [-360, 360], "orientation", "rotation about beam"], |
---|
[81dd619] | 138 | ] |
---|
| 139 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 140 | |
---|
[2a0b2b1] | 141 | source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "core_shell_ellipsoid.c"] |
---|
[81dd619] | 142 | |
---|
[5031ca3] | 143 | def ER(radius_equat_core, x_core, thick_shell, x_polar_shell): |
---|
[65bf704] | 144 | """ |
---|
| 145 | Returns the effective radius used in the S*P calculation |
---|
| 146 | """ |
---|
| 147 | from .ellipsoid import ER as ellipsoid_ER |
---|
[5031ca3] | 148 | polar_outer = radius_equat_core*x_core + thick_shell*x_polar_shell |
---|
| 149 | equat_outer = radius_equat_core + thick_shell |
---|
| 150 | return ellipsoid_ER(polar_outer, equat_outer) |
---|
[65bf704] | 151 | |
---|
| 152 | |
---|
[5031ca3] | 153 | demo = dict(scale=0.05, background=0.001, |
---|
| 154 | radius_equat_core=20.0, |
---|
| 155 | x_core=3.0, |
---|
| 156 | thick_shell=30.0, |
---|
| 157 | x_polar_shell=1.0, |
---|
[29172aa] | 158 | sld_core=2.0, |
---|
| 159 | sld_shell=1.0, |
---|
| 160 | sld_solvent=6.3, |
---|
[81dd619] | 161 | theta=0, |
---|
| 162 | phi=0) |
---|
| 163 | |
---|
| 164 | q = 0.1 |
---|
[b7e8b94] | 165 | # tests had in old coords theta=0, phi=0; new coords theta=90, phi=0 |
---|
| 166 | qx = q*cos(pi/6.0) |
---|
| 167 | qy = q*sin(pi/6.0) |
---|
| 168 | # 11Jan2017 RKH sorted tests after redefinition of angles |
---|
[fcb33e4] | 169 | tests = [ |
---|
| 170 | # Accuracy tests based on content in test/utest_coreshellellipsoidXTmodel.py |
---|
| 171 | [{'radius_equat_core': 200.0, |
---|
| 172 | 'x_core': 0.1, |
---|
| 173 | 'thick_shell': 50.0, |
---|
| 174 | 'x_polar_shell': 0.2, |
---|
| 175 | 'sld_core': 2.0, |
---|
| 176 | 'sld_shell': 1.0, |
---|
| 177 | 'sld_solvent': 6.3, |
---|
| 178 | 'background': 0.001, |
---|
| 179 | 'scale': 1.0, |
---|
| 180 | }, 1.0, 0.00189402], |
---|
[81dd619] | 181 | |
---|
| 182 | # Additional tests with larger range of parameters |
---|
[fcb33e4] | 183 | [{'background': 0.01}, 0.1, 11.6915], |
---|
| 184 | |
---|
| 185 | [{'radius_equat_core': 20.0, |
---|
| 186 | 'x_core': 200.0, |
---|
| 187 | 'thick_shell': 54.0, |
---|
| 188 | 'x_polar_shell': 3.0, |
---|
| 189 | 'sld_core': 20.0, |
---|
| 190 | 'sld_shell': 10.0, |
---|
| 191 | 'sld_solvent': 6.0, |
---|
| 192 | 'background': 0.0, |
---|
| 193 | 'scale': 1.0, |
---|
| 194 | }, 0.01, 8688.53], |
---|
[7c2935c] | 195 | |
---|
| 196 | # 2D tests |
---|
| 197 | [{'background': 0.001, |
---|
| 198 | 'theta': 90.0, |
---|
| 199 | 'phi': 0.0, |
---|
| 200 | }, (0.4, 0.5), 0.00690673], |
---|
[fcb33e4] | 201 | |
---|
| 202 | [{'radius_equat_core': 20.0, |
---|
| 203 | 'x_core': 200.0, |
---|
| 204 | 'thick_shell': 54.0, |
---|
| 205 | 'x_polar_shell': 3.0, |
---|
| 206 | 'sld_core': 20.0, |
---|
| 207 | 'sld_shell': 10.0, |
---|
| 208 | 'sld_solvent': 6.0, |
---|
| 209 | 'background': 0.01, |
---|
| 210 | 'scale': 0.01, |
---|
[b7e8b94] | 211 | 'theta': 90.0, |
---|
[7c2935c] | 212 | 'phi': 0.0, |
---|
[fcb33e4] | 213 | }, (qx, qy), 0.01000025], |
---|
| 214 | ] |
---|