source: sasmodels/sasmodels/models/spinodal.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: 3.7 KB
RevLine 
[43fe34b]1r"""
2Definition
3----------
4
[b297ba9]5This model calculates the SAS signal of a phase separating system
6undergoing spinodal decomposition. The scattering intensity $I(q)$ is calculated
7as
[bba9361]8
[48462b0]9.. math::
[bba9361]10    I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B
11
[b297ba9]12where $x=q/q_0$, $q_0$ is the peak position, $I_{max}$ is the intensity
13at $q_0$ (parameterised as the $scale$ parameter), and $B$ is a flat
14background. The spinodal wavelength, $\Lambda$, is given by $2\pi/q_0$.
[93fe8a1]15
[b297ba9]16The definition of $I_{max}$ in the literature varies. Hashimoto *et al* (1991)
17define it as
[93fe8a1]18
19.. math::
20    I_{max} = \Lambda^3\Delta\rho^2
[b297ba9]21
22whereas Meier & Strobl (1987) give
[93fe8a1]23
24.. math::
25    I_{max} = V_z\Delta\rho^2
[b297ba9]26
[93fe8a1]27where $V_z$ is the volume per monomer unit.
[475ff58]28
[b297ba9]29The exponent $\gamma$ is equal to $d+1$ for off-critical concentration
30mixtures (smooth interfaces) and $2d$ for critical concentration mixtures
31(entangled interfaces), where $d$ is the dimensionality (ie, 1, 2, 3) of the
32system. Thus 2 <= $\gamma$ <= 6. A transition from $\gamma=d+1$ to $\gamma=2d$
33is expected near the percolation threshold.
[475ff58]34
[b297ba9]35As this function tends to zero as $q$ tends to zero, in practice it may be
36necessary to combine it with another function describing the low-angle
[475ff58]37scattering, or to simply omit the low-angle scattering from the fit.
[43fe34b]38
39References
40----------
41
[0507e09]42.. [#] H. Furukawa. Dynamics-scaling theory for phase-separating unmixing mixtures: Growth rates of droplets and scaling properties of autocorrelation functions. Physica A 123, 497 (1984).
43.. [#] H. Meier & G. Strobl. Small-Angle X-ray Scattering Study of Spinodal Decomposition in Polystyrene/Poly(styrene-co-bromostyrene) Blends. Macromolecules 20, 649-654 (1987).
44.. [#] T. Hashimoto, M. Takenaka & H. Jinnai. Scattering Studies of Self-Assembling Processes of Polymer Blends in Spinodal Decomposition. J. Appl. Cryst. 24, 457-466 (1991).
[93fe8a1]45
[0507e09]46Source
47------
[93fe8a1]48
[0507e09]49`spinodal.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/spinodal.py>`_
[43fe34b]50
[0507e09]51Authorship and Verification
52----------------------------
[43fe34b]53
[0507e09]54* **Author:** Dirk Honecker **Date:** Oct 7, 2016
55* **Last Modified by:** Steve King **Date:** Oct 25, 2018
56* **Last Reviewed by:** Steve King **Date:** Oct 25, 2018
57* **Source added by :** Steve King **Date:** March 25, 2019
[43fe34b]58"""
59
[2d81cfe]60import numpy as np
[43fe34b]61from numpy import inf, errstate
62
63name = "spinodal"
64title = "Spinodal decomposition model"
65description = """\
[475ff58]66      I(q) = Imax ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma)) + background
[43fe34b]67
68      List of default parameters:
[b297ba9]69
[475ff58]70      Imax = correlation peak intensity at q_0
71      background = incoherent background
72      gamma = exponent (see model documentation)
[43fe34b]73      q_0 = correlation peak position [1/A]
[475ff58]74      x = q/q_0"""
[b297ba9]75
[43fe34b]76category = "shape-independent"
77
78# pylint: disable=bad-whitespace, line-too-long
79#             ["name", "units", default, [lower, upper], "type", "description"],
[48462b0]80parameters = [["gamma",      "",    3.0, [-inf, inf], "", "Exponent"],
[43fe34b]81              ["q_0",  "1/Ang",     0.1, [-inf, inf], "", "Correlation peak position"]
82             ]
83# pylint: enable=bad-whitespace, line-too-long
84
85def Iq(q,
86       gamma=3.0,
87       q_0=0.1):
88    """
89    :param q:              Input q-value
90    :param gamma:          Exponent
91    :param q_0:            Correlation peak position
92    :return:               Calculated intensity
93    """
94    with errstate(divide='ignore'):
95        x = q/q_0
[48462b0]96        inten = ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma))
[43fe34b]97    return inten
98Iq.vectorized = True  # Iq accepts an array of q values
99
[48462b0]100def random():
[b297ba9]101    """Return a random parameter set for the model."""
[48462b0]102    pars = dict(
103        scale=10**np.random.uniform(1, 3),
104        gamma=np.random.uniform(0, 6),
105        q_0=10**np.random.uniform(-3, -1),
106    )
107    return pars
108
[43fe34b]109demo = dict(scale=1, background=0,
110            gamma=1, q_0=0.1)
Note: See TracBrowser for help on using the repository browser.