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