[23d3b41] | 1 | r""" |
---|
[513efc5] | 2 | This model describes the scattering from polymer chains subject to excluded |
---|
| 3 | volume effects and has been used as a template for describing mass fractals. |
---|
[23d3b41] | 4 | |
---|
| 5 | Definition |
---|
| 6 | ---------- |
---|
| 7 | |
---|
[513efc5] | 8 | The form factor was originally presented in the following integral form |
---|
| 9 | (Benoit, 1957) |
---|
[23d3b41] | 10 | |
---|
| 11 | .. math:: |
---|
| 12 | |
---|
| 13 | P(Q)=2\int_0^{1}dx(1-x)exp\left[-\frac{Q^2a^2}{6}n^{2v}x^{2v}\right] |
---|
| 14 | |
---|
| 15 | where $\nu$ is the excluded volume parameter |
---|
| 16 | (which is related to the Porod exponent $m$ as $\nu=1/m$ ), |
---|
| 17 | $a$ is the statistical segment length of the polymer chain, |
---|
| 18 | and $n$ is the degree of polymerization. |
---|
[513efc5] | 19 | This integral was later put into an almost analytical form as follows |
---|
| 20 | (Hammouda, 1993) |
---|
[23d3b41] | 21 | |
---|
| 22 | .. math:: |
---|
| 23 | |
---|
| 24 | P(Q)=\frac{1}{\nu U^{1/2\nu}}\gamma\left(\frac{1}{2\nu},U\right) - |
---|
| 25 | \frac{1}{\nu U^{1/\nu}}\gamma\left(\frac{1}{\nu},U\right) |
---|
| 26 | |
---|
| 27 | where $\gamma(x,U)$ is the incomplete gamma function |
---|
| 28 | |
---|
| 29 | .. math:: |
---|
| 30 | |
---|
| 31 | \gamma(x,U)=\int_0^{U}dt\ exp(-t)t^{x-1} |
---|
| 32 | |
---|
| 33 | and the variable $U$ is given in terms of the scattering vector $Q$ as |
---|
| 34 | |
---|
| 35 | .. math:: |
---|
| 36 | |
---|
| 37 | U=\frac{Q^2a^2n^{2\nu}}{6} = \frac{Q^2R_{g}^2(2\nu+1)(2\nu+2)}{6} |
---|
| 38 | |
---|
| 39 | The square of the radius-of-gyration is defined as |
---|
| 40 | |
---|
| 41 | .. math:: |
---|
| 42 | |
---|
| 43 | R_{g}^2 = \frac{a^2n^{2\nu}}{(2\nu+1)(2\nu+2)} |
---|
| 44 | |
---|
| 45 | Note that this model applies only in the mass fractal range (ie, $5/3<=m<=3$ ) |
---|
| 46 | and **does not apply** to surface fractals ( $3<m<=4$ ). |
---|
[513efc5] | 47 | It also does not reproduce the rigid rod limit (m=1) because it assumes chain |
---|
| 48 | flexibility from the outset. It may cover a portion of the semi-flexible chain |
---|
| 49 | range ( $1<m<5/3$ ). |
---|
[23d3b41] | 50 | |
---|
[513efc5] | 51 | A low-Q expansion yields the Guinier form and a high-Q expansion yields the |
---|
| 52 | Porod form which is given by |
---|
[23d3b41] | 53 | |
---|
| 54 | .. math:: |
---|
| 55 | |
---|
[513efc5] | 56 | P(Q\rightarrow \infty) = \frac{1}{\nu U^{1/2\nu}}\Gamma\left( |
---|
| 57 | \frac{1}{2\nu}\right) - \frac{1}{\nu U^{1/\nu}}\Gamma\left( |
---|
| 58 | \frac{1}{\nu}\right) |
---|
[23d3b41] | 59 | |
---|
| 60 | Here $\Gamma(x) = \gamma(x,\infty)$ is the gamma function. |
---|
| 61 | |
---|
| 62 | The asymptotic limit is dominated by the first term |
---|
| 63 | |
---|
| 64 | .. math:: |
---|
| 65 | |
---|
| 66 | P(Q\rightarrow \infty) \sim \frac{1}{\nu U^{1/2\nu}}\Gamma\left(\frac{1}{2\nu}\right) = |
---|
| 67 | \frac{m}{\left(QR_{g}\right)^m}\left[\frac{6}{(2\nu +1)(2\nu +2)} \right]^{m/2} |
---|
| 68 | \Gamma (m/2) |
---|
| 69 | |
---|
[bf59527] | 70 | The special case when $\nu=0.5$ (or $m=1/\nu=2$ ) corresponds to Gaussian chains for |
---|
[23d3b41] | 71 | which the form factor is given by the familiar Debye function. |
---|
| 72 | |
---|
| 73 | .. math:: |
---|
| 74 | |
---|
| 75 | P(Q) = \frac{2}{Q^4R_{g}^4} \left[exp(-Q^2R_{g}^2) - 1 + Q^2R_{g}^2 \right] |
---|
| 76 | |
---|
| 77 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
| 78 | where the $q$ vector is defined as |
---|
| 79 | |
---|
| 80 | .. math:: |
---|
| 81 | |
---|
| 82 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | References |
---|
| 86 | ---------- |
---|
| 87 | |
---|
| 88 | H Benoit, *Comptes Rendus*, 245 (1957) 2244-2247 |
---|
| 89 | |
---|
| 90 | B Hammouda, *SANS from Homogeneous Polymer Mixtures - A Unified Overview, |
---|
| 91 | Advances in Polym. Sci.* 106(1993) 87-133 |
---|
| 92 | |
---|
| 93 | """ |
---|
| 94 | |
---|
[2c74c11] | 95 | from numpy import inf, power, errstate |
---|
[23d3b41] | 96 | from scipy.special import gammainc, gamma |
---|
| 97 | |
---|
| 98 | name = "polymer_excl_volume" |
---|
| 99 | title = "Polymer Excluded Volume model" |
---|
[513efc5] | 100 | description = """Compute the scattering intensity from polymers with excluded |
---|
| 101 | volume effects. |
---|
[23d3b41] | 102 | rg: radius of gyration |
---|
| 103 | porod_exp: Porod exponent |
---|
| 104 | """ |
---|
| 105 | category = "shape-independent" |
---|
| 106 | |
---|
[168052c] | 107 | # pylint: disable=bad-whitespace, line-too-long |
---|
[40a87fa] | 108 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 109 | parameters = [ |
---|
[404ebbd] | 110 | ["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"], |
---|
| 111 | ["porod_exp", "", 3.0, [0, inf], "", "Porod exponent"], |
---|
[40a87fa] | 112 | ] |
---|
[168052c] | 113 | # pylint: enable=bad-whitespace, line-too-long |
---|
[23d3b41] | 114 | |
---|
| 115 | |
---|
[416609b] | 116 | def Iq(q, rg=60.0, porod_exp=3.0): |
---|
[23d3b41] | 117 | """ |
---|
| 118 | :param q: Input q-value (float or [float, float]) |
---|
| 119 | :param rg: Radius of gyration |
---|
| 120 | :param porod_exp: Porod exponent |
---|
| 121 | :return: Calculated intensity |
---|
| 122 | """ |
---|
[40a87fa] | 123 | usub = (q*rg)**2 * (2.0/porod_exp + 1.0) * (2.0/porod_exp + 2.0)/6.0 |
---|
[2c74c11] | 124 | with errstate(divide='ignore', invalid='ignore'): |
---|
[40a87fa] | 125 | upow = power(usub, -0.5*porod_exp) |
---|
| 126 | result= (porod_exp*upow * |
---|
| 127 | (gamma(0.5*porod_exp)*gammainc(0.5*porod_exp, usub) - |
---|
| 128 | upow*gamma(porod_exp)*gammainc(porod_exp, usub))) |
---|
| 129 | result[q <= 0] = 1.0 |
---|
[23d3b41] | 130 | |
---|
[40a87fa] | 131 | return result |
---|
[23d3b41] | 132 | |
---|
| 133 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 134 | |
---|
[404ebbd] | 135 | def random(): |
---|
| 136 | import numpy as np |
---|
| 137 | rg = 10**np.random.uniform(0, 4) |
---|
| 138 | porod_exp = np.random.uniform(1e-3, 6) |
---|
| 139 | scale = 10**np.random.uniform(1, 5) |
---|
| 140 | pars = dict( |
---|
| 141 | #background=0, |
---|
| 142 | scale=scale, |
---|
| 143 | rg=rg, |
---|
| 144 | porod_exp=porod_exp, |
---|
| 145 | ) |
---|
| 146 | return pars |
---|
| 147 | |
---|
[07a6700] | 148 | tests = [ |
---|
[168052c] | 149 | # Accuracy tests based on content in test/polyexclvol_default_igor.txt |
---|
[6dd90c1] | 150 | [{'rg': 60, 'porod_exp': 3.0}, 0.001, 0.999801], |
---|
| 151 | [{'rg': 60, 'porod_exp': 3.0}, 0.105363, 0.0172751], |
---|
| 152 | [{'rg': 60, 'porod_exp': 3.0, 'background': 0.0}, 0.665075, 6.56261e-05], |
---|
[168052c] | 153 | |
---|
| 154 | # Additional tests with larger range of parameters |
---|
[6dd90c1] | 155 | [{'rg': 10, 'porod_exp': 4.0}, 0.1, 0.724436675809], |
---|
[168052c] | 156 | [{'rg': 2.2, 'porod_exp': 22.0, 'background': 100.0}, 5.0, 100.0], |
---|
| 157 | [{'rg': 1.1, 'porod_exp': 1, 'background': 10.0, 'scale': 1.25}, |
---|
| 158 | 20000., 10.0000712097] |
---|
| 159 | ] |
---|