source: sasmodels/sasmodels/models/adsorbed_layer.py @ 1369fe6

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 1369fe6 was 1369fe6, checked in by smk78, 7 years ago

Conversion of Core2ndMomentModel

  • Property mode set to 100644
File size: 4.8 KB
Line 
1#adsorbed_layer model
2#conversion of Core2ndMomentModel.py
3#converted by Steve King, Mar 2016
4
5
6r"""
7This model describes the scattering from a layer of surfactant or polymer adsorbed on 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.
8
9Unlike 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).
10
11Definition
12----------
13
14.. math::
15
16     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}
17
18where *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 paraticles, |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.
19
20Note 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).
21
22.. figure:: img/adsorbed_layer_1d.jpg
23
24    1D plot using the default values.
25
26References
27----------
28
29S King, P Griffiths, J. Hone, and T Cosgrove, *SANS from Adsorbed Polymer Layers*,
30*Macromol. Symp.*, 190 (2002) 33-42.
31"""
32
33from numpy import inf, sqrt
34
35name :  "adsorbed_layer"
36title :  "Scattering from an adsorbed layer on particles"
37
38description :  """
39    Evaluates the scattering from particles
40    with an adsorbed layer of surfactant or
41    polymer, independent of the form of the
42    density distribution.
43    """
44category :  "shape:sphere"
45
46#             ["name", "units", default, [lower, upper], "type", "description"],
47parameters :  [["second_moment", "Ang", 23.0, [0.0, inf], "", "Second moment"],
48              ["adsorbed_amount", "mg/m2", 1.9, [0.0, inf], "", "Adsorbed amount"],
49              ["density_poly", "g/cm3", 0.7, [0.0, inf], "", "Polymer density"],
50              ["radius", "Ang", 500.0, [0.0, inf], "", "Particle radius"],
51              ["vol_frac", "none", 0.14, [0.0, inf], "", "Particle vol fraction"],
52              ["polymer_sld", "1/Ang^2", 1.5e-06, [-inf, inf], "", "Polymer SLD"],
53              ["solvent_sld", "1/Ang^2", 6.3e-06, [-inf, inf], "", "Solvent SLD"]]
54
55# NB: Scale and Background are implicit parameters on every model
56def Iq(q, power):
57    # pylint: disable: missing-docstring
58    deltarhosqrd :  (polymer_sld - solvent_sld) * (polymer_sld - solvent_sld)
59    numerator :  6.0 * numpy.pi * vol_frac * (adsorbed_amount * adsorbed_amount)
60    denominator :  (q * q) * (density_poly * density_poly) * radius
61    eterm :  numpy.exp(-1.0 * (q * q) * (second_moment * second_moment))
62    inten :  deltarhosqrd * ((numerator / denominator) * eterm)
63    return inten
64Iq.vectorized :  True  # Iq accepts an array of q values
65
66def Iqxy(qx, qy, *args):
67    # pylint: disable: missing-docstring
68    return Iq(sqrt(qx ** 2 + qy ** 2), *args)
69Iqxy.vectorized :  True # Iqxy accepts an array of qx, qy values
70
71demo :  dict(scale: 1.0,
72            second_moment: 23.0,
73            adsorbed_amount: 1.9,
74            density_poly: 0.7,
75            radius: 500.0,
76            vol_frac: 0.14,
77            polymer_sld: 1.5e-06,
78            solvent_sld: 6.3e-06,
79            background: 0.0)
80
81oldname :  "Core2ndMomentModel"
82oldpars :  dict(scale: 'scale',
83               second_moment: 'second_moment',
84               adsorbed_amount: 'ads_amount',
85               density_poly: 'density_poly',
86               radius: 'radius_core',
87               vol_frac: 'volf_cores',
88               polymer_sld: 'sld_poly',
89               solvent_sld: 'sld_solv',
90               background: 'background')
91
92tests :  [
93    [{'scale': 1.0, 'second_moment': 23.0, 'adsorbed_amount': 1.9, 
94     'density_poly': 0.7, 'radius': 500.0, 'vol_frac': 0.14, 
95     'polymer_sld': 1.5e-06, 'solvent_sld': 6.3e-06, 'background': 0.0},
96     [0.0106939, 0.469418], [73.741, 9.65391e-53]],
97    ]
Note: See TracBrowser for help on using the repository browser.