Three-layer displaced core-shell ellipsoid - absolute scale version - ABS_core_shell_extra_inner_shell.py

    r"""
Three-layer displaced core-shell ellipsoid - absolute scale version.

**Description**

Identical geometry to ``core_shell_extra_inner_shell`` but the scattering
contrast of each layer is specified via explicit SLD values.  The particle
volume fraction sets the absolute intensity level.  Keep the SASView global
``scale = 1`` for true absolute units (cm\ :sup:`-1`).

**Layer Structure**

.. list-table::
   :header-rows: 1

   * - Layer
     - Radial extent
     - SLD
     - Contrast delta rho = SLD − sld_solvent
   * - Outer shell
     - R < r < R + d_shell
     - ``sld_outer_shell``
     - delta rho\ :sub:`out`
   * - Inner shell
     - R − d_in < r < R
     - ``sld_inner_shell``
     - delta rho\ :sub:`in`
   * - Core
     - r < R − d_in
     - ``sld_core``
     - delta rho\ :sub:`core`

where d_shell = |thickness_shell| + 2 |sigma_outer| and
d_in = |thickness_inner_shell|.

**Form Factor Decomposition (absolute)**

.. math::

    F(q,\theta) &= \Delta\rho_\text{out}\,V_\text{RO}\,\phi(q r_\text{RO})\,
                   e^{-\frac{1}{2}(q\sigma_\text{out})^2} \\
               &\quad +\Bigl[
                 (\Delta\rho_\text{in}-\Delta\rho_\text{out})\,V_R\,\phi(q r_R)
               + (\Delta\rho_\text{core}-\Delta\rho_\text{in})\,V_\text{RI}\,\phi(q r_\text{RI})
               \Bigr]\,e^{-\frac{1}{2}(q\sigma_\text{core})^2}
               \,\cos(q\delta\sin\theta)

**Absolute Intensity**

.. math::

    I(q) = 10^{-4}\,\frac{\varphi}{\langle V\rangle}
           \bigl[\langle F^2\rangle + \langle F\rangle^2(S(q)-1)\bigr]
           B(q) + I_\text{poly}(q)

The factor 10\ :sup:`-4` converts
(10\ :sup:`-6` Ang\ :sup:`-2`)\ :sup:`2`·Ang\ :sup:`3`·Ang\ :sup:`-3`
= 10\ :sup:`-12` Ang\ :sup:`-1` to cm\ :sup:`-1`.

**Parameter Definitions**

``scale``
    Leave at **1** for absolute scale.

``background`` (cm\ :sup:`-1`)
    Flat incoherent background.

``radius`` (*R*, Ang)
    Mean equatorial semi-axis of the inner/outer shell boundary.

``aspect_ratio`` (*eps* = c/a)
    Polar/equatorial semi-axis ratio; >1 prolate, <1 oblate, =1 sphere.

``volfraction`` (*Phi*)
    Particle volume fraction; sets the absolute scattering level
    n = Phi/<V>.

``sld_core`` (10\ :sup:`-6` Ang\ :sup:`-2`)
    SLD of the innermost core material.

``sld_inner_shell`` (10\ :sup:`-6` Ang\ :sup:`-2`)
    SLD of the inner shell material.

``sld_outer_shell`` (10\ :sup:`-6` Ang\ :sup:`-2`)
    SLD of the outer shell material.

``sld_solvent`` (10\ :sup:`-6` Ang\ :sup:`-2`)
    SLD of the solvent (D\ :sub:`2`\ O ~ 6.35, H\ :sub:`2`\ O ~ −0.56).

``thickness_shell`` (*d*, Ang)
    Equatorial outer-shell thickness; effective extent = d + 2 sigma_outer.

``thickness_inner_shell`` (*d_in*, Ang)
    Equatorial inner-shell thickness; core equatorial radius = R − d_in.

``volfraction_hs``, ``radius_hs``
    Hard-sphere volume fraction and interaction radius for Percus-Yevick
    S(q).  Set ``volfraction_hs`` = 0 to disable.

``sigma_rel``
    Relative Gaussian polydispersity sigma_R/R; 0 = monodisperse.

``power_law``, ``exponent_2``
    Low-*q* correction B(q) = 1 + A\ :sub:`10` * (0.001/q)\ :sup:`m`,
    m = |A\ :sub:`11`| + 2.  Set ``power_law`` = 0 to disable.

``sigma_outer`` (Ang)
    Debye–Waller roughness of the outer shell surface.

``sigma_core`` (Ang)
    Debye–Waller roughness shared by both inner shell surfaces.

``rg_polymer`` (Ang), ``scale_polymer`` (cm\ :sup:`-1`)
    Rg and absolute amplitude of the Debye polymer background.

``displacement`` (*delta*, Ang)
    Perpendicular displacement of the inner structure; 0 = concentric.

**References**

- Spinozzi et al., *Biophys. J.* (2002)
- Orthaber et al., *J. Appl. Cryst.* 33, 218–225 (2000)
"""

