source: sasmodels/sasmodels/models/poly_gauss_coil.py @ 58c3367

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 58c3367 was 40a87fa, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

lint and latex cleanup

  • Property mode set to 100644
File size: 3.4 KB
Line 
1#poly_gauss_coil model
2#conversion of Poly_GaussCoil.py
3#converted by Steve King, Mar 2016
4r"""
5This empirical model describes the scattering from *polydisperse* polymer
6chains in theta solvents or polymer melts, assuming a Schulz-Zimm type
7molecular weight distribution.
8
9To describe the scattering from *monodisperse* polymer chains, see the
10:ref:`mono-gauss-coil` model.
11
12Definition
13----------
14
15.. math::
16
17     I(q) = \text{scale} \cdot I_0 \cdot P(q) + \text{background}
18
19where
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
33Here, $\phi_\text{poly}$, is the volume fraction of polymer, $V$ is the
34volume 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
37sld of the solvent, and $R_g$ is the radius of gyration of the polymer coil.
38
39The 2D scattering intensity is calculated in the same way as the 1D,
40but where the $q$ vector is redefined as
41
42.. math::
43
44    q = \sqrt{q_x^2 + q_y^2}
45
46References
47----------
48
49O Glatter and O Kratky (editors), *Small Angle X-ray Scattering*,
50Academic Press, (1982) Page 404.
51
52J S Higgins, H C Benoit, *Polymers and Neutron Scattering*,
53Oxford Science Publications, (1996).
54
55S M King, *Small Angle Neutron Scattering* in *Modern Techniques for
56Polymer Characterisation*, Wiley, (1999).
57
58http://www.ncnr.nist.gov/staff/hammouda/distance_learning/chapter_28.pdf
59"""
60
61from numpy import inf, exp, power
62
63name = "poly_gauss_coil"
64title = "Scattering from polydisperse polymer coils"
65
66description = """
67    Evaluates the scattering from
68    polydisperse polymer chains.
69    """
70category = "shape-independent"
71
72# pylint: disable=bad-whitespace, line-too-long
73#   ["name", "units", default, [lower, upper], "type", "description"],
74parameters = [
75    ["i_zero",          "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"],
76    ["radius_gyration",  "Ang", 75.0, [0.0, inf], "", "Radius of gyration"],
77    ["polydispersity",  "None",  2.0, [1.0, inf], "", "Polymer Mw/Mn"],
78    ]
79# pylint: enable=bad-whitespace, line-too-long
80
81# NB: Scale and Background are implicit parameters on every model
82def Iq(q, i_zero, radius_gyration, polydispersity):
83    # pylint: disable = missing-docstring
84    u = polydispersity - 1.0
85    z = (q*radius_gyration)**2 / (1.0 + 2.0*u)
86    # need to trap the case of the polydispersity being 1 (ie, monodisperse!)
87    if polydispersity == 1.0:
88        inten = i_zero * 2.0 * (exp(-z) + z - 1.0)
89    else:
90        inten = i_zero * 2.0 * (power(1.0 + u*z, -1.0/u) + z - 1.0) / (1.0 + u)
91    index = q != 0.
92    inten[~index] = i_zero
93    inten[index] /= z[index]**2
94    return inten
95Iq.vectorized = True  # Iq accepts an array of q values
96
97demo = dict(scale=1.0,
98            i_zero=70.0,
99            radius_gyration=75.0,
100            polydispersity=2.0,
101            background=0.0)
102
103# these unit test values taken from SasView 3.1.2
104tests = [
105    [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0,
106      'polydispersity': 2.0, 'background': 0.0},
107     [0.0106939, 0.469418], [57.6405, 0.169016]],
108    ]
Note: See TracBrowser for help on using the repository browser.