source: sasmodels/sasmodels/models/mass_surface_fractal.py @ 0507e09

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 0507e09 was 0507e09, checked in by smk78, 5 years ago

Added link to source code to each model. Closes #883

  • Property mode set to 100644
File size: 5.8 KB
RevLine 
[7ed702f]1r"""
2
3A number of natural and commercial processes form high-surface area materials
4as a result of the vapour-phase aggregation of primary particles.
5Examples of such materials include soots, aerosols, and fume or pyrogenic
6silicas. These are all characterised by cluster mass distributions (sometimes
7also cluster size distributions) and internal surfaces that are fractal in
8nature. The scattering from such materials displays two distinct breaks in
9log-log representation, corresponding to the radius-of-gyration of the primary
10particles, $rg$, and the radius-of-gyration of the clusters (aggregates),
11$Rg$. Between these boundaries the scattering follows a power law related to
12the mass fractal dimension, $Dm$, whilst above the high-Q boundary the
13scattering follows a power law related to the surface fractal dimension of
14the primary particles, $Ds$.
15
16Definition
17----------
18
19The scattered intensity I(q) is calculated using a modified
20Ornstein-Zernicke equation
21
22.. math::
23
[ca04add]24    I(q) = scale \times P(q) + background \\
[7ed702f]25    P(q) = \left\{ \left[ 1+(q^2a)\right]^{D_m/2} \times
26                   \left[ 1+(q^2b)\right]^{(6-D_s-D_m)/2}
[ca04add]27           \right\}^{-1} \\
28    a = R_{g}^2/(3D_m/2) \\
29    b = r_{g}^2/[-3(D_s+D_m-6)/2] \\
[7ed702f]30    scale = scale\_factor \times NV^2 (\rho_{particle} - \rho_{solvent})^2
31
32where $R_g$ is the size of the cluster, $r_g$ is the size of the primary
33particle, $D_s$ is the surface fractal dimension, $D_m$ is the mass fractal
34dimension, $\rho_{solvent}$ is the scattering length density of the solvent,
35and $\rho_{particle}$ is the scattering length density of particles.
36
37.. note::
38
39    The surface ( $D_s$ ) and mass ( $D_m$ ) fractal dimensions are only
[71b751d]40    valid if $0 < surface\_dim < 6$, $0 < mass\_dim < 6$, and
41    $(surface\_dim + mass\_dim ) < 6$.
[ff18db1]42    Older versions of sasview may have the default primary particle radius
[71b751d]43    larger than the cluster radius, this was an error, also present in the
44    Schmidt review paper below. The primary particle should be the smaller
45    as described in the original Hurd, et al., who also point out that
46    polydispersity in the primary particle sizes may affect their
[ff18db1]47    apparent surface fractal dimension.
[71b751d]48
[7ed702f]49
[95441ff]50References
51----------
[7ed702f]52
[7994359]53.. [#] P Schmidt, *J Appl. Cryst.*, 24 (1991) 414-435 Equation(19)
54.. [#] A J Hurd, D W Schaefer, J E Martin, *Phys. Rev. A*,
55   35 (1987) 2361-2364 Equation(2)
[7ed702f]56
[0507e09]57Source
58------
59
60`mass_surface_fractal.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/mass_surface_fractal.py>`_
61
62`mass_surface_fractal.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/mass_surface_fractal.c>`_
63
[7994359]64Authorship and Verification
65----------------------------
[ff18db1]66
[0507e09]67* **Author:** Piotr Rozyczko **Date:** Jan 20, 2016
68* **Last Modified by:**
[ff18db1]69* **Last Reviewed by:** Richard Heenan **Date:** May 30, 2018
[0507e09]70* **Source added by :** Steve King **Date:** March 25, 2019
[7ed702f]71"""
72
[2d81cfe]73import numpy as np
[7ed702f]74from numpy import inf
75
76name = "mass_surface_fractal"
77title = "Mass Surface Fractal model"
78description = """
79        The scattering intensity  I(x) = scale*P(x)*S(x) + background, where
80        p(x)= {[1+(x^2*a)]^(Dm/2) * [1+(x^2*b)]^(6-Ds-Dm)/2}^(-1)
81        a = Rg^2/(3*Dm/2)
82        b = rg^2/(3*(6-Ds-Dm)/2)
83        scale        =  scale factor * N*Volume^2*contrast^2
[a807206]84        fractal_dim_mass       =  Dm (mass fractal dimension)
85        fractal_dim_surf  =  Ds
86        rg_cluster  =  Rg
[30fbe2e]87        rg_primary    =  rg
[7ed702f]88        background   =  background
89        Hurd, Schaefer, Martin, Phys Rev A, eq(2),(1987),35, 2361-2364
90        Note that 0 < Ds< 6 and 0 < Dm < 6.
91        """
92category = "shape-independent"
93
[168052c]94# pylint: disable=bad-whitespace, line-too-long
[6d96b66]95#   ["name", "units", default, [lower, upper], "type","description"],
96parameters = [
97    ["fractal_dim_mass", "",      1.8, [0.0, 6.0], "", "Mass fractal dimension"],
98    ["fractal_dim_surf", "",      2.3, [0.0, 6.0], "", "Surface fractal dimension"],
[ff18db1]99    ["rg_cluster",       "Ang", 4000., [0.0, inf], "", "Cluster radius of gyration"],
100    ["rg_primary",       "Ang",  86.7, [0.0, inf], "", "Primary particle radius of gyration"],
[6d96b66]101]
[168052c]102# pylint: enable=bad-whitespace, line-too-long
[7ed702f]103
[9c461c7]104source = ["mass_surface_fractal.c"]
[7ed702f]105
[404ebbd]106def random():
[b297ba9]107    """Return a random parameter set for the model."""
[232bb12]108    fractal_dim = np.random.uniform(0, 6)
[404ebbd]109    surface_portion = np.random.uniform(0, 1)
110    fractal_dim_surf = fractal_dim*surface_portion
111    fractal_dim_mass = fractal_dim - fractal_dim_surf
112    rg_cluster = 10**np.random.uniform(1, 5)
113    rg_primary = rg_cluster*10**np.random.uniform(-4, -1)
114    scale = 10**np.random.uniform(2, 5)
115    pars = dict(
116        #background=0,
117        scale=scale,
118        fractal_dim_mass=fractal_dim_mass,
119        fractal_dim_surf=fractal_dim_surf,
120        rg_cluster=rg_cluster,
121        rg_primary=rg_primary,
122    )
123    return pars
124
125
[7ed702f]126demo = dict(scale=1, background=0,
[a807206]127            fractal_dim_mass=1.8,
128            fractal_dim_surf=2.3,
[ff18db1]129            rg_cluster=4000.0,
130            rg_primary=86.7)
[7ed702f]131
[07a6700]132tests = [
[168052c]133
[b297ba9]134    # Accuracy tests based on content in test/utest_other_models.py  All
135    # except first, changed so rg_cluster is the larger, RKH 30 May 2018
[ff18db1]136    [{'fractal_dim_mass':   1.8,
[a807206]137      'fractal_dim_surf':   2.3,
138      'rg_cluster':   86.7,
[30fbe2e]139      'rg_primary': 4000.0,
[6dd90c1]140      'background':    0.0,
[168052c]141     }, 0.05, 1.77537e-05],
142
143    # Additional tests with larger range of parameters
[a807206]144    [{'fractal_dim_mass':      3.3,
145      'fractal_dim_surf':   1.0,
[ff18db1]146      'rg_cluster': 4000.0,
147      'rg_primary':   90.0,
148     }, 0.001, 0.0932516614456],
[168052c]149
[a807206]150    [{'fractal_dim_mass':      1.3,
[ff18db1]151      'fractal_dim_surf':   2.0,
152      'rg_cluster': 2000.0,
153      'rg_primary':   90.0,
[168052c]154      'background':    0.8,
[ff18db1]155     }, 0.001, 1.28296431786],
[168052c]156
[a807206]157    [{'fractal_dim_mass':      2.3,
[ff18db1]158      'fractal_dim_surf':   3.1,
159      'rg_cluster':  1000.0,
160      'rg_primary':  30.0,
[168052c]161      'scale':        10.0,
[6dd90c1]162      'background':    0.0,
[ff18db1]163     }, 0.051, 0.00333804044899],
[168052c]164    ]
Note: See TracBrowser for help on using the repository browser.