[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 | |
---|
[5031ca3] | 13 | The geometric parameters of this model are |
---|
[81dd619] | 14 | |
---|
[b99734a] | 15 | *radius_equat_core =* equatorial core radius *= Rminor_core* |
---|
[81dd619] | 16 | |
---|
[5031ca3] | 17 | *X_core = polar_core / radius_equat_core = Rmajor_core / Rminor_core* |
---|
[81dd619] | 18 | |
---|
[5031ca3] | 19 | *Thick_shell = equat_outer - radius_equat_core = Rminor_outer - Rminor_core* |
---|
[81dd619] | 20 | |
---|
[5031ca3] | 21 | *XpolarShell = Tpolar_shell / Thick_shell = (Rmajor_outer - Rmajor_core)/ |
---|
| 22 | (Rminor_outer - Rminor_core)* |
---|
[81dd619] | 23 | |
---|
[5031ca3] | 24 | In terms of the original radii |
---|
[81dd619] | 25 | |
---|
[5031ca3] | 26 | *polar_core = radius_equat_core * X_core* |
---|
[81dd619] | 27 | |
---|
[5031ca3] | 28 | *equat_shell = radius_equat_core + Thick_shell* |
---|
[29172aa] | 29 | |
---|
[5031ca3] | 30 | *polar_shell = radius_equat_core * X_core + Thick_shell * XpolarShell* |
---|
[29172aa] | 31 | |
---|
[5031ca3] | 32 | (where we note that "shell" perhaps confusingly, relates to the outer radius) |
---|
| 33 | When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate. |
---|
| 34 | *X_core = 1* is a spherical core. |
---|
[81dd619] | 35 | |
---|
[5031ca3] | 36 | For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness |
---|
| 37 | pro-rata with the radius *XpolarShell = X_core*. |
---|
[81dd619] | 38 | |
---|
[5031ca3] | 39 | When including an $S(q)$, the radius in $S(q)$ is calculated to be that of |
---|
| 40 | a sphere with the same 2nd virial coefficient of the outer surface of the |
---|
| 41 | ellipsoid. This may have some undesirable effects if the aspect ratio of the |
---|
| 42 | ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$ |
---|
| 43 | - which assumes spheres - will not in any case be valid. |
---|
[81dd619] | 44 | |
---|
[5031ca3] | 45 | If SAS data are in absolute units, and the SLDs are correct, then scale should |
---|
| 46 | be the total volume fraction of the "outer particle". When $S(q)$ is introduced |
---|
| 47 | this moves to the $S(q)$ volume fraction, and scale should then be 1.0, |
---|
| 48 | or contain some other units conversion factor (for example, if you have SAXS data). |
---|
[81dd619] | 49 | |
---|
| 50 | References |
---|
| 51 | ---------- |
---|
| 52 | |
---|
[5031ca3] | 53 | R K Heenan, 2015, reparametrised the core_shell_ellipsoid model |
---|
[81dd619] | 54 | |
---|
| 55 | """ |
---|
| 56 | |
---|
| 57 | from numpy import inf, sin, cos, pi |
---|
| 58 | |
---|
[b99734a] | 59 | name = "core_shell_ellipsoid" |
---|
[81dd619] | 60 | title = "Form factor for an spheroid ellipsoid particle with a core shell structure." |
---|
| 61 | description = """ |
---|
[b99734a] | 62 | [core_shell_ellipsoid] Calculates the form factor for an spheroid |
---|
[5031ca3] | 63 | ellipsoid particle with a core_shell structure. |
---|
| 64 | The form factor is averaged over all possible |
---|
| 65 | orientations of the ellipsoid such that P(q) |
---|
| 66 | = scale*<f^2>/Vol + bkg, where f is the |
---|
| 67 | single particle scattering amplitude. |
---|
| 68 | [Parameters]: |
---|
| 69 | radius_equat_core = equatorial radius of core, |
---|
| 70 | x_core = ratio of core polar/equatorial radii, |
---|
| 71 | thick_shell = equatorial radius of outer surface, |
---|
| 72 | x_polar_shell = ratio of polar shell thickness to equatorial shell thickness, |
---|
| 73 | sld_core = SLD_core |
---|
| 74 | sld_shell = SLD_shell |
---|
| 75 | sld_solvent = SLD_solvent |
---|
| 76 | background = Incoherent bkg |
---|
| 77 | scale =scale |
---|
| 78 | Note:It is the users' responsibility to ensure |
---|
| 79 | that shell radii are larger than core radii. |
---|
| 80 | oblate: polar radius < equatorial radius |
---|
| 81 | prolate : polar radius > equatorial radius - this new model will make this easier |
---|
| 82 | and polydispersity integrals more logical (as previously the shell could disappear). |
---|
[81dd619] | 83 | """ |
---|
| 84 | category = "shape:ellipsoid" |
---|
| 85 | |
---|
| 86 | # pylint: disable=bad-whitespace, line-too-long |
---|
[5031ca3] | 87 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
[81dd619] | 88 | parameters = [ |
---|
[5031ca3] | 89 | ["radius_equat_core","Ang", 20, [0, inf], "volume", "Equatorial radius of core"], |
---|
| 90 | ["x_core", "None", 3, [0, inf], "volume", "axial ratio of core, X = r_polar/r_equatorial"], |
---|
| 91 | ["thick_shell", "Ang", 30, [0, inf], "volume", "thickness of shell at equator"], |
---|
| 92 | ["x_polar_shell", "", 1, [0, inf], "volume", "ratio of thickness of shell at pole to that at equator"], |
---|
| 93 | ["sld_core", "1e-6/Ang^2", 2, [-inf, inf], "sld", "Core scattering length density"], |
---|
| 94 | ["sld_shell", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Shell scattering length density"], |
---|
| 95 | ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent scattering length density"], |
---|
| 96 | ["theta", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation wrt incoming beam"], |
---|
| 97 | ["phi", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation in the plane of the detector"], |
---|
[81dd619] | 98 | ] |
---|
| 99 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 100 | |
---|
[5031ca3] | 101 | source = ["lib/sph_j1c.c", "lib/gfn.c", "lib/gauss76.c", |
---|
[b99734a] | 102 | "core_shell_ellipsoid.c"] |
---|
[81dd619] | 103 | |
---|
[5031ca3] | 104 | def ER(radius_equat_core, x_core, thick_shell, x_polar_shell): |
---|
[65bf704] | 105 | """ |
---|
| 106 | Returns the effective radius used in the S*P calculation |
---|
| 107 | """ |
---|
| 108 | from .ellipsoid import ER as ellipsoid_ER |
---|
[5031ca3] | 109 | polar_outer = radius_equat_core*x_core + thick_shell*x_polar_shell |
---|
| 110 | equat_outer = radius_equat_core + thick_shell |
---|
| 111 | return ellipsoid_ER(polar_outer, equat_outer) |
---|
[65bf704] | 112 | |
---|
| 113 | |
---|
[5031ca3] | 114 | demo = dict(scale=0.05, background=0.001, |
---|
| 115 | radius_equat_core=20.0, |
---|
| 116 | x_core=3.0, |
---|
| 117 | thick_shell=30.0, |
---|
| 118 | x_polar_shell=1.0, |
---|
[29172aa] | 119 | sld_core=2.0, |
---|
| 120 | sld_shell=1.0, |
---|
| 121 | sld_solvent=6.3, |
---|
[81dd619] | 122 | theta=0, |
---|
| 123 | phi=0) |
---|
| 124 | |
---|
| 125 | q = 0.1 |
---|
| 126 | phi = pi/6 |
---|
| 127 | qx = q*cos(phi) |
---|
| 128 | qy = q*sin(phi) |
---|
| 129 | |
---|
| 130 | tests = [ |
---|
[5031ca3] | 131 | # Accuracy tests based on content in test/utest_coreshellellipsoidXTmodel.py |
---|
[2222134] | 132 | [{'radius_equat_core': 200.0, |
---|
[5031ca3] | 133 | 'x_core': 0.1, |
---|
| 134 | 'thick_shell': 50.0, |
---|
| 135 | 'x_polar_shell': 0.2, |
---|
[29172aa] | 136 | 'sld_core': 2.0, |
---|
| 137 | 'sld_shell': 1.0, |
---|
| 138 | 'sld_solvent': 6.3, |
---|
[81dd619] | 139 | 'background': 0.001, |
---|
| 140 | 'scale': 1.0, |
---|
| 141 | }, 1.0, 0.00189402], |
---|
| 142 | |
---|
| 143 | # Additional tests with larger range of parameters |
---|
[5031ca3] | 144 | [{'background': 0.01}, 0.1, 11.6915], |
---|
[81dd619] | 145 | |
---|
[2222134] | 146 | [{'radius_equat_core': 20.0, |
---|
[5031ca3] | 147 | 'x_core': 200.0, |
---|
| 148 | 'thick_shell': 54.0, |
---|
| 149 | 'x_polar_shell': 3.0, |
---|
[29172aa] | 150 | 'sld_core': 20.0, |
---|
| 151 | 'sld_shell': 10.0, |
---|
| 152 | 'sld_solvent': 6.0, |
---|
[81dd619] | 153 | 'background': 0.0, |
---|
| 154 | 'scale': 1.0, |
---|
[5031ca3] | 155 | }, 0.01, 8688.53], |
---|
[81dd619] | 156 | |
---|
[5031ca3] | 157 | [{'background': 0.001}, (0.4, 0.5), 0.00690673], |
---|
[81dd619] | 158 | |
---|
[2222134] | 159 | [{'radius_equat_core': 20.0, |
---|
[5031ca3] | 160 | 'x_core': 200.0, |
---|
| 161 | 'thick_shell': 54.0, |
---|
| 162 | 'x_polar_shell': 3.0, |
---|
[29172aa] | 163 | 'sld_core': 20.0, |
---|
| 164 | 'sld_shell': 10.0, |
---|
| 165 | 'sld_solvent': 6.0, |
---|
[81dd619] | 166 | 'background': 0.01, |
---|
| 167 | 'scale': 0.01, |
---|
[5031ca3] | 168 | }, (qx, qy), 0.0100002], |
---|
[81dd619] | 169 | ] |
---|