1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | //////////////////////////////////////////////// |
---|
4 | // Template: |
---|
5 | // 06 NOV 98 SRK |
---|
6 | //////////////////////////////////////////////// |
---|
7 | // Giovanni Nisato 30 Nov 1998 |
---|
8 | // Borue-Erukhimovich RPA for linear polyelectrolytes |
---|
9 | // references: Borue, V. Y.; Erukhimovich, I. Y. Macromolecules 1988, 21, 3240. |
---|
10 | // Joanny, J.-F.; Leibler, L. Journal de Physique 1990, 51, 545. |
---|
11 | // Moussaid, A.; Schosseler, F.; Munch, J.-P.; Candau, S. J. Journal de Physique II France 1993, 3, 573. |
---|
12 | //////////////////////////////////////////////// |
---|
13 | |
---|
14 | Proc PlotBE_Polyelectrolyte(num,qmin,qmax) |
---|
15 | Variable num=512,qmin=0.001,qmax=0.2 |
---|
16 | Prompt num "Enter number of data points for model: " |
---|
17 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
18 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
19 | |
---|
20 | make/o/n=(num) xwave_BE,ywave_BE |
---|
21 | xwave_BE = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
22 | make/o coef_BE = {10,7.1,12,10,0.00,0.05,0.7,0.001} |
---|
23 | make/o/t parameters_BE = {"K (barns)","Lb ()","h (-3)","b ()","Cs (mol/L)","alpha","C (mol/L)","Background"} |
---|
24 | Edit parameters_BE,coef_BE |
---|
25 | ywave_BE := BEPolyelectrolyte(coef_BE,xwave_BE) |
---|
26 | Display ywave_BE vs xwave_BE |
---|
27 | ModifyGraph log=0,marker=29,msize=2,mode=4 //**** log=0 if linear scale desired |
---|
28 | Label bottom "q (\\S-1\\M)" |
---|
29 | Label left "S(q) BE , cm\\S-1\\M" |
---|
30 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
31 | End |
---|
32 | |
---|
33 | /////////////////////////////////////////////////////////// |
---|
34 | |
---|
35 | Proc PlotSmearedBE_Polyelectrolyte() //**** name of your function |
---|
36 | //no input parameters necessary, it MUST use the experimental q-values |
---|
37 | // from the experimental data read in from an AVE/QSIG data file |
---|
38 | // if no gQvals wave, data must not have been loaded => abort |
---|
39 | if(ResolutionWavesMissing()) |
---|
40 | Abort |
---|
41 | endif |
---|
42 | |
---|
43 | // Setup parameter table for model function |
---|
44 | make/o smear_coef_BE = {10,7.1,12,10,0.00,0.05,0.7,0.001} //**** mod, coef values to match unsmeared model above |
---|
45 | make/o/t smear_parameters_BE= {"K (barns)","Lb ()","h (-3)","b ()","Cs (mol/L)","alpha","C (mol/L)","Background"} |
---|
46 | Edit smear_parameters_BE,smear_coef_BE //**** mod |
---|
47 | |
---|
48 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
49 | // make extra copy of experimental q-values for easy plotting |
---|
50 | Duplicate/O $gQvals smeared_BE,smeared_qvals //**** mod |
---|
51 | SetScale d,0,0,"1/cm",smeared_BE //**** mod |
---|
52 | |
---|
53 | smeared_BE := SmearedBEPolyelec(smear_coef_BE,$gQvals) //**** mod, your SMEARED function name |
---|
54 | Display smeared_BE vs smeared_qvals //**** mod |
---|
55 | ModifyGraph log=0,marker=29,msize=2,mode=4 |
---|
56 | Label bottom "q (\\S-1\\M)" |
---|
57 | Label left "I sBE (cm\\S-1\\M)" |
---|
58 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
59 | End |
---|
60 | |
---|
61 | /////////////////////////////////////////////////////////////// |
---|
62 | // unsmeared model calculation |
---|
63 | /////////////////////////// |
---|
64 | // Borue-Erukhimovich RPA model for linear polyelectrolytes |
---|
65 | /////////////////////////// |
---|
66 | |
---|
67 | |
---|
68 | Function BEPolyelectrolyte(w,q) : FitFunc |
---|
69 | Wave w |
---|
70 | Variable q |
---|
71 | // Input (fitting) variables are: |
---|
72 | //[0] K = contrast factor (barns = 10-24 cm^2=10-4 ^2) |
---|
73 | //[1] Lb = Bjerrum length ; this parameter needs to be kept constant for a given solvent and temperature! () |
---|
74 | //[2] h = virial parameter (3) |
---|
75 | //[3] b = monomer length () |
---|
76 | //[4] Cs = concentration of monovalent salt (mol/L) |
---|
77 | //[5] alpha = ionization degree : ratio of charged monomers to total number of monomers |
---|
78 | //[6] C = polymer molar concentration (mol/L) |
---|
79 | //[7] Bkd = Background |
---|
80 | // local variables |
---|
81 | Variable K,Lb,h,b,alpha,C,Ca,Cs,Csa,r02,K2,q2,Sq,Bkd |
---|
82 | K = w[0] |
---|
83 | Lb = w[1] |
---|
84 | h = w[2] |
---|
85 | b = w[3] |
---|
86 | Cs = w[4] |
---|
87 | alpha = w[5] |
---|
88 | C = w[6] |
---|
89 | Bkd =w[7] |
---|
90 | |
---|
91 | Ca = C *6.022136e-4 // polymer number concentration in angstroms-3 |
---|
92 | Csa = Cs * 6.022136e-4 // 1:1 salt concentration, angstroms-3 |
---|
93 | k2= 4*Pi*Lb*(2*Cs+alpha*Ca) // inverse Debye length, squared; classical definition |
---|
94 | |
---|
95 | // alternative definitionfor ANNEALED (weak) polyelectrolytes (e.g. : polyacrylic acid): |
---|
96 | // k2= 4*Pi*Lb*(2*Cs+2*alpha*Ca) |
---|
97 | // reference: Raphal, E.; Joanny, J.-F. Europhysics Letters 1990, 11, 179. |
---|
98 | |
---|
99 | r02 = 1./alpha / Ca^0.5*( b / (48*Pi*Lb) ^0.5 ) |
---|
100 | q2 = q^2 |
---|
101 | |
---|
102 | |
---|
103 | // K = a^2 with: a = (bp - vp/vsolvent * bsolvent) |
---|
104 | // where : b = Sum(batom) ; batom = scattering length in cm-12 |
---|
105 | // vp = partial molar volume of the polymer ; vsolvent= partial molar volume of the solvent |
---|
106 | // NB :K in Barns = 10^-24 cm2 ; the rest of the expression is in -3 = 10^24 cm3 |
---|
107 | // -> there is no multiplication factor to get the result in cm-1 . |
---|
108 | // Returns S(q) in cm-1 |
---|
109 | |
---|
110 | Sq = K*1./(4*Pi*Lb*alpha^2) * (q2 + k2) / (1+(r02^2) * (q2+k2) * (q2- (12*h*Ca/b^2)) ) + Bkd |
---|
111 | |
---|
112 | Return (Sq) |
---|
113 | End |
---|
114 | //End of function BE() |
---|
115 | /////////////////////////////////////////////////////////////// |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | /////////////////////////////////////////////////////////////// |
---|
120 | // smeared model calculation |
---|
121 | /////////////////////////// |
---|
122 | |
---|
123 | // this is all there is to the smeared calculation! |
---|
124 | Function SmearedBEPolyelec(w,x) :FitFunc |
---|
125 | Wave w |
---|
126 | Variable x |
---|
127 | |
---|
128 | Variable ans |
---|
129 | SVAR sq = gSig_Q |
---|
130 | SVAR qb = gQ_bar |
---|
131 | SVAR sh = gShadow |
---|
132 | SVAR gQ = gQVals |
---|
133 | |
---|
134 | //the name of your unsmeared model is the first argument |
---|
135 | ans = Smear_Model_20(BEPolyelectrolyte,$sq,$qb,$sh,$gQ,w,x) |
---|
136 | |
---|
137 | return(ans) |
---|
138 | End |
---|
139 | |
---|
140 | |
---|
141 | |
---|