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 "PolyCore" |
---|
8 | |
---|
9 | #include "HardSphereStruct" |
---|
10 | #include "HPMSA" |
---|
11 | #include "SquareWellStruct" |
---|
12 | #include "StickyHardSphereStruct" |
---|
13 | |
---|
14 | Proc PlotPolyCore_HS(num,qmin,qmax) |
---|
15 | Variable num=256,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_PCF_HS,ywave_PCF_HS |
---|
21 | xwave_PCF_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
22 | Make/O/D coef_PCF_HS = {0.1,60,.2,10,1e-6,2e-6,3e-6,0.0001} |
---|
23 | make/o/t parameters_PCF_HS = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","bkg (cm-1)"} |
---|
24 | Edit/K=1 parameters_PCF_HS,coef_PCF_HS |
---|
25 | Variable/G root:g_PCF_HS |
---|
26 | g_PCF_HS := PolyCore_HS(coef_PCF_HS,ywave_PCF_HS,xwave_PCF_HS) |
---|
27 | // ywave_PCF_HS := PolyCore_HS(coef_PCF_HS,xwave_PCF_HS) |
---|
28 | Display/K=1 ywave_PCF_HS vs xwave_PCF_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 | |
---|
33 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
34 | End |
---|
35 | |
---|
36 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
37 | Proc PlotSmearedPolyCore_HS(str) |
---|
38 | String str |
---|
39 | Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) |
---|
40 | |
---|
41 | // if any of the resolution waves are missing => abort |
---|
42 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
43 | Abort |
---|
44 | endif |
---|
45 | |
---|
46 | SetDataFolder $("root:"+str) |
---|
47 | |
---|
48 | // Setup parameter table for model function |
---|
49 | Make/O/D smear_coef_PCF_HS = {0.1,60,.2,10,1e-6,2e-6,3e-6,0.0001} |
---|
50 | make/o/t smear_parameters_PCF_HS = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","bkg (cm-1)"} |
---|
51 | Edit smear_parameters_PCF_HS,smear_coef_PCF_HS |
---|
52 | |
---|
53 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
54 | // make extra copy of experimental q-values for easy plotting |
---|
55 | Duplicate/O $(str+"_q") smeared_PCF_HS,smeared_qvals |
---|
56 | SetScale d,0,0,"1/cm",smeared_PCF_HS |
---|
57 | |
---|
58 | Variable/G gs_PCF_HS=0 |
---|
59 | gs_PCF_HS := fSmearedPolyCore_HS(smear_coef_PCF_HS,smeared_PCF_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
60 | |
---|
61 | Display smeared_PCF_HS vs smeared_qvals |
---|
62 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
63 | Label bottom "q (\\S-1\\M)" |
---|
64 | Label left "Intensity (cm\\S-1\\M)" |
---|
65 | |
---|
66 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
67 | |
---|
68 | SetDataFolder root: |
---|
69 | End |
---|
70 | |
---|
71 | |
---|
72 | //AAO function |
---|
73 | Function PolyCore_HS(w,yw,xw) : FitFunc |
---|
74 | Wave w,yw,xw |
---|
75 | |
---|
76 | //setup form factor coefficient wave |
---|
77 | Make/O/D/N=8 form_PCF_HS |
---|
78 | form_PCF_HS[0] = 1 |
---|
79 | form_PCF_HS[1] = w[1] |
---|
80 | form_PCF_HS[2] = w[2] |
---|
81 | form_PCF_HS[3] = w[3] |
---|
82 | form_PCF_HS[4] = w[4] |
---|
83 | form_PCF_HS[5] = w[5] |
---|
84 | form_PCF_HS[6] = w[6] |
---|
85 | form_PCF_HS[7] = 0 |
---|
86 | |
---|
87 | //calculate the diameter of the effective one-component sphere |
---|
88 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
89 | pd = w[2] |
---|
90 | zz = (1/pd)^2 - 1 |
---|
91 | Ravg = w[1] |
---|
92 | thick = w[3] |
---|
93 | |
---|
94 | Vpoly = 4*pi/3*(Ravg+thick)^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_PCF_HS |
---|
100 | struct_PCF_HS[0] = diam/2 |
---|
101 | struct_PCF_HS[1] = w[0] |
---|
102 | |
---|
103 | //calculate each and combine |
---|
104 | Duplicate/O xw temp_PCF_HS_PQ,temp_PCF_HS_SQ //make waves for the AAO |
---|
105 | PolyCoreForm(form_PCF_HS,temp_PCF_HS_PQ,xw) |
---|
106 | HardSphereStruct(struct_PCF_HS,temp_PCF_HS_SQ,xw) |
---|
107 | yw = temp_PCF_HS_PQ*temp_PCF_HS_SQ |
---|
108 | yw *= w[0] |
---|
109 | yw += w[7] |
---|
110 | |
---|
111 | //cleanup waves |
---|
112 | // Killwaves/Z form_PCF_HS,struct_PCF_HS |
---|
113 | |
---|
114 | return (0) |
---|
115 | End |
---|
116 | |
---|
117 | ///////////////////////////////////////// |
---|
118 | Proc PlotPolyCore_SW(num,qmin,qmax) |
---|
119 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
120 | Prompt num "Enter number of data points for model: " |
---|
121 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
122 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
123 | |
---|
124 | Make/O/D/n=(num) xwave_PCF_SW,ywave_PCF_SW |
---|
125 | xwave_PCF_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
126 | Make/O/D coef_PCF_SW = {0.1,60,.2,10,1e-6,2e-6,3e-6,1.0,1.2,0.0001} |
---|
127 | make/o/t parameters_PCF_SW = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
128 | Edit/K=1 parameters_PCF_SW,coef_PCF_SW |
---|
129 | |
---|
130 | Variable/G root:g_PCF_SW |
---|
131 | g_PCF_SW := PolyCore_SW(coef_PCF_SW,ywave_PCF_SW,xwave_PCF_SW) |
---|
132 | Display/K=1 ywave_PCF_SW vs xwave_PCF_SW |
---|
133 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
134 | Label bottom "q (\\S-1\\M)" |
---|
135 | Label left "Intensity (cm\\S-1\\M)" |
---|
136 | |
---|
137 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
138 | End |
---|
139 | |
---|
140 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
141 | Proc PlotSmearedPolyCore_SW(str) |
---|
142 | String str |
---|
143 | Prompt str,"Pick the data folder conatining 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_PCF_SW = {0.1,60,.2,10,1e-6,2e-6,3e-6,1.0,1.2,0.0001} |
---|
154 | make/o/t smear_parameters_PCF_SW = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
155 | Edit smear_parameters_PCF_SW,smear_coef_PCF_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_PCF_SW,smeared_qvals |
---|
160 | SetScale d,0,0,"1/cm",smeared_PCF_SW |
---|
161 | |
---|
162 | Variable/G gs_PCF_SW=0 |
---|
163 | gs_PCF_SW := fSmearedPolyCore_SW(smear_coef_PCF_SW,smeared_PCF_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
164 | |
---|
165 | Display smeared_PCF_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 | |
---|
170 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
171 | |
---|
172 | SetDataFolder root: |
---|
173 | End |
---|
174 | |
---|
175 | |
---|
176 | Function PolyCore_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=8 form_PCF_SW |
---|
183 | form_PCF_SW[0] = 1 |
---|
184 | form_PCF_SW[1] = w[1] |
---|
185 | form_PCF_SW[2] = w[2] |
---|
186 | form_PCF_SW[3] = w[3] |
---|
187 | form_PCF_SW[4] = w[4] |
---|
188 | form_PCF_SW[5] = w[5] |
---|
189 | form_PCF_SW[6] = w[6] |
---|
190 | form_PCF_SW[7] = 0 |
---|
191 | |
---|
192 | //calculate the diameter of the effective one-component sphere |
---|
193 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
194 | pd = w[2] |
---|
195 | zz = (1/pd)^2 - 1 |
---|
196 | Ravg = w[1] |
---|
197 | thick = w[3] |
---|
198 | |
---|
199 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
200 | diam = (6*Vpoly/pi)^(1/3) |
---|
201 | |
---|
202 | //setup structure factor coefficient wave |
---|
203 | Make/O/D/N=4 struct_PCF_SW |
---|
204 | struct_PCF_SW[0] = diam/2 |
---|
205 | struct_PCF_SW[1] = w[0] |
---|
206 | struct_PCF_SW[2] = w[7] |
---|
207 | struct_PCF_SW[3] = w[8] |
---|
208 | |
---|
209 | //calculate each and combine |
---|
210 | Duplicate/O xw temp_PCF_SW_PQ,temp_PCF_SW_SQ //make waves for the AAO |
---|
211 | PolyCoreForm(form_PCF_SW,temp_PCF_SW_PQ,xw) |
---|
212 | SquareWellStruct(struct_PCF_SW,temp_PCF_SW_SQ,xw) |
---|
213 | yw = temp_PCF_SW_PQ * temp_PCF_SW_SQ |
---|
214 | yw *= w[0] |
---|
215 | yw += w[9] |
---|
216 | |
---|
217 | //cleanup waves |
---|
218 | // Killwaves/Z form_PCF_SW,struct_PCF_SW |
---|
219 | |
---|
220 | return (0) |
---|
221 | End |
---|
222 | |
---|
223 | |
---|
224 | ///////////////////////////////////////// |
---|
225 | Proc PlotPolyCore_SC(num,qmin,qmax) |
---|
226 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
227 | Prompt num "Enter number of data points for model: " |
---|
228 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
229 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
230 | |
---|
231 | if(!DataFolderExists(":HayPenMSA")) |
---|
232 | NewDataFolder :HayPenMSA |
---|
233 | endif |
---|
234 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
235 | |
---|
236 | Make/O/D/n=(num) xwave_PCF_SC,ywave_PCF_SC |
---|
237 | xwave_PCF_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
238 | Make/O/D coef_PCF_SC = {0.1,60,.2,10,1e-6,2e-6,3e-6,10,0,298,78,0.0001} |
---|
239 | make/o/t parameters_PCF_SC = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
240 | Edit/K=1 parameters_PCF_SC,coef_PCF_SC |
---|
241 | |
---|
242 | Variable/G root:g_PCF_SC |
---|
243 | g_PCF_SC := PolyCore_SC(coef_PCF_SC,ywave_PCF_SC,xwave_PCF_SC) |
---|
244 | Display/K=1 ywave_PCF_SC vs xwave_PCF_SC |
---|
245 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
246 | Label bottom "q (\\S-1\\M)" |
---|
247 | Label left "Intensity (cm\\S-1\\M)" |
---|
248 | |
---|
249 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
250 | End |
---|
251 | |
---|
252 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
253 | Proc PlotSmearedPolyCore_SC(str) |
---|
254 | String str |
---|
255 | Prompt str,"Pick the data folder conatining 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_PCF_SC = {0.1,60,.2,10,1e-6,2e-6,3e-6,10,0,298,78,0.0001} |
---|
271 | make/o/t smear_parameters_PCF_SC = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
272 | Edit smear_parameters_PCF_SC,smear_coef_PCF_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_PCF_SC,smeared_qvals |
---|
277 | SetScale d,0,0,"1/cm",smeared_PCF_SC |
---|
278 | |
---|
279 | Variable/G gs_PCF_SC=0 |
---|
280 | gs_PCF_SC := fSmearedPolyCore_SC(smear_coef_PCF_SC,smeared_PCF_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
281 | |
---|
282 | Display smeared_PCF_SC vs smeared_qvals |
---|
283 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
284 | Label bottom "q (\\S-1\\M)" |
---|
285 | Label left "Intensity (cm\\S-1\\M)" |
---|
286 | |
---|
287 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
288 | |
---|
289 | SetDataFolder root: |
---|
290 | End |
---|
291 | |
---|
292 | |
---|
293 | Function PolyCore_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=8 form_PCF_SC |
---|
300 | form_PCF_SC[0] = 1 |
---|
301 | form_PCF_SC[1] = w[1] |
---|
302 | form_PCF_SC[2] = w[2] |
---|
303 | form_PCF_SC[3] = w[3] |
---|
304 | form_PCF_SC[4] = w[4] |
---|
305 | form_PCF_SC[5] = w[5] |
---|
306 | form_PCF_SC[6] = w[6] |
---|
307 | form_PCF_SC[7] = 0 |
---|
308 | |
---|
309 | //calculate the diameter of the effective one-component sphere |
---|
310 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
311 | pd = w[2] |
---|
312 | zz = (1/pd)^2 - 1 |
---|
313 | Ravg = w[1] |
---|
314 | thick = w[3] |
---|
315 | |
---|
316 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
317 | diam = (6*Vpoly/pi)^(1/3) |
---|
318 | |
---|
319 | //setup structure factor coefficient wave |
---|
320 | Make/O/D/N=6 struct_PCF_SC |
---|
321 | struct_PCF_SC[0] = diam |
---|
322 | struct_PCF_SC[1] = w[7] |
---|
323 | struct_PCF_SC[2] = w[0] |
---|
324 | struct_PCF_SC[3] = w[9] |
---|
325 | struct_PCF_SC[4] = w[8] |
---|
326 | struct_PCF_SC[5] = w[10] |
---|
327 | |
---|
328 | //calculate each and combine |
---|
329 | Duplicate/O xw temp_PCF_SC_PQ,temp_PCF_SC_SQ //make waves for the AAO |
---|
330 | PolyCoreForm(form_PCF_SC,temp_PCF_SC_PQ,xw) |
---|
331 | HayterPenfoldMSA(struct_PCF_SC,temp_PCF_SC_SQ,xw) |
---|
332 | yw = temp_PCF_SC_PQ * temp_PCF_SC_SQ |
---|
333 | yw *= w[0] |
---|
334 | yw += w[11] |
---|
335 | |
---|
336 | //cleanup waves |
---|
337 | // Killwaves/Z form_PCF_SC,struct_PCF_SC |
---|
338 | |
---|
339 | return (0) |
---|
340 | End |
---|
341 | |
---|
342 | ///////////////////////////////////////// |
---|
343 | Proc PlotPolyCore_SHS(num,qmin,qmax) |
---|
344 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
345 | Prompt num "Enter number of data points for model: " |
---|
346 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
347 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
348 | |
---|
349 | Make/O/D/n=(num) xwave_PCF_SHS,ywave_PCF_SHS |
---|
350 | xwave_PCF_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
351 | Make/O/D coef_PCF_SHS = {0.1,60,.2,10,1e-6,2e-6,3e-6,0.05,0.2,0.0001} |
---|
352 | make/o/t parameters_PCF_SHS = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
353 | Edit/K=1 parameters_PCF_SHS,coef_PCF_SHS |
---|
354 | |
---|
355 | Variable/G root:g_PCF_SHS |
---|
356 | g_PCF_SHS := PolyCore_SHS(coef_PCF_SHS,ywave_PCF_SHS,xwave_PCF_SHS) |
---|
357 | Display/K=1 ywave_PCF_SHS vs xwave_PCF_SHS |
---|
358 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
359 | Label bottom "q (\\S-1\\M)" |
---|
360 | Label left "Intensity (cm\\S-1\\M)" |
---|
361 | |
---|
362 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
363 | End |
---|
364 | |
---|
365 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
366 | Proc PlotSmearedPolyCore_SHS(str) |
---|
367 | String str |
---|
368 | Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) |
---|
369 | |
---|
370 | // if any of the resolution waves are missing => abort |
---|
371 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
372 | Abort |
---|
373 | endif |
---|
374 | |
---|
375 | SetDataFolder $("root:"+str) |
---|
376 | |
---|
377 | // Setup parameter table for model function |
---|
378 | Make/O/D smear_coef_PCF_SHS = {0.1,60,.2,10,1e-6,2e-6,3e-6,0.05,0.2,0.0001} |
---|
379 | make/o/t smear_parameters_PCF_SHS = {"volume fraction","avg core rad (A)","core polydisp (0,1)","shell thickness (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
380 | Edit smear_parameters_PCF_SHS,smear_coef_PCF_SHS |
---|
381 | |
---|
382 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
383 | // make extra copy of experimental q-values for easy plotting |
---|
384 | Duplicate/O $(str+"_q") smeared_PCF_SHS,smeared_qvals |
---|
385 | SetScale d,0,0,"1/cm",smeared_PCF_SHS |
---|
386 | |
---|
387 | Variable/G gs_PCF_SHS=0 |
---|
388 | gs_PCF_SHS := fSmearedPolyCore_SHS(smear_coef_PCF_SHS,smeared_PCF_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
389 | |
---|
390 | Display smeared_PCF_SHS vs smeared_qvals |
---|
391 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
392 | Label bottom "q (\\S-1\\M)" |
---|
393 | Label left "Intensity (cm\\S-1\\M)" |
---|
394 | |
---|
395 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
396 | |
---|
397 | SetDataFolder root: |
---|
398 | End |
---|
399 | |
---|
400 | |
---|
401 | Function PolyCore_SHS(w,yw,xw) : FitFunc |
---|
402 | Wave w,yw,xw |
---|
403 | |
---|
404 | Variable inten |
---|
405 | |
---|
406 | //setup form factor coefficient wave |
---|
407 | Make/O/D/N=8 form_PCF_SHS |
---|
408 | form_PCF_SHS[0] = 1 |
---|
409 | form_PCF_SHS[1] = w[1] |
---|
410 | form_PCF_SHS[2] = w[2] |
---|
411 | form_PCF_SHS[3] = w[3] |
---|
412 | form_PCF_SHS[4] = w[4] |
---|
413 | form_PCF_SHS[5] = w[5] |
---|
414 | form_PCF_SHS[6] = w[6] |
---|
415 | form_PCF_SHS[7] = 0 |
---|
416 | |
---|
417 | //calculate the diameter of the effective one-component sphere |
---|
418 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
419 | pd = w[2] |
---|
420 | zz = (1/pd)^2 - 1 |
---|
421 | Ravg = w[1] |
---|
422 | thick = w[3] |
---|
423 | |
---|
424 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
425 | diam = (6*Vpoly/pi)^(1/3) |
---|
426 | |
---|
427 | //setup structure factor coefficient wave |
---|
428 | Make/O/D/N=4 struct_PCF_SHS |
---|
429 | struct_PCF_SHS[0] = diam/2 |
---|
430 | struct_PCF_SHS[1] = w[0] |
---|
431 | struct_PCF_SHS[2] = w[7] |
---|
432 | struct_PCF_SHS[3] = w[8] |
---|
433 | |
---|
434 | //calculate each and combine |
---|
435 | Duplicate/O xw temp_PCF_SHS_PQ,temp_PCF_SHS_SQ //make waves for the AAO |
---|
436 | PolyCoreForm(form_PCF_SHS,temp_PCF_SHS_PQ,xw) |
---|
437 | StickyHS_Struct(struct_PCF_SHS,temp_PCF_SHS_SQ,xw) |
---|
438 | yw = temp_PCF_SHS_PQ * temp_PCF_SHS_SQ |
---|
439 | yw *= w[0] |
---|
440 | yw += w[9] |
---|
441 | |
---|
442 | //cleanup waves |
---|
443 | // Killwaves/Z form_PCF_SW,struct_PCF_SW |
---|
444 | |
---|
445 | return (0) |
---|
446 | End |
---|
447 | |
---|
448 | |
---|
449 | // this is all there is to the smeared calculation! |
---|
450 | Function SmearedPolyCore_HS(s) :FitFunc |
---|
451 | Struct ResSmearAAOStruct &s |
---|
452 | |
---|
453 | // the name of your unsmeared model is the first argument |
---|
454 | s.yW = Smear_Model_20(PolyCore_HS,s.coefW,s.xW,s.resW) |
---|
455 | |
---|
456 | return(0) |
---|
457 | End |
---|
458 | |
---|
459 | // this is all there is to the smeared calculation! |
---|
460 | Function SmearedPolyCore_SW(s) :FitFunc |
---|
461 | Struct ResSmearAAOStruct &s |
---|
462 | |
---|
463 | // the name of your unsmeared model is the first argument |
---|
464 | s.yW = Smear_Model_20(PolyCore_SW,s.coefW,s.xW,s.resW) |
---|
465 | |
---|
466 | return(0) |
---|
467 | End |
---|
468 | |
---|
469 | // this is all there is to the smeared calculation! |
---|
470 | Function SmearedPolyCore_SC(s) :FitFunc |
---|
471 | Struct ResSmearAAOStruct &s |
---|
472 | |
---|
473 | // the name of your unsmeared model is the first argument |
---|
474 | s.yW = Smear_Model_20(PolyCore_SC,s.coefW,s.xW,s.resW) |
---|
475 | |
---|
476 | return(0) |
---|
477 | End |
---|
478 | |
---|
479 | // this is all there is to the smeared calculation! |
---|
480 | Function SmearedPolyCore_SHS(s) :FitFunc |
---|
481 | Struct ResSmearAAOStruct &s |
---|
482 | |
---|
483 | // the name of your unsmeared model is the first argument |
---|
484 | s.yW = Smear_Model_20(PolyCore_SHS,s.coefW,s.xW,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 fSmearedPolyCore_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 = SmearedPolyCore_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 fSmearedPolyCore_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 = SmearedPolyCore_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 fSmearedPolyCore_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 = SmearedPolyCore_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 fSmearedPolyCore_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 = SmearedPolyCore_SHS(fs) |
---|
585 | |
---|
586 | return (0) |
---|
587 | End |
---|