source: sasmodels/sasmodels/models/core_shell_sphere.py @ 40a87fa

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 40a87fa was 40a87fa, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

lint and latex cleanup

  • Property mode set to 100644
File size: 3.8 KB
Line 
1r"""
2.. _core_shell_sphere:
3
4This model provides the form factor, $P(q)$, for a spherical particle with
5a core-shell structure. The form factor is normalized by the particle volume.
6
7Definition
8----------
9
10The 1D scattering intensity is calculated in the following way (Guinier, 1955)
11
12.. math::
13
14    P(q) = \frac{\text{scale}}{V} F^2(q) + \text{background}
15
16where
17
18.. math::
19
20    F^2(q) = \frac{3}{V_s}\left[
21       V_c(\rho_c-\rho_s)\frac{\sin(qr_c)-qr_c\cos(qr_c)}{(qr_c)^3} +
22       V_s(\rho_s-\rho_\text{solv})\frac{\sin(qr_s)-qr_s\cos(qr_s)}{(qr_s)^3}
23       \right]
24
25where $V_s$ is the volume of the whole particle, $V_c$ is the volume of the
26core, $r_s$ = $radius$ + $thickness$ is the radius of the particle, $r_c$
27is the radius of the core, $\rho_c$ is the scattering length density of the
28core, $\rho_s$ is the scattering length density of the shell,
29$\rho_\text{solv}$, is the scattering length density of the solvent.
30
31The 2D scattering intensity is the same as $P(q)$ above, regardless of the
32orientation of the $q$ vector.
33
34NB: The outer most radius (ie, = radius + thickness) is used as the
35effective radius for $S(Q)$ when $P(Q) \cdot S(Q)$ is applied.
36
37References
38----------
39
40A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*,
41John Wiley and Sons, New York, (1955)
42
43Validation
44----------
45
46Validation of our code was done by comparing the output of the 1D model to
47the output of the software provided by NIST (Kline, 2006). Figure 1 shows a
48comparison of the output of our model and the output of the NIST software.
49"""
50
51from numpy import pi, inf
52
53name = "core_shell_sphere"
54title = "Form factor for a monodisperse spherical particle with particle with a core-shell structure."
55description = """
56    F^2(q) = 3/V_s [V_c (sld_core-sld_shell) (sin(q*radius)-q*radius*cos(q*radius))/(q*radius)^3
57                   + V_s (sld_shell-sld_solvent) (sin(q*r_s)-q*r_s*cos(q*r_s))/(q*r_s)^3]
58
59            V_s: Volume of the sphere shell
60            V_c: Volume of the sphere core
61            r_s: Shell radius = radius + thickness
62"""
63category = "shape:sphere"
64
65# pylint: disable=bad-whitespace, line-too-long
66#             ["name", "units", default, [lower, upper], "type","description"],
67parameters = [["radius",      "Ang",        60.0, [0, inf],    "volume", "Sphere core radius"],
68              ["thickness",   "Ang",        10.0, [0, inf],    "volume", "Sphere shell thickness"],
69              ["sld_core",    "1e-6/Ang^2", 1.0,  [-inf, inf], "sld",    "core scattering length density"],
70              ["sld_shell",   "1e-6/Ang^2", 2.0,  [-inf, inf], "sld",    "shell scattering length density"],
71              ["sld_solvent", "1e-6/Ang^2", 3.0,  [-inf, inf], "sld",    "Solvent scattering length density"]]
72# pylint: enable=bad-whitespace, line-too-long
73
74source = ["lib/sph_j1c.c", "lib/core_shell.c", "core_shell_sphere.c"]
75
76demo = dict(scale=1, background=0, radius=60, thickness=10,
77            sld_core=1.0, sld_shell=2.0, sld_solvent=0.0)
78
79def ER(radius, thickness):
80    """
81        Equivalent radius
82        @param radius: core radius
83        @param thickness: shell thickness
84    """
85    return radius + thickness
86
87def VR(radius, thickness):
88    """
89        Volume ratio
90        @param radius: core radius
91        @param thickness: shell thickness
92    """
93    return (1, 1)
94    whole = 4.0 * pi / 3.0 * pow((radius + thickness), 3)
95    core = 4.0 * pi / 3.0 * radius * radius * radius
96    return whole, whole - core
97
98tests = [
99    [{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0],
100     # TODO: VR test suppressed until we sort out new product model
101     # and determine what to do with volume ratio.
102     #[{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704],
103
104     # The SasView test result was 0.00169, with a background of 0.001
105     [{'radius': 60.0, 'thickness': 10.0, 'sld_core': 1.0, 'sld_shell':2.0,
106       'sld_solvent':3.0, 'background':0.0},
107      0.4, 0.000698838],
108]
Note: See TracBrowser for help on using the repository browser.