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