source: sasmodels/sasmodels/models/adsorbed_layer.py @ ec45c4f

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

remove oldname/oldpars from new models

  • Property mode set to 100644
File size: 4.9 KB
Line 
1#adsorbed_layer model
2#conversion of Core2ndMomentModel.py
3#converted by Steve King, Mar 2016
4
5
6
7r"""
8This 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
10Unlike 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).
11
12Definition
13----------
14
15.. math::
16
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}
18
19where *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.
20
21Note 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).
22
23References
24----------
25
26S King, P Griffiths, J Hone, and T Cosgrove, *SANS from Adsorbed Polymer Layers*,
27*Macromol. Symp.*, 190 (2002) 33-42.
28"""
29
30from numpy import inf, sqrt, pi, exp
31
32name =  "adsorbed_layer"
33title =  "Scattering from an adsorbed layer on particles"
34
35description =  """
36    Evaluates the scattering from large particles
37    with an adsorbed layer of surfactant or
38    polymer, independent of the form of the
39    density distribution.
40    """
41category =  "shape:sphere"
42
43#             ["name", "units", default, [lower, upper], "type", "description"],
44parameters =  [["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"]]
51
52# NB: Scale and Background are implicit parameters on every model
53def Iq(q, second_moment, adsorbed_amount, density_shell, radius, 
54        volfraction, sld_shell, sld_solvent):
55    # 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) * radius
59#    eterm =  exp(-1.0 * (q * q) * (second_moment * second_moment))
60#    #scale by 10^-2 for units conversion to cm^-1
61#    inten =  1.0e-02 * deltarhosqrd * ((numerator / denominator) * eterm)
62    aa =  (sld_shell - sld_solvent) * adsorbed_amount / q / density_shell
63    bb = q * second_moment
64    #scale by 10^-2 for units conversion to cm^-1
65    inten =  6.0e-02 * pi * volfraction * aa * aa * exp(-bb * bb) / radius
66    return inten
67Iq.vectorized =  True  # Iq accepts an array of q values
68
69def Iqxy(qx, qy, *args):
70    # pylint: disable = missing-docstring
71    return Iq(sqrt(qx ** 2 + qy ** 2), *args)
72Iqxy.vectorized =  True # Iqxy accepts an array of qx, qy values
73
74demo =  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)
83
84# these unit test values taken from SasView 3.1.2
85tests =  [
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
Note: See TracBrowser for help on using the repository browser.