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