[5c1d341] | 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 | |
---|
[232bb12] | 30 | scale = scale\_factor \times NV^2(\rho_\text{particle} - \rho_\text{solvent})^2 |
---|
[5c1d341] | 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 |
---|
[232bb12] | 37 | dimension, $\zeta$ is the cut-off length, $\rho_\text{solvent}$ is the scattering |
---|
| 38 | length density of the solvent, and $\rho_\text{particle}$ is the scattering |
---|
| 39 | length density of particles. |
---|
[5c1d341] | 40 | |
---|
| 41 | .. note:: |
---|
| 42 | |
---|
| 43 | The mass fractal dimension ( $D_m$ ) is only |
---|
[232bb12] | 44 | valid if $1 < mass\_dim < 6$. It is also only valid over a limited |
---|
[5c1d341] | 45 | $q$ range (see the reference for details). |
---|
| 46 | |
---|
| 47 | |
---|
[95441ff] | 48 | References |
---|
| 49 | ---------- |
---|
[5c1d341] | 50 | |
---|
[168052c] | 51 | D Mildner and P Hall, *J. Phys. D: Appl. Phys.*, |
---|
| 52 | 19 (1986) 1535-1545 Equation(9) |
---|
[5c1d341] | 53 | |
---|
| 54 | |
---|
| 55 | """ |
---|
| 56 | |
---|
| 57 | from numpy import inf |
---|
| 58 | |
---|
| 59 | name = "mass_fractal" |
---|
| 60 | title = "Mass Fractal model" |
---|
| 61 | description = """ |
---|
| 62 | The scattering intensity I(x) = scale*P(x)*S(x) + background, where |
---|
| 63 | scale = scale_factor * V * delta^(2) |
---|
| 64 | p(x)= F(x*radius)^(2) |
---|
| 65 | F(x) = 3*[sin(x)-x cos(x)]/x**3 |
---|
| 66 | S(x) = [(gamma(Dm-1)*colength^(Dm-1)*[1+(x^2*colength^2)]^((1-Dm)/2) |
---|
| 67 | * sin[(Dm-1)*arctan(x*colength)])/x] |
---|
| 68 | where delta = sldParticle -sldSolv. |
---|
| 69 | radius = Particle radius |
---|
[a807206] | 70 | fractal_dim_mass = Mass fractal dimension |
---|
[5c1d341] | 71 | cutoff_length = Cut-off length |
---|
| 72 | background = background |
---|
| 73 | Ref.:Mildner, Hall,J Phys D Appl Phys(1986), 9, 1535-1545 |
---|
[a807206] | 74 | Note I: This model is valid for 1<fractal_dim_mass<6. |
---|
[5c1d341] | 75 | Note II: This model is not in absolute scale. |
---|
| 76 | """ |
---|
| 77 | category = "shape-independent" |
---|
| 78 | |
---|
[168052c] | 79 | # pylint: disable=bad-whitespace, line-too-long |
---|
[6d96b66] | 80 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 81 | parameters = [ |
---|
| 82 | ["radius", "Ang", 10.0, [0.0, inf], "", "Particle radius"], |
---|
| 83 | ["fractal_dim_mass", "", 1.9, [1.0, 6.0], "", "Mass fractal dimension"], |
---|
| 84 | ["cutoff_length", "Ang", 100.0, [0.0, inf], "", "Cut-off length"], |
---|
| 85 | ] |
---|
[168052c] | 86 | # pylint: enable=bad-whitespace, line-too-long |
---|
[5c1d341] | 87 | |
---|
[925ad6e] | 88 | source = ["lib/sas_3j1x_x.c", "lib/sas_gamma.c", "mass_fractal.c"] |
---|
[5c1d341] | 89 | |
---|
[404ebbd] | 90 | def random(): |
---|
| 91 | import numpy as np |
---|
| 92 | radius = 10**np.random.uniform(0.7, 4) |
---|
| 93 | cutoff_length = 10**np.random.uniform(0.7, 2)*radius |
---|
[4553dae] | 94 | # TODO: fractal dimension should range from 1 to 6 |
---|
[404ebbd] | 95 | fractal_dim_mass = 2*np.random.beta(3, 4) + 1 |
---|
| 96 | Vf = 10**np.random.uniform(-4, -1) |
---|
| 97 | pars = dict( |
---|
| 98 | #background=0, |
---|
| 99 | scale=1, #1e5*Vf/radius**(fractal_dim_mass), |
---|
| 100 | radius=radius, |
---|
| 101 | cutoff_length=cutoff_length, |
---|
| 102 | fractal_dim_mass=fractal_dim_mass, |
---|
| 103 | ) |
---|
| 104 | return pars |
---|
| 105 | |
---|
[5c1d341] | 106 | demo = dict(scale=1, background=0, |
---|
| 107 | radius=10.0, |
---|
[a807206] | 108 | fractal_dim_mass=1.9, |
---|
[87edabf] | 109 | cutoff_length=100.0) |
---|
[5c1d341] | 110 | |
---|
[07a6700] | 111 | tests = [ |
---|
[168052c] | 112 | |
---|
| 113 | # Accuracy tests based on content in test/utest_other_models.py |
---|
| 114 | [{'radius': 10.0, |
---|
[a807206] | 115 | 'fractal_dim_mass': 1.9, |
---|
[168052c] | 116 | 'cutoff_length': 100.0, |
---|
[6dd90c1] | 117 | }, 0.05, 279.59422], |
---|
[168052c] | 118 | |
---|
| 119 | # Additional tests with larger range of parameters |
---|
| 120 | [{'radius': 2.0, |
---|
[a807206] | 121 | 'fractal_dim_mass': 3.3, |
---|
[168052c] | 122 | 'cutoff_length': 1.0, |
---|
[6dd90c1] | 123 | }, 0.5, 1.29116774904], |
---|
[168052c] | 124 | |
---|
| 125 | [{'radius': 1.0, |
---|
[a807206] | 126 | 'fractal_dim_mass': 1.3, |
---|
[168052c] | 127 | 'cutoff_length': 1.0, |
---|
| 128 | 'background': 0.8, |
---|
| 129 | }, 0.001, 1.69747015932], |
---|
| 130 | |
---|
| 131 | [{'radius': 1.0, |
---|
[a807206] | 132 | 'fractal_dim_mass': 2.3, |
---|
[168052c] | 133 | 'cutoff_length': 1.0, |
---|
| 134 | 'scale': 10.0, |
---|
[6dd90c1] | 135 | }, 0.051, 11.6237966145], |
---|
[168052c] | 136 | ] |
---|