source: sasmodels/sasmodels/models/mono_gauss_coil.py @ 2c74c11

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

implicit Iqxy; fix divide by 0 for q=0

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[246517d]1#mono_gauss_coil model
2#conversion of DebyeModel.py
3#converted by Steve King, Mar 2016
4
5
6
7r"""
[6b4f7f6]8This Debye Gaussian coil 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).
[246517d]9
[6b4f7f6]10To describe the scattering from *polydisperse* polymer chains see the :ref:`poly_gauss_coil <poly-gauss-coil>` model.
[246517d]11
12Definition
13----------
14
15     *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background*
[15bd6e7]16
[246517d]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`
[15bd6e7]22
23     *Z* = (*q R* \ :sub:`g`)\ :sup:`2`
[246517d]24
25and
26
[15bd6e7]27     *V* = *M* / (*N*\ :sub:`A` |delta|)
28
[246517d]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
[2c74c11]47from numpy import inf, exp, errstate
[246517d]48
49name =  "mono_gauss_coil"
50title =  "Scattering from monodisperse polymer coils"
51
52description =  """
53    Evaluates the scattering from
[15bd6e7]54    monodisperse polymer chains.
[246517d]55    """
56category =  "shape-independent"
57
58#             ["name", "units", default, [lower, upper], "type", "description"],
[15bd6e7]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"]]
[246517d]61
62# NB: Scale and Background are implicit parameters on every model
63def Iq(q, i_zero, radius_gyration):
64    # pylint: disable = missing-docstring
[2c74c11]65    z = (q * radius_gyration)**2
[246517d]66
[2c74c11]67    with errstate(invalid='ignore'):
68        inten = (i_zero * 2.0) * (exp(-z) + z - 1.0)/z**2
69        inten[q == 0] = i_zero
70    return inten
71Iq.vectorized = True # Iq accepts an array of q values
[246517d]72
73demo =  dict(scale = 1.0,
[15bd6e7]74            i_zero = 70.0,
75            radius_gyration = 75.0,
[246517d]76            background = 0.0)
77
[f10bc52]78# these unit test values taken from SasView 3.1.2
[246517d]79tests =  [
[8898d0f]80    [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 'background': 0.0},
[15bd6e7]81     [0.0106939, 0.469418], [57.1241, 0.112859]],
[246517d]82    ]
Note: See TracBrowser for help on using the repository browser.