1 | r""" |
---|
2 | This model calculates the form factor for a flexible cylinder with an |
---|
3 | elliptical cross section and a uniform scattering length density. |
---|
4 | The non-negligible diameter of the cylinder is included by accounting |
---|
5 | for excluded volume interactions within the walk of a single cylinder. |
---|
6 | **Inter-cylinder interactions are NOT provided for.** |
---|
7 | |
---|
8 | The form factor is normalized by the particle volume such that |
---|
9 | |
---|
10 | .. math:: |
---|
11 | |
---|
12 | P(q) = \text{scale} \left<F^2\right>/V + \text{background} |
---|
13 | |
---|
14 | where the averaging $\left<\ldots\right>$ is over all possible orientations |
---|
15 | of the flexible cylinder. |
---|
16 | |
---|
17 | The 2D scattering intensity is the same as 1D, regardless of the orientation |
---|
18 | of the q vector which is defined as |
---|
19 | |
---|
20 | .. math:: |
---|
21 | |
---|
22 | q = \sqrt{q_x^2 + q_y^2} |
---|
23 | |
---|
24 | |
---|
25 | Definitions |
---|
26 | ----------- |
---|
27 | |
---|
28 | The function is calculated in a similar way to that for the |
---|
29 | :ref:`flexible-cylinder` model in reference [1] below using the author's |
---|
30 | "Method 3 With Excluded Volume". |
---|
31 | |
---|
32 | The model is a parameterization of simulations of a discrete representation of |
---|
33 | the worm-like chain model of Kratky and Porod applied in the pseudo-continuous |
---|
34 | limit. See equations (13, 26-27) in the original reference for the details. |
---|
35 | |
---|
36 | .. note:: |
---|
37 | |
---|
38 | There are several typos in the original reference that have been corrected |
---|
39 | by WRC. Details of the corrections are in the reference below. Most notably |
---|
40 | |
---|
41 | - Equation (13): the term $(1 - w(QR))$ should swap position with $w(QR)$ |
---|
42 | |
---|
43 | - Equations (23) and (24) are incorrect; WRC has entered these into |
---|
44 | Mathematica and solved analytically. The results were then converted to |
---|
45 | code. |
---|
46 | |
---|
47 | - Equation (27) should be $q0 = max(a3/sqrt(RgSquare),3)$ instead of |
---|
48 | $max(a3*b/sqrt(RgSquare),3)$ |
---|
49 | |
---|
50 | - The scattering function is negative for a range of parameter values and |
---|
51 | q-values that are experimentally accessible. A correction function has been |
---|
52 | added to give the proper behavior. |
---|
53 | |
---|
54 | .. figure:: img/flexible_cylinder_ex_geometry.jpg |
---|
55 | |
---|
56 | |
---|
57 | The chain of contour length, $L$, (the total length) can be described as a chain |
---|
58 | of some number of locally stiff segments of length $l_p$, the persistence length |
---|
59 | (the length along the cylinder over which the flexible cylinder can be considered |
---|
60 | a rigid rod). |
---|
61 | The Kuhn length $(b = 2*l_p)$ is also used to describe the stiffness of a chain. |
---|
62 | |
---|
63 | The cross section of the cylinder is elliptical, with minor radius $a$ . |
---|
64 | The major radius is larger, so of course, **the axis_ratio must be |
---|
65 | greater than one.** Simple constraints should be applied during curve fitting to |
---|
66 | maintain this inequality. |
---|
67 | |
---|
68 | In the parameters, the $sld$ and $sld\_solvent$ represent the SLD of the |
---|
69 | chain/cylinder and solvent respectively. The *scale*, and the contrast are both |
---|
70 | multiplicative factors in the model and are perfectly correlated. One or both of |
---|
71 | these parameters must be held fixed during model fitting. |
---|
72 | |
---|
73 | **This is a model with complex behaviour depending on the ratio of** $L/b$ **and the |
---|
74 | reader is strongly encouraged to read reference [1] before use.** |
---|
75 | |
---|
76 | References |
---|
77 | ---------- |
---|
78 | |
---|
79 | .. [#] J S Pedersen and P Schurtenberger. *Scattering functions of semiflexible polymers with and without excluded volume effects.* Macromolecules, 29 (1996) 7602-7612 |
---|
80 | |
---|
81 | Correction of the formula can be found in |
---|
82 | |
---|
83 | .. [#] W R Chen, P D Butler and L J Magid, *Incorporating Intermicellar Interactions in the Fitting of SANS Data from Cationic Wormlike Micelles.* Langmuir, 22(15) 2006 6539-6548 |
---|
84 | |
---|
85 | Source |
---|
86 | ------ |
---|
87 | |
---|
88 | `flexible_cylinder_elliptical.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/flexible_cylinder_elliptical.py>`_ |
---|
89 | |
---|
90 | `flexible_cylinder_elliptical.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/flexible_cylinder_elliptical.c>`_ |
---|
91 | |
---|
92 | Authorship and Verification |
---|
93 | ---------------------------- |
---|
94 | |
---|
95 | * **Author:** |
---|
96 | * **Last Modified by:** |
---|
97 | * **Last Reviewed by:** |
---|
98 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
99 | """ |
---|
100 | |
---|
101 | import numpy as np |
---|
102 | from numpy import inf |
---|
103 | |
---|
104 | name = "flexible_cylinder_elliptical" |
---|
105 | title = "Flexible cylinder wth an elliptical cross section and a uniform " \ |
---|
106 | "scattering length density." |
---|
107 | description = """Note : scale and contrast=sldCyl-sldSolv are both multiplicative |
---|
108 | factors in the |
---|
109 | model and are perfectly correlated. One or |
---|
110 | both of these parameters must be held fixed |
---|
111 | during model fitting. |
---|
112 | """ |
---|
113 | single = False |
---|
114 | |
---|
115 | category = "shape:cylinder" |
---|
116 | # pylint: disable=bad-whitespace, line-too-long |
---|
117 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
118 | parameters = [ |
---|
119 | ["length", "Ang", 1000.0, [0, inf], "volume", "Length of the flexible cylinder"], |
---|
120 | ["kuhn_length", "Ang", 100.0, [0, inf], "volume", "Kuhn length of the flexible cylinder"], |
---|
121 | ["radius", "Ang", 20.0, [1, inf], "volume", "Radius of the flexible cylinder"], |
---|
122 | ["axis_ratio", "", 1.5, [0, inf], "", "Axis_ratio (major_radius/minor_radius"], |
---|
123 | ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", "Cylinder scattering length density"], |
---|
124 | ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent scattering length density"], |
---|
125 | ] |
---|
126 | # pylint: enable=bad-whitespace, line-too-long |
---|
127 | |
---|
128 | source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "lib/wrc_cyl.c", |
---|
129 | "flexible_cylinder_elliptical.c"] |
---|
130 | |
---|
131 | def random(): |
---|
132 | """Return a random parameter set for the model.""" |
---|
133 | length = 10**np.random.uniform(2, 6) |
---|
134 | radius = 10**np.random.uniform(1, 3) |
---|
135 | axis_ratio = 10**np.random.uniform(-1, 1) |
---|
136 | kuhn_length = 10**np.random.uniform(-2, -0.7)*length # at least 10 segments |
---|
137 | pars = dict( |
---|
138 | length=length, |
---|
139 | radius=radius, |
---|
140 | axis_ratio=axis_ratio, |
---|
141 | kuhn_length=kuhn_length, |
---|
142 | ) |
---|
143 | return pars |
---|
144 | |
---|
145 | tests = [ |
---|
146 | # Accuracy tests based on content in test/utest_other_models.py |
---|
147 | # Currently fails in OCL |
---|
148 | # [{'length': 1000.0, |
---|
149 | # 'kuhn_length': 100.0, |
---|
150 | # 'radius': 20.0, |
---|
151 | # 'axis_ratio': 1.5, |
---|
152 | # 'sld': 1.0, |
---|
153 | # 'sld_solvent': 6.3, |
---|
154 | # 'background': 0.0001, |
---|
155 | # }, 0.001, 3509.2187], |
---|
156 | |
---|
157 | # Additional tests with larger range of parameters |
---|
158 | [{'length': 1000.0, |
---|
159 | 'kuhn_length': 100.0, |
---|
160 | 'radius': 20.0, |
---|
161 | 'axis_ratio': 1.5, |
---|
162 | 'sld': 1.0, |
---|
163 | 'sld_solvent': 6.3, |
---|
164 | 'background': 0.0001, |
---|
165 | }, 1.0, 0.00223819], |
---|
166 | [{'length': 10.0, |
---|
167 | 'kuhn_length': 800.0, |
---|
168 | 'radius': 2.0, |
---|
169 | 'axis_ratio': 0.5, |
---|
170 | 'sld': 6.0, |
---|
171 | 'sld_solvent': 12.3, |
---|
172 | 'background': 0.001, |
---|
173 | }, 0.1, 0.390281], |
---|
174 | [{'length': 100.0, |
---|
175 | 'kuhn_length': 800.0, |
---|
176 | 'radius': 50.0, |
---|
177 | 'axis_ratio': 4.5, |
---|
178 | 'sld': 0.1, |
---|
179 | 'sld_solvent': 5.1, |
---|
180 | 'background': 0.0, |
---|
181 | }, 1.0, 0.0016338264790] |
---|
182 | ] |
---|