source: sasmodels/sasmodels/models/hollow_cylinder.py @ 66ebdd6

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

Finished the hollow_cylinder model and added unit tests to guinier and
lorentz models.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1r"""
2This model provides the form factor, *P(q)*, for a monodisperse hollow right
3angle circular cylinder (tube) where the form factor is normalized by the
4volume of the tube
5
6*P(q)* = *scale* \* *<F*\ :sup:`2`\ *>* / *V*\ :sub:`shell` + *background*
7
8where the averaging < > is applied only for the 1D calculation.
9
10The inside and outside of the hollow cylinder are assumed have the same SLD.
11
12Definition
13----------
14
15The 1D scattering intensity is calculated in the following way (Guinier, 1955)
16
17.. math::
18
19    \begin{eqnarray}
20    P(q)&=&(\text{scale})V_{shell}(\Delta\rho)^2\int_0^{1}\Psi^2[q_z,
21    R_{shell}(1-x^2)^{1/2},R_{core}(1-x^2)^{1/2}][\frac{sin(qHx)}{qHx}]^2dx\\
22    \Psi[q,y,z]&=&\frac{1}{1-\gamma^2}[\Lambda(qy)-\gamma^2\Lambda(qz)]\\
23    \Lambda(a)&=&2J_1(a)/a\\
24    \gamma&=&R_{core}/R_{shell}\\
25    V_{shell}&=&\pi(R_{shell}^2-R_{core}^2)L\\
26    J_1(x)&=&\frac{(sin(x)-x\cdot cos(x))}{x^2}\\
27    \end{eqnarray}
28
29where *scale* is a scale factor and *J1* is the 1st order Bessel function.
30
31To provide easy access to the orientation of the core-shell cylinder, we define
32the axis of the cylinder using two angles |theta| and |phi|\ . As for the case
33of the cylinder, those angles are defined in Figure 2 of the CylinderModel.
34
35NB: The 2nd virial coefficient of the cylinder is calculated based on the radius
36and 2 length values, and used as the effective radius for *S(Q)* when
37*P(Q)* \* *S(Q)* is applied.
38
39In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent`
40and the *radius* = *R*\ :sub:`shell` while *core_radius* = *R*\ :sub:`core`.
41
42.. image:: img/image074.jpg
43
44*Figure. 1D plot using the default values (w/1000 data point).*
45
46Our model uses the form factor calculations implemented in a c-library provided
47by the NIST Center for Neutron Research (Kline, 2006).
48
49.. image:: img/image061.jpg
50
51*Figure. Definition of the angles for the oriented hollow_cylinder model.*
52
53.. image:: img/image062.jpg
54
55*Figure. Examples of the angles for oriented pp against the detector plane.*
56
57REFERENCE
58
59L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and
60Neutron Scattering*, Plenum Press, New York, (1987)
61"""
62
63from numpy import inf
64
65name = "hollow_cylinder"
66title = ""
67description = """
68P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude.
69core_radius = the radius of core
70radius = the radius of shell
71length = the total length of the cylinder
72sld = SLD of the shell
73solvent_sld = SLD of the solvent
74background = incoherent background
75"""
76category = "shape:cylinder"
77
78#             ["name", "units", default, [lower, upper], "type","description"],
79parameters = [
80              ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"],
81              ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"],
82              ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"],
83              ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"],
84              ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"],
85              ["theta", "[deg]", 90, [-360, 360], "orientation", "Theta angle"],
86              ["phi", "[deg]", 0, [-360, 360], "orientation", "Phi angle"],
87              ]
88
89source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"]
90
91# parameters for demo
92demo = dict(scale=1.0,background=0.0,length=400.0,radius=30.0,core_radius=20.0,
93            sld=6.3,solvent_sld=1,theta=90,phi=0,
94            radius_pd=.2, radius_pd_n=9,
95            length_pd=.2, length_pd_n=10,
96            theta_pd=10, theta_pd_n=5,
97            )
98
99# For testing against the old sasview models, include the converted parameter
100# names and the target sasview model name.
101oldname = 'HollowCylinderModel'
102oldpars = dict(scale='scale',background='background',radius='radius',
103               core_radius='core_radius',sld='sldCyl',length='length',
104               solvent_sld='sldSolv',phi='axis_phi',theta='axis_theta')
105
106# Parameters for unit tests
107tests = [
108         [{"radius" : 30.0},0.00005,1764.926]
109         ]
Note: See TracBrowser for help on using the repository browser.