source: sasmodels/sasmodels/models/fractal_core_shell.py @ 42356c8

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

label all sld parameters

  • 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$ = 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
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, inf],    "volume", "Sphere core radius"],
66    ["thickness",   "Ang",        10.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, inf],    "",       "Volume fraction of building block spheres"],
71    ["frac_dim",    "",           2.0,  [-inf, inf], "",       "Fractal dimension"],
72    ["cor_length",  "Ang",      100.0,  [0, inf],    "",       "Correlation length of fractal-like aggregates"]]
73# pylint: enable=bad-whitespace, line-too-long
74
75source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "lib/core_shell.c", "fractal_core_shell.c"]
76
77demo = dict(scale=0.05,
78            background=0,
79            radius=20,
80            thickness=5,
81            sld_core=3.5,
82            sld_shell=1.0,
83            sld_solvent=6.35,
84            volfraction=0.05,
85            frac_dim=2.0,
86            cor_length=100.0)
87
88def ER(radius, thickness):
89    """
90        Equivalent radius
91        @param radius: core radius
92        @param thickness: shell thickness
93    """
94    return radius + thickness
95
96def VR(radius, thickness):
97    """
98        Volume ratio
99        @param radius: core radius
100        @param thickness: shell thickness
101    """
102    whole = 4.0 * pi / 3.0 * pow((radius + thickness), 3)
103    core = 4.0 * pi / 3.0 * radius * radius * radius
104    return whole, whole-core
105
106tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0],
107         [{'radius': 20.0, 'thickness': 10.0}, 'VR', 0.703703704],
108
109         # The SasView test result was 0.00169, with a background of 0.001
110         [{'radius': 60.0,
111           'thickness': 10.0,
112           'sld_core': 1.0,
113           'sld_shell': 2.0,
114           'sld_solvent': 3.0,
115           'background': 0.0
116          }, 0.4, 0.00070126]]
Note: See TracBrowser for help on using the repository browser.