1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion=6.1 |
---|
3 | |
---|
4 | // |
---|
5 | // be sure to include all of the necessary files |
---|
6 | // |
---|
7 | #include "SchulzSpheres_v40" |
---|
8 | |
---|
9 | #include "HardSphereStruct_v40" |
---|
10 | #include "HPMSA_v40" |
---|
11 | #include "SquareWellStruct_v40" |
---|
12 | #include "StickyHardSphereStruct_v40" |
---|
13 | |
---|
14 | Proc PlotSchulzSpheres_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 (A^-1) for model: " |
---|
18 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
19 | |
---|
20 | Make/O/D/N=(num) xwave_sch_HS,ywave_sch_HS |
---|
21 | xwave_sch_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
22 | Make/O/D coef_sch_HS = {0.01,60,0.2,1e-6,3e-6,0.001} |
---|
23 | make/O/T parameters_sch_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_sch_HS,coef_sch_HS |
---|
25 | |
---|
26 | Variable/G root:g_sch_HS |
---|
27 | g_sch_HS := SchulzSpheres_HS(coef_sch_HS,ywave_sch_HS,xwave_sch_HS) |
---|
28 | Display ywave_sch_HS vs xwave_sch_HS |
---|
29 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
30 | Label bottom "q (A\\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("SchulzSpheres_HS","coef_sch_HS","parameters_sch_HS","sch_HS") |
---|
35 | End |
---|
36 | |
---|
37 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
38 | Proc PlotSmearedSchulzSpheres_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_sch_HS = {0.01,60,0.2,1e-6,3e-6,0.001} |
---|
51 | make/o/t smear_parameters_sch_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_sch_HS,smear_coef_sch_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_sch_HS,smeared_qvals |
---|
57 | SetScale d,0,0,"1/cm",smeared_sch_HS |
---|
58 | |
---|
59 | Variable/G gs_sch_HS=0 |
---|
60 | gs_sch_HS := fSmearedSchulzSpheres_HS(smear_coef_sch_HS,smeared_sch_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
61 | |
---|
62 | Display smeared_sch_HS vs smeared_qvals |
---|
63 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
64 | Label bottom "q (A\\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("SmearedSchulzSpheres_HS","smear_coef_sch_HS","smear_parameters_sch_HS","sch_HS") |
---|
70 | End |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | Function SchulzSpheres_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_sch_HS |
---|
81 | form_sch_HS[0] = 1 |
---|
82 | form_sch_HS[1] = w[1] |
---|
83 | form_sch_HS[2] = w[2] |
---|
84 | form_sch_HS[3] = w[3] |
---|
85 | form_sch_HS[4] = w[4] |
---|
86 | form_sch_HS[5] = 0 |
---|
87 | |
---|
88 | //calculate the diameter of the effective one-component sphere |
---|
89 | Variable pd,diam,zz,Vpoly,Ravg |
---|
90 | pd = w[2] |
---|
91 | zz = (1/pd)^2 - 1 |
---|
92 | Ravg = w[1] |
---|
93 | |
---|
94 | Vpoly = 4*pi/3*(Ravg)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
95 | diam = (6*Vpoly/pi)^(1/3) |
---|
96 | |
---|
97 | |
---|
98 | //setup structure factor coefficient wave |
---|
99 | Make/O/D/N=2 struct_sch_HS |
---|
100 | struct_sch_HS[0] = diam/2 |
---|
101 | struct_sch_HS[1] = w[0] |
---|
102 | |
---|
103 | //calculate each and combine |
---|
104 | Duplicate/O xw tmp_sch_HS_PQ,tmp_sch_HS_SQ |
---|
105 | SchulzSpheres(form_sch_HS,tmp_sch_HS_PQ,xw) |
---|
106 | HardSphereStruct(struct_sch_HS,tmp_sch_HS_SQ,xw) |
---|
107 | yw = tmp_sch_HS_PQ * tmp_sch_HS_SQ |
---|
108 | yw *= w[0] |
---|
109 | yw += w[5] |
---|
110 | |
---|
111 | //cleanup waves |
---|
112 | // Killwaves/Z form_sch_HS,struct_sch_HS |
---|
113 | |
---|
114 | return (0) |
---|
115 | End |
---|
116 | |
---|
117 | ///////////////////////////////////////// |
---|
118 | Proc PlotSchulzSpheres_SW(num,qmin,qmax) |
---|
119 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
120 | Prompt num "Enter number of data points for model: " |
---|
121 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
122 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
123 | |
---|
124 | Make/O/D/N=(num) xwave_sch_SW,ywave_sch_SW |
---|
125 | xwave_sch_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
126 | Make/O/D coef_sch_SW = {0.01,60,0.2,1e-6,3e-6,1.0,1.2,0.001} |
---|
127 | make/O/T parameters_sch_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)"} |
---|
128 | Edit parameters_sch_SW,coef_sch_SW |
---|
129 | |
---|
130 | Variable/G root:g_sch_SW |
---|
131 | g_sch_SW := SchulzSpheres_SW(coef_sch_SW,ywave_sch_SW,xwave_sch_SW) |
---|
132 | Display ywave_sch_SW vs xwave_sch_SW |
---|
133 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
134 | Label bottom "q (A\\S-1\\M)" |
---|
135 | Label left "Intensity (cm\\S-1\\M)" |
---|
136 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
137 | |
---|
138 | AddModelToStrings("SchulzSpheres_SW","coef_sch_SW","parameters_sch_SW","sch_SW") |
---|
139 | End |
---|
140 | |
---|
141 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
142 | Proc PlotSmearedSchulzSpheres_SW(str) |
---|
143 | String str |
---|
144 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
145 | |
---|
146 | // if any of the resolution waves are missing => abort |
---|
147 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
148 | Abort |
---|
149 | endif |
---|
150 | |
---|
151 | SetDataFolder $("root:"+str) |
---|
152 | |
---|
153 | // Setup parameter table for model function |
---|
154 | Make/O/D smear_coef_sch_SW = {0.01,60,0.2,1e-6,3e-6,1.0,1.2,0.001} |
---|
155 | make/o/t smear_parameters_sch_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)"} |
---|
156 | Edit smear_parameters_sch_SW,smear_coef_sch_SW |
---|
157 | |
---|
158 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
159 | // make extra copy of experimental q-values for easy plotting |
---|
160 | Duplicate/O $(str+"_q") smeared_sch_SW,smeared_qvals |
---|
161 | SetScale d,0,0,"1/cm",smeared_sch_SW |
---|
162 | |
---|
163 | Variable/G gs_sch_SW=0 |
---|
164 | gs_sch_SW := fSmearedSchulzSpheres_SW(smear_coef_sch_SW,smeared_sch_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
165 | |
---|
166 | Display smeared_sch_SW vs smeared_qvals |
---|
167 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
168 | Label bottom "q (A\\S-1\\M)" |
---|
169 | Label left "Intensity (cm\\S-1\\M)" |
---|
170 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
171 | |
---|
172 | SetDataFolder root: |
---|
173 | AddModelToStrings("SmearedSchulzSpheres_SW","smear_coef_sch_SW","smear_parameters_sch_SW","sch_SW") |
---|
174 | End |
---|
175 | |
---|
176 | |
---|
177 | |
---|
178 | Function SchulzSpheres_SW(w,yw,xw) : FitFunc |
---|
179 | Wave w,yw,xw |
---|
180 | |
---|
181 | Variable inten |
---|
182 | |
---|
183 | //setup form factor coefficient wave |
---|
184 | Make/O/D/N=6 form_sch_SW |
---|
185 | form_sch_SW[0] = 1 |
---|
186 | form_sch_SW[1] = w[1] |
---|
187 | form_sch_SW[2] = w[2] |
---|
188 | form_sch_SW[3] = w[3] |
---|
189 | form_sch_SW[4] = w[4] |
---|
190 | form_sch_SW[5] = 0 |
---|
191 | |
---|
192 | //calculate the diameter of the effective one-component sphere |
---|
193 | Variable pd,diam,zz,Vpoly,Ravg |
---|
194 | pd = w[2] |
---|
195 | zz = (1/pd)^2 - 1 |
---|
196 | Ravg = w[1] |
---|
197 | |
---|
198 | Vpoly = 4*pi/3*(Ravg)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
199 | diam = (6*Vpoly/pi)^(1/3) |
---|
200 | |
---|
201 | //setup structure factor coefficient wave |
---|
202 | Make/O/D/N=4 struct_sch_SW |
---|
203 | struct_sch_SW[0] = diam/2 |
---|
204 | struct_sch_SW[1] = w[0] |
---|
205 | struct_sch_SW[2] = w[5] |
---|
206 | struct_sch_SW[3] = w[6] |
---|
207 | |
---|
208 | //calculate each and combine |
---|
209 | Duplicate/O xw tmp_sch_SW_PQ,tmp_sch_SW_SQ |
---|
210 | SchulzSpheres(form_sch_SW,tmp_sch_SW_PQ,xw) |
---|
211 | SquareWellStruct(struct_sch_SW,tmp_sch_SW_SQ,xw) |
---|
212 | yw = tmp_sch_SW_PQ * tmp_sch_SW_SQ |
---|
213 | yw *= w[0] |
---|
214 | yw += w[7] |
---|
215 | |
---|
216 | //cleanup waves |
---|
217 | // Killwaves/Z form_sch_SW,struct_sch_SW |
---|
218 | |
---|
219 | return (0) |
---|
220 | End |
---|
221 | |
---|
222 | |
---|
223 | ///////////////////////////////////////// |
---|
224 | Proc PlotSchulzSpheres_SC(num,qmin,qmax) |
---|
225 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
226 | Prompt num "Enter number of data points for model: " |
---|
227 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
228 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
229 | |
---|
230 | if(!DataFolderExists(":HayPenMSA")) |
---|
231 | NewDataFolder :HayPenMSA |
---|
232 | endif |
---|
233 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
234 | |
---|
235 | Make/O/D/N=(num) xwave_sch_SC,ywave_sch_SC |
---|
236 | xwave_sch_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
237 | Make/O/D coef_sch_SC = {0.01,60,0.2,1e-6,3e-6,20,0,298,78,0.001} |
---|
238 | make/O/T parameters_sch_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)"} |
---|
239 | Edit parameters_sch_SC,coef_sch_SC |
---|
240 | |
---|
241 | Variable/G root:g_sch_SC |
---|
242 | g_sch_SC := SchulzSpheres_SC(coef_sch_SC,ywave_sch_SC,xwave_sch_SC) |
---|
243 | Display ywave_sch_SC vs xwave_sch_SC |
---|
244 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
245 | Label bottom "q (A\\S-1\\M)" |
---|
246 | Label left "Intensity (cm\\S-1\\M)" |
---|
247 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
248 | |
---|
249 | AddModelToStrings("SchulzSpheres_SC","coef_sch_SC","parameters_sch_SC","sch_SC") |
---|
250 | End |
---|
251 | |
---|
252 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
253 | Proc PlotSmearedSchulzSpheres_SC(str) |
---|
254 | String str |
---|
255 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
256 | |
---|
257 | // if any of the resolution waves are missing => abort |
---|
258 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
259 | Abort |
---|
260 | endif |
---|
261 | |
---|
262 | SetDataFolder $("root:"+str) |
---|
263 | |
---|
264 | if(!DataFolderExists(":HayPenMSA")) |
---|
265 | NewDataFolder :HayPenMSA |
---|
266 | endif |
---|
267 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
268 | |
---|
269 | // Setup parameter table for model function |
---|
270 | Make/O/D smear_coef_sch_SC = {0.01,60,0.2,1e-6,3e-6,20,0,298,78,0.001} |
---|
271 | make/o/t smear_parameters_sch_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)"} |
---|
272 | Edit smear_parameters_sch_SC,smear_coef_sch_SC |
---|
273 | |
---|
274 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
275 | // make extra copy of experimental q-values for easy plotting |
---|
276 | Duplicate/O $(str+"_q") smeared_sch_SC,smeared_qvals |
---|
277 | SetScale d,0,0,"1/cm",smeared_sch_SC |
---|
278 | |
---|
279 | Variable/G gs_sch_SC=0 |
---|
280 | gs_sch_SC := fSmearedSchulzSpheres_SC(smear_coef_sch_SC,smeared_sch_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
281 | |
---|
282 | Display smeared_sch_SC vs smeared_qvals |
---|
283 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
284 | Label bottom "q (A\\S-1\\M)" |
---|
285 | Label left "Intensity (cm\\S-1\\M)" |
---|
286 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
287 | |
---|
288 | SetDataFolder root: |
---|
289 | AddModelToStrings("SmearedSchulzSpheres_SC","smear_coef_sch_SC","smear_parameters_sch_SC","sch_SC") |
---|
290 | End |
---|
291 | |
---|
292 | |
---|
293 | Function SchulzSpheres_SC(w,yw,xw) : FitFunc |
---|
294 | Wave w,yw,xw |
---|
295 | |
---|
296 | Variable inten |
---|
297 | |
---|
298 | //setup form factor coefficient wave |
---|
299 | Make/O/D/N=6 form_sch_SC |
---|
300 | form_sch_SC[0] = 1 |
---|
301 | form_sch_SC[1] = w[1] |
---|
302 | form_sch_SC[2] = w[2] |
---|
303 | form_sch_SC[3] = w[3] |
---|
304 | form_sch_SC[4] = w[4] |
---|
305 | form_sch_SC[5] = 0 |
---|
306 | |
---|
307 | //calculate the diameter of the effective one-component sphere |
---|
308 | Variable pd,diam,zz,Vpoly,Ravg |
---|
309 | pd = w[2] |
---|
310 | zz = (1/pd)^2 - 1 |
---|
311 | Ravg = w[1] |
---|
312 | |
---|
313 | Vpoly = 4*pi/3*(Ravg)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
314 | diam = (6*Vpoly/pi)^(1/3) |
---|
315 | |
---|
316 | //setup structure factor coefficient wave |
---|
317 | Make/O/D/N=6 struct_sch_SC |
---|
318 | struct_sch_SC[0] = diam |
---|
319 | struct_sch_SC[1] = w[5] |
---|
320 | struct_sch_SC[2] = w[0] |
---|
321 | struct_sch_SC[3] = w[7] |
---|
322 | struct_sch_SC[4] = w[6] |
---|
323 | struct_sch_SC[5] = w[8] |
---|
324 | |
---|
325 | //calculate each and combine |
---|
326 | Duplicate/O xw tmp_sch_SC_PQ,tmp_sch_SC_SQ |
---|
327 | SchulzSpheres(form_sch_SC,tmp_sch_SC_PQ,xw) |
---|
328 | HayterPenfoldMSA(struct_sch_SC,tmp_sch_SC_SQ,xw) |
---|
329 | yw = tmp_sch_SC_PQ *tmp_sch_SC_SQ |
---|
330 | yw *= w[0] |
---|
331 | yw += w[9] |
---|
332 | |
---|
333 | //cleanup waves |
---|
334 | // Killwaves/Z form_sch_SC,struct_sch_SC |
---|
335 | |
---|
336 | return (0) |
---|
337 | End |
---|
338 | |
---|
339 | ///////////////////////////////////////// |
---|
340 | Proc PlotSchulzSpheres_SHS(num,qmin,qmax) |
---|
341 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
342 | Prompt num "Enter number of data points for model: " |
---|
343 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
344 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
345 | |
---|
346 | Make/O/D/N=(num) xwave_sch_SHS,ywave_sch_SHS |
---|
347 | xwave_sch_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
348 | Make/O/D coef_sch_SHS = {0.01,60,0.2,1e-6,3e-6,0.05,0.2,0.001} |
---|
349 | make/O/T parameters_sch_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)"} |
---|
350 | Edit parameters_sch_SHS,coef_sch_SHS |
---|
351 | |
---|
352 | Variable/G root:g_sch_SHS |
---|
353 | g_sch_SHS := SchulzSpheres_SHS(coef_sch_SHS,ywave_sch_SHS,xwave_sch_SHS) |
---|
354 | Display ywave_sch_SHS vs xwave_sch_SHS |
---|
355 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
356 | Label bottom "q (A\\S-1\\M)" |
---|
357 | Label left "Intensity (cm\\S-1\\M)" |
---|
358 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
359 | |
---|
360 | AddModelToStrings("SchulzSpheres_SHS","coef_sch_SHS","parameters_sch_SHS","sch_SHS") |
---|
361 | End |
---|
362 | |
---|
363 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
364 | Proc PlotSmearedSchulzSpheres_SHS(str) |
---|
365 | String str |
---|
366 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
367 | |
---|
368 | // if any of the resolution waves are missing => abort |
---|
369 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
370 | Abort |
---|
371 | endif |
---|
372 | |
---|
373 | SetDataFolder $("root:"+str) |
---|
374 | |
---|
375 | // Setup parameter table for model function |
---|
376 | Make/O/D smear_coef_sch_SHS = {0.01,60,0.2,1e-6,3e-6,0.05,0.2,0.001} |
---|
377 | make/o/t smear_parameters_sch_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)"} |
---|
378 | Edit smear_parameters_sch_SHS,smear_coef_sch_SHS |
---|
379 | |
---|
380 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
381 | // make extra copy of experimental q-values for easy plotting |
---|
382 | Duplicate/O $(str+"_q") smeared_sch_SHS,smeared_qvals |
---|
383 | SetScale d,0,0,"1/cm",smeared_sch_SHS |
---|
384 | |
---|
385 | Variable/G gs_sch_SHS=0 |
---|
386 | gs_sch_SHS := fSmearedSchulzSpheres_SHS(smear_coef_sch_SHS,smeared_sch_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
387 | |
---|
388 | Display smeared_sch_SHS vs smeared_qvals |
---|
389 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
390 | Label bottom "q (A\\S-1\\M)" |
---|
391 | Label left "Intensity (cm\\S-1\\M)" |
---|
392 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
393 | |
---|
394 | SetDataFolder root: |
---|
395 | AddModelToStrings("SmearedSchulzSpheres_SHS","smear_coef_sch_SHS","smear_parameters_sch_SHS","sch_SHS") |
---|
396 | End |
---|
397 | |
---|
398 | |
---|
399 | Function SchulzSpheres_SHS(w,yw,xw) : FitFunc |
---|
400 | Wave w,yw,xw |
---|
401 | |
---|
402 | Variable inten |
---|
403 | |
---|
404 | //setup form factor coefficient wave |
---|
405 | Make/O/D/N=6 form_sch_SHS |
---|
406 | form_sch_SHS[0] = 1 |
---|
407 | form_sch_SHS[1] = w[1] |
---|
408 | form_sch_SHS[2] = w[2] |
---|
409 | form_sch_SHS[3] = w[3] |
---|
410 | form_sch_SHS[4] = w[4] |
---|
411 | form_sch_SHS[5] = 0 |
---|
412 | |
---|
413 | //calculate the diameter of the effective one-component sphere |
---|
414 | Variable pd,diam,zz,Vpoly,Ravg |
---|
415 | pd = w[2] |
---|
416 | zz = (1/pd)^2 - 1 |
---|
417 | Ravg = w[1] |
---|
418 | |
---|
419 | Vpoly = 4*pi/3*(Ravg)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
420 | diam = (6*Vpoly/pi)^(1/3) |
---|
421 | |
---|
422 | //setup structure factor coefficient wave |
---|
423 | Make/O/D/N=4 struct_sch_SHS |
---|
424 | struct_sch_SHS[0] = diam/2 |
---|
425 | struct_sch_SHS[1] = w[0] |
---|
426 | struct_sch_SHS[2] = w[5] |
---|
427 | struct_sch_SHS[3] = w[6] |
---|
428 | |
---|
429 | //calculate each and combine |
---|
430 | Duplicate/O xw tmp_sch_SHS_PQ,tmp_sch_SHS_SQ |
---|
431 | SchulzSpheres(form_sch_SHS,tmp_sch_SHS_PQ,xw) |
---|
432 | StickyHS_Struct(struct_sch_SHS,tmp_sch_SHS_SQ,xw) |
---|
433 | yw = tmp_sch_SHS_PQ * tmp_sch_SHS_SQ |
---|
434 | yw *= w[0] |
---|
435 | yw += w[7] |
---|
436 | |
---|
437 | //cleanup waves |
---|
438 | // Killwaves/Z form_sch_SHS,struct_sch_SHS |
---|
439 | |
---|
440 | return (0) |
---|
441 | End |
---|
442 | |
---|
443 | |
---|
444 | |
---|
445 | // this is all there is to the smeared calculation! |
---|
446 | Function SmearedSchulzSpheres_HS(s) : FitFunc |
---|
447 | Struct ResSmearAAOStruct &s |
---|
448 | |
---|
449 | // the name of your unsmeared model (AAO) is the first argument |
---|
450 | Smear_Model_20(SchulzSpheres_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
451 | |
---|
452 | return(0) |
---|
453 | End |
---|
454 | |
---|
455 | // this is all there is to the smeared calculation! |
---|
456 | Function SmearedSchulzSpheres_SW(s) : FitFunc |
---|
457 | Struct ResSmearAAOStruct &s |
---|
458 | |
---|
459 | // the name of your unsmeared model (AAO) is the first argument |
---|
460 | Smear_Model_20(SchulzSpheres_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
461 | |
---|
462 | return(0) |
---|
463 | End |
---|
464 | |
---|
465 | // this is all there is to the smeared calculation! |
---|
466 | Function SmearedSchulzSpheres_SC(s) : FitFunc |
---|
467 | Struct ResSmearAAOStruct &s |
---|
468 | |
---|
469 | // the name of your unsmeared model (AAO) is the first argument |
---|
470 | Smear_Model_20(SchulzSpheres_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
471 | |
---|
472 | return(0) |
---|
473 | End |
---|
474 | |
---|
475 | // this is all there is to the smeared calculation! |
---|
476 | Function SmearedSchulzSpheres_SHS(s) : FitFunc |
---|
477 | Struct ResSmearAAOStruct &s |
---|
478 | |
---|
479 | // the name of your unsmeared model (AAO) is the first argument |
---|
480 | Smear_Model_20(SchulzSpheres_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
481 | |
---|
482 | return(0) |
---|
483 | End |
---|
484 | |
---|
485 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
486 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
487 | // |
---|
488 | // used only for the dependency, not for fitting |
---|
489 | // |
---|
490 | Function fSmearedSchulzSpheres_HS(coefW,yW,xW) |
---|
491 | Wave coefW,yW,xW |
---|
492 | |
---|
493 | String str = getWavesDataFolder(yW,0) |
---|
494 | String DF="root:"+str+":" |
---|
495 | |
---|
496 | WAVE resW = $(DF+str+"_res") |
---|
497 | |
---|
498 | STRUCT ResSmearAAOStruct fs |
---|
499 | WAVE fs.coefW = coefW |
---|
500 | WAVE fs.yW = yW |
---|
501 | WAVE fs.xW = xW |
---|
502 | WAVE fs.resW = resW |
---|
503 | |
---|
504 | Variable err |
---|
505 | err = SmearedSchulzSpheres_HS(fs) |
---|
506 | |
---|
507 | return (0) |
---|
508 | End |
---|
509 | |
---|
510 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
511 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
512 | // |
---|
513 | // used only for the dependency, not for fitting |
---|
514 | // |
---|
515 | Function fSmearedSchulzSpheres_SW(coefW,yW,xW) |
---|
516 | Wave coefW,yW,xW |
---|
517 | |
---|
518 | String str = getWavesDataFolder(yW,0) |
---|
519 | String DF="root:"+str+":" |
---|
520 | |
---|
521 | WAVE resW = $(DF+str+"_res") |
---|
522 | |
---|
523 | STRUCT ResSmearAAOStruct fs |
---|
524 | WAVE fs.coefW = coefW |
---|
525 | WAVE fs.yW = yW |
---|
526 | WAVE fs.xW = xW |
---|
527 | WAVE fs.resW = resW |
---|
528 | |
---|
529 | Variable err |
---|
530 | err = SmearedSchulzSpheres_SW(fs) |
---|
531 | |
---|
532 | return (0) |
---|
533 | End |
---|
534 | |
---|
535 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
536 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
537 | // |
---|
538 | // used only for the dependency, not for fitting |
---|
539 | // |
---|
540 | Function fSmearedSchulzSpheres_SC(coefW,yW,xW) |
---|
541 | Wave coefW,yW,xW |
---|
542 | |
---|
543 | String str = getWavesDataFolder(yW,0) |
---|
544 | String DF="root:"+str+":" |
---|
545 | |
---|
546 | WAVE resW = $(DF+str+"_res") |
---|
547 | |
---|
548 | STRUCT ResSmearAAOStruct fs |
---|
549 | WAVE fs.coefW = coefW |
---|
550 | WAVE fs.yW = yW |
---|
551 | WAVE fs.xW = xW |
---|
552 | WAVE fs.resW = resW |
---|
553 | |
---|
554 | Variable err |
---|
555 | err = SmearedSchulzSpheres_SC(fs) |
---|
556 | |
---|
557 | return (0) |
---|
558 | End |
---|
559 | |
---|
560 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
561 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
562 | // |
---|
563 | // used only for the dependency, not for fitting |
---|
564 | // |
---|
565 | Function fSmearedSchulzSpheres_SHS(coefW,yW,xW) |
---|
566 | Wave coefW,yW,xW |
---|
567 | |
---|
568 | String str = getWavesDataFolder(yW,0) |
---|
569 | String DF="root:"+str+":" |
---|
570 | |
---|
571 | WAVE resW = $(DF+str+"_res") |
---|
572 | |
---|
573 | STRUCT ResSmearAAOStruct fs |
---|
574 | WAVE fs.coefW = coefW |
---|
575 | WAVE fs.yW = yW |
---|
576 | WAVE fs.xW = xW |
---|
577 | WAVE fs.resW = resW |
---|
578 | |
---|
579 | Variable err |
---|
580 | err = SmearedSchulzSpheres_SHS(fs) |
---|
581 | |
---|
582 | return (0) |
---|
583 | End |
---|