source: sasmodels/sasmodels/models/be_polyelectrolyte.py @ b0c4271

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since b0c4271 was b0c4271, checked in by butler, 8 years ago

model documentation final format through core_shell_bicelle re: #646

  • Property mode set to 100644
File size: 6.1 KB
Line 
1r"""
2Definition
3----------
4This model calculates the structure factor of a polyelectrolyte solution with
5the RPA expression derived by Borue and Erukhimovich\ [#Borue]_.  The scattering intensity
6$I(q)$ is calculated as
7
8.. math::
9
10    I(q) = K\frac{q^2+k^2}{4\pi L\alpha ^2}
11    \frac{1}{1+r_{0}^2(q^2+k^2)(q^2-12hC_a/b^2)} + background
12
13    k^2 = 4\pi L(2C_s + \alpha C_a)
14
15    r_{0}^2 = \frac{1}{\alpha \sqrt{C_a} \left( b/\sqrt{48\pi L_b}\right)}
16
17where $K$ is the contrast factor for the polymer, $L_b$ is the Bjerrum length,
18$h$ is the virial parameter, $b$ is the monomer length,
19$C_s$ is the concentration of monovalent salt, $\alpha$ is the ionization
20degree, $C_a$ is the polymer molar concentration, and $background$ is the
21incoherent background.
22
23For 2D data the scattering intensity is calculated in the same way as 1D,
24where the $q$ vector is defined as
25
26.. math::
27
28    q = \sqrt{q_x^2 + q_y^2}
29
30
31NB: $1 barn = 10^{-24} cm^2$
32
33References
34----------
35
36.. [#Borue] V Y Borue, I Y Erukhimovich, *Macromolecules*, 21 (1988) 3240
37.. [#] J F Joanny, L Leibler, *Journal de Physique*, 51 (1990) 545
38.. [#] A Moussaid, F Schosseler, J P Munch, S Candau, *J. Journal de Physique
39   II France*, 3 (1993) 573
40.. [#] E Raphael, J F Joanny, *Europhysics Letters*, 11 (1990) 179
41
42Authorship and Verification
43----------------------------
44
45* **Author:** NIST IGOR/DANSE **Date:** pre 2010
46* **Last Modified by:** Paul Kienzle **Date:** July 24, 2016
47* **Last Reviewed by:** Piotr rozyczko **Date:** January 27, 2016
48"""
49
50from numpy import inf, pi, sqrt
51
52name = "be_polyelectrolyte"
53title = "Polyelectrolyte with the RPA expression derived by Borue and Erukhimovich"
54description = """
55            Evaluate
56            F(x) = K 1/(4 pi Lb (alpha)^(2)) (q^(2)+k2)/(1+(r02)^(2))
57                 (q^(2)+k2) (q^(2)-(12 h C/b^(2)))
58
59            has 3 internal parameters :
60                   The inverse Debye Length: K2 = 4 pi Lb (2 Cs+alpha C)
61                   r02 =1/alpha/Ca^(0.5) (B/(48 pi Lb)^(0.5))
62                   Ca = 6.022136e-4 C
63            """
64category = "shape-independent"
65
66# pylint: disable=bad-whitespace, line-too-long
67#   ["name", "units", default, [lower, upper], "type", "description"],
68parameters = [
69    ["contrast_factor",       "barns",   10.0,  [-inf, inf], "", "Contrast factor of the polymer"],
70    ["bjerrum_length",        "Ang",      7.1,  [0, inf],    "", "Bjerrum length"],
71    ["virial_param",          "1/Ang^2", 12.0,  [-inf, inf], "", "Virial parameter"],
72    ["monomer_length",        "Ang",     10.0,  [0, inf],    "", "Monomer length"],
73    ["salt_concentration",    "mol/L",    0.0,  [-inf, inf], "", "Concentration of monovalent salt"],
74    ["ionization_degree",     "",         0.05, [0, inf],    "", "Degree of ionization"],
75    ["polymer_concentration", "mol/L",    0.7,  [0, inf],    "", "Polymer molar concentration"],
76    ]
77# pylint: enable=bad-whitespace, line-too-long
78
79
80def Iq(q,
81       contrast_factor=10.0,
82       bjerrum_length=7.1,
83       virial_param=12.0,
84       monomer_length=10.0,
85       salt_concentration=0.0,
86       ionization_degree=0.05,
87       polymer_concentration=0.7):
88    """
89    :param q:                     Input q-value
90    :param contrast_factor:       Contrast factor of the polymer
91    :param bjerrum_length:        Bjerrum length
92    :param virial_param:          Virial parameter
93    :param monomer_length:        Monomer length
94    :param salt_concentration:    Concentration of monovalent salt
95    :param ionization_degree:     Degree of ionization
96    :param polymer_concentration: Polymer molar concentration
97    :return:                      1-D intensity
98    """
99
100    concentration = polymer_concentration * 6.022136e-4
101
102    k_square = 4.0 * pi * bjerrum_length * (2*salt_concentration +
103                                            ionization_degree * concentration)
104
105    r0_square = 1.0/ionization_degree/sqrt(concentration) * \
106                (monomer_length/sqrt((48.0*pi*bjerrum_length)))
107
108    term1 = contrast_factor/(4.0 * pi * bjerrum_length *
109                             ionization_degree**2) * (q**2 + k_square)
110
111    term2 = 1.0 + r0_square**2 * (q**2 + k_square) * \
112        (q**2 - (12.0 * virial_param * concentration/(monomer_length**2)))
113
114    return term1/term2
115
116Iq.vectorized = True  # Iq accepts an array of q values
117
118
119demo = dict(scale=1, background=0.1,
120            contrast_factor=10.0,
121            bjerrum_length=7.1,
122            virial_param=12.0,
123            monomer_length=10.0,
124            salt_concentration=0.0,
125            ionization_degree=0.05,
126            polymer_concentration=0.7)
127
128tests = [
129
130    # Accuracy tests based on content in test/utest_other_models.py
131    [{'contrast_factor':       10.0,
132      'bjerrum_length':         7.1,
133      'virial_param':          12.0,
134      'monomer_length':        10.0,
135      'salt_concentration':     0.0,
136      'ionization_degree':      0.05,
137      'polymer_concentration':  0.7,
138      'background':             0.001,
139     }, 0.001, 0.0948379],
140
141    # Additional tests with larger range of parameters
142    [{'contrast_factor':       10.0,
143      'bjerrum_length':       100.0,
144      'virial_param':           3.0,
145      'monomer_length':         1.0,
146      'salt_concentration':    10.0,
147      'ionization_degree':      2.0,
148      'polymer_concentration': 10.0,
149      'background':             0.0,
150     }, 0.1, -3.75693800588],
151
152    [{'contrast_factor':       10.0,
153      'bjerrum_length':       100.0,
154      'virial_param':           3.0,
155      'monomer_length':         1.0,
156      'salt_concentration':    10.0,
157      'ionization_degree':      2.0,
158      'polymer_concentration': 10.0,
159      'background':           100.0
160     }, 5.0, 100.029142149],
161
162    [{'contrast_factor':     100.0,
163      'bjerrum_length':       10.0,
164      'virial_param':        180.0,
165      'monomer_length':        1.0,
166      'salt_concentration':    0.1,
167      'ionization_degree':     0.5,
168      'polymer_concentration': 0.1,
169      'background':             0.0,
170     }, 200., 1.80664667511e-06],
171    ]
Note: See TracBrowser for help on using the repository browser.