source: sasmodels/sasmodels/models/lamellar_hg.py

Last change on this file 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.2 KB
Line 
1# Note: model title and parameter table are inserted automatically
2r"""
3This model provides the scattering intensity, $I(q)$, for a lyotropic lamellar
4phase where a random distribution in solution are assumed. The SLD of the head
5region is taken to be different from the SLD of the tail region.
6
7Definition
8----------
9
10The scattering intensity $I(q)$ is
11
12.. math::
13
14   I(q) = 2\pi\frac{\text{scale}}{2(\delta_H + \delta_T)}  P(q) \frac{1}{q^2}
15
16The form factor $P(q)$ is
17
18.. math::
19
20    P(q) = \frac{4}{q^2}
21        \left\lbrace
22            \Delta \rho_H
23            \left[\sin[q(\delta_H + \delta_T)\ - \sin(q\delta_T)\right]
24            + \Delta\rho_T\sin(q\delta_T)
25        \right\rbrace^2
26
27where $\delta_T$ is *length_tail*, $\delta_H$ is *length_head*,
28$\Delta\rho_H$ is the head contrast (*sld_head* $-$ *sld_solvent*),
29and $\Delta\rho_T$ is tail contrast (*sld* $-$ *sld_solvent*).
30
31The total thickness of the lamellar sheet is $\delta_H + \delta_T + \delta_T + \delta_H$.
32Note that in a non aqueous solvent the chemical "head" group may be the
33"Tail region" and vice-versa.
34
35The 2D scattering intensity is calculated in the same way as 1D, where
36the $q$ vector is defined as
37
38.. math:: q = \sqrt{q_x^2 + q_y^2}
39
40
41References
42----------
43
44.. [#] F Nallet, R Laversanne, and D Roux, *J. Phys. II France*, 3, (1993) 487-502
45.. [#] J Berghausen, J Zipfel, P Lindner, W Richtering, *J. Phys. Chem. B*, 105, (2001) 11081-11088
46
47Authorship and Verification
48----------------------------
49
50* **Author:**
51* **Last Modified by:**
52* **Last Reviewed by:** S King and P Butler **Date** April 17, 2014
53"""
54
55import numpy as np
56from numpy import inf
57
58name = "lamellar_hg"
59title = "Random lamellar phase with Head and Tail Groups"
60description = """\
61    [Random lamellar phase with Head and Tail Groups]
62        I(q)= 2*pi*P(q)/(2(H+T)*q^(2)), where
63        P(q)= see manual
64        layer thickness =(H+T+T+H) = 2(Head+Tail)
65        sld = Tail scattering length density
66        sld_head = Head scattering length density
67        sld_solvent = solvent scattering length density
68        background = incoherent background
69        scale = scale factor
70"""
71category = "shape:lamellae"
72
73# pylint: disable=bad-whitespace, line-too-long
74#             ["name", "units", default, [lower, upper], "type","description"],
75parameters = [["length_tail", "Ang",       15,   [0, inf],  "volume",  "Tail thickness ( total = H+T+T+H)"],
76              ["length_head", "Ang",       10,   [0, inf],  "volume",  "Head thickness"],
77              ["sld",         "1e-6/Ang^2", 0.4, [-inf,inf], "sld",    "Tail scattering length density"],
78              ["sld_head",    "1e-6/Ang^2", 3.0, [-inf,inf], "sld",    "Head scattering length density"],
79              ["sld_solvent", "1e-6/Ang^2", 6,   [-inf,inf], "sld",    "Solvent scattering length density"]]
80# pylint: enable=bad-whitespace, line-too-long
81
82# No volume normalization despite having a volume parameter
83# This should perhaps be volume normalized?
84form_volume = """
85    return 1.0;
86    """
87
88Iq = """
89    const double qsq = q*q;
90    const double drh = sld_head - sld_solvent;
91    const double drt = sld - sld_solvent;    //correction 13FEB06 by L.Porcar
92    const double qT = q*length_tail;
93    double Pq, inten;
94    Pq = drh*(sin(q*(length_head+length_tail))-sin(qT)) + drt*sin(qT);
95    Pq *= Pq;
96    Pq *= 4.0/(qsq);
97
98    inten = 2.0e-4*M_PI*Pq/qsq;
99
100    // normalize by the bilayer thickness
101    inten /= 2.0*(length_head+length_tail);
102
103    return inten;
104    """
105
106def random():
107    """Return a random parameter set for the model."""
108    thickness = 10**np.random.uniform(1, 4)
109    length_head = thickness * np.random.uniform(0, 1)
110    length_tail = thickness - length_head
111    pars = dict(
112        length_head=length_head,
113        length_tail=length_tail,
114    )
115    return pars
116
117demo = dict(scale=1, background=0,
118            length_tail=15, length_head=10,
119            sld=0.4, sld_head=3.0, sld_solvent=6.0,
120            length_tail_pd=0.2, length_tail_pd_n=40,
121            length_head_pd=0.01, length_head_pd_n=40)
122
123#
124tests = [
125    [{'scale': 1.0, 'background': 0.0, 'length_tail': 15.0, 'length_head': 10.0,
126      'sld': 0.4, 'sld_head': 3.0, 'sld_solvent': 6.0},
127     [0.001], [653143.9209]],
128]
129# 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.