source: sasmodels/sasmodels/models/adsorbed_layer.py @ 52ec91e

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 52ec91e was 52ec91e, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

use consistent pattern for units names: g/cm3, mg/m2

  • Property mode set to 100644
File size: 4.6 KB
Line 
1#adsorbed_layer model
2#conversion of Core2ndMomentModel.py
3#converted by Steve King, Mar 2016
4
5r"""
6This model describes the scattering from a layer of surfactant or polymer
7adsorbed on large, smooth, notionally spherical particles under the conditions
8that (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
10particle radius is >> layer thickness (ie, the interface is locally flat),
11and (iv) scattering from excess unadsorbed adsorbate in the bulk medium is
12absent or has been corrected for.
13
14Unlike many other core-shell models, this model does not assume any form
15for 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
17homogeneous step-function). For comparison, if the thickness of a (traditional
18core-shell like) step function distribution is $t$, the second moment about
19the mean of the density distribution (ie, the distance of the centre-of-mass
20of the distribution from the interface), $\sigma = \sqrt{t^2/12}$.
21
22Definition
23----------
24
25.. math::
26
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}
33
34where *scale* is a scale factor, $\rho_\text{poly}$ is the sld of the
35polymer (or surfactant) layer, $\rho_\text{solv}$ is the sld of the
36solvent/medium and cores, $\phi_\text{core}$ is the volume fraction of
37the core particles, $\delta_\text{poly}$ is the bulk density of the
38polymer, $\Gamma$ is the adsorbed amount, and $\sigma$ is the second
39moment of the thickness distribution.
40
41Note that all parameters except $\sigma$ are correlated so fitting more
42than one of these parameters will generally fail. Also note that unlike
43other shape models, no volume normalization is applied to this model (the
44calculation is exact).
45
46References
47----------
48
49S King, P Griffiths, J Hone, and T Cosgrove,
50*SANS from Adsorbed Polymer Layers*, *Macromol. Symp.*, 190 (2002) 33-42.
51"""
52
53from numpy import inf, pi, exp, errstate
54
55name = "adsorbed_layer"
56title = "Scattering from an adsorbed layer on particles"
57
58description = """
59    Evaluates the scattering from large particles
60    with an adsorbed layer of surfactant or
61    polymer, independent of the form of the
62    density distribution.
63    """
64category = "shape:sphere"
65
66# pylint: disable=bad-whitespace, line-too-long
67#   ["name", "units", default, [lower, upper], "type", "description"],
68parameters = [
69    ["second_moment", "Ang", 23.0, [0.0, inf], "", "Second moment of polymer distribution"],
70    ["adsorbed_amount", "mg/m^2", 1.9, [0.0, inf], "", "Adsorbed amount of polymer"],
71    ["density_shell", "g/cm^3", 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: enable=bad-whitespace, line-too-long
78
79# NB: Scale and Background are implicit parameters on every model
80def Iq(q, second_moment, adsorbed_amount, density_shell, radius,
81       volfraction, sld_shell, sld_solvent):
82    # pylint: disable = missing-docstring
83    #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    with errstate(divide='ignore'):
90        aa = ((sld_shell - sld_solvent)/density_shell * adsorbed_amount) / q
91    bb = q * second_moment
92    #scale by 10^-2 for units conversion to cm^-1
93    inten = 6.0e-02 * pi * volfraction * aa**2 * exp(-bb**2) / radius
94    return inten
95Iq.vectorized = True  # Iq accepts an array of q values
96
97# unit test values taken from SasView 3.1.2
98tests = [
99    [{'scale': 1.0, 'second_moment': 23.0, 'adsorbed_amount': 1.9,
100      'density_shell': 0.7, 'radius': 500.0, 'volfraction': 0.14,
101      'sld_shell': 1.5, 'sld_solvent': 6.3, 'background': 0.0},
102     [0.0106939, 0.1], [73.741, 4.51684e-3]],
103]
104
105# 2016-03-16 SMK converted from sasview, checked vs SANDRA
106# 2016-03-18 RKH some edits & renaming
107# 2016-04-14 PAK reformatting
Note: See TracBrowser for help on using the repository browser.