source: sasmodels/sasmodels/models/cylinder.py @ a7684e5

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since a7684e5 was a7684e5, checked in by Paul Kienzle <pkienzle@…>, 10 years ago

docu updates

  • Property mode set to 100644
File size: 5.0 KB
Line 
1# Note: model title and parameter table are inserted automatically
2r"""
3The form factor is normalized by the particle volume.
4
5For information about polarised and magnetic scattering, click here_.
6
7Definition
8----------
9
10The output of the 2D scattering intensity function for oriented cylinders is
11given by (Guinier, 1955)
12
13.. math::
14
15    P(q,\alpha) = \frac{\text{scale}}{V}f^2(q) + \text{bkg}
16
17where
18
19.. math::
20
21    f(q) = 2 (\Delta \rho) V
22           \frac{\sin (q L/2 \cos \alpha)}{q L/2 \cos \alpha}
23           \frac{J_1 (q r \sin \alpha)}{q r \sin \alpha}
24
25and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V$
26is the volume of the cylinder, $L$ is the length of the cylinder, $r$ is the
27radius of the cylinder, and $d\rho$ (contrast) is the scattering length density
28difference between the scatterer and the solvent. $J_1$ is the first order
29Bessel function.
30
31To provide easy access to the orientation of the cylinder, we define the
32axis of the cylinder using two angles $\theta$ and $\phi$. Those angles
33are defined in Figure :num:`figure #CylinderModel-orientation`.
34
35.. _CylinderModel-orientation:
36
37.. figure:: img/image061.JPG   (should be img/cylinder-1.jpg, or img/cylinder-orientation.jpg)
38
39    Definition of the angles for oriented cylinders.
40
41.. figure:: img/image062.JPG
42
43    Examples of the angles for oriented pp against the detector plane.
44
45NB: The 2nd virial coefficient of the cylinder is calculated based on the
46radius and length values, and used as the effective radius for $S(Q)$
47when $P(Q) \cdot S(Q)$ is applied.
48
49The output of the 1D scattering intensity function for randomly oriented
50cylinders is then given by
51
52.. math::
53
54    P(q) = \frac{\text{scale}}{V}
55        \int_0^{\pi/2} f^2(q,\alpha) \sin \alpha d\alpha + \text{background}
56
57The *theta* and *phi* parameters are not used for the 1D output. Our
58implementation of the scattering kernel and the 1D scattering intensity
59use the c-library from NIST.
60
61Validation
62----------
63
64Validation of our code was done by comparing the output of the 1D model
65to the output of the software provided by the NIST (Kline, 2006).
66Figure :num:`figure #CylinderModel-compare` shows a comparison of
67the 1D output of our model and the output of the NIST software.
68
69.. _CylinderModel-compare:
70
71.. figure:: img/image065.JPG
72
73    Comparison of the SasView scattering intensity for a cylinder with the
74    output of the NIST SANS analysis software.
75    The parameters were set to: *Scale* = 1.0, *Radius* = 20 |Ang|,
76    *Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and
77    *Background* = 0.01 |cm^-1|.
78
79In general, averaging over a distribution of orientations is done by
80evaluating the following
81
82.. math::
83
84    P(q) = \int_0^{\pi/2} d\phi
85        \int_0^\pi p(\theta, \phi) P_0(q,\alpha) \sin \theta d\theta
86
87
88where $p(\theta,\phi)$ is the probability distribution for the orientation
89and $P_0(q,\alpha)$ is the scattering intensity for the fully oriented
90system. Since we have no other software to compare the implementation of
91the intensity for fully oriented cylinders, we can compare the result of
92averaging our 2D output using a uniform distribution $p(\theta, \phi) = 1.0$.
93Figure :num:`figure #CylinderModel-crosscheck` shows the result of
94such a cross-check.
95
96.. _CylinderModel-crosscheck:
97
98.. figure:: img/image066.JPG
99
100    Comparison of the intensity for uniformly distributed cylinders
101    calculated from our 2D model and the intensity from the NIST SANS
102    analysis software.
103    The parameters used were: *Scale* = 1.0, *Radius* = 20 |Ang|,
104    *Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and
105    *Background* = 0.0 |cm^-1|.
106"""
107
108from numpy import pi, inf
109
110name = "cylinder"
111title = "Right circular cylinder with uniform scattering length density."
112description = """
113     f(q)= 2*(sldCyl - sldSolv)*V*sin(qLcos(alpha/2))
114            /[qLcos(alpha/2)]*J1(qRsin(alpha/2))/[qRsin(alpha)]
115
116            P(q,alpha)= scale/V*f(q)^(2)+background
117            V: Volume of the cylinder
118            R: Radius of the cylinder
119            L: Length of the cylinder
120            J1: The bessel function
121            alpha: angle betweenthe axis of the
122            cylinder and the q-vector for 1D
123            :the ouput is P(q)=scale/V*integral
124            from pi/2 to zero of...
125            f(q)^(2)*sin(alpha)*dalpha+ bkg
126    """
127
128parameters = [
129#   [ "name", "units", default, [lower, upper], "type",
130#     "description" ],
131    [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "",
132      "Cylinder scattering length density" ],
133    [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "",
134      "Solvent scattering length density" ],
135    [ "radius", "Ang",  20, [0, inf], "volume",
136      "Cylinder radius" ],
137    [ "length", "Ang",  400, [0, inf], "volume",
138      "Cylinder length" ],
139    [ "theta", "degrees", 60, [-inf, inf], "orientation",
140      "In plane angle" ],
141    [ "phi", "degrees", 60, [-inf, inf], "orientation",
142      "Out of plane angle" ],
143    ]
144
145source = [ "lib/J1.c", "lib/gauss76.c", "lib/cylkernel.c", "cylinder.c"]
146
147def ER(radius, length):
148    ddd = 0.75*radius*(2*radius*length + (length+radius)*(length+pi*radius))
149    return 0.5 * (ddd)**(1./3.)
150
Note: See TracBrowser for help on using the repository browser.