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