1 | r""" |
---|
2 | For information about polarised and magnetic scattering, see |
---|
3 | the :doc:`magnetic help <../sasgui/perspectives/fitting/mag_help>` documentation. |
---|
4 | |
---|
5 | Definition |
---|
6 | ---------- |
---|
7 | |
---|
8 | The scattering intensity *I(q)* is calculated as: |
---|
9 | |
---|
10 | .. math:: |
---|
11 | I(q) = \frac{scale}{V}(\Delta \rho)^2 A^2(q) S(q) +\text{background} |
---|
12 | |
---|
13 | |
---|
14 | where the amplitude *A(q)* is given as the typical sphere scattering convoluted |
---|
15 | with a Gaussian to get a gradual drop-off in the scattering length density: |
---|
16 | |
---|
17 | .. math:: |
---|
18 | |
---|
19 | A(q) = \frac{3\left[\sin(qR) - qR \cos(qR)\right]}{(qR)^3} |
---|
20 | \exp\left(\frac{-(\sigma_{fuzzy}q)^2}{2}\right) |
---|
21 | |
---|
22 | Here *|A(q)|*:sup:`2`\ is the form factor, *P(q)*. The scale is equivalent to the |
---|
23 | volume fraction of spheres, each of volume, *V*\. Contrast (|drho|) is the |
---|
24 | difference of scattering length densities of the sphere and the surrounding |
---|
25 | solvent. |
---|
26 | |
---|
27 | Poly-dispersion in radius and in fuzziness is provided for, though the fuzziness |
---|
28 | must be kept much smaller than the sphere radius for meaningful results. |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | From the reference: |
---|
33 | |
---|
34 | The "fuzziness" of the interface is defined by the parameter |
---|
35 | |sigma| :sub:`fuzzy`\ . The particle radius *R* represents the radius of the |
---|
36 | particle where the scattering length density profile decreased to 1/2 of the |
---|
37 | core density. The |sigma| :sub:`fuzzy`\ is the width of the smeared particle |
---|
38 | surface; i.e., the standard deviation from the average height of the fuzzy |
---|
39 | interface. The inner regions of the microgel that display a higher density |
---|
40 | are described by the radial box profile extending to a radius of |
---|
41 | approximately *Rbox* ~ *R* - 2\ |sigma|\ . The profile approaches zero as |
---|
42 | *Rsans* ~ *R* + 2\ |sigma|\ . |
---|
43 | |
---|
44 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
45 | where the *q* vector is defined as |
---|
46 | |
---|
47 | .. math:: |
---|
48 | |
---|
49 | q = \sqrt{{q_x}^2 + {q_y}^2} |
---|
50 | |
---|
51 | |
---|
52 | References |
---|
53 | ---------- |
---|
54 | |
---|
55 | M Stieger, J. S Pedersen, P Lindner, W Richtering, *Langmuir*, |
---|
56 | 20 (2004) 7283-7292 |
---|
57 | """ |
---|
58 | |
---|
59 | from numpy import inf |
---|
60 | |
---|
61 | name = "fuzzy_sphere" |
---|
62 | title = "Scattering from spherical particles with a fuzzy surface." |
---|
63 | description = """\ |
---|
64 | scale: scale factor times volume fraction, |
---|
65 | or just volume fraction for absolute scale data |
---|
66 | radius: radius of the solid sphere |
---|
67 | fuzziness = the standard deviation of the fuzzy interfacial |
---|
68 | thickness (ie., so-called interfacial roughness) |
---|
69 | sld: the SLD of the sphere |
---|
70 | solvend_sld: the SLD of the solvent |
---|
71 | background: incoherent background |
---|
72 | Note: By definition, this function works only when fuzziness << radius. |
---|
73 | """ |
---|
74 | category = "shape:sphere" |
---|
75 | |
---|
76 | # pylint: disable=bad-whitespace,line-too-long |
---|
77 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
78 | parameters = [["sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Particle scattering length density"], |
---|
79 | ["sld_solvent", "1e-6/Ang^2", 3, [-inf, inf], "", "Solvent scattering length density"], |
---|
80 | ["radius", "Ang", 60, [0, inf], "volume", "Sphere radius"], |
---|
81 | ["fuzziness", "Ang", 10, [0, inf], "", "std deviation of Gaussian convolution for interface (must be << radius)"], |
---|
82 | ] |
---|
83 | # pylint: enable=bad-whitespace,line-too-long |
---|
84 | |
---|
85 | source = ["lib/sph_j1c.c"] |
---|
86 | |
---|
87 | # No volume normalization despite having a volume parameter |
---|
88 | # This should perhaps be volume normalized? |
---|
89 | form_volume = """ |
---|
90 | return 1.333333333333333*M_PI*radius*radius*radius; |
---|
91 | """ |
---|
92 | |
---|
93 | Iq = """ |
---|
94 | const double qr = q*radius; |
---|
95 | const double bes = sph_j1c(qr); |
---|
96 | const double qf = q*fuzziness; |
---|
97 | const double fq = bes * (sld - sld_solvent) * form_volume(radius) * exp(-0.5*qf*qf); |
---|
98 | return 1.0e-4*fq*fq; |
---|
99 | """ |
---|
100 | |
---|
101 | Iqxy = """ |
---|
102 | // never called since no orientation or magnetic parameters. |
---|
103 | //return -1.0; |
---|
104 | return Iq(sqrt(qx*qx + qy*qy), sld, sld_solvent, radius, fuzziness); |
---|
105 | """ |
---|
106 | |
---|
107 | def ER(radius): |
---|
108 | """ |
---|
109 | Return radius |
---|
110 | """ |
---|
111 | return radius |
---|
112 | |
---|
113 | # VR defaults to 1.0 |
---|
114 | |
---|
115 | demo = dict(scale=1, background=0.001, |
---|
116 | sld=1, sld_solvent=3, |
---|
117 | radius=60, |
---|
118 | fuzziness=10, |
---|
119 | radius_pd=.2, radius_pd_n=45, |
---|
120 | fuzziness_pd=.2, fuzziness_pd_n=0) |
---|
121 | |
---|
122 | oldname = "FuzzySphereModel" |
---|
123 | oldpars = dict(sld='sldSph', sld_solvent='sldSolv', radius='radius', fuzziness='fuzziness') |
---|
124 | |
---|
125 | |
---|
126 | tests = [ |
---|
127 | # Accuracy tests based on content in test/utest_models_new1_3.py |
---|
128 | #[{'background': 0.001}, 1.0, 0.001], |
---|
129 | |
---|
130 | [{}, 0.00301005, 359.2315], |
---|
131 | |
---|
132 | ] |
---|