[d60b433] | 1 | # Note: model title and parameter table are inserted automatically |
---|
| 2 | r""" |
---|
[eb69cce] | 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. |
---|
[d60b433] | 9 | |
---|
[eb69cce] | 10 | **This routine only works for charged particles**. If the charge is set to |
---|
[d529d93] | 11 | zero the routine may self-destruct! For non-charged particles use a hard |
---|
[eb69cce] | 12 | sphere potential. |
---|
[d60b433] | 13 | |
---|
[eb69cce] | 14 | 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 present |
---|
| 16 | there is no provision for entering the ionic strength directly nor for use |
---|
[d529d93] | 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 assumed to |
---|
| 19 | be monovalent. |
---|
| 20 | |
---|
| 21 | In sasview the effective radius may be calculated from the parameters |
---|
| 22 | used in the form factor $P(q)$ that this $S(q)$ is combined with. |
---|
| 23 | |
---|
| 24 | The computation uses a Taylor series expansion at very small rescaled $qR$, to |
---|
| 25 | avoid some serious rounding error issues, this may result in a minor artefact |
---|
| 26 | in the transition region under some circumstances. |
---|
[d60b433] | 27 | |
---|
[eb69cce] | 28 | For 2D data, the scattering intensity is calculated in the same way as 1D, |
---|
| 29 | where the $q$ vector is defined as |
---|
[d60b433] | 30 | |
---|
| 31 | .. math:: |
---|
| 32 | |
---|
[eb69cce] | 33 | q = \sqrt{q_x^2 + q_y^2} |
---|
[d60b433] | 34 | |
---|
| 35 | |
---|
[eb69cce] | 36 | References |
---|
| 37 | ---------- |
---|
[d60b433] | 38 | |
---|
| 39 | J B Hayter and J Penfold, *Molecular Physics*, 42 (1981) 109-118 |
---|
| 40 | |
---|
| 41 | J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656 |
---|
| 42 | """ |
---|
[d529d93] | 43 | from numpy import inf |
---|
[d60b433] | 44 | |
---|
[d529d93] | 45 | category = "structure-factor" |
---|
| 46 | structure_factor = True |
---|
| 47 | single = False # double precision only! |
---|
| 48 | |
---|
| 49 | # dp[0] = 2.0*radius_effective(); |
---|
[d60b433] | 50 | # dp[1] = fabs(charge()); |
---|
| 51 | # dp[2] = volfraction(); |
---|
| 52 | # dp[3] = temperature(); |
---|
[54954e1] | 53 | # dp[4] = salt_concentration(); |
---|
[d60b433] | 54 | # dp[5] = dielectconst(); |
---|
| 55 | |
---|
| 56 | |
---|
[d529d93] | 57 | |
---|
[d60b433] | 58 | |
---|
[348557a] | 59 | name = "hayter_msa" |
---|
[d529d93] | 60 | title = "Hayter-Penfold rescaled MSA, charged sphere, interparticle S(Q) structure factor" |
---|
[d60b433] | 61 | description = """\ |
---|
[d529d93] | 62 | [Hayter-Penfold RMSA charged sphere interparticle S(Q) structure factor] |
---|
[d60b433] | 63 | Interparticle structure factor S(Q)for a charged hard spheres. |
---|
[ec2ca99] | 64 | Routine takes absolute value of charge, use HardSphere if charge |
---|
| 65 | goes to zero. |
---|
[d529d93] | 66 | In sasview the effective radius and volume fraction may be calculated |
---|
| 67 | from the parameters used in P(Q). |
---|
[d60b433] | 68 | """ |
---|
[d529d93] | 69 | |
---|
[ec2ca99] | 70 | |
---|
| 71 | # pylint: disable=bad-whitespace, line-too-long |
---|
[b7d432f] | 72 | # [ "name", "units", default, [lower, upper], "type", "description" ], |
---|
[ec2ca99] | 73 | parameters = [ |
---|
[d529d93] | 74 | ["radius_effective", "Ang", 20.75, [0, inf], "volume", "effective radius of charged sphere"], |
---|
| 75 | ["volfraction", "None", 0.0192, [0, 0.74], "", "volume fraction of spheres"], |
---|
[a3e0a8b] | 76 | ["charge", "e", 19.0, [0, inf], "", "charge on sphere (in electrons)"], |
---|
[ec2ca99] | 77 | ["temperature", "K", 318.16, [0, inf], "", "temperature, in Kelvin, for Debye length calculation"], |
---|
[54954e1] | 78 | ["salt_concentration", "M", 0.0, [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], |
---|
[d529d93] | 79 | ["dielectconst", "None", 71.08, [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"] |
---|
[ec2ca99] | 80 | ] |
---|
| 81 | # pylint: enable=bad-whitespace, line-too-long |
---|
[d60b433] | 82 | |
---|
[d529d93] | 83 | source = ["hayter_msa_kernel.c"] |
---|
[d60b433] | 84 | # No volume normalization despite having a volume parameter |
---|
| 85 | # This should perhaps be volume normalized? |
---|
| 86 | form_volume = """ |
---|
| 87 | return 1.0; |
---|
| 88 | """ |
---|
| 89 | Iqxy = """ |
---|
| 90 | // never called since no orientation or magnetic parameters. |
---|
[9f6f2f8] | 91 | return Iq(sqrt(qx*qx+qy*qy), IQ_PARAMETERS); |
---|
[d60b433] | 92 | """ |
---|
| 93 | # ER defaults to 0.0 |
---|
| 94 | # VR defaults to 1.0 |
---|
| 95 | |
---|
[ab87a12] | 96 | # default parameter set, use compare.sh -midQ -linear |
---|
[ec2ca99] | 97 | # note the calculation varies in different limiting cases so a wide range of |
---|
| 98 | # parameters will be required for a thorough test! |
---|
[54954e1] | 99 | # odd that the default st has salt_concentration zero |
---|
[d529d93] | 100 | demo = dict(radius_effective=20.75, |
---|
[ec2ca99] | 101 | charge=19.0, |
---|
| 102 | volfraction=0.0192, |
---|
| 103 | temperature=318.16, |
---|
[54954e1] | 104 | salt_concentration=0.05, |
---|
[ec2ca99] | 105 | dielectconst=71.08, |
---|
[d529d93] | 106 | radius_effective_pd=0.1, |
---|
| 107 | radius_effective_pd_n=40) |
---|
[7f47777] | 108 | # |
---|
[348557a] | 109 | # attempt to use same values as old sasview unit test at Q=.001 was 0.0712928, |
---|
| 110 | # then add lots new ones assuming values from new model are OK, need some low Q values to test the small Q Taylor expansion |
---|
[7f47777] | 111 | tests = [ |
---|
[ec2ca99] | 112 | [{'scale': 1.0, |
---|
| 113 | 'background': 0.0, |
---|
[d529d93] | 114 | 'radius_effective': 20.75, |
---|
[ec2ca99] | 115 | 'charge': 19.0, |
---|
| 116 | 'volfraction': 0.0192, |
---|
| 117 | 'temperature': 298.0, |
---|
[54954e1] | 118 | 'salt_concentration': 0, |
---|
[ec2ca99] | 119 | 'dielectconst': 78.0, |
---|
[d529d93] | 120 | 'radius_effective_pd': 0}, |
---|
[348557a] | 121 | [0.00001,0.0010,0.01,0.075], [0.0711646,0.0712928,0.0847006,1.07150]], |
---|
| 122 | [{'scale': 1.0, |
---|
| 123 | 'background': 0.0, |
---|
[d529d93] | 124 | 'radius_effective': 20.75, |
---|
[348557a] | 125 | 'charge': 19.0, |
---|
| 126 | 'volfraction': 0.0192, |
---|
| 127 | 'temperature': 298.0, |
---|
[54954e1] | 128 | 'salt_concentration': 0.05, |
---|
[348557a] | 129 | 'dielectconst': 78.0, |
---|
[d529d93] | 130 | 'radius_effective_pd': 0.1, |
---|
| 131 | 'radius_effective_pd_n': 40}, |
---|
[348557a] | 132 | [0.00001,0.0010,0.01,0.075], [0.450272,0.450420,0.465116,1.039625]] |
---|
[ec2ca99] | 133 | ] |
---|
[d529d93] | 134 | # ADDED by: RKH ON: 16Mar2016 converted from sasview, new Taylor expansion at smallest rescaled Q |
---|