Changeset 62cf915 in sasmodels
- Timestamp:
- Apr 14, 2016 8:32:09 AM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3a45c2c, e78edc4
- Parents:
- 81ec7c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/adsorbed_layer.py
rec45c4f r62cf915 3 3 #converted by Steve King, Mar 2016 4 4 5 r""" 6 This model describes the scattering from a layer of surfactant or polymer 7 adsorbed on large, smooth, notionally spherical particles under the conditions 8 that (i) the particles (cores) are contrast-matched to the dispersion medium, 9 (ii) $S(Q) \sim 1$ (ie, the particle volume fraction is dilute), (iii) the 10 particle radius is >> layer thickness (ie, the interface is locally flat), 11 and (iv) scattering from excess unadsorbed adsorbate in the bulk medium is 12 absent or has been corrected for. 5 13 6 7 r""" 8 This model describes the scattering from a layer of surfactant or polymer adsorbed on large, smooth, notionally spherical particles under the conditions that (i) the particles (cores) are contrast-matched to the dispersion medium, (ii) *S(Q)* ~ 1 (ie, the particle volume fraction is dilute), (iii) the particle radius is >> layer thickness (ie, the interface is locally flat), and (iv) scattering from excess unadsorbed adsorbate in the bulk medium is absent or has been corrected for. 9 10 Unlike many other core-shell models, this model does not assume any form for the density distribution of the adsorbed species normal to the interface (cf, a core-shell model normally assumes the density distribution to be a homogeneous step-function). For comparison, if the thickness of a (traditional core-shell like) step function distribution is *t*, the second moment about the mean of the density distribution (ie, the distance of the centre-of-mass of the distribution from the interface), |sigma| = sqrt((*t* :sup:`2` )/12). 14 Unlike many other core-shell models, this model does not assume any form 15 for the density distribution of the adsorbed species normal to the interface 16 (cf, a core-shell model normally assumes the density distribution to be a 17 homogeneous step-function). For comparison, if the thickness of a (traditional 18 core-shell like) step function distribution is $t$, the second moment about 19 the mean of the density distribution (ie, the distance of the centre-of-mass 20 of the distribution from the interface), $\sigma = \sqrt{t^2/12}$. 11 21 12 22 Definition … … 15 25 .. math:: 16 26 17 I(q) = \text{scale} \cdot(\rho_\text{poly}-\rho_\text{solvent})^2 \left[\frac{6\pi\phi_\text{core}}{Q^2}\frac{\Gamma^2}{\delta_\text{poly}^2R_\text{core}} \exp(-Q^2\sigma^2)\right] + \text{background} 27 I(q) = \text{scale} \cdot (\rho_\text{poly}-\rho_\text{solvent})^2 28 \left[ 29 \frac{6\pi\phi_\text{core}}{Q^2} 30 \frac{\Gamma^2}{\delta_\text{poly}^2R_\text{core}} 31 \exp(-Q^2\sigma^2) 32 \right] + \text{background} 18 33 19 where *scale* is a scale factor, |rho|\ :sub:`poly` is the sld of the polymer (or surfactant) layer, |rho|\ :sub:`solv` is the sld of the solvent/medium and cores, |phi|\ :sub:`core` is the volume fraction of the core particles, |delta|\ :sub:`poly` is the bulk density of the polymer, |biggamma| is the adsorbed amount, and |sigma| is the second moment of the thickness distribution. 34 where *scale* is a scale factor, $\rho_\text{poly}$ is the sld of the 35 polymer (or surfactant) layer, $\rho_\text{solv}$ is the sld of the 36 solvent/medium and cores, $\phi_\text{core}$ is the volume fraction of 37 the core particles, $\delta_\text{poly}$ is the bulk density of the 38 polymer, $\Gamma$ is the adsorbed amount, and $\sigma$ is the second 39 moment of the thickness distribution. 20 40 21 Note that all parameters except the |sigma| are correlated so fitting more than one of these parameters will generally fail. Also note that unlike other shape models, no volume normalization is applied to this model (the calculation is exact). 41 Note that all parameters except $\sigma$ are correlated so fitting more 42 than one of these parameters will generally fail. Also note that unlike 43 other shape models, no volume normalization is applied to this model (the 44 calculation is exact). 22 45 23 46 References 24 47 ---------- 25 48 26 S King, P Griffiths, J Hone, and T Cosgrove, *SANS from Adsorbed Polymer Layers*,27 * Macromol. Symp.*, 190 (2002) 33-42.49 S King, P Griffiths, J Hone, and T Cosgrove, 50 *SANS from Adsorbed Polymer Layers*, *Macromol. Symp.*, 190 (2002) 33-42. 28 51 """ 29 52 30 53 from numpy import inf, sqrt, pi, exp 31 54 32 name = 33 title = 55 name = "adsorbed_layer" 56 title = "Scattering from an adsorbed layer on particles" 34 57 35 description = 58 description = """ 36 59 Evaluates the scattering from large particles 37 60 with an adsorbed layer of surfactant or … … 39 62 density distribution. 40 63 """ 41 category = 64 category = "shape:sphere" 42 65 66 # pylint: disable=bad-whitespace, line-too-long 43 67 # ["name", "units", default, [lower, upper], "type", "description"], 44 parameters = [["second_moment", "Ang", 23.0, [0.0, inf], "", "Second moment of polymer distribution"], 45 ["adsorbed_amount", "mg/m2", 1.9, [0.0, inf], "", "Adsorbed amount of polymer"], 46 ["density_shell", "g/cm3", 0.7, [0.0, inf], "", "Bulk density of polymer in the shell"], 47 ["radius", "Ang", 500.0, [0.0, inf], "", "Core particle radius"], 48 ["volfraction", "None", 0.14, [0.0, inf], "", "Core particle volume fraction"], 49 ["sld_shell", "1e-6/Ang^2", 1.5, [-inf, inf], "sld", "Polymer shell SLD"], 50 ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent SLD"]] 68 parameters = [ 69 ["second_moment", "Ang", 23.0, [0.0, inf], "", "Second moment of polymer distribution"], 70 ["adsorbed_amount", "mg/m2", 1.9, [0.0, inf], "", "Adsorbed amount of polymer"], 71 ["density_shell", "g/cm3", 0.7, [0.0, inf], "", "Bulk density of polymer in the shell"], 72 ["radius", "Ang", 500.0, [0.0, inf], "", "Core particle radius"], 73 ["volfraction", "None", 0.14, [0.0, inf], "", "Core particle volume fraction"], 74 ["sld_shell", "1e-6/Ang^2", 1.5, [-inf, inf], "sld", "Polymer shell SLD"], 75 ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent SLD"], 76 ] 77 # pylint: disable=bad-whitespace, line-too-long 51 78 52 79 # NB: Scale and Background are implicit parameters on every model 53 def Iq(q, second_moment, adsorbed_amount, density_shell, radius, 54 80 def Iq(q, second_moment, adsorbed_amount, density_shell, radius, 81 volfraction, sld_shell, sld_solvent): 55 82 # pylint: disable = missing-docstring 56 #deltarhosqrd = (sld_shell - sld_solvent) * (sld_shell - sld_solvent)57 #numerator = 6.0 * pi * volfraction * (adsorbed_amount * adsorbed_amount)58 #denominator = (q * q) * (density_shell * density_shell) * radius59 #eterm = exp(-1.0 * (q * q) * (second_moment * second_moment))60 ##scale by 10^-2 for units conversion to cm^-161 #inten = 1.0e-02 * deltarhosqrd * ((numerator / denominator) * eterm)62 aa = (sld_shell - sld_solvent) * adsorbed_amount / q / density_shell83 #deltarhosqrd = (sld_shell - sld_solvent) * (sld_shell - sld_solvent) 84 #numerator = 6.0 * pi * volfraction * (adsorbed_amount * adsorbed_amount) 85 #denominator = (q * q) * (density_shell * density_shell) * radius 86 #eterm = exp(-1.0 * (q * q) * (second_moment * second_moment)) 87 ##scale by 10^-2 for units conversion to cm^-1 88 #inten = 1.0e-02 * deltarhosqrd * ((numerator / denominator) * eterm) 89 aa = (sld_shell - sld_solvent) * adsorbed_amount / q / density_shell 63 90 bb = q * second_moment 64 91 #scale by 10^-2 for units conversion to cm^-1 65 inten = 92 inten = 6.0e-02 * pi * volfraction * aa * aa * exp(-bb * bb) / radius 66 93 return inten 67 94 Iq.vectorized = True # Iq accepts an array of q values … … 70 97 # pylint: disable = missing-docstring 71 98 return Iq(sqrt(qx ** 2 + qy ** 2), *args) 72 Iqxy.vectorized = 99 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 73 100 74 demo = dict(scale = 1.0, 75 second_moment = 23.0, 76 adsorbed_amount = 1.9, 77 density_shell = 0.7, 78 radius = 500.0, 79 volfraction = 0.14, 80 sld_shell = 1.5, 81 sld_solvent = 6.3, 82 background = 0.0) 101 # unit test values taken from SasView 3.1.2 102 tests = [ 103 [{'scale': 1.0, 'second_moment': 23.0, 'adsorbed_amount': 1.9, 104 'density_shell': 0.7, 'radius': 500.0, 'volfraction': 0.14, 105 'sld_shell': 1.5, 'sld_solvent': 6.3, 'background': 0.0}, 106 [0.0106939, 0.1], [73.741, 4.51684e-3]], 107 ] 83 108 84 # these unit test values taken from SasView 3.1.2 85 tests = [ 86 [{'scale': 1.0, 'second_moment': 23.0, 'adsorbed_amount': 1.9, 87 'density_shell': 0.7, 'radius': 500.0, 'volfraction': 0.14, 88 'sld_shell': 1.5, 'sld_solvent': 6.3, 'background': 0.0}, 89 [0.0106939, 0.1], [73.741, 4.51684e-3]], 90 ] 91 # ADDED by: SMK ON: 16Mar2016 convert from sasview, check vs SANDRA, 18Mar2016 RKH some edits & renaming 109 # 2016-03-16 SMK converted from sasview, checked vs SANDRA 110 # 2016-03-18 RKH some edits & renaming 111 # 2016-04-14 PAK reformatting
Note: See TracChangeset
for help on using the changeset viewer.