1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion=6.1 |
---|
3 | |
---|
4 | |
---|
5 | // plots the form factor of spheres with a Gaussian radius distribution |
---|
6 | // and a fuzzy surface |
---|
7 | // |
---|
8 | // M. Stieger, J. S. Pedersen, P. Lindner, W. Richtering, Langmuir 20 (2004) 7283-7292. |
---|
9 | // |
---|
10 | // potentially a lorentzian could be added to the low Q, if absolutely necessary |
---|
11 | // |
---|
12 | // SRK JUL 2009 |
---|
13 | // |
---|
14 | // Use different volume fraction and radius for hard sphere interaction as Stieger et al. |
---|
15 | // |
---|
16 | // |
---|
17 | // AJJ Feb 2010 |
---|
18 | |
---|
19 | |
---|
20 | // |
---|
21 | // be sure to include all of the necessary files |
---|
22 | // |
---|
23 | #include "FuzzySpheres_v40" |
---|
24 | |
---|
25 | #include "HardSphereStruct_v40" |
---|
26 | #include "HPMSA_v40" |
---|
27 | #include "SquareWellStruct_v40" |
---|
28 | #include "StickyHardSphereStruct_v40" |
---|
29 | |
---|
30 | Proc PlotFuzzySphere_HS(num,qmin,qmax) |
---|
31 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
32 | Prompt num "Enter number of data points for model: " |
---|
33 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
34 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
35 | |
---|
36 | Make/O/D/N=(num) xwave_fuzz_HS,ywave_fuzz_HS |
---|
37 | xwave_fuzz_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
38 | Make/O/D coef_fuzz_HS = {0.01,60,0.2,10,1e-6,3e-6,0.001} |
---|
39 | make/O/T parameters_fuzz_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} |
---|
40 | Edit parameters_fuzz_HS,coef_fuzz_HS |
---|
41 | |
---|
42 | Variable/G root:g_fuzz_HS |
---|
43 | g_fuzz_HS := FuzzySphere_HS(coef_fuzz_HS,ywave_fuzz_HS,xwave_fuzz_HS) |
---|
44 | Display ywave_fuzz_HS vs xwave_fuzz_HS |
---|
45 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
46 | Label bottom "q (A\\S-1\\M)" |
---|
47 | Label left "Intensity (cm\\S-1\\M)" |
---|
48 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
49 | |
---|
50 | AddModelToStrings("FuzzySphere_HS","coef_fuzz_HS","parameters_fuzz_HS","fuzz_HS") |
---|
51 | End |
---|
52 | |
---|
53 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
54 | Proc PlotSmearedFuzzySphere_HS(str) |
---|
55 | String str |
---|
56 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
57 | |
---|
58 | // if any of the resolution waves are missing => abort |
---|
59 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
60 | Abort |
---|
61 | endif |
---|
62 | |
---|
63 | SetDataFolder $("root:"+str) |
---|
64 | |
---|
65 | // Setup parameter table for model function |
---|
66 | Make/O/D smear_coef_fuzz_HS = {0.01,60,0.2,10,1e-6,3e-6,0.001} |
---|
67 | make/o/t smear_parameters_fuzz_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} |
---|
68 | Edit smear_parameters_fuzz_HS,smear_coef_fuzz_HS |
---|
69 | |
---|
70 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
71 | // make extra copy of experimental q-values for easy plotting |
---|
72 | Duplicate/O $(str+"_q") smeared_fuzz_HS,smeared_qvals |
---|
73 | SetScale d,0,0,"1/cm",smeared_fuzz_HS |
---|
74 | |
---|
75 | Variable/G gs_fuzz_HS=0 |
---|
76 | gs_fuzz_HS := fSmearedFuzzySphere_HS(smear_coef_fuzz_HS,smeared_fuzz_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
77 | |
---|
78 | Display smeared_fuzz_HS vs smeared_qvals |
---|
79 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
80 | Label bottom "q (A\\S-1\\M)" |
---|
81 | Label left "Intensity (cm\\S-1\\M)" |
---|
82 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
83 | |
---|
84 | SetDataFolder root: |
---|
85 | AddModelToStrings("SmearedFuzzySphere_HS","smear_coef_fuzz_HS","smear_parameters_fuzz_HS","fuzz_HS") |
---|
86 | End |
---|
87 | |
---|
88 | |
---|
89 | |
---|
90 | Function FuzzySphere_HS(w,yw,xw) : FitFunc |
---|
91 | Wave w,yw,xw |
---|
92 | |
---|
93 | Variable inten |
---|
94 | |
---|
95 | //setup form factor coefficient wave |
---|
96 | Make/O/D/N=7 form_fuzz_HS |
---|
97 | form_fuzz_HS[0] = 1 |
---|
98 | form_fuzz_HS[1] = w[1] |
---|
99 | form_fuzz_HS[2] = w[2] |
---|
100 | form_fuzz_HS[3] = w[3] |
---|
101 | form_fuzz_HS[4] = w[4] |
---|
102 | form_fuzz_HS[5] = w[5] |
---|
103 | form_fuzz_HS[6] = 0 |
---|
104 | |
---|
105 | //calculate the diameter of the effective one-component sphere |
---|
106 | Variable pd,diam,Vpoly,Ravg |
---|
107 | pd = w[2] |
---|
108 | Ravg = w[1] |
---|
109 | |
---|
110 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
111 | diam = (6*Vpoly/pi)^(1/3) |
---|
112 | |
---|
113 | |
---|
114 | //setup structure factor coefficient wave |
---|
115 | Make/O/D/N=2 struct_fuzz_HS |
---|
116 | struct_fuzz_HS[0] = diam/2 |
---|
117 | struct_fuzz_HS[1] = w[0] |
---|
118 | |
---|
119 | //calculate each and combine |
---|
120 | Duplicate/O xw tmp_fuzz_HS_PQ,tmp_fuzz_HS_SQ |
---|
121 | FuzzySpheres(form_fuzz_HS,tmp_fuzz_HS_PQ,xw) |
---|
122 | HardSphereStruct(struct_fuzz_HS,tmp_fuzz_HS_SQ,xw) |
---|
123 | yw = tmp_fuzz_HS_PQ * tmp_fuzz_HS_SQ |
---|
124 | yw *= w[0] |
---|
125 | yw += w[6] |
---|
126 | |
---|
127 | //cleanup waves |
---|
128 | // Killwaves/Z form_fuzz_HS,struct_fuzz_HS |
---|
129 | |
---|
130 | return (0) |
---|
131 | End |
---|
132 | |
---|
133 | ///////////////////////////////////////// |
---|
134 | Proc PlotFuzzySphere_SW(num,qmin,qmax) |
---|
135 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
136 | Prompt num "Enter number of data points for model: " |
---|
137 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
138 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
139 | |
---|
140 | Make/O/D/N=(num) xwave_fuzz_SW,ywave_fuzz_SW |
---|
141 | xwave_fuzz_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
142 | Make/O/D coef_fuzz_SW = {0.01,60,0.2,10,1e-6,3e-6,1.0,1.2,0.001} |
---|
143 | make/O/T parameters_fuzz_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
144 | Edit parameters_fuzz_SW,coef_fuzz_SW |
---|
145 | |
---|
146 | Variable/G root:g_fuzz_SW |
---|
147 | g_fuzz_SW := FuzzySphere_SW(coef_fuzz_SW,ywave_fuzz_SW,xwave_fuzz_SW) |
---|
148 | Display ywave_fuzz_SW vs xwave_fuzz_SW |
---|
149 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
150 | Label bottom "q (A\\S-1\\M)" |
---|
151 | Label left "Intensity (cm\\S-1\\M)" |
---|
152 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
153 | |
---|
154 | AddModelToStrings("FuzzySphere_SW","coef_fuzz_SW","parameters_fuzz_SW","fuzz_SW") |
---|
155 | End |
---|
156 | |
---|
157 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
158 | Proc PlotSmearedFuzzySphere_SW(str) |
---|
159 | String str |
---|
160 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
161 | |
---|
162 | // if any of the resolution waves are missing => abort |
---|
163 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
164 | Abort |
---|
165 | endif |
---|
166 | |
---|
167 | SetDataFolder $("root:"+str) |
---|
168 | |
---|
169 | // Setup parameter table for model function |
---|
170 | Make/O/D smear_coef_fuzz_SW = {0.01,60,0.2,10,1e-6,3e-6,1.0,1.2,0.001} |
---|
171 | make/o/t smear_parameters_fuzz_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
172 | Edit smear_parameters_fuzz_SW,smear_coef_fuzz_SW |
---|
173 | |
---|
174 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
175 | // make extra copy of experimental q-values for easy plotting |
---|
176 | Duplicate/O $(str+"_q") smeared_fuzz_SW,smeared_qvals |
---|
177 | SetScale d,0,0,"1/cm",smeared_fuzz_SW |
---|
178 | |
---|
179 | Variable/G gs_fuzz_SW=0 |
---|
180 | gs_fuzz_SW := fSmearedFuzzySphere_SW(smear_coef_fuzz_SW,smeared_fuzz_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
181 | |
---|
182 | Display smeared_fuzz_SW vs smeared_qvals |
---|
183 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
184 | Label bottom "q (A\\S-1\\M)" |
---|
185 | Label left "Intensity (cm\\S-1\\M)" |
---|
186 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
187 | |
---|
188 | SetDataFolder root: |
---|
189 | AddModelToStrings("SmearedFuzzySphere_SW","smear_coef_fuzz_SW","smear_parameters_fuzz_SW","fuzz_SW") |
---|
190 | End |
---|
191 | |
---|
192 | |
---|
193 | Function FuzzySphere_SW(w,yw,xw) : FitFunc |
---|
194 | Wave w,yw,xw |
---|
195 | |
---|
196 | Variable inten |
---|
197 | |
---|
198 | //setup form factor coefficient wave |
---|
199 | Make/O/D/N=7 form_fuzz_SW |
---|
200 | form_fuzz_SW[0] = 1 |
---|
201 | form_fuzz_SW[1] = w[1] |
---|
202 | form_fuzz_SW[2] = w[2] |
---|
203 | form_fuzz_SW[3] = w[3] |
---|
204 | form_fuzz_SW[4] = w[4] |
---|
205 | form_fuzz_SW[5] = w[5] |
---|
206 | form_fuzz_SW[6] = 0 |
---|
207 | |
---|
208 | //calculate the diameter of the effective one-component sphere |
---|
209 | Variable pd,diam,Vpoly,Ravg |
---|
210 | pd = w[2] |
---|
211 | Ravg = w[1] |
---|
212 | |
---|
213 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
214 | diam = (6*Vpoly/pi)^(1/3) |
---|
215 | |
---|
216 | //setup structure factor coefficient wave |
---|
217 | Make/O/D/N=4 struct_fuzz_SW |
---|
218 | struct_fuzz_SW[0] = diam/2 |
---|
219 | struct_fuzz_SW[1] = w[0] |
---|
220 | struct_fuzz_SW[2] = w[6] |
---|
221 | struct_fuzz_SW[3] = w[7] |
---|
222 | |
---|
223 | //calculate each and combine |
---|
224 | Duplicate/O xw tmp_fuzz_SW_PQ,tmp_fuzz_SW_SQ |
---|
225 | FuzzySpheres(form_fuzz_SW,tmp_fuzz_SW_PQ,xw) |
---|
226 | SquareWellStruct(struct_fuzz_SW,tmp_fuzz_SW_SQ,xw) |
---|
227 | yw = tmp_fuzz_SW_PQ * tmp_fuzz_SW_SQ |
---|
228 | yw *= w[0] |
---|
229 | yw += w[8] |
---|
230 | |
---|
231 | //cleanup waves |
---|
232 | // Killwaves/Z form_fuzz_SW,struct_fuzz_SW |
---|
233 | |
---|
234 | return (0) |
---|
235 | End |
---|
236 | |
---|
237 | |
---|
238 | ///////////////////////////////////////// |
---|
239 | Proc PlotFuzzySphere_SC(num,qmin,qmax) |
---|
240 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
241 | Prompt num "Enter number of data points for model: " |
---|
242 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
243 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
244 | |
---|
245 | if(!DataFolderExists(":HayPenMSA")) |
---|
246 | NewDataFolder :HayPenMSA |
---|
247 | endif |
---|
248 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
249 | |
---|
250 | Make/O/D/N=(num) xwave_fuzz_SC,ywave_fuzz_SC |
---|
251 | xwave_fuzz_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
252 | Make/O/D coef_fuzz_SC = {0.01,60,0.2,10,1e-6,3e-6,20,0,298,78,0.001} |
---|
253 | make/O/T parameters_fuzz_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
254 | Edit parameters_fuzz_SC,coef_fuzz_SC |
---|
255 | |
---|
256 | Variable/G root:g_fuzz_SC |
---|
257 | g_fuzz_SC := FuzzySphere_SC(coef_fuzz_SC,ywave_fuzz_SC,xwave_fuzz_SC) |
---|
258 | Display ywave_fuzz_SC vs xwave_fuzz_SC |
---|
259 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
260 | Label bottom "q (A\\S-1\\M)" |
---|
261 | Label left "Intensity (cm\\S-1\\M)" |
---|
262 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
263 | |
---|
264 | AddModelToStrings("FuzzySphere_SC","coef_fuzz_SC","parameters_fuzz_SC","fuzz_SC") |
---|
265 | End |
---|
266 | |
---|
267 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
268 | Proc PlotSmearedFuzzySphere_SC(str) |
---|
269 | String str |
---|
270 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
271 | |
---|
272 | // if any of the resolution waves are missing => abort |
---|
273 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
274 | Abort |
---|
275 | endif |
---|
276 | |
---|
277 | SetDataFolder $("root:"+str) |
---|
278 | |
---|
279 | if(!DataFolderExists(":HayPenMSA")) |
---|
280 | NewDataFolder :HayPenMSA |
---|
281 | endif |
---|
282 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
283 | |
---|
284 | // Setup parameter table for model function |
---|
285 | Make/O/D smear_coef_fuzz_SC = {0.01,60,0.2,10,1e-6,3e-6,20,0,298,78,0.001} |
---|
286 | make/o/t smear_parameters_fuzz_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
287 | Edit smear_parameters_fuzz_SC,smear_coef_fuzz_SC |
---|
288 | |
---|
289 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
290 | // make extra copy of experimental q-values for easy plotting |
---|
291 | Duplicate/O $(str+"_q") smeared_fuzz_SC,smeared_qvals |
---|
292 | SetScale d,0,0,"1/cm",smeared_fuzz_SC |
---|
293 | |
---|
294 | Variable/G gs_fuzz_SC=0 |
---|
295 | gs_fuzz_SC := fSmearedFuzzySphere_SC(smear_coef_fuzz_SC,smeared_fuzz_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
296 | |
---|
297 | Display smeared_fuzz_SC vs smeared_qvals |
---|
298 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
299 | Label bottom "q (A\\S-1\\M)" |
---|
300 | Label left "Intensity (cm\\S-1\\M)" |
---|
301 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
302 | |
---|
303 | SetDataFolder root: |
---|
304 | AddModelToStrings("SmearedFuzzySphere_SC","smear_coef_fuzz_SC","smear_parameters_fuzz_SC","fuzz_SC") |
---|
305 | End |
---|
306 | |
---|
307 | |
---|
308 | Function FuzzySphere_SC(w,yw,xw) : FitFunc |
---|
309 | Wave w,yw,xw |
---|
310 | |
---|
311 | Variable inten |
---|
312 | |
---|
313 | //setup form factor coefficient wave |
---|
314 | Make/O/D/N=7 form_fuzz_SC |
---|
315 | form_fuzz_SC[0] = 1 |
---|
316 | form_fuzz_SC[1] = w[1] |
---|
317 | form_fuzz_SC[2] = w[2] |
---|
318 | form_fuzz_SC[3] = w[3] |
---|
319 | form_fuzz_SC[4] = w[4] |
---|
320 | form_fuzz_SC[5] = w[5] |
---|
321 | form_fuzz_SC[6] = 0 |
---|
322 | |
---|
323 | //calculate the diameter of the effective one-component sphere |
---|
324 | Variable pd,diam,Vpoly,Ravg |
---|
325 | pd = w[2] |
---|
326 | Ravg = w[1] |
---|
327 | |
---|
328 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
329 | diam = (6*Vpoly/pi)^(1/3) |
---|
330 | |
---|
331 | //setup structure factor coefficient wave |
---|
332 | Make/O/D/N=6 struct_fuzz_SC |
---|
333 | struct_fuzz_SC[0] = diam |
---|
334 | struct_fuzz_SC[1] = w[6] |
---|
335 | struct_fuzz_SC[2] = w[0] |
---|
336 | struct_fuzz_SC[3] = w[8] |
---|
337 | struct_fuzz_SC[4] = w[7] |
---|
338 | struct_fuzz_SC[5] = w[9] |
---|
339 | |
---|
340 | //calculate each and combine |
---|
341 | Duplicate/O xw tmp_fuzz_SC_PQ,tmp_fuzz_SC_SQ |
---|
342 | FuzzySpheres(form_fuzz_SC,tmp_fuzz_SC_PQ,xw) |
---|
343 | HayterPenfoldMSA(struct_fuzz_SC,tmp_fuzz_SC_SQ,xw) |
---|
344 | yw = tmp_fuzz_SC_PQ * tmp_fuzz_SC_SQ |
---|
345 | yw *= w[0] |
---|
346 | yw += w[10] |
---|
347 | |
---|
348 | //cleanup waves |
---|
349 | // Killwaves/Z form_fuzz_SC,struct_fuzz_SC |
---|
350 | |
---|
351 | return (0) |
---|
352 | End |
---|
353 | |
---|
354 | ///////////////////////////////////////// |
---|
355 | Proc PlotFuzzySphere_SHS(num,qmin,qmax) |
---|
356 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
357 | Prompt num "Enter number of data points for model: " |
---|
358 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
359 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
360 | |
---|
361 | Make/O/D/N=(num) xwave_fuzz_SHS,ywave_fuzz_SHS |
---|
362 | xwave_fuzz_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
363 | Make/O/D coef_fuzz_SHS = {0.01,60,0.2,10,1e-6,3e-6,0.05,0.2,0.001} |
---|
364 | make/O/T parameters_fuzz_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
365 | Edit parameters_fuzz_SHS,coef_fuzz_SHS |
---|
366 | |
---|
367 | Variable/G root:g_fuzz_SHS |
---|
368 | g_fuzz_SHS := FuzzySphere_SHS(coef_fuzz_SHS,ywave_fuzz_SHS,xwave_fuzz_SHS) |
---|
369 | Display ywave_fuzz_SHS vs xwave_fuzz_SHS |
---|
370 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
371 | Label bottom "q (A\\S-1\\M)" |
---|
372 | Label left "Intensity (cm\\S-1\\M)" |
---|
373 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
374 | |
---|
375 | AddModelToStrings("FuzzySphere_SHS","coef_fuzz_SHS","parameters_fuzz_SHS","fuzz_SHS") |
---|
376 | End |
---|
377 | |
---|
378 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
379 | Proc PlotSmearedFuzzySphere_SHS(str) |
---|
380 | String str |
---|
381 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
382 | |
---|
383 | // if any of the resolution waves are missing => abort |
---|
384 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
385 | Abort |
---|
386 | endif |
---|
387 | |
---|
388 | SetDataFolder $("root:"+str) |
---|
389 | |
---|
390 | // Setup parameter table for model function |
---|
391 | Make/O/D smear_coef_fuzz_SHS = {0.01,60,0.2,10,1e-6,3e-6,0.05,0.2,0.001} |
---|
392 | make/o/t smear_parameters_fuzz_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
393 | Edit smear_parameters_fuzz_SHS,smear_coef_fuzz_SHS |
---|
394 | |
---|
395 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
396 | // make extra copy of experimental q-values for easy plotting |
---|
397 | Duplicate/O $(str+"_q") smeared_fuzz_SHS,smeared_qvals |
---|
398 | SetScale d,0,0,"1/cm",smeared_fuzz_SHS |
---|
399 | |
---|
400 | Variable/G gs_fuzz_SHS=0 |
---|
401 | gs_fuzz_SHS := fSmearedFuzzySphere_SHS(smear_coef_fuzz_SHS,smeared_fuzz_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
402 | |
---|
403 | Display smeared_fuzz_SHS vs smeared_qvals |
---|
404 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
405 | Label bottom "q (A\\S-1\\M)" |
---|
406 | Label left "Intensity (cm\\S-1\\M)" |
---|
407 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
408 | |
---|
409 | SetDataFolder root: |
---|
410 | AddModelToStrings("SmearedFuzzySphere_SHS","smear_coef_fuzz_SHS","smear_parameters_fuzz_SHS","fuzz_SHS") |
---|
411 | End |
---|
412 | |
---|
413 | |
---|
414 | Function FuzzySphere_SHS(w,yw,xw) : FitFunc |
---|
415 | Wave w,yw,xw |
---|
416 | |
---|
417 | Variable inten |
---|
418 | |
---|
419 | //setup form factor coefficient wave |
---|
420 | Make/O/D/N=7 form_fuzz_SHS |
---|
421 | form_fuzz_SHS[0] = 1 |
---|
422 | form_fuzz_SHS[1] = w[1] |
---|
423 | form_fuzz_SHS[2] = w[2] |
---|
424 | form_fuzz_SHS[3] = w[3] |
---|
425 | form_fuzz_SHS[4] = w[4] |
---|
426 | form_fuzz_SHS[5] = w[5] |
---|
427 | form_fuzz_SHS[6] = 0 |
---|
428 | |
---|
429 | //calculate the diameter of the effective one-component sphere |
---|
430 | Variable pd,diam,Vpoly,Ravg |
---|
431 | pd = w[2] |
---|
432 | Ravg = w[1] |
---|
433 | |
---|
434 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
435 | diam = (6*Vpoly/pi)^(1/3) |
---|
436 | |
---|
437 | //setup structure factor coefficient wave |
---|
438 | Make/O/D/N=4 struct_fuzz_SHS |
---|
439 | struct_fuzz_SHS[0] = diam/2 |
---|
440 | struct_fuzz_SHS[1] = w[0] |
---|
441 | struct_fuzz_SHS[2] = w[6] |
---|
442 | struct_fuzz_SHS[3] = w[7] |
---|
443 | |
---|
444 | //calculate each and combine |
---|
445 | Duplicate/O xw tmp_fuzz_SHS_PQ,tmp_fuzz_SHS_SQ |
---|
446 | FuzzySpheres(form_fuzz_SHS,tmp_fuzz_SHS_PQ,xw) |
---|
447 | StickyHS_Struct(struct_fuzz_SHS,tmp_fuzz_SHS_SQ,xw) |
---|
448 | yw = tmp_fuzz_SHS_PQ * tmp_fuzz_SHS_SQ |
---|
449 | yw *= w[0] |
---|
450 | yw += w[8] |
---|
451 | |
---|
452 | //cleanup waves |
---|
453 | // Killwaves/Z form_fuzz_SHS,struct_fuzz_SHS |
---|
454 | |
---|
455 | return (0) |
---|
456 | End |
---|
457 | |
---|
458 | |
---|
459 | |
---|
460 | // this is all there is to the smeared calculation! |
---|
461 | Function SmearedFuzzySphere_HS(s) : FitFunc |
---|
462 | Struct ResSmearAAOStruct &s |
---|
463 | |
---|
464 | // the name of your unsmeared model (AAO) is the first argument |
---|
465 | Smear_Model_20(FuzzySphere_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
466 | |
---|
467 | return(0) |
---|
468 | End |
---|
469 | |
---|
470 | // this is all there is to the smeared calculation! |
---|
471 | Function SmearedFuzzySphere_SW(s) : FitFunc |
---|
472 | Struct ResSmearAAOStruct &s |
---|
473 | |
---|
474 | // the name of your unsmeared model (AAO) is the first argument |
---|
475 | Smear_Model_20(FuzzySphere_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
476 | |
---|
477 | return(0) |
---|
478 | End |
---|
479 | |
---|
480 | // this is all there is to the smeared calculation! |
---|
481 | Function SmearedFuzzySphere_SC(s) : FitFunc |
---|
482 | Struct ResSmearAAOStruct &s |
---|
483 | |
---|
484 | // the name of your unsmeared model (AAO) is the first argument |
---|
485 | Smear_Model_20(FuzzySphere_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
486 | |
---|
487 | return(0) |
---|
488 | End |
---|
489 | |
---|
490 | // this is all there is to the smeared calculation! |
---|
491 | Function SmearedFuzzySphere_SHS(s) : FitFunc |
---|
492 | Struct ResSmearAAOStruct &s |
---|
493 | |
---|
494 | // the name of your unsmeared model (AAO) is the first argument |
---|
495 | Smear_Model_20(FuzzySphere_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
496 | |
---|
497 | return(0) |
---|
498 | End |
---|
499 | |
---|
500 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
501 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
502 | // |
---|
503 | // used only for the dependency, not for fitting |
---|
504 | // |
---|
505 | Function fSmearedFuzzySphere_HS(coefW,yW,xW) |
---|
506 | Wave coefW,yW,xW |
---|
507 | |
---|
508 | String str = getWavesDataFolder(yW,0) |
---|
509 | String DF="root:"+str+":" |
---|
510 | |
---|
511 | WAVE resW = $(DF+str+"_res") |
---|
512 | |
---|
513 | STRUCT ResSmearAAOStruct fs |
---|
514 | WAVE fs.coefW = coefW |
---|
515 | WAVE fs.yW = yW |
---|
516 | WAVE fs.xW = xW |
---|
517 | WAVE fs.resW = resW |
---|
518 | |
---|
519 | Variable err |
---|
520 | err = SmearedFuzzySphere_HS(fs) |
---|
521 | |
---|
522 | return (0) |
---|
523 | End |
---|
524 | |
---|
525 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
526 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
527 | // |
---|
528 | // used only for the dependency, not for fitting |
---|
529 | // |
---|
530 | Function fSmearedFuzzySphere_SW(coefW,yW,xW) |
---|
531 | Wave coefW,yW,xW |
---|
532 | |
---|
533 | String str = getWavesDataFolder(yW,0) |
---|
534 | String DF="root:"+str+":" |
---|
535 | |
---|
536 | WAVE resW = $(DF+str+"_res") |
---|
537 | |
---|
538 | STRUCT ResSmearAAOStruct fs |
---|
539 | WAVE fs.coefW = coefW |
---|
540 | WAVE fs.yW = yW |
---|
541 | WAVE fs.xW = xW |
---|
542 | WAVE fs.resW = resW |
---|
543 | |
---|
544 | Variable err |
---|
545 | err = SmearedFuzzySphere_SW(fs) |
---|
546 | |
---|
547 | return (0) |
---|
548 | End |
---|
549 | |
---|
550 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
551 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
552 | // |
---|
553 | // used only for the dependency, not for fitting |
---|
554 | // |
---|
555 | Function fSmearedFuzzySphere_SC(coefW,yW,xW) |
---|
556 | Wave coefW,yW,xW |
---|
557 | |
---|
558 | String str = getWavesDataFolder(yW,0) |
---|
559 | String DF="root:"+str+":" |
---|
560 | |
---|
561 | WAVE resW = $(DF+str+"_res") |
---|
562 | |
---|
563 | STRUCT ResSmearAAOStruct fs |
---|
564 | WAVE fs.coefW = coefW |
---|
565 | WAVE fs.yW = yW |
---|
566 | WAVE fs.xW = xW |
---|
567 | WAVE fs.resW = resW |
---|
568 | |
---|
569 | Variable err |
---|
570 | err = SmearedFuzzySphere_SC(fs) |
---|
571 | |
---|
572 | return (0) |
---|
573 | End |
---|
574 | |
---|
575 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
576 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
577 | // |
---|
578 | // used only for the dependency, not for fitting |
---|
579 | // |
---|
580 | Function fSmearedFuzzySphere_SHS(coefW,yW,xW) |
---|
581 | Wave coefW,yW,xW |
---|
582 | |
---|
583 | String str = getWavesDataFolder(yW,0) |
---|
584 | String DF="root:"+str+":" |
---|
585 | |
---|
586 | WAVE resW = $(DF+str+"_res") |
---|
587 | |
---|
588 | STRUCT ResSmearAAOStruct fs |
---|
589 | WAVE fs.coefW = coefW |
---|
590 | WAVE fs.yW = yW |
---|
591 | WAVE fs.xW = xW |
---|
592 | WAVE fs.resW = resW |
---|
593 | |
---|
594 | Variable err |
---|
595 | err = SmearedFuzzySphere_SHS(fs) |
---|
596 | |
---|
597 | return (0) |
---|
598 | End |
---|