source: sasmodels/sasmodels/models/pringle.py @ d277229

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since d277229 was d277229, checked in by grethevj, 6 years ago

Models updated to include choices for effective interaction radii

  • Property mode set to 100644
File size: 3.7 KB
Line 
1r"""
2Definition
3----------
4
5The form factor for this bent disc is essentially that of a hyperbolic
6paraboloid and calculated as
7
8.. math::
9
10    P(q) = (\Delta \rho )^2 V \int^{\pi/2}_0 d\psi \sin{\psi} sinc^2
11    \left( \frac{qd\cos{\psi}}{2} \right)
12    \left[ \left( S^2_0+C^2_0\right) + 2\sum_{n=1}^{\infty}
13     \left( S^2_n+C^2_n\right) \right]
14
15where
16
17.. math::
18
19    C_n = \frac{1}{r^2}\int^{R}_{0} r dr\cos(qr^2\alpha \cos{\psi})
20    J_n\left( qr^2\beta \cos{\psi}\right)
21    J_{2n}\left( qr \sin{\psi}\right)
22
23.. math::
24
25    S_n = \frac{1}{r^2}\int^{R}_{0} r dr\sin(qr^2\alpha \cos{\psi})
26    J_n\left( qr^2\beta \cos{\psi}\right)
27    J_{2n}\left( qr \sin{\psi}\right)
28
29and $\Delta \rho \text{ is } \rho_{pringle}-\rho_{solvent}$, $V$ is the volume of
30the disc, $\psi$ is the angle between the normal to the disc and the q vector,
31$d$ and $R$ are the "pringle" thickness and radius respectively, $\alpha$ and
32$\beta$ are the two curvature parameters, and $J_n$ is the n\ :sup:`th` order
33Bessel function of the first kind.
34
35.. figure:: img/pringles_fig1.png
36
37    Schematic of model shape (Graphic from Matt Henderson, matt@matthen.com)
38
39Reference
40---------
41
42Karen Edler, Universtiy of Bath, Private Communication. 2012.
43Derivation by Stefan Alexandru Rautu.
44
45* **Author:** Andrew Jackson **Date:** 2008
46* **Last Modified by:** Wojciech Wpotrzebowski **Date:** March 20, 2016
47* **Last Reviewed by:** Andrew Jackson **Date:** September 26, 2016
48"""
49
50import numpy as np
51from numpy import inf, pi
52
53name = "pringle"
54title = "The Pringle model provides the form factor, $P(q)$, for a 'pringle' \
55or 'saddle-shaped' disc that is bent in two directions."
56description = """\
57
58"""
59category = "shape:cylinder"
60
61# pylint: disable=bad-whitespace, line-too-long
62#   ["name", "units", default, [lower, upper], "type","description"],
63parameters = [
64    ["radius",      "Ang",         60.0,   [0, inf],    "volume", "Pringle radius"],
65    ["thickness",   "Ang",         10.0,   [0, inf],    "volume", "Thickness of pringle"],
66    ["alpha",       "",            0.001,  [-inf, inf], "volume", "Curvature parameter alpha"],
67    ["beta",        "",            0.02,   [-inf, inf], "volume", "Curvature paramter beta"],
68    ["sld", "1e-6/Ang^2",  1.0,    [-inf, inf], "sld", "Pringle sld"],
69    ["sld_solvent", "1e-6/Ang^2",  6.3,    [-inf, inf], "sld", "Solvent sld"]
70    ]
71# pylint: enable=bad-whitespace, line-too-long
72
73
74source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", \
75          "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"]
76effective_radius_type = ["equivalent sphere","radius"]
77
78#def ER(radius, thickness, alpha, beta):
79#    """
80#    Return equivalent radius (ER)
81#    """
82#    ddd = 0.75 * radius * (2 * radius * thickness + (thickness + radius) \
83#                           * (thickness + pi * radius))
84#    return 0.5 * (ddd) ** (1. / 3.)
85
86def random():
87    alpha, beta = 10**np.random.uniform(-1, 1, size=2)
88    radius = 10**np.random.uniform(1, 3)
89    thickness = 10**np.random.uniform(0.7, 2)
90    pars = dict(
91        radius=radius,
92        thickness=thickness,
93        alpha=alpha,
94        beta=beta,
95    )
96    return pars
97
98tests = [
99    [{'scale' : 1.0,
100      'radius': 60.0,
101      'thickness': 10.0,
102      'alpha': 0.001,
103      'beta': 0.02,
104      'sld': 1.0,
105      'sld_solvent': 6.3,
106      'background': 0.001,
107     }, 0.1, 9.87676],
108
109    [{'scale' : 1.0,
110      'radius': 60.0,
111      'thickness': 10.0,
112      'alpha': 0.001,
113      'beta': 0.02,
114      'sld': 1.0,
115      'sld_solvent': 6.3,
116      'background': 0.001,
117     }, 0.01, 290.56723],
118
119    [{'scale' : 1.0,
120      'radius': 60.0,
121      'thickness': 10.0,
122      'alpha': 0.001,
123      'beta': 0.02,
124      'sld': 1.0,
125      'sld_solvent': 6.3,
126      'background': 0.001,
127     }, 0.001, 317.40847],
128]
Note: See TracBrowser for help on using the repository browser.