source: sasmodels/sasmodels/models/teubner_strey.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: 1.8 KB
Line 
1r"""
2Definition
3----------
4
5This model calculates the scattered intensity of a two-component system
6using the Teubner-Strey model. Unlike :ref:`dab` this function generates
7a peak.
8
9.. math::
10
11    I(q) = \frac{1}{a_2 + c_1 q^2 + c_2 q^4} + \text{background}
12
13The parameters $a_2$, $c_1$ and $c_2$ can be used to determine the
14characteristic domain size $d$,
15
16.. math::
17
18    d = 2\pi\left[\frac12\left(\frac{a_2}{c_2}\right)^{1/2}
19                  + \frac14\frac{c_1}{c_2}\right]^{-1/2}
20
21
22and the correlation length $\xi$,
23
24.. math::
25
26    \xi = \left[\frac12\left(\frac{a_2}{c_2}\right)^{1/2}
27                  - \frac14\frac{c_1}{c_2}\right]^{-1/2}
28
29
30For 2D data, scattering intensity is calculated in the same way as 1D,
31where the $q$ vector is defined as
32
33.. math::
34
35    q = \sqrt{q_x^2 + q_y^2}
36
37
38References
39----------
40
41M Teubner, R Strey, *J. Chem. Phys.*, 87 (1987) 3195
42
43K V Schubert, R Strey, S R Kline and E W Kaler,
44*J. Chem. Phys.*, 101 (1994) 5343
45
46"""
47
48import numpy as np
49from numpy import inf, sqrt
50
51name = "teubner_strey"
52title = "Teubner-Strey model of microemulsions"
53description = """\
54   Scattering model class for the Teubner-Strey model given by
55    Provide F(x) = 1/( a2 + c1 q^2+  c2 q^4 ) + background
56    a2>0, c1<0, c2>0, 4 a2 c2 - c1^2 > 0
57"""
58category = "shape-independent"
59
60#             ["name", "units", default, [lower, upper], "type","description"],
61parameters = [["a2", "", 0.1, [0, inf], "",
62               "a2"],
63              ["c1", "1e-6/Ang^2", -30., [-inf, 0], "",
64               "c1"],
65              ["c2", "Ang", 5000., [0, inf], "volume",
66               "c2"],
67             ]
68
69
70def Iq(q, a2, c1, c2):
71    return 1. / np.polyval([c2, c1, a2], q**2)
72Iq.vectorized = True  # Iq accepts an array of q values
73
74demo = dict(scale=1, background=0, a2=0.1, c1=-30.0, c2=5000.0)
75tests = [[{}, 0.2, 0.145927536232]]
Note: See TracBrowser for help on using the repository browser.