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


Ignore:
Files:
8 added
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • doc/ref/index.rst

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

    r2e49f9e r462a115  
    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", 
    216219    "1e-6/Ang^2": "|1e-6Ang^-2|", 
    217220    "degrees": "degree", 
  • sasmodels/models/be_polyelectrolyte.py

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

    rb0c4271 r43fe34b  
    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_o = 2\pi / d_o$. 
     19Here the peak position is related to the d-spacing as $q_0 = 2\pi / d_0$. 
    2020 
    2121$A$ is the Porod law scale factor, $n$ the Porod exponent, $C$ is the 
  • sasmodels/models/core_shell_bicelle.py

    radc753d r416f5c7  
    4242    I(Q,\alpha) = \frac{\text{scale}}{V} \cdot 
    4343        F(Q,\alpha)^2 + \text{background} 
     44 
    4445where 
    4546 
    4647.. math:: 
    4748 
    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} 
     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} 
    5354    \bigg] 
    5455    \end{align}  
     
    130131#             ["name", "units", default, [lower, upper], "type", "description"], 
    131132parameters = [ 
    132     ["radius",         "Ang",       20, [0, inf],    "volume",      "Cylinder core radius"], 
     133    ["radius",         "Ang",       80, [0, inf],    "volume",      "Cylinder core radius"], 
    133134    ["thick_rim",  "Ang",       10, [0, inf],    "volume",      "Rim shell thickness"], 
    134135    ["thick_face", "Ang",       10, [0, inf],    "volume",      "Cylinder face thickness"], 
    135     ["length",         "Ang",      400, [0, inf],    "volume",      "Cylinder length"], 
     136    ["length",         "Ang",      50, [0, inf],    "volume",      "Cylinder length"], 
    136137    ["sld_core",       "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder core scattering length density"], 
    137138    ["sld_face",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder face scattering length density"], 
  • sasmodels/models/core_shell_ellipsoid.py

    rb99734a r416f5c7  
    1111.. figure:: img/core_shell_ellipsoid_geometry.png 
    1212 
    13 The geometric parameters of this model are 
    14  
    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  
    24 In 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) 
     13The geometric parameters of this model are shown in the diagram above, which 
     14shows (a) a cut through at the circular equator and (b) a cross section through 
     15the poles, of a prolate ellipsoid. 
     16 
    3317When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate. 
    3418*X_core = 1* is a spherical core. 
    3519 
    3620For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness 
    37 pro-rata with the radius *XpolarShell = X_core*. 
     21pro-rata with the radius set or constrain *XpolarShell = X_core*. 
    3822 
    3923When including an $S(q)$, the radius in $S(q)$ is calculated to be that of 
     
    4125ellipsoid. This may have some undesirable effects if the aspect ratio of the 
    4226ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$ 
    43 - which assumes spheres - will not in any case be valid. 
     27- which assumes spheres - will not in any case be valid.  Generating a  
     28custom product model will enable separate effective volume fraction and effective  
     29radius in the $S(q)$. 
    4430 
    4531If SAS data are in absolute units, and the SLDs are correct, then scale should 
     
    4834or contain some other units conversion factor (for example, if you have SAXS data). 
    4935 
     36The calculation of intensity follows that for the solid ellipsoid, but with separate 
     37terms 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 
     43where 
     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 
     51where 
     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 
     59and 
     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 
     69rotational axis of the ellipsoid, $R_e$ is the equatorial radius perpendicular 
     70to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the 
     71scattering length density difference, either $(sld\_core - sld\_shell)$ or $(sld\_shell - sld\_solvent)$. 
     72 
     73For 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 
    5080References 
    5181---------- 
    52  
    53 R K Heenan, 2015, reparametrised the core_shell_ellipsoid model 
     82see for example: 
     83Kotlarchyk, M.; Chen, S.-H. J. Chem. Phys., 1983, 79, 2461. 
     84Berr, S.  J. Phys. Chem., 1987, 91, 4760. 
     85 
     86Authorship 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 
    5492 
    5593""" 
  • sasmodels/models/cylinder.py

    r551398c r416f5c7  
    1414.. math:: 
    1515 
    16     P(q,\alpha) = \frac{\text{scale}}{V} F^2(q) + \text{background} 
     16    P(q,\alpha) = \frac{\text{scale}}{V} F^2(q,\alpha) + \text{background} 
    1717 
    1818where 
     
    2020.. math:: 
    2121 
    22     F(q) = 2 (\Delta \rho) V 
     22    F(q,\alpha) = 2 (\Delta \rho) V 
    2323           \frac{\sin \left(\tfrac12 qL\cos\alpha \right)} 
    2424                {\tfrac12 qL \cos \alpha} 
     
    3131first order Bessel function. 
    3232 
     33For 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 
    3340To provide easy access to the orientation of the cylinder, we define the 
    3441axis of the cylinder using two angles $\theta$ and $\phi$. Those angles 
    35 are defined in :numref:`cylinder-angle-definition`. 
     42are defined in :numref:`cylinder-angle-definition` . 
    3643 
    3744.. _cylinder-angle-definition: 
  • sasmodels/models/ellipsoid.py

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

    ra807206 r416f5c7  
    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

    ra807206 rbba9361  
    1111 
    1212The 1D scattering intensity for this model is calculated according to 
    13 the equations given by Pedersen (Pedersen, 2000). 
     13the equations given by Pedersen (Pedersen, 2000), summarised briefly here. 
     14 
     15The micelle core is imagined as $N\_aggreg$ polymer heads, each of volume $v\_core$, 
     16which then defines a micelle core of $radius\_core$, which is a separate parameter 
     17even though it could be directly determined. 
     18The Gaussian random coil tails, of gyration radius $rg$, are imagined uniformly  
     19distributed around the spherical core, centred at a distance $radius\_core + d\_penetration.rg$ 
     20from the micelle centre, where $d\_penetration$ is of order unity. 
     21A volume $v\_corona$ is defined for each coil. 
     22The model in detail seems to separately parametrise the terms for the shape of I(Q) and the 
     23relative intensity of each term, so use with caution and check parameters for consistency. 
     24The spherical core is monodisperse, so it's intensity and the cross terms may have sharp 
     25oscillations (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 
     34where $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 
     39whilst 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 
     47The sphere to coil ( core to corona) and coil to coil (corona to corona) cross terms are 
     48approximated 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} 
    1457 
    1558Validation 
    1659---------- 
    1760 
    18 This model has not yet been validated. Feb2015 
     61$P(q)$ above is multiplied by $ndensity$, and a units conversion of 10^{-13}, so $scale$ 
     62is likely 1.0 if the scattering data is in absolute units. This model has not yet been  
     63independently validated. 
    1964 
    2065 
     
    3176title = "Polymer micelle model" 
    3277description = """ 
    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. 
     78This model provides the form factor, $P(q)$, for a micelle with a spherical 
     79core and Gaussian polymer chains attached to the surface, thus may be applied 
     80to block copolymer micelles. To work well the Gaussian chains must be much 
     81smaller than the core, which is often not the case.  Please study the 
     82reference to Pedersen and full documentation carefully.  
    3583    """ 
     84 
     85 
    3686category = "shape:sphere" 
    3787 
  • sasmodels/models/triaxial_ellipsoid.py

    ra807206 r416f5c7  
    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 
     58class 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) 
    5766 
    5867class Pinhole1D(Resolution): 
     
    306315            weights[i, :] = (in_x + abs_x) * np.diff(q_edges) / (2*h) 
    307316        else: 
    308             for k in range(-n_height, h_height+1): 
     317            for k in range(-n_height, n_height+1): 
    309318                weights[i, :] += _q_perp_weights(q_edges, qi+k*h/n_height, w) 
    310319            weights[i, :] /= 2*n_height + 1 
Note: See TracChangeset for help on using the changeset viewer.