# Changeset db1d9d5 in sasmodels

Ignore:
Timestamp:
Mar 28, 2019 5:16:51 PM (22 months ago)
Branches:
master, ticket-1257-vesicle-product, ticket_1156, ticket_822_more_unit_tests
Children:
8795b6f
Parents:
a34b811
Message:

merge with master

Files:
19 edited

Unmodified
Removed
• ## doc/guide/plugin.rst

 re5cb3df and a check that the model runs. If you are not using sasmodels from SasView, skip this step. Recommended Testing ................... **NB: For now, this more detailed testing is only possible if you have a SasView build environment available!** If the model compiles and runs, you can next run the unit tests that
• ## doc/guide/resolution.rst

 r0db85af .. sm_help.rst .. This is a port of the original SasView html help file to ReSTructured text .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. .. resolution.rst .. This is a port of the original SasView html help file sm_help to ReSTructured .. text by S King, ISIS, during SasView CodeCamp-III in Feb 2015. resolution contribution into a model calculation/simulation (which by definition will be exact) to make it more representative of what has been measured experimentally - a process called *smearing*. Sasmodels does the latter. experimentally - a process called *smearing*. The Sasmodels component of SasView does the latter. Both smearing and desmearing rely on functions to describe the resolution for the instrument and stored with the data file.  If not, they will need to be set manually before fitting. .. note:: Problems may be encountered if the data set loaded by SasView is a concatenation of SANS data from several detector distances where, of course, the worst Q resolution is next to the beam stop at each detector distance. (This will also be noticeable in the residuals plot where there will be poor overlap). SasView sensibly orders all the input data points by increasing Q for nicer-looking plots, however, the dQ data can then vary considerably from point to point. If 'Use dQ data' smearing is selected then spikes may appear in the model fits, whereas if 'None' or 'Custom Pinhole Smear' are selected the fits look normal. In such instances, possible solutions are to simply remove the data with poor Q resolution from the shorter detector distances, or to fit the data from different detector distances simultaneously.
