[3330bb4] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | This model calculates the structure factor of a polyelectrolyte solution with |
---|
| 5 | the RPA expression derived by Borue and Erukhimovich\ [#Borue]_. Note however |
---|
| 6 | that the fitting procedure here does not follow the notation in that reference |
---|
| 7 | as 's' and 't' are **not** decoupled. Instead the scattering intensity $I(q)$ |
---|
| 8 | is calculated as |
---|
| 9 | |
---|
| 10 | .. math:: |
---|
| 11 | |
---|
| 12 | I(q) = K\frac{q^2+k^2}{4\pi L_b\alpha ^2} |
---|
| 13 | \frac{1}{1+r_{0}^2(q^2+k^2)(q^2-12hC_a/b^2)} + background |
---|
| 14 | |
---|
| 15 | k^2 = 4\pi L_b(2C_s + \alpha C_a) |
---|
| 16 | |
---|
| 17 | r_{0}^2 = \frac{1}{\alpha \sqrt{C_a} \left( b/\sqrt{48\pi L_b}\right)} |
---|
| 18 | |
---|
[a151caa] | 19 | where |
---|
[3330bb4] | 20 | |
---|
| 21 | $K$ is the contrast factor for the polymer which is defined differently than in |
---|
| 22 | other models and is given in barns where $1 barn = 10^{-24} cm^2$. $K$ is |
---|
| 23 | defined as: |
---|
| 24 | |
---|
| 25 | .. math:: |
---|
| 26 | |
---|
| 27 | K = a^2 |
---|
| 28 | |
---|
| 29 | a = b_p - (v_p/v_s) b_s |
---|
[a151caa] | 30 | |
---|
[3330bb4] | 31 | where $b_p$ and $b_s$ are sum of the scattering lengths of the atoms |
---|
| 32 | constituting the monomer of the polymer and the sum of the scattering lengths |
---|
| 33 | of the atoms constituting the solvent molecules respectively, and $v_p$ and |
---|
| 34 | $v_s$ are the partial molar volume of the polymer and the solvent respectively |
---|
| 35 | |
---|
| 36 | $L_b$ is the Bjerrum length(|Ang|) - **Note:** This parameter needs to be |
---|
[a151caa] | 37 | kept constant for a given solvent and temperature! |
---|
[3330bb4] | 38 | |
---|
| 39 | $h$ is the virial parameter (|Ang^3|/mol) - **Note:** See [#Borue]_ for the |
---|
| 40 | correct interpretation of this parameter. It incorporates second and third |
---|
| 41 | virial coefficients and can be Negative. |
---|
| 42 | |
---|
| 43 | $b$ is the monomer length(|Ang|), $C_s$ is the concentration of monovalent |
---|
| 44 | salt(mol/L), $\alpha$ is the ionization degree (ionization degree : ratio of |
---|
| 45 | charged monomers to total number of monomers), $C_a$ is the polymer molar |
---|
| 46 | concentration(mol/L), and $background$ is the incoherent background. |
---|
| 47 | |
---|
| 48 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
| 49 | where the $\vec q$ vector is defined as |
---|
| 50 | |
---|
| 51 | .. math:: |
---|
| 52 | |
---|
| 53 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 54 | |
---|
| 55 | References |
---|
| 56 | ---------- |
---|
| 57 | |
---|
| 58 | .. [#Borue] V Y Borue, I Y Erukhimovich, *Macromolecules*, 21 (1988) 3240 |
---|
| 59 | .. [#] J F Joanny, L Leibler, *Journal de Physique*, 51 (1990) 545 |
---|
| 60 | .. [#] A Moussaid, F Schosseler, J P Munch, S Candau, *J. Journal de Physique |
---|
| 61 | II France*, 3 (1993) 573 |
---|
| 62 | .. [#] E Raphael, J F Joanny, *Europhysics Letters*, 11 (1990) 179 |
---|
| 63 | |
---|
| 64 | Authorship and Verification |
---|
| 65 | ---------------------------- |
---|
| 66 | |
---|
| 67 | * **Author:** NIST IGOR/DANSE **Date:** pre 2010 |
---|
| 68 | * **Last Modified by:** Paul Kienzle **Date:** July 24, 2016 |
---|
[ef07e95] | 69 | * **Last Reviewed by:** Paul Butler and Richard Heenan **Date:** October 07, 2016 |
---|
[3330bb4] | 70 | """ |
---|
| 71 | |
---|
[2d81cfe] | 72 | import numpy as np |
---|
[3330bb4] | 73 | from numpy import inf, pi, sqrt |
---|
| 74 | |
---|
| 75 | name = "be_polyelectrolyte" |
---|
| 76 | title = "Polyelectrolyte with the RPA expression derived by Borue and Erukhimovich" |
---|
| 77 | description = """ |
---|
| 78 | Evaluate |
---|
| 79 | F(x) = K 1/(4 pi Lb (alpha)^(2)) (q^(2)+k2)/(1+(r02)^(2)) |
---|
| 80 | (q^(2)+k2) (q^(2)-(12 h C/b^(2))) |
---|
| 81 | |
---|
| 82 | has 3 internal parameters : |
---|
| 83 | The inverse Debye Length: K2 = 4 pi Lb (2 Cs+alpha C) |
---|
| 84 | r02 =1/alpha/Ca^(0.5) (B/(48 pi Lb)^(0.5)) |
---|
| 85 | Ca = 6.022136e-4 C |
---|
| 86 | """ |
---|
| 87 | category = "shape-independent" |
---|
| 88 | |
---|
| 89 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 90 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 91 | parameters = [ |
---|
| 92 | ["contrast_factor", "barns", 10.0, [-inf, inf], "", "Contrast factor of the polymer"], |
---|
| 93 | ["bjerrum_length", "Ang", 7.1, [0, inf], "", "Bjerrum length"], |
---|
| 94 | ["virial_param", "Ang^3/mol", 12.0, [-inf, inf], "", "Virial parameter"], |
---|
| 95 | ["monomer_length", "Ang", 10.0, [0, inf], "", "Monomer length"], |
---|
| 96 | ["salt_concentration", "mol/L", 0.0, [-inf, inf], "", "Concentration of monovalent salt"], |
---|
| 97 | ["ionization_degree", "", 0.05, [0, inf], "", "Degree of ionization"], |
---|
| 98 | ["polymer_concentration", "mol/L", 0.7, [0, inf], "", "Polymer molar concentration"], |
---|
| 99 | ] |
---|
| 100 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | def Iq(q, |
---|
| 104 | contrast_factor=10.0, |
---|
| 105 | bjerrum_length=7.1, |
---|
| 106 | virial_param=12.0, |
---|
| 107 | monomer_length=10.0, |
---|
| 108 | salt_concentration=0.0, |
---|
| 109 | ionization_degree=0.05, |
---|
| 110 | polymer_concentration=0.7): |
---|
| 111 | """ |
---|
| 112 | :param q: Input q-value |
---|
| 113 | :param contrast_factor: Contrast factor of the polymer |
---|
| 114 | :param bjerrum_length: Bjerrum length |
---|
| 115 | :param virial_param: Virial parameter |
---|
| 116 | :param monomer_length: Monomer length |
---|
| 117 | :param salt_concentration: Concentration of monovalent salt |
---|
| 118 | :param ionization_degree: Degree of ionization |
---|
| 119 | :param polymer_concentration: Polymer molar concentration |
---|
| 120 | :return: 1-D intensity |
---|
| 121 | """ |
---|
| 122 | |
---|
| 123 | concentration = polymer_concentration * 6.022136e-4 |
---|
| 124 | |
---|
| 125 | k_square = 4.0 * pi * bjerrum_length * (2*salt_concentration + |
---|
| 126 | ionization_degree * concentration) |
---|
| 127 | |
---|
| 128 | r0_square = 1.0/ionization_degree/sqrt(concentration) * \ |
---|
| 129 | (monomer_length/sqrt((48.0*pi*bjerrum_length))) |
---|
| 130 | |
---|
| 131 | term1 = contrast_factor/(4.0 * pi * bjerrum_length * |
---|
| 132 | ionization_degree**2) * (q**2 + k_square) |
---|
| 133 | |
---|
| 134 | term2 = 1.0 + r0_square**2 * (q**2 + k_square) * \ |
---|
| 135 | (q**2 - (12.0 * virial_param * concentration/(monomer_length**2))) |
---|
| 136 | |
---|
| 137 | return term1/term2 |
---|
| 138 | |
---|
| 139 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 140 | |
---|
[a151caa] | 141 | def random(): |
---|
[8f04da4] | 142 | # TODO: review random be_polyelectrolyte model generation |
---|
[a151caa] | 143 | pars = dict( |
---|
| 144 | scale=10000, #background=0, |
---|
| 145 | #polymer_concentration=0.7, |
---|
| 146 | polymer_concentration=np.random.beta(5, 3), # around 70% |
---|
| 147 | #salt_concentration=0.0, |
---|
| 148 | # keep salt concentration extremely low |
---|
| 149 | # and use explicit molar to match polymer concentration |
---|
| 150 | salt_concentration=np.random.beta(1, 100)*6.022136e-4, |
---|
| 151 | #contrast_factor=10.0, |
---|
| 152 | contrast_fact=np.random.uniform(1, 100), |
---|
| 153 | #bjerrum_length=7.1, |
---|
| 154 | bjerrum_length=np.random.uniform(1, 10), |
---|
| 155 | #virial_param=12.0, |
---|
| 156 | virial_param=np.random.uniform(-1000, 30), |
---|
| 157 | #monomer_length=10.0, |
---|
| 158 | monomer_length=10.0**(4*np.random.beta(1.5, 3)), |
---|
| 159 | #ionization_degree=0.05, |
---|
| 160 | ionization_degree=np.random.beta(1.5, 4), |
---|
| 161 | ) |
---|
| 162 | return pars |
---|
[3330bb4] | 163 | |
---|
| 164 | demo = dict(scale=1, background=0.1, |
---|
| 165 | contrast_factor=10.0, |
---|
| 166 | bjerrum_length=7.1, |
---|
| 167 | virial_param=12.0, |
---|
| 168 | monomer_length=10.0, |
---|
| 169 | salt_concentration=0.0, |
---|
| 170 | ionization_degree=0.05, |
---|
| 171 | polymer_concentration=0.7) |
---|
| 172 | |
---|
| 173 | tests = [ |
---|
| 174 | |
---|
| 175 | # Accuracy tests based on content in test/utest_other_models.py |
---|
| 176 | [{'contrast_factor': 10.0, |
---|
| 177 | 'bjerrum_length': 7.1, |
---|
| 178 | 'virial_param': 12.0, |
---|
| 179 | 'monomer_length': 10.0, |
---|
| 180 | 'salt_concentration': 0.0, |
---|
| 181 | 'ionization_degree': 0.05, |
---|
| 182 | 'polymer_concentration': 0.7, |
---|
| 183 | 'background': 0.001, |
---|
| 184 | }, 0.001, 0.0948379], |
---|
| 185 | |
---|
| 186 | # Additional tests with larger range of parameters |
---|
| 187 | [{'contrast_factor': 10.0, |
---|
| 188 | 'bjerrum_length': 100.0, |
---|
| 189 | 'virial_param': 3.0, |
---|
| 190 | 'monomer_length': 1.0, |
---|
| 191 | 'salt_concentration': 10.0, |
---|
| 192 | 'ionization_degree': 2.0, |
---|
| 193 | 'polymer_concentration': 10.0, |
---|
| 194 | 'background': 0.0, |
---|
| 195 | }, 0.1, -3.75693800588], |
---|
| 196 | |
---|
| 197 | [{'contrast_factor': 10.0, |
---|
| 198 | 'bjerrum_length': 100.0, |
---|
| 199 | 'virial_param': 3.0, |
---|
| 200 | 'monomer_length': 1.0, |
---|
| 201 | 'salt_concentration': 10.0, |
---|
| 202 | 'ionization_degree': 2.0, |
---|
| 203 | 'polymer_concentration': 10.0, |
---|
| 204 | 'background': 100.0 |
---|
| 205 | }, 5.0, 100.029142149], |
---|
| 206 | |
---|
| 207 | [{'contrast_factor': 100.0, |
---|
| 208 | 'bjerrum_length': 10.0, |
---|
| 209 | 'virial_param': 180.0, |
---|
| 210 | 'monomer_length': 1.0, |
---|
| 211 | 'salt_concentration': 0.1, |
---|
| 212 | 'ionization_degree': 0.5, |
---|
| 213 | 'polymer_concentration': 0.1, |
---|
| 214 | 'background': 0.0, |
---|
| 215 | }, 200., 1.80664667511e-06], |
---|
| 216 | ] |
---|