source: sasmodels/sasmodels/models/HayterMSAsq.py @ ec2ca99

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since ec2ca99 was ec2ca99, checked in by piotr, 8 years ago

more fun with pylint

  • Property mode set to 100644
File size: 4.0 KB
Line 
1# Note: model title and parameter table are inserted automatically
2r"""
3This calculates the structure factor (the Fourier transform of the pair
4correlation function $g(r)$) for a system of charged, spheroidal objects
5in a dielectric medium. When combined with an appropriate form factor
6(such as sphere, core+shell, ellipsoid, etc), this allows for inclusion
7of the interparticle interference effects due to screened coulomb repulsion
8between charged particles.
9
10**This routine only works for charged particles**. If the charge is set to
11zero the routine will self-destruct! For non-charged particles use a hard
12sphere potential.
13
14The salt concentration is used to compute the ionic strength of the solution
15which in turn is used to compute the Debye screening length. At present
16there is no provision for entering the ionic strength directly nor for use
17of any multivalent salts. The counterions are also assumed to be monovalent.
18
19For 2D data, the scattering intensity is calculated in the same way as 1D,
20where the $q$ vector is defined as
21
22.. math::
23
24    q = \sqrt{q_x^2 + q_y^2}
25
26.. figure:: img/HayterMSAsq_227.jpg
27
28    1D plot using the default values (in linear scale).
29
30References
31----------
32
33J B Hayter and J Penfold, *Molecular Physics*, 42 (1981) 109-118
34
35J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656
36"""
37
38#  dp[0] = 2.0*effect_radius();
39#  dp[1] = fabs(charge());
40#  dp[2] = volfraction();
41#  dp[3] = temperature();
42#  dp[4] = saltconc();
43#  dp[5] = dielectconst();
44
45from numpy import inf
46
47source = ["HayterMSAsq_kernel.c"]
48
49name = "HayterMSAsq"
50title = "Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor"
51description = """\
52    [Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor]
53        Interparticle structure factor S(Q)for a charged hard spheres.
54        Routine takes absolute value of charge, use HardSphere if charge
55        goes to zero.
56        In sasview the effective radius will be calculated from the
57        parameters used in P(Q).
58"""
59single = False  # double precision only for now
60
61# pylint: disable=bad-whitespace, line-too-long
62#             [ "name", "units", default, [lower, upper], "type", "description" ],
63parameters = [
64    ["effect_radius", "Ang", 20.75,   [0, inf],    "volume", "effective radius of hard sphere"],
65    ["charge",        "e",   19.0,    [0, inf],    "", "charge on sphere (in electrons)"],
66    ["volfraction",   "",     0.0192, [0, 0.74],   "", "volume fraction of spheres"],
67    ["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"],
70    ]
71# pylint: enable=bad-whitespace, line-too-long
72category = "structure-factor"
73
74# No volume normalization despite having a volume parameter
75# This should perhaps be volume normalized?
76form_volume = """
77    return 1.0;
78    """
79Iqxy = """
80    // never called since no orientation or magnetic parameters.
81    return Iq(sqrt(qx*qx+qy*qy), IQ_PARAMETERS);
82    """
83# ER defaults to 0.0
84# VR defaults to 1.0
85
86oldname = 'HayterMSAStructure'
87oldpars = dict()
88# default parameter set,  use  compare.sh -midQ -linear
89# note the calculation varies in different limiting cases so a wide range of
90# parameters will be required for a thorough test!
91# odd that the default st has saltconc zero
92demo = dict(effect_radius=20.75,
93            charge=19.0,
94            volfraction=0.0192,
95            temperature=318.16,
96            saltconc=0.05,
97            dielectconst=71.08,
98            effect_radius_pd=0.1,
99            effect_radius_pd_n=40)
100#
101# attempt to use same values as old sasview unit test
102tests = [
103    [{'scale': 1.0,
104      'background': 0.0,
105      'effect_radius': 20.75,
106      'charge': 19.0,
107      'volfraction': 0.0192,
108      'temperature': 298.0,
109      'saltconc': 0,
110      'dielectconst': 78.0,
111      'effect_radius_pd': 0},
112     [0.0010], [0.0712928]]
113    ]
114
Note: See TracBrowser for help on using the repository browser.