[cf404cb] | 1 | r""" |
---|
[841753c] | 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* |
---|
[cf404cb] | 4 | rods (like strings - with a total mass *Mw* = *M* \* *m*\ :sub:`r` + *N* \* *m*\ |
---|
[841753c] | 5 | :sub:`s`, and the string segment length (or edge separation) *l* |
---|
[cf404cb] | 6 | (= *A* - 2\ *R*)). *A* is the center-to-center pearl separation distance. |
---|
| 7 | |
---|
[2f0c07d] | 8 | .. figure:: img/pearl_necklace_geometry.jpg |
---|
[cf404cb] | 9 | |
---|
| 10 | Pearl Necklace schematic |
---|
| 11 | |
---|
| 12 | Definition |
---|
| 13 | ---------- |
---|
| 14 | |
---|
[a2f9aa2] | 15 | The output of the scattering intensity function for the pearl_necklace is |
---|
[cf404cb] | 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) &= 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 | |
---|
[841753c] | 39 | where the mass *m*\ :sub:`i` is (SLD\ :sub:`i` - SLD\ :sub:`solvent`) \* |
---|
[cf404cb] | 40 | (volume of the *N* pearls/rods). *V* is the total volume of the necklace. |
---|
| 41 | |
---|
[841753c] | 42 | The 2D scattering intensity is the same as $P(q)$ above, regardless of the |
---|
[cf404cb] | 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 | |
---|
[a807206] | 48 | NB: *num_pearls* must be an integer. |
---|
[cf404cb] | 49 | |
---|
[2f0c07d] | 50 | References |
---|
| 51 | ---------- |
---|
[cf404cb] | 52 | |
---|
[841753c] | 53 | R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*, |
---|
[cf404cb] | 54 | *Macromol. Symp.* 211 (2004) 25-42 2004 |
---|
| 55 | """ |
---|
| 56 | |
---|
[f12357f] | 57 | from numpy import inf, pi |
---|
[cf404cb] | 58 | |
---|
| 59 | name = "pearl_necklace" |
---|
[a2f9aa2] | 60 | title = "Colloidal spheres chained together with no preferential orientation" |
---|
[cf404cb] | 61 | description = """ |
---|
| 62 | Calculate form factor for Pearl Necklace Model |
---|
| 63 | [Macromol. Symp. 2004, 211, 25-42] |
---|
| 64 | Parameters: |
---|
| 65 | background:background |
---|
| 66 | scale: scale factor |
---|
| 67 | sld: the SLD of the pearl spheres |
---|
| 68 | sld_string: the SLD of the strings |
---|
| 69 | sld_solvent: the SLD of the solvent |
---|
[a807206] | 70 | num_pearls: number of the pearls |
---|
[cf404cb] | 71 | radius: the radius of a pearl |
---|
[a807206] | 72 | edge_sep: the length of string segment; surface to surface |
---|
| 73 | thick_string: thickness (ie, diameter) of the string |
---|
[cf404cb] | 74 | """ |
---|
| 75 | category = "shape:cylinder" |
---|
| 76 | |
---|
| 77 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
[a2f9aa2] | 78 | parameters = [["radius", "Ang", 80.0, [0, inf], "volume", |
---|
[cf404cb] | 79 | "Mean radius of the chained spheres"], |
---|
[a807206] | 80 | ["edge_sep", "Ang", 350.0, [0, inf], "volume", |
---|
[cf404cb] | 81 | "Mean separation of chained particles"], |
---|
[a807206] | 82 | ["thick_string", "Ang", 2.5, [0, inf], "volume", |
---|
[cf404cb] | 83 | "Thickness of the chain linkage"], |
---|
[1bd1ea2] | 84 | ["num_pearls", "none", 3, [1, inf], "volume", |
---|
[a2f9aa2] | 85 | "Number of pearls in the necklace (must be integer)"], |
---|
[42356c8] | 86 | ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", |
---|
[cf404cb] | 87 | "Scattering length density of the chained spheres"], |
---|
[42356c8] | 88 | ["sld_string", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", |
---|
[cf404cb] | 89 | "Scattering length density of the chain linkage"], |
---|
[42356c8] | 90 | ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", |
---|
[cf404cb] | 91 | "Scattering length density of the solvent"], |
---|
[841753c] | 92 | ] |
---|
[cf404cb] | 93 | |
---|
[4b541ac] | 94 | source = ["lib/sas_Si.c", "lib/sas_3j1x_x.c", "pearl_necklace.c"] |
---|
[d18582e] | 95 | single = False # use double precision unless told otherwise |
---|
[f12357f] | 96 | |
---|
[a807206] | 97 | def volume(radius, edge_sep, thick_string, num_pearls): |
---|
[f12357f] | 98 | """ |
---|
| 99 | Calculates the total particle volume of the necklace. |
---|
| 100 | Redundant with form_volume. |
---|
| 101 | """ |
---|
[d2deac2] | 102 | num_pearls = int(num_pearls + 0.5) |
---|
[a807206] | 103 | number_of_strings = num_pearls - 1.0 |
---|
| 104 | string_vol = edge_sep * pi * pow((thick_string / 2.0), 2.0) |
---|
[f12357f] | 105 | pearl_vol = 4.0 /3.0 * pi * pow(radius, 3.0) |
---|
| 106 | total_vol = number_of_strings * string_vol |
---|
[a807206] | 107 | total_vol += num_pearls * pearl_vol |
---|
[f12357f] | 108 | return total_vol |
---|
| 109 | |
---|
[a807206] | 110 | def ER(radius, edge_sep, thick_string, num_pearls): |
---|
[f12357f] | 111 | """ |
---|
| 112 | Calculation for effective radius. |
---|
| 113 | """ |
---|
[d2deac2] | 114 | num_pearls = int(num_pearls + 0.5) |
---|
[a807206] | 115 | tot_vol = volume(radius, edge_sep, thick_string, num_pearls) |
---|
[4962519] | 116 | rad_out = (tot_vol/(4.0/3.0*pi)) ** (1./3.) |
---|
[f12357f] | 117 | return rad_out |
---|
[cf404cb] | 118 | |
---|
[8f04da4] | 119 | def random(): |
---|
| 120 | import numpy as np |
---|
| 121 | radius = 10**np.random.uniform(1, 3) # 1 - 1000 |
---|
| 122 | thick_string = 10**np.random.uniform(0, np.log10(radius)-1) # 1 - radius/10 |
---|
| 123 | edge_sep = 10**np.random.uniform(0, 3) # 1 - 1000 |
---|
| 124 | num_pearls = np.round(10**np.random.uniform(0.3, 3)) # 2 - 1000 |
---|
| 125 | pars = dict( |
---|
| 126 | radius=radius, |
---|
| 127 | edge_sep=edge_sep, |
---|
| 128 | thick_string=thick_string, |
---|
| 129 | num_pearls=num_pearls, |
---|
| 130 | ) |
---|
| 131 | return pars |
---|
| 132 | |
---|
[cf404cb] | 133 | # parameters for demo |
---|
[a807206] | 134 | demo = dict(scale=1, background=0, radius=80.0, edge_sep=350.0, |
---|
| 135 | num_pearls=3, sld=1, sld_solvent=6.3, sld_string=1, |
---|
| 136 | thick_string=2.5, |
---|
[cf404cb] | 137 | radius_pd=.2, radius_pd_n=5, |
---|
[a807206] | 138 | edge_sep_pd=25.0, edge_sep_pd_n=5, |
---|
| 139 | num_pearls_pd=0, num_pearls_pd_n=0, |
---|
| 140 | thick_string_pd=0.2, thick_string_pd_n=5, |
---|
[cf404cb] | 141 | ) |
---|
| 142 | |
---|
[f12357f] | 143 | tests = [[{}, 0.001, 17380.245], [{}, 'ER', 115.39502]] |
---|