1 | r""" |
---|
2 | This model provides the form factor for a pearl necklace composed of two |
---|
3 | elements: *N* pearls (homogeneous spheres of radius *R*) freely jointed by *M* |
---|
4 | rods (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_necklace_geometry.jpg |
---|
9 | |
---|
10 | Pearl Necklace schematic |
---|
11 | |
---|
12 | Definition |
---|
13 | ---------- |
---|
14 | |
---|
15 | The output of the scattering intensity function for the pearl_necklace is |
---|
16 | given 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 | |
---|
23 | where |
---|
24 | |
---|
25 | .. math:: |
---|
26 | |
---|
27 | S_{ss}(q) &= 2m_s^2\psi^2(q)\left[\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}\right] \\ |
---|
29 | S_{ff}(q) &= m_r^2\left[M\left\{2\Lambda(q)-\left(\frac{sin(ql/2)}{ql/2}\right)\right\}+ |
---|
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}\right] \\ |
---|
32 | S_{fs}(q) &= m_r \beta (q) \cdot m_s \psi (q) \cdot 4\left[ |
---|
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}\right] \\ |
---|
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 | |
---|
39 | where 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 | |
---|
42 | The 2D scattering intensity is the same as $P(q)$ above, regardless of the |
---|
43 | orientation of the *q* vector. |
---|
44 | |
---|
45 | The returned value is scaled to units of |cm^-1| and the parameters of the |
---|
46 | pearl_necklace model are the following |
---|
47 | |
---|
48 | NB: *num_pearls* must be an integer. |
---|
49 | |
---|
50 | References |
---|
51 | ---------- |
---|
52 | |
---|
53 | .. [#] R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*, |
---|
54 | *Macromol. Symp.* 211 (2004) 25-42 2004 |
---|
55 | .. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659 |
---|
56 | |
---|
57 | Source |
---|
58 | ------ |
---|
59 | |
---|
60 | `pearl_necklace.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/pearl_necklace.py>`_ |
---|
61 | |
---|
62 | `pearl_necklace.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/pearl_necklace.c>`_ |
---|
63 | |
---|
64 | Authorship and Verification |
---|
65 | ---------------------------- |
---|
66 | |
---|
67 | * **Author:** |
---|
68 | * **Last Modified by:** |
---|
69 | * **Last Reviewed by:** |
---|
70 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
71 | """ |
---|
72 | |
---|
73 | import numpy as np |
---|
74 | from numpy import inf |
---|
75 | |
---|
76 | name = "pearl_necklace" |
---|
77 | title = "Colloidal spheres chained together with no preferential orientation" |
---|
78 | description = """ |
---|
79 | Calculate form factor for Pearl Necklace Model |
---|
80 | [Macromol. Symp. 2004, 211, 25-42] |
---|
81 | Parameters: |
---|
82 | background:background |
---|
83 | scale: scale factor |
---|
84 | sld: the SLD of the pearl spheres |
---|
85 | sld_string: the SLD of the strings |
---|
86 | sld_solvent: the SLD of the solvent |
---|
87 | num_pearls: number of the pearls |
---|
88 | radius: the radius of a pearl |
---|
89 | edge_sep: the length of string segment; surface to surface |
---|
90 | thick_string: thickness (ie, diameter) of the string |
---|
91 | """ |
---|
92 | category = "shape:cylinder" |
---|
93 | |
---|
94 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
95 | parameters = [["radius", "Ang", 80.0, [0, inf], "volume", |
---|
96 | "Mean radius of the chained spheres"], |
---|
97 | ["edge_sep", "Ang", 350.0, [0, inf], "volume", |
---|
98 | "Mean separation of chained particles"], |
---|
99 | ["thick_string", "Ang", 2.5, [0, inf], "volume", |
---|
100 | "Thickness of the chain linkage"], |
---|
101 | ["num_pearls", "none", 3, [1, inf], "volume", |
---|
102 | "Number of pearls in the necklace (must be integer)"], |
---|
103 | ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", |
---|
104 | "Scattering length density of the chained spheres"], |
---|
105 | ["sld_string", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", |
---|
106 | "Scattering length density of the chain linkage"], |
---|
107 | ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", |
---|
108 | "Scattering length density of the solvent"], |
---|
109 | ] |
---|
110 | |
---|
111 | source = ["lib/sas_Si.c", "lib/sas_3j1x_x.c", "pearl_necklace.c"] |
---|
112 | single = False # use double precision unless told otherwise |
---|
113 | effective_radius_type = ["equivalent volume sphere"] |
---|
114 | |
---|
115 | def random(): |
---|
116 | """Return a random parameter set for the model.""" |
---|
117 | radius = 10**np.random.uniform(1, 3) # 1 - 1000 |
---|
118 | thick_string = 10**np.random.uniform(0, np.log10(radius)-1) # 1 - radius/10 |
---|
119 | edge_sep = 10**np.random.uniform(0, 3) # 1 - 1000 |
---|
120 | num_pearls = np.round(10**np.random.uniform(0.3, 3)) # 2 - 1000 |
---|
121 | pars = dict( |
---|
122 | radius=radius, |
---|
123 | edge_sep=edge_sep, |
---|
124 | thick_string=thick_string, |
---|
125 | num_pearls=num_pearls, |
---|
126 | ) |
---|
127 | return pars |
---|
128 | |
---|
129 | # parameters for demo |
---|
130 | demo = dict(scale=1, background=0, radius=80.0, edge_sep=350.0, |
---|
131 | num_pearls=3, sld=1, sld_solvent=6.3, sld_string=1, |
---|
132 | thick_string=2.5, |
---|
133 | radius_pd=.2, radius_pd_n=5, |
---|
134 | edge_sep_pd=25.0, edge_sep_pd_n=5, |
---|
135 | num_pearls_pd=0, num_pearls_pd_n=0, |
---|
136 | thick_string_pd=0.2, thick_string_pd_n=5, |
---|
137 | ) |
---|
138 | # ER function is not being used here, not that it is likely very sensible to |
---|
139 | # include an S(Q) with this model, the default in sasview 5.0 would be to the |
---|
140 | # "unconstrained" radius_effective. |
---|
141 | #tests = [[{}, 0.001, 17380.245], [{}, 'ER', 115.39502]] |
---|
142 | tests = [[{}, 0.001, 17380.245]] |
---|