Changeset d529d93 in sasmodels for sasmodels/models/hayter_msa.py
- Timestamp:
- Mar 17, 2016 8:16:55 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3a45c2c, 0784c18
- Parents:
- c5dadbb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hayter_msa.py
r348557a rd529d93 9 9 10 10 **This routine only works for charged particles**. If the charge is set to 11 zero the routine willself-destruct! For non-charged particles use a hard11 zero the routine may self-destruct! For non-charged particles use a hard 12 12 sphere potential. 13 13 … … 15 15 which in turn is used to compute the Debye screening length. At present 16 16 there is no provision for entering the ionic strength directly nor for use 17 of any multivalent salts. The counterions are also assumed to be monovalent. 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. 18 27 19 28 For 2D data, the scattering intensity is calculated in the same way as 1D, … … 24 33 q = \sqrt{q_x^2 + q_y^2} 25 34 26 .. figure:: img/HayterMSAsq_227.jpg27 28 1D plot using the default values (in linear scale).29 35 30 36 References … … 35 41 J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656 36 42 """ 43 from numpy import inf 37 44 38 # dp[0] = 2.0*effect_radius(); 45 category = "structure-factor" 46 structure_factor = True 47 single = False # double precision only! 48 49 # dp[0] = 2.0*radius_effective(); 39 50 # dp[1] = fabs(charge()); 40 51 # dp[2] = volfraction(); … … 43 54 # dp[5] = dielectconst(); 44 55 45 from numpy import inf46 56 47 source = ["hayter_msa_kernel.c"] 57 48 58 49 59 name = "hayter_msa" 50 title = "Hayter-Penfold MSA charged sphereinterparticle S(Q) structure factor"60 title = "Hayter-Penfold rescaled MSA, charged sphere, interparticle S(Q) structure factor" 51 61 description = """\ 52 [Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor]62 [Hayter-Penfold RMSA charged sphere interparticle S(Q) structure factor] 53 63 Interparticle structure factor S(Q)for a charged hard spheres. 54 64 Routine takes absolute value of charge, use HardSphere if charge 55 65 goes to zero. 56 In sasview the effective radius will be calculated from the57 parameters used in P(Q).66 In sasview the effective radius and volume fraction may be calculated 67 from the parameters used in P(Q). 58 68 """ 59 single = False # double precision only! 69 60 70 61 71 # pylint: disable=bad-whitespace, line-too-long 62 72 # [ "name", "units", default, [lower, upper], "type", "description" ], 63 73 parameters = [ 64 [" effect_radius", "Ang", 20.75, [0, inf], "volume", "effective radius of hard sphere"],74 ["radius_effective", "Ang", 20.75, [0, inf], "volume", "effective radius of charged sphere"], 65 75 ["charge", "e", 19.0, [0, inf], "", "charge on sphere (in electrons)"], 66 ["volfraction", " ", 0.0192, [0, 0.74], "", "volume fraction of spheres"],76 ["volfraction", "None", 0.0192, [0, 0.74], "", "volume fraction of spheres"], 67 77 ["temperature", "K", 318.16, [0, inf], "", "temperature, in Kelvin, for Debye length calculation"], 68 ["saltconc", "M", 0.0, [-inf, inf], "", "conc of salt, 1:1 electolyte, for Debye length"],69 ["dielectconst", " ", 71.08, [-inf, inf], "", "dielectric constant of solvent (default water), for Debye length"],78 ["saltconc", "M", 0.0, [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 79 ["dielectconst", "None", 71.08, [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"] 70 80 ] 71 81 # pylint: enable=bad-whitespace, line-too-long 72 category = "structure-factor"73 82 83 source = ["hayter_msa_kernel.c"] 74 84 # No volume normalization despite having a volume parameter 75 85 # This should perhaps be volume normalized? … … 85 95 86 96 oldname = 'HayterMSAStructure' 87 oldpars = dict() 97 #oldpars = dict(effect_radius="radius_effective",effect_radius_pd="radius_effective_pd",effect_radius_pd_n="radius_effective_pd_n") 98 oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 99 #oldpars = dict( ) 88 100 # default parameter set, use compare.sh -midQ -linear 89 101 # note the calculation varies in different limiting cases so a wide range of 90 102 # parameters will be required for a thorough test! 91 103 # odd that the default st has saltconc zero 92 demo = dict( effect_radius=20.75,104 demo = dict(radius_effective=20.75, 93 105 charge=19.0, 94 106 volfraction=0.0192, … … 96 108 saltconc=0.05, 97 109 dielectconst=71.08, 98 effect_radius_pd=0.1,99 effect_radius_pd_n=40)110 radius_effective_pd=0.1, 111 radius_effective_pd_n=40) 100 112 # 101 113 # attempt to use same values as old sasview unit test at Q=.001 was 0.0712928, … … 104 116 [{'scale': 1.0, 105 117 'background': 0.0, 106 ' effect_radius': 20.75,118 'radius_effective': 20.75, 107 119 'charge': 19.0, 108 120 'volfraction': 0.0192, … … 110 122 'saltconc': 0, 111 123 'dielectconst': 78.0, 112 ' effect_radius_pd': 0},124 'radius_effective_pd': 0}, 113 125 [0.00001,0.0010,0.01,0.075], [0.0711646,0.0712928,0.0847006,1.07150]], 114 126 [{'scale': 1.0, 115 127 'background': 0.0, 116 ' effect_radius': 20.75,128 'radius_effective': 20.75, 117 129 'charge': 19.0, 118 130 'volfraction': 0.0192, … … 120 132 'saltconc': 0.05, 121 133 'dielectconst': 78.0, 122 ' effect_radius_pd': 0.1,123 ' effect_radius_pd_n': 40},134 'radius_effective_pd': 0.1, 135 'radius_effective_pd_n': 40}, 124 136 [0.00001,0.0010,0.01,0.075], [0.450272,0.450420,0.465116,1.039625]] 125 137 ] 126 138 # ADDED by: RKH ON: 16Mar2016 converted from sasview, new Taylor expansion at smallest rescaled Q
Note: See TracChangeset
for help on using the changeset viewer.