source: sasmodels/sasmodels/models/dab.py @ b297ba9

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since b297ba9 was b297ba9, checked in by Paul Kienzle <pkienzle@…>, 7 months ago

lint

  • Property mode set to 100644
File size: 2.1 KB
Line 
1r"""
2Calculates the scattering from a randomly distributed, two-phase system based on
3the Debye-Anderson-Brumberger (DAB) model for such systems. The two-phase system
4is characterized by a single length scale, the correlation length, which is a
5measure of the average spacing between regions of phase 1 and phase 2. **The
6model also assumes smooth interfaces between the phases** and hence exhibits
7Porod behavior $(I \sim q^{-4})$ at large $q$, $(qL \gg 1)$.
8
9The DAB model is ostensibly a development of the earlier Debye-Bueche model.
10
11Definition
12----------
13
14.. math::
15
16    I(q) = \text{scale}\cdot\frac{L^3}{(1 + (q\cdot L)^2)^2} + \text{background}
17
18where scale is
19
20.. math:: \text{scale} = 8 \pi \phi (1-\phi) \Delta\rho^2
21
22and the parameter $L$ is the correlation length.
23
24For 2D data the scattering intensity is calculated in the same way as 1D,
25where the $q$ vector is defined as
26
27.. math:: q = \sqrt{q_x^2 + q_y^2}
28
29
30References
31----------
32
33P Debye, H R Anderson, H Brumberger, *Scattering by an Inhomogeneous Solid. II.
34The Correlation Function and its Application*, *J. Appl. Phys.*, 28(6) (1957) 679
35
36P Debye, A M Bueche, *Scattering by an Inhomogeneous Solid*, *J. Appl. Phys.*,
3720 (1949) 518
38
39*2013/09/09 - Description reviewed by King, S and Parker, P.*
40"""
41
42import numpy as np
43from numpy import inf
44
45name = "dab"
46title = "DAB (Debye Anderson Brumberger) Model"
47description = """\
48
49F(q)= scale * L^3/(1 + (q*L)^2)^2
50
51L: the correlation length
52
53"""
54category = "shape-independent"
55
56#             ["name", "units", default, [lower, upper], "type", "description"],
57parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "correlation length"],
58             ]
59
60Iq = """
61    double numerator   = cube(cor_length);
62    double denominator = square(1 + square(q*cor_length));
63
64    return numerator / denominator ;
65    """
66
67def random():
68    """Return a random parameter set for the model."""
69    pars = dict(
70        scale=10**np.random.uniform(1, 4),
71        cor_length=10**np.random.uniform(0.3, 3),
72        #background = 0,
73    )
74    pars['scale'] /= pars['cor_length']**3
75    return pars
76
77demo = dict(scale=1, background=0, cor_length=50)
Note: See TracBrowser for help on using the repository browser.