Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified sasmodels/models/hollow_cylinder.py

    raea2e2a ra807206  
    11r""" 
    22This model provides the form factor, $P(q)$, for a monodisperse hollow right 
    3 angle circular cylinder (rigid tube) where the form factor is normalized by the 
    4 volume of the tube (i.e. not by the external volume). 
     3angle circular cylinder (tube) where the form factor is normalized by the 
     4volume of the tube 
    55 
    66.. math:: 
     
    2121    P(q)           &= (\text{scale})V_\text{shell}\Delta\rho^2 
    2222            \int_0^{1}\Psi^2 
    23             \left[q_z, R_\text{outer}(1-x^2)^{1/2}, 
     23            \left[q_z, R_\text{shell}(1-x^2)^{1/2}, 
    2424                       R_\text{core}(1-x^2)^{1/2}\right] 
    2525            \left[\frac{\sin(qHx)}{qHx}\right]^2 dx \\ 
     
    2727            \left[ \Lambda(qy) - \gamma^2\Lambda(qz) \right] \\ 
    2828    \Lambda(a)     &= 2 J_1(a) / a \\ 
    29     \gamma         &= R_\text{core} / R_\text{outer} \\ 
    30     V_\text{shell} &= \pi \left(R_\text{outer}^2 - R_\text{core}^2 \right)L \\ 
     29    \gamma         &= R_\text{core} / R_\text{shell} \\ 
     30    V_\text{shell} &= \pi \left(R_\text{shell}^2 - R_\text{core}^2 \right)L \\ 
    3131    J_1(x)         &= (\sin(x)-x\cdot \cos(x)) / x^2 
    3232 
     
    3535 
    3636**NB**: The 2nd virial coefficient of the cylinder is calculated 
    37 based on the outer radius and full length, which give an the effective radius 
    38 for structure factor $S(q)$ when $P(q) \cdot S(q)$ is applied. 
     37based on the radius and 2 length values, and used as the effective radius 
     38for $S(q)$ when $P(q) \cdot S(q)$ is applied. 
    3939 
    40 In the parameters,the *radius* is $R_\text{core}$ while *thickness* is $R_\text{outer} - R_\text{core}$. 
     40In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` 
     41and the *radius* is $R_\text{shell}$ while *radius_core* is $R_\text{core}$. 
    4142 
    4243To provide easy access to the orientation of the core-shell cylinder, we define 
     
    4950L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 
    5051Neutron Scattering*, Plenum Press, New York, (1987) 
    51  
    52 Authorship and Verification 
    53 ---------------------------- 
    54  
    55 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    56 * **Last Modified by:** Richard Heenan **Date:** October 06, 2016  
    57    (reparametrised to use thickness, not outer radius) 
    58 * **Last Reviewed by:** Richard Heenan **Date:** October 06, 2016 
    59  
    6052""" 
    6153 
     
    6658description = """ 
    6759P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude. 
    68 radius = the radius of core 
    69 thickness = the thickness of shell 
     60radius_core = the radius of core 
     61radius = the radius of shell 
    7062length = the total length of the cylinder 
    7163sld = SLD of the shell 
     
    7769#   ["name", "units", default, [lower, upper], "type","description"], 
    7870parameters = [ 
    79     ["radius",      "Ang",     20.0, [0, inf],    "volume",      "Cylinder core radius"], 
    80     ["thickness",   "Ang",     10.0, [0, inf],    "volume",      "Cylinder wall thickness"], 
    81     ["length",      "Ang",    400.0, [0, inf],    "volume",      "Cylinder total length"], 
     71    ["radius",      "Ang",     30.0, [0, inf],    "volume",      "Cylinder radius"], 
     72    ["radius_core", "Ang",     20.0, [0, inf],    "volume",      "Hollow core radius"], 
     73    ["length",      "Ang",    400.0, [0, inf],    "volume",      "Cylinder length"], 
    8274    ["sld",         "1/Ang^2",  6.3, [-inf, inf], "sld",         "Cylinder sld"], 
    8375    ["sld_solvent", "1/Ang^2",  1,   [-inf, inf], "sld",         "Solvent sld"], 
     
    9082 
    9183# pylint: disable=W0613 
    92 def ER(radius, thickness, length): 
     84def ER(radius, radius_core, length): 
    9385    """ 
    94     :param radius:      Cylinder core radius 
    95     :param thickness:   Cylinder wall thickness 
     86    :param radius:      Cylinder radius 
     87    :param radius_core: Hollow core radius, UNUSED 
    9688    :param length:      Cylinder length 
    9789    :return:            Effective radius 
    9890    """ 
    99     router = radius + thickness 
    100     if router == 0 or length == 0: 
     91    if radius == 0 or length == 0: 
    10192        return 0.0 
    102     len1 = router 
     93    len1 = radius 
    10394    len2 = length/2.0 
    10495    term1 = len1*len1*2.0*len2/2.0 
     
    10899    return diam 
    109100 
    110 def VR(radius, thickness, length): 
     101def VR(radius, radius_core, length): 
    111102    """ 
    112103    :param radius:      Cylinder radius 
    113     :param thickness:   Cylinder wall thickness 
     104    :param radius_core: Hollow core radius 
    114105    :param length:      Cylinder length 
    115106    :return:            Volf ratio for P(q)*S(q) 
    116107    """ 
    117     router = radius + thickness 
    118     vol_core = pi*radius*radius*length 
    119     vol_total = pi*router*router*length 
     108    vol_core = pi*radius_core*radius_core*length 
     109    vol_total = pi*radius*radius*length 
    120110    vol_shell = vol_total - vol_core 
    121111    return vol_shell, vol_total 
    122112 
    123113# parameters for demo 
    124 demo = dict(scale=1.0, background=0.0, length=400.0, radius=20.0, 
    125             thickness=10, sld=6.3, sld_solvent=1, theta=90, phi=0, 
    126             thickness_pd=0.2, thickness_pd_n=9, 
     114demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, 
     115            radius_core=20.0, sld=6.3, sld_solvent=1, theta=90, phi=0, 
     116            radius_pd=.2, radius_pd_n=9, 
    127117            length_pd=.2, length_pd_n=10, 
    128             radius_pd=.2, radius_pd_n=9, 
     118            radius_core_pd=.2, radius_core_pd_n=9, 
    129119            theta_pd=10, theta_pd_n=5, 
    130120           ) 
     
    132122# Parameters for unit tests 
    133123tests = [ 
    134     [{}, 0.00005, 1764.926], 
     124    [{"radius": 30.0}, 0.00005, 1764.926], 
    135125    [{}, 'VR', 1.8], 
    136126    [{}, 0.001, 1756.76] 
Note: See TracChangeset for help on using the changeset viewer.