source: sasmodels/sasmodels/models/lamellar_stack_caille.py @ d57b06c

Last change on this file since d57b06c was c1e44e5, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

Add local link to source files. Refs #1263.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1r"""
2This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a
3lamellar phase where a random distribution in solution are assumed.
4Here a Caille $S(q)$ is used for the lamellar stacks.
5
6Definition
7----------
8
9The scattering intensity $I(q)$ is
10
11.. math::
12
13    I(q) = 2\pi \frac{P(q)S(q)}{q^2\delta }
14
15The form factor is
16
17.. math::
18
19    P(q) = \frac{2\Delta\rho^2}{q^2}\left(1-\cos q\delta \right)
20
21and the structure factor is
22
23.. math::
24
25    S(q) = 1 + 2 \sum_1^{N-1}\left(1-\frac{n}{N}\right)
26           \cos(qdn)\exp\left(-\frac{2q^2d^2\alpha(n)}{2}\right)
27
28where
29
30.. math::
31    :nowrap:
32
33    \begin{align*}
34    \alpha(n) &= \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right)
35              && \\
36    \gamma_E  &= 0.5772156649
37              && \text{Euler's constant} \\
38    \eta_{cp} &= \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}}
39              && \text{Caille constant}
40    \end{align*}
41
42Here $d$ = (repeat) d_spacing, $\delta$ = bilayer thickness,
43the contrast $\Delta\rho$ = SLD(headgroup) - SLD(solvent),
44$K$ = smectic bending elasticity, $B$ = compression modulus, and
45$N$ = number of lamellar plates (*n_plates*).
46
47NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the
48assumptions of the model are incorrect.** And due to a complication of the
49model function, users are responsible for making sure that all the assumptions
50are handled accurately (see the original reference below for more details).
51
52Non-integer numbers of stacks are calculated as a linear combination of
53results for the next lower and higher values.
54
55The 2D scattering intensity is calculated in the same way as 1D, where the
56$q$ vector is defined as
57
58.. math::
59
60    q = \sqrt{q_x^2 + q_y^2}
61
62
63
64References
65----------
66
67.. [#] F Nallet, R Laversanne, and D Roux, *J. Phys. II France*, 3, (1993) 487-502
68.. [#] J Berghausen, J Zipfel, P Lindner, W Richtering, *J. Phys. Chem. B*, 105, (2001) 11081-11088
69
70Authorship and Verification
71----------------------------
72
73* **Author:**
74* **Last Modified by:**
75* **Last Reviewed by:**
76"""
77
78import numpy as np
79from numpy import inf
80
81name = "lamellar_stack_caille"
82title = "Random lamellar sheet with Caille structure factor"
83description = """\
84    [Random lamellar phase with Caille  structure factor]
85    randomly oriented stacks of infinite sheets
86    with Caille S(Q), having polydisperse spacing.
87    sld = sheet scattering length density
88    sld_solvent = solvent scattering length density
89    background = incoherent background
90    scale = scale factor
91"""
92category = "shape:lamellae"
93
94single = False  # TODO: check
95# pylint: disable=bad-whitespace, line-too-long
96#             ["name", "units", default, [lower, upper], "type","description"],
97parameters = [
98    ["thickness",        "Ang",      30.0,  [0, inf],   "volume", "sheet thickness"],
99    ["Nlayers",          "",          20,   [1, inf],   "",       "Number of layers"],
100    ["d_spacing",        "Ang",      400.,  [0.0,inf],  "volume", "lamellar d-spacing of Caille S(Q)"],
101    ["Caille_parameter", "1/Ang^2",    0.1, [0.0,0.8],  "",       "Caille parameter"],
102    ["sld",              "1e-6/Ang^2", 6.3, [-inf,inf], "sld",    "layer scattering length density"],
103    ["sld_solvent",      "1e-6/Ang^2", 1.0, [-inf,inf], "sld",    "Solvent scattering length density"],
104    ]
105# pylint: enable=bad-whitespace, line-too-long
106
107source = ["lamellar_stack_caille.c"]
108
109def random():
110    """Return a random parameter set for the model."""
111    total_thickness = 10**np.random.uniform(2, 4.7)
112    Nlayers = np.random.randint(2, 200)
113    d_spacing = total_thickness / Nlayers
114    thickness = d_spacing * np.random.uniform(0, 1)
115    Caille_parameter = np.random.uniform(0, 0.8)
116    pars = dict(
117        thickness=thickness,
118        Nlayers=Nlayers,
119        d_spacing=d_spacing,
120        Caille_parameter=Caille_parameter,
121    )
122    return pars
123
124# No volume normalization despite having a volume parameter
125# This should perhaps be volume normalized?
126form_volume = """
127    return 1.0;
128    """
129
130demo = dict(scale=1, background=0,
131            thickness=67., Nlayers=3.75, d_spacing=200.,
132            Caille_parameter=0.268, sld=1.0, sld_solvent=6.34,
133            thickness_pd=0.1, thickness_pd_n=100,
134            d_spacing_pd=0.05, d_spacing_pd_n=40)
135
136#
137tests = [
138    [{'scale': 1.0, 'background': 0.0, 'thickness': 30., 'Nlayers': 20.0,
139      'd_spacing': 400., 'Caille_parameter': 0.1, 'sld': 6.3,
140      'sld_solvent': 1.0, 'thickness_pd': 0.0, 'd_spacing_pd': 0.0},
141     [0.001], [28895.13397]]
142    ]
143# ADDED by: RKH  ON: 18Mar2016  converted from sasview previously, now renaming everything & sorting the docs
Note: See TracBrowser for help on using the repository browser.