1 | r""" |
---|
2 | Calculates the scattering from fractal-like aggregates based on |
---|
3 | the Mildner reference. |
---|
4 | |
---|
5 | Definition |
---|
6 | ---------- |
---|
7 | |
---|
8 | The scattering intensity $I(q)$ is calculated as |
---|
9 | |
---|
10 | .. math:: |
---|
11 | |
---|
12 | I(q) = scale \times P(q)S(q) + background |
---|
13 | |
---|
14 | .. math:: |
---|
15 | |
---|
16 | P(q) = F(qR)^2 |
---|
17 | |
---|
18 | .. math:: |
---|
19 | |
---|
20 | F(x) = \frac{3\left[sin(x)-xcos(x)\right]}{x^3} |
---|
21 | |
---|
22 | .. math:: |
---|
23 | |
---|
24 | S(q) = \frac{\Gamma(D_m-1)\zeta^{D_m-1}}{\left[1+(q\zeta)^2 |
---|
25 | \right]^{(D_m-1)/2}} |
---|
26 | \frac{sin\left[(D_m - 1) tan^{-1}(q\zeta) \right]}{q} |
---|
27 | |
---|
28 | .. math:: |
---|
29 | |
---|
30 | scale = scale\_factor \times NV^2(\rho_{particle} - \rho_{solvent})^2 |
---|
31 | |
---|
32 | .. math:: |
---|
33 | |
---|
34 | V = \frac{4}{3}\pi R^3 |
---|
35 | |
---|
36 | where $R$ is the radius of the building block, $D_m$ is the **mass** fractal |
---|
37 | dimension,$\zeta$ is the cut-off length, $\rho_{solvent}$ is the scattering |
---|
38 | length density of the solvent, |
---|
39 | and $\rho_{particle}$ is the scattering length density of particles. |
---|
40 | |
---|
41 | .. note:: |
---|
42 | |
---|
43 | The mass fractal dimension ( $D_m$ ) is only |
---|
44 | valid if $0 < mass_dim < 6$. It is also only valid over a limited |
---|
45 | $q$ range (see the reference for details). |
---|
46 | |
---|
47 | .. figure:: img/mass_fractal_1d.jpg |
---|
48 | |
---|
49 | 1D plot using the default values. |
---|
50 | |
---|
51 | Reference |
---|
52 | --------- |
---|
53 | |
---|
54 | D Mildner and P Hall, *J. Phys. D: Appl. Phys.*, |
---|
55 | 19 (1986) 1535-1545 Equation(9) |
---|
56 | |
---|
57 | |
---|
58 | """ |
---|
59 | |
---|
60 | from numpy import inf |
---|
61 | |
---|
62 | name = "mass_fractal" |
---|
63 | title = "Mass Fractal model" |
---|
64 | description = """ |
---|
65 | The scattering intensity I(x) = scale*P(x)*S(x) + background, where |
---|
66 | scale = scale_factor * V * delta^(2) |
---|
67 | p(x)= F(x*radius)^(2) |
---|
68 | F(x) = 3*[sin(x)-x cos(x)]/x**3 |
---|
69 | S(x) = [(gamma(Dm-1)*colength^(Dm-1)*[1+(x^2*colength^2)]^((1-Dm)/2) |
---|
70 | * sin[(Dm-1)*arctan(x*colength)])/x] |
---|
71 | where delta = sldParticle -sldSolv. |
---|
72 | radius = Particle radius |
---|
73 | mass_dim = Mass fractal dimension |
---|
74 | cutoff_length = Cut-off length |
---|
75 | background = background |
---|
76 | Ref.:Mildner, Hall,J Phys D Appl Phys(1986), 9, 1535-1545 |
---|
77 | Note I: This model is valid for 1<mass_dim<6. |
---|
78 | Note II: This model is not in absolute scale. |
---|
79 | """ |
---|
80 | category = "shape-independent" |
---|
81 | |
---|
82 | # pylint: disable=bad-whitespace, line-too-long |
---|
83 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
84 | parameters = [["radius", "Ang", 10.0, [0.0, inf], "", "Particle radius"], |
---|
85 | ["mass_dim", "", 1.9, [1.0, 6.0], "", "Mass fractal dimension"], |
---|
86 | ["cutoff_length", "Ang", 100.0, [0.0, inf], "", "Cut-off length"], |
---|
87 | ] |
---|
88 | # pylint: enable=bad-whitespace, line-too-long |
---|
89 | |
---|
90 | source = ["lib/sph_j1c.c", "lib/lanczos_gamma.c", "mass_fractal.c"] |
---|
91 | |
---|
92 | demo = dict(scale=1, background=0, |
---|
93 | radius=10.0, |
---|
94 | mass_dim=1.9, |
---|
95 | cutoff_length=100.0) |
---|
96 | |
---|
97 | oldname = 'MassFractalModel' |
---|
98 | oldpars = dict(radius='radius', |
---|
99 | mass_dim='mass_dim', |
---|
100 | cutoff_length='co_length') |
---|
101 | |
---|
102 | tests = [ |
---|
103 | |
---|
104 | # Accuracy tests based on content in test/utest_other_models.py |
---|
105 | [{'radius': 10.0, |
---|
106 | 'mass_dim': 1.9, |
---|
107 | 'cutoff_length': 100.0, |
---|
108 | }, 0.05, 279.59322], |
---|
109 | |
---|
110 | # Additional tests with larger range of parameters |
---|
111 | [{'radius': 2.0, |
---|
112 | 'mass_dim': 3.3, |
---|
113 | 'cutoff_length': 1.0, |
---|
114 | }, 0.5, 1.29016774904], |
---|
115 | |
---|
116 | [{'radius': 1.0, |
---|
117 | 'mass_dim': 1.3, |
---|
118 | 'cutoff_length': 1.0, |
---|
119 | 'background': 0.8, |
---|
120 | }, 0.001, 1.69747015932], |
---|
121 | |
---|
122 | [{'radius': 1.0, |
---|
123 | 'mass_dim': 2.3, |
---|
124 | 'cutoff_length': 1.0, |
---|
125 | 'scale': 10.0, |
---|
126 | }, 0.051, 11.6227966145], |
---|
127 | ] |
---|