1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion = 6.0 |
---|
3 | |
---|
4 | // |
---|
5 | // be sure to include all of the necessary files |
---|
6 | // |
---|
7 | #include "GaussSpheres_v40" |
---|
8 | |
---|
9 | #include "HardSphereStruct_v40" |
---|
10 | #include "HPMSA_v40" |
---|
11 | #include "SquareWellStruct_v40" |
---|
12 | #include "StickyHardSphereStruct_v40" |
---|
13 | |
---|
14 | Proc PlotGaussPolySphere_HS(num,qmin,qmax) |
---|
15 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
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/D/N=(num) xwave_pgs_HS,ywave_pgs_HS |
---|
21 | xwave_pgs_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
22 | Make/O/D coef_pgs_HS = {0.01,60,0.2,1e-6,3e-6,0.001} |
---|
23 | make/O/T parameters_pgs_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} |
---|
24 | Edit parameters_pgs_HS,coef_pgs_HS |
---|
25 | |
---|
26 | Variable/G root:g_pgs_HS |
---|
27 | g_pgs_HS := GaussPolySphere_HS(coef_pgs_HS,ywave_pgs_HS,xwave_pgs_HS) |
---|
28 | Display ywave_pgs_HS vs xwave_pgs_HS |
---|
29 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
30 | Label bottom "q (\\S-1\\M)" |
---|
31 | Label left "Intensity (cm\\S-1\\M)" |
---|
32 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
33 | |
---|
34 | AddModelToStrings("GaussPolySphere_HS","coef_pgs_HS","pgs_HS") |
---|
35 | End |
---|
36 | |
---|
37 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
38 | Proc PlotSmearedGaussPolySphere_HS(str) |
---|
39 | String str |
---|
40 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
41 | |
---|
42 | // if any of the resolution waves are missing => abort |
---|
43 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
44 | Abort |
---|
45 | endif |
---|
46 | |
---|
47 | SetDataFolder $("root:"+str) |
---|
48 | |
---|
49 | // Setup parameter table for model function |
---|
50 | Make/O/D smear_coef_pgs_HS = {0.01,60,0.2,1e-6,3e-6,0.001} |
---|
51 | make/o/t smear_parameters_pgs_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} |
---|
52 | Edit smear_parameters_pgs_HS,smear_coef_pgs_HS |
---|
53 | |
---|
54 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
55 | // make extra copy of experimental q-values for easy plotting |
---|
56 | Duplicate/O $(str+"_q") smeared_pgs_HS,smeared_qvals |
---|
57 | SetScale d,0,0,"1/cm",smeared_pgs_HS |
---|
58 | |
---|
59 | Variable/G gs_pgs_HS=0 |
---|
60 | gs_pgs_HS := fSmearedGaussPolySphere_HS(smear_coef_pgs_HS,smeared_pgs_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
61 | |
---|
62 | Display smeared_pgs_HS vs smeared_qvals |
---|
63 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
64 | Label bottom "q (\\S-1\\M)" |
---|
65 | Label left "Intensity (cm\\S-1\\M)" |
---|
66 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
67 | |
---|
68 | SetDataFolder root: |
---|
69 | AddModelToStrings("SmearedGaussPolySphere_HS","smear_coef_pgs_HS","pgs_HS") |
---|
70 | End |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | Function GaussPolySphere_HS(w,yw,xw) : FitFunc |
---|
75 | Wave w,yw,xw |
---|
76 | |
---|
77 | Variable inten |
---|
78 | |
---|
79 | //setup form factor coefficient wave |
---|
80 | Make/O/D/N=6 form_pgs_HS |
---|
81 | form_pgs_HS[0] = 1 |
---|
82 | form_pgs_HS[1] = w[1] |
---|
83 | form_pgs_HS[2] = w[2] |
---|
84 | form_pgs_HS[3] = w[3] |
---|
85 | form_pgs_HS[4] = w[4] |
---|
86 | form_pgs_HS[5] = 0 |
---|
87 | |
---|
88 | //calculate the diameter of the effective one-component sphere |
---|
89 | Variable pd,diam,Vpoly,Ravg |
---|
90 | pd = w[2] |
---|
91 | Ravg = w[1] |
---|
92 | |
---|
93 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
94 | diam = (6*Vpoly/pi)^(1/3) |
---|
95 | |
---|
96 | |
---|
97 | //setup structure factor coefficient wave |
---|
98 | Make/O/D/N=2 struct_pgs_HS |
---|
99 | struct_pgs_HS[0] = diam/2 |
---|
100 | struct_pgs_HS[1] = w[0] |
---|
101 | |
---|
102 | //calculate each and combine |
---|
103 | Duplicate/O xw tmp_pgs_HS_PQ,tmp_pgs_HS_SQ |
---|
104 | GaussSpheres(form_pgs_HS,tmp_pgs_HS_PQ,xw) |
---|
105 | HardSphereStruct(struct_pgs_HS,tmp_pgs_HS_SQ,xw) |
---|
106 | yw = tmp_pgs_HS_PQ * tmp_pgs_HS_SQ |
---|
107 | yw *= w[0] |
---|
108 | yw += w[5] |
---|
109 | |
---|
110 | //cleanup waves |
---|
111 | // Killwaves/Z form_pgs_HS,struct_pgs_HS |
---|
112 | |
---|
113 | return (0) |
---|
114 | End |
---|
115 | |
---|
116 | ///////////////////////////////////////// |
---|
117 | Proc PlotGaussPolySphere_SW(num,qmin,qmax) |
---|
118 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
119 | Prompt num "Enter number of data points for model: " |
---|
120 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
121 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
122 | |
---|
123 | Make/O/D/N=(num) xwave_pgs_SW,ywave_pgs_SW |
---|
124 | xwave_pgs_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
125 | Make/O/D coef_pgs_SW = {0.01,60,0.2,1e-6,3e-6,1.0,1.2,0.001} |
---|
126 | make/O/T parameters_pgs_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
127 | Edit parameters_pgs_SW,coef_pgs_SW |
---|
128 | |
---|
129 | Variable/G root:g_pgs_SW |
---|
130 | g_pgs_SW := GaussPolySphere_SW(coef_pgs_SW,ywave_pgs_SW,xwave_pgs_SW) |
---|
131 | Display ywave_pgs_SW vs xwave_pgs_SW |
---|
132 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
133 | Label bottom "q (\\S-1\\M)" |
---|
134 | Label left "Intensity (cm\\S-1\\M)" |
---|
135 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
136 | |
---|
137 | AddModelToStrings("GaussPolySphere_SW","coef_pgs_SW","pgs_SW") |
---|
138 | End |
---|
139 | |
---|
140 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
141 | Proc PlotSmearedGaussPolySphere_SW(str) |
---|
142 | String str |
---|
143 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
144 | |
---|
145 | // if any of the resolution waves are missing => abort |
---|
146 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
147 | Abort |
---|
148 | endif |
---|
149 | |
---|
150 | SetDataFolder $("root:"+str) |
---|
151 | |
---|
152 | // Setup parameter table for model function |
---|
153 | Make/O/D smear_coef_pgs_SW = {0.01,60,0.2,1e-6,3e-6,1.0,1.2,0.001} |
---|
154 | make/o/t smear_parameters_pgs_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
155 | Edit smear_parameters_pgs_SW,smear_coef_pgs_SW |
---|
156 | |
---|
157 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
158 | // make extra copy of experimental q-values for easy plotting |
---|
159 | Duplicate/O $(str+"_q") smeared_pgs_SW,smeared_qvals |
---|
160 | SetScale d,0,0,"1/cm",smeared_pgs_SW |
---|
161 | |
---|
162 | Variable/G gs_pgs_SW=0 |
---|
163 | gs_pgs_SW := fSmearedGaussPolySphere_SW(smear_coef_pgs_SW,smeared_pgs_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
164 | |
---|
165 | Display smeared_pgs_SW vs smeared_qvals |
---|
166 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
167 | Label bottom "q (\\S-1\\M)" |
---|
168 | Label left "Intensity (cm\\S-1\\M)" |
---|
169 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
170 | |
---|
171 | SetDataFolder root: |
---|
172 | AddModelToStrings("SmearedGaussPolySphere_SW","smear_coef_pgs_SW","pgs_SW") |
---|
173 | End |
---|
174 | |
---|
175 | |
---|
176 | Function GaussPolySphere_SW(w,yw,xw) : FitFunc |
---|
177 | Wave w,yw,xw |
---|
178 | |
---|
179 | Variable inten |
---|
180 | |
---|
181 | //setup form factor coefficient wave |
---|
182 | Make/O/D/N=6 form_pgs_SW |
---|
183 | form_pgs_SW[0] = 1 |
---|
184 | form_pgs_SW[1] = w[1] |
---|
185 | form_pgs_SW[2] = w[2] |
---|
186 | form_pgs_SW[3] = w[3] |
---|
187 | form_pgs_SW[4] = w[4] |
---|
188 | form_pgs_SW[5] = 0 |
---|
189 | |
---|
190 | //calculate the diameter of the effective one-component sphere |
---|
191 | Variable pd,diam,Vpoly,Ravg |
---|
192 | pd = w[2] |
---|
193 | Ravg = w[1] |
---|
194 | |
---|
195 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
196 | diam = (6*Vpoly/pi)^(1/3) |
---|
197 | |
---|
198 | //setup structure factor coefficient wave |
---|
199 | Make/O/D/N=4 struct_pgs_SW |
---|
200 | struct_pgs_SW[0] = diam/2 |
---|
201 | struct_pgs_SW[1] = w[0] |
---|
202 | struct_pgs_SW[2] = w[5] |
---|
203 | struct_pgs_SW[3] = w[6] |
---|
204 | |
---|
205 | //calculate each and combine |
---|
206 | Duplicate/O xw tmp_pgs_SW_PQ,tmp_pgs_SW_SQ |
---|
207 | GaussSpheres(form_pgs_SW,tmp_pgs_SW_PQ,xw) |
---|
208 | SquareWellStruct(struct_pgs_SW,tmp_pgs_SW_SQ,xw) |
---|
209 | yw = tmp_pgs_SW_PQ * tmp_pgs_SW_SQ |
---|
210 | yw *= w[0] |
---|
211 | yw += w[7] |
---|
212 | |
---|
213 | //cleanup waves |
---|
214 | // Killwaves/Z form_pgs_SW,struct_pgs_SW |
---|
215 | |
---|
216 | return (0) |
---|
217 | End |
---|
218 | |
---|
219 | |
---|
220 | ///////////////////////////////////////// |
---|
221 | Proc PlotGaussPolySphere_SC(num,qmin,qmax) |
---|
222 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
223 | Prompt num "Enter number of data points for model: " |
---|
224 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
225 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
226 | |
---|
227 | if(!DataFolderExists(":HayPenMSA")) |
---|
228 | NewDataFolder :HayPenMSA |
---|
229 | endif |
---|
230 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
231 | |
---|
232 | Make/O/D/N=(num) xwave_pgs_SC,ywave_pgs_SC |
---|
233 | xwave_pgs_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
234 | Make/O/D coef_pgs_SC = {0.01,60,0.2,1e-6,3e-6,20,0,298,78,0.001} |
---|
235 | make/O/T parameters_pgs_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
236 | Edit parameters_pgs_SC,coef_pgs_SC |
---|
237 | |
---|
238 | Variable/G root:g_pgs_SC |
---|
239 | g_pgs_SC := GaussPolySphere_SC(coef_pgs_SC,ywave_pgs_SC,xwave_pgs_SC) |
---|
240 | Display ywave_pgs_SC vs xwave_pgs_SC |
---|
241 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
242 | Label bottom "q (\\S-1\\M)" |
---|
243 | Label left "Intensity (cm\\S-1\\M)" |
---|
244 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
245 | |
---|
246 | AddModelToStrings("GaussPolySphere_SC","coef_pgs_SC","pgs_SC") |
---|
247 | End |
---|
248 | |
---|
249 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
250 | Proc PlotSmearedGaussPolySphere_SC(str) |
---|
251 | String str |
---|
252 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
253 | |
---|
254 | // if any of the resolution waves are missing => abort |
---|
255 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
256 | Abort |
---|
257 | endif |
---|
258 | |
---|
259 | SetDataFolder $("root:"+str) |
---|
260 | |
---|
261 | if(!DataFolderExists(":HayPenMSA")) |
---|
262 | NewDataFolder :HayPenMSA |
---|
263 | endif |
---|
264 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
265 | |
---|
266 | // Setup parameter table for model function |
---|
267 | Make/O/D smear_coef_pgs_SC = {0.01,60,0.2,1e-6,3e-6,20,0,298,78,0.001} |
---|
268 | make/o/t smear_parameters_pgs_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
269 | Edit smear_parameters_pgs_SC,smear_coef_pgs_SC |
---|
270 | |
---|
271 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
272 | // make extra copy of experimental q-values for easy plotting |
---|
273 | Duplicate/O $(str+"_q") smeared_pgs_SC,smeared_qvals |
---|
274 | SetScale d,0,0,"1/cm",smeared_pgs_SC |
---|
275 | |
---|
276 | Variable/G gs_pgs_SC=0 |
---|
277 | gs_pgs_SC := fSmearedGaussPolySphere_SC(smear_coef_pgs_SC,smeared_pgs_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
278 | |
---|
279 | Display smeared_pgs_SC vs smeared_qvals |
---|
280 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
281 | Label bottom "q (\\S-1\\M)" |
---|
282 | Label left "Intensity (cm\\S-1\\M)" |
---|
283 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
284 | |
---|
285 | SetDataFolder root: |
---|
286 | AddModelToStrings("SmearedGaussPolySphere_SC","smear_coef_pgs_SC","pgs_SC") |
---|
287 | End |
---|
288 | |
---|
289 | |
---|
290 | Function GaussPolySphere_SC(w,yw,xw) : FitFunc |
---|
291 | Wave w,yw,xw |
---|
292 | |
---|
293 | Variable inten |
---|
294 | |
---|
295 | //setup form factor coefficient wave |
---|
296 | Make/O/D/N=6 form_pgs_SC |
---|
297 | form_pgs_SC[0] = 1 |
---|
298 | form_pgs_SC[1] = w[1] |
---|
299 | form_pgs_SC[2] = w[2] |
---|
300 | form_pgs_SC[3] = w[3] |
---|
301 | form_pgs_SC[4] = w[4] |
---|
302 | form_pgs_SC[5] = 0 |
---|
303 | |
---|
304 | //calculate the diameter of the effective one-component sphere |
---|
305 | Variable pd,diam,Vpoly,Ravg |
---|
306 | pd = w[2] |
---|
307 | Ravg = w[1] |
---|
308 | |
---|
309 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
310 | diam = (6*Vpoly/pi)^(1/3) |
---|
311 | |
---|
312 | //setup structure factor coefficient wave |
---|
313 | Make/O/D/N=6 struct_pgs_SC |
---|
314 | struct_pgs_SC[0] = diam |
---|
315 | struct_pgs_SC[1] = w[5] |
---|
316 | struct_pgs_SC[2] = w[0] |
---|
317 | struct_pgs_SC[3] = w[7] |
---|
318 | struct_pgs_SC[4] = w[6] |
---|
319 | struct_pgs_SC[5] = w[8] |
---|
320 | |
---|
321 | //calculate each and combine |
---|
322 | Duplicate/O xw tmp_pgs_SC_PQ,tmp_pgs_SC_SQ |
---|
323 | GaussSpheres(form_pgs_SC,tmp_pgs_SC_PQ,xw) |
---|
324 | HayterPenfoldMSA(struct_pgs_SC,tmp_pgs_SC_SQ,xw) |
---|
325 | yw = tmp_pgs_SC_PQ * tmp_pgs_SC_SQ |
---|
326 | yw *= w[0] |
---|
327 | yw += w[9] |
---|
328 | |
---|
329 | //cleanup waves |
---|
330 | // Killwaves/Z form_pgs_SC,struct_pgs_SC |
---|
331 | |
---|
332 | return (0) |
---|
333 | End |
---|
334 | |
---|
335 | ///////////////////////////////////////// |
---|
336 | Proc PlotGaussPolySphere_SHS(num,qmin,qmax) |
---|
337 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
338 | Prompt num "Enter number of data points for model: " |
---|
339 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
340 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
341 | |
---|
342 | Make/O/D/N=(num) xwave_pgs_SHS,ywave_pgs_SHS |
---|
343 | xwave_pgs_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
344 | Make/O/D coef_pgs_SHS = {0.01,60,0.2,1e-6,3e-6,0.05,0.2,0.001} |
---|
345 | make/O/T parameters_pgs_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
346 | Edit parameters_pgs_SHS,coef_pgs_SHS |
---|
347 | |
---|
348 | Variable/G root:g_pgs_SHS |
---|
349 | g_pgs_SHS := GaussPolySphere_SHS(coef_pgs_SHS,ywave_pgs_SHS,xwave_pgs_SHS) |
---|
350 | Display ywave_pgs_SHS vs xwave_pgs_SHS |
---|
351 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
352 | Label bottom "q (\\S-1\\M)" |
---|
353 | Label left "Intensity (cm\\S-1\\M)" |
---|
354 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
355 | |
---|
356 | AddModelToStrings("GaussPolySphere_SHS","coef_pgs_SHS","pgs_SHS") |
---|
357 | End |
---|
358 | |
---|
359 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
360 | Proc PlotSmearedGaussPolySphere_SHS(str) |
---|
361 | String str |
---|
362 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
363 | |
---|
364 | // if any of the resolution waves are missing => abort |
---|
365 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
366 | Abort |
---|
367 | endif |
---|
368 | |
---|
369 | SetDataFolder $("root:"+str) |
---|
370 | |
---|
371 | // Setup parameter table for model function |
---|
372 | Make/O/D smear_coef_pgs_SHS = {0.01,60,0.2,1e-6,3e-6,0.05,0.2,0.001} |
---|
373 | make/o/t smear_parameters_pgs_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
374 | Edit smear_parameters_pgs_SHS,smear_coef_pgs_SHS |
---|
375 | |
---|
376 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
377 | // make extra copy of experimental q-values for easy plotting |
---|
378 | Duplicate/O $(str+"_q") smeared_pgs_SHS,smeared_qvals |
---|
379 | SetScale d,0,0,"1/cm",smeared_pgs_SHS |
---|
380 | |
---|
381 | Variable/G gs_pgs_SHS=0 |
---|
382 | gs_pgs_SHS := fSmearedGaussPolySphere_SHS(smear_coef_pgs_SHS,smeared_pgs_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
383 | |
---|
384 | Display smeared_pgs_SHS vs smeared_qvals |
---|
385 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
386 | Label bottom "q (\\S-1\\M)" |
---|
387 | Label left "Intensity (cm\\S-1\\M)" |
---|
388 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
389 | |
---|
390 | SetDataFolder root: |
---|
391 | AddModelToStrings("SmearedGaussPolySphere_SHS","smear_coef_pgs_SHS","pgs_SHS") |
---|
392 | End |
---|
393 | |
---|
394 | |
---|
395 | Function GaussPolySphere_SHS(w,yw,xw) : FitFunc |
---|
396 | Wave w,yw,xw |
---|
397 | |
---|
398 | Variable inten |
---|
399 | |
---|
400 | //setup form factor coefficient wave |
---|
401 | Make/O/D/N=6 form_pgs_SHS |
---|
402 | form_pgs_SHS[0] = 1 |
---|
403 | form_pgs_SHS[1] = w[1] |
---|
404 | form_pgs_SHS[2] = w[2] |
---|
405 | form_pgs_SHS[3] = w[3] |
---|
406 | form_pgs_SHS[4] = w[4] |
---|
407 | form_pgs_SHS[5] = 0 |
---|
408 | |
---|
409 | //calculate the diameter of the effective one-component sphere |
---|
410 | Variable pd,diam,Vpoly,Ravg |
---|
411 | pd = w[2] |
---|
412 | Ravg = w[1] |
---|
413 | |
---|
414 | Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2) |
---|
415 | diam = (6*Vpoly/pi)^(1/3) |
---|
416 | |
---|
417 | //setup structure factor coefficient wave |
---|
418 | Make/O/D/N=4 struct_pgs_SHS |
---|
419 | struct_pgs_SHS[0] = diam/2 |
---|
420 | struct_pgs_SHS[1] = w[0] |
---|
421 | struct_pgs_SHS[2] = w[5] |
---|
422 | struct_pgs_SHS[3] = w[6] |
---|
423 | |
---|
424 | //calculate each and combine |
---|
425 | Duplicate/O xw tmp_pgs_SHS_PQ,tmp_pgs_SHS_SQ |
---|
426 | GaussSpheres(form_pgs_SHS,tmp_pgs_SHS_PQ,xw) |
---|
427 | StickyHS_Struct(struct_pgs_SHS,tmp_pgs_SHS_SQ,xw) |
---|
428 | yw = tmp_pgs_SHS_PQ * tmp_pgs_SHS_SQ |
---|
429 | yw *= w[0] |
---|
430 | yw += w[7] |
---|
431 | |
---|
432 | //cleanup waves |
---|
433 | // Killwaves/Z form_pgs_SHS,struct_pgs_SHS |
---|
434 | |
---|
435 | return (0) |
---|
436 | End |
---|
437 | |
---|
438 | |
---|
439 | |
---|
440 | // this is all there is to the smeared calculation! |
---|
441 | Function SmearedGaussPolySphere_HS(s) : FitFunc |
---|
442 | Struct ResSmearAAOStruct &s |
---|
443 | |
---|
444 | // the name of your unsmeared model (AAO) is the first argument |
---|
445 | Smear_Model_20(GaussPolySphere_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
446 | |
---|
447 | return(0) |
---|
448 | End |
---|
449 | |
---|
450 | // this is all there is to the smeared calculation! |
---|
451 | Function SmearedGaussPolySphere_SW(s) : FitFunc |
---|
452 | Struct ResSmearAAOStruct &s |
---|
453 | |
---|
454 | // the name of your unsmeared model (AAO) is the first argument |
---|
455 | Smear_Model_20(GaussPolySphere_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
456 | |
---|
457 | return(0) |
---|
458 | End |
---|
459 | |
---|
460 | // this is all there is to the smeared calculation! |
---|
461 | Function SmearedGaussPolySphere_SC(s) : FitFunc |
---|
462 | Struct ResSmearAAOStruct &s |
---|
463 | |
---|
464 | // the name of your unsmeared model (AAO) is the first argument |
---|
465 | Smear_Model_20(GaussPolySphere_SC,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 SmearedGaussPolySphere_SHS(s) : FitFunc |
---|
472 | Struct ResSmearAAOStruct &s |
---|
473 | |
---|
474 | // the name of your unsmeared model (AAO) is the first argument |
---|
475 | Smear_Model_20(GaussPolySphere_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
476 | |
---|
477 | return(0) |
---|
478 | End |
---|
479 | |
---|
480 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
481 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
482 | // |
---|
483 | // used only for the dependency, not for fitting |
---|
484 | // |
---|
485 | Function fSmearedGaussPolySphere_HS(coefW,yW,xW) |
---|
486 | Wave coefW,yW,xW |
---|
487 | |
---|
488 | String str = getWavesDataFolder(yW,0) |
---|
489 | String DF="root:"+str+":" |
---|
490 | |
---|
491 | WAVE resW = $(DF+str+"_res") |
---|
492 | |
---|
493 | STRUCT ResSmearAAOStruct fs |
---|
494 | WAVE fs.coefW = coefW |
---|
495 | WAVE fs.yW = yW |
---|
496 | WAVE fs.xW = xW |
---|
497 | WAVE fs.resW = resW |
---|
498 | |
---|
499 | Variable err |
---|
500 | err = SmearedGaussPolySphere_HS(fs) |
---|
501 | |
---|
502 | return (0) |
---|
503 | End |
---|
504 | |
---|
505 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
506 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
507 | // |
---|
508 | // used only for the dependency, not for fitting |
---|
509 | // |
---|
510 | Function fSmearedGaussPolySphere_SW(coefW,yW,xW) |
---|
511 | Wave coefW,yW,xW |
---|
512 | |
---|
513 | String str = getWavesDataFolder(yW,0) |
---|
514 | String DF="root:"+str+":" |
---|
515 | |
---|
516 | WAVE resW = $(DF+str+"_res") |
---|
517 | |
---|
518 | STRUCT ResSmearAAOStruct fs |
---|
519 | WAVE fs.coefW = coefW |
---|
520 | WAVE fs.yW = yW |
---|
521 | WAVE fs.xW = xW |
---|
522 | WAVE fs.resW = resW |
---|
523 | |
---|
524 | Variable err |
---|
525 | err = SmearedGaussPolySphere_SW(fs) |
---|
526 | |
---|
527 | return (0) |
---|
528 | End |
---|
529 | |
---|
530 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
531 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
532 | // |
---|
533 | // used only for the dependency, not for fitting |
---|
534 | // |
---|
535 | Function fSmearedGaussPolySphere_SC(coefW,yW,xW) |
---|
536 | Wave coefW,yW,xW |
---|
537 | |
---|
538 | String str = getWavesDataFolder(yW,0) |
---|
539 | String DF="root:"+str+":" |
---|
540 | |
---|
541 | WAVE resW = $(DF+str+"_res") |
---|
542 | |
---|
543 | STRUCT ResSmearAAOStruct fs |
---|
544 | WAVE fs.coefW = coefW |
---|
545 | WAVE fs.yW = yW |
---|
546 | WAVE fs.xW = xW |
---|
547 | WAVE fs.resW = resW |
---|
548 | |
---|
549 | Variable err |
---|
550 | err = SmearedGaussPolySphere_SC(fs) |
---|
551 | |
---|
552 | return (0) |
---|
553 | End |
---|
554 | |
---|
555 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
556 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
557 | // |
---|
558 | // used only for the dependency, not for fitting |
---|
559 | // |
---|
560 | Function fSmearedGaussPolySphere_SHS(coefW,yW,xW) |
---|
561 | Wave coefW,yW,xW |
---|
562 | |
---|
563 | String str = getWavesDataFolder(yW,0) |
---|
564 | String DF="root:"+str+":" |
---|
565 | |
---|
566 | WAVE resW = $(DF+str+"_res") |
---|
567 | |
---|
568 | STRUCT ResSmearAAOStruct fs |
---|
569 | WAVE fs.coefW = coefW |
---|
570 | WAVE fs.yW = yW |
---|
571 | WAVE fs.xW = xW |
---|
572 | WAVE fs.resW = resW |
---|
573 | |
---|
574 | Variable err |
---|
575 | err = SmearedGaussPolySphere_SHS(fs) |
---|
576 | |
---|
577 | return (0) |
---|
578 | End |
---|
579 | |
---|