[81dd619] | 1 | r""" |
---|
| 2 | This model provides the form factor, $P(q)$, for a core shell ellipsoid (below) |
---|
[29172aa] | 3 | where the form factor is normalized by the volume of the outer [CHECK]. |
---|
[81dd619] | 4 | |
---|
| 5 | .. math:: |
---|
| 6 | |
---|
| 7 | P(q) = scale * \left<f^2\right>/V + background |
---|
| 8 | |
---|
[29172aa] | 9 | where the volume $V = (4/3)\pi(R_{major\_outer}R_{minor\_outer}^2)$ and the averaging $< >$ is |
---|
[81dd619] | 10 | applied over all orientations for 1D. |
---|
| 11 | |
---|
[5111921] | 12 | .. figure:: img/core_shell_ellipsoid_geometry.png |
---|
[81dd619] | 13 | |
---|
| 14 | The returned value is in units of $cm^{-1}$, on absolute scale. |
---|
| 15 | |
---|
| 16 | Definition |
---|
| 17 | ---------- |
---|
| 18 | |
---|
| 19 | The form factor calculated is |
---|
| 20 | |
---|
| 21 | .. math:: |
---|
| 22 | |
---|
| 23 | P(q) = \frac{scale}{V}\int_0^1 |
---|
[29172aa] | 24 | \left|F(q,r_{minor\_core},r_{major\_core},\alpha) + F(q,r_{major\_outer},r_{major\_outer},\alpha)\right|^2d\alpha + background |
---|
[81dd619] | 25 | |
---|
[29172aa] | 26 | \left|F(q,r_{minor},r_{major},\alpha)\right|=(4\pi/3)r_{major}r_{minor}^2 \Delta \rho \cdot (3j_1(u)/u) |
---|
[81dd619] | 27 | |
---|
[29172aa] | 28 | u = q\left[ r_{major}^2\alpha ^2 + r_{minor}^2(1-\alpha ^2)\right]^{1/2} |
---|
[81dd619] | 29 | |
---|
| 30 | where |
---|
| 31 | |
---|
| 32 | .. math:: |
---|
| 33 | |
---|
| 34 | j_1(u)=(\sin x - x \cos x)/x^2 |
---|
| 35 | |
---|
| 36 | To provide easy access to the orientation of the core-shell ellipsoid, |
---|
| 37 | we define the axis of the solid ellipsoid using two angles $\theta$ and $\phi$. |
---|
[2f0c07d] | 38 | These angles are defined as for |
---|
| 39 | :ref:`cylinder orientation <cylinder-angle-definition>`. |
---|
[81dd619] | 40 | The contrast is defined as SLD(core) - SLD(shell) and SLD(shell) - SLD(solvent). |
---|
| 41 | |
---|
| 42 | In the parameters, *equat_core* = equatorial core radius, *polar_core* = |
---|
| 43 | polar core radius, *equat_shell* = $r_{min}$ (or equatorial outer radius), |
---|
| 44 | and *polar_shell* = $r_{maj}$ (or polar outer radius). |
---|
| 45 | |
---|
[29172aa] | 46 | Note:It is the users' responsibility to ensure that shell radii are larger than |
---|
| 47 | the core radii, especially if both are polydisperse, in which case the |
---|
| 48 | core_shell_ellipsoid_xt model may be much better. |
---|
| 49 | |
---|
| 50 | |
---|
[81dd619] | 51 | .. note:: |
---|
| 52 | The 2nd virial coefficient of the solid ellipsoid is calculated based on |
---|
| 53 | the *radius_a* (= *polar_shell)* and *radius_b (= equat_shell)* values, |
---|
| 54 | and used as the effective radius for *S(Q)* when $P(Q) * S(Q)$ is applied. |
---|
| 55 | |
---|
[2f0c07d] | 56 | .. figure:: img/core_shell_ellipsoid_angle_projection.jpg |
---|
[81dd619] | 57 | |
---|
| 58 | The angles for oriented core_shell_ellipsoid. |
---|
| 59 | |
---|
| 60 | Our model uses the form factor calculations implemented in a c-library provided |
---|
| 61 | by the NIST Center for Neutron Research (Kline, 2006). |
---|
| 62 | |
---|
| 63 | References |
---|
| 64 | ---------- |
---|
| 65 | |
---|
| 66 | M Kotlarchyk, S H Chen, *J. Chem. Phys.*, 79 (1983) 2461 |
---|
| 67 | |
---|
| 68 | S J Berr, *Phys. Chem.*, 91 (1987) 4760 |
---|
| 69 | |
---|
| 70 | """ |
---|
| 71 | |
---|
| 72 | from numpy import inf, sin, cos, pi |
---|
| 73 | |
---|
| 74 | name = "core_shell_ellipsoid" |
---|
| 75 | title = "Form factor for an spheroid ellipsoid particle with a core shell structure." |
---|
| 76 | description = """ |
---|
| 77 | [SpheroidCoreShellModel] Calculates the form factor for an spheroid |
---|
| 78 | ellipsoid particle with a core_shell structure. |
---|
| 79 | The form factor is averaged over all possible |
---|
| 80 | orientations of the ellipsoid such that P(q) |
---|
| 81 | = scale*<f^2>/Vol + bkg, where f is the |
---|
| 82 | single particle scattering amplitude. |
---|
| 83 | [Parameters]: |
---|
[29172aa] | 84 | equat_core = equatorial radius of core, Rminor_core, |
---|
| 85 | polar_core = polar radius of core, Rmajor_core, |
---|
| 86 | equat_shell = equatorial radius of shell, Rminor_outer, |
---|
| 87 | polar_shell = polar radius of shell, Rmajor_outer, |
---|
| 88 | sld_core = scattering length density of core, |
---|
| 89 | sld_shell = scattering length density of shell, |
---|
| 90 | sld_solvent = scattering length density of solvent, |
---|
[81dd619] | 91 | background = Incoherent bkg |
---|
| 92 | scale =scale |
---|
| 93 | Note:It is the users' responsibility to ensure |
---|
[29172aa] | 94 | that shell radii are larger than core radii, |
---|
| 95 | especially if both are polydisperse. |
---|
[81dd619] | 96 | oblate: polar radius < equatorial radius |
---|
| 97 | prolate : polar radius > equatorial radius |
---|
| 98 | """ |
---|
| 99 | category = "shape:ellipsoid" |
---|
| 100 | |
---|
[13ed84c] | 101 | single = False # TODO: maybe using sph_j1c inside gfn would help? |
---|
[81dd619] | 102 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 103 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 104 | parameters = [ |
---|
[29172aa] | 105 | ["equat_core", "Ang", 200, [0, inf], "volume", "Equatorial radius of core, Rminor_core "], |
---|
| 106 | ["polar_core", "Ang", 10, [0, inf], "volume", "Polar radius of core, Rmajor_core"], |
---|
| 107 | ["equat_shell", "Ang", 250, [0, inf], "volume", "Equatorial radius of shell, Rminor_outer "], |
---|
| 108 | ["polar_shell", "Ang", 30, [0, inf], "volume", "Polar radius of shell, Rmajor_outer"], |
---|
| 109 | ["sld_core", "1e-6/Ang^2", 2, [-inf, inf], "sld", "Core scattering length density"], |
---|
| 110 | ["sld_shell", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Shell scattering length density"], |
---|
| 111 | ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent scattering length density"], |
---|
[81dd619] | 112 | ["theta", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation wrt incoming beam"], |
---|
| 113 | ["phi", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation in the plane of the detector"], |
---|
| 114 | ] |
---|
| 115 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 116 | |
---|
[177c1a1] | 117 | source = ["lib/sph_j1c.c", "lib/gfn.c", "lib/gauss76.c", "core_shell_ellipsoid.c"] |
---|
[81dd619] | 118 | |
---|
[27fade8] | 119 | def ER(equat_core, polar_core, equat_shell, polar_shell): |
---|
[65bf704] | 120 | """ |
---|
| 121 | Returns the effective radius used in the S*P calculation |
---|
| 122 | """ |
---|
| 123 | import numpy as np |
---|
| 124 | from .ellipsoid import ER as ellipsoid_ER |
---|
[27fade8] | 125 | return ellipsoid_ER(polar_shell, equat_shell) |
---|
[65bf704] | 126 | |
---|
| 127 | |
---|
[81dd619] | 128 | demo = dict(scale=1, background=0.001, |
---|
| 129 | equat_core=200.0, |
---|
| 130 | polar_core=10.0, |
---|
| 131 | equat_shell=250.0, |
---|
| 132 | polar_shell=30.0, |
---|
[29172aa] | 133 | sld_core=2.0, |
---|
| 134 | sld_shell=1.0, |
---|
| 135 | sld_solvent=6.3, |
---|
[81dd619] | 136 | theta=0, |
---|
| 137 | phi=0) |
---|
| 138 | |
---|
| 139 | q = 0.1 |
---|
| 140 | phi = pi/6 |
---|
| 141 | qx = q*cos(phi) |
---|
| 142 | qy = q*sin(phi) |
---|
| 143 | |
---|
| 144 | tests = [ |
---|
| 145 | # Accuracy tests based on content in test/utest_other_models.py |
---|
| 146 | [{'equat_core': 200.0, |
---|
| 147 | 'polar_core': 20.0, |
---|
| 148 | 'equat_shell': 250.0, |
---|
| 149 | 'polar_shell': 30.0, |
---|
[29172aa] | 150 | 'sld_core': 2.0, |
---|
| 151 | 'sld_shell': 1.0, |
---|
| 152 | 'sld_solvent': 6.3, |
---|
[81dd619] | 153 | 'background': 0.001, |
---|
| 154 | 'scale': 1.0, |
---|
| 155 | }, 1.0, 0.00189402], |
---|
| 156 | |
---|
| 157 | # Additional tests with larger range of parameters |
---|
| 158 | [{'background': 0.01}, 0.1, 8.86741], |
---|
| 159 | |
---|
| 160 | [{'equat_core': 20.0, |
---|
| 161 | 'polar_core': 200.0, |
---|
| 162 | 'equat_shell': 54.0, |
---|
| 163 | 'polar_shell': 3.0, |
---|
[29172aa] | 164 | 'sld_core': 20.0, |
---|
| 165 | 'sld_shell': 10.0, |
---|
| 166 | 'sld_solvent': 6.0, |
---|
[81dd619] | 167 | 'background': 0.0, |
---|
| 168 | 'scale': 1.0, |
---|
| 169 | }, 0.01, 26150.4], |
---|
| 170 | |
---|
| 171 | [{'background': 0.001}, (0.4, 0.5), 0.00170471], |
---|
| 172 | |
---|
| 173 | [{'equat_core': 20.0, |
---|
| 174 | 'polar_core': 200.0, |
---|
| 175 | 'equat_shell': 54.0, |
---|
| 176 | 'polar_shell': 3.0, |
---|
[29172aa] | 177 | 'sld_core': 20.0, |
---|
| 178 | 'sld_shell': 10.0, |
---|
| 179 | 'sld_solvent': 6.0, |
---|
[81dd619] | 180 | 'background': 0.01, |
---|
| 181 | 'scale': 0.01, |
---|
| 182 | }, (qx, qy), 0.105764], |
---|
| 183 | ] |
---|