Changes in / [0ae0f9a:0444c02] in sasmodels
- Files:
-
- 2 added
- 8 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/ref/index.rst
rc34a31f r886fa25 9 9 intro.rst 10 10 refs.rst 11 gpu /gpu_computations.rst11 gpu_computations.rst 12 12 magnetism/magnetism.rst 13 13 sesans/sans_to_sesans.rst 14 sesans/sesans_fitting.rst15 -
sasmodels/generate.py
r462a115 r2e49f9e 214 214 "1/Ang": "|Ang^-1|", 215 215 "1/Ang^2": "|Ang^-2|", 216 "Ang^3": "|Ang^3|",217 "1e15/cm^3": "|1e15cm^3|",218 "Ang^3/mol": "|Ang^3|/mol",219 216 "1e-6/Ang^2": "|1e-6Ang^-2|", 220 217 "degrees": "degree", -
sasmodels/models/be_polyelectrolyte.py
r5df888c rb0c4271 3 3 ---------- 4 4 This 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 5 the RPA expression derived by Borue and Erukhimovich\ [#Borue]_. The scattering intensity 6 $I(q)$ is calculated as 9 7 10 8 .. math:: 11 9 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} 13 11 \frac{1}{1+r_{0}^2(q^2+k^2)(q^2-12hC_a/b^2)} + background 14 12 15 k^2 = 4\pi L _b(2C_s + \alpha C_a)13 k^2 = 4\pi L(2C_s + \alpha C_a) 16 14 17 15 r_{0}^2 = \frac{1}{\alpha \sqrt{C_a} \left( b/\sqrt{48\pi L_b}\right)} 18 16 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. 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. 47 22 48 23 For 2D data the scattering intensity is calculated in the same way as 1D, 49 where the $ \vecq$ vector is defined as24 where the $q$ vector is defined as 50 25 51 26 .. math:: 52 27 53 28 q = \sqrt{q_x^2 + q_y^2} 29 30 31 NB: $1 barn = 10^{-24} cm^2$ 54 32 55 33 References … … 91 69 ["contrast_factor", "barns", 10.0, [-inf, inf], "", "Contrast factor of the polymer"], 92 70 ["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"], 94 72 ["monomer_length", "Ang", 10.0, [0, inf], "", "Monomer length"], 95 73 ["salt_concentration", "mol/L", 0.0, [-inf, inf], "", "Concentration of monovalent salt"], -
sasmodels/models/broad_peak.py
r43fe34b rb0c4271 17 17 .. math:: I(q) = \frac{A}{q^n} + \frac{C}{1 + (|q - q_0|\xi)^m} + B 18 18 19 Here the peak position is related to the d-spacing as $q_ 0 = 2\pi / d_0$.19 Here the peak position is related to the d-spacing as $q_o = 2\pi / d_o$. 20 20 21 21 $A$ is the Porod law scale factor, $n$ the Porod exponent, $C$ is the -
sasmodels/models/core_shell_bicelle.py
r416f5c7 radc753d 42 42 I(Q,\alpha) = \frac{\text{scale}}{V} \cdot 43 43 F(Q,\alpha)^2 + \text{background} 44 45 44 where 46 45 47 46 .. math:: 48 47 49 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} 54 53 \bigg] 55 54 \end{align} … … 131 130 # ["name", "units", default, [lower, upper], "type", "description"], 132 131 parameters = [ 133 ["radius", "Ang", 80, [0, inf], "volume", "Cylinder core radius"],132 ["radius", "Ang", 20, [0, inf], "volume", "Cylinder core radius"], 134 133 ["thick_rim", "Ang", 10, [0, inf], "volume", "Rim shell thickness"], 135 134 ["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"], 137 136 ["sld_core", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Cylinder core scattering length density"], 138 137 ["sld_face", "1e-6/Ang^2", 4, [-inf, inf], "sld", "Cylinder face scattering length density"], -
sasmodels/models/core_shell_ellipsoid.py
r416f5c7 rb99734a 11 11 .. figure:: img/core_shell_ellipsoid_geometry.png 12 12 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. 13 The geometric parameters of this model are 16 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) 17 33 When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate. 18 34 *X_core = 1* is a spherical core. 19 35 20 36 For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness 21 pro-rata with the radius set or constrain*XpolarShell = X_core*.37 pro-rata with the radius *XpolarShell = X_core*. 22 38 23 39 When including an $S(q)$, the radius in $S(q)$ is calculated to be that of … … 25 41 ellipsoid. This may have some undesirable effects if the aspect ratio of the 26 42 ellipsoid 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. 30 44 31 45 If SAS data are in absolute units, and the SLDs are correct, then scale should … … 34 48 or contain some other units conversion factor (for example, if you have SAXS data). 35 49 36 The calculation of intensity follows that for the solid ellipsoid, but with separate37 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 where44 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 where52 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 and60 61 .. math::62 63 r(R_e,R_p,\alpha) = \left[ R_e^2 \sin^2 \alpha64 + 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 the69 rotational axis of the ellipsoid, $R_e$ is the equatorial radius perpendicular70 to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the71 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 80 50 References 81 51 ---------- 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.85 52 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 53 R K Heenan, 2015, reparametrised the core_shell_ellipsoid model 92 54 93 55 """ -
sasmodels/models/cylinder.py
r416f5c7 r551398c 14 14 .. math:: 15 15 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} 17 17 18 18 where … … 20 20 .. math:: 21 21 22 F(q ,\alpha) = 2 (\Delta \rho) V22 F(q) = 2 (\Delta \rho) V 23 23 \frac{\sin \left(\tfrac12 qL\cos\alpha \right)} 24 24 {\tfrac12 qL \cos \alpha} … … 31 31 first order Bessel function. 32 32 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 40 33 To provide easy access to the orientation of the cylinder, we define the 41 34 axis of the cylinder using two angles $\theta$ and $\phi$. Those angles 42 are defined in :numref:`cylinder-angle-definition` 35 are defined in :numref:`cylinder-angle-definition`. 43 36 44 37 .. _cylinder-angle-definition: -
sasmodels/models/ellipsoid.py
r416f5c7 ra807206 35 35 to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the 36 36 scattering 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 44 37 45 38 To provide easy access to the orientation of the ellipsoid, we define -
sasmodels/models/parallelepiped.py
r416f5c7 ra807206 10 10 11 11 | This model calculates the scattering from a rectangular parallelepiped 12 | ( \:numref:`parallelepiped-image`\).12 | (:numref:`parallelepiped-image`). 13 13 | If you need to apply polydispersity, see also :ref:`rectangular-prism`. 14 14 -
sasmodels/models/polymer_micelle.py
rbba9361 ra807206 11 11 12 12 The 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} 13 the equations given by Pedersen (Pedersen, 2000). 57 14 58 15 Validation 59 16 ---------- 60 17 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. 18 This model has not yet been validated. Feb2015 64 19 65 20 … … 76 31 title = "Polymer micelle model" 77 32 description = """ 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. 83 35 """ 84 85 86 36 category = "shape:sphere" 87 37 -
sasmodels/models/triaxial_ellipsoid.py
r416f5c7 ra807206 36 36 we define the axis of the cylinder using the angles $\theta$, $\phi$ 37 37 and $\psi$. These angles are defined on 38 :numref:`triaxial-ellipsoid-angles` 38 :numref:`triaxial-ellipsoid-angles`. 39 39 The angle $\psi$ is the rotational angle around its own $c$ axis 40 40 against the $q$ plane. For example, $\psi = 0$ when the -
sasmodels/resolution.py
r0444c02 r0444c02 55 55 return theory 56 56 57 58 class SESANS1D(Resolution):59 60 def __init__(self, data, q_calc):61 self.data = data62 self.q_calc = q_calc63 64 def apply(self, theory):65 return sesans.transform(self.data, self.q_calc, theory, None, None)66 57 67 58 class Pinhole1D(Resolution): … … 315 306 weights[i, :] = (in_x + abs_x) * np.diff(q_edges) / (2*h) 316 307 else: 317 for k in range(-n_height, n_height+1):308 for k in range(-n_height, h_height+1): 318 309 weights[i, :] += _q_perp_weights(q_edges, qi+k*h/n_height, w) 319 310 weights[i, :] /= 2*n_height + 1
Note: See TracChangeset
for help on using the changeset viewer.