• ## sasmodels/conversion_table.py

 re65c3ba "TwoPowerLawModel", ], "unified_power_Rg": [ "unified_power_rg": [ "UnifiedPowerRg", dict(((field_new+str(index), field_old+str(index))
• ## sasmodels/convert.py

 rb297ba9 if pars['volfraction_a'] > 0.5: pars['volfraction_a'] = 1.0 - pars['volfraction_a'] elif name == 'unified_power_Rg': elif name == 'unified_power_rg': pars['level'] = int(pars['level'])
• ## sasmodels/models/core_shell_cylinder.py

 ra34b811 density of the solvent, and *background* is the background level.  The outer radius of the shell is given by $R+T$ and the total length of the outer shell is given by $L+2T$. $J1$ is the first order Bessel function. shell is given by $L+2T$. $J_1$ is the first order Bessel function. .. _core-shell-cylinder-geometry:
• ## sasmodels/models/core_shell_ellipsoid.py

 ra34b811 ---------- Parameters for this model are the core axial ratio X and a shell thickness, which are more often what we would like to determine and makes the model better behaved, particularly when polydispersity is applied than the four independent radii used in the original parameterization of this model. Parameters for this model are the core axial ratio $X_{core}$ and a shell thickness $t_{shell}$, which are more often what we would like to determine and make the model better behaved, particularly when polydispersity is applied, than the four independent radii used in the original parameterization of this model. the poles, of a prolate ellipsoid. When *X_core < 1* the core is oblate; when *X_core > 1* it is prolate. *X_core = 1* is a spherical core. For a fixed shell thickness *XpolarShell = 1*, to scale the shell thickness pro-rata with the radius set or constrain *XpolarShell = X_core*. When including an $S(q)$, the radius in $S(q)$ is calculated to be that of a sphere with the same 2nd virial coefficient of the outer surface of the ellipsoid. This may have some undesirable effects if the aspect ratio of the ellipsoid is large (ie, if $X << 1$ or $X >> 1$ ), when the $S(q)$ - which assumes spheres - will not in any case be valid.  Generating a custom product model will enable separate effective volume fraction and effective radius in the $S(q)$. When $X_{core}$ < 1 the core is oblate; when $X_{core}$ > 1 it is prolate. $X_{core}$ = 1 is a spherical core. For a fixed shell thickness $X_{polar shell}$ = 1, to scale $t_{shell}$ pro-rata with the radius set or constrain $X_{polar shell}$ = $X_{core}$. .. note:: When including an $S(q)$, the radius in $S(q)$ is calculated to be that of a sphere with the same 2nd virial coefficient of the outer surface of the ellipsoid. This may have some undesirable effects if the aspect ratio of the ellipsoid is large (ie, if $X << 1$ or $X >> 1$), when the $S(q)$ - which assumes spheres - will not in any case be valid.  Generating a custom product model will enable separate effective volume fraction and effective radius in the $S(q)$. If SAS data are in absolute units, and the SLDs are correct, then scale should where .. In following equation SK changed radius\_equat\_core to R_e .. math:: :nowrap: \begin{align*} F(q,\alpha) = &f(q,radius\_equat\_core,radius\_equat\_core.x\_core,\alpha) \\ &+ f(q,radius\_equat\_core + thick\_shell, radius\_equat\_core.x\_core + thick\_shell.x\_polar\_shell,\alpha) F(q,\alpha) = &f(q,R_e,R_e.x_{core},\alpha) \\ &+ f(q,R_e + t_{shell}, R_e.x_{core} + t_{shell}.x_{polar shell},\alpha) \end{align*} $V = (4/3)\pi R_pR_e^2$ is the volume of the ellipsoid , $R_p$ is the polar radius along the rotational axis of the ellipsoid, $R_e$ is the equatorial radius perpendicular to the rotational axis of the ellipsoid and $\Delta \rho$ (contrast) is the scattering length density difference, either $(sld\_core - sld\_shell)$ or $(sld\_shell - sld\_solvent)$. equatorial radius perpendicular to the rotational axis of the ellipsoid, $t_{shell}$ is the thickness of the shell at the equator, and $\Delta \rho$ (the contrast) is the scattering length density difference, either $(\rho_{core} - \rho_{shell})$ or $(\rho_{shell} - \rho_{solvent})$. For randomly oriented particles: * **Author:** NIST IGOR/DANSE **Date:** pre 2010 * **Last Modified by:** Richard Heenan (reparametrised model) **Date:** 2015 * **Last Reviewed by:** Richard Heenan **Date:** October 6, 2016 * **Last Reviewed by:** Steve King **Date:** March 27, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """
• ## sasmodels/models/flexible_cylinder.py

 r0507e09 The Kuhn length $(b = 2*l_p)$ is also used to describe the stiffness of a chain. The returned value is in units of $cm^{-1}$, on absolute scale. In the parameters, the sld and sld\_solvent represent the SLD of the cylinder and solvent respectively. Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research (Kline, 2006). From the reference: Our model uses the form factor calculations in reference [1] as implemented in a c-library provided by the NIST Center for Neutron Research (Kline, 2006). This states: 'Method 3 With Excluded Volume' is used. pseudocontinuous limit. See equations (13,26-27) in the original reference for the details. .. note:: There are several typos in the original reference that have been corrected by WRC [2]. Details of the corrections are in the reference below. Most notably - Equation (13): the term $(1 - w(QR))$ should swap position with $w(QR)$ - Equations (23) and (24) are incorrect; WRC has entered these into Mathematica and solved analytically. The results were then converted to code. - Equation (27) should be $q0 = max(a3/(Rg^2)^{1/2},3)$ instead of $max(a3*b(Rg^2)^{1/2},3)$ - The scattering function is negative for a range of parameter values and q-values that are experimentally accessible. A correction function has been added to give the proper behavior. **This is a model with complex behaviour depending on the ratio of** $L/b$ **and the reader is strongly encouraged to read reference [1] before use.** References flexible_cylinder.c _ wrc_cyl.c _ Authorship and Verification ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Author:** * **Last Modified by:** * **Last Reviewed by:** Steve King **Date:** March 26, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """ name = "flexible_cylinder" title = "Flexible cylinder where the form factor is normalized by the volume" \ title = "Flexible cylinder where the form factor is normalized by the volume " \ "of the cylinder." description = """Note : scale and contrast = (sld - sld_solvent) are both
• ## sasmodels/models/flexible_cylinder_elliptical.py

 r0507e09 The non-negligible diameter of the cylinder is included by accounting for excluded volume interactions within the walk of a single cylinder. **Inter-cylinder interactions are NOT provided for.** The form factor is normalized by the particle volume such that ----------- The function calculated in a similar way to that for the flexible_cylinder model from the reference given below using the author's "Method 3 With Excluded Volume". The function is calculated in a similar way to that for the :ref:flexible-cylinder model in reference [1] below using the author's "Method 3 With Excluded Volume". The model is a parameterization of simulations of a discrete representation of the worm-like chain model of Kratky and Porod applied in the pseudo-continuous There are several typos in the original reference that have been corrected by WRC. Details of the corrections are in the reference below. Most notably by WRC [2]. Details of the corrections are in the reference below. Most notably - Equation (13): the term $(1 - w(QR))$ should swap position with $w(QR)$ code. - Equation (27) should be $q0 = max(a3/sqrt(RgSquare),3)$ instead of $max(a3*b/sqrt(RgSquare),3)$ - Equation (27) should be $q0 = max(a3/(Rg^2)^{1/2},3)$ instead of $max(a3*b(Rg^2)^{1/2},3)$ - The scattering function is negative for a range of parameter values and The cross section of the cylinder is elliptical, with minor radius $a$ . The major radius is larger, so of course, **the axis ratio (parameter 5) must be The major radius is larger, so of course, **the axis_ratio must be greater than one.** Simple constraints should be applied during curve fitting to maintain this inequality. The returned value is in units of $cm^{-1}$, on absolute scale. In the parameters, the $sld$ and $sld\_solvent$ represent the SLD of the these parameters must be held fixed during model fitting. **No inter-cylinder interference effects are included in this calculation.** **This is a model with complex behaviour depending on the ratio of** $L/b$ **and the reader is strongly encouraged to read reference [1] before use.** References flexible_cylinder_elliptical.c _ wrc_cyl.c _ Authorship and Verification ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Author:** * **Last Modified by:** Richard Heenan **Date:** December, 2016 * **Last Reviewed by:** Steve King **Date:** March 26, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """
• ## sasmodels/models/guinier_porod.py

 r0507e09 such as rods or platelets, and shapes intermediate between spheres and rods or between rods and platelets, and overcomes some of the deficiencies of the (Beaucage) Unified_Power_Rg model (see Hammouda, 2010). deficiencies of the (Beaucage) :ref:unified-power-rg model (see Hammouda, 2010). Definition
• ## sasmodels/models/hardsphere.py

 r0507e09 # Note: model title and parameter table are inserted automatically r"""Calculate the interparticle structure factor for monodisperse r""" Calculates the interparticle structure factor for monodisperse spherical particles interacting through hard sphere (excluded volume) interactions. May be a reasonable approximation for other shapes of particles that freely rotate, and for moderately polydisperse systems. Though strictly the maths needs to be modified (no \Beta(Q) correction yet in sasview). interactions. This $S(q)$ may also be a reasonable approximation for other particle shapes that freely rotate (but see the note below), and for moderately polydisperse systems. .. note:: This routine is intended for uncharged particles! For charged particles try using the :ref:hayter-msa $S(q)$ instead. .. note:: Earlier versions of SasView did not incorporate the so-called $\beta(q)$ ("beta") correction [1] for polydispersity and non-sphericity. This is only available in SasView versions 4.2.2 and higher. radius_effective is the effective hard sphere radius. volfraction is the volume fraction occupied by the spheres. In sasview the effective radius may be calculated from the parameters In SasView the effective radius may be calculated from the parameters used in the form factor $P(q)$ that this $S(q)$ is combined with. For numerical stability the computation uses a Taylor series expansion at very small $qR$, there may be a very minor glitch at the transition point in some circumstances. at very small $qR$, but there may be a very minor glitch at the transition point in some circumstances. The S(Q) uses the Percus-Yevick closure where the interparticle potential is This S(q) uses the Percus-Yevick closure relationship [2] where the interparticle potential $U(r)$ is .. math:: \end{cases} where $r$ is the distance from the center of the sphere of a radius $R$. where $r$ is the distance from the center of a sphere of a radius $R$. For a 2D plot, the wave transfer is defined as ---------- .. [#] M Kotlarchyk & S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 .. [#] J K Percus, J Yevick, *J. Phys. Rev.*, 110, (1958) 1 ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Source added by :** Steve King **Date:** March 25, 2019 """ [Hard sphere structure factor, with Percus-Yevick closure] Interparticle S(Q) for random, non-interacting spheres. May be a reasonable approximation for other shapes of particles that freely rotate, and for moderately polydisperse systems. Though strictly the maths needs to be modified - which sasview does not do yet. May be a reasonable approximation for other particle shapes that freely rotate, and for moderately polydisperse systems . The "beta(q)" correction is available in versions 4.2.2 and higher. radius_effective is the hard sphere radius volfraction is the volume fraction occupied by the spheres.
• ## sasmodels/models/hayter_msa.py

 r0507e09 # Note: model title and parameter table are inserted automatically r""" This calculates the structure factor (the Fourier transform of the pair correlation function $g(r)$) for a system of charged, spheroidal objects in a dielectric medium. When combined with an appropriate form factor (such as sphere, core+shell, ellipsoid, etc), this allows for inclusion of the interparticle interference effects due to screened coulomb repulsion between charged particles. Calculates the interparticle structure factor for a system of charged, spheroidal, objects in a dielectric medium [1,2]. When combined with an appropriate form factor $P(q)$, this allows for inclusion of the interparticle interference effects due to screened Coulombic repulsion between the charged particles. **This routine only works for charged particles**. If the charge is set to zero the routine may self-destruct! For non-charged particles use a hard sphere potential. .. note:: This routine only works for charged particles! If the charge is set to zero the routine may self-destruct! For uncharged particles use the :ref:hardsphere $S(q)$ instead. The upper limit for the charge is limited to 200e to avoid numerical instabilities. .. note:: Earlier versions of SasView did not incorporate the so-called $\beta(q)$ ("beta") correction [3] for polydispersity and non-sphericity. This is only available in SasView versions 4.2.2 and higher. The salt concentration is used to compute the ionic strength of the solution which in turn is used to compute the Debye screening length. At present there is no provision for entering the ionic strength directly nor for use of any multivalent salts, though it should be possible to simulate the effect of this by increasing the salt concentration. The counterions are also assumed to be monovalent. which in turn is used to compute the Debye screening length. There is no provision for entering the ionic strength directly. **At present the counterions are assumed to be monovalent**, though it should be possible to simulate the effect of multivalent counterions by increasing the salt concentration. In sasview the effective radius may be calculated from the parameters Over the range 0 - 100 C the dielectric constant $\kappa$ of water may be approximated with a maximum deviation of 0.01 units by the empirical formula [4] .. math:: \kappa = 87.740 - 0.40008 T + 9.398x10^{-4} T^2 - 1.410x10^{-6} T^3 where $T$ is the temperature in celsius. In SasView the effective radius may be calculated from the parameters used in the form factor $P(q)$ that this $S(q)$ is combined with. .. [#] J B Hayter and J Penfold, *Molecular Physics*, 42 (1981) 109-118 .. [#] J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656 .. [#] M Kotlarchyk and S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 .. [#] C G Malmberg and A A Maryott, *J. Res. Nat. Bureau Standards*, 56 (1956) 2641 Source ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Author:** * **Last Modified by:** * **Last Reviewed by:** Steve King **Date:** March 28, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """ name = "hayter_msa" title = "Hayter-Penfold rescaled MSA, charged sphere, interparticle S(Q) structure factor" title = "Hayter-Penfold Rescaled Mean Spherical Approximation (RMSA) structure factor for charged spheres" description = """\ [Hayter-Penfold RMSA charged sphere interparticle S(Q) structure factor] Interparticle structure factor S(Q)for a charged hard spheres. Routine takes absolute value of charge, use HardSphere if charge goes to zero. In sasview the effective radius and volume fraction may be calculated from the parameters used in P(Q). Interparticle structure factor S(Q) for charged hard spheres. This routine only works for charged particles! For uncharged particles use the hardsphere S(q) instead. The "beta(q)" correction is available in versions 4.2.2 and higher. """ # pylint: disable=bad-whitespace, line-too-long #             [ "name", "units", default, [lower, upper], "type", "description" ], # # NOTE: SMK, 28Mar19 The upper limit for charge is set to 200 to avoid instabilities noted by PK in #       Ticket #1152. Also see the thread in Ticket 859. The docs above also note that charge=0 will #       cause problems, yet the default parameters allowed it! After discussions with PK I have #       changed it to (an arbitarily) small but non-zero value.  But I haven't changed the low limit #       in function random() below. # parameters = [ ["radius_effective", "Ang", 20.75,   [0, inf],    "volume", "effective radius of charged sphere"], ["volfraction",   "None",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], ["charge",        "e",   19.0,    [0, 200],    "", "charge on sphere (in electrons)"], ["charge",        "e",   19.0,    [0.000001, 200],    "", "charge on sphere (in electrons)"], ["temperature",   "K",  318.16,   [0, 450],    "", "temperature, in Kelvin, for Debye length calculation"], ["concentration_salt",      "M",    0.0,    [0, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], ["dielectconst",  "None",    71.08,   [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"] ["dielectconst",  "None",    71.08,   [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, kappa, default water, for Debye length"] ] # pylint: enable=bad-whitespace, line-too-long
• ## sasmodels/models/lib/wrc_cyl.c

 r18a2bfc /* Functions for WRC implementation of flexible cylinders Functions for WRC implementation of flexible cylinders. See W R Chen, P D Butler and L J Magid, Incorporating Intermicellar Interactions in the Fitting of SANS Data from Cationic Wormlike Micelles. Langmuir, 22(15) 2006 6539-6548 */
• ## sasmodels/models/multilayer_vesicle.py

 ra34b811 * **Converted to sasmodels by:** Piotr Rozyczko **Date:** Feb 24, 2016 * **Last Modified by:** Paul Kienzle **Date:** Feb 7, 2017 * **Last Reviewed by:** Paul Butler **Date:** March 12, 2017 * **Last Reviewed by:** Steve King **Date:** March 28, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """ name = "multilayer_vesicle" title = "P(Q) for a Multi-lamellar vesicle" title = "Calculate form factor for a multi-lamellar vesicle" description = """ multilayer_vesicle model parameters; ["sld_solvent",    "1e-6/Ang^2",  6.4, [-inf, inf], "sld", "solvent scattering length density"], ["sld",   "1e-6/Ang^2",  0.4, [-inf, inf], "sld", "Shell scattering length density"], ["n_shells",     "",            2.0, [1.0, inf],  "volume", "Number of shell plus solvent layer pairs"], ["n_shells",     "",            2.0, [1.0, inf],  "volume", "Number of shell plus solvent layer pairs (must be integer)"], ] # pylint: enable=bad-whitespace, line-too-long
• ## sasmodels/models/onion.py

 ra34b811 solvent. We currently provide up to 9 shells with this model. NB: *radius* represents the core radius $r_0$ and *thickness[k]* represents the thickness of the shell, $r_{k+1} - r_k$. .. note:: *radius* represents the core radius $r_0$ and *thickness[k]* represents the thickness of the shell, $r_{k+1} - r_k$. Definition j_1(x) = \frac{\sin(x)}{x^2} - \frac{\cos(x)}{x} and the volume is $V(r) = \frac{4\pi}{3}r^3$. The volume of the particle is determined by the radius of the outer shell, so $V_\text{particle} = V(r_N)$. Now lets consider the SLD of a shell defined by and the volume is $V(r) = \frac{4\pi}{3}r^3$. The volume of the particle is determined by the radius of the outer shell, so $V_\text{particle} = V(r_N)$. Now consider the SLD of a shell defined by .. math:: thickness of the $k^\text{th}$ shell in the equation above, respectively. For $A > 0$, .. figure:: img/onion_geometry.png Example of an onion model profile. **Exponential SLD profiles** ($A > 0$ or $A < 0$): .. math:: - 3CV(r_{\text{shell}-1}) \frac{j_1(\beta_\text{in})}{\beta_\text{in}} for where .. math:: B&=\frac{\rho_\text{out} - \rho_\text{in}}{e^A-1} & C &= \frac{\rho_\text{in}e^A - \rho_\text{out}}{e^A-1} \\ \alpha_\text{in} &= A\frac{r_{\text{shell}-1}}{\Delta t_\text{shell}} & \alpha_\text{out} &= A\frac{r_\text{shell}}{\Delta t_\text{shell}} \\ \beta_\text{in} &= qr_{\text{shell}-1} & \beta_\text{out} &= qr_\text{shell} \\ \end{align*} where $h$ is and .. math:: h(x,y) = \frac{x \sin(y) - y\cos(y)}{(x^2+y^2)y} h(x,y) = \frac{x \sin(y) - y\cos(y)}{(x^2+y^2)y} - \frac{(x^2-y^2)\sin(y) - 2xy\cos(y)}{(x^2+y^2)^2y} For $A \sim 0$, e.g., $A = -0.0001$, this function converges to that of the linear SLD profile with $\rho_\text{shell}(r) \approx A(r-r_{\text{shell}-1})/\Delta t_\text{shell})+B$, so this case is equivalent to **Linear SLD profile** ($A \sim 0$): For small $A$, say, $A = -0.0001$, the function converges to that of of a linear SLD profile with $\rho_\text{shell}(r) \approx A(r-r_{\text{shell}-1})/\Delta t_\text{shell})+B$, which is equivalent to .. math:: \end{align*} For $A = 0$, the exponential function has no dependence on the radius (so that **Constant SLD** ($A = 0$): When $A = 0$ the exponential function has no dependence on the radius (meaning $\rho_\text{out}$ is ignored in this case) and becomes flat. We set the constant to $\rho_\text{in}$ for convenience, and thus the form factor contributed by \frac{j_1(qr_\text{in})}{qr_\text{in}} .. figure:: img/onion_geometry.png Example of an onion model profile. The 2D scattering intensity is the same as $P(q)$ above, regardless of the orientation of the $q$ vector which is defined as * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Last Reviewed by:** Steve King **Date:** March 28, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """ description = """\ Form factor of mutishells normalized by the volume. Here each shell is Form factor of multishells normalized by the volume. Here each shell is described by an exponential function; II) For the exact point of A_shell == 0, f(r) = sld_in ,i.e., it crosses over flat function Note that the 'sld_out' becaomes NULL in this case. Note that the 'sld_out' becomes NULL in this case. background:background, # TODO: n is a volume parameter that is not polydisperse # NOTE: Joachim Wuttke has suggested an alternative parameterisation #       in Ticket #1107 # pylint: disable=bad-whitespace, line-too-long #   ["name", "units", default, [lower, upper], "type","description"], ["radius_core", "Ang", 200., [0, inf], "volume", "Radius of the core"], ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld", "Solvent scattering length density"], ["n_shells", "", 1, [0, 10], "volume", "number of shells"], ["n_shells", "", 1, [0, 10], "volume", "number of shells (must be integer)"], ["sld_in[n_shells]", "1e-6/Ang^2", 1.7, [-inf, inf], "sld", "scattering length density at the inner radius of shell k"], ["sld_out[n_shells]", "1e-6/Ang^2", 2.0, [-inf, inf], "sld", "scattering length density at the outer radius of shell k"],
• ## sasmodels/models/pearl_necklace.py

 ra34b811 .. math:: S_{ss}(q) &= sm_s^2\psi^2(q)[\frac{N}{1-sin(qA)/qA}-\frac{N}{2}- \frac{1-(sin(qA)/qA)^N}{(1-sin(qA)/qA)^2}\cdot\frac{sin(qA)}{qA}] \\ S_{ff}(q) &= sm_r^2[M\{2\Lambda(q)-(\frac{sin(ql/2)}{ql/2})\}+ S_{ss}(q) &= 2m_s^2\psi^2(q)\left[\frac{N}{1-sin(qA)/qA}-\frac{N}{2}- \frac{1-(sin(qA)/qA)^N}{(1-sin(qA)/qA)^2}\cdot\frac{sin(qA)}{qA}\right] \\ S_{ff}(q) &= m_r^2\left[M\left\{2\Lambda(q)-\left(\frac{sin(ql/2)}{ql/2}\right)\right\}+ \frac{2M\beta^2(q)}{1-sin(qA)/qA}-2\beta^2(q)\cdot \frac{1-(sin(qA)/qA)^M}{(1-sin(qA)/qA)^2}] \\ S_{fs}(q) &= m_r \beta (q) \cdot m_s \psi (q) \cdot 4[ \frac{1-(sin(qA)/qA)^M}{(1-sin(qA)/qA)^2}\right] \\ S_{fs}(q) &= m_r \beta (q) \cdot m_s \psi (q) \cdot 4\left[ \frac{N-1}{1-sin(qA)/qA}-\frac{1-(sin(qA)/qA)^{N-1}}{(1-sin(qA)/qA)^2} \cdot \frac{sin(qA)}{qA}] \\ \cdot \frac{sin(qA)}{qA}\right] \\ \psi(q) &= 3 \cdot \frac{sin(qR)-(qR)\cdot cos(qR)}{(qR)^3} \\ \Lambda(q) &= \frac{\int_0^{ql}\frac{sin(t)}{t}dt}{ql} \\ (volume of the *N* pearls/rods). *V* is the total volume of the necklace. .. note:: *num_pearls* must be an integer. The 2D scattering intensity is the same as $P(q)$ above, regardless of the orientation of the *q* vector. The returned value is scaled to units of |cm^-1| and the parameters of the pearl_necklace model are the following NB: *num_pearls* must be an integer. References .. [#] R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*, *Macromol. Symp.* 211 (2004) 25-42 2004 *Macromol. Symp.* 211 (2004) 25-42 2004 .. [#] L. Onsager, *Ann. New York Acad. Sci.*, 51 (1949) 627-659 * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Last Modified by:** Andrew Jackson **Date:** March 28, 2019 * **Last Reviewed by:** Steve King **Date:** March 28, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """
• ## sasmodels/models/rpa.py

 r0507e09 These case numbers are different from those in the NIST SANS package! The models are based on the papers by Akcasu *et al.* and by Hammouda assuming the polymer follows Gaussian statistics such The models are based on the papers by Akcasu *et al.* [1] and by Hammouda [2] assuming the polymer follows Gaussian statistics such that $R_g^2 = n b^2/6$ where $b$ is the statistical segment length and $n$ is the number of statistical segment lengths. A nice tutorial on how these are constructed and implemented can be found in chapters 28 and 39 of Boualem Hammouda's 'SANS Toolbox'. constructed and implemented can be found in chapters 28, 31 and 34, and Part H, of Hammouda's 'SANS Toolbox' [3]. In brief the macroscopic cross sections are derived from the general forms for homopolymer scattering and the multiblock cross-terms while the inter In brief, the macroscopic cross sections are derived from the general forms for homopolymer scattering and the multiblock cross-terms while the inter, polymer cross terms are described in the usual way by the $\chi$ parameter. * **Component D is assumed to be the "background" component (ie, all contrasts are calculated with respect to component D).** So the scattering contrast for a C/D blend = [SLD(component C) - SLD(component D)]\ :sup:2. for a C/D blend $\rho_{C/D} = [\rho_C - \rho_D]$\ :sup:2. * Depending on which case is being used, the number of fitting parameters can vary. * **Converted to sasmodels by:** Paul Kienzle **Date:** July 18, 2016 * **Last Modified by:** Paul Butler **Date:** March 12, 2017 * **Last Reviewed by:** Paul Butler **Date:** March 12, 2017 * **Last Reviewed by:** Steve King **Date:** March 27, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """
• ## sasmodels/models/squarewell.py

 r0507e09 # Note: model title and parameter table are inserted automatically r""" This calculates the interparticle structure factor for a square well fluid spherical particles. The mean spherical approximation (MSA) closure was used for this calculation, and is not the most appropriate closure for an attractive interparticle potential. This solution has been compared to Monte Carlo simulations for a square well fluid, showing this calculation to be limited in applicability to well depths $\epsilon < 1.5$ kT and volume fractions $\phi < 0.08$. Calculates the interparticle structure factor for a hard sphere fluid with a narrow, attractive, square well potential. **The Mean Spherical Approximation (MSA) closure relationship is used, but it is not the most appropriate closure for an attractive interparticle potential.** However, the solution has been compared to Monte Carlo simulations for a square well fluid and these show the MSA calculation to be limited to well depths $\epsilon < 1.5$ kT and volume fractions $\phi < 0.08$. Positive well depths correspond to an attractive potential well. Negative well depths correspond to a potential "shoulder", which may or may not be physically reasonable. The stickyhardsphere model may be a better choice in some circumstances. Computed values may behave badly at extremely small $qR$. physically reasonable. The :ref:stickyhardsphere model may be a better choice in some circumstances. Computed values may behave badly at extremely small $qR$. .. note:: Earlier versions of SasView did not incorporate the so-called $\beta(q)$ ("beta") correction [2] for polydispersity and non-sphericity. This is only available in SasView versions 4.2.2 and higher. The well width $(\lambda)$ is defined as multiples of the particle diameter The interaction potential is: .. image:: img/squarewell.png .. math:: \end{cases} where $r$ is the distance from the center of the sphere of a radius $R$. where $r$ is the distance from the center of a sphere of a radius $R$. In sasview the effective radius may be calculated from the parameters In SasView the effective radius may be calculated from the parameters used in the form factor $P(q)$ that this $S(q)$ is combined with. .. [#] R V Sharma, K C Sharma, *Physica*, 89A (1977) 213 .. [#] M Kotlarchyk and S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 Source ------ ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Author:** * **Last Modified by:** * **Last Reviewed by:** Steve King **Date:** March 27, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """ name = "squarewell" title = "Square well structure factor, with MSA closure" title = "Square well structure factor with Mean Spherical Approximation closure" description = """\ [Square well structure factor, with MSA closure] Interparticle structure factor S(Q)for a hard sphere fluid with a narrow attractive well. Fits are prone to deliver non-physical parameters, use with care and read the references in the full manual. In sasview the effective radius will be calculated from the parameters used in P(Q). Interparticle structure factor S(Q) for a hard sphere fluid with a narrow attractive well. Fits are prone to deliver non- physical parameters; use with care and read the references in the model documentation.The "beta(q)" correction is available in versions 4.2.2 and higher. """ category = "structure-factor"
• ## sasmodels/models/stickyhardsphere.py

 r0507e09 # Note: model title and parameter table are inserted automatically r""" This calculates the interparticle structure factor for a hard sphere fluid with a narrow attractive well. A perturbative solution of the Percus-Yevick closure is used. The strength of the attractive well is described in terms of "stickiness" as defined below. The perturb (perturbation parameter), $\epsilon$, should be held between 0.01 and 0.1. It is best to hold the perturbation parameter fixed and let the "stickiness" vary to adjust the interaction strength. The stickiness, $\tau$, is defined in the equation below and is a function of both the perturbation parameter and the interaction strength. $\tau$ and $\epsilon$ are defined in terms of the hard sphere diameter $(\sigma = 2 R)$, the width of the square well, $\Delta$ (same units as $R$\ ), and the depth of the well, $U_o$, in units of $kT$. From the definition, it is clear that smaller $\tau$ means stronger attraction. Calculates the interparticle structure factor for a hard sphere fluid with a narrow, attractive, potential well. Unlike the :ref:squarewell model, here a perturbative solution of the Percus-Yevick closure relationship is used. The strength of the attractive well is described in terms of "stickiness" as defined below. The perturbation parameter (perturb), $\tau$, should be fixed between 0.01 and 0.1 and the "stickiness", $\epsilon$, allowed to vary to adjust the interaction strength. The "stickiness" is defined in the equation below and is a function of both the perturbation parameter and the interaction strength. $\epsilon$ and $\tau$ are defined in terms of the hard sphere diameter $(\sigma = 2 R)$, the width of the square well, $\Delta$ (having the same units as $R$\ ), and the depth of the well, $U_o$, in units of $kT$. From the definition, it is clear that smaller $\epsilon$ means a stronger attraction. .. math:: \tau     &= \frac{1}{12\epsilon} \exp(u_o / kT) \\ \epsilon &= \Delta / (\sigma + \Delta) \epsilon     &= \frac{1}{12\tau} \exp(u_o / kT) \\ \tau &= \Delta / (\sigma + \Delta) where the interaction potential is \end{cases} The Percus-Yevick (PY) closure was used for this calculation, and is an adequate closure for an attractive interparticle potential. This solution The Percus-Yevick (PY) closure is used for this calculation, and is an adequate closure for an attractive interparticle potential. The solution has been compared to Monte Carlo simulations for a square well fluid, with good agreement. The true particle volume fraction, $\phi$, is not equal to $h$, which appears in most of the reference. The two are related in equation (24) of the reference. The reference also describes the relationship between this perturbation solution and the original sticky hard sphere (or adhesive sphere) model by Baxter. **NB**: The calculation can go haywire for certain combinations of the input parameters, producing unphysical solutions - in this case errors are reported to the command window and the $S(q)$ is set to -1 (so it will disappear on a log-log plot). Use tight bounds to keep the parameters to values that you know are physical (test them) and keep nudging them until the optimization does not hit the constraints. In sasview the effective radius may be calculated from the parameters The true particle volume fraction, $\phi$, is not equal to $h$ which appears in most of reference [1]. The two are related in equation (24). Reference [1] also describes the relationship between this perturbative solution and the original sticky hard sphere (or "adhesive sphere") model of Baxter [2]. .. note:: The calculation can go haywire for certain combinations of the input parameters, producing unphysical solutions. In this case errors are reported to the command window and $S(q)$ is set to -1 (so it will disappear on a log-log plot!). Use tight bounds to keep the parameters to values that you know are physical (test them), and keep nudging them until the optimization does not hit the constraints. .. note:: Earlier versions of SasView did not incorporate the so-called $\beta(q)$ ("beta") correction [3] for polydispersity and non-sphericity. This is only available in SasView versions 4.2.2 and higher. In SasView the effective radius may be calculated from the parameters used in the form factor $P(q)$ that this $S(q)$ is combined with. .. [#] S V G Menon, C Manohar, and K S Rao, *J. Chem. Phys.*, 95(12) (1991) 9186-9190 .. [#] R J Baxter, *J. Chem. Phys.*, 49 (1968), 2770-2774 .. [#] M Kotlarchyk and S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 Source ------ ---------------------------- * **Author:** * **Last Modified by:** * **Last Reviewed by:** * **Author:** * **Last Modified by:** * **Last Reviewed by:** Steve King **Date:** March 27, 2019 * **Source added by :** Steve King **Date:** March 25, 2019 """ name = "stickyhardsphere" title = "Sticky hard sphere structure factor, with Percus-Yevick closure" title = "'Sticky' hard sphere structure factor with Percus-Yevick closure" description = """\ [Sticky hard sphere structure factor, with Percus-Yevick closure] Interparticle structure factor S(Q)for a hard sphere fluid with a narrow attractive well. Fits are prone to deliver non-physical parameters, use with care and read the references in the full manual. In sasview the effective radius will be calculated from the parameters used in P(Q). Interparticle structure factor S(Q) for a hard sphere fluid with a narrow attractive well. Fits are prone to deliver non- physical parameters; use with care and read the references in the model documentation.The "beta(q)" correction is available in versions 4.2.2 and higher. """ category = "structure-factor" "volume fraction of hard spheres"], ["perturb", "", 0.05, [0.01, 0.1], "", "perturbation parameter, epsilon"], "perturbation parameter, tau"], ["stickiness", "", 0.20, [-inf, inf], "", "stickiness, tau"], "stickiness, epsilon"], ]
• ## sasmodels/models/unified_power_Rg.py

 r0507e09 artefacts that appear as kinks in the fitted model function. Also see the Guinier_Porod model. Also see the :ref:guinier-porod model. The empirical fit function is: ------ unified_power_Rg.py _ unified_power_rg.py _ Authorship and Verification category = "shape-independent" name = "unified_power_Rg" name = "unified_power_rg" title = "Unified Power Rg" description = """
Note: See TracChangeset for help on using the changeset viewer.