source: sasmodels/sasmodels/models/lamellar.py @ aa2edb2

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

Removing hardcoded figures to be replaced by autogenerated ones

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