[7d4b2ae] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
[07300ea] | 4 | Calculates the scattering from a fractal structure with a primary building |
---|
| 5 | block of core-shell spheres, as opposed to just homogeneous spheres in |
---|
| 6 | the fractal model. It is an extension of the well known Teixeira\ [#teixeira]_ |
---|
| 7 | fractal model replacing the $P(q)$ of a solid sphere with that of a core-shell |
---|
| 8 | sphere. This model could find use for aggregates of coated particles, or |
---|
| 9 | aggregates of vesicles for example. |
---|
[7d4b2ae] | 10 | |
---|
| 11 | .. math:: |
---|
| 12 | |
---|
[07300ea] | 13 | I(q) = P(q)S(q) + \text{background} |
---|
[7d4b2ae] | 14 | |
---|
[07300ea] | 15 | Where $P(q)$ is the core-shell form factor and $S(q)$ is the |
---|
| 16 | Teixeira\ [#teixeira]_ fractal structure factor both of which are given again |
---|
| 17 | below: |
---|
[7d4b2ae] | 18 | |
---|
| 19 | .. math:: |
---|
| 20 | |
---|
[07300ea] | 21 | P(q) &= \frac{\phi}{V_s}\left[3V_c(\rho_c-\rho_s) |
---|
[7d4b2ae] | 22 | \frac{\sin(qr_c)-qr_c\cos(qr_c)}{(qr_c)^3}+ |
---|
| 23 | 3V_s(\rho_s-\rho_{solv}) |
---|
[ca04add] | 24 | \frac{\sin(qr_s)-qr_s\cos(qr_s)}{(qr_s)^3}\right]^2 \\ |
---|
[efb7615] | 25 | S(q) &= 1 + \frac{D_f\ \Gamma\!(D_f-1)}{[1+1/(q\xi)^2]^{(D_f-1)/2}} |
---|
[07300ea] | 26 | \frac{\sin[(D_f-1)\tan^{-1}(q\xi)]}{(qr_s)^{D_f}} |
---|
[7d4b2ae] | 27 | |
---|
[07300ea] | 28 | where $\phi$ is the volume fraction of particles, $V_s$ is the volume of the |
---|
| 29 | whole particle, $V_c$ is the volume of the core, $\rho_c$, $\rho_s$, and |
---|
| 30 | $\rho_{solv}$ are the scattering length densities of the core, shell, and |
---|
| 31 | solvent respectively, $r_c$ and $r_s$ are the radius of the core and the radius |
---|
[efb7615] | 32 | of the whole particle respectively, $D_f$ is the fractal dimension, and $\xi$ the |
---|
[07300ea] | 33 | correlation length. |
---|
[efb7615] | 34 | |
---|
[07300ea] | 35 | Polydispersity of radius and thickness are also provided for. |
---|
[7d4b2ae] | 36 | |
---|
[07300ea] | 37 | This model does not allow for anisotropy and thus the 2D scattering intensity |
---|
| 38 | is calculated in the same way as 1D, where the $q$ vector is defined as |
---|
[7d4b2ae] | 39 | |
---|
| 40 | .. math:: |
---|
| 41 | |
---|
| 42 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 43 | |
---|
[07300ea] | 44 | Our model is derived from the form factor calculations implemented in IGOR |
---|
| 45 | macros by the NIST Center for Neutron Research\ [#Kline]_ |
---|
| 46 | |
---|
[aad336c] | 47 | References |
---|
| 48 | ---------- |
---|
[7d4b2ae] | 49 | |
---|
[07300ea] | 50 | .. [#teixeira] J Teixeira, *J. Appl. Cryst.*, 21 (1988) 781-785 |
---|
| 51 | .. [#Kline] S R Kline, *J Appl. Cryst.*, 39 (2006) 895 |
---|
| 52 | |
---|
| 53 | Authorship and Verification |
---|
| 54 | ---------------------------- |
---|
| 55 | |
---|
| 56 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
[ef07e95] | 57 | * **Last Modified by:** Paul Butler and Paul Kienzle **Date:** November 27, 2016 |
---|
| 58 | * **Last Reviewed by:** Paul Butler and Paul Kienzle **Date:** November 27, 2016 |
---|
[7d4b2ae] | 59 | """ |
---|
| 60 | |
---|
[2d81cfe] | 61 | import numpy as np |
---|
[b297ba9] | 62 | from numpy import inf |
---|
[7d4b2ae] | 63 | |
---|
| 64 | name = "fractal_core_shell" |
---|
[07300ea] | 65 | title = "Scattering from a fractal structure formed from core shell spheres" |
---|
| 66 | description = """\ |
---|
| 67 | Model for fractal aggregates of core-shell primary particles. It is based on |
---|
| 68 | the Teixeira model for the S(q) of a fractal * P(q) for a core-shell sphere |
---|
| 69 | |
---|
| 70 | radius = the radius of the core |
---|
| 71 | thickness = thickness of the shell |
---|
| 72 | thick_layer = thickness of a layer |
---|
| 73 | sld_core = the SLD of the core |
---|
| 74 | sld_shell = the SLD of the shell |
---|
| 75 | sld_solvent = the SLD of the solvent |
---|
| 76 | volfraction = volume fraction of core-shell particles |
---|
| 77 | fractal_dim = fractal dimension |
---|
| 78 | cor_length = correlation length of the fractal like aggretates |
---|
| 79 | """ |
---|
[7d4b2ae] | 80 | category = "shape-independent" |
---|
| 81 | |
---|
| 82 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 83 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 84 | parameters = [ |
---|
[6d96b66] | 85 | ["radius", "Ang", 60.0, [0.0, inf], "volume", "Sphere core radius"], |
---|
| 86 | ["thickness", "Ang", 10.0, [0.0, inf], "volume", "Sphere shell thickness"], |
---|
[42356c8] | 87 | ["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", "Sphere core scattering length density"], |
---|
| 88 | ["sld_shell", "1e-6/Ang^2", 2.0, [-inf, inf], "sld", "Sphere shell scattering length density"], |
---|
| 89 | ["sld_solvent", "1e-6/Ang^2", 3.0, [-inf, inf], "sld", "Solvent scattering length density"], |
---|
[eb3eb38] | 90 | ["volfraction", "", 0.05, [0.0, inf], "", "Volume fraction of building block spheres"], |
---|
[217590b] | 91 | ["fractal_dim", "", 2.0, [0.0, 6.0], "", "Fractal dimension"], |
---|
[6d96b66] | 92 | ["cor_length", "Ang", 100.0, [0.0, inf], "", "Correlation length of fractal-like aggregates"], |
---|
| 93 | ] |
---|
[7d4b2ae] | 94 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 95 | |
---|
[925ad6e] | 96 | source = ["lib/sas_3j1x_x.c", "lib/sas_gamma.c", "lib/core_shell.c", |
---|
[217590b] | 97 | "lib/fractal_sq.c", "fractal_core_shell.c"] |
---|
[7d4b2ae] | 98 | |
---|
[404ebbd] | 99 | def random(): |
---|
[b297ba9] | 100 | """Return a random parameter set for the model.""" |
---|
[8f04da4] | 101 | outer_radius = 10**np.random.uniform(0.7, 4) |
---|
| 102 | # Use a distribution with a preference for thin shell or thin core |
---|
| 103 | # Avoid core,shell radii < 1 |
---|
| 104 | thickness = np.random.beta(0.5, 0.5)*(outer_radius-2) + 1 |
---|
| 105 | radius = outer_radius - thickness |
---|
| 106 | cor_length = 10**np.random.uniform(0.7, 2)*outer_radius |
---|
[404ebbd] | 107 | volfraction = 10**np.random.uniform(-3, -1) |
---|
| 108 | fractal_dim = 2*np.random.beta(3, 4) + 1 |
---|
| 109 | pars = dict( |
---|
| 110 | #background=0, sld_block=1, sld_solvent=0, |
---|
| 111 | volfraction=volfraction, |
---|
| 112 | radius=radius, |
---|
| 113 | cor_length=cor_length, |
---|
| 114 | fractal_dim=fractal_dim, |
---|
| 115 | ) |
---|
| 116 | return pars |
---|
| 117 | |
---|
[7d4b2ae] | 118 | demo = dict(scale=0.05, |
---|
| 119 | background=0, |
---|
| 120 | radius=20, |
---|
| 121 | thickness=5, |
---|
[aad336c] | 122 | sld_core=3.5, |
---|
| 123 | sld_shell=1.0, |
---|
| 124 | sld_solvent=6.35, |
---|
[7d4b2ae] | 125 | volfraction=0.05, |
---|
[a807206] | 126 | fractal_dim=2.0, |
---|
[7d4b2ae] | 127 | cor_length=100.0) |
---|
| 128 | |
---|
[b297ba9] | 129 | # TODO: why is there an ER function here? |
---|
[7d4b2ae] | 130 | def ER(radius, thickness): |
---|
| 131 | """ |
---|
| 132 | Equivalent radius |
---|
| 133 | @param radius: core radius |
---|
| 134 | @param thickness: shell thickness |
---|
| 135 | """ |
---|
| 136 | return radius + thickness |
---|
| 137 | |
---|
[2cc8aa2] | 138 | #tests = [[{'radius': 20.0, 'thickness': 10.0}, 'ER', 30.0], |
---|
| 139 | tests = [ |
---|
[b297ba9] | 140 | # At some point the SasView 3.x test result was deemed incorrect. The |
---|
| 141 | # following tests were verified against NIST IGOR macros ver 7.850. |
---|
| 142 | # NOTE: NIST macros do only provide for a polydispers core (no option |
---|
| 143 | # for a poly shell or for a monodisperse core. The results seemed |
---|
| 144 | # extremely sensitive to the core PD, varying non monotonically all |
---|
| 145 | # the way to a PD of 1e-6. From 1e-6 to 1e-9 no changes in the |
---|
| 146 | # results were observed and the values below were taken using PD=1e-9. |
---|
| 147 | # Non-monotonically = I(0.001)=188 to 140 to 177 back to 160 etc. |
---|
| 148 | [{'radius': 20.0, |
---|
| 149 | 'thickness': 5.0, |
---|
| 150 | 'sld_core': 3.5, |
---|
| 151 | 'sld_shell': 1.0, |
---|
| 152 | 'sld_solvent': 6.35, |
---|
| 153 | 'volfraction': 0.05, |
---|
| 154 | 'background': 0.0}, |
---|
| 155 | [0.001, 0.00291, 0.0107944, 0.029923, 0.100726, 0.476304], |
---|
| 156 | [177.146, 165.151, 84.1596, 20.1466, 1.40906, 0.00622666] |
---|
| 157 | ] |
---|
| 158 | ] |
---|