from numpy import inf

name  = "ABS_core_shell_extra_inner_shell"
title = "Three-Layer Displaced Core-Shell Ellipsoid — Absolute Scale"
category = "shape:ellipsoid"
description = """
    Absolute-scale scattering from a three-layer polydisperse ellipsoid:
    outer shell, inner shell, and core. SLD values for all layers and the
    solvent are given explicitly; the particle volume fraction sets the
    absolute intensity. Keep scale=1 for true absolute units (cm^-1).
"""

# "volume"-tagged: radius, aspect_ratio, thickness_shell only.
# These are the parameters passed to form_volume() and radius_effective().
parameters = [
    ["radius",               "Ang",    37.45,  [0,    inf], "volume",
     "Mean equatorial semi-axis of the inner/outer shell boundary"],
    ["aspect_ratio",         "",        1.326,  [0,    inf], "volume",
     "Polar/equatorial semi-axis ratio eps=c/a (>1 prolate, <1 oblate, =1 sphere)"],
    ["volfraction",          "",        0.01,   [0,   0.74], "",
     "Particle volume fraction phi; sets absolute intensity n = phi/<V>"],
    ["sld_core",             "1e-6/Ang^2",  1.5,  [-inf, inf], "",
     "SLD of the innermost core material"],
    ["sld_inner_shell",      "1e-6/Ang^2", -1.0,  [-inf, inf], "",
     "SLD of the inner shell material"],
    ["sld_outer_shell",      "1e-6/Ang^2",  2.0,  [-inf, inf], "",
     "SLD of the outer shell material"],
    ["sld_solvent",          "1e-6/Ang^2",  6.35, [-inf, inf], "",
     "SLD of the solvent (D2O~6.35, H2O~-0.56)"],
    ["thickness_shell",      "Ang",    15.37,  [0,    inf], "volume",
     "Equatorial outer-shell thickness d; effective extent = d + 2*sigma_outer"],
    ["thickness_inner_shell","Ang",     8.547, [0,    inf], "",
     "Equatorial inner-shell thickness d_in; core equatorial radius = R - d_in"],
    ["volfraction_hs",       "",        0.0,   [0,   0.74], "",
     "Hard-sphere volume fraction for Percus-Yevick S(q); 0 = no interactions"],
    ["radius_hs",            "Ang",   100.0,   [0,    inf], "",
     "Hard-sphere interaction radius; active only when volfraction_hs > 0"],
    ["sigma_rel",            "",        0.02,  [0,    inf], "",
     "Relative polydispersity sigma_R/R; 0 = monodisperse"],
    ["power_law",            "",        3.664, [-inf,  inf], "",
     "Amplitude A10 of low-q correction B(q)=1+A10*(0.001/q)^m; 0 = disabled"],
    ["exponent_2",           "",        0.40,  [-inf,  inf], "",
     "Exponent parameter A11; actual exponent m = |A11| + 2"],
    ["sigma_outer",          "Ang",     0.0,   [0,    inf], "",
     "Debye-Waller roughness of the outer shell surface; 0 = sharp"],
    ["rg_polymer",           "Ang",    13.0,   [0,    inf], "",
     "Radius of gyration of free polymer chains (Debye background)"],
    ["scale_polymer",        "1/cm",    4.348e-4,[-inf, inf], "",
     "Absolute zero-q intensity of Debye polymer contribution (cm^-1); 0 = disabled"],
    ["displacement",         "Ang",     0.0,   [-inf,  inf], "",
     "Perpendicular displacement of inner structure; 0 = concentric"],
    ["sigma_core",           "Ang",     0.0,   [0,    inf], "",
     "Debye-Waller roughness shared by both inner shell surfaces; 0 = sharp"],
]

