Changes in / [0ae0f9a:0444c02] in sasmodels


Ignore:
Files:
2 added
8 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • doc/ref/index.rst

    rc34a31f r886fa25  
    99   intro.rst 
    1010   refs.rst 
    11    gpu/gpu_computations.rst 
     11   gpu_computations.rst 
    1212   magnetism/magnetism.rst 
    1313   sesans/sans_to_sesans.rst 
    14    sesans/sesans_fitting.rst 
    15     
  • sasmodels/generate.py

    r462a115 r2e49f9e  
    214214    "1/Ang": "|Ang^-1|", 
    215215    "1/Ang^2": "|Ang^-2|", 
    216     "Ang^3": "|Ang^3|", 
    217     "1e15/cm^3": "|1e15cm^3|", 
    218     "Ang^3/mol": "|Ang^3|/mol", 
    219216    "1e-6/Ang^2": "|1e-6Ang^-2|", 
    220217    "degrees": "degree", 
  • sasmodels/models/be_polyelectrolyte.py

    r5df888c rb0c4271  
    33---------- 
    44This model calculates the structure factor of a polyelectrolyte solution with 
    5 the RPA expression derived by Borue and Erukhimovich\ [#Borue]_.  Note however 
    6 that the fitting procedure here does not follow the notation in that reference 
    7 as 's' and 't' are **not** decoupled. Instead the scattering intensity $I(q)$ 
    8 is calculated as 
     5the RPA expression derived by Borue and Erukhimovich\ [#Borue]_.  The scattering intensity 
     6$I(q)$ is calculated as 
    97 
    108.. math:: 
    119 
    12     I(q) = K\frac{q^2+k^2}{4\pi L_b\alpha ^2} 
     10    I(q) = K\frac{q^2+k^2}{4\pi L\alpha ^2} 
    1311    \frac{1}{1+r_{0}^2(q^2+k^2)(q^2-12hC_a/b^2)} + background 
    1412 
    15     k^2 = 4\pi L_b(2C_s + \alpha C_a) 
     13    k^2 = 4\pi L(2C_s + \alpha C_a) 
    1614 
    1715    r_{0}^2 = \frac{1}{\alpha \sqrt{C_a} \left( b/\sqrt{48\pi L_b}\right)} 
    1816 
    19 where  
    20  
    21 $K$ is the contrast factor for the polymer which is defined differently than in 
    22 other models and is given in barns where $1 barn = 10^{-24} cm^2$.  $K$ is 
    23 defined as: 
    24  
    25 .. math:: 
    26  
    27     K = a^2 
    28  
    29     a = b_p - (v_p/v_s) b_s 
    30      
    31 where $b_p$ and $b_s$ are sum of the scattering lengths of the atoms 
    32 constituting the monomer of the polymer and the sum of the scattering lengths 
    33 of the atoms constituting the solvent molecules respectively, and $v_p$ and 
    34 $v_s$ are the partial molar volume of the polymer and the solvent respectively 
    35  
    36 $L_b$ is the Bjerrum length(|Ang|) - **Note:** This parameter needs to be 
    37 kept constant for a given solvent and temperature!  
    38  
    39 $h$ is the virial parameter (|Ang^3|/mol) - **Note:** See [#Borue]_ for the 
    40 correct interpretation of this parameter.  It incorporates second and third 
    41 virial coefficients and can be Negative. 
    42  
    43 $b$ is the monomer length(|Ang|), $C_s$ is the concentration of monovalent 
    44 salt(mol/L), $\alpha$ is the ionization degree (ionization degree : ratio of 
    45 charged monomers  to total number of monomers), $C_a$ is the polymer molar 
    46 concentration(mol/L), and $background$ is the incoherent background. 
     17where $K$ is the contrast factor for the polymer, $L_b$ is the Bjerrum length, 
     18$h$ is the virial parameter, $b$ is the monomer length, 
     19$C_s$ is the concentration of monovalent salt, $\alpha$ is the ionization 
     20degree, $C_a$ is the polymer molar concentration, and $background$ is the 
     21incoherent background. 
    4722 
    4823For 2D data the scattering intensity is calculated in the same way as 1D, 
    49 where the $\vec q$ vector is defined as 
     24where the $q$ vector is defined as 
    5025 
    5126.. math:: 
    5227 
    5328    q = \sqrt{q_x^2 + q_y^2} 
     29 
     30 
     31NB: $1 barn = 10^{-24} cm^2$ 
    5432 
    5533References 
     
    9169    ["contrast_factor",       "barns",   10.0,  [-inf, inf], "", "Contrast factor of the polymer"], 
    9270    ["bjerrum_length",        "Ang",      7.1,  [0, inf],    "", "Bjerrum length"], 
    93     ["virial_param",          "Ang^3/mol", 12.0,  [-inf, inf], "", "Virial parameter"], 
     71    ["virial_param",          "1/Ang^2", 12.0,  [-inf, inf], "", "Virial parameter"], 
    9472    ["monomer_length",        "Ang",     10.0,  [0, inf],    "", "Monomer length"], 
    9573    ["salt_concentration",    "mol/L",    0.0,  [-inf, inf], "", "Concentration of monovalent salt"], 
  • sasmodels/models/broad_peak.py

    r43fe34b rb0c4271  
    1717.. math:: I(q) = \frac{A}{q^n} + \frac{C}{1 + (|q - q_0|\xi)^m} + B 
    1818 
    19 Here the peak position is related to the d-spacing as $q_0 = 2\pi / d_0$. 
     19Here the peak position is related to the d-spacing as $q_o = 2\pi / d_o$. 
    2020 
    2121$A$ is the Porod law scale factor, $n$ the Porod exponent, $C$ is the 
  • sasmodels/models/core_shell_bicelle.py

    r416f5c7 radc753d  
    4242    I(Q,\alpha) = \frac{\text{scale}}{V} \cdot 
    4343        F(Q,\alpha)^2 + \text{background} 
    44  
    4544where 
    4645 
    4746.. math:: 
    4847 
    49         \begin{align}     
    50     F(Q,\alpha) = &\bigg[  
    51     (\rho_c - \rho_f) V_c \frac{J_1(QRsin \alpha)}{QRsin\alpha}\frac{2 \cdot sin(QLcos\alpha/2)}{QLcos\alpha} \\ 
    52     &+(\rho_f - \rho_r) V_{c+f} \frac{J_1(QRsin\alpha)}{QRsin\alpha}\frac{2 \cdot sin(Q(L/2+t_f)cos\alpha)}{Q(L+2t_f)cos\alpha} \\ 
    53     &+(\rho_r - \rho_s) V_t \frac{J_1(Q(R+t_r)sin\alpha)}{Q(R+t_r)sin\alpha}\frac{2 \cdot sin(Q(L/2+t_f)cos\alpha)}{Q(L+2t_f)cos\alpha} 
     48    \begin{align}     
     49    F(Q,\alpha) = &\frac{1}{V_t} \bigg[  
     50    (\rho_c - \rho_f) V_c \frac{J_1(QRsin \alpha)}{QRsin\alpha}\frac{2 \cdot QLcos\alpha}{QLcos\alpha} \\ 
     51    &+(\rho_f - \rho_r) V_{c+f} \frac{J_1(QRsin\alpha)}{QRsin\alpha}\frac{2 \cdot Q(L+t_f)cos\alpha}{Q(L+t_f)cos\alpha} \\ 
     52    &+(\rho_r - \rho_s) V_t \frac{J_1(Q(R+t_r)sin\alpha)}{Q(R+t_r)sin\alpha}\frac{2 \cdot Q(L+t_f)cos\alpha}{Q(L+t_f)cos\alpha} 
    5453    \bigg] 
    5554    \end{align}  
     
    131130#             ["name", "units", default, [lower, upper], "type", "description"], 
    132131parameters = [ 
    133     ["radius",         "Ang",       80, [0, inf],    "volume",      "Cylinder core radius"], 
     132    ["radius",         "Ang",       20, [0, inf],    "volume",      "Cylinder core radius"], 
    134133    ["thick_rim",  "Ang",       10, [0, inf],    "volume",      "Rim shell thickness"], 
    135134    ["thick_face", "Ang",       10, [0, inf],    "volume",      "Cylinder face thickness"], 
    136     ["length",         "Ang",      50, [0, inf],    "volume",      "Cylinder length"], 
     135    ["length",         "Ang",      400, [0, inf],    "volume",      "Cylinder length"], 
    137136    ["sld_core",       "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder core scattering length density"], 
    138137    ["sld_face",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder face scattering length density"], 
  • sasmodels/models/core_shell_ellipsoid.py

    r416f5c7 rb99734a  
    1111.. figure:: img/core_shell_ellipsoid_geometry.png 
    1212 
    13 The geometric parameters of this model are shown in the diagram above, which 
    14 shows (a) a cut through at the circular equator and (b) a cross section through 
    15 the poles, of a prolate ellipsoid. 
     13The geometric parameters of this model are 
    1614 
     15*radius_equat_core =* equatorial core radius *= Rminor_core* 
     16 
     17*X_core = polar_core / radius_equat_core = Rmajor_core / Rminor_core* 
     18 
     19*Thick_shell = equat_outer - radius_equat_core = Rminor_outer - Rminor_core* 
     20 
     21*XpolarShell = Tpolar_shell / Thick_shell = (Rmajor_outer - Rmajor_core)/ 
     22(Rminor_outer - Rminor_core)* 
     23 
     24In terms of the original radii 
     25 
     26*polar_core = radius_equat_core * X_core* 
     27 
     28*equat_shell = radius_equat_core + Thick_shell* 
     29 
     30*polar_shell = radius_equat_core * X_core + Thick_shell * XpolarShell* 
     31 
     32(where we note that "shell" perhaps confusingly, relates to the outer radius) 
    1733When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate. 
    1834*X_core = 1* is a spherical core. 
    1935 
    2036For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness 
    21 pro-rata with the radius set or constrain *XpolarShell = X_core*. 
     37pro-rata with the radius *XpolarShell = X_core*. 
    2238 
    2339When including an $S(q)$, the radius in $S(q)$ is calculated to be that of 
     
    2541ellipsoid. This may have some undesirable effects if the aspect ratio of the 
    2642ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$ 
    27 - which assumes spheres - will not in any case be valid.  Generating a  
    28 custom product model will enable separate effective volume fraction and effective  
    29 radius in the $S(q)$. 
     43- which assumes spheres - will not in any case be valid. 
    3044 
    3145If SAS data are in absolute units, and the SLDs are correct, then scale should 
     
    3448or contain some other units conversion factor (for example, if you have SAXS data). 
    3549 
    36 The calculation of intensity follows that for the solid ellipsoid, but with separate 
    37 terms for the core-shell and shell-solvent boundaries. 
    38  
    39 .. math:: 
    40  
    41     P(q,\alpha) = \frac{\text{scale}}{V} F^2(q,\alpha) + \text{background} 
    42  
    43 where 
    44  
    45 .. math:: 
    46     \begin{align}     
    47     F(q,\alpha) = &f(q,radius\_equat\_core,radius\_equat\_core.x\_core,\alpha) \\ 
    48     &+ f(q,radius\_equat\_core + thick\_shell,radius\_equat\_core.x\_core + thick\_shell.x\_polar\_shell,\alpha) 
    49     \end{align}  
    50  
    51 where 
    52   
    53 .. math:: 
    54  
    55     f(q,R_e,R_p,\alpha) = \frac{3 \Delta \rho V (\sin[qr(R_p,R_e,\alpha)] 
    56                 - \cos[qr(R_p,R_e,\alpha)])} 
    57                 {[qr(R_p,R_e,\alpha)]^3} 
    58  
    59 and 
    60  
    61 .. math:: 
    62  
    63     r(R_e,R_p,\alpha) = \left[ R_e^2 \sin^2 \alpha 
    64         + R_p^2 \cos^2 \alpha \right]^{1/2} 
    65  
    66  
    67 $\alpha$ is the angle between the axis of the ellipsoid and $\vec q$, 
    68 $V = (4/3)\pi R_pR_e^2$ is the volume of the ellipsoid , $R_p$ is the polar radius along the 
    69 rotational axis of the ellipsoid, $R_e$ is the equatorial radius perpendicular 
    70 to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the 
    71 scattering length density difference, either $(sld\_core - sld\_shell)$ or $(sld\_shell - sld\_solvent)$. 
    72  
    73 For randomly oriented particles: 
    74  
    75 .. math:: 
    76  
    77    F^2(q)=\int_{0}^{\pi/2}{F^2(q,\alpha)\sin(\alpha)d\alpha} 
    78  
    79  
    8050References 
    8151---------- 
    82 see for example: 
    83 Kotlarchyk, M.; Chen, S.-H. J. Chem. Phys., 1983, 79, 2461. 
    84 Berr, S.  J. Phys. Chem., 1987, 91, 4760. 
    8552 
    86 Authorship and Verification 
    87 ---------------------------- 
    88  
    89 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    90 * **Last Modified by:** Richard Heenan (reparametrised model) **Date:** 2015 
    91 * **Last Reviewed by:** Richard Heenan **Date:** October 6, 2016 
     53R K Heenan, 2015, reparametrised the core_shell_ellipsoid model 
    9254 
    9355""" 
  • sasmodels/models/cylinder.py

    r416f5c7 r551398c  
    1414.. math:: 
    1515 
    16     P(q,\alpha) = \frac{\text{scale}}{V} F^2(q,\alpha) + \text{background} 
     16    P(q,\alpha) = \frac{\text{scale}}{V} F^2(q) + \text{background} 
    1717 
    1818where 
     
    2020.. math:: 
    2121 
    22     F(q,\alpha) = 2 (\Delta \rho) V 
     22    F(q) = 2 (\Delta \rho) V 
    2323           \frac{\sin \left(\tfrac12 qL\cos\alpha \right)} 
    2424                {\tfrac12 qL \cos \alpha} 
     
    3131first order Bessel function. 
    3232 
    33 For randomly oriented particles: 
    34  
    35 .. math:: 
    36  
    37     F^2(q)=\int_{0}^{\pi/2}{F^2(q,\alpha)\sin(\alpha)d\alpha} 
    38  
    39  
    4033To provide easy access to the orientation of the cylinder, we define the 
    4134axis of the cylinder using two angles $\theta$ and $\phi$. Those angles 
    42 are defined in :numref:`cylinder-angle-definition` . 
     35are defined in :numref:`cylinder-angle-definition`. 
    4336 
    4437.. _cylinder-angle-definition: 
  • sasmodels/models/ellipsoid.py

    r416f5c7 ra807206  
    3535to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the 
    3636scattering length density difference between the scatterer and the solvent. 
    37  
    38 For randomly oriented particles: 
    39  
    40 .. math:: 
    41  
    42    F^2(q)=\int_{0}^{\pi/2}{F^2(q,\alpha)\sin(\alpha)d\alpha} 
    43  
    4437 
    4538To provide easy access to the orientation of the ellipsoid, we define 
  • sasmodels/models/parallelepiped.py

    r416f5c7 ra807206  
    1010 
    1111| This model calculates the scattering from a rectangular parallelepiped 
    12 | (\:numref:`parallelepiped-image`\). 
     12| (:numref:`parallelepiped-image`). 
    1313| If you need to apply polydispersity, see also :ref:`rectangular-prism`. 
    1414 
  • sasmodels/models/polymer_micelle.py

    rbba9361 ra807206  
    1111 
    1212The 1D scattering intensity for this model is calculated according to 
    13 the equations given by Pedersen (Pedersen, 2000), summarised briefly here. 
    14  
    15 The micelle core is imagined as $N\_aggreg$ polymer heads, each of volume $v\_core$, 
    16 which then defines a micelle core of $radius\_core$, which is a separate parameter 
    17 even though it could be directly determined. 
    18 The Gaussian random coil tails, of gyration radius $rg$, are imagined uniformly  
    19 distributed around the spherical core, centred at a distance $radius\_core + d\_penetration.rg$ 
    20 from the micelle centre, where $d\_penetration$ is of order unity. 
    21 A volume $v\_corona$ is defined for each coil. 
    22 The model in detail seems to separately parametrise the terms for the shape of I(Q) and the 
    23 relative intensity of each term, so use with caution and check parameters for consistency. 
    24 The spherical core is monodisperse, so it's intensity and the cross terms may have sharp 
    25 oscillations (use q resolution smearing if needs be to help remove them). 
    26  
    27 .. math:: 
    28     P(q) = N^2\beta^2_s\Phi(qR)^2+N\beta^2_cP_c(q)+2N^2\beta_s\beta_cS_{sc}s_c(q)+N(N-1)\beta_c^2S_{cc}(q) 
    29      
    30     \beta_s = v\_core(sld\_core - sld\_solvent) 
    31      
    32     \beta_c = v\_corona(sld\_corona - sld\_solvent) 
    33  
    34 where $N = n\_aggreg$, and for the spherical core of radius $R$  
    35  
    36 .. math::    
    37    \Phi(qR)= \frac{\sin(qr) - qr\cos(qr)}{(qr)^3} 
    38  
    39 whilst for the Gaussian coils 
    40  
    41 .. math:: 
    42  
    43    P_c(q) &= 2 [\exp(-Z) + Z - 1] / Z^2 
    44  
    45    Z &= (q R_g)^2 
    46  
    47 The sphere to coil ( core to corona) and coil to coil (corona to corona) cross terms are 
    48 approximated by: 
    49  
    50 .. math:: 
    51     
    52    S_{sc}(q)=\Phi(qR)\psi(Z)\frac{sin(q(R+d.R_g))}{q(R+d.R_g)} 
    53     
    54    S_{cc}(q)=\psi(Z)^2\left[\frac{sin(q(R+d.R_g))}{q(R+d.R_g)} \right ]^2 
    55     
    56    \psi(Z)=\frac{[1-exp^{-Z}]}{Z} 
     13the equations given by Pedersen (Pedersen, 2000). 
    5714 
    5815Validation 
    5916---------- 
    6017 
    61 $P(q)$ above is multiplied by $ndensity$, and a units conversion of 10^{-13}, so $scale$ 
    62 is likely 1.0 if the scattering data is in absolute units. This model has not yet been  
    63 independently validated. 
     18This model has not yet been validated. Feb2015 
    6419 
    6520 
     
    7631title = "Polymer micelle model" 
    7732description = """ 
    78 This model provides the form factor, $P(q)$, for a micelle with a spherical 
    79 core and Gaussian polymer chains attached to the surface, thus may be applied 
    80 to block copolymer micelles. To work well the Gaussian chains must be much 
    81 smaller than the core, which is often not the case.  Please study the 
    82 reference to Pedersen and full documentation carefully.  
     33    This model provides an approximate form factor, P(q), for a micelle with 
     34    a spherical core with Gaussian polymer chains attached to the surface. 
    8335    """ 
    84  
    85  
    8636category = "shape:sphere" 
    8737 
  • sasmodels/models/triaxial_ellipsoid.py

    r416f5c7 ra807206  
    3636we define the axis of the cylinder using the angles $\theta$, $\phi$ 
    3737and $\psi$. These angles are defined on 
    38 :numref:`triaxial-ellipsoid-angles` . 
     38:numref:`triaxial-ellipsoid-angles`. 
    3939The angle $\psi$ is the rotational angle around its own $c$ axis 
    4040against the $q$ plane. For example, $\psi = 0$ when the 
  • sasmodels/resolution.py

    r0444c02 r0444c02  
    5555        return theory 
    5656 
    57  
    58 class SESANS1D(Resolution): 
    59  
    60     def __init__(self, data, q_calc): 
    61         self.data = data 
    62         self.q_calc = q_calc 
    63  
    64     def apply(self, theory): 
    65         return sesans.transform(self.data, self.q_calc, theory, None, None) 
    6657 
    6758class Pinhole1D(Resolution): 
     
    315306            weights[i, :] = (in_x + abs_x) * np.diff(q_edges) / (2*h) 
    316307        else: 
    317             for k in range(-n_height, n_height+1): 
     308            for k in range(-n_height, h_height+1): 
    318309                weights[i, :] += _q_perp_weights(q_edges, qi+k*h/n_height, w) 
    319310            weights[i, :] /= 2*n_height + 1 
Note: See TracChangeset for help on using the changeset viewer.