source: sasmodels/sasmodels/models/pearl_necklace.py @ dcef2ee

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

Added pearl necklace model and numeric method for intrgrating sin(x)/x.
Modified compare.py to ignore PD for number of pearls and string
thickness.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1r"""
2This model provides the form factor for a pearl necklace composed of two
3elements: *N* pearls (homogeneous spheres of radius *R*) freely jointed by *M*
4rods (like strings - with a total mass *Mw* = *M* \* *m*\ :sub:`r` + *N* \* *m*\
5:sub:`s`, and the string segment length (or edge separation) *l*
6(= *A* - 2\ *R*)). *A* is the center-to-center pearl separation distance.
7
8.. figure:: img/pearl_fig.jpg
9
10    Pearl Necklace schematic
11
12Definition
13----------
14
15The output of the scattering intensity function for the PearlNecklaceModel is
16given by (Schweins, 2004)
17
18.. math::
19
20    I(q)=\frac{ \text{scale} }{V} \cdot \frac{(S_{ss}(q)+S_{ff}(q)+S_{fs}(q))}
21        {(M \cdot m_f + N \cdot m_s)^2} + \text{bkg}
22
23where
24
25.. math::
26
27    S_{ss}(q) &= sm_s^2\psi^2(q)[\frac{N}{1-sin(qA)/qA}-\frac{N}{2}-
28        \frac{1-(sin(qA)/qA)^N}{(1-sin(qA)/qA)^2}\cdot\frac{sin(qA)}{qA}] \\
29    S_{ff}(q) &= sm_r^2[M\{2\Lambda(q)-(\frac{sin(ql/2)}{ql/2})\}+
30        \frac{2M\beta^2(q)}{1-sin(qA)/qA}-2\beta^2(q)\cdot
31        \frac{1-(sin(qA)/qA)^M}{(1-sin(qA)/qA)^2}] \\
32    S_{fs}(q) &= m_r \beta (q) \cdot m_s \psi (q) \cdot 4[
33        \frac{N-1}{1-sin(qA)/qA}-\frac{1-(sin(qA)/qA)^{N-1}}{(1-sin(qA)/qA)^2}
34        \cdot \frac{sin(qA)}{qA}] \\
35    \psi(q) &= 3 \cdot \frac{sin(qR)-(qR)\cdot cos(qR)}{(qR)^3} \\
36    \Lambda(q) &= \frac{\int_0^{ql}\frac{sin(t)}{t}dt}{ql} \\
37    \beta(q) &= \frac{\int_{qR}^{q(A-R)}\frac{sin(t)}{t}dt}{ql}
38
39where the mass *m*\ :sub:`i` is (SLD\ :sub:`i` - SLD\ :sub:`solvent`) \*
40(volume of the *N* pearls/rods). *V* is the total volume of the necklace.
41
42The 2D scattering intensity is the same as $P(q)$ above, regardless of the
43orientation of the *q* vector.
44
45The returned value is scaled to units of |cm^-1| and the parameters of the
46pearl_necklace model are the following
47
48NB: *number_of_pearls* must be an integer.
49
50.. figure:: img/pearl_plot.jpg
51
52    1D plot using the default values (w/1000 data point).
53
54REFERENCE
55
56R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*,
57*Macromol. Symp.* 211 (2004) 25-42 2004
58"""
59
60from numpy import inf
61
62name = "pearl_necklace"
63title = "Colloidal spheres chained together with o preferential orientation"
64description = """
65Calculate form factor for Pearl Necklace Model
66[Macromol. Symp. 2004, 211, 25-42]
67Parameters:
68background:background
69scale: scale factor
70sld: the SLD of the pearl spheres
71sld_string: the SLD of the strings
72sld_solvent: the SLD of the solvent
73number_of_pearls: number of the pearls
74radius: the radius of a pearl
75edge_separation: the length of string segment; surface to surface
76string_thickness: thickness (ie, diameter) of the string
77"""
78category = "shape:cylinder"
79
80#             ["name", "units", default, [lower, upper], "type","description"],
81parameters = [["radius", "Angstrom", 80.0, [0, inf], "volume", 
82               "Mean radius of the chained spheres"],
83              ["edge_separation", "Angstrom", 350.0, [0, inf], "volume", 
84               "Mean separation of chained particles"],
85              ["string_thickness", "Angstrom", 2.5, [0, inf], "volume", 
86               "Thickness of the chain linkage"],
87              ["number_of_pearls", "none", 3, [0, inf], "volume", 
88               "Mean number of pearls in each necklace"],
89              ["sld", "Angstrom^2", 1.0, [-inf, inf], "", 
90               "Scattering length density of the chained spheres"],
91              ["string_sld", "Angstrom^2", 1.0, [-inf, inf], "", 
92               "Scattering length density of the chain linkage"],
93              ["solvent_sld", "Angstrom^2", 6.3, [-inf, inf], "", 
94               "Scattering length density of the solvent"],
95              ]
96
97source = ["lib/Si.c", "pearl_necklace.c"]
98
99# parameters for demo
100demo = dict(scale=1, background=0, radius=80.0, edge_separation=350.0,
101            number_of_pearls=3, sld=1, solvent_sld=6.3, string_sld=1,
102            string_thickness=2.5,
103            radius_pd=.2, radius_pd_n=5,
104            edge_separation_pd=25.0, edge_separation_pd_n=5,
105            number_of_pearls_pd=0, number_of_pearls_pd_n=0,
106            string_thickness_pd=0.2, string_thickness_pd_n=5,
107           )
108
109# For testing against the old sasview models, include the converted parameter
110# names and the target sasview model name.
111oldname = 'PearlNecklaceModel'
112oldpars = dict(scale='scale',background='background',radius='radius',
113               number_of_pearls='num_pearls', solvent_sld='sld_solv',
114               string_thickness='thick_string', sld='sld_pearl',
115               string_sld='sld_string', edge_separation='edge_separation')
Note: See TracBrowser for help on using the repository browser.