1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion=6.1 |
---|
3 | |
---|
4 | // be sure to include all the necessary files... |
---|
5 | |
---|
6 | #include "PolyRectSphere_v40" |
---|
7 | |
---|
8 | #include "HardSphereStruct_v40" |
---|
9 | #include "HPMSA_v40" |
---|
10 | #include "SquareWellStruct_v40" |
---|
11 | #include "StickyHardSphereStruct_v40" |
---|
12 | |
---|
13 | Proc PlotPolyRectSphere_HS(num,qmin,qmax) |
---|
14 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
15 | Prompt num "Enter number of data points for model: " |
---|
16 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
17 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
18 | |
---|
19 | Make/O/D/n=(num) xwave_RECT_HS,ywave_RECT_HS |
---|
20 | xwave_RECT_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
21 | Make/O/D coef_RECT_HS = {0.1,60,0.1,1e-6,6.3e-6,0.0001} |
---|
22 | make/o/t parameters_RECT_HS = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","bkg (cm-1)"} |
---|
23 | Edit/K=1 parameters_RECT_HS,coef_RECT_HS |
---|
24 | |
---|
25 | Variable/G root:g_RECT_HS |
---|
26 | g_RECT_HS := PolyRectSphere_HS(coef_RECT_HS,ywave_RECT_HS,xwave_RECT_HS) |
---|
27 | Display/K=1 ywave_RECT_HS vs xwave_RECT_HS |
---|
28 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
29 | Label bottom "q (A\\S-1\\M)" |
---|
30 | Label left "Intensity (cm\\S-1\\M)" |
---|
31 | |
---|
32 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
33 | |
---|
34 | AddModelToStrings("PolyRectSphere_HS","coef_RECT_HS","parameters_RECT_HS","RECT_HS") |
---|
35 | End |
---|
36 | |
---|
37 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
38 | Proc PlotSmearedPolyRectSphere_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_RECT_HS = {0.1,60,0.1,1e-6,6.3e-6,0.0001} |
---|
51 | make/o/t smear_parameters_RECT_HS = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","bkg (cm-1)"} |
---|
52 | Edit smear_parameters_RECT_HS,smear_coef_RECT_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_RECT_HS,smeared_qvals |
---|
57 | SetScale d,0,0,"1/cm",smeared_RECT_HS |
---|
58 | |
---|
59 | Variable/G gs_RECT_HS=0 |
---|
60 | gs_RECT_HS := fSmearedPolyRectSphere_HS(smear_coef_RECT_HS,smeared_RECT_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
61 | |
---|
62 | Display smeared_RECT_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 | |
---|
67 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
68 | |
---|
69 | SetDataFolder root: |
---|
70 | AddModelToStrings("SmearedPolyRectSphere_HS","smear_coef_RECT_HS","smear_parameters_RECT_HS","RECT_HS") |
---|
71 | End |
---|
72 | |
---|
73 | |
---|
74 | Function PolyRectSphere_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_RECT_HS |
---|
81 | form_RECT_HS[0] = 1 |
---|
82 | form_RECT_HS[1] = w[1] |
---|
83 | form_RECT_HS[2] = w[2] |
---|
84 | form_RECT_HS[3] = w[3] |
---|
85 | form_RECT_HS[4] = w[4] |
---|
86 | form_RECT_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] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
93 | |
---|
94 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
95 | diam = (6*Vpoly/pi)^(1/3) |
---|
96 | |
---|
97 | //setup structure factor coefficient wave |
---|
98 | Make/O/D/N=2 struct_RECT_HS |
---|
99 | struct_RECT_HS[0] = diam/2 |
---|
100 | struct_RECT_HS[1] = w[0] |
---|
101 | |
---|
102 | //calculate each and combine |
---|
103 | Duplicate/O xw temp_RECT_HS_PQ,temp_RECT_HS_SQ //make waves for the AAO |
---|
104 | PolyRectSpheres(form_RECT_HS,temp_RECT_HS_PQ,xw) |
---|
105 | HardSphereStruct(struct_RECT_HS,temp_RECT_HS_SQ,xw) |
---|
106 | yw = temp_RECT_HS_PQ * temp_RECT_HS_SQ |
---|
107 | yw *= w[0] |
---|
108 | yw += w[5] |
---|
109 | |
---|
110 | //cleanup waves |
---|
111 | // Killwaves/Z form_RECT_HS,struct_RECT_HS |
---|
112 | |
---|
113 | return (0) |
---|
114 | End |
---|
115 | |
---|
116 | ///////////////////////////////////////// |
---|
117 | Proc PlotPolyRectSphere_SW(num,qmin,qmax) |
---|
118 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
119 | Prompt num "Enter number of data points for model: " |
---|
120 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
121 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
122 | |
---|
123 | Make/O/D/n=(num) xwave_RECT_SW,ywave_RECT_SW |
---|
124 | xwave_RECT_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
125 | Make/O/D coef_RECT_SW = {0.1,60,0.1,1e-6,6.3e-6,1.0,1.2,0.0001} |
---|
126 | make/o/t parameters_RECT_SW = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
127 | Edit/K=1 parameters_RECT_SW,coef_RECT_SW |
---|
128 | |
---|
129 | Variable/G root:g_RECT_SW |
---|
130 | g_RECT_SW := PolyRectSphere_SW(coef_RECT_SW,ywave_RECT_SW,xwave_RECT_SW) |
---|
131 | Display/K=1 ywave_RECT_SW vs xwave_RECT_SW |
---|
132 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
133 | Label bottom "q (A\\S-1\\M)" |
---|
134 | Label left "Intensity (cm\\S-1\\M)" |
---|
135 | |
---|
136 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
137 | |
---|
138 | AddModelToStrings("PolyRectSphere_SW","coef_RECT_SW","parameters_RECT_SW","RECT_SW") |
---|
139 | End |
---|
140 | |
---|
141 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
142 | Proc PlotSmearedPolyRectSphere_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_RECT_SW = {0.1,60,0.1,1e-6,6.3e-6,1.0,1.2,0.0001} |
---|
155 | make/o/t smear_parameters_RECT_SW = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
156 | Edit smear_parameters_RECT_SW,smear_coef_RECT_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_RECT_SW,smeared_qvals |
---|
161 | SetScale d,0,0,"1/cm",smeared_RECT_SW |
---|
162 | |
---|
163 | Variable/G gs_RECT_SW=0 |
---|
164 | gs_RECT_SW := fSmearedPolyRectSphere_SW(smear_coef_RECT_SW,smeared_RECT_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
165 | |
---|
166 | Display smeared_RECT_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 | |
---|
171 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
172 | |
---|
173 | SetDataFolder root: |
---|
174 | AddModelToStrings("SmearedPolyRectSphere_SW","smear_coef_RECT_SW","smear_parameters_RECT_SW","RECT_SW") |
---|
175 | End |
---|
176 | |
---|
177 | |
---|
178 | Function PolyRectSphere_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_RECT_SW |
---|
185 | form_RECT_SW[0] = 1 |
---|
186 | form_RECT_SW[1] = w[1] |
---|
187 | form_RECT_SW[2] = w[2] |
---|
188 | form_RECT_SW[3] = w[3] |
---|
189 | form_RECT_SW[4] = w[4] |
---|
190 | form_RECT_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] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
197 | |
---|
198 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
199 | diam = (6*Vpoly/pi)^(1/3) |
---|
200 | |
---|
201 | //setup structure factor coefficient wave |
---|
202 | Make/O/D/N=4 struct_RECT_SW |
---|
203 | struct_RECT_SW[0] = diam/2 |
---|
204 | struct_RECT_SW[1] = w[0] |
---|
205 | struct_RECT_SW[2] = w[5] |
---|
206 | struct_RECT_SW[3] = w[6] |
---|
207 | |
---|
208 | //calculate each and combine |
---|
209 | Duplicate/O xw temp_RECT_SW_PQ,temp_RECT_SW_SQ //make waves for the AAO |
---|
210 | PolyRectSpheres(form_RECT_SW,temp_RECT_SW_PQ,xw) |
---|
211 | SquareWellStruct(struct_RECT_SW,temp_RECT_SW_SQ,xw) |
---|
212 | yw = temp_RECT_SW_PQ * temp_RECT_SW_SQ |
---|
213 | yw *= w[0] |
---|
214 | yw += w[7] |
---|
215 | |
---|
216 | //cleanup waves |
---|
217 | // Killwaves/Z form_RECT_SW,struct_RECT_SW |
---|
218 | |
---|
219 | return (0) |
---|
220 | End |
---|
221 | |
---|
222 | |
---|
223 | ///////////////////////////////////////// |
---|
224 | Proc PlotPolyRectSphere_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_RECT_SC,ywave_RECT_SC |
---|
236 | xwave_RECT_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
237 | Make/O/D coef_RECT_SC = {0.1,60,0.1,1e-6,6.3e-6,10,0,298,78,0.0001} |
---|
238 | make/o/t parameters_RECT_SC = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
239 | Edit/K=1 parameters_RECT_SC,coef_RECT_SC |
---|
240 | |
---|
241 | Variable/G root:g_RECT_SC |
---|
242 | g_RECT_SC := PolyRectSphere_SC(coef_RECT_SC,ywave_RECT_SC,xwave_RECT_SC) |
---|
243 | Display/K=1 ywave_RECT_SC vs xwave_RECT_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 | |
---|
248 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
249 | |
---|
250 | AddModelToStrings("PolyRectSphere_SC","coef_RECT_SC","parameters_RECT_SC","RECT_SC") |
---|
251 | End |
---|
252 | |
---|
253 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
254 | Proc PlotSmearedPolyRectSphere_SC(str) |
---|
255 | String str |
---|
256 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
257 | |
---|
258 | // if any of the resolution waves are missing => abort |
---|
259 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
260 | Abort |
---|
261 | endif |
---|
262 | |
---|
263 | SetDataFolder $("root:"+str) |
---|
264 | |
---|
265 | if(!DataFolderExists(":HayPenMSA")) |
---|
266 | NewDataFolder :HayPenMSA |
---|
267 | endif |
---|
268 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
269 | |
---|
270 | // Setup parameter table for model function |
---|
271 | Make/O/D smear_coef_RECT_SC = {0.1,60,0.1,1e-6,6.3e-6,10,0,298,78,0.0001} |
---|
272 | make/o/t smear_parameters_RECT_SC = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
273 | Edit smear_parameters_RECT_SC,smear_coef_RECT_SC |
---|
274 | |
---|
275 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
276 | // make extra copy of experimental q-values for easy plotting |
---|
277 | Duplicate/O $(str+"_q") smeared_RECT_SC,smeared_qvals |
---|
278 | SetScale d,0,0,"1/cm",smeared_RECT_SC |
---|
279 | |
---|
280 | Variable/G gs_RECT_SC=0 |
---|
281 | gs_RECT_SC := fSmearedPolyRectSphere_SC(smear_coef_RECT_SC,smeared_RECT_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
282 | |
---|
283 | Display smeared_RECT_SC vs smeared_qvals |
---|
284 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
285 | Label bottom "q (A\\S-1\\M)" |
---|
286 | Label left "Intensity (cm\\S-1\\M)" |
---|
287 | |
---|
288 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
289 | |
---|
290 | SetDataFolder root: |
---|
291 | AddModelToStrings("SmearedPolyRectSphere_SC","smear_coef_RECT_SC","smear_parameters_RECT_SC","RECT_SC") |
---|
292 | End |
---|
293 | |
---|
294 | |
---|
295 | Function PolyRectSphere_SC(w,yw,xw) : FitFunc |
---|
296 | Wave w,yw,xw |
---|
297 | |
---|
298 | Variable inten |
---|
299 | |
---|
300 | //setup form factor coefficient wave |
---|
301 | Make/O/D/N=6 form_RECT_SC |
---|
302 | form_RECT_SC[0] = 1 |
---|
303 | form_RECT_SC[1] = w[1] |
---|
304 | form_RECT_SC[2] = w[2] |
---|
305 | form_RECT_SC[3] = w[3] |
---|
306 | form_RECT_SC[4] = w[4] |
---|
307 | form_RECT_SC[5] = 0 |
---|
308 | |
---|
309 | //calculate the diameter of the effective one-component sphere |
---|
310 | Variable pd,diam,zz,Vpoly,Ravg |
---|
311 | pd = w[2] |
---|
312 | zz = (1/pd)^2 - 1 |
---|
313 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
314 | |
---|
315 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
316 | diam = (6*Vpoly/pi)^(1/3) |
---|
317 | |
---|
318 | //setup structure factor coefficient wave |
---|
319 | Make/O/D/N=6 struct_RECT_SC |
---|
320 | struct_RECT_SC[0] = diam |
---|
321 | struct_RECT_SC[1] = w[5] |
---|
322 | struct_RECT_SC[2] = w[0] |
---|
323 | struct_RECT_SC[3] = w[7] |
---|
324 | struct_RECT_SC[4] = w[6] |
---|
325 | struct_RECT_SC[5] = w[8] |
---|
326 | |
---|
327 | //calculate each and combine |
---|
328 | Duplicate/O xw temp_RECT_SC_PQ,temp_RECT_SC_SQ //make waves for the AAO |
---|
329 | PolyRectSpheres(form_RECT_SC,temp_RECT_SC_PQ,xw) |
---|
330 | HayterPenfoldMSA(struct_RECT_SC,temp_RECT_SC_SQ,xw) |
---|
331 | yw = temp_RECT_SC_PQ * temp_RECT_SC_SQ |
---|
332 | yw *= w[0] |
---|
333 | yw += w[9] |
---|
334 | |
---|
335 | //cleanup waves |
---|
336 | // Killwaves/Z form_RECT_SC,struct_RECT_SC |
---|
337 | |
---|
338 | return (0) |
---|
339 | End |
---|
340 | |
---|
341 | ///////////////////////////////////////// |
---|
342 | Proc PlotPolyRectSphere_SHS(num,qmin,qmax) |
---|
343 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
344 | Prompt num "Enter number of data points for model: " |
---|
345 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
346 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
347 | |
---|
348 | Make/O/D/n=(num) xwave_RECT_SHS,ywave_RECT_SHS |
---|
349 | xwave_RECT_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
350 | Make/O/D coef_RECT_SHS = {0.1,60,0.1,1e-6,6.3e-6,0.05,0.2,0.0001} |
---|
351 | make/o/t parameters_RECT_SHS = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
352 | Edit/K=1 parameters_RECT_SHS,coef_RECT_SHS |
---|
353 | |
---|
354 | Variable/G root:g_RECT_SHS |
---|
355 | g_RECT_SHS := PolyRectSphere_SHS(coef_RECT_SHS,ywave_RECT_SHS,xwave_RECT_SHS) |
---|
356 | Display/K=1 ywave_RECT_SHS vs xwave_RECT_SHS |
---|
357 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
358 | Label bottom "q (A\\S-1\\M)" |
---|
359 | Label left "Intensity (cm\\S-1\\M)" |
---|
360 | |
---|
361 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
362 | |
---|
363 | AddModelToStrings("PolyRectSphere_SHS","coef_RECT_SHS","parameters_RECT_SHS","RECT_SHS") |
---|
364 | End |
---|
365 | |
---|
366 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
367 | Proc PlotSmearedPolyRectSphere_SHS(str) |
---|
368 | String str |
---|
369 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
370 | |
---|
371 | // if any of the resolution waves are missing => abort |
---|
372 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
373 | Abort |
---|
374 | endif |
---|
375 | |
---|
376 | SetDataFolder $("root:"+str) |
---|
377 | |
---|
378 | // Setup parameter table for model function |
---|
379 | Make/O/D smear_coef_RECT_SHS = {0.1,60,0.1,1e-6,6.3e-6,0.05,0.2,0.0001} |
---|
380 | make/o/t smear_parameters_RECT_SHS = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
381 | Edit smear_parameters_RECT_SHS,smear_coef_RECT_SHS |
---|
382 | |
---|
383 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
384 | // make extra copy of experimental q-values for easy plotting |
---|
385 | Duplicate/O $(str+"_q") smeared_RECT_SHS,smeared_qvals |
---|
386 | SetScale d,0,0,"1/cm",smeared_RECT_SHS |
---|
387 | |
---|
388 | Variable/G gs_RECT_SHS=0 |
---|
389 | gs_RECT_SHS := fSmearedPolyRectSphere_SHS(smear_coef_RECT_SHS,smeared_RECT_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
390 | |
---|
391 | Display smeared_RECT_SHS vs smeared_qvals |
---|
392 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
393 | Label bottom "q (A\\S-1\\M)" |
---|
394 | Label left "Intensity (cm\\S-1\\M)" |
---|
395 | |
---|
396 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
397 | |
---|
398 | SetDataFolder root: |
---|
399 | AddModelToStrings("SmearedPolyRectSphere_SHS","smear_coef_RECT_SHS","smear_parameters_RECT_SHS","RECT_SHS") |
---|
400 | End |
---|
401 | |
---|
402 | |
---|
403 | Function PolyRectSphere_SHS(w,yw,xw) : FitFunc |
---|
404 | Wave w,yw,xw |
---|
405 | |
---|
406 | Variable inten |
---|
407 | |
---|
408 | //setup form factor coefficient wave |
---|
409 | Make/O/D/N=6 form_RECT_SHS |
---|
410 | form_RECT_SHS[0] = 1 |
---|
411 | form_RECT_SHS[1] = w[1] |
---|
412 | form_RECT_SHS[2] = w[2] |
---|
413 | form_RECT_SHS[3] = w[3] |
---|
414 | form_RECT_SHS[4] = w[4] |
---|
415 | form_RECT_SHS[5] = 0 |
---|
416 | |
---|
417 | //calculate the diameter of the effective one-component sphere |
---|
418 | Variable pd,diam,zz,Vpoly,Ravg |
---|
419 | pd = w[2] |
---|
420 | zz = (1/pd)^2 - 1 |
---|
421 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
422 | |
---|
423 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
424 | diam = (6*Vpoly/pi)^(1/3) |
---|
425 | |
---|
426 | //setup structure factor coefficient wave |
---|
427 | Make/O/D/N=4 struct_RECT_SHS |
---|
428 | struct_RECT_SHS[0] = diam/2 |
---|
429 | struct_RECT_SHS[1] = w[0] |
---|
430 | struct_RECT_SHS[2] = w[5] |
---|
431 | struct_RECT_SHS[3] = w[6] |
---|
432 | |
---|
433 | //calculate each and combine |
---|
434 | Duplicate/O xw temp_RECT_SHS_PQ,temp_RECT_SHS_SQ //make waves for the AAO |
---|
435 | PolyRectSpheres(form_RECT_SHS,temp_RECT_SHS_PQ,xw) |
---|
436 | StickyHS_Struct(struct_RECT_SHS,temp_RECT_SHS_SQ,xw) |
---|
437 | yw = temp_RECT_SHS_PQ * temp_RECT_SHS_SQ |
---|
438 | yw *= w[0] |
---|
439 | yw += w[7] |
---|
440 | |
---|
441 | //cleanup waves |
---|
442 | // Killwaves/Z form_RECT_SHS,struct_RECT_SHS |
---|
443 | |
---|
444 | return (0) |
---|
445 | End |
---|
446 | |
---|
447 | |
---|
448 | |
---|
449 | // this is all there is to the smeared calculation! |
---|
450 | Function SmearedPolyRectSphere_HS(s) :FitFunc |
---|
451 | Struct ResSmearAAOStruct &s |
---|
452 | |
---|
453 | // the name of your unsmeared model is the first argument |
---|
454 | Smear_Model_20(PolyRectSphere_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
455 | |
---|
456 | return(0) |
---|
457 | End |
---|
458 | |
---|
459 | // this is all there is to the smeared calculation! |
---|
460 | Function SmearedPolyRectSphere_SW(s) :FitFunc |
---|
461 | Struct ResSmearAAOStruct &s |
---|
462 | |
---|
463 | // the name of your unsmeared model is the first argument |
---|
464 | Smear_Model_20(PolyRectSphere_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
465 | |
---|
466 | return(0) |
---|
467 | End |
---|
468 | |
---|
469 | // this is all there is to the smeared calculation! |
---|
470 | Function SmearedPolyRectSphere_SC(s) :FitFunc |
---|
471 | Struct ResSmearAAOStruct &s |
---|
472 | |
---|
473 | // the name of your unsmeared model is the first argument |
---|
474 | Smear_Model_20(PolyRectSphere_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
475 | |
---|
476 | return(0) |
---|
477 | End |
---|
478 | |
---|
479 | // this is all there is to the smeared calculation! |
---|
480 | Function SmearedPolyRectSphere_SHS(s) :FitFunc |
---|
481 | Struct ResSmearAAOStruct &s |
---|
482 | |
---|
483 | // the name of your unsmeared model is the first argument |
---|
484 | Smear_Model_20(PolyRectSphere_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
485 | |
---|
486 | return(0) |
---|
487 | End |
---|
488 | |
---|
489 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
490 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
491 | // |
---|
492 | // used only for the dependency, not for fitting |
---|
493 | // |
---|
494 | Function fSmearedPolyRectSphere_HS(coefW,yW,xW) |
---|
495 | Wave coefW,yW,xW |
---|
496 | |
---|
497 | String str = getWavesDataFolder(yW,0) |
---|
498 | String DF="root:"+str+":" |
---|
499 | |
---|
500 | WAVE resW = $(DF+str+"_res") |
---|
501 | |
---|
502 | STRUCT ResSmearAAOStruct fs |
---|
503 | WAVE fs.coefW = coefW |
---|
504 | WAVE fs.yW = yW |
---|
505 | WAVE fs.xW = xW |
---|
506 | WAVE fs.resW = resW |
---|
507 | |
---|
508 | Variable err |
---|
509 | err = SmearedPolyRectSphere_HS(fs) |
---|
510 | |
---|
511 | return (0) |
---|
512 | End |
---|
513 | |
---|
514 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
515 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
516 | // |
---|
517 | // used only for the dependency, not for fitting |
---|
518 | // |
---|
519 | Function fSmearedPolyRectSphere_SW(coefW,yW,xW) |
---|
520 | Wave coefW,yW,xW |
---|
521 | |
---|
522 | String str = getWavesDataFolder(yW,0) |
---|
523 | String DF="root:"+str+":" |
---|
524 | |
---|
525 | WAVE resW = $(DF+str+"_res") |
---|
526 | |
---|
527 | STRUCT ResSmearAAOStruct fs |
---|
528 | WAVE fs.coefW = coefW |
---|
529 | WAVE fs.yW = yW |
---|
530 | WAVE fs.xW = xW |
---|
531 | WAVE fs.resW = resW |
---|
532 | |
---|
533 | Variable err |
---|
534 | err = SmearedPolyRectSphere_SW(fs) |
---|
535 | |
---|
536 | return (0) |
---|
537 | End |
---|
538 | |
---|
539 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
540 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
541 | // |
---|
542 | // used only for the dependency, not for fitting |
---|
543 | // |
---|
544 | Function fSmearedPolyRectSphere_SC(coefW,yW,xW) |
---|
545 | Wave coefW,yW,xW |
---|
546 | |
---|
547 | String str = getWavesDataFolder(yW,0) |
---|
548 | String DF="root:"+str+":" |
---|
549 | |
---|
550 | WAVE resW = $(DF+str+"_res") |
---|
551 | |
---|
552 | STRUCT ResSmearAAOStruct fs |
---|
553 | WAVE fs.coefW = coefW |
---|
554 | WAVE fs.yW = yW |
---|
555 | WAVE fs.xW = xW |
---|
556 | WAVE fs.resW = resW |
---|
557 | |
---|
558 | Variable err |
---|
559 | err = SmearedPolyRectSphere_SC(fs) |
---|
560 | |
---|
561 | return (0) |
---|
562 | End |
---|
563 | |
---|
564 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
565 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
566 | // |
---|
567 | // used only for the dependency, not for fitting |
---|
568 | // |
---|
569 | Function fSmearedPolyRectSphere_SHS(coefW,yW,xW) |
---|
570 | Wave coefW,yW,xW |
---|
571 | |
---|
572 | String str = getWavesDataFolder(yW,0) |
---|
573 | String DF="root:"+str+":" |
---|
574 | |
---|
575 | WAVE resW = $(DF+str+"_res") |
---|
576 | |
---|
577 | STRUCT ResSmearAAOStruct fs |
---|
578 | WAVE fs.coefW = coefW |
---|
579 | WAVE fs.yW = yW |
---|
580 | WAVE fs.xW = xW |
---|
581 | WAVE fs.resW = resW |
---|
582 | |
---|
583 | Variable err |
---|
584 | err = SmearedPolyRectSphere_SHS(fs) |
---|
585 | |
---|
586 | return (0) |
---|
587 | End |
---|