source: sasmodels/sasmodels/models/fractal_core_shell.py @ 217590b

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 217590b was 217590b, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

fractal, fractal_core_shell: support fractal_dim as low as 0.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1r"""
2Calculates the scattering from a fractal structure with a primary building
3block of core-shell spheres, as opposed to just homogeneous spheres in
4the fractal model.
5This model could find use for aggregates of coated particles, or aggregates
6of vesicles.
7
8Definition
9----------
10
11.. math::
12
13    I(q) = \text{background} + P(q)S(q)
14
15The form factor $P(q)$ is that from core_shell model with $bkg$ = 0
16
17
18.. math::
19
20    P(q)=\frac{scale}{V_s}\left[3V_c(\rho_c-\rho_s)
21    \frac{\sin(qr_c)-qr_c\cos(qr_c)}{(qr_c)^3}+
22    3V_s(\rho_s-\rho_{solv})
23    \frac{\sin(qr_s)-qr_s\cos(qr_s)}{(qr_s)^3}\right]^2
24
25
26while the fractal structure factor $S(q)$ is
27
28.. math::
29
30    S(q) = \frac{D_f\Gamma(D_f-1)\sin((D_f-1)\tan^{-1}(q\xi))}
31    {(qr_c)^{D_f}\left(1+\frac{1}{q^2\xi ^2} \right)^{\frac{D_f-1}{2}}}
32
33where $D_f$ = fractal_dim, |xi| = cor_length, $r_c$ = (core) radius, and
34$scale$ = volume fraction.
35
36The fractal structure is as documented in the fractal model.
37Polydispersity of radius and thickness is provided for.
38
39For 2D data: The 2D scattering intensity is calculated in the same way as 1D,
40where the $q$ vector is defined as
41
42.. math::
43
44    q = \sqrt{q_x^2 + q_y^2}
45
46References
47----------
48
49See the core_shell and fractal model descriptions
50
51"""
52
53from numpy import pi, inf
54
55name = "fractal_core_shell"
56title = ""
57description = """
58
59"""
60category = "shape-independent"
61
62# pylint: disable=bad-whitespace, line-too-long
63#   ["name", "units", default, [lower, upper], "type","description"],
64parameters = [
65    ["radius",      "Ang",        60.0, [0.0, inf],  "volume", "Sphere core radius"],
66    ["thickness",   "Ang",        10.0, [0.0, inf],  "volume", "Sphere shell thickness"],
67    ["sld_core",    "1e-6/Ang^2", 1.0,  [-inf, inf], "sld",    "Sphere core scattering length density"],
68    ["sld_shell",   "1e-6/Ang^2", 2.0,  [-inf, inf], "sld",    "Sphere shell scattering length density"],
69    ["sld_solvent", "1e-6/Ang^2", 3.0,  [-inf, inf], "sld",    "Solvent scattering length density"],
70    ["volfraction", "",           1.0,  [0.0, inf],  "",       "Volume fraction of building block spheres"],
71    ["fractal_dim",    "",        2.0,  [0.0, 6.0],  "",       "Fractal dimension"],
72    ["cor_length",  "Ang",      100.0,  [0.0, inf],  "",       "Correlation length of fractal-like aggregates"],
73]
74# pylint: enable=bad-whitespace, line-too-long
75
76source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "lib/core_shell.c",
77          "lib/fractal_sq.c", "fractal_core_shell.c"]
78
79demo = dict(scale=0.05,
80            background=0,
81            radius=20,
82            thickness=5,
83            sld_core=3.5,
84            sld_shell=1.0,
85            sld_solvent=6.35,
86            volfraction=0.05,
87            fractal_dim=2.0,
88            cor_length=100.0)
89
90def ER(radius, thickness):
91    """
92        Equivalent radius
93        @param radius: core radius
94        @param thickness: shell thickness
95    """
96    return radius + thickness
97
98def VR(radius, thickness):
99    """
100        Volume ratio
101        @param radius: core radius
102        @param thickness: shell thickness
103    """
104    whole = 4.0/3.0 * pi * (radius + thickness)**3
105    core = 4.0/3.0 * pi * radius**3
106    return whole, whole-core
107
108tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0],
109         [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704],
110
111         # The SasView test result was 0.00169, with a background of 0.001
112         [{'radius': 60.0,
113           'thickness': 10.0,
114           'sld_core': 1.0,
115           'sld_shell': 2.0,
116           'sld_solvent': 3.0,
117           'background': 0.0
118          }, 0.4, 0.00070126]]
Note: See TracBrowser for help on using the repository browser.