source: sasmodels/sasmodels/models/mono_gauss_coil.py @ f10bc52

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since f10bc52 was f10bc52, checked in by smk78, 8 years ago

Added comment on origin of unit test values (Paul's idea)

  • Property mode set to 100644
File size: 3.3 KB
Line 
1#mono_gauss_coil model
2#conversion of DebyeModel.py
3#converted by Steve King, Mar 2016
4
5
6
7r"""
8This model strictly describes the scattering from *monodisperse* polymer chains in theta solvents or polymer melts, conditions under which the distances between segments follow a Gaussian distribution. Provided the number of segments is large (ie, high molecular weight polymers) the single-chain form factor P(Q) is that described by Debye (1947).
9
10To describe the scattering from *polydisperse* polymer chains, see the To describe the scattering from *monodisperse* polymer chains, see the :ref:`poly_gauss_coil <poly-gauss-coil>` model.
11
12Definition
13----------
14
15     *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background*
16
17where
18
19     *I*\ :sub:`0` = |phi|\ :sub:`poly` |cdot| *V* |cdot| (|rho|\ :sub:`poly` - |rho|\ :sub:`solv`)\  :sup:`2`
20
21     *P(q)* = 2 [exp(-Z) + Z - 1] / Z \ :sup:`2`
22
23     *Z* = (*q R* \ :sub:`g`)\ :sup:`2`
24
25and
26
27     *V* = *M* / (*N*\ :sub:`A` |delta|)
28
29Here, |phi|\ :sub:`poly` is the volume fraction of polymer, *V* is the volume of a polymer coil, *M* is the molecular weight of the polymer, *N*\ :sub:`A` is Avogadro's Number, |delta| is the bulk density of the polymer, |rho|\ :sub:`poly` is the sld of the polymer, |rho|\ :sub:`solv` is the sld of the solvent, and *R*\ :sub:`g` is the radius of gyration of the polymer coil.
30
31The 2D scattering intensity is calculated in the same way as the 1D, but where the *q* vector is redefined as
32
33.. math::
34
35    q = \sqrt{q_x^2 + q_y^2}
36
37References
38----------
39
40P Debye, *J. Phys. Colloid. Chem.*, 51 (1947) 18.
41
42R J Roe, *Methods of X-Ray and Neutron Scattering in Polymer Science*, Oxford University Press, New York (2000).
43
44http://www.ncnr.nist.gov/staff/hammouda/distance_learning/chapter_28.pdf
45"""
46
47from numpy import inf, sqrt, exp
48
49name =  "mono_gauss_coil"
50title =  "Scattering from monodisperse polymer coils"
51
52description =  """
53    Evaluates the scattering from
54    monodisperse polymer chains.
55    """
56category =  "shape-independent"
57
58#             ["name", "units", default, [lower, upper], "type", "description"],
59parameters =  [["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"],
60               ["radius_gyration", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"]]
61
62# NB: Scale and Background are implicit parameters on every model
63def Iq(q, i_zero, radius_gyration):
64    # pylint: disable = missing-docstring
65    z = (q * radius_gyration) * (q * radius_gyration)
66    if (q == 0).any():
67       inten = i_zero
68    else:
69       inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z)
70    return inten
71#Iq.vectorized = True # Iq accepts an array of q values
72
73def Iqxy(qx, qy, *args):
74    # pylint: disable = missing-docstring
75    return Iq(sqrt(qx ** 2 + qy ** 2), *args)
76#Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values
77
78demo =  dict(scale = 1.0,
79            i_zero = 70.0,
80            radius_gyration = 75.0,
81            background = 0.0)
82
83oldname =  "DebyeModel"
84oldpars =  dict(scale = 'scale',
85               radius_gyration = 'rg',
86               background = 'background')
87
88# these unit test values taken from SasView 3.1.2
89tests =  [
90    [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 'background': 0.0},
91     [0.0106939, 0.469418], [57.1241, 0.112859]],
92    ]
Note: See TracBrowser for help on using the repository browser.