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