1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | // be sure to include all the necessary files... |
---|
4 | |
---|
5 | #include "Sphere" |
---|
6 | |
---|
7 | #include "HardSphereStruct" |
---|
8 | #include "HPMSA" |
---|
9 | #include "SquareWellStruct" |
---|
10 | #include "StickyHardSphereStruct" |
---|
11 | |
---|
12 | Proc PlotSphere_HS(num,qmin,qmax) |
---|
13 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
14 | Prompt num "Enter number of data points for model: " |
---|
15 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
16 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
17 | |
---|
18 | //make the normal model waves |
---|
19 | Make/O/D/n=(num) xwave_S_HS,ywave_S_HS |
---|
20 | xwave_S_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
21 | Make/O/D coef_S_HS = {0.1,60,1e-6,0.01} |
---|
22 | make/o/t parameters_S_HS = {"volume fraction","Radius (A)","contrast (-2)","bkgd (cm-1)"} |
---|
23 | Edit/K=1 parameters_S_HS,coef_S_HS |
---|
24 | ywave_S_HS := Sphere_HS(coef_S_HS,xwave_S_HS) |
---|
25 | Display/K=1 ywave_S_HS vs xwave_S_HS |
---|
26 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
27 | Label bottom "q (\\S-1\\M)" |
---|
28 | Label left "Intensity (cm\\S-1\\M)" |
---|
29 | |
---|
30 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
31 | End |
---|
32 | |
---|
33 | Proc PlotSmearedSphere_HS() |
---|
34 | //no input parameters necessary, it MUST use the experimental q-values |
---|
35 | // from the experimental data read in from an AVE/QSIG data file |
---|
36 | |
---|
37 | // if no gQvals wave, data must not have been loaded => abort |
---|
38 | if(ResolutionWavesMissing()) |
---|
39 | Abort |
---|
40 | endif |
---|
41 | |
---|
42 | // Setup parameter table for model function |
---|
43 | Make/O/D smear_coef_S_HS = {0.1,60,1e-6,0.01} |
---|
44 | make/o/t smear_parameters_S_HS = {"volume fraction","Radius (A)","contrast (-2)","bkgd (cm-1)"} |
---|
45 | Edit smear_parameters_S_HS,smear_coef_S_HS |
---|
46 | |
---|
47 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
48 | // make extra copy of experimental q-values for easy plotting |
---|
49 | Duplicate/O $gQvals smeared_S_HS,smeared_qvals |
---|
50 | SetScale d,0,0,"1/cm",smeared_S_HS |
---|
51 | |
---|
52 | smeared_S_HS := SmearedSphere_HS(smear_coef_S_HS,$gQvals) |
---|
53 | Display smeared_S_HS vs smeared_qvals |
---|
54 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
55 | Label bottom "q (\\S-1\\M)" |
---|
56 | Label left "Intensity (cm\\S-1\\M)" |
---|
57 | |
---|
58 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
59 | End |
---|
60 | |
---|
61 | Function Sphere_HS(w,x) : FitFunc |
---|
62 | Wave w |
---|
63 | Variable x |
---|
64 | |
---|
65 | Variable inten |
---|
66 | |
---|
67 | //setup form factor coefficient wave |
---|
68 | Make/O/D/N=4 form_S_HS |
---|
69 | form_S_HS[0] = 1 |
---|
70 | form_S_HS[1] = w[1] |
---|
71 | form_S_HS[2] = w[2] |
---|
72 | form_S_HS[3] = 0 |
---|
73 | |
---|
74 | //setup structure factor coefficient wave |
---|
75 | Make/O/D/N=2 struct_S_HS |
---|
76 | struct_S_HS[0] = w[1] |
---|
77 | struct_S_HS[1] = w[0] |
---|
78 | |
---|
79 | //calculate each and combine |
---|
80 | inten = SphereForm(form_S_HS,x) |
---|
81 | inten *= HardSphereStruct(struct_S_HS,x) |
---|
82 | inten *= w[0] |
---|
83 | inten += w[3] |
---|
84 | |
---|
85 | //cleanup waves |
---|
86 | //Killwaves/Z form_S_HS,struct_S_HS |
---|
87 | |
---|
88 | return (inten) |
---|
89 | End |
---|
90 | |
---|
91 | ///////////////////////////////// |
---|
92 | Proc PlotSphere_SW(num,qmin,qmax) |
---|
93 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
94 | Prompt num "Enter number of data points for model: " |
---|
95 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
96 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
97 | |
---|
98 | /// |
---|
99 | Make/O/D/N=4 form_S_SW |
---|
100 | Make/O/D/N=4 struct_S_SW |
---|
101 | /// |
---|
102 | Make/O/D/n=(num) xwave_S_SW,ywave_S_SW |
---|
103 | xwave_S_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
104 | Make/O/D coef_S_SW = {0.1,60,1e-6,1.0,1.2,0.01} |
---|
105 | make/o/t parameters_S_SW = {"volume fraction","Radius (A)","contrast (-2)","well depth (kT)","well width (diam.)","bkgd (cm-1)"} |
---|
106 | Edit/K=1 parameters_S_SW,coef_S_SW |
---|
107 | ywave_S_SW := Sphere_SW(coef_S_SW,xwave_S_SW) |
---|
108 | Display/K=1 ywave_S_SW vs xwave_S_SW |
---|
109 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
110 | Label bottom "q (\\S-1\\M)" |
---|
111 | Label left "Intensity (cm\\S-1\\M)" |
---|
112 | |
---|
113 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
114 | End |
---|
115 | |
---|
116 | Proc PlotSmearedSphere_SW() |
---|
117 | //no input parameters necessary, it MUST use the experimental q-values |
---|
118 | // from the experimental data read in from an AVE/QSIG data file |
---|
119 | |
---|
120 | // if no gQvals wave, data must not have been loaded => abort |
---|
121 | if(ResolutionWavesMissing()) |
---|
122 | Abort |
---|
123 | endif |
---|
124 | |
---|
125 | // Setup parameter table for model function |
---|
126 | Make/O/D smear_coef_S_SW = {0.1,60,1e-6,1.0,1.2,0.01} |
---|
127 | make/o/t smear_parameters_S_SW = {"volume fraction","Radius (A)","contrast (-2)","well depth (kT)","well width (diam.)","bkgd (cm-1)"} |
---|
128 | Edit smear_parameters_S_SW,smear_coef_S_SW |
---|
129 | |
---|
130 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
131 | // make extra copy of experimental q-values for easy plotting |
---|
132 | Duplicate/O $gQvals smeared_S_SW,smeared_qvals |
---|
133 | SetScale d,0,0,"1/cm",smeared_S_SW |
---|
134 | |
---|
135 | smeared_S_SW := SmearedSphere_SW(smear_coef_S_SW,$gQvals) |
---|
136 | Display smeared_S_SW vs smeared_qvals |
---|
137 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
138 | Label bottom "q (\\S-1\\M)" |
---|
139 | Label left "Intensity (cm\\S-1\\M)" |
---|
140 | |
---|
141 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
142 | End |
---|
143 | |
---|
144 | Function Sphere_SW(w,x) : FitFunc |
---|
145 | Wave w |
---|
146 | Variable x |
---|
147 | |
---|
148 | Variable inten |
---|
149 | |
---|
150 | //setup form factor coefficient wave |
---|
151 | Make/O/D/N=4 form_S_SW |
---|
152 | form_S_SW[0] = 1 |
---|
153 | form_S_SW[1] = w[1] |
---|
154 | form_S_SW[2] = w[2] |
---|
155 | form_S_SW[3] = 0 |
---|
156 | |
---|
157 | //setup structure factor coefficient wave |
---|
158 | Make/O/D/N=4 struct_S_SW |
---|
159 | struct_S_SW[0] = w[1] |
---|
160 | struct_S_SW[1] = w[0] |
---|
161 | struct_S_SW[2] = w[3] |
---|
162 | struct_S_SW[3] = w[4] |
---|
163 | |
---|
164 | //calculate each and combine |
---|
165 | inten = SphereForm(form_S_SW,x) |
---|
166 | inten *= SquareWellStruct(struct_S_SW,x) |
---|
167 | inten *= w[0] |
---|
168 | inten += w[5] |
---|
169 | |
---|
170 | //cleanup waves |
---|
171 | //Killwaves/Z form_S_SW,struct_S_SW |
---|
172 | |
---|
173 | return (inten) |
---|
174 | End |
---|
175 | |
---|
176 | ///////////////////////////////// |
---|
177 | Proc PlotSphere_SC(num,qmin,qmax) |
---|
178 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
179 | Prompt num "Enter number of data points for model: " |
---|
180 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
181 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
182 | |
---|
183 | if (DataFolderExists("root:HayPenMSA")) |
---|
184 | Make/O/D/N=17 root:HayPenMSA:gMSAWave |
---|
185 | else |
---|
186 | NewDataFolder root:HayPenMSA |
---|
187 | Make/O/D/N=17 root:HayPenMSA:gMSAWave |
---|
188 | endif |
---|
189 | |
---|
190 | /// |
---|
191 | Make/O/D/n=(num) xwave_S_SC,ywave_S_SC |
---|
192 | xwave_S_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
193 | Make/O/D coef_S_SC = {0.2,50,3e-6,20,0,298,78,0.0001} |
---|
194 | make/o/t parameters_S_SC = {"volume fraction","Radius (A)","contrast (-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkgd (cm-1)"} |
---|
195 | Edit/K=1 parameters_S_SC,coef_S_SC |
---|
196 | ywave_S_SC := Sphere_SC(coef_S_SC,xwave_S_SC) |
---|
197 | Display/K=1 ywave_S_SC vs xwave_S_SC |
---|
198 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
199 | Label bottom "q (\\S-1\\M)" |
---|
200 | Label left "Intensity (cm\\S-1\\M)" |
---|
201 | |
---|
202 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
203 | End |
---|
204 | |
---|
205 | Proc PlotSmearedSphere_SC() |
---|
206 | //no input parameters necessary, it MUST use the experimental q-values |
---|
207 | // from the experimental data read in from an AVE/QSIG data file |
---|
208 | |
---|
209 | // if no gQvals wave, data must not have been loaded => abort |
---|
210 | if(ResolutionWavesMissing()) |
---|
211 | Abort |
---|
212 | endif |
---|
213 | |
---|
214 | if (DataFolderExists("root:HayPenMSA")) |
---|
215 | Make/O/D/N=17 root:HayPenMSA:gMSAWave |
---|
216 | else |
---|
217 | NewDataFolder root:HayPenMSA |
---|
218 | Make/O/D/N=17 root:HayPenMSA:gMSAWave |
---|
219 | endif |
---|
220 | |
---|
221 | // Setup parameter table for model function |
---|
222 | Make/O/D smear_coef_S_SC = {0.2,50,3e-6,20,0,298,78,0.0001} |
---|
223 | make/o/t smear_parameters_S_SC = {"volume fraction","Radius (A)","contrast (-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkgd (cm-1)"} |
---|
224 | Edit smear_parameters_S_SC,smear_coef_S_SC |
---|
225 | |
---|
226 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
227 | // make extra copy of experimental q-values for easy plotting |
---|
228 | Duplicate/O $gQvals smeared_S_SC,smeared_qvals |
---|
229 | SetScale d,0,0,"1/cm",smeared_S_SC |
---|
230 | |
---|
231 | smeared_S_SC := SmearedSphere_SC(smear_coef_S_SC,$gQvals) |
---|
232 | Display smeared_S_SC vs smeared_qvals |
---|
233 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
234 | Label bottom "q (\\S-1\\M)" |
---|
235 | Label left "Intensity (cm\\S-1\\M)" |
---|
236 | |
---|
237 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
238 | End |
---|
239 | |
---|
240 | Function Sphere_SC(w,x) : FitFunc |
---|
241 | Wave w |
---|
242 | Variable x |
---|
243 | |
---|
244 | // Variable timer=StartMSTimer |
---|
245 | Variable inten |
---|
246 | |
---|
247 | //setup form factor coefficient wave |
---|
248 | Make/O/D/N=4 form_S_SC |
---|
249 | form_S_SC[0] = 1 |
---|
250 | form_S_SC[1] = w[1] |
---|
251 | form_S_SC[2] = w[2] |
---|
252 | form_S_SC[3] = 0 |
---|
253 | |
---|
254 | //setup structure factor coefficient wave |
---|
255 | Make/O/D/N=6 struct_S_SC |
---|
256 | struct_S_SC[0] = 2*w[1] //diameter |
---|
257 | struct_S_SC[1] = w[3] |
---|
258 | struct_S_SC[2] = w[0] |
---|
259 | struct_S_SC[3] = w[5] |
---|
260 | struct_S_SC[4] = w[4] |
---|
261 | struct_S_SC[5] = w[6] |
---|
262 | |
---|
263 | //calculate each and combine |
---|
264 | inten = SphereForm(form_S_SC,x) |
---|
265 | inten *= HayterPenfoldMSA(struct_S_SC,x) |
---|
266 | inten *= w[0] |
---|
267 | inten += w[7] |
---|
268 | |
---|
269 | //cleanup waves |
---|
270 | //Killwaves/Z form_S_SC,struct_S_SC |
---|
271 | //Print "ps elapsed time = ",StopMSTimer(timer) |
---|
272 | return (inten) |
---|
273 | End |
---|
274 | |
---|
275 | ///////////////////////////////// |
---|
276 | Proc PlotSphere_SHS(num,qmin,qmax) |
---|
277 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
278 | Prompt num "Enter number of data points for model: " |
---|
279 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
280 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
281 | |
---|
282 | /// |
---|
283 | Make/O/D/N=4 form_S_SHS |
---|
284 | Make/O/D/N=4 struct_S_SHS |
---|
285 | /// |
---|
286 | Make/O/D/n=(num) xwave_S_SHS,ywave_S_SHS |
---|
287 | xwave_S_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
288 | Make/O/D coef_S_SHS = {0.1,60,1e-6,0.05,0.2,0.01} |
---|
289 | make/o/t parameters_S_SHS = {"volume fraction","Radius (A)","contrast (-2)","perturbation parameter (0.1)","stickiness, tau","bkgd (cm-1)"} |
---|
290 | Edit/K=1 parameters_S_SHS,coef_S_SHS |
---|
291 | ywave_S_SHS := Sphere_SHS(coef_S_SHS,xwave_S_SHS) |
---|
292 | Display/K=1 ywave_S_SHS vs xwave_S_SHS |
---|
293 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
294 | Label bottom "q (\\S-1\\M)" |
---|
295 | Label left "Intensity (cm\\S-1\\M)" |
---|
296 | |
---|
297 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
298 | End |
---|
299 | |
---|
300 | Proc PlotSmearedSphere_SHS() |
---|
301 | //no input parameters necessary, it MUST use the experimental q-values |
---|
302 | // from the experimental data read in from an AVE/QSIG data file |
---|
303 | |
---|
304 | // if no gQvals wave, data must not have been loaded => abort |
---|
305 | if(ResolutionWavesMissing()) |
---|
306 | Abort |
---|
307 | endif |
---|
308 | |
---|
309 | // Setup parameter table for model function |
---|
310 | Make/O/D smear_coef_S_SHS = {0.1,60,1e-6,0.05,0.2,0.01} |
---|
311 | make/o/t smear_parameters_S_SHS = {"volume fraction","Radius (A)","contrast (-2)","perturbation parameter (0.1)","stickiness, tau","bkgd (cm-1)"} |
---|
312 | Edit smear_parameters_S_SHS,smear_coef_S_SHS |
---|
313 | |
---|
314 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
315 | // make extra copy of experimental q-values for easy plotting |
---|
316 | Duplicate/O $gQvals smeared_S_SHS,smeared_qvals |
---|
317 | SetScale d,0,0,"1/cm",smeared_S_SHS |
---|
318 | |
---|
319 | smeared_S_SHS := SmearedSphere_SHS(smear_coef_S_SHS,$gQvals) |
---|
320 | Display smeared_S_SHS vs smeared_qvals |
---|
321 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
322 | Label bottom "q (\\S-1\\M)" |
---|
323 | Label left "Intensity (cm\\S-1\\M)" |
---|
324 | |
---|
325 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
326 | End |
---|
327 | |
---|
328 | Function Sphere_SHS(w,x) : FitFunc |
---|
329 | Wave w |
---|
330 | Variable x |
---|
331 | |
---|
332 | Variable inten |
---|
333 | |
---|
334 | //setup form factor coefficient wave |
---|
335 | Make/O/D/N=4 form_S_SHS |
---|
336 | form_S_SHS[0] = 1 |
---|
337 | form_S_SHS[1] = w[1] |
---|
338 | form_S_SHS[2] = w[2] |
---|
339 | form_S_SHS[3] = 0 |
---|
340 | |
---|
341 | //setup structure factor coefficient wave |
---|
342 | Make/O/D/N=4 struct_S_SHS |
---|
343 | struct_S_SHS[0] = w[1] |
---|
344 | struct_S_SHS[1] = w[0] |
---|
345 | struct_S_SHS[2] = w[3] |
---|
346 | struct_S_SHS[3] = w[4] |
---|
347 | |
---|
348 | //calculate each and combine |
---|
349 | inten = SphereForm(form_S_SHS,x) |
---|
350 | inten *= StickyHS_Struct(struct_S_SHS,x) |
---|
351 | inten *= w[0] |
---|
352 | inten += w[5] |
---|
353 | |
---|
354 | //cleanup waves |
---|
355 | //Killwaves/Z form_S_SHS,struct_S_SHS |
---|
356 | |
---|
357 | return (inten) |
---|
358 | End |
---|
359 | |
---|
360 | |
---|
361 | |
---|
362 | // this is all there is to the smeared calculation! |
---|
363 | Function SmearedSphere_HS(w,x) :FitFunc |
---|
364 | Wave w |
---|
365 | Variable x |
---|
366 | |
---|
367 | Variable ans |
---|
368 | SVAR sq = gSig_Q |
---|
369 | SVAR qb = gQ_bar |
---|
370 | SVAR sh = gShadow |
---|
371 | SVAR gQ = gQVals |
---|
372 | |
---|
373 | //the name of your unsmeared model is the first argument |
---|
374 | ans = Smear_Model_20(Sphere_HS,$sq,$qb,$sh,$gQ,w,x) |
---|
375 | |
---|
376 | return(ans) |
---|
377 | End |
---|
378 | |
---|
379 | // this is all there is to the smeared calculation! |
---|
380 | Function SmearedSphere_SW(w,x) :FitFunc |
---|
381 | Wave w |
---|
382 | Variable x |
---|
383 | |
---|
384 | Variable ans |
---|
385 | SVAR sq = gSig_Q |
---|
386 | SVAR qb = gQ_bar |
---|
387 | SVAR sh = gShadow |
---|
388 | SVAR gQ = gQVals |
---|
389 | |
---|
390 | //the name of your unsmeared model is the first argument |
---|
391 | ans = Smear_Model_20(Sphere_SW,$sq,$qb,$sh,$gQ,w,x) |
---|
392 | |
---|
393 | return(ans) |
---|
394 | End |
---|
395 | |
---|
396 | // this is all there is to the smeared calculation! |
---|
397 | Function SmearedSphere_SC(w,x) :FitFunc |
---|
398 | Wave w |
---|
399 | Variable x |
---|
400 | |
---|
401 | Variable ans |
---|
402 | SVAR sq = gSig_Q |
---|
403 | SVAR qb = gQ_bar |
---|
404 | SVAR sh = gShadow |
---|
405 | SVAR gQ = gQVals |
---|
406 | |
---|
407 | //the name of your unsmeared model is the first argument |
---|
408 | ans = Smear_Model_20(Sphere_SC,$sq,$qb,$sh,$gQ,w,x) |
---|
409 | |
---|
410 | return(ans) |
---|
411 | End |
---|
412 | |
---|
413 | // this is all there is to the smeared calculation! |
---|
414 | Function SmearedSphere_SHS(w,x) :FitFunc |
---|
415 | Wave w |
---|
416 | Variable x |
---|
417 | |
---|
418 | Variable ans |
---|
419 | SVAR sq = gSig_Q |
---|
420 | SVAR qb = gQ_bar |
---|
421 | SVAR sh = gShadow |
---|
422 | SVAR gQ = gQVals |
---|
423 | |
---|
424 | //the name of your unsmeared model is the first argument |
---|
425 | ans = Smear_Model_20(Sphere_SHS,$sq,$qb,$sh,$gQ,w,x) |
---|
426 | |
---|
427 | return(ans) |
---|
428 | End |
---|