source: sasmodels/sasmodels/models/spinodal.py

Last change on this file was c1e44e5, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

Add local link to source files. Refs #1263.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1r"""
2Definition
3----------
4
5This model calculates the SAS signal of a phase separating system
6undergoing spinodal decomposition. The scattering intensity $I(q)$ is calculated
7as
8
9.. math::
10    I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B
11
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$.
15
16The definition of $I_{max}$ in the literature varies. Hashimoto *et al* (1991)
17define it as
18
19.. math::
20    I_{max} = \Lambda^3\Delta\rho^2
21
22whereas Meier & Strobl (1987) give
23
24.. math::
25    I_{max} = V_z\Delta\rho^2
26
27where $V_z$ is the volume per monomer unit.
28
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.
34
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
37scattering, or to simply omit the low-angle scattering from the fit.
38
39References
40----------
41
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).
45
46Authorship and Verification
47----------------------------
48
49* **Author:** Dirk Honecker **Date:** Oct 7, 2016
50* **Last Modified by:** Steve King **Date:** Oct 25, 2018
51* **Last Reviewed by:** Steve King **Date:** Oct 25, 2018
52"""
53
54import numpy as np
55from numpy import inf, errstate
56
57name = "spinodal"
58title = "Spinodal decomposition model"
59description = """\
60      I(q) = Imax ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma)) + background
61
62      List of default parameters:
63
64      Imax = correlation peak intensity at q_0
65      background = incoherent background
66      gamma = exponent (see model documentation)
67      q_0 = correlation peak position [1/A]
68      x = q/q_0"""
69
70category = "shape-independent"
71
72# pylint: disable=bad-whitespace, line-too-long
73#             ["name", "units", default, [lower, upper], "type", "description"],
74parameters = [["gamma",      "",    3.0, [-inf, inf], "", "Exponent"],
75              ["q_0",  "1/Ang",     0.1, [-inf, inf], "", "Correlation peak position"]
76             ]
77# pylint: enable=bad-whitespace, line-too-long
78
79def Iq(q,
80       gamma=3.0,
81       q_0=0.1):
82    """
83    :param q:              Input q-value
84    :param gamma:          Exponent
85    :param q_0:            Correlation peak position
86    :return:               Calculated intensity
87    """
88    with errstate(divide='ignore'):
89        x = q/q_0
90        inten = ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma))
91    return inten
92Iq.vectorized = True  # Iq accepts an array of q values
93
94def random():
95    """Return a random parameter set for the model."""
96    pars = dict(
97        scale=10**np.random.uniform(1, 3),
98        gamma=np.random.uniform(0, 6),
99        q_0=10**np.random.uniform(-3, -1),
100    )
101    return pars
102
103demo = dict(scale=1, background=0,
104            gamma=1, q_0=0.1)
Note: See TracBrowser for help on using the repository browser.