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 | // added the lorentzian SRK APR 2010. this is a little different than other P*S, since the |
---|
19 | // Lorentzian is not scaled by phi, but rather is added on to the high q independently. |
---|
20 | // -- so it must be tacked on at the end, just like the form factor |
---|
21 | |
---|
22 | |
---|
23 | // |
---|
24 | // be sure to include all of the necessary files |
---|
25 | // |
---|
26 | #include "FuzzySpheres_v40" |
---|
27 | |
---|
28 | #include "HardSphereStruct_v40" |
---|
29 | #include "HPMSA_v40" |
---|
30 | #include "SquareWellStruct_v40" |
---|
31 | #include "StickyHardSphereStruct_v40" |
---|
32 | #include "Two_Yukawa_v40" |
---|
33 | |
---|
34 | Proc PlotFuzzySphere_HS(num,qmin,qmax) |
---|
35 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
36 | Prompt num "Enter number of data points for model: " |
---|
37 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
38 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
39 | |
---|
40 | Make/O/D/N=(num) xwave_fuzz_HS,ywave_fuzz_HS |
---|
41 | xwave_fuzz_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
42 | Make/O/D coef_fuzz_HS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.001} |
---|
43 | 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)","Lorentz Scale","Lorentz length","bkg (cm-1 sr-1)"} |
---|
44 | Edit parameters_fuzz_HS,coef_fuzz_HS |
---|
45 | |
---|
46 | Variable/G root:g_fuzz_HS |
---|
47 | g_fuzz_HS := FuzzySphere_HS(coef_fuzz_HS,ywave_fuzz_HS,xwave_fuzz_HS) |
---|
48 | Display ywave_fuzz_HS vs xwave_fuzz_HS |
---|
49 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
50 | Label bottom "q (A\\S-1\\M)" |
---|
51 | Label left "Intensity (cm\\S-1\\M)" |
---|
52 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
53 | |
---|
54 | AddModelToStrings("FuzzySphere_HS","coef_fuzz_HS","parameters_fuzz_HS","fuzz_HS") |
---|
55 | End |
---|
56 | |
---|
57 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
58 | Proc PlotSmearedFuzzySphere_HS(str) |
---|
59 | String str |
---|
60 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
61 | |
---|
62 | // if any of the resolution waves are missing => abort |
---|
63 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
64 | Abort |
---|
65 | endif |
---|
66 | |
---|
67 | SetDataFolder $("root:"+str) |
---|
68 | |
---|
69 | // Setup parameter table for model function |
---|
70 | Make/O/D smear_coef_fuzz_HS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.001} |
---|
71 | 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)","Lorentz Scale","Lorentz length","bkg (cm-1 sr-1)"} |
---|
72 | Edit smear_parameters_fuzz_HS,smear_coef_fuzz_HS |
---|
73 | |
---|
74 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
75 | // make extra copy of experimental q-values for easy plotting |
---|
76 | Duplicate/O $(str+"_q") smeared_fuzz_HS,smeared_qvals |
---|
77 | SetScale d,0,0,"1/cm",smeared_fuzz_HS |
---|
78 | |
---|
79 | Variable/G gs_fuzz_HS=0 |
---|
80 | gs_fuzz_HS := fSmearedFuzzySphere_HS(smear_coef_fuzz_HS,smeared_fuzz_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
81 | |
---|
82 | Display smeared_fuzz_HS vs smeared_qvals |
---|
83 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
84 | Label bottom "q (A\\S-1\\M)" |
---|
85 | Label left "Intensity (cm\\S-1\\M)" |
---|
86 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
87 | |
---|
88 | SetDataFolder root: |
---|
89 | AddModelToStrings("SmearedFuzzySphere_HS","smear_coef_fuzz_HS","smear_parameters_fuzz_HS","fuzz_HS") |
---|
90 | End |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | Function FuzzySphere_HS(w,yw,xw) : FitFunc |
---|
95 | Wave w,yw,xw |
---|
96 | |
---|
97 | Variable inten |
---|
98 | |
---|
99 | //setup form factor coefficient wave |
---|
100 | Make/O/D/N=9 form_fuzz_HS |
---|
101 | form_fuzz_HS[0] = w[0] // send the real volume fraction in here, so the scaling is done correctly |
---|
102 | form_fuzz_HS[1] = w[1] |
---|
103 | form_fuzz_HS[2] = w[2] |
---|
104 | form_fuzz_HS[3] = w[3] |
---|
105 | form_fuzz_HS[4] = w[4] |
---|
106 | form_fuzz_HS[5] = w[5] |
---|
107 | form_fuzz_HS[6] = w[6] // w[6] is the Lorentzian scale |
---|
108 | form_fuzz_HS[7] = w[7] |
---|
109 | form_fuzz_HS[8] = 0 |
---|
110 | |
---|
111 | //calculate the diameter of the effective one-component sphere |
---|
112 | Variable pd,diam,Vpoly,Ravg |
---|
113 | pd = w[2] |
---|
114 | Ravg = w[1] |
---|
115 | |
---|
116 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
117 | diam = (6*Vpoly/pi)^(1/3) |
---|
118 | |
---|
119 | |
---|
120 | //setup structure factor coefficient wave |
---|
121 | Make/O/D/N=2 struct_fuzz_HS |
---|
122 | struct_fuzz_HS[0] = diam/2 |
---|
123 | struct_fuzz_HS[1] = w[0] |
---|
124 | |
---|
125 | //calculate each and combine |
---|
126 | Duplicate/O xw tmp_fuzz_HS_PQ,tmp_fuzz_HS_SQ |
---|
127 | FuzzySpheres(form_fuzz_HS,tmp_fuzz_HS_PQ,xw) |
---|
128 | |
---|
129 | HardSphereStruct(struct_fuzz_HS,tmp_fuzz_HS_SQ,xw) |
---|
130 | yw = tmp_fuzz_HS_PQ * tmp_fuzz_HS_SQ |
---|
131 | |
---|
132 | // yw *= w[0] // scaling is done in FuzzySpheres |
---|
133 | yw += w[8] |
---|
134 | |
---|
135 | //cleanup waves |
---|
136 | // Killwaves/Z form_fuzz_HS,struct_fuzz_HS |
---|
137 | |
---|
138 | return (0) |
---|
139 | End |
---|
140 | |
---|
141 | ///////////////////////////////////////// |
---|
142 | Proc PlotFuzzySphere_SW(num,qmin,qmax) |
---|
143 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
144 | Prompt num "Enter number of data points for model: " |
---|
145 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
146 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
147 | |
---|
148 | Make/O/D/N=(num) xwave_fuzz_SW,ywave_fuzz_SW |
---|
149 | xwave_fuzz_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
150 | Make/O/D coef_fuzz_SW = {0.01,60,0.2,10,1e-6,3e-6,1,50,1.0,1.2,0.001} |
---|
151 | 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)","Lorentz Scale","Lorentz length","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
152 | Edit parameters_fuzz_SW,coef_fuzz_SW |
---|
153 | |
---|
154 | Variable/G root:g_fuzz_SW |
---|
155 | g_fuzz_SW := FuzzySphere_SW(coef_fuzz_SW,ywave_fuzz_SW,xwave_fuzz_SW) |
---|
156 | Display ywave_fuzz_SW vs xwave_fuzz_SW |
---|
157 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
158 | Label bottom "q (A\\S-1\\M)" |
---|
159 | Label left "Intensity (cm\\S-1\\M)" |
---|
160 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
161 | |
---|
162 | AddModelToStrings("FuzzySphere_SW","coef_fuzz_SW","parameters_fuzz_SW","fuzz_SW") |
---|
163 | End |
---|
164 | |
---|
165 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
166 | Proc PlotSmearedFuzzySphere_SW(str) |
---|
167 | String str |
---|
168 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
169 | |
---|
170 | // if any of the resolution waves are missing => abort |
---|
171 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
172 | Abort |
---|
173 | endif |
---|
174 | |
---|
175 | SetDataFolder $("root:"+str) |
---|
176 | |
---|
177 | // Setup parameter table for model function |
---|
178 | Make/O/D smear_coef_fuzz_SW = {0.01,60,0.2,10,1e-6,3e-6,1,50,1.0,1.2,0.001} |
---|
179 | 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)","Lorentz Scale","Lorentz length","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
180 | Edit smear_parameters_fuzz_SW,smear_coef_fuzz_SW |
---|
181 | |
---|
182 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
183 | // make extra copy of experimental q-values for easy plotting |
---|
184 | Duplicate/O $(str+"_q") smeared_fuzz_SW,smeared_qvals |
---|
185 | SetScale d,0,0,"1/cm",smeared_fuzz_SW |
---|
186 | |
---|
187 | Variable/G gs_fuzz_SW=0 |
---|
188 | gs_fuzz_SW := fSmearedFuzzySphere_SW(smear_coef_fuzz_SW,smeared_fuzz_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
189 | |
---|
190 | Display smeared_fuzz_SW vs smeared_qvals |
---|
191 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
192 | Label bottom "q (A\\S-1\\M)" |
---|
193 | Label left "Intensity (cm\\S-1\\M)" |
---|
194 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
195 | |
---|
196 | SetDataFolder root: |
---|
197 | AddModelToStrings("SmearedFuzzySphere_SW","smear_coef_fuzz_SW","smear_parameters_fuzz_SW","fuzz_SW") |
---|
198 | End |
---|
199 | |
---|
200 | |
---|
201 | Function FuzzySphere_SW(w,yw,xw) : FitFunc |
---|
202 | Wave w,yw,xw |
---|
203 | |
---|
204 | Variable inten |
---|
205 | |
---|
206 | //setup form factor coefficient wave |
---|
207 | Make/O/D/N=9 form_fuzz_SW |
---|
208 | form_fuzz_SW[0] = w[0] |
---|
209 | form_fuzz_SW[1] = w[1] |
---|
210 | form_fuzz_SW[2] = w[2] |
---|
211 | form_fuzz_SW[3] = w[3] |
---|
212 | form_fuzz_SW[4] = w[4] |
---|
213 | form_fuzz_SW[5] = w[5] |
---|
214 | form_fuzz_SW[6] = w[6] |
---|
215 | form_fuzz_SW[7] = w[7] |
---|
216 | form_fuzz_SW[8] = 0 |
---|
217 | |
---|
218 | //calculate the diameter of the effective one-component sphere |
---|
219 | Variable pd,diam,Vpoly,Ravg |
---|
220 | pd = w[2] |
---|
221 | Ravg = w[1] |
---|
222 | |
---|
223 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
224 | diam = (6*Vpoly/pi)^(1/3) |
---|
225 | |
---|
226 | //setup structure factor coefficient wave |
---|
227 | Make/O/D/N=4 struct_fuzz_SW |
---|
228 | struct_fuzz_SW[0] = diam/2 |
---|
229 | struct_fuzz_SW[1] = w[0] |
---|
230 | struct_fuzz_SW[2] = w[8] |
---|
231 | struct_fuzz_SW[3] = w[9] |
---|
232 | |
---|
233 | //calculate each and combine |
---|
234 | Duplicate/O xw tmp_fuzz_SW_PQ,tmp_fuzz_SW_SQ |
---|
235 | FuzzySpheres(form_fuzz_SW,tmp_fuzz_SW_PQ,xw) |
---|
236 | SquareWellStruct(struct_fuzz_SW,tmp_fuzz_SW_SQ,xw) |
---|
237 | yw = tmp_fuzz_SW_PQ * tmp_fuzz_SW_SQ |
---|
238 | |
---|
239 | // yw *= w[0] // scaling is done in FuzzySpheres |
---|
240 | yw += w[10] |
---|
241 | |
---|
242 | //cleanup waves |
---|
243 | // Killwaves/Z form_fuzz_SW,struct_fuzz_SW |
---|
244 | |
---|
245 | return (0) |
---|
246 | End |
---|
247 | |
---|
248 | |
---|
249 | ///////////////////////////////////////// |
---|
250 | Proc PlotFuzzySphere_SC(num,qmin,qmax) |
---|
251 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
252 | Prompt num "Enter number of data points for model: " |
---|
253 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
254 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
255 | |
---|
256 | if(!DataFolderExists(":HayPenMSA")) |
---|
257 | NewDataFolder :HayPenMSA |
---|
258 | endif |
---|
259 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
260 | |
---|
261 | Make/O/D/N=(num) xwave_fuzz_SC,ywave_fuzz_SC |
---|
262 | xwave_fuzz_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
263 | Make/O/D coef_fuzz_SC = {0.01,60,0.2,10,1e-6,3e-6,1,50,20,0,298,78,0.001} |
---|
264 | 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)","Lorentz Scale","Lorentz length","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
265 | Edit parameters_fuzz_SC,coef_fuzz_SC |
---|
266 | |
---|
267 | Variable/G root:g_fuzz_SC |
---|
268 | g_fuzz_SC := FuzzySphere_SC(coef_fuzz_SC,ywave_fuzz_SC,xwave_fuzz_SC) |
---|
269 | Display ywave_fuzz_SC vs xwave_fuzz_SC |
---|
270 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
271 | Label bottom "q (A\\S-1\\M)" |
---|
272 | Label left "Intensity (cm\\S-1\\M)" |
---|
273 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
274 | |
---|
275 | AddModelToStrings("FuzzySphere_SC","coef_fuzz_SC","parameters_fuzz_SC","fuzz_SC") |
---|
276 | End |
---|
277 | |
---|
278 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
279 | Proc PlotSmearedFuzzySphere_SC(str) |
---|
280 | String str |
---|
281 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
282 | |
---|
283 | // if any of the resolution waves are missing => abort |
---|
284 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
285 | Abort |
---|
286 | endif |
---|
287 | |
---|
288 | SetDataFolder $("root:"+str) |
---|
289 | |
---|
290 | if(!DataFolderExists(":HayPenMSA")) |
---|
291 | NewDataFolder :HayPenMSA |
---|
292 | endif |
---|
293 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
294 | |
---|
295 | // Setup parameter table for model function |
---|
296 | Make/O/D smear_coef_fuzz_SC = {0.01,60,0.2,10,1e-6,3e-6,1,50,20,0,298,78,0.001} |
---|
297 | 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)","Lorentz Scale","Lorentz length","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
298 | Edit smear_parameters_fuzz_SC,smear_coef_fuzz_SC |
---|
299 | |
---|
300 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
301 | // make extra copy of experimental q-values for easy plotting |
---|
302 | Duplicate/O $(str+"_q") smeared_fuzz_SC,smeared_qvals |
---|
303 | SetScale d,0,0,"1/cm",smeared_fuzz_SC |
---|
304 | |
---|
305 | Variable/G gs_fuzz_SC=0 |
---|
306 | gs_fuzz_SC := fSmearedFuzzySphere_SC(smear_coef_fuzz_SC,smeared_fuzz_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
307 | |
---|
308 | Display smeared_fuzz_SC vs smeared_qvals |
---|
309 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
310 | Label bottom "q (A\\S-1\\M)" |
---|
311 | Label left "Intensity (cm\\S-1\\M)" |
---|
312 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
313 | |
---|
314 | SetDataFolder root: |
---|
315 | AddModelToStrings("SmearedFuzzySphere_SC","smear_coef_fuzz_SC","smear_parameters_fuzz_SC","fuzz_SC") |
---|
316 | End |
---|
317 | |
---|
318 | |
---|
319 | Function FuzzySphere_SC(w,yw,xw) : FitFunc |
---|
320 | Wave w,yw,xw |
---|
321 | |
---|
322 | Variable inten |
---|
323 | |
---|
324 | //setup form factor coefficient wave |
---|
325 | Make/O/D/N=9 form_fuzz_SC |
---|
326 | form_fuzz_SC[0] = w[0] |
---|
327 | form_fuzz_SC[1] = w[1] |
---|
328 | form_fuzz_SC[2] = w[2] |
---|
329 | form_fuzz_SC[3] = w[3] |
---|
330 | form_fuzz_SC[4] = w[4] |
---|
331 | form_fuzz_SC[5] = w[5] |
---|
332 | form_fuzz_SC[6] = w[6] |
---|
333 | form_fuzz_SC[7] = w[7] |
---|
334 | form_fuzz_SC[8] = 0 |
---|
335 | |
---|
336 | //calculate the diameter of the effective one-component sphere |
---|
337 | Variable pd,diam,Vpoly,Ravg |
---|
338 | pd = w[2] |
---|
339 | Ravg = w[1] |
---|
340 | |
---|
341 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
342 | diam = (6*Vpoly/pi)^(1/3) |
---|
343 | |
---|
344 | //setup structure factor coefficient wave |
---|
345 | Make/O/D/N=6 struct_fuzz_SC |
---|
346 | struct_fuzz_SC[0] = diam |
---|
347 | struct_fuzz_SC[1] = w[8] |
---|
348 | struct_fuzz_SC[2] = w[0] |
---|
349 | struct_fuzz_SC[3] = w[10] |
---|
350 | struct_fuzz_SC[4] = w[9] |
---|
351 | struct_fuzz_SC[5] = w[11] |
---|
352 | |
---|
353 | //calculate each and combine |
---|
354 | Duplicate/O xw tmp_fuzz_SC_PQ,tmp_fuzz_SC_SQ |
---|
355 | FuzzySpheres(form_fuzz_SC,tmp_fuzz_SC_PQ,xw) |
---|
356 | HayterPenfoldMSA(struct_fuzz_SC,tmp_fuzz_SC_SQ,xw) |
---|
357 | yw = tmp_fuzz_SC_PQ * tmp_fuzz_SC_SQ |
---|
358 | |
---|
359 | // yw *= w[0] // scaling is done in FuzzySpheres |
---|
360 | yw += w[12] |
---|
361 | |
---|
362 | //cleanup waves |
---|
363 | // Killwaves/Z form_fuzz_SC,struct_fuzz_SC |
---|
364 | |
---|
365 | return (0) |
---|
366 | End |
---|
367 | |
---|
368 | ///////////////////////////////////////// |
---|
369 | Proc PlotFuzzySphere_SHS(num,qmin,qmax) |
---|
370 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
371 | Prompt num "Enter number of data points for model: " |
---|
372 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
373 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
374 | |
---|
375 | Make/O/D/N=(num) xwave_fuzz_SHS,ywave_fuzz_SHS |
---|
376 | xwave_fuzz_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
377 | Make/O/D coef_fuzz_SHS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.05,0.2,0.001} |
---|
378 | 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)","Lorentz Scale","Lorentz length","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
379 | Edit parameters_fuzz_SHS,coef_fuzz_SHS |
---|
380 | |
---|
381 | Variable/G root:g_fuzz_SHS |
---|
382 | g_fuzz_SHS := FuzzySphere_SHS(coef_fuzz_SHS,ywave_fuzz_SHS,xwave_fuzz_SHS) |
---|
383 | Display ywave_fuzz_SHS vs xwave_fuzz_SHS |
---|
384 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
385 | Label bottom "q (A\\S-1\\M)" |
---|
386 | Label left "Intensity (cm\\S-1\\M)" |
---|
387 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
388 | |
---|
389 | AddModelToStrings("FuzzySphere_SHS","coef_fuzz_SHS","parameters_fuzz_SHS","fuzz_SHS") |
---|
390 | End |
---|
391 | |
---|
392 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
393 | Proc PlotSmearedFuzzySphere_SHS(str) |
---|
394 | String str |
---|
395 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
396 | |
---|
397 | // if any of the resolution waves are missing => abort |
---|
398 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
399 | Abort |
---|
400 | endif |
---|
401 | |
---|
402 | SetDataFolder $("root:"+str) |
---|
403 | |
---|
404 | // Setup parameter table for model function |
---|
405 | Make/O/D smear_coef_fuzz_SHS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.05,0.2,0.001} |
---|
406 | 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)","Lorentz Scale","Lorentz length","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
407 | Edit smear_parameters_fuzz_SHS,smear_coef_fuzz_SHS |
---|
408 | |
---|
409 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
410 | // make extra copy of experimental q-values for easy plotting |
---|
411 | Duplicate/O $(str+"_q") smeared_fuzz_SHS,smeared_qvals |
---|
412 | SetScale d,0,0,"1/cm",smeared_fuzz_SHS |
---|
413 | |
---|
414 | Variable/G gs_fuzz_SHS=0 |
---|
415 | gs_fuzz_SHS := fSmearedFuzzySphere_SHS(smear_coef_fuzz_SHS,smeared_fuzz_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
416 | |
---|
417 | Display smeared_fuzz_SHS vs smeared_qvals |
---|
418 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
419 | Label bottom "q (A\\S-1\\M)" |
---|
420 | Label left "Intensity (cm\\S-1\\M)" |
---|
421 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
422 | |
---|
423 | SetDataFolder root: |
---|
424 | AddModelToStrings("SmearedFuzzySphere_SHS","smear_coef_fuzz_SHS","smear_parameters_fuzz_SHS","fuzz_SHS") |
---|
425 | End |
---|
426 | |
---|
427 | |
---|
428 | Function FuzzySphere_SHS(w,yw,xw) : FitFunc |
---|
429 | Wave w,yw,xw |
---|
430 | |
---|
431 | Variable inten |
---|
432 | |
---|
433 | //setup form factor coefficient wave |
---|
434 | Make/O/D/N=9 form_fuzz_SHS |
---|
435 | form_fuzz_SHS[0] = w[0] |
---|
436 | form_fuzz_SHS[1] = w[1] |
---|
437 | form_fuzz_SHS[2] = w[2] |
---|
438 | form_fuzz_SHS[3] = w[3] |
---|
439 | form_fuzz_SHS[4] = w[4] |
---|
440 | form_fuzz_SHS[5] = w[5] |
---|
441 | form_fuzz_SHS[6] = w[6] |
---|
442 | form_fuzz_SHS[7] = w[7] |
---|
443 | form_fuzz_SHS[8] = 0 |
---|
444 | |
---|
445 | //calculate the diameter of the effective one-component sphere |
---|
446 | Variable pd,diam,Vpoly,Ravg |
---|
447 | pd = w[2] |
---|
448 | Ravg = w[1] |
---|
449 | |
---|
450 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
451 | diam = (6*Vpoly/pi)^(1/3) |
---|
452 | |
---|
453 | //setup structure factor coefficient wave |
---|
454 | Make/O/D/N=4 struct_fuzz_SHS |
---|
455 | struct_fuzz_SHS[0] = diam/2 |
---|
456 | struct_fuzz_SHS[1] = w[0] |
---|
457 | struct_fuzz_SHS[2] = w[8] |
---|
458 | struct_fuzz_SHS[3] = w[9] |
---|
459 | |
---|
460 | //calculate each and combine |
---|
461 | Duplicate/O xw tmp_fuzz_SHS_PQ,tmp_fuzz_SHS_SQ |
---|
462 | FuzzySpheres(form_fuzz_SHS,tmp_fuzz_SHS_PQ,xw) |
---|
463 | StickyHS_Struct(struct_fuzz_SHS,tmp_fuzz_SHS_SQ,xw) |
---|
464 | yw = tmp_fuzz_SHS_PQ * tmp_fuzz_SHS_SQ |
---|
465 | |
---|
466 | // yw *= w[0] // scaling is done in FuzzySpheres |
---|
467 | yw += w[10] |
---|
468 | |
---|
469 | //cleanup waves |
---|
470 | // Killwaves/Z form_fuzz_SHS,struct_fuzz_SHS |
---|
471 | |
---|
472 | return (0) |
---|
473 | End |
---|
474 | |
---|
475 | //two yukawa |
---|
476 | Proc PlotFuzzySphere_2Y(num,qmin,qmax) |
---|
477 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
478 | Prompt num "Enter number of data points for model: " |
---|
479 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
480 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
481 | |
---|
482 | Make/O/D/N=(num) xwave_fuzz_2Y,ywave_fuzz_2Y |
---|
483 | xwave_fuzz_2Y = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
484 | Make/O/D coef_fuzz_2Y = {0.01,60,0.2,10,1e-6,3e-6,1,50,6,10,-1,2,0.001} |
---|
485 | make/O/T parameters_fuzz_2Y = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","scale, K1","charge, Z1","scale, K2","charge, Z2","bkg (cm-1 sr-1)"} |
---|
486 | Edit parameters_fuzz_2Y,coef_fuzz_2Y |
---|
487 | |
---|
488 | Variable/G root:g_fuzz_2Y |
---|
489 | g_fuzz_2Y := FuzzySphere_2Y(coef_fuzz_2Y,ywave_fuzz_2Y,xwave_fuzz_2Y) |
---|
490 | Display ywave_fuzz_2Y vs xwave_fuzz_2Y |
---|
491 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
492 | Label bottom "q (A\\S-1\\M)" |
---|
493 | Label left "Intensity (cm\\S-1\\M)" |
---|
494 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
495 | |
---|
496 | AddModelToStrings("FuzzySphere_2Y","coef_fuzz_2Y","parameters_fuzz_2Y","fuzz_2Y") |
---|
497 | End |
---|
498 | |
---|
499 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
500 | Proc PlotSmearedFuzzySphere_2Y(str) |
---|
501 | String str |
---|
502 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
503 | |
---|
504 | // if any of the resolution waves are missing => abort |
---|
505 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
506 | Abort |
---|
507 | endif |
---|
508 | |
---|
509 | SetDataFolder $("root:"+str) |
---|
510 | |
---|
511 | // Setup parameter table for model function |
---|
512 | Make/O/D smear_coef_fuzz_2Y = {0.01,60,0.2,10,1e-6,3e-6,1,50,6,10,-1,2,0.001} |
---|
513 | make/o/t smear_parameters_fuzz_2Y = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","scale, K1","charge, Z1","scale, K2","charge, Z2","bkg (cm-1 sr-1)"} |
---|
514 | Edit smear_parameters_fuzz_2Y,smear_coef_fuzz_2Y |
---|
515 | |
---|
516 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
517 | // make extra copy of experimental q-values for easy plotting |
---|
518 | Duplicate/O $(str+"_q") smeared_fuzz_2Y,smeared_qvals |
---|
519 | SetScale d,0,0,"1/cm",smeared_fuzz_2Y |
---|
520 | |
---|
521 | Variable/G gs_fuzz_2Y=0 |
---|
522 | gs_fuzz_2Y := fSmearedFuzzySphere_2Y(smear_coef_fuzz_2Y,smeared_fuzz_2Y,smeared_qvals) //this wrapper fills the STRUCT |
---|
523 | |
---|
524 | Display smeared_fuzz_2Y vs smeared_qvals |
---|
525 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
526 | Label bottom "q (A\\S-1\\M)" |
---|
527 | Label left "Intensity (cm\\S-1\\M)" |
---|
528 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
529 | |
---|
530 | SetDataFolder root: |
---|
531 | AddModelToStrings("SmearedFuzzySphere_2Y","smear_coef_fuzz_2Y","smear_parameters_fuzz_2Y","fuzz_2Y") |
---|
532 | End |
---|
533 | |
---|
534 | |
---|
535 | |
---|
536 | Function FuzzySphere_2Y(w,yw,xw) : FitFunc |
---|
537 | Wave w,yw,xw |
---|
538 | |
---|
539 | Variable inten |
---|
540 | |
---|
541 | //setup form factor coefficient wave |
---|
542 | Make/O/D/N=9 form_fuzz_2Y |
---|
543 | form_fuzz_2Y[0] = w[0] // send the real volume fraction in here, so the scaling is done correctly |
---|
544 | form_fuzz_2Y[1] = w[1] |
---|
545 | form_fuzz_2Y[2] = w[2] |
---|
546 | form_fuzz_2Y[3] = w[3] |
---|
547 | form_fuzz_2Y[4] = w[4] |
---|
548 | form_fuzz_2Y[5] = w[5] |
---|
549 | form_fuzz_2Y[6] = w[6] // w[6] is the Lorentzian scale |
---|
550 | form_fuzz_2Y[7] = w[7] |
---|
551 | form_fuzz_2Y[8] = 0 |
---|
552 | |
---|
553 | //calculate the diameter of the effective one-component sphere |
---|
554 | Variable pd,diam,Vpoly,Ravg |
---|
555 | pd = w[2] |
---|
556 | Ravg = w[1] |
---|
557 | |
---|
558 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
559 | diam = (6*Vpoly/pi)^(1/3) |
---|
560 | |
---|
561 | |
---|
562 | //setup structure factor coefficient wave |
---|
563 | Make/O/D/N=6 struct_fuzz_2Y |
---|
564 | struct_fuzz_2Y[0] = w[0] |
---|
565 | struct_fuzz_2Y[1] = diam/2 |
---|
566 | struct_fuzz_2Y[2] = w[8] |
---|
567 | struct_fuzz_2Y[3] = w[9] |
---|
568 | struct_fuzz_2Y[4] = w[10] |
---|
569 | struct_fuzz_2Y[5] = w[11] |
---|
570 | |
---|
571 | //calculate each and combine |
---|
572 | Duplicate/O xw tmp_fuzz_2Y_PQ,tmp_fuzz_2Y_SQ |
---|
573 | FuzzySpheres(form_fuzz_2Y,tmp_fuzz_2Y_PQ,xw) |
---|
574 | |
---|
575 | TwoYukawa(struct_fuzz_2Y,tmp_fuzz_2Y_SQ,xw) |
---|
576 | yw = tmp_fuzz_2Y_PQ * tmp_fuzz_2Y_SQ |
---|
577 | |
---|
578 | // yw *= w[0] // scaling is done in FuzzySpheres |
---|
579 | yw += w[12] |
---|
580 | |
---|
581 | //cleanup waves |
---|
582 | // Killwaves/Z form_fuzz_2Y,struct_fuzz_2Y |
---|
583 | |
---|
584 | return (0) |
---|
585 | End |
---|
586 | |
---|
587 | |
---|
588 | // this is all there is to the smeared calculation! |
---|
589 | Function SmearedFuzzySphere_HS(s) : FitFunc |
---|
590 | Struct ResSmearAAOStruct &s |
---|
591 | |
---|
592 | // the name of your unsmeared model (AAO) is the first argument |
---|
593 | Smear_Model_20(FuzzySphere_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
594 | |
---|
595 | return(0) |
---|
596 | End |
---|
597 | |
---|
598 | // this is all there is to the smeared calculation! |
---|
599 | Function SmearedFuzzySphere_SW(s) : FitFunc |
---|
600 | Struct ResSmearAAOStruct &s |
---|
601 | |
---|
602 | // the name of your unsmeared model (AAO) is the first argument |
---|
603 | Smear_Model_20(FuzzySphere_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
604 | |
---|
605 | return(0) |
---|
606 | End |
---|
607 | |
---|
608 | // this is all there is to the smeared calculation! |
---|
609 | Function SmearedFuzzySphere_SC(s) : FitFunc |
---|
610 | Struct ResSmearAAOStruct &s |
---|
611 | |
---|
612 | // the name of your unsmeared model (AAO) is the first argument |
---|
613 | Smear_Model_20(FuzzySphere_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
614 | |
---|
615 | return(0) |
---|
616 | End |
---|
617 | |
---|
618 | // this is all there is to the smeared calculation! |
---|
619 | Function SmearedFuzzySphere_SHS(s) : FitFunc |
---|
620 | Struct ResSmearAAOStruct &s |
---|
621 | |
---|
622 | // the name of your unsmeared model (AAO) is the first argument |
---|
623 | Smear_Model_20(FuzzySphere_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
624 | |
---|
625 | return(0) |
---|
626 | End |
---|
627 | |
---|
628 | // this is all there is to the smeared calculation! |
---|
629 | Function SmearedFuzzySphere_2Y(s) : FitFunc |
---|
630 | Struct ResSmearAAOStruct &s |
---|
631 | |
---|
632 | // the name of your unsmeared model (AAO) is the first argument |
---|
633 | Smear_Model_20(FuzzySphere_2Y,s.coefW,s.xW,s.yW,s.resW) |
---|
634 | |
---|
635 | return(0) |
---|
636 | End |
---|
637 | |
---|
638 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
639 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
640 | // |
---|
641 | // used only for the dependency, not for fitting |
---|
642 | // |
---|
643 | Function fSmearedFuzzySphere_HS(coefW,yW,xW) |
---|
644 | Wave coefW,yW,xW |
---|
645 | |
---|
646 | String str = getWavesDataFolder(yW,0) |
---|
647 | String DF="root:"+str+":" |
---|
648 | |
---|
649 | WAVE resW = $(DF+str+"_res") |
---|
650 | |
---|
651 | STRUCT ResSmearAAOStruct fs |
---|
652 | WAVE fs.coefW = coefW |
---|
653 | WAVE fs.yW = yW |
---|
654 | WAVE fs.xW = xW |
---|
655 | WAVE fs.resW = resW |
---|
656 | |
---|
657 | Variable err |
---|
658 | err = SmearedFuzzySphere_HS(fs) |
---|
659 | |
---|
660 | return (0) |
---|
661 | End |
---|
662 | |
---|
663 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
664 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
665 | // |
---|
666 | // used only for the dependency, not for fitting |
---|
667 | // |
---|
668 | Function fSmearedFuzzySphere_SW(coefW,yW,xW) |
---|
669 | Wave coefW,yW,xW |
---|
670 | |
---|
671 | String str = getWavesDataFolder(yW,0) |
---|
672 | String DF="root:"+str+":" |
---|
673 | |
---|
674 | WAVE resW = $(DF+str+"_res") |
---|
675 | |
---|
676 | STRUCT ResSmearAAOStruct fs |
---|
677 | WAVE fs.coefW = coefW |
---|
678 | WAVE fs.yW = yW |
---|
679 | WAVE fs.xW = xW |
---|
680 | WAVE fs.resW = resW |
---|
681 | |
---|
682 | Variable err |
---|
683 | err = SmearedFuzzySphere_SW(fs) |
---|
684 | |
---|
685 | return (0) |
---|
686 | End |
---|
687 | |
---|
688 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
689 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
690 | // |
---|
691 | // used only for the dependency, not for fitting |
---|
692 | // |
---|
693 | Function fSmearedFuzzySphere_SC(coefW,yW,xW) |
---|
694 | Wave coefW,yW,xW |
---|
695 | |
---|
696 | String str = getWavesDataFolder(yW,0) |
---|
697 | String DF="root:"+str+":" |
---|
698 | |
---|
699 | WAVE resW = $(DF+str+"_res") |
---|
700 | |
---|
701 | STRUCT ResSmearAAOStruct fs |
---|
702 | WAVE fs.coefW = coefW |
---|
703 | WAVE fs.yW = yW |
---|
704 | WAVE fs.xW = xW |
---|
705 | WAVE fs.resW = resW |
---|
706 | |
---|
707 | Variable err |
---|
708 | err = SmearedFuzzySphere_SC(fs) |
---|
709 | |
---|
710 | return (0) |
---|
711 | End |
---|
712 | |
---|
713 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
714 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
715 | // |
---|
716 | // used only for the dependency, not for fitting |
---|
717 | // |
---|
718 | Function fSmearedFuzzySphere_SHS(coefW,yW,xW) |
---|
719 | Wave coefW,yW,xW |
---|
720 | |
---|
721 | String str = getWavesDataFolder(yW,0) |
---|
722 | String DF="root:"+str+":" |
---|
723 | |
---|
724 | WAVE resW = $(DF+str+"_res") |
---|
725 | |
---|
726 | STRUCT ResSmearAAOStruct fs |
---|
727 | WAVE fs.coefW = coefW |
---|
728 | WAVE fs.yW = yW |
---|
729 | WAVE fs.xW = xW |
---|
730 | WAVE fs.resW = resW |
---|
731 | |
---|
732 | Variable err |
---|
733 | err = SmearedFuzzySphere_SHS(fs) |
---|
734 | |
---|
735 | return (0) |
---|
736 | End |
---|
737 | |
---|
738 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
739 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
740 | // |
---|
741 | // used only for the dependency, not for fitting |
---|
742 | // |
---|
743 | Function fSmearedFuzzySphere_2Y(coefW,yW,xW) |
---|
744 | Wave coefW,yW,xW |
---|
745 | |
---|
746 | String str = getWavesDataFolder(yW,0) |
---|
747 | String DF="root:"+str+":" |
---|
748 | |
---|
749 | WAVE resW = $(DF+str+"_res") |
---|
750 | |
---|
751 | STRUCT ResSmearAAOStruct fs |
---|
752 | WAVE fs.coefW = coefW |
---|
753 | WAVE fs.yW = yW |
---|
754 | WAVE fs.xW = xW |
---|
755 | WAVE fs.resW = resW |
---|
756 | |
---|
757 | Variable err |
---|
758 | err = SmearedFuzzySphere_2Y(fs) |
---|
759 | |
---|
760 | return (0) |
---|
761 | End |
---|