source: sasmodels/sasmodels/models/teubner_strey.py @ b3f2a24

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since b3f2a24 was b3f2a24, checked in by dirk, 8 years ago

update help for Teubner-Stray model

  • Property mode set to 100644
File size: 3.3 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. A two-phase material can be characterised by two length scales -
8a correlation length and a domain size (periodicity).
9
10The original paper by Teubner and Strey defined the function as:
11
12.. math::
13
14    I(q) \propto \frac{1}{a_2 + c_1 q^2 + c_2 q^4} + \text{background}
15
16where the parameters $a_2$, $c_1$ and $c_2$ are defined in terms of the
17periodicity, $d$, and correlation length $\xi$ as:
18
19.. math::
20
21    a_2 &= \biggl[1+\bigl(\frac{2\pi\xi}{d}\bigr)^2\biggr]^2\\
22    c_1 &= -2\xi^2\bigl(\frac{2\pi\xi}{d}\bigr)^2+2\xi^2\\
23    c_2 &= \xi^4
24
25and thus, the periodicity, $d$ is given by
26
27.. math::
28
29    d = 2\pi\left[\frac12\left(\frac{a_2}{c_2}\right)^{1/2}
30                  - \frac14\frac{c_1}{c_2}\right]^{-1/2}
31
32and the correlation length, $\xi$, is given by
33
34.. math::
35
36    \xi = \left[\frac12\left(\frac{a_2}{c_2}\right)^{1/2}
37                  + \frac14\frac{c_1}{c_2}\right]^{-1/2}
38
39Here the model is parameterised in terms of  $d$ and $\xi$ and with an explicit
40volume fraction for one phase, $\phi_a$, and contrast,
41$\delta\rho^2 = (\rho_a - \rho_b)^2$ :
42
43.. math::
44
45    I(q) = \frac{8\pi\phi_a(1-\phi_a)(\Delta\rho)^2c_2/\xi}
46        {a_2 + c_1q^2 + c_2q^4}
47
48where :math:`8\pi\phi_a(1-\phi_a)(\Delta\rho)^2c_2/\xi` is the constant of
49proportionality from the first equation above.
50
51In the case of a microemulsion, $a_2 > 0$, $c_1 < 0$, and $c_2 >0$.
52
53For 2D data, scattering intensity is calculated in the same way as 1D,
54where the $q$ vector is defined as
55
56.. math::
57
58    q = \sqrt{q_x^2 + q_y^2}
59
60References
61----------
62
63M Teubner, R Strey, *J. Chem. Phys.*, 87 (1987) 3195
64
65K V Schubert, R Strey, S R Kline and E W Kaler,
66*J. Chem. Phys.*, 101 (1994) 5343
67
68H Endo, M Mihailescu, M. Monkenbusch, J Allgaier, G Gompper, D Richter,
69B Jakobs, T Sottmann, R Strey, and I Grillo, *J. Chem. Phys.*, 115 (2001), 580
70"""
71
72import numpy as np
73from numpy import inf,power,pi
74
75name = "teubner_strey"
76title = "Teubner-Strey model of microemulsions"
77description = """\
78    Calculates scattering according to the Teubner-Strey model
79"""
80category = "shape-independent"
81
82#   ["name", "units", default, [lower, upper], "type","description"],
83parameters = [
84    ["volfraction_a", "", 0.5, [0, 1.0], "", "Volume fraction of phase a"],
85    ["sld_a", "1e-6/Ang^2", 0.3, [-inf, inf], "", "SLD of phase a"],
86    ["sld_b", "1e-6/Ang^2", 6.3, [-inf, inf], "", "SLD of phase b"],
87    ["d", "Ang", 100.0, [0, inf], "", "Domain size (periodicity)"],
88    ["xi", "Ang", 30.0, [0, inf], "", "Correlation length"],
89    ]
90
91def Iq(q, volfraction, sld, sld_solvent,d,xi):
92    """SAS form"""
93    drho2 = (sld-sld_solvent)*(sld-sld_solvent)
94    k = 2.0*pi*xi/d
95    a2 = power(1.0+power(k,2.0),2.0)
96    c1 = -2.0*xi*xi*power(k,2.0)+2*xi*xi
97    c2 = power(xi,4.0)
98    prefactor = 8.0*pi*volfraction*(1.0-volfraction)*drho2*c2/xi
99    #k2 = (2.0*pi/d)*(2.0*pi/d)
100    #xi2 = 1/(xi*xi)
101    #q2 = q*q
102    #result = prefactor/((xi2+k2)*(xi2+k2)+2.0*(xi2-k2)*q2+q2*q2)
103    return 1.0e-4*prefactor / np.polyval([c2, c1, a2], q**2)
104
105Iq.vectorized = True  # Iq accepts an array of q values
106
107demo = dict(scale=1, background=0, volfraction_a=0.5,
108                     sld_a=0.3, sld_b=6.3,
109                     d=100.0, xi=30.0)
110tests = [[{}, 0.06, 41.5918888453]]
Note: See TracBrowser for help on using the repository browser.