[29da213] | 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 plus |
---|
| 5 | a lorentzian at higher-q values. |
---|
| 6 | |
---|
| 7 | Definition |
---|
| 8 | ---------- |
---|
| 9 | |
---|
| 10 | The scattering intensity I(q) is calculated as (Eqn. 5 from the reference) |
---|
| 11 | |
---|
| 12 | .. math:: |
---|
| 13 | |
---|
| 14 | I(q) = I_G(0)exp(-q^2\Xi ^2/2) + I_L(0)/(1+q^2\xi^2) |
---|
| 15 | |
---|
| 16 | $\Xi$ is the length scale of the static correlations in the gel, |
---|
| 17 | which can be attributed to the "frozen-in" crosslinks. |
---|
| 18 | $\xi is the dynamic correlation length, which can be attributed to the |
---|
| 19 | fluctuating polymer chains between crosslinks. |
---|
| 20 | $IG(0)$ and $IL(0)$ are the scaling factors for each of these structures. |
---|
| 21 | Think carefully about how these map to your particular system! |
---|
| 22 | |
---|
| 23 | .. note:: |
---|
| 24 | The peaked structure at higher $q$ values (Figure 2 from the reference) |
---|
| 25 | is not reproduced by the model. Peaks can be introduced into the model |
---|
| 26 | by summing this model with the PeakGaussModel function. |
---|
| 27 | |
---|
| 28 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
| 29 | where the $q$ vector is defined as |
---|
| 30 | |
---|
| 31 | .. math:: |
---|
| 32 | |
---|
| 33 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | .. figure:: img/gauss_lorentz_gel_1d.jpg |
---|
| 37 | |
---|
| 38 | 1D plot using the default values (w/500 data point). |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | References |
---|
| 42 | ---------- |
---|
| 43 | |
---|
| 44 | G Evmenenko, E Theunissen, K Mortensen, H Reynaers, *Polymer*, 42 (2001) 2907-2913 |
---|
| 45 | |
---|
| 46 | """ |
---|
| 47 | |
---|
| 48 | from numpy import inf, pi, sqrt, exp |
---|
| 49 | |
---|
| 50 | name = "gauss_lorentz_gel" |
---|
| 51 | title = "Gauss Lorentz Gel model of scattering from a gel structure" |
---|
| 52 | description = """ |
---|
| 53 | Class that evaluates a GaussLorentzGel model. |
---|
| 54 | |
---|
| 55 | I(q) = scale_g*exp(- q^2*Z^2 / 2)+scale_l/(1+q^2*z^2) |
---|
| 56 | + background |
---|
| 57 | List of default parameters: |
---|
| 58 | scale_g = Gauss scale factor |
---|
| 59 | Z = Static correlation length |
---|
| 60 | scale_l = Lorentzian scale factor |
---|
| 61 | z = Dynamic correlation length |
---|
| 62 | background = Incoherent background |
---|
| 63 | """ |
---|
| 64 | category = "shape-independent" |
---|
| 65 | |
---|
| 66 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 67 | parameters = [["gauss_scale_factor", "", 100.0, [-inf, inf], "", "Gauss scale factor"], |
---|
| 68 | ["static_cor_length", "Ang", 100.0, [0, inf], "", "Static correlation length"], |
---|
| 69 | ["lorentz_scale_factor", "", 50.0, [-inf, inf], "", "Lorentzian scale factor"], |
---|
| 70 | ["dynamic_cor_length", "Ang", 20.0, [0, inf], "", "Dynamic correlation length"], |
---|
| 71 | ] |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | def Iq(q, |
---|
| 75 | gauss_scale_factor, |
---|
| 76 | static_cor_length, |
---|
| 77 | lorentz_scale_factor, |
---|
| 78 | dynamic_cor_length): |
---|
| 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 |
---|
| 86 | |
---|
| 87 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | def Iqxy(qx, qy, *args): |
---|
| 91 | iq = Iq(sqrt(qx**2 + qy**2), *args) |
---|
| 92 | |
---|
| 93 | return iq |
---|
| 94 | |
---|
| 95 | Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | demo = dict(scale=1, background=0.1, |
---|
| 99 | gauss_scale_factor=100.0, |
---|
| 100 | static_cor_length=100.0, |
---|
| 101 | lorentz_scale_factor=50.0, |
---|
| 102 | dynamic_cor_length=20.0) |
---|
| 103 | |
---|
| 104 | oldname = "GaussLorentzGelModel" |
---|
| 105 | |
---|
| 106 | oldpars = dict(background='background', |
---|
| 107 | gauss_scale_factor='scale_g', |
---|
| 108 | static_cor_length='stat_colength', |
---|
| 109 | lorentz_scale_factor='scale_l', |
---|
| 110 | dynamic_cor_length='dyn_colength') |
---|
| 111 | |
---|
[07a6700] | 112 | tests = [ |
---|
| 113 | # Accuracy tests based on content in test/utest_extra_models.py |
---|
| 114 | [{'gauss_scale_factor': 100.0, |
---|
| 115 | 'static_cor_length': 100.0, |
---|
| 116 | 'lorentz_scale_factor': 50.0, |
---|
| 117 | 'dynamic_cor_length': 20.0, |
---|
| 118 | }, 0.001, 149.481], |
---|
| 119 | |
---|
| 120 | [{'gauss_scale_factor': 100.0, |
---|
| 121 | 'static_cor_length': 100.0, |
---|
| 122 | 'lorentz_scale_factor': 50.0, |
---|
| 123 | 'dynamic_cor_length': 20.0, |
---|
| 124 | }, 0.105363, 9.1903], |
---|
| 125 | |
---|
| 126 | [{'gauss_scale_factor': 100.0, |
---|
| 127 | 'static_cor_length': 100.0, |
---|
| 128 | 'lorentz_scale_factor': 50.0, |
---|
| 129 | 'dynamic_cor_length': 20.0, |
---|
| 130 | }, 0.441623, 0.632811], |
---|
| 131 | |
---|
| 132 | # Additional tests with larger range of parameters |
---|
| 133 | [{'gauss_scale_factor': 10.0, |
---|
[29da213] | 134 | 'static_cor_length': 100.0, |
---|
| 135 | 'lorentz_scale_factor': 3.0, |
---|
| 136 | 'dynamic_cor_length': 1.0, |
---|
| 137 | }, 0.1, 2.9702970297], |
---|
| 138 | |
---|
| 139 | [{'gauss_scale_factor': 10.0, |
---|
| 140 | 'static_cor_length': 100.0, |
---|
| 141 | 'lorentz_scale_factor': 3.0, |
---|
| 142 | 'dynamic_cor_length': 1.0, |
---|
| 143 | 'background': 100.0 |
---|
| 144 | }, 5.0, 100.115384615], |
---|
| 145 | |
---|
| 146 | [{'gauss_scale_factor': 10.0, |
---|
| 147 | 'static_cor_length': 100.0, |
---|
| 148 | 'lorentz_scale_factor': 3.0, |
---|
| 149 | 'dynamic_cor_length': 1.0, |
---|
| 150 | }, 200., 7.49981250469e-05], |
---|
| 151 | ] |
---|