source: sasmodels/sasmodels/models/spinodal.py @ 43fe34b

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 43fe34b was 43fe34b, checked in by dirk, 8 years ago

closed: #723

  • Property mode set to 100644
File size: 2.3 KB
Line 
1r"""
2Definition
3----------
4
5This model calculates the SAS signal of a phase separating solution under spinodal decomposition.
6The scattering intensity $I(q)$ is calculated as
7.. math:: I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B
8where $x=q/q_0$ and $B$ is a flat background. The characteristic structure length
9 scales with the correlation peak at $q_0$. The exponent $\gamma$ is equal to
10$d+1$ with d the dimensionality of the off-critical concentration mixtures.
11A transition to $\gamma=2 d$is seen near the percolation treshold into the
12critical concentration regime.
13
14References
15----------
16
17H. Furukawa. Dynamics-scaling theory for phase-separating unmixing mixtures:
18Growth rates of droplets and scaling properties of autocorrelation functions. Physica A 123,497 (1984).
19
20Authorship and Verification
21----------------------------
22
23* **Author:** Dirk Honecker **Date:** Oct 7, 2016
24* **Last Modified by:**
25* **Last Reviewed by:**
26"""
27
28from numpy import inf, errstate
29
30name = "spinodal"
31title = "Spinodal decomposition model"
32description = """\
33      I(q) = scale ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma))+background
34
35      List of default parameters:
36      scale = scaling
37      gamma = exponent
38      x = q/q_0
39      q_0 = correlation peak position [1/A]
40      background = Incoherent background"""
41category = "shape-independent"
42
43# pylint: disable=bad-whitespace, line-too-long
44#             ["name", "units", default, [lower, upper], "type", "description"],
45parameters = [["scale",    "",  1.0, [-inf, inf], "", "Scale factor"],
46              ["gamma",      "",      3.0, [-inf, inf], "", "Exponent"],
47              ["q_0",  "1/Ang",     0.1, [-inf, inf], "", "Correlation peak position"]
48             ]
49# pylint: enable=bad-whitespace, line-too-long
50
51def Iq(q,
52       scale=1.0,
53       gamma=3.0,
54       q_0=0.1):
55    """
56    :param q:              Input q-value
57    :param scale:          Scale factor
58    :param gamma:          Exponent
59    :param q_0:            Correlation peak position
60    :return:               Calculated intensity
61    """
62   
63    with errstate(divide='ignore'):
64        x = q/q_0
65        inten = scale * ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma)) 
66    return inten
67Iq.vectorized = True  # Iq accepts an array of q values
68
69demo = dict(scale=1, background=0,
70            gamma=1, q_0=0.1)
Note: See TracBrowser for help on using the repository browser.