1 | #poly_gauss_coil model |
---|
2 | #conversion of Poly_GaussCoil.py |
---|
3 | #converted by Steve King, Mar 2016 |
---|
4 | r""" |
---|
5 | This empirical model describes the scattering from *polydisperse* polymer |
---|
6 | chains in theta solvents or polymer melts, assuming a Schulz-Zimm type |
---|
7 | molecular weight distribution. |
---|
8 | |
---|
9 | To describe the scattering from *monodisperse* polymer chains, see the |
---|
10 | :ref:`mono-gauss-coil` model. |
---|
11 | |
---|
12 | Definition |
---|
13 | ---------- |
---|
14 | |
---|
15 | .. math:: |
---|
16 | |
---|
17 | I(q) = \text{scale} \cdot I_0 \cdot P(q) + \text{background} |
---|
18 | |
---|
19 | where |
---|
20 | |
---|
21 | .. math:: |
---|
22 | |
---|
23 | I_0 &= \phi_\text{poly} \cdot V \cdot (\rho_\text{poly}-\rho_\text{solv})^2 |
---|
24 | |
---|
25 | P(q) &= 2 [(1 + UZ)^{-1/U} + Z - 1] / [(1 + U) Z^2] |
---|
26 | |
---|
27 | Z &= [(q R_g)^2] / (1 + 2U) |
---|
28 | |
---|
29 | U &= (Mw / Mn) - 1 = \text{polydispersity ratio} - 1 |
---|
30 | |
---|
31 | V &= M / (N_A \delta) |
---|
32 | |
---|
33 | Here, $\phi_\text{poly}$, is the volume fraction of polymer, $V$ is the |
---|
34 | volume of a polymer coil, $M$ is the molecular weight of the polymer, |
---|
35 | $N_A$ is Avogadro's Number, $\delta$ is the bulk density of the polymer, |
---|
36 | $\rho_\text{poly}$ is the sld of the polymer, $\rho_\text{solv}$ is the |
---|
37 | sld of the solvent, and $R_g$ is the radius of gyration of the polymer coil. |
---|
38 | |
---|
39 | The 2D scattering intensity is calculated in the same way as the 1D, |
---|
40 | but where the $q$ vector is redefined as |
---|
41 | |
---|
42 | .. math:: |
---|
43 | |
---|
44 | q = \sqrt{q_x^2 + q_y^2} |
---|
45 | |
---|
46 | References |
---|
47 | ---------- |
---|
48 | |
---|
49 | O Glatter and O Kratky (editors), *Small Angle X-ray Scattering*, |
---|
50 | Academic Press, (1982) Page 404. |
---|
51 | |
---|
52 | J S Higgins, H C Benoit, *Polymers and Neutron Scattering*, |
---|
53 | Oxford Science Publications, (1996). |
---|
54 | |
---|
55 | S M King, *Small Angle Neutron Scattering* in *Modern Techniques for |
---|
56 | Polymer Characterisation*, Wiley, (1999). |
---|
57 | |
---|
58 | http://www.ncnr.nist.gov/staff/hammouda/distance_learning/chapter_28.pdf |
---|
59 | """ |
---|
60 | |
---|
61 | import numpy as np |
---|
62 | from numpy import inf, expm1, power |
---|
63 | |
---|
64 | name = "poly_gauss_coil" |
---|
65 | title = "Scattering from polydisperse polymer coils" |
---|
66 | |
---|
67 | description = """ |
---|
68 | Evaluates the scattering from |
---|
69 | polydisperse polymer chains. |
---|
70 | """ |
---|
71 | category = "shape-independent" |
---|
72 | |
---|
73 | # pylint: disable=bad-whitespace, line-too-long |
---|
74 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
75 | parameters = [ |
---|
76 | ["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], |
---|
77 | ["rg", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], |
---|
78 | ["polydispersity", "None", 2.0, [1.0, inf], "", "Polymer Mw/Mn"], |
---|
79 | ] |
---|
80 | # pylint: enable=bad-whitespace, line-too-long |
---|
81 | |
---|
82 | # NB: Scale and Background are implicit parameters on every model |
---|
83 | def Iq(q, i_zero, rg, polydispersity): |
---|
84 | # pylint: disable = missing-docstring |
---|
85 | u = polydispersity - 1.0 |
---|
86 | z = q**2 * (rg**2 / (1.0 + 2.0*u)) |
---|
87 | |
---|
88 | # need to trap the case of the polydispersity being 1 (ie, monodisperse!) |
---|
89 | if polydispersity == 1.0: |
---|
90 | result = 2.0 * (expm1(-z) + z) |
---|
91 | index = q != 0. |
---|
92 | result[index] /= z[index]**2 |
---|
93 | result[~index] = 1.0 |
---|
94 | else: |
---|
95 | # Taylor series around z=0 of (2*(1+uz)^(-1/u) + z - 1) / (z^2(u+1)) |
---|
96 | p = [ |
---|
97 | #(-1 - 20*u - 155*u**2 - 580*u**3 - 1044*u**4 - 720*u**5) / 2520., |
---|
98 | #( 1 + 14*u + 71*u**2 + 154*u**3 + 120*u**4) / 360., |
---|
99 | #(-1 - 9*u - 26*u**2 - 24*u**3) / 60., |
---|
100 | ( 1 + 5*u + 6*u**2) / 12., |
---|
101 | (-1 - 2*u) / 3., |
---|
102 | ( 1 ), |
---|
103 | ] |
---|
104 | result = 2.0 * (power(1.0 + u*z, -1.0/u) + z - 1.0) / (1.0 + u) |
---|
105 | index = z > 1e-4 |
---|
106 | result[index] /= z[index]**2 |
---|
107 | result[~index] = np.polyval(p, z[~index]) |
---|
108 | return i_zero * result |
---|
109 | Iq.vectorized = True # Iq accepts an array of q values |
---|
110 | |
---|
111 | demo = dict(scale=1.0, |
---|
112 | i_zero=70.0, |
---|
113 | rg=75.0, |
---|
114 | polydispersity=2.0, |
---|
115 | background=0.0) |
---|
116 | |
---|
117 | # these unit test values taken from SasView 3.1.2 |
---|
118 | tests = [ |
---|
119 | [{'scale': 1.0, 'i_zero': 70.0, 'rg': 75.0, |
---|
120 | 'polydispersity': 2.0, 'background': 0.0}, |
---|
121 | [0.0106939, 0.469418], [57.6405, 0.169016]], |
---|
122 | ] |
---|