1 | r""" |
---|
2 | Definition |
---|
3 | ---------- |
---|
4 | |
---|
5 | This model calculates the SAS signal of a phase separating solution |
---|
6 | under spinodal decomposition. The scattering intensity $I(q)$ is calculated as |
---|
7 | |
---|
8 | .. math:: |
---|
9 | I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B |
---|
10 | |
---|
11 | where $x=q/q_0$ and $B$ is a flat background. The characteristic structure |
---|
12 | length scales with the correlation peak at $q_0$. The exponent $\gamma$ is |
---|
13 | equal to $d+1$ with d the dimensionality of the off-critical concentration |
---|
14 | mixtures. A transition to $\gamma=2d$ is seen near the percolation threshold |
---|
15 | into the critical concentration regime. |
---|
16 | |
---|
17 | References |
---|
18 | ---------- |
---|
19 | |
---|
20 | H. Furukawa. Dynamics-scaling theory for phase-separating unmixing mixtures: |
---|
21 | Growth rates of droplets and scaling properties of autocorrelation functions. |
---|
22 | Physica A 123,497 (1984). |
---|
23 | |
---|
24 | Authorship and Verification |
---|
25 | ---------------------------- |
---|
26 | |
---|
27 | * **Author:** Dirk Honecker **Date:** Oct 7, 2016 |
---|
28 | """ |
---|
29 | |
---|
30 | import numpy as np |
---|
31 | from numpy import inf, errstate |
---|
32 | |
---|
33 | name = "spinodal" |
---|
34 | title = "Spinodal decomposition model" |
---|
35 | description = """\ |
---|
36 | I(q) = scale ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma))+background |
---|
37 | |
---|
38 | List of default parameters: |
---|
39 | scale = scaling |
---|
40 | gamma = exponent |
---|
41 | x = q/q_0 |
---|
42 | q_0 = correlation peak position [1/A] |
---|
43 | background = Incoherent background""" |
---|
44 | category = "shape-independent" |
---|
45 | |
---|
46 | # pylint: disable=bad-whitespace, line-too-long |
---|
47 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
48 | parameters = [["gamma", "", 3.0, [-inf, inf], "", "Exponent"], |
---|
49 | ["q_0", "1/Ang", 0.1, [-inf, inf], "", "Correlation peak position"] |
---|
50 | ] |
---|
51 | # pylint: enable=bad-whitespace, line-too-long |
---|
52 | |
---|
53 | def Iq(q, |
---|
54 | gamma=3.0, |
---|
55 | q_0=0.1): |
---|
56 | """ |
---|
57 | :param q: Input q-value |
---|
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 = ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma)) |
---|
66 | return inten |
---|
67 | Iq.vectorized = True # Iq accepts an array of q values |
---|
68 | |
---|
69 | def random(): |
---|
70 | pars = dict( |
---|
71 | scale=10**np.random.uniform(1, 3), |
---|
72 | gamma=np.random.uniform(0, 6), |
---|
73 | q_0=10**np.random.uniform(-3, -1), |
---|
74 | ) |
---|
75 | return pars |
---|
76 | |
---|
77 | demo = dict(scale=1, background=0, |
---|
78 | gamma=1, q_0=0.1) |
---|