# source:sasmodels/sasmodels/models/mass_fractal.py@6d96b66

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

fractal models: handle limits of q=0 and dim=1

• Property mode set to 100644
File size: 3.2 KB
Line
1r"""
2Calculates the scattering from fractal-like aggregates based on
3the Mildner reference.
4
5Definition
6----------
7
8The scattering intensity $I(q)$ is calculated as
9
10.. math::
11
12    I(q) = scale \times P(q)S(q) + background
13
14.. math::
15
16    P(q) = F(qR)^2
17
18.. math::
19
20    F(x) = \frac{3\left[sin(x)-xcos(x)\right]}{x^3}
21
22.. math::
23
24    S(q) = \frac{\Gamma(D_m-1)\zeta^{D_m-1}}{\left[1+(q\zeta)^2
25    \right]^{(D_m-1)/2}}
26    \frac{sin\left[(D_m - 1) tan^{-1}(q\zeta) \right]}{q}
27
28.. math::
29
30    scale = scale\_factor \times NV^2(\rho_{particle} - \rho_{solvent})^2
31
32.. math::
33
34    V = \frac{4}{3}\pi R^3
35
36where $R$ is the radius of the building block, $D_m$ is the **mass** fractal
37dimension, | \zeta\|  is the cut-off length, $\rho_{solvent}$ is the scattering
38length density of the solvent,
39and $\rho_{particle}$ is the scattering length density of particles.
40
41.. note::
42
43    The mass fractal dimension ( $D_m$ ) is only
44    valid if $0 < mass\_dim < 6$. It is also only valid over a limited
45    $q$ range (see the reference for details).
46
47
48References
49----------
50
51D Mildner and P Hall, *J. Phys. D: Appl. Phys.*,
5219 (1986) 1535-1545 Equation(9)
53
54
55"""
56
57from numpy import inf
58
59name = "mass_fractal"
60title = "Mass Fractal model"
61description = """
62        The scattering intensity  I(x) = scale*P(x)*S(x) + background, where
63        scale = scale_factor  * V * delta^(2)
65        F(x) = 3*[sin(x)-x cos(x)]/x**3
66        S(x) = [(gamma(Dm-1)*colength^(Dm-1)*[1+(x^2*colength^2)]^((1-Dm)/2)
67        * sin[(Dm-1)*arctan(x*colength)])/x]
68        where delta = sldParticle -sldSolv.
70        fractal_dim_mass  =  Mass fractal dimension
71        cutoff_length  =  Cut-off length
72        background   =  background
73        Ref.:Mildner, Hall,J Phys D Appl Phys(1986), 9, 1535-1545
74        Note I: This model is valid for 1<fractal_dim_mass<6.
75        Note II: This model is not in absolute scale.
76        """
77category = "shape-independent"
78
80#   ["name", "units", default, [lower, upper], "type","description"],
81parameters = [
83    ["fractal_dim_mass", "",      1.9, [1.0, 6.0], "", "Mass fractal dimension"],
84    ["cutoff_length",    "Ang", 100.0, [0.0, inf], "", "Cut-off length"],
85]
87
88source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "mass_fractal.c"]
89
90demo = dict(scale=1, background=0,
92            fractal_dim_mass=1.9,
93            cutoff_length=100.0)
94
95tests = [
96
97    # Accuracy tests based on content in test/utest_other_models.py
99      'fractal_dim_mass':        1.9,
100      'cutoff_length': 100.0,
101     }, 0.05, 279.59422],
102
103    # Additional tests with larger range of parameters
105      'fractal_dim_mass':      3.3,
106      'cutoff_length': 1.0,
107     }, 0.5, 1.29116774904],
108