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 | * **Last Modified by:** |
---|
29 | * **Last Reviewed by:** |
---|
30 | """ |
---|
31 | |
---|
32 | import numpy as np |
---|
33 | from numpy import inf, errstate |
---|
34 | |
---|
35 | name = "spinodal" |
---|
36 | title = "Spinodal decomposition model" |
---|
37 | description = """\ |
---|
38 | I(q) = scale ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma))+background |
---|
39 | |
---|
40 | List of default parameters: |
---|
41 | scale = scaling |
---|
42 | gamma = exponent |
---|
43 | x = q/q_0 |
---|
44 | q_0 = correlation peak position [1/A] |
---|
45 | background = Incoherent background""" |
---|
46 | category = "shape-independent" |
---|
47 | |
---|
48 | # pylint: disable=bad-whitespace, line-too-long |
---|
49 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
50 | parameters = [["gamma", "", 3.0, [-inf, inf], "", "Exponent"], |
---|
51 | ["q_0", "1/Ang", 0.1, [-inf, inf], "", "Correlation peak position"] |
---|
52 | ] |
---|
53 | # pylint: enable=bad-whitespace, line-too-long |
---|
54 | |
---|
55 | def Iq(q, |
---|
56 | gamma=3.0, |
---|
57 | q_0=0.1): |
---|
58 | """ |
---|
59 | :param q: Input q-value |
---|
60 | :param gamma: Exponent |
---|
61 | :param q_0: Correlation peak position |
---|
62 | :return: Calculated intensity |
---|
63 | """ |
---|
64 | |
---|
65 | with errstate(divide='ignore'): |
---|
66 | x = q/q_0 |
---|
67 | inten = ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma)) |
---|
68 | return inten |
---|
69 | Iq.vectorized = True # Iq accepts an array of q values |
---|
70 | |
---|
71 | def random(): |
---|
72 | pars = dict( |
---|
73 | scale=10**np.random.uniform(1, 3), |
---|
74 | gamma=np.random.uniform(0, 6), |
---|
75 | q_0=10**np.random.uniform(-3, -1), |
---|
76 | ) |
---|
77 | return pars |
---|
78 | |
---|
79 | demo = dict(scale=1, background=0, |
---|
80 | gamma=1, q_0=0.1) |
---|