[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. |
---|
[a2ca6e5] | 19 | |
---|
[547c6f0] | 20 | This integral was put into an almost analytical form as follows |
---|
[513efc5] | 21 | (Hammouda, 1993) |
---|
[23d3b41] | 22 | |
---|
| 23 | .. math:: |
---|
| 24 | |
---|
[547c6f0] | 25 | P(Q)=\frac{1}{\nu U^{1/2\nu}} |
---|
| 26 | \left\{ |
---|
| 27 | \gamma\left(\frac{1}{2\nu},U\right) - |
---|
| 28 | \frac{1}{U^{1/2\nu}}\gamma\left(\frac{1}{\nu},U\right) |
---|
| 29 | \right\} |
---|
[a2ca6e5] | 30 | |
---|
[547c6f0] | 31 | and later recast as (for example, Hore, 2013; Hammouda & Kim, 2017) |
---|
[a2ca6e5] | 32 | |
---|
| 33 | .. math:: |
---|
| 34 | |
---|
| 35 | P(Q)=\frac{1}{\nu U^{1/2\nu}}\gamma\left(\frac{1}{2\nu},U\right) - |
---|
[23d3b41] | 36 | \frac{1}{\nu U^{1/\nu}}\gamma\left(\frac{1}{\nu},U\right) |
---|
| 37 | |
---|
| 38 | where $\gamma(x,U)$ is the incomplete gamma function |
---|
| 39 | |
---|
| 40 | .. math:: |
---|
| 41 | |
---|
[547c6f0] | 42 | \gamma(x,U)=\int_0^{U}dt\ \exp(-t)t^{x-1} |
---|
[23d3b41] | 43 | |
---|
| 44 | and the variable $U$ is given in terms of the scattering vector $Q$ as |
---|
| 45 | |
---|
| 46 | .. math:: |
---|
| 47 | |
---|
| 48 | U=\frac{Q^2a^2n^{2\nu}}{6} = \frac{Q^2R_{g}^2(2\nu+1)(2\nu+2)}{6} |
---|
| 49 | |
---|
[a2ca6e5] | 50 | The two analytic forms are equivalent. In the 1993 paper |
---|
| 51 | |
---|
| 52 | .. math:: |
---|
| 53 | |
---|
| 54 | \frac{1}{\nu U^{1/2\nu}} |
---|
| 55 | |
---|
| 56 | has been factored out. |
---|
| 57 | |
---|
| 58 | **SasView implements the 1993 expression**. |
---|
| 59 | |
---|
[23d3b41] | 60 | The square of the radius-of-gyration is defined as |
---|
| 61 | |
---|
| 62 | .. math:: |
---|
| 63 | |
---|
| 64 | R_{g}^2 = \frac{a^2n^{2\nu}}{(2\nu+1)(2\nu+2)} |
---|
| 65 | |
---|
[a2ca6e5] | 66 | .. note:: |
---|
| 67 | This model applies only in the mass fractal range (ie, $5/3<=m<=3$ ) |
---|
| 68 | and **does not apply** to surface fractals ( $3<m<=4$ ). |
---|
| 69 | It also does not reproduce the rigid rod limit (m=1) because it assumes chain |
---|
| 70 | flexibility from the outset. It may cover a portion of the semi-flexible chain |
---|
| 71 | range ( $1<m<5/3$ ). |
---|
[23d3b41] | 72 | |
---|
[513efc5] | 73 | A low-Q expansion yields the Guinier form and a high-Q expansion yields the |
---|
| 74 | Porod form which is given by |
---|
[23d3b41] | 75 | |
---|
| 76 | .. math:: |
---|
| 77 | |
---|
[513efc5] | 78 | P(Q\rightarrow \infty) = \frac{1}{\nu U^{1/2\nu}}\Gamma\left( |
---|
| 79 | \frac{1}{2\nu}\right) - \frac{1}{\nu U^{1/\nu}}\Gamma\left( |
---|
| 80 | \frac{1}{\nu}\right) |
---|
[23d3b41] | 81 | |
---|
| 82 | Here $\Gamma(x) = \gamma(x,\infty)$ is the gamma function. |
---|
| 83 | |
---|
| 84 | The asymptotic limit is dominated by the first term |
---|
| 85 | |
---|
| 86 | .. math:: |
---|
| 87 | |
---|
| 88 | P(Q\rightarrow \infty) \sim \frac{1}{\nu U^{1/2\nu}}\Gamma\left(\frac{1}{2\nu}\right) = |
---|
| 89 | \frac{m}{\left(QR_{g}\right)^m}\left[\frac{6}{(2\nu +1)(2\nu +2)} \right]^{m/2} |
---|
| 90 | \Gamma (m/2) |
---|
| 91 | |
---|
[bf59527] | 92 | The special case when $\nu=0.5$ (or $m=1/\nu=2$ ) corresponds to Gaussian chains for |
---|
[23d3b41] | 93 | which the form factor is given by the familiar Debye function. |
---|
| 94 | |
---|
| 95 | .. math:: |
---|
| 96 | |
---|
[547c6f0] | 97 | P(Q) = \frac{2}{Q^4R_{g}^4} \left[\exp(-Q^2R_{g}^2) - 1 + Q^2R_{g}^2 \right] |
---|
[23d3b41] | 98 | |
---|
| 99 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
| 100 | where the $q$ vector is defined as |
---|
| 101 | |
---|
| 102 | .. math:: |
---|
| 103 | |
---|
| 104 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | References |
---|
| 108 | ---------- |
---|
| 109 | |
---|
[0507e09] | 110 | .. [#] H Benoit, *Comptes Rendus*, 245 (1957) 2244-2247 |
---|
| 111 | .. [#] B Hammouda, *SANS from Homogeneous Polymer Mixtures - A Unified Overview, Advances in Polym. Sci.* 106 (1993) 87-133 |
---|
| 112 | .. [#] M Hore et al, *Co-Nonsolvency of Poly(n-isopropylacrylamide) in Deuterated Water/Ethanol Mixtures* 46 (2013) 7894-7901 |
---|
| 113 | .. [#] B Hammouda & M-H Kim, *The empirical core-chain model* 247 (2017) 434-440 |
---|
[23d3b41] | 114 | |
---|
[0507e09] | 115 | Source |
---|
| 116 | ------ |
---|
[a2ca6e5] | 117 | |
---|
[0507e09] | 118 | `polymer_excl_volume.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/polymer_excl_volume.py>`_ |
---|
[a2ca6e5] | 119 | |
---|
[0507e09] | 120 | `polymer_excl_volume.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/polymer_excl_volume.c>`_ |
---|
| 121 | |
---|
| 122 | Authorship and Verification |
---|
| 123 | ---------------------------- |
---|
| 124 | |
---|
| 125 | * **Author:** |
---|
| 126 | * **Last Modified by:** |
---|
| 127 | * **Last Reviewed by:** |
---|
| 128 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
[23d3b41] | 129 | """ |
---|
| 130 | |
---|
[2d81cfe] | 131 | import numpy as np |
---|
[2c74c11] | 132 | from numpy import inf, power, errstate |
---|
[23d3b41] | 133 | from scipy.special import gammainc, gamma |
---|
| 134 | |
---|
| 135 | name = "polymer_excl_volume" |
---|
| 136 | title = "Polymer Excluded Volume model" |
---|
[513efc5] | 137 | description = """Compute the scattering intensity from polymers with excluded |
---|
| 138 | volume effects. |
---|
[23d3b41] | 139 | rg: radius of gyration |
---|
| 140 | porod_exp: Porod exponent |
---|
| 141 | """ |
---|
| 142 | category = "shape-independent" |
---|
| 143 | |
---|
[168052c] | 144 | # pylint: disable=bad-whitespace, line-too-long |
---|
[40a87fa] | 145 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 146 | parameters = [ |
---|
[404ebbd] | 147 | ["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"], |
---|
| 148 | ["porod_exp", "", 3.0, [0, inf], "", "Porod exponent"], |
---|
[40a87fa] | 149 | ] |
---|
[168052c] | 150 | # pylint: enable=bad-whitespace, line-too-long |
---|
[23d3b41] | 151 | |
---|
| 152 | |
---|
[416609b] | 153 | def Iq(q, rg=60.0, porod_exp=3.0): |
---|
[23d3b41] | 154 | """ |
---|
| 155 | :param q: Input q-value (float or [float, float]) |
---|
| 156 | :param rg: Radius of gyration |
---|
| 157 | :param porod_exp: Porod exponent |
---|
| 158 | :return: Calculated intensity |
---|
| 159 | """ |
---|
[40a87fa] | 160 | usub = (q*rg)**2 * (2.0/porod_exp + 1.0) * (2.0/porod_exp + 2.0)/6.0 |
---|
[2c74c11] | 161 | with errstate(divide='ignore', invalid='ignore'): |
---|
[40a87fa] | 162 | upow = power(usub, -0.5*porod_exp) |
---|
[aa90015] | 163 | # Note: scipy gammainc is "regularized", being gamma(s,x)/Gamma(s), |
---|
| 164 | # so need to scale by Gamma(s) to recover gamma(s, x). |
---|
[2d81cfe] | 165 | result = (porod_exp*upow * |
---|
| 166 | (gamma(0.5*porod_exp)*gammainc(0.5*porod_exp, usub) - |
---|
| 167 | upow*gamma(porod_exp)*gammainc(porod_exp, usub))) |
---|
[40a87fa] | 168 | result[q <= 0] = 1.0 |
---|
[23d3b41] | 169 | |
---|
[40a87fa] | 170 | return result |
---|
[23d3b41] | 171 | |
---|
| 172 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 173 | |
---|
[404ebbd] | 174 | def random(): |
---|
[b297ba9] | 175 | """Return a random parameter set for the model.""" |
---|
[404ebbd] | 176 | rg = 10**np.random.uniform(0, 4) |
---|
| 177 | porod_exp = np.random.uniform(1e-3, 6) |
---|
| 178 | scale = 10**np.random.uniform(1, 5) |
---|
| 179 | pars = dict( |
---|
| 180 | #background=0, |
---|
| 181 | scale=scale, |
---|
| 182 | rg=rg, |
---|
| 183 | porod_exp=porod_exp, |
---|
| 184 | ) |
---|
| 185 | return pars |
---|
| 186 | |
---|
[07a6700] | 187 | tests = [ |
---|
[168052c] | 188 | # Accuracy tests based on content in test/polyexclvol_default_igor.txt |
---|
[6dd90c1] | 189 | [{'rg': 60, 'porod_exp': 3.0}, 0.001, 0.999801], |
---|
| 190 | [{'rg': 60, 'porod_exp': 3.0}, 0.105363, 0.0172751], |
---|
| 191 | [{'rg': 60, 'porod_exp': 3.0, 'background': 0.0}, 0.665075, 6.56261e-05], |
---|
[168052c] | 192 | |
---|
| 193 | # Additional tests with larger range of parameters |
---|
[6dd90c1] | 194 | [{'rg': 10, 'porod_exp': 4.0}, 0.1, 0.724436675809], |
---|
[168052c] | 195 | [{'rg': 2.2, 'porod_exp': 22.0, 'background': 100.0}, 5.0, 100.0], |
---|
| 196 | [{'rg': 1.1, 'porod_exp': 1, 'background': 10.0, 'scale': 1.25}, |
---|
| 197 | 20000., 10.0000712097] |
---|
| 198 | ] |
---|