source: sasmodels/sasmodels/models/hollow_rectangular_prism_thin_walls.py @ a34b811

ticket-1257-vesicle-productticket_1156ticket_822_more_unit_tests
Last change on this file since a34b811 was a34b811, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

use radius_effective/radius_effective_mode/radius_effective_modes consistently throughout the code

  • Property mode set to 100644
File size: 5.2 KB
RevLine 
[deb7ee0]1# rectangular_prism model
2# Note: model title and parameter table are inserted automatically
3r"""
4Definition
5----------
6
[6e7d7b6]7
8This model provides the form factor, $P(q)$, for a hollow rectangular
9prism with infinitely thin walls. It computes only the 1D scattering, not the 2D.
[deb7ee0]10The 1D scattering intensity for this model is calculated according to the
[6e7d7b6]11equations given by Nayuk and Huber\ [#Nayuk2012]_.
[deb7ee0]12
13Assuming a hollow parallelepiped with infinitely thin walls, edge lengths
[ab2aea8]14$A \le B \le C$ and presenting an orientation with respect to the
15scattering vector given by $\theta$ and $\phi$, where $\theta$ is the angle
16between the $z$ axis and the longest axis of the parallelepiped $C$, and
17$\phi$ is the angle between the scattering vector (lying in the $xy$ plane)
18and the $y$ axis, the form factor is given by
[deb7ee0]19
20.. math::
21
[ab2aea8]22    P(q) = \frac{1}{V^2} \frac{2}{\pi} \int_0^{\frac{\pi}{2}}
23           \int_0^{\frac{\pi}{2}} [A_L(q)+A_T(q)]^2 \sin\theta\,d\theta\,d\phi
[deb7ee0]24
[ab2aea8]25where
[deb7ee0]26
27.. math::
28
[ab2aea8]29    V &= 2AB + 2AC + 2BC \\
30    A_L(q) &=  8 \times \frac{
31            \sin \left( \tfrac{1}{2} q A \sin\phi \sin\theta \right)
32            \sin \left( \tfrac{1}{2} q B \cos\phi \sin\theta \right)
33            \cos \left( \tfrac{1}{2} q C \cos\theta \right)
34        }{q^2 \, \sin^2\theta \, \sin\phi \cos\phi} \\
35    A_T(q) &=  A_F(q) \times
36      \frac{2\,\sin \left( \tfrac{1}{2} q C \cos\theta \right)}{q\,\cos\theta}
[deb7ee0]37
38and
39
40.. math::
[ab2aea8]41
42  A_F(q) =  4 \frac{ \cos \left( \tfrac{1}{2} q A \sin\phi \sin\theta \right)
43                       \sin \left( \tfrac{1}{2} q B \cos\phi \sin\theta \right) }
[deb7ee0]44                     {q \, \cos\phi \, \sin\theta} +
[ab2aea8]45              4 \frac{ \sin \left( \tfrac{1}{2} q A \sin\phi \sin\theta \right)
46                       \cos \left( \tfrac{1}{2} q B \cos\phi \sin\theta \right) }
[deb7ee0]47                     {q \, \sin\phi \, \sin\theta}
48
49The 1D scattering intensity is then calculated as
50
51.. math::
52
[ab2aea8]53  I(q) = \text{scale} \times V \times (\rho_\text{p} - \rho_\text{solvent})^2 \times P(q)
54
[6e7d7b6]55where $V$ is the surface area of the rectangular prism, $\rho_\text{p}$
56is the scattering length density of the parallelepiped, $\rho_\text{solvent}$
57is the scattering length density of the solvent, and (if the data are in
58absolute units) *scale* is related to the total surface area.
[deb7ee0]59
60**The 2D scattering intensity is not computed by this model.**
61
62
63Validation
64----------
65
66Validation of the code was conducted  by qualitatively comparing the output
[6e7d7b6]67of the 1D model to the curves shown in (Nayuk, 2012\ [#Nayuk2012]_).
[deb7ee0]68
[aa2edb2]69
70References
71----------
[deb7ee0]72
[6e7d7b6]73.. [#Nayuk2012] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854
[0507e09]74.. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659
[6e7d7b6]75
[0507e09]76Source
77------
78
79`hollow_rectangular_prism_thin_walls.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/hollow_rectangular_prism_thin_walls.py>`_
80
81`hollow_rectangular_prism_thin_walls.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/hollow_rectangular_prism_thin_walls.c>`_
[6e7d7b6]82
83Authorship and Verification
84----------------------------
85
86* **Author:** Miguel Gonzales **Date:** February 26, 2016
87* **Last Modified by:** Paul Kienzle **Date:** October 15, 2016
88* **Last Reviewed by:** Paul Butler **Date:** September 07, 2018
[0507e09]89* **Source added by :** Steve King **Date:** March 25, 2019
[deb7ee0]90"""
91
[2d81cfe]92import numpy as np
[b297ba9]93from numpy import inf
[deb7ee0]94
[3d8283b]95name = "hollow_rectangular_prism_thin_walls"
96title = "Hollow rectangular parallelepiped with thin walls."
[deb7ee0]97description = """
[3d8283b]98    I(q)= scale*V*(sld - sld_solvent)^2*P(q)+background
[deb7ee0]99        with P(q) being the form factor corresponding to a hollow rectangular
100        parallelepiped with infinitely thin walls.
101"""
102category = "shape:parallelepiped"
103
104#             ["name", "units", default, [lower, upper], "type","description"],
[42356c8]105parameters = [["sld", "1e-6/Ang^2", 6.3, [-inf, inf], "sld",
[deb7ee0]106               "Parallelepiped scattering length density"],
[42356c8]107              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld",
[deb7ee0]108               "Solvent scattering length density"],
[a807206]109              ["length_a", "Ang", 35, [0, inf], "volume",
[deb7ee0]110               "Shorter side of the parallelepiped"],
111              ["b2a_ratio", "Ang", 1, [0, inf], "volume",
112               "Ratio sides b/a"],
113              ["c2a_ratio", "Ang", 1, [0, inf], "volume",
114               "Ratio sides c/a"],
115             ]
116
[3d8283b]117source = ["lib/gauss76.c", "hollow_rectangular_prism_thin_walls.c"]
[71b751d]118have_Fq = True
[a34b811]119radius_effective_modes = [
[b297ba9]120    "equivalent cylinder excluded volume", "equivalent outer volume sphere",
[99658f6]121    "half length_a", "half length_b", "half length_c",
[ee60aa7]122    "equivalent outer circular cross-section",
123    "half ab diagonal", "half diagonal",
124    ]
[deb7ee0]125
126
[31df0c9]127def random():
[b297ba9]128    """Return a random parameter set for the model."""
[31df0c9]129    a, b, c = 10**np.random.uniform(1, 4.7, size=3)
130    pars = dict(
131        length_a=a,
132        b2a_ratio=b/a,
133        c2a_ratio=c/a,
134    )
135    return pars
136
137
[deb7ee0]138# parameters for demo
139demo = dict(scale=1, background=0,
[ab2aea8]140            sld=6.3, sld_solvent=1.0,
[a807206]141            length_a=35, b2a_ratio=1, c2a_ratio=1,
142            length_a_pd=0.1, length_a_pd_n=10,
[deb7ee0]143            b2a_ratio_pd=0.1, b2a_ratio_pd_n=1,
144            c2a_ratio_pd=0.1, c2a_ratio_pd_n=1)
145
[6dd90c1]146tests = [[{}, 0.2, 0.837719188592],
147         [{}, [0.2], [0.837719188592]],
[deb7ee0]148        ]
Note: See TracBrowser for help on using the repository browser.