source: sasmodels/sasmodels/models/lamellar_hg_stack_caille.py @ c1e44e5

Last change on this file since c1e44e5 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: 5.3 KB
Line 
1# Note: model title and parameter table are inserted automatically
2r"""
3This model provides the scattering intensity, $I(q) = P(q)S(q)$, for a lamellar
4phase where a random distribution in solution are assumed. Here a Caille $S(q)$
5is used for the lamellar stacks.
6
7The scattering intensity $I(q)$ is
8
9.. math::
10
11    I(q) = 2 \pi \frac{P(q)S(q)}{q^2\delta }
12
13
14The form factor $P(q)$ is
15
16.. math::
17
18        P(q) = \frac{4}{q^2}\big\{
19        \Delta\rho_H \left[\sin[q(\delta_H + \delta_T)] - \sin(q\delta_T)\right]
20            + \Delta\rho_T\sin(q\delta_T)\big\}^2
21
22and the structure factor $S(q)$ is
23
24.. math::
25
26    S(q) = 1 + 2 \sum_1^{N-1}\left(1-\frac{n}{N}\right)
27        \cos(qdn)\exp\left(-\frac{2q^2d^2\alpha(n)}{2}\right)
28
29where
30
31.. math::
32    :nowrap:
33
34    \begin{align*}
35    \alpha(n) &= \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right)
36              &&  \\
37    \gamma_E  &= 0.5772156649
38              && \text{Euler's constant} \\
39    \eta_{cp} &= \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}}
40              && \text{Caille constant}
41    \end{align*}
42
43
44$\delta_T$ is the tail length (or *length_tail*), $\delta_H$ is the head
45thickness (or *length_head*), $\Delta\rho_H$ is SLD(headgroup) - SLD(solvent),
46and $\Delta\rho_T$ is SLD(tail) - SLD(headgroup). Here $d$ is (repeat) spacing,
47$K$ is smectic bending elasticity, $B$ is compression modulus, and $N$ is the
48number of lamellar plates (*Nlayers*).
49
50NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the
51assumptions of the model are incorrect.**  And due to a complication of the
52model function, users are responsible for making sure that all the assumptions
53are handled accurately (see the original reference below for more details).
54
55Non-integer numbers of stacks are calculated as a linear combination of
56results for the next lower and higher values.
57
58Be aware that the computations may be very slow.
59
60The 2D scattering intensity is calculated in the same way as 1D, where
61the $q$ vector is defined as
62
63.. math::
64
65    q = \sqrt{q_x^2 + q_y^2}
66
67
68References
69----------
70
71.. [#] F Nallet, R Laversanne, and D Roux, *J. Phys. II France*, 3, (1993) 487-502
72.. [#] J Berghausen, J Zipfel, P Lindner, W Richtering, *J. Phys. Chem. B*, 105, (2001) 11081-11088
73
74Authorship and Verification
75----------------------------
76
77* **Author:**
78* **Last Modified by:**
79* **Last Reviewed by:**
80"""
81
82import numpy as np
83from numpy import inf
84
85name = "lamellar_hg_stack_caille"
86title = "Random lamellar head/tail/tail/head sheet with Caille structure factor"
87description = """\
88    [Random lamellar phase with Caille  structure factor]
89        randomly oriented stacks of infinite sheets
90        with Caille S(Q), having polydisperse spacing.
91        layer thickness =(H+T+T+H) = 2(Head+Tail)
92        sld = Tail scattering length density
93        sld_head = Head scattering length density
94        sld_solvent = solvent scattering length density
95        background = incoherent background
96        scale = scale factor
97"""
98category = "shape:lamellae"
99
100single = False  # TODO: check
101parameters = [
102    #   [ "name", "units", default, [lower, upper], "type",
103    #     "description" ],
104    ["length_tail", "Ang", 10, [0, inf], "volume",
105     "Tail thickness"],
106    ["length_head", "Ang", 2, [0, inf], "volume",
107     "head thickness"],
108    ["Nlayers", "", 30, [1, inf], "",
109     "Number of layers"],
110    ["d_spacing", "Ang", 40., [0.0, inf], "volume",
111     "lamellar d-spacing of Caille S(Q)"],
112    ["Caille_parameter", "", 0.001, [0.0, 0.8], "",
113     "Caille parameter"],
114    ["sld", "1e-6/Ang^2", 0.4, [-inf, inf], "sld",
115     "Tail scattering length density"],
116    ["sld_head", "1e-6/Ang^2", 2.0, [-inf, inf], "sld",
117     "Head scattering length density"],
118    ["sld_solvent", "1e-6/Ang^2", 6, [-inf, inf], "sld",
119     "Solvent scattering length density"],
120    ]
121
122source = ["lamellar_hg_stack_caille.c"]
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
130def random():
131    """Return a random parameter set for the model."""
132    total_thickness = 10**np.random.uniform(2, 4.7)
133    Nlayers = np.random.randint(2, 200)
134    d_spacing = total_thickness / Nlayers
135    thickness = d_spacing * np.random.uniform(0, 1)
136    length_head = thickness * np.random.uniform(0, 1)
137    length_tail = thickness - length_head
138    Caille_parameter = np.random.uniform(0, 0.8)
139    pars = dict(
140        length_head=length_head,
141        length_tail=length_tail,
142        Nlayers=Nlayers,
143        d_spacing=d_spacing,
144        Caille_parameter=Caille_parameter,
145    )
146    return pars
147
148demo = dict(
149    scale=1, background=0,
150    Nlayers=20, d_spacing=200., Caille_parameter=0.05,
151    length_tail=15, length_head=10,
152    #sld=-1, sld_head=4.0, sld_solvent=6.0,
153    sld=-1, sld_head=4.1, sld_solvent=6.0,
154    length_tail_pd=0.1, length_tail_pd_n=20,
155    length_head_pd=0.05, length_head_pd_n=30,
156    d_spacing_pd=0.2, d_spacing_pd_n=40,
157    )
158
159#
160tests = [[{'scale': 1.0, 'background': 0.0, 'length_tail': 10.0, 'length_head': 2.0,
161           'Nlayers': 30.0, 'd_spacing': 40., 'Caille_parameter': 0.001, 'sld': 0.4,
162           'sld_head': 2.0, 'sld_solvent': 6.0, 'length_tail_pd': 0.0,
163           'length_head_pd': 0.0, 'd_spacing_pd': 0.0}, [0.001], [6838238.571488]]]
164# 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.