[43fe34b] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | |
---|
[2d81cfe] | 5 | This model calculates the SAS signal of a phase separating solution |
---|
| 6 | under spinodal decomposition. The scattering intensity $I(q)$ is calculated as |
---|
[bba9361] | 7 | |
---|
[48462b0] | 8 | .. math:: |
---|
[bba9361] | 9 | I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B |
---|
| 10 | |
---|
[2d81cfe] | 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. |
---|
[43fe34b] | 16 | |
---|
| 17 | References |
---|
| 18 | ---------- |
---|
| 19 | |
---|
[48462b0] | 20 | H. Furukawa. Dynamics-scaling theory for phase-separating unmixing mixtures: |
---|
[2d81cfe] | 21 | Growth rates of droplets and scaling properties of autocorrelation functions. |
---|
| 22 | Physica A 123,497 (1984). |
---|
[43fe34b] | 23 | |
---|
| 24 | Authorship and Verification |
---|
| 25 | ---------------------------- |
---|
| 26 | |
---|
| 27 | * **Author:** Dirk Honecker **Date:** Oct 7, 2016 |
---|
| 28 | """ |
---|
| 29 | |
---|
[2d81cfe] | 30 | import numpy as np |
---|
[43fe34b] | 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"], |
---|
[48462b0] | 48 | parameters = [["gamma", "", 3.0, [-inf, inf], "", "Exponent"], |
---|
[43fe34b] | 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 | """ |
---|
[48462b0] | 62 | |
---|
[43fe34b] | 63 | with errstate(divide='ignore'): |
---|
| 64 | x = q/q_0 |
---|
[48462b0] | 65 | inten = ((1 + gamma / 2) * x ** 2) / (gamma / 2 + x ** (2 + gamma)) |
---|
[43fe34b] | 66 | return inten |
---|
| 67 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 68 | |
---|
[48462b0] | 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 | |
---|
[43fe34b] | 77 | demo = dict(scale=1, background=0, |
---|
| 78 | gamma=1, q_0=0.1) |
---|