source: sasmodels/sasmodels/models/core_shell_bicelle.py @ 8007311

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

Converted CoreShellBicelle?

  • Property mode set to 100644
File size: 4.7 KB
Line 
1r"""
2
3Definition
4----------
5This model provides the form factor for a circular cylinder with a core-shell
6scattering length density profile.
7The form factor is normalized by the particle volume.
8
9.. _core-shell-cylinder-geometry:
10
11.. figure:: img/core_shell_bicelle_geometry.png
12
13    (Graphic from DOI: 10.1039/C0NP00002G)
14
15
16The output of the 1D scattering intensity function for randomly oriented
17cylinders is then given by the equation above.
18
19The *theta* and *phi* parameters are not used for the 1D output.
20Our implementation of the scattering kernel and the 1D scattering intensity
21use the c-library from NIST.
22
23.. figure:: img/core_shell_bicelle_1d.jpg
24
25    1D plot using the default values (w/200 data point).
26
27.. figure:: img/core_shell_bicelle_fig1.jpg
28
29    Definition of the angles for the oriented CoreShellBicelleModel.
30
31.. figure:: img/core_shell_bicelle_fig2.jpg
32
33    Examples of the angles for oriented pp against the detector plane.
34
35References
36----------
37
38L A Feigin and D I Svergun,
39*Structure Analysis by Small-Angle X-Ray and Neutron Scattering,*
40Plenum Press, New York, (1987)
41
42"""
43
44from numpy import inf, sin, cos
45
46name = "core_shell_bicelle"
47title = "Circular cylinder with a core-shell scattering length density profile.."
48description = """
49    P(q,alpha)= scale/Vs*f(q)^(2) + bkg,  where: f(q)= 2(core_sld
50    - solvant_sld)* Vc*sin[qLcos(alpha/2)]
51    /[qLcos(alpha/2)]*J1(qRsin(alpha))
52    /[qRsin(alpha)]+2(shell_sld-solvent_sld)
53    *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T)
54    *cos(alpha/2)]*J1(q(R+T)sin(alpha))
55    /q(R+T)sin(alpha)]
56
57    alpha:is the angle between the axis of
58    the cylinder and the q-vector
59    Vs: the volume of the outer shell
60    Vc: the volume of the core
61    L: the length of the core
62    shell_sld: the scattering length density
63    of the shell
64    solvent_sld: the scattering length density
65    of the solvent
66    bkg: the background
67    T: the thickness
68    R+T: is the outer radius
69    L+2T: The total length of the outershell
70    J1: the first order Bessel function
71    theta: axis_theta of the cylinder
72    phi: the axis_phi of the cylinder...
73        """
74category = "shape:cylinder"
75
76# pylint: disable=bad-whitespace, line-too-long
77#             ["name", "units", default, [lower, upper], "type", "description"],
78parameters = [
79    ["radius",         "Ang",       20, [0, inf],    "volume",      "Cylinder core radius"],
80    ["rim_thickness",  "Ang",       10, [0, inf],    "volume",      "Rim shell thickness"],
81    ["face_thickness", "Ang",       10, [0, inf],    "volume",      "Cylinder face thickness"],
82    ["length",         "Ang",      400, [0, inf],    "volume",      "Cylinder length"],
83    ["core_sld",       "1e-6/Ang^2", 1, [-inf, inf], "",            "Cylinder core scattering length density"],
84    ["face_sld",       "1e-6/Ang^2", 4, [-inf, inf], "",            "Cylinder face scattering length density"],
85    ["rim_sld",        "1e-6/Ang^2", 4, [-inf, inf], "",            "Cylinder rim scattering length density"],
86    ["solvent_sld",    "1e-6/Ang^2", 1, [-inf, inf], "",            "Solvent scattering length density"],
87    ["theta",          "degrees",   90, [-inf, inf], "orientation", "In plane angle"],
88    ["phi",            "degrees",    0, [-inf, inf], "orientation", "Out of plane angle"],
89    ]
90
91# pylint: enable=bad-whitespace, line-too-long
92
93source = ["lib/J1.c", "lib/gauss76.c", "core_shell_bicelle.c"]
94
95demo = dict(scale=1, background=0,
96            radius=20.0,
97            rim_thickness=10.0,
98            face_thickness=10.0,
99            length=400.0,
100            core_sld=1.0,
101            face_sld=4.0,
102            rim_sld=4.0,
103            solvent_sld=1.0,
104            theta=90,
105            phi=0)
106
107oldname = 'CoreShellBicelleModel'
108
109oldpars = dict(rim_thickness='rim_thick',
110               face_thickness='face_thick',
111               theta='axis_theta',
112               phi='axis_phi')
113
114qx, qy = 0.4 * cos(90), 0.5 * sin(0)
115tests = [
116    # Accuracy tests based on content in test/utest_other_models.py
117    [{'radius': 20.0,
118      'rim_thickness': 10.0,
119      'face_thickness': 10.0,
120      'length': 400.0,
121      'core_sld': 1.0,
122      'face_sld': 4.0,
123      'rim_sld': 4.0,
124      'solvent_sld': 1.0,
125      'background': 0.0,
126     }, 0.001, 353.550],
127
128    [{'radius': 20.0,
129      'rim_thickness': 10.0,
130      'face_thickness': 10.0,
131      'length': 400.0,
132      'core_sld': 1.0,
133      'face_sld': 4.0,
134      'rim_sld': 4.0,
135      'solvent_sld': 1.0,
136      'theta': 90.0,
137      'phi': 0.0,
138      'background': 0.00,
139     }, (qx, qy), 24.9167],
140
141    # Additional tests with larger range of parameters
142    [{'radius': 3.0,
143      'rim_thickness': 100.0,
144      'face_thickness': 100.0,
145      'length': 1200.0,
146      'core_sld': 5.0,
147      'face_sld': 41.0,
148      'rim_sld': 42.0,
149      'solvent_sld': 21.0,
150     }, 0.05, 1670.1828],
151    ]
Note: See TracBrowser for help on using the repository browser.