source: sasmodels/sasmodels/models/lamellarFFHG.py @ 7f47777

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 7f47777 was 7f47777, checked in by richardh, 8 years ago

RKH added simple 1d unit test as per sasview

  • Property mode set to 100644
File size: 3.8 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 *tail_length*, $\delta_H$ is *head_length*,
28$\Delta\rho_H$ is the head contrast (*head_sld* $-$ *solvent_sld*),
29and $\Delta\rho_T$ is tail contrast (*sld* $-$ *solvent_sld*).
30
31The 2D scattering intensity is calculated in the same way as 1D, where
32the $q$ vector is defined as
33
34.. math::
35
36    q = \sqrt{q_x^2 + q_y^2}
37
38
39.. figure:: img/lamellarFFHG_1d.jpg
40
41    1D plot using the default values (w/1000 data point).
42
43References
44----------
45
46F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502
47
48also in J. Phys. Chem. B, 105, (2001) 11081-11088
49
50*2014/04/17 - Description reviewed by S King and P Butler.*
51"""
52
53from numpy import inf
54
55name = "lamellar_FFHG"
56title = "Random lamellar phase with Head Groups"
57description = """\
58    [Random lamellar phase with Head Groups]
59        I(q)= 2*pi*P(q)/(2(H+T)*q^(2)), where
60        P(q)= see manual
61        layer thickness =(H+T+T+H) = 2(Head+Tail)
62        sld = Tail scattering length density
63        head_sld = Head scattering length density
64        solvent_sld = solvent scattering length density
65        background = incoherent background
66        scale = scale factor
67"""
68category = "shape:lamellae"
69
70#             ["name", "units", default, [lower, upper], "type","description"],
71parameters = [["tail_length", "Ang",  15, [0, inf], "volume",
72               "Tail thickness"],
73              ["head_length", "Ang",  10, [0, inf], "volume",
74               "head thickness"],
75              ["sld", "1e-6/Ang^2", 0.4, [-inf,inf], "",
76               "Tail scattering length density"],
77              ["head_sld", "1e-6/Ang^2", 3.0, [-inf,inf], "",
78               "Head scattering length density"],
79              ["solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "",
80               "Solvent scattering length density"],
81             ]
82
83# No volume normalization despite having a volume parameter
84# This should perhaps be volume normalized?
85form_volume = """
86    return 1.0;
87    """
88
89Iq = """
90    const double qsq = q*q;
91    const double drh = head_sld - solvent_sld;
92    const double drt = sld - solvent_sld;    //correction 13FEB06 by L.Porcar
93    const double qT = q*tail_length;
94    double Pq, inten;
95    Pq = drh*(sin(q*(head_length+tail_length))-sin(qT)) + drt*sin(qT);
96    Pq *= Pq;
97    Pq *= 4.0/(qsq);
98
99    inten = 2.0e-4*M_PI*Pq/qsq;
100
101    // normalize by the bilayer thickness
102    inten /= 2.0*(head_length+tail_length);
103
104    return inten;
105    """
106
107Iqxy = """
108    return Iq(sqrt(qx*qx+qy*qy), IQ_PARAMETERS);
109    """
110
111# ER defaults to 0.0
112# VR defaults to 1.0
113
114demo = dict(scale=1, background=0,
115            tail_length=15,head_length=10,
116            sld=0.4, head_sld=3.0, solvent_sld=6.0,
117            tail_length_pd= 0.2, tail_length_pd_n=40,
118            head_length_pd= 0.01, head_length_pd_n=40)
119
120oldname = 'LamellarFFHGModel'
121oldpars = dict(head_length='h_thickness', tail_length='t_length',
122               sld='sld_tail', head_sld='sld_head', solvent_sld='sld_solvent')
123#
124tests = [
125        [ {'scale': 1.0, 'background' : 0.0, 'tail_length' : 15.0, 'head_length' : 10.0,'sld' : 0.4,
126         'head_sld' : 3.0, 'solvent_sld' : 6.0, }, [0.001], [653143.9209]]
127        ]
128
129
Note: See TracBrowser for help on using the repository browser.