[97cb037] | 1 | r""" |
---|
| 2 | This model calculates the structure factor of a polyelectrolyte solution with |
---|
| 3 | the RPA expression derived by Borue and Erukhimovich. |
---|
| 4 | |
---|
| 5 | Definition |
---|
| 6 | ---------- |
---|
| 7 | |
---|
| 8 | The scattering intensity $I(q)$ is calculated as |
---|
| 9 | |
---|
| 10 | .. math:: |
---|
| 11 | |
---|
| 12 | I(q) = K\frac{q^2+k^2}{4\pi L\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(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 | |
---|
| 19 | where $K$ is the contrast factor for the polymer, $L_b$ is the Bjerrum length, |
---|
| 20 | $h$ is the virial parameter, $b$ is the monomer length, |
---|
| 21 | $C_s$ is the concentration of monovalent salt, $\alpha$ is the ionization |
---|
| 22 | degree, $C_a$ is the polymer molar concentration, and $background$ is the |
---|
| 23 | incoherent background. |
---|
| 24 | |
---|
| 25 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
| 26 | where the $q$ vector is defined as |
---|
| 27 | |
---|
| 28 | .. math:: |
---|
| 29 | |
---|
| 30 | q = \sqrt{q_x^2 + q_y^2} |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | .. figure:: img/be_polyelectrolyte_1d.jpg |
---|
| 34 | |
---|
| 35 | 1D plot using the default values (w/500 data point). |
---|
| 36 | |
---|
| 37 | NB: $1 barn = 10^{-24} cm^2$ |
---|
| 38 | |
---|
| 39 | References |
---|
| 40 | ---------- |
---|
| 41 | |
---|
| 42 | V Y Borue, I Y Erukhimovich, *Macromolecules*, 21 (1988) 3240 |
---|
| 43 | |
---|
| 44 | J F Joanny, L Leibler, *Journal de Physique*, 51 (1990) 545 |
---|
| 45 | |
---|
[168052c] | 46 | A Moussaid, F Schosseler, J P Munch, S Candau, |
---|
| 47 | *J. Journal de Physique II France*, 3 (1993) 573 |
---|
[97cb037] | 48 | |
---|
| 49 | E Raphael, J F Joanny, *Europhysics Letters*, 11 (1990) 179 |
---|
| 50 | |
---|
| 51 | """ |
---|
| 52 | |
---|
[168052c] | 53 | from numpy import inf, pi, sqrt |
---|
[97cb037] | 54 | |
---|
| 55 | name = "be_polyelectrolyte" |
---|
| 56 | title = "Polyelectrolyte with the RPA expression derived by Borue and Erukhimovich" |
---|
| 57 | description = """ |
---|
| 58 | Evaluate |
---|
| 59 | F(x) = K 1/(4 pi Lb (alpha)^(2)) (q^(2)+k2)/(1+(r02)^(2)) |
---|
| 60 | (q^(2)+k2) (q^(2)-(12 h C/b^(2))) |
---|
| 61 | |
---|
| 62 | has 3 internal parameters : |
---|
| 63 | The inverse Debye Length: K2 = 4 pi Lb (2 Cs+alpha C) |
---|
| 64 | r02 =1/alpha/Ca^(0.5) (B/(48 pi Lb)^(0.5)) |
---|
| 65 | Ca = 6.022136e-4 C |
---|
| 66 | """ |
---|
| 67 | category = "shape-independent" |
---|
| 68 | |
---|
[168052c] | 69 | # pylint: disable=bad-whitespace, line-too-long |
---|
| 70 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 71 | parameters = [ |
---|
| 72 | ["contrast_factor", "barns", 10.0, [-inf, inf], "", "Contrast factor of the polymer"], |
---|
| 73 | ["bjerrum_length", "Ang", 7.1, [0, inf], "", "Bjerrum length"], |
---|
| 74 | ["virial_param", "1/Ang^2", 12.0, [-inf, inf], "", "Virial parameter"], |
---|
| 75 | ["monomer_length", "Ang", 10.0, [0, inf], "", "Monomer length"], |
---|
| 76 | ["salt_concentration", "mol/L", 0.0, [-inf, inf], "", "Concentration of monovalent salt"], |
---|
| 77 | ["ionization_degree", "", 0.05, [0, inf], "", "Degree of ionization"], |
---|
| 78 | ["polymer_concentration", "mol/L", 0.7, [0, inf], "", "Polymer molar concentration"], |
---|
| 79 | ] |
---|
| 80 | # pylint: enable=bad-whitespace, line-too-long |
---|
[97cb037] | 81 | |
---|
| 82 | |
---|
| 83 | def Iq(q, |
---|
[168052c] | 84 | contrast_factor=10.0, |
---|
| 85 | bjerrum_length=7.1, |
---|
| 86 | virial_param=12.0, |
---|
| 87 | monomer_length=10.0, |
---|
| 88 | salt_concentration=0.0, |
---|
| 89 | ionization_degree=0.05, |
---|
| 90 | polymer_concentration=0.7): |
---|
| 91 | """ |
---|
| 92 | :param q: Input q-value |
---|
| 93 | :param contrast_factor: Contrast factor of the polymer |
---|
| 94 | :param bjerrum_length: Bjerrum length |
---|
| 95 | :param virial_param: Virial parameter |
---|
| 96 | :param monomer_length: Monomer length |
---|
| 97 | :param salt_concentration: Concentration of monovalent salt |
---|
| 98 | :param ionization_degree: Degree of ionization |
---|
| 99 | :param polymer_concentration: Polymer molar concentration |
---|
| 100 | :return: 1-D intensity |
---|
| 101 | """ |
---|
[97cb037] | 102 | |
---|
| 103 | concentration = polymer_concentration * 6.022136e-4 |
---|
| 104 | |
---|
| 105 | k_square = 4.0 * pi * bjerrum_length * (2*salt_concentration + |
---|
[168052c] | 106 | ionization_degree * concentration) |
---|
[97cb037] | 107 | |
---|
| 108 | r0_square = 1.0/ionization_degree/sqrt(concentration) * \ |
---|
[168052c] | 109 | (monomer_length/sqrt((48.0*pi*bjerrum_length))) |
---|
[97cb037] | 110 | |
---|
| 111 | term1 = contrast_factor/(4.0 * pi * bjerrum_length * |
---|
[168052c] | 112 | ionization_degree**2) * (q**2 + k_square) |
---|
[97cb037] | 113 | |
---|
| 114 | term2 = 1.0 + r0_square**2 * (q**2 + k_square) * \ |
---|
| 115 | (q**2 - (12.0 * virial_param * concentration/(monomer_length**2))) |
---|
| 116 | |
---|
| 117 | return term1/term2 |
---|
| 118 | |
---|
| 119 | Iq.vectorized = True # Iq accepts an array of q values |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | def Iqxy(qx, qy, *args): |
---|
[168052c] | 123 | """ |
---|
| 124 | :param qx: Input q_x-value |
---|
| 125 | :param qy: Input q_y-value |
---|
| 126 | :param args: Remaining arguments |
---|
| 127 | :return: 2D-Intensity |
---|
| 128 | """ |
---|
| 129 | iq = Iq(sqrt(qx**2 + qy**2), *args) |
---|
| 130 | return iq |
---|
[97cb037] | 131 | |
---|
| 132 | Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | demo = dict(scale=1, background=0.1, |
---|
| 136 | contrast_factor=10.0, |
---|
| 137 | bjerrum_length=7.1, |
---|
| 138 | virial_param=12.0, |
---|
| 139 | monomer_length=10.0, |
---|
| 140 | salt_concentration=0.0, |
---|
| 141 | ionization_degree=0.05, |
---|
| 142 | polymer_concentration=0.7) |
---|
| 143 | |
---|
| 144 | oldname = "BEPolyelectrolyte" |
---|
| 145 | |
---|
| 146 | oldpars = dict(background='background', |
---|
| 147 | contrast_factor='k', |
---|
| 148 | bjerrum_length='lb', |
---|
| 149 | virial_param='h', |
---|
| 150 | monomer_length='b', |
---|
| 151 | salt_concentration='cs', |
---|
| 152 | ionization_degree='alpha', |
---|
| 153 | polymer_concentration='c') |
---|
| 154 | |
---|
[07a6700] | 155 | tests = [ |
---|
[168052c] | 156 | |
---|
| 157 | # Accuracy tests based on content in test/utest_other_models.py |
---|
| 158 | [{'contrast_factor': 10.0, |
---|
| 159 | 'bjerrum_length': 7.1, |
---|
| 160 | 'virial_param': 12.0, |
---|
| 161 | 'monomer_length': 10.0, |
---|
| 162 | 'salt_concentration': 0.0, |
---|
| 163 | 'ionization_degree': 0.05, |
---|
| 164 | 'polymer_concentration': 0.7, |
---|
| 165 | 'background': 0.001, |
---|
| 166 | }, 0.001, 0.0948379], |
---|
| 167 | |
---|
| 168 | # Additional tests with larger range of parameters |
---|
| 169 | [{'contrast_factor': 10.0, |
---|
| 170 | 'bjerrum_length': 100.0, |
---|
| 171 | 'virial_param': 3.0, |
---|
| 172 | 'monomer_length': 1.0, |
---|
| 173 | 'salt_concentration': 10.0, |
---|
| 174 | 'ionization_degree': 2.0, |
---|
| 175 | 'polymer_concentration': 10.0, |
---|
| 176 | }, 0.1, -3.75693800588], |
---|
| 177 | |
---|
| 178 | [{'contrast_factor': 10.0, |
---|
| 179 | 'bjerrum_length': 100.0, |
---|
| 180 | 'virial_param': 3.0, |
---|
| 181 | 'monomer_length': 1.0, |
---|
| 182 | 'salt_concentration': 10.0, |
---|
| 183 | 'ionization_degree': 2.0, |
---|
| 184 | 'polymer_concentration': 10.0, |
---|
| 185 | 'background': 100.0 |
---|
| 186 | }, 5.0, 100.029142149], |
---|
| 187 | |
---|
| 188 | [{'contrast_factor': 100.0, |
---|
| 189 | 'bjerrum_length': 10.0, |
---|
| 190 | 'virial_param': 180.0, |
---|
| 191 | 'monomer_length': 1.0, |
---|
| 192 | 'salt_concentration': 0.1, |
---|
| 193 | 'ionization_degree': 0.5, |
---|
| 194 | 'polymer_concentration': 0.1, |
---|
| 195 | }, 200., 1.80664667511e-06], |
---|
| 196 | ] |
---|