source: sasmodels/sasmodels/models/core_shell_bicelle.py @ 43b7eea

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

Initial clean-up of Bessel functions

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