source: sasmodels/sasmodels/models/lamellar.py @ 348557a

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

rkh new hayter_msa, new squarewell, unit test to lamellar

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[5d4777d]1r"""
2Polydispersity in the bilayer thickness can be applied from the GUI.
3
4Definition
5----------
6
[eb69cce]7The scattering intensity $I(q)$ is
[5d4777d]8
9.. math::
10
[eb69cce]11    I(q) = \frac{2\pi P(q)}{\delta q^2}
[5d4777d]12
13
14The form factor is
15
16.. math::
17
[eb69cce]18    P(q) = \frac{2\Delta\rho^2}{q^2}(1-cos(q\delta))
[5d4777d]19
20
[eb69cce]21where $\delta$ is the bilayer thickness.
[5d4777d]22
[eb69cce]23The 2D scattering intensity is calculated in the same way as 1D, where
24the $q$ vector is defined as
[5d4777d]25
26.. math::
27
[eb69cce]28    q = \sqrt{q_x^2 + q_y^2}
[5d4777d]29
30
[19dcb933]31.. figure:: img/lamellar_1d.jpg
[5d4777d]32
33    1D plot using the default values (w/1000 data point).
34
35
[eb69cce]36References
37----------
[5d4777d]38
39F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502
40
41also in J. Phys. Chem. B, 105, (2001) 11081-11088
42
43
44"""
45
[3c56da87]46from numpy import inf
[5d4777d]47
48name = "lamellar"
49title = "Lyotropic lamellar phase with uniform SLD and random distribution"
50description = """\
[3e428ec]51    [Dilute Lamellar Form Factor](from a lyotropic lamellar phase)
52        I(q)= 2*pi*P(q)/(delta *q^(2)), where
53        P(q)=2*(contrast/q)^(2)*(1-cos(q*delta))^(2))
54        thickness = layer thickness
55        sld = layer scattering length density
56        sld_solvent = solvent scattering length density
57        background = incoherent background
58        scale = scale factor
[5d4777d]59"""
[a5d0d00]60category = "shape:lamellae"
[5d4777d]61
[3e428ec]62#             ["name", "units", default, [lower, upper], "type","description"],
63parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "",
64               "Layer scattering length density" ],
65              ["solvent_sld", "1e-6/Ang^2", 6, [-inf, inf], "",
66               "Solvent scattering length density" ],
67              ["thickness", "Ang", 50, [0, inf], "volume","Bilayer thickness" ],
68             ]
[5d4777d]69
70
71# No volume normalization despite having a volume parameter
72# This should perhaps be volume normalized?
73form_volume = """
[994d77f]74    return 1.0;
[5d4777d]75    """
76
77Iq = """
[994d77f]78    const double sub = sld - solvent_sld;
79    const double qsq = q*q;
[38d8774]80    // Original expression
81    //return 4.0e-4*M_PI*sub*sub/qsq * (1.0-cos(q*thickness)) / (thickness*qsq);
82    // const double alpha = fmod(q*thickness+0.1, 2.0*M_PI)-0.1;
83    // Use small angle fix 1-cos(theta) = 2 sin^2(theta/2)
84    const double sinq2 = sin(0.5*q*thickness);
85    return 4.0e-4*M_PI*sub*sub/qsq * 2.0*sinq2*sinq2 / (thickness*qsq);
[5d4777d]86    """
87
88Iqxy = """
[bfb195e]89    return Iq(sqrt(qx*qx+qy*qy), IQ_PARAMETERS);
[5d4777d]90    """
91
92# ER defaults to 0.0
[d547f16]93# VR defaults to 1.0
94
[3e428ec]95demo = dict(scale=1, background=0,
96            sld=6, solvent_sld=1,
97            thickness=40,
98            thickness_pd=0.2, thickness_pd_n=40)
[a503bfd]99oldname = 'LamellarModel'
100oldpars = dict(sld='sld_bi', solvent_sld='sld_sol', thickness='bi_thick')
[348557a]101tests = [
102        [ {'scale': 1.0, 'background' : 0.0, 'thickness' : 50.0, 'sld' : 1.0,'solvent_sld' : 6.3, 'thickness_pd' : 0.0, 
103           }, [0.001], [882289.54309]]
104        ]
105# ADDED by: converted by PAK? (or RKH?)     ON: 16Mar2016 - RKH adding unit tests from sasview to early 2015 conversion
106#  [(qx1, qy1), (qx2, qy2), ...], [I(qx1,qy1), I(qx2,qy2), ...]],
Note: See TracBrowser for help on using the repository browser.