source = ["lib/sas_3j1x_x.c", "ABS_core_shell_extra_inner_shell.c"]

effective_radius_type = [
    "outer equatorial radius",
    "core equatorial radius",
]


def form_volume(radius, aspect_ratio, thickness_shell):
    import numpy as np
    r_outer   = radius + thickness_shell
    eps_outer = (radius*aspect_ratio + thickness_shell) / r_outer
    return 4.0*np.pi/3.0 * r_outer**3 * eps_outer


def radius_effective(mode, radius, aspect_ratio, thickness_shell):
    if mode == 1:
        return radius + thickness_shell
    else:
        return radius


def random():
    import numpy as np
    radius               = 10**np.random.uniform(1, 3)
    aspect_ratio         = np.random.uniform(0.5, 2.0)
    thickness_shell      = np.random.uniform(0.05, 0.4)*radius
    thickness_inner_shell= np.random.uniform(0.05, 0.4)*radius
    volfraction          = 10**np.random.uniform(-3, -1)
    sld_core             = np.random.uniform(-1, 5)
    sld_inner_shell      = np.random.uniform(-2, 4)
    sld_outer_shell      = np.random.uniform(0, 5)
    sld_solvent          = np.random.uniform(5, 7)
    volfraction_hs       = np.random.uniform(0, 0.35)
    radius_hs            = np.random.uniform(0.8, 2.0)*radius
    sigma_rel            = 10**np.random.uniform(-2, -0.3)
    power_law            = np.random.uniform(0, 10)
    exponent_2           = np.random.uniform(0, 1)
    sigma_outer          = np.random.uniform(0, 2)
    sigma_core           = np.random.uniform(0, 2)
    rg_polymer           = 10**np.random.uniform(0, 2)
    scale_polymer        = 10**np.random.uniform(-5, -2)
    displacement         = np.random.uniform(0, 0.8*thickness_shell)
    return dict(
        radius=radius, aspect_ratio=aspect_ratio,
        volfraction=volfraction,
        sld_core=sld_core, sld_inner_shell=sld_inner_shell,
        sld_outer_shell=sld_outer_shell, sld_solvent=sld_solvent,
        thickness_shell=thickness_shell,
        thickness_inner_shell=thickness_inner_shell,
        volfraction_hs=volfraction_hs, radius_hs=radius_hs,
        sigma_rel=sigma_rel, power_law=power_law, exponent_2=exponent_2,
        sigma_outer=sigma_outer, rg_polymer=rg_polymer,
        scale_polymer=scale_polymer, displacement=displacement,
        sigma_core=sigma_core,
    )


# Reference values with scale=1, background=0.
# Defaults: radius=37.446, aspect_ratio=1.3256, volfraction=0.01,
#   sld_core=1.5, sld_inner_shell=-1.0, sld_outer_shell=2.0,
#   sld_solvent=6.35, thickness_shell=15.374, thickness_inner_shell=8.547,
#   volfraction_hs=0, radius_hs=100, sigma_rel=0.02, power_law=3.664,
#   exponent_2=0.40, sigma_outer=0, rg_polymer=13, scale_polymer=4.348e-4,
#   displacement=0, sigma_core=0.
_default = {
    'scale': 1.0, 'background': 0.0,
    'radius': 37.446, 'aspect_ratio': 1.3256,
    'volfraction': 0.01,
    'sld_core': 1.5, 'sld_inner_shell': -1.0,
    'sld_outer_shell': 2.0, 'sld_solvent': 6.35,
    'thickness_shell': 15.374, 'thickness_inner_shell': 8.547,
    'volfraction_hs': 0.0, 'radius_hs': 100.0,
    'sigma_rel': 0.02, 'power_law': 3.664, 'exponent_2': 0.40,
    'sigma_outer': 0.0, 'rg_polymer': 13.0, 'scale_polymer': 4.348e-4,
    'displacement': 0.0, 'sigma_core': 0.0,
}

tests = [
    [_default, 0.01,  1.834873e+01],
    [_default, 0.05,  3.303952e+00],
    [_default, 0.10,  1.230987e-01],
    [_default, 0.20,  1.580762e-03],
    [dict(_default, volfraction_hs=0.2, radius_hs=50.0), 0.05, 3.331104e+00],
    [dict(_default, volfraction_hs=0.2, radius_hs=50.0), 0.10, 1.146907e-01],
]

Back to Model Download