source: sasmodels/sasmodels/models/lamellar_stack_caille.py @ 830cf6b

ticket-1257-vesicle-productticket_1156ticket_822_more_unit_tests
Last change on this file since 830cf6b was 0507e09, checked in by smk78, 5 years ago

Added link to source code to each model. Closes #883

  • Property mode set to 100644
File size: 4.8 KB
RevLine 
[dc02af0]1r"""
[a5d0d00]2This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a
3lamellar phase where a random distribution in solution are assumed.
[eb69cce]4Here a Caille $S(q)$ is used for the lamellar stacks.
5
6Definition
7----------
[dc02af0]8
[a5d0d00]9The scattering intensity $I(q)$ is
[dc02af0]10
[eb69cce]11.. math::
[a5d0d00]12
[6ab4ed8]13    I(q) = 2\pi \frac{P(q)S(q)}{q^2\delta }
[dc02af0]14
15The form factor is
16
[eb69cce]17.. math::
[a5d0d00]18
19    P(q) = \frac{2\Delta\rho^2}{q^2}\left(1-\cos q\delta \right)
[dc02af0]20
21and the structure factor is
22
[eb69cce]23.. math::
[a5d0d00]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)
[dc02af0]27
28where
29
[eb69cce]30.. math::
[d18f8a8]31    :nowrap:
[dc02af0]32
[d18f8a8]33    \begin{align*}
[eb69cce]34    \alpha(n) &= \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right)
[d18f8a8]35              && \\
[eb69cce]36    \gamma_E  &= 0.5772156649
[d18f8a8]37              && \text{Euler's constant} \\
[eb69cce]38    \eta_{cp} &= \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}}
[d18f8a8]39              && \text{Caille constant}
40    \end{align*}
[dc02af0]41
[7c57861]42Here $d$ = (repeat) d_spacing, $\delta$ = bilayer thickness,
[a5d0d00]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*).
[dc02af0]46
[a5d0d00]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).
[dc02af0]51
[a5d0d00]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
[dc02af0]57
58.. math::
59
[a5d0d00]60    q = \sqrt{q_x^2 + q_y^2}
[dc02af0]61
62
[0507e09]63
[eb69cce]64References
65----------
[dc02af0]66
[0507e09]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
70Source
71------
72
73`lamellar_stack_caille.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/lamellar_stack_caille.py>`_
74
75`lamellar_stack_caille.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/lamellar_stack_caille.c>`_
76
77Authorship and Verification
78----------------------------
[dc02af0]79
[0507e09]80* **Author:**
81* **Last Modified by:**
82* **Last Reviewed by:**
83* **Source added by :** Steve King **Date:** March 25, 2019
[dc02af0]84"""
[2d81cfe]85
86import numpy as np
[3c56da87]87from numpy import inf
[dc02af0]88
[6ab4ed8]89name = "lamellar_stack_caille"
[dc02af0]90title = "Random lamellar sheet with Caille structure factor"
91description = """\
[ec2ca99]92    [Random lamellar phase with Caille  structure factor]
93    randomly oriented stacks of infinite sheets
94    with Caille S(Q), having polydisperse spacing.
95    sld = sheet scattering length density
96    sld_solvent = solvent scattering length density
97    background = incoherent background
98    scale = scale factor
[dc02af0]99"""
[a5d0d00]100category = "shape:lamellae"
[dc02af0]101
[7f1ee79]102single = False  # TODO: check
[ec2ca99]103# pylint: disable=bad-whitespace, line-too-long
[3e428ec]104#             ["name", "units", default, [lower, upper], "type","description"],
[ec2ca99]105parameters = [
106    ["thickness",        "Ang",      30.0,  [0, inf],   "volume", "sheet thickness"],
[a57b31d]107    ["Nlayers",          "",          20,   [1, inf],   "",       "Number of layers"],
[7c57861]108    ["d_spacing",        "Ang",      400.,  [0.0,inf],  "volume", "lamellar d-spacing of Caille S(Q)"],
[ec2ca99]109    ["Caille_parameter", "1/Ang^2",    0.1, [0.0,0.8],  "",       "Caille parameter"],
[42356c8]110    ["sld",              "1e-6/Ang^2", 6.3, [-inf,inf], "sld",    "layer scattering length density"],
111    ["sld_solvent",      "1e-6/Ang^2", 1.0, [-inf,inf], "sld",    "Solvent scattering length density"],
[ec2ca99]112    ]
113# pylint: enable=bad-whitespace, line-too-long
[3e428ec]114
[0bef47b]115source = ["lamellar_stack_caille.c"]
[dc02af0]116
[404ebbd]117def random():
[b297ba9]118    """Return a random parameter set for the model."""
[404ebbd]119    total_thickness = 10**np.random.uniform(2, 4.7)
120    Nlayers = np.random.randint(2, 200)
121    d_spacing = total_thickness / Nlayers
122    thickness = d_spacing * np.random.uniform(0, 1)
123    Caille_parameter = np.random.uniform(0, 0.8)
124    pars = dict(
125        thickness=thickness,
126        Nlayers=Nlayers,
127        d_spacing=d_spacing,
128        Caille_parameter=Caille_parameter,
129    )
130    return pars
131
[dc02af0]132# No volume normalization despite having a volume parameter
133# This should perhaps be volume normalized?
134form_volume = """
135    return 1.0;
136    """
137
[3e428ec]138demo = dict(scale=1, background=0,
[7c57861]139            thickness=67., Nlayers=3.75, d_spacing=200.,
[6ab4ed8]140            Caille_parameter=0.268, sld=1.0, sld_solvent=6.34,
[ec2ca99]141            thickness_pd=0.1, thickness_pd_n=100,
[7c57861]142            d_spacing_pd=0.05, d_spacing_pd_n=40)
[dc02af0]143
[7f47777]144#
145tests = [
[ec2ca99]146    [{'scale': 1.0, 'background': 0.0, 'thickness': 30., 'Nlayers': 20.0,
[7c57861]147      'd_spacing': 400., 'Caille_parameter': 0.1, 'sld': 6.3,
148      'sld_solvent': 1.0, 'thickness_pd': 0.0, 'd_spacing_pd': 0.0},
[ec2ca99]149     [0.001], [28895.13397]]
150    ]
[40a87fa]151# 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.