source: sasmodels/sasmodels/models/fractal_core_shell.py @ 7d4b2ae

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 7d4b2ae was 7d4b2ae, checked in by piotr, 8 years ago

Added fractal_core_shell

  • Property mode set to 100644
File size: 3.6 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$ = frac_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
46.. figure:: img/fractal_core_shell_1d.jpg
47
48    1D plot using the default values (w/500 data point).
49
50Reference
51---------
52
53See the core_shell and fractal model descriptions
54
55"""
56
57from numpy import pi, inf
58
59name = "fractal_core_shell"
60title = ""
61description = """
62
63"""
64category = "shape-independent"
65
66# pylint: disable=bad-whitespace, line-too-long
67#   ["name", "units", default, [lower, upper], "type","description"],
68parameters = [
69    ["radius",      "Ang",        60.0, [0, inf],    "volume", "Sphere core radius"],
70    ["thickness",   "Ang",        10.0, [0, inf],    "volume", "Sphere shell thickness"],
71    ["core_sld",    "1e-6/Ang^2", 1.0,  [-inf, inf], "",       "Sphere core scattering length density"],
72    ["shell_sld",   "1e-6/Ang^2", 2.0,  [-inf, inf], "",       "Sphere shell scattering length density"],
73    ["solvent_sld", "1e-6/Ang^2", 3.0,  [-inf, inf], "",       "Solvent scattering length density"],
74    ["volfraction", "",           1.0,  [0, inf],    "",       "Volume fraction of building block spheres"],
75    ["frac_dim",    "",           2.0,  [-inf, inf], "",       "Fractal dimension"],
76    ["cor_length",  "Ang",      100.0,  [0, inf],    "",       "Correlation length of fractal-like aggregates"]]
77# pylint: enable=bad-whitespace, line-too-long
78
79source = ["lib/sph_j1c.c", "lib/lanczos_gamma.c", "lib/core_shell.c", "fractal_core_shell.c"]
80
81demo = dict(scale=0.05,
82            background=0,
83            radius=20,
84            thickness=5,
85            core_sld=3.5,
86            shell_sld=1.0,
87            solvent_sld=6.35,
88            volfraction=0.05,
89            frac_dim=2.0,
90            cor_length=100.0)
91
92oldname = 'FractalCoreShellModel'
93oldpars = {}
94
95def ER(radius, thickness):
96    """
97        Equivalent radius
98        @param radius: core radius
99        @param thickness: shell thickness
100    """
101    return radius + thickness
102
103def VR(radius, thickness):
104    """
105        Volume ratio
106        @param radius: core radius
107        @param thickness: shell thickness
108    """
109    whole = 4.0 * pi / 3.0 * pow((radius + thickness), 3)
110    core = 4.0 * pi / 3.0 * radius * radius * radius
111    return whole, whole-core
112
113tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0],
114         [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704],
115
116         # The SasView test result was 0.00169, with a background of 0.001
117         [{'radius': 60.0,
118           'thickness': 10.0,
119           'core_sld': 1.0,
120           'shell_sld': 2.0,
121           'solvent_sld': 3.0,
122           'background': 0.0
123          }, 0.4, 0.00070126]]
Note: See TracBrowser for help on using the repository browser.