Changeset 5f3c534 in sasmodels
- Timestamp:
- Mar 27, 2019 12:11:45 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 9947865
- Parents:
- 055ec4f
- Location:
- sasmodels/models
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hardsphere.py
r0507e09 r5f3c534 1 1 # Note: model title and parameter table are inserted automatically 2 r"""Calculate the interparticle structure factor for monodisperse 2 r""" 3 Calculates the interparticle structure factor for monodisperse 3 4 spherical particles interacting through hard sphere (excluded volume) 4 interactions. 5 May be a reasonable approximation for other shapes of particles that 6 freely rotate, and for moderately polydisperse systems. Though strictly 7 the maths needs to be modified (no \Beta(Q) correction yet in sasview). 5 interactions. This $S(q)$ may also be a reasonable approximation for 6 other particle shapes that freely rotate (but see the note below), 7 and for moderately polydisperse systems. 8 9 .. note:: 10 11 This routine is intended for uncharged particles! For charged 12 particles try using the :ref:`hayter-msa` $S(q)$ instead. 13 14 .. note:: 15 16 Earlier versions of SasView did not incorporate the so-called 17 $\beta(q)$ ("beta") correction [1] for polydispersity and non-sphericity. 18 This is only available in SasView versions 4.2.2 and higher. 8 19 9 20 radius_effective is the effective hard sphere radius. 10 21 volfraction is the volume fraction occupied by the spheres. 11 22 12 In sasview the effective radius may be calculated from the parameters23 In SasView the effective radius may be calculated from the parameters 13 24 used in the form factor $P(q)$ that this $S(q)$ is combined with. 14 25 15 26 For numerical stability the computation uses a Taylor series expansion 16 at very small $qR$, there may be a very minor glitch at the transition point17 in some circumstances.27 at very small $qR$, but there may be a very minor glitch at the 28 transition point in some circumstances. 18 29 19 Th e S(Q) uses the Percus-Yevick closure where the interparticle20 potentialis30 This S(q) uses the Percus-Yevick closure relationship [2] where the 31 interparticle potential $U(r)$ is 21 32 22 33 .. math:: … … 27 38 \end{cases} 28 39 29 where $r$ is the distance from the center of thesphere of a radius $R$.40 where $r$ is the distance from the center of a sphere of a radius $R$. 30 41 31 42 For a 2D plot, the wave transfer is defined as … … 38 49 References 39 50 ---------- 51 52 .. [#] M Kotlarchyk & S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 40 53 41 54 .. [#] J K Percus, J Yevick, *J. Phys. Rev.*, 110, (1958) 1 … … 63 76 [Hard sphere structure factor, with Percus-Yevick closure] 64 77 Interparticle S(Q) for random, non-interacting spheres. 65 May be a reasonable approximation for other shapes of66 particles that freely rotate, and for moderately polydisperse67 systems. Though strictly the maths needs to be modified -68 which sasview does not do yet.78 May be a reasonable approximation for other particle shapes 79 that freely rotate, and for moderately polydisperse systems 80 . The "beta(q)" correction is available in versions 4.2.2 81 and higher. 69 82 radius_effective is the hard sphere radius 70 83 volfraction is the volume fraction occupied by the spheres. -
sasmodels/models/hayter_msa.py
r0507e09 r5f3c534 1 1 # Note: model title and parameter table are inserted automatically 2 2 r""" 3 This calculates the structure factor (the Fourier transform of the pair 4 correlation function $g(r)$) for a system of charged, spheroidal objects 5 in a dielectric medium. When combined with an appropriate form factor 6 (such as sphere, core+shell, ellipsoid, etc), this allows for inclusion 7 of the interparticle interference effects due to screened coulomb repulsion 8 between charged particles. 3 Calculates the interparticle structure factor for a system of charged, 4 spheroidal, objects in a dielectric medium [1,2]. When combined with an 5 appropriate form factor $P(q)$, this allows for inclusion of the 6 interparticle interference effects due to screened Coulombic 7 repulsion between the charged particles. 9 8 10 **This routine only works for charged particles**. If the charge is set to 11 zero the routine may self-destruct! For non-charged particles use a hard 12 sphere potential. 9 .. note:: 10 11 This routine only works for charged particles! If the charge is set 12 to zero the routine may self-destruct! For uncharged particles use 13 the :ref:`hardsphere` $S(q)$ instead. 14 15 .. note:: 16 17 Earlier versions of SasView did not incorporate the so-called 18 $\beta(q)$ ("beta") correction [3] for polydispersity and non-sphericity. 19 This is only available in SasView versions 4.2.2 and higher. 13 20 14 21 The salt concentration is used to compute the ionic strength of the solution 15 which in turn is used to compute the Debye screening length. At present16 there is no provision for entering the ionic strength directly nor for use 17 of any multivalent salts, though it should be possible to simulate the effect 18 of this by increasing the salt concentration. The counterions are also 19 assumed to be monovalent.22 which in turn is used to compute the Debye screening length. There is no 23 provision for entering the ionic strength directly. **At present the 24 counterions are assumed to be monovalent**, though it should be possible 25 to simulate the effect of multivalent counterions by increasing the salt 26 concentration. 20 27 21 In sasview the effective radius may be calculated from the parameters 28 Over the range 0 - 100 C the dielectric constant $\kappa$ of water may be 29 approximated with a maximum deviation of 0.01 units by the empirical 30 formula [4] 31 32 .. math:: 33 34 \kappa = 87.740 - 0.40008 T + 9.398x10^{-4} T^2 - 1.410x10^{-6} T^3 35 36 where $T$ is the temperature in celsius. 37 38 In SasView the effective radius may be calculated from the parameters 22 39 used in the form factor $P(q)$ that this $S(q)$ is combined with. 23 40 … … 38 55 39 56 .. [#] J B Hayter and J Penfold, *Molecular Physics*, 42 (1981) 109-118 57 40 58 .. [#] J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656 59 60 .. [#] M Kotlarchyk and S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 61 62 .. [#] C G Malmberg and A A Maryott, *J. Res. Nat. Bureau Standards*, 56 (1956) 2641 41 63 42 64 Source … … 52 74 * **Author:** 53 75 * **Last Modified by:** 54 * **Last Reviewed by:** 76 * **Last Reviewed by:** Steve King **Date:** March 27, 2019 55 77 * **Source added by :** Steve King **Date:** March 25, 2019 56 78 """ … … 74 96 75 97 name = "hayter_msa" 76 title = "Hayter-Penfold rescaled MSA, charged sphere, interparticle S(Q) structure factor"98 title = "Hayter-Penfold Rescaled Mean Spherical Approximation (RMSA) structure factor for charged spheres" 77 99 description = """\ 78 100 [Hayter-Penfold RMSA charged sphere interparticle S(Q) structure factor] 79 Interparticle structure factor S(Q)for a charged hard spheres. 80 Routine takes absolute value of charge, use HardSphere if charge 81 goes to zero. 82 In sasview the effective radius and volume fraction may be calculated 83 from the parameters used in P(Q). 101 Interparticle structure factor S(Q) for charged hard spheres. 102 This routine only works for charged particles! For uncharged particles 103 use the hardsphere S(q) instead. The "beta(q)" correction is available 104 in versions 4.2.2 and higher. 84 105 """ 85 106 … … 93 114 ["temperature", "K", 318.16, [0, 450], "", "temperature, in Kelvin, for Debye length calculation"], 94 115 ["concentration_salt", "M", 0.0, [0, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 95 ["dielectconst", "None", 71.08, [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"]116 ["dielectconst", "None", 71.08, [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, kappa, default water, for Debye length"] 96 117 ] 97 118 # pylint: enable=bad-whitespace, line-too-long -
sasmodels/models/squarewell.py
r0507e09 r5f3c534 1 1 # Note: model title and parameter table are inserted automatically 2 2 r""" 3 This calculates the interparticle structure factor for a square well fluid 4 spherical particles. The mean spherical approximation (MSA) closure was 5 used for this calculation, and is not the most appropriate closure for 6 a n attractive interparticle potential. This solution has been compared7 t o Monte Carlo simulations for a square well fluid, showing this calculation8 to be limited in applicability to well depths $\epsilon < 1.5$ kT and 9 volume fractions $\phi < 0.08$.3 Calculates the interparticle structure factor for a hard sphere fluid 4 with a narrow, attractive, square well potential. **The Mean Spherical 5 Approximation (MSA) closure relationship is used, but it is not the most 6 appropriate closure for an attractive interparticle potential.** However, 7 the solution has been compared to Monte Carlo simulations for a square 8 well fluid and these show the MSA calculation to be limited to well 9 depths $\epsilon < 1.5$ kT and volume fractions $\phi < 0.08$. 10 10 11 11 Positive well depths correspond to an attractive potential well. Negative 12 12 well depths correspond to a potential "shoulder", which may or may not be 13 physically reasonable. The stickyhardsphere model may be a better choice in 14 some circumstances. Computed values may behave badly at extremely small $qR$. 13 physically reasonable. The :ref:`stickyhardsphere` model may be a better 14 choice in some circumstances. 15 16 Computed values may behave badly at extremely small $qR$. 17 18 .. note:: 19 20 Earlier versions of SasView did not incorporate the so-called 21 $\beta(q)$ ("beta") correction [2] for polydispersity and non-sphericity. 22 This is only available in SasView versions 4.2.2 and higher. 15 23 16 24 The well width $(\lambda)$ is defined as multiples of the particle diameter … … 18 26 19 27 The interaction potential is: 20 21 .. image:: img/squarewell.png22 28 23 29 .. math:: … … 29 35 \end{cases} 30 36 31 where $r$ is the distance from the center of thesphere of a radius $R$.37 where $r$ is the distance from the center of a sphere of a radius $R$. 32 38 33 In sasview the effective radius may be calculated from the parameters39 In SasView the effective radius may be calculated from the parameters 34 40 used in the form factor $P(q)$ that this $S(q)$ is combined with. 35 41 … … 46 52 .. [#] R V Sharma, K C Sharma, *Physica*, 89A (1977) 213 47 53 54 .. [#] M Kotlarchyk and S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 55 48 56 Source 49 57 ------ … … 56 64 * **Author:** 57 65 * **Last Modified by:** 58 * **Last Reviewed by:** 66 * **Last Reviewed by:** Steve King **Date:** March 27, 2019 59 67 * **Source added by :** Steve King **Date:** March 25, 2019 60 68 """ … … 64 72 65 73 name = "squarewell" 66 title = "Square well structure factor , with MSAclosure"74 title = "Square well structure factor with Mean Spherical Approximation closure" 67 75 description = """\ 68 76 [Square well structure factor, with MSA closure] 69 Interparticle structure factor S(Q) for a hard sphere fluid with70 a narrow attractive well. Fits are prone to deliver non-physical71 parameters, use with care and read the references in the full manual.72 In sasview the effective radius will be calculated from the73 parameters used in P(Q).77 Interparticle structure factor S(Q) for a hard sphere fluid 78 with a narrow attractive well. Fits are prone to deliver non- 79 physical parameters; use with care and read the references in 80 the model documentation.The "beta(q)" correction is available 81 in versions 4.2.2 and higher. 74 82 """ 75 83 category = "structure-factor" -
sasmodels/models/stickyhardsphere.py
r0507e09 r5f3c534 1 1 # Note: model title and parameter table are inserted automatically 2 2 r""" 3 This calculates the interparticle structure factor for a hard sphere fluid 4 with a narrow attractive well. A perturbative solution of the Percus-Yevick5 closure is used. The strength of the attractive well is described in terms 6 of "stickiness" as defined below. 7 8 The perturb (perturbation parameter), $\epsilon$, should be held between 0.01 9 and 0.1. It is best to hold the perturbation parameter fixed and let 10 the "stickiness" vary to adjust the interaction strength. The stickiness, 11 $\tau$, is defined in the equation below and is a function of both the 12 perturbation parameter and the interaction strength. $\tau$ and $\epsilon$ 13 are defined in terms of the hard sphere diameter $(\sigma = 2 R)$, the 14 width of the square well, $\Delta$ (same units as $R$\ ), and the depth of 15 the well, $U_o$, in units of $kT$. From the definition, it is clear that 16 smaller $\tau$ meansstronger attraction.3 Calculates the interparticle structure factor for a hard sphere fluid 4 with a narrow, attractive, potential well. Unlike the :ref:`squarewell` 5 model, here a perturbative solution of the Percus-Yevick closure 6 relationship is used. The strength of the attractive well is described 7 in terms of "stickiness" as defined below. 8 9 The perturbation parameter (perturb), $\tau$, should be fixed between 0.01 10 and 0.1 and the "stickiness", $\epsilon$, allowed to vary to adjust the 11 interaction strength. The "stickiness" is defined in the equation below and is 12 a function of both the perturbation parameter and the interaction strength. 13 $\epsilon$ and $\tau$ are defined in terms of the hard sphere diameter $(\sigma = 2 R)$, 14 the width of the square well, $\Delta$ (having the same units as $R$\ ), 15 and the depth of the well, $U_o$, in units of $kT$. From the definition, it 16 is clear that smaller $\epsilon$ means a stronger attraction. 17 17 18 18 .. math:: 19 19 20 \ tau &= \frac{1}{12\epsilon} \exp(u_o / kT) \\21 \ epsilon&= \Delta / (\sigma + \Delta)20 \epsilon &= \frac{1}{12\tau} \exp(u_o / kT) \\ 21 \tau &= \Delta / (\sigma + \Delta) 22 22 23 23 where the interaction potential is … … 31 31 \end{cases} 32 32 33 The Percus-Yevick (PY) closure was used for this calculation, and is an34 adequate closure for an attractive interparticle potential. Th issolution33 The Percus-Yevick (PY) closure is used for this calculation, and is an 34 adequate closure for an attractive interparticle potential. The solution 35 35 has been compared to Monte Carlo simulations for a square well fluid, with 36 36 good agreement. 37 37 38 The true particle volume fraction, $\phi$, is not equal to $h$, which appears 39 in most of the reference. The two are related in equation (24) of the 40 reference. The reference also describes the relationship between this 41 perturbation solution and the original sticky hard sphere (or adhesive 42 sphere) model by Baxter. 43 44 **NB**: The calculation can go haywire for certain combinations of the input 45 parameters, producing unphysical solutions - in this case errors are 46 reported to the command window and the $S(q)$ is set to -1 (so it will 47 disappear on a log-log plot). Use tight bounds to keep the parameters to 48 values that you know are physical (test them) and keep nudging them until 49 the optimization does not hit the constraints. 50 51 In sasview the effective radius may be calculated from the parameters 38 The true particle volume fraction, $\phi$, is not equal to $h$ which appears 39 in most of reference [1]. The two are related in equation (24). Reference 40 [1] also describes the relationship between this perturbative solution and 41 the original sticky hard sphere (or "adhesive sphere") model of Baxter [2]. 42 43 .. note:: 44 45 The calculation can go haywire for certain combinations of the input 46 parameters, producing unphysical solutions. In this case errors are 47 reported to the command window and $S(q)$ is set to -1 (so it will 48 disappear on a log-log plot!). 49 50 Use tight bounds to keep the parameters to values that you know are 51 physical (test them), and keep nudging them until the optimization 52 does not hit the constraints. 53 54 .. note:: 55 56 Earlier versions of SasView did not incorporate the so-called 57 $\beta(q)$ ("beta") correction [3] for polydispersity and non-sphericity. 58 This is only available in SasView versions 4.2.2 and higher. 59 60 In SasView the effective radius may be calculated from the parameters 52 61 used in the form factor $P(q)$ that this $S(q)$ is combined with. 53 62 … … 65 74 .. [#] S V G Menon, C Manohar, and K S Rao, *J. Chem. Phys.*, 95(12) (1991) 9186-9190 66 75 76 .. [#] R J Baxter, *J. Chem. Phys.*, 49 (1968), 2770-2774 77 78 .. [#] M Kotlarchyk and S-H Chen, *J. Chem. Phys.*, 79 (1983) 2461-2469 79 67 80 Source 68 81 ------ … … 75 88 * **Author:** 76 89 * **Last Modified by:** 77 * **Last Reviewed by:** 90 * **Last Reviewed by:** Steve King **Date:** March 27, 2019 78 91 * **Source added by :** Steve King **Date:** March 25, 2019 79 92 """ … … 85 98 86 99 name = "stickyhardsphere" 87 title = " Sticky hard sphere structure factor,with Percus-Yevick closure"100 title = "'Sticky' hard sphere structure factor with Percus-Yevick closure" 88 101 description = """\ 89 102 [Sticky hard sphere structure factor, with Percus-Yevick closure] 90 Interparticle structure factor S(Q) for a hard sphere fluid with91 a narrow attractive well. Fits are prone to deliver non-physical92 parameters, use with care and read the references in the full manual.93 In sasview the effective radius will be calculated from the94 parameters used in P(Q).103 Interparticle structure factor S(Q) for a hard sphere fluid 104 with a narrow attractive well. Fits are prone to deliver non- 105 physical parameters; use with care and read the references in 106 the model documentation.The "beta(q)" correction is available 107 in versions 4.2.2 and higher. 95 108 """ 96 109 category = "structure-factor" … … 107 120 "volume fraction of hard spheres"], 108 121 ["perturb", "", 0.05, [0.01, 0.1], "", 109 "perturbation parameter, epsilon"],122 "perturbation parameter, tau"], 110 123 ["stickiness", "", 0.20, [-inf, inf], "", 111 "stickiness, tau"],124 "stickiness, epsilon"], 112 125 ] 113 126
Note: See TracChangeset
for help on using the changeset viewer.