source: sasmodels/sasmodels/models/gauss_lorentz_gel.py @ 6cefbc9

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

lint and latex cleanup

  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[29da213]1r"""
2This model calculates the scattering from a gel structure,
3but typically a physical rather than chemical network.
[b8954d7]4It is modeled as a sum of a low-q exponential decay (which happens to
5give a functional form similar to Guinier scattering, so interpret with
6care) plus a Lorentzian at higher-q values. See also the gel_fit model.
[29da213]7
8Definition
9----------
10
[40a87fa]11The scattering intensity $I(q)$ is calculated as (Eqn. 5 from the reference)
[29da213]12
[40a87fa]13.. math:: I(q) = I_G(0) \exp(-q^2\Xi ^2/2) + I_L(0)/(1+q^2\xi^2)
[29da213]14
[40a87fa]15$\Xi$ is the length scale of the static correlations in the gel, which can
16be attributed to the "frozen-in" crosslinks. $\xi$ is the dynamic correlation
17length, which can be attributed to the fluctuating polymer chains between
18crosslinks. $I_G(0)$ and $I_L(0)$ are the scaling factors for each of these
19structures. Think carefully about how these map to your particular system!
[29da213]20
21.. note::
22    The peaked structure at higher $q$ values (Figure 2 from the reference)
23    is not reproduced by the model. Peaks can be introduced into the model
[40a87fa]24    by summing this model with the :ref:`gaussian-peak` model.
[29da213]25
26For 2D data the scattering intensity is calculated in the same way as 1D,
27where the $q$ vector is defined as
28
[40a87fa]29.. math:: q = \sqrt{q_x^2 + q_y^2}
[29da213]30
31References
32----------
33
[168052c]34G Evmenenko, E Theunissen, K Mortensen, H Reynaers, *Polymer*,
3542 (2001) 2907-2913
[29da213]36
37"""
38
[2c74c11]39from numpy import inf, exp
[29da213]40
41name = "gauss_lorentz_gel"
42title = "Gauss Lorentz Gel model of scattering from a gel structure"
43description = """
44            Class that evaluates a GaussLorentzGel model.
45
46            I(q) = scale_g*exp(- q^2*Z^2 / 2)+scale_l/(1+q^2*z^2)
47                    + background
48            List of default parameters:
49                scale_g = Gauss scale factor
50                Z = Static correlation length
51                scale_l = Lorentzian scale factor
52                z = Dynamic correlation length
53                background = Incoherent background
54            """
55category = "shape-independent"
[168052c]56# pylint: disable=bad-whitespace, line-too-long
[29da213]57#            ["name", "units", default, [lower, upper], "type", "description"],
58parameters = [["gauss_scale_factor",   "",    100.0,  [-inf, inf], "", "Gauss scale factor"],
59              ["static_cor_length",    "Ang", 100.0,  [0, inf],    "", "Static correlation length"],
60              ["lorentz_scale_factor", "",     50.0,  [-inf, inf], "", "Lorentzian scale factor"],
61              ["dynamic_cor_length",   "Ang",  20.0,  [0, inf],    "", "Dynamic correlation length"],
[168052c]62             ]
63# pylint: enable=bad-whitespace, line-too-long
[29da213]64
65def Iq(q,
[168052c]66       gauss_scale_factor=100.0,
67       static_cor_length=100.0,
68       lorentz_scale_factor=50.0,
69       dynamic_cor_length=20.0):
70    """
71
72    :param q:                    Input q-value
73    :param gauss_scale_factor:   Gauss scale factor
74    :param static_cor_length:    Static correlation length
75    :param lorentz_scale_factor: Lorentzian scale factor
76    :param dynamic_cor_length:   Dynamic correlation length
77    :return:                     1-D intensity
78    """
79
80    term1 = gauss_scale_factor *\
81            exp(-1.0*q*q*static_cor_length*static_cor_length/2.0)
82    term2 = lorentz_scale_factor /\
83            (1.0+(q*dynamic_cor_length)*(q*dynamic_cor_length))
84
85    return term1 + term2
[29da213]86
87Iq.vectorized = True  # Iq accepts an array of q values
88
89
90demo = dict(scale=1, background=0.1,
91            gauss_scale_factor=100.0,
92            static_cor_length=100.0,
93            lorentz_scale_factor=50.0,
94            dynamic_cor_length=20.0)
95
[07a6700]96tests = [
[168052c]97
98    # Accuracy tests based on content in test/utest_extra_models.py
99    [{'gauss_scale_factor':  100.0,
100      'static_cor_length':   100.0,
101      'lorentz_scale_factor': 50.0,
102      'dynamic_cor_length':   20.0,
[6dd90c1]103     }, 0.001, 149.482],
[168052c]104
105    [{'gauss_scale_factor':  100.0,
106      'static_cor_length':   100.0,
107      'lorentz_scale_factor': 50.0,
108      'dynamic_cor_length':   20.0,
[6dd90c1]109     }, 0.105363, 9.1913],
[168052c]110
111    [{'gauss_scale_factor':  100.0,
112      'static_cor_length':   100.0,
113      'lorentz_scale_factor': 50.0,
114      'dynamic_cor_length':   20.0,
[6dd90c1]115     }, 0.441623, 0.633811],
[168052c]116
117    # Additional tests with larger range of parameters
118    [{'gauss_scale_factor':  10.0,
119      'static_cor_length':  100.0,
120      'lorentz_scale_factor': 3.0,
121      'dynamic_cor_length':   1.0,
[6dd90c1]122     }, 0.1, 2.9712970297],
[168052c]123
124    [{'gauss_scale_factor':  10.0,
125      'static_cor_length':  100.0,
126      'lorentz_scale_factor': 3.0,
127      'dynamic_cor_length':   1.0,
128      'background':         100.0
[6dd90c1]129     }, 5.0, 100.116384615],
[168052c]130
131    [{'gauss_scale_factor':  10.0,
132      'static_cor_length':  100.0,
133      'lorentz_scale_factor': 3.0,
134      'dynamic_cor_length':   1.0,
[6dd90c1]135      'background':           0.0,
[168052c]136     }, 200., 7.49981250469e-05],
137    ]
Note: See TracBrowser for help on using the repository browser.