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