[43fe34b] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | |
---|
[475ff58] | 5 | This model calculates the SAS signal of a phase separating system |
---|
| 6 | undergoing spinodal decomposition. The scattering intensity $I(q)$ is calculated |
---|
| 7 | as |
---|
[bba9361] | 8 | |
---|
[48462b0] | 9 | .. math:: |
---|
[bba9361] | 10 | I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B |
---|
| 11 | |
---|
[475ff58] | 12 | where $x=q/q_0$, $q_0$ is the peak position, $I_{max}$ is the intensity |
---|
| 13 | at $q_0$ (parameterised as the $scale$ parameter), and $B$ is a flat |
---|
| 14 | background. The spinodal wavelength is given by $2\pi/q_0$. |
---|
| 15 | |
---|
| 16 | The exponent $\gamma$ is equal to $d+1$ for off-critical concentration |
---|
| 17 | mixtures (smooth interfaces) and $2d$ for critical concentration mixtures |
---|
| 18 | (entangled interfaces), where $d$ is the dimensionality (ie, 1, 2, 3) of the |
---|
| 19 | system. Thus 2 <= $\gamma$ <= 6. A transition from $\gamma=d+1$ to $\gamma=2d$ |
---|
| 20 | is expected near the percolation threshold. |
---|
| 21 | |
---|
| 22 | As this function tends to zero as $q$ tends to zero, in practice it may be |
---|
| 23 | necessary to combine it with another function describing the low-angle |
---|
| 24 | scattering, or to simply omit the low-angle scattering from the fit. |
---|
[43fe34b] | 25 | |
---|
| 26 | References |
---|
| 27 | ---------- |
---|
| 28 | |
---|
[48462b0] | 29 | H. Furukawa. Dynamics-scaling theory for phase-separating unmixing mixtures: |
---|
[2d81cfe] | 30 | Growth rates of droplets and scaling properties of autocorrelation functions. |
---|
| 31 | Physica A 123,497 (1984). |
---|
[43fe34b] | 32 | |
---|
[475ff58] | 33 | Revision History |
---|
| 34 | ---------------- |
---|
[43fe34b] | 35 | |
---|
[475ff58] | 36 | * **Author:** Dirk Honecker **Date:** Oct 7, 2016 |
---|
| 37 | * **Revised:** Steve King **Date:** Sep 7, 2018 |
---|
[43fe34b] | 38 | """ |
---|
| 39 | |
---|
[2d81cfe] | 40 | import numpy as np |
---|
[43fe34b] | 41 | from numpy import inf, errstate |
---|
| 42 | |
---|
| 43 | name = "spinodal" |
---|
| 44 | title = "Spinodal decomposition model" |
---|
| 45 | description = """\ |
---|
[475ff58] | 46 | I(q) = Imax ((1+gamma/2)x^2)/(gamma/2+x^(2+gamma)) + background |
---|
[43fe34b] | 47 | |
---|
| 48 | List of default parameters: |
---|
[475ff58] | 49 | |
---|
| 50 | Imax = correlation peak intensity at q_0 |
---|
| 51 | background = incoherent background |
---|
| 52 | gamma = exponent (see model documentation) |
---|
[43fe34b] | 53 | q_0 = correlation peak position [1/A] |
---|
[475ff58] | 54 | x = q/q_0""" |
---|
| 55 | |
---|
[43fe34b] | 56 | category = "shape-independent" |
---|
| 57 | |
---|
| 58 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 59 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
[48462b0] | 60 | parameters = [["gamma", "", 3.0, [-inf, inf], "", "Exponent"], |
---|
[43fe34b] | 61 | ["q_0", "1/Ang", 0.1, [-inf, inf], "", "Correlation peak position"] |
---|
| 62 | ] |
---|
| 63 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 64 | |
---|
| 65 | def Iq(q, |
---|
| 66 | gamma=3.0, |
---|
| 67 | q_0=0.1): |
---|
| 68 | """ |
---|
| 69 | :param q: Input q-value |
---|
| 70 | :param gamma: Exponent |
---|
| 71 | :param q_0: Correlation peak position |
---|
| 72 | :return: Calculated intensity |
---|
| 73 | """ |
---|
| 74 | with errstate(divide='ignore'): |
---|
| 75 | x = q/q_0 |
---|
[48462b0] | 76 | inten = ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma)) |
---|
[43fe34b] | 77 | return inten |
---|
| 78 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 79 | |
---|
[48462b0] | 80 | def random(): |
---|
| 81 | pars = dict( |
---|
| 82 | scale=10**np.random.uniform(1, 3), |
---|
| 83 | gamma=np.random.uniform(0, 6), |
---|
| 84 | q_0=10**np.random.uniform(-3, -1), |
---|
| 85 | ) |
---|
| 86 | return pars |
---|
| 87 | |
---|
[43fe34b] | 88 | demo = dict(scale=1, background=0, |
---|
| 89 | gamma=1, q_0=0.1) |
---|