1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion = 6.0 |
---|
3 | |
---|
4 | // be sure to include all the necessary files... |
---|
5 | |
---|
6 | #include "PolyCoreShellRatio" |
---|
7 | |
---|
8 | #include "HardSphereStruct" |
---|
9 | #include "HPMSA" |
---|
10 | #include "SquareWellStruct" |
---|
11 | #include "StickyHardSphereStruct" |
---|
12 | |
---|
13 | Proc PlotPolyCSRatio_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 (^-1) for model: " |
---|
17 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
18 | |
---|
19 | Make/O/D/n=(num) xwave_PCR_HS,ywave_PCR_HS |
---|
20 | xwave_PCR_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
21 | Make/O/D coef_PCR_HS = {0.1,60,10,0.1,1e-6,2e-6,6e-6,0.0001} |
---|
22 | make/o/t parameters_PCR_HS = {"volume fraction","avg radius (A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","bkg (cm-1)"} |
---|
23 | Edit/K=1 parameters_PCR_HS,coef_PCR_HS |
---|
24 | |
---|
25 | Variable/G root:g_PCR_HS |
---|
26 | g_PCR_HS := PolyCSRatio_HS(coef_PCR_HS,ywave_PCR_HS,xwave_PCR_HS) |
---|
27 | Display/K=1 ywave_PCR_HS vs xwave_PCR_HS |
---|
28 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
29 | Label bottom "q (\\S-1\\M)" |
---|
30 | Label left "Intensity (cm\\S-1\\M)" |
---|
31 | |
---|
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 PlotSmearedPolyCSRatio_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_PCR_HS = {0.1,60,10,0.1,1e-6,2e-6,6e-6,0.0001} |
---|
49 | make/o/t smear_parameters_PCR_HS = {"volume fraction","avg radius (A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","bkg (cm-1)"} |
---|
50 | Edit smear_parameters_PCR_HS,smear_coef_PCR_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_PCR_HS,smeared_qvals |
---|
55 | SetScale d,0,0,"1/cm",smeared_PCR_HS |
---|
56 | |
---|
57 | Variable/G gs_PCR_HS=0 |
---|
58 | gs_PCR_HS := fSmearedPolyCSRatio_HS(smear_coef_PCR_HS,smeared_PCR_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
59 | |
---|
60 | Display smeared_PCR_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 | |
---|
65 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
66 | |
---|
67 | SetDataFolder root: |
---|
68 | End |
---|
69 | |
---|
70 | |
---|
71 | Function PolyCSRatio_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=8 form_PCR_HS |
---|
78 | form_PCR_HS[0] = 1 |
---|
79 | form_PCR_HS[1] = w[1] |
---|
80 | form_PCR_HS[2] = w[2] |
---|
81 | form_PCR_HS[3] = w[3] |
---|
82 | form_PCR_HS[4] = w[4] |
---|
83 | form_PCR_HS[5] = w[5] |
---|
84 | form_PCR_HS[6] = w[6] |
---|
85 | form_PCR_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[3] |
---|
90 | zz = (1/pd)^2 - 1 |
---|
91 | Ravg = w[1] |
---|
92 | thick = w[2] |
---|
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 | //setup structure factor coefficient wave |
---|
98 | Make/O/D/N=2 struct_PCR_HS |
---|
99 | struct_PCR_HS[0] = diam/2 |
---|
100 | struct_PCR_HS[1] = w[0] |
---|
101 | |
---|
102 | //calculate each and combine |
---|
103 | Duplicate/O xw temp_PCR_HS_PQ,temp_PCR_HS_SQ //make waves for the AAO |
---|
104 | PolyCoreShellRatio(form_PCR_HS,temp_PCR_HS_PQ,xw) |
---|
105 | HardSphereStruct(struct_PCR_HS,temp_PCR_HS_SQ,xw) |
---|
106 | yw = temp_PCR_HS_PQ * temp_PCR_HS_SQ |
---|
107 | yw *= w[0] |
---|
108 | yw += w[7] |
---|
109 | |
---|
110 | //cleanup waves |
---|
111 | // Killwaves/Z form_PCR_HS,struct_PCR_HS |
---|
112 | |
---|
113 | return (0) |
---|
114 | End |
---|
115 | |
---|
116 | ///////////////////////////////////////// |
---|
117 | Proc PlotPolyCSRatio_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 (^-1) for model: " |
---|
121 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
122 | |
---|
123 | Make/O/D/n=(num) xwave_PCR_SW,ywave_PCR_SW |
---|
124 | xwave_PCR_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
125 | Make/O/D coef_PCR_SW = {0.1,60,10,0.1,1e-6,2e-6,3e-6,1,1.2,0.0001} |
---|
126 | make/o/t parameters_PCR_SW = {"volume fraction","avg radius(A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
127 | Edit/K=1 parameters_PCR_SW,coef_PCR_SW |
---|
128 | |
---|
129 | Variable/G root:g_PCR_SW |
---|
130 | g_PCR_SW := PolyCSRatio_SW(coef_PCR_SW,ywave_PCR_SW,xwave_PCR_SW) |
---|
131 | Display/K=1 ywave_PCR_SW vs xwave_PCR_SW |
---|
132 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
133 | Label bottom "q (\\S-1\\M)" |
---|
134 | Label left "Intensity (cm\\S-1\\M)" |
---|
135 | |
---|
136 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
137 | End |
---|
138 | |
---|
139 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
140 | Proc PlotSmearedPolyCSRatio_SW(str) |
---|
141 | String str |
---|
142 | Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) |
---|
143 | |
---|
144 | // if any of the resolution waves are missing => abort |
---|
145 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
146 | Abort |
---|
147 | endif |
---|
148 | |
---|
149 | SetDataFolder $("root:"+str) |
---|
150 | |
---|
151 | // Setup parameter table for model function |
---|
152 | Make/O/D smear_coef_PCR_SW = {0.1,60,10,0.1,1e-6,2e-6,3e-6,1,1.2,0.0001} |
---|
153 | make/o/t smear_parameters_PCR_SW = {"volume fraction","avg radius(A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
154 | Edit smear_parameters_PCR_SW,smear_coef_PCR_SW |
---|
155 | |
---|
156 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
157 | // make extra copy of experimental q-values for easy plotting |
---|
158 | Duplicate/O $(str+"_q") smeared_PCR_SW,smeared_qvals |
---|
159 | SetScale d,0,0,"1/cm",smeared_PCR_SW |
---|
160 | |
---|
161 | Variable/G gs_PCR_SW=0 |
---|
162 | gs_PCR_SW := fSmearedPolyCSRatio_SW(smear_coef_PCR_SW,smeared_PCR_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
163 | |
---|
164 | Display smeared_PCR_SW vs smeared_qvals |
---|
165 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
166 | Label bottom "q (\\S-1\\M)" |
---|
167 | Label left "Intensity (cm\\S-1\\M)" |
---|
168 | |
---|
169 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
170 | |
---|
171 | SetDataFolder root: |
---|
172 | End |
---|
173 | |
---|
174 | |
---|
175 | Function PolyCSRatio_SW(w,yw,xw) : FitFunc |
---|
176 | Wave w,yw,xw |
---|
177 | |
---|
178 | Variable inten |
---|
179 | |
---|
180 | //setup form factor coefficient wave |
---|
181 | Make/O/D/N=8 form_PCR_SW |
---|
182 | form_PCR_SW[0] = 1 |
---|
183 | form_PCR_SW[1] = w[1] |
---|
184 | form_PCR_SW[2] = w[2] |
---|
185 | form_PCR_SW[3] = w[3] |
---|
186 | form_PCR_SW[4] = w[4] |
---|
187 | form_PCR_SW[5] = w[5] |
---|
188 | form_PCR_SW[6] = w[6] |
---|
189 | form_PCR_SW[7] = 0 |
---|
190 | |
---|
191 | //calculate the diameter of the effective one-component sphere |
---|
192 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
193 | pd = w[3] |
---|
194 | zz = (1/pd)^2 - 1 |
---|
195 | Ravg = w[1] |
---|
196 | thick = w[2] |
---|
197 | |
---|
198 | Vpoly = 4*pi/3*(Ravg+thick)^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_PCR_SW |
---|
203 | struct_PCR_SW[0] = diam/2 |
---|
204 | struct_PCR_SW[1] = w[0] |
---|
205 | struct_PCR_SW[2] = w[7] |
---|
206 | struct_PCR_SW[3] = w[8] |
---|
207 | |
---|
208 | //calculate each and combine |
---|
209 | Duplicate/O xw temp_PCR_SW_PQ,temp_PCR_SW_SQ //make waves for the AAO |
---|
210 | PolyCoreShellRatio(form_PCR_SW,temp_PCR_SW_PQ,xw) |
---|
211 | SquareWellStruct(struct_PCR_SW,temp_PCR_SW_SQ,xw) |
---|
212 | yw = temp_PCR_SW_PQ * temp_PCR_SW_SQ |
---|
213 | yw *= w[0] |
---|
214 | yw += w[9] |
---|
215 | |
---|
216 | //cleanup waves |
---|
217 | // Killwaves/Z form_PCR_SW,struct_PCR_SW |
---|
218 | |
---|
219 | return (0) |
---|
220 | End |
---|
221 | |
---|
222 | |
---|
223 | ///////////////////////////////////////// |
---|
224 | Proc PlotPolyCSRatio_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 (^-1) for model: " |
---|
228 | Prompt qmax "Enter maximum q-value (^-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_PCR_SC,ywave_PCR_SC |
---|
236 | xwave_PCR_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
237 | Make/O/D coef_PCR_SC = {0.1,60,10,0.1,1e-6,2e-6,6e-6,10,0,298,78,0.0001} |
---|
238 | make/o/t parameters_PCR_SC = {"volume fraction","avg radius(A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
239 | Edit/K=1 parameters_PCR_SC,coef_PCR_SC |
---|
240 | |
---|
241 | Variable/G root:g_PCR_SC |
---|
242 | g_PCR_SC := PolyCSRatio_SC(coef_PCR_SC,ywave_PCR_SC,xwave_PCR_SC) |
---|
243 | Display/K=1 ywave_PCR_SC vs xwave_PCR_SC |
---|
244 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
245 | Label bottom "q (\\S-1\\M)" |
---|
246 | Label left "Intensity (cm\\S-1\\M)" |
---|
247 | |
---|
248 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
249 | End |
---|
250 | |
---|
251 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
252 | Proc PlotSmearedPolyCSRatio_SC(str) |
---|
253 | String str |
---|
254 | Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) |
---|
255 | |
---|
256 | // if any of the resolution waves are missing => abort |
---|
257 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
258 | Abort |
---|
259 | endif |
---|
260 | |
---|
261 | SetDataFolder $("root:"+str) |
---|
262 | |
---|
263 | if(!DataFolderExists(":HayPenMSA")) |
---|
264 | NewDataFolder :HayPenMSA |
---|
265 | endif |
---|
266 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
267 | |
---|
268 | // Setup parameter table for model function |
---|
269 | Make/O/D smear_coef_PCR_SC = {0.1,60,10,0.1,1e-6,2e-6,6e-6,10,0,298,78,0.0001} |
---|
270 | make/o/t smear_parameters_PCR_SC = {"volume fraction","avg radius(A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
271 | Edit smear_parameters_PCR_SC,smear_coef_PCR_SC |
---|
272 | |
---|
273 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
274 | // make extra copy of experimental q-values for easy plotting |
---|
275 | Duplicate/O $(str+"_q") smeared_PCR_SC,smeared_qvals |
---|
276 | SetScale d,0,0,"1/cm",smeared_PCR_SC |
---|
277 | |
---|
278 | Variable/G gs_PCR_SC=0 |
---|
279 | gs_PCR_SC := fSmearedPolyCSRatio_SC(smear_coef_PCR_SC,smeared_PCR_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
280 | |
---|
281 | Display smeared_PCR_SC vs smeared_qvals |
---|
282 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
283 | Label bottom "q (\\S-1\\M)" |
---|
284 | Label left "Intensity (cm\\S-1\\M)" |
---|
285 | |
---|
286 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
287 | |
---|
288 | SetDataFolder root: |
---|
289 | End |
---|
290 | |
---|
291 | |
---|
292 | Function PolyCSRatio_SC(w,yw,xw) : FitFunc |
---|
293 | Wave w,yw,xw |
---|
294 | |
---|
295 | Variable inten |
---|
296 | |
---|
297 | //setup form factor coefficient wave |
---|
298 | Make/O/D/N=8 form_PCR_SC |
---|
299 | form_PCR_SC[0] = 1 |
---|
300 | form_PCR_SC[1] = w[1] |
---|
301 | form_PCR_SC[2] = w[2] |
---|
302 | form_PCR_SC[3] = w[3] |
---|
303 | form_PCR_SC[4] = w[4] |
---|
304 | form_PCR_SC[5] = w[5] |
---|
305 | form_PCR_SC[6] = w[6] |
---|
306 | form_PCR_SC[7] = 0 |
---|
307 | |
---|
308 | //calculate the diameter of the effective one-component sphere |
---|
309 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
310 | pd = w[3] |
---|
311 | zz = (1/pd)^2 - 1 |
---|
312 | Ravg = w[1] |
---|
313 | thick = w[2] |
---|
314 | |
---|
315 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
316 | diam = (6*Vpoly/pi)^(1/3) |
---|
317 | |
---|
318 | //setup structure factor coefficient wave |
---|
319 | Make/O/D/N=6 struct_PCR_SC |
---|
320 | struct_PCR_SC[0] = diam |
---|
321 | struct_PCR_SC[1] = w[7] |
---|
322 | struct_PCR_SC[2] = w[0] |
---|
323 | struct_PCR_SC[3] = w[9] |
---|
324 | struct_PCR_SC[4] = w[8] |
---|
325 | struct_PCR_SC[5] = w[10] |
---|
326 | |
---|
327 | //calculate each and combine |
---|
328 | Duplicate/O xw temp_PCR_SC_PQ,temp_PCR_SC_SQ //make waves for the AAO |
---|
329 | PolyCoreShellRatio(form_PCR_SC,temp_PCR_SC_PQ,xw) |
---|
330 | HayterPenfoldMSA(struct_PCR_SC,temp_PCR_SC_SQ,xw) |
---|
331 | yw = temp_PCR_SC_PQ * temp_PCR_SC_SQ |
---|
332 | yw *= w[0] |
---|
333 | yw += w[11] |
---|
334 | |
---|
335 | //cleanup waves |
---|
336 | // Killwaves/Z form_PCR_SC,struct_PCR_SC |
---|
337 | |
---|
338 | return (0) |
---|
339 | End |
---|
340 | |
---|
341 | ///////////////////////////////////////// |
---|
342 | Proc PlotPolyCSRatio_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 (^-1) for model: " |
---|
346 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
347 | |
---|
348 | Make/O/D/n=(num) xwave_PCR_SHS,ywave_PCR_SHS |
---|
349 | xwave_PCR_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
350 | Make/O/D coef_PCR_SHS = {0.1,60,10,0.1,1e-6,2e-6,3e-6,0.05,0.2,0.0001} |
---|
351 | make/o/t parameters_PCR_SHS = {"volume fraction","avg radius(A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
352 | Edit/K=1 parameters_PCR_SHS,coef_PCR_SHS |
---|
353 | |
---|
354 | Variable/G root:g_PCR_SHS |
---|
355 | g_PCR_SHS := PolyCSRatio_SHS(coef_PCR_SHS,ywave_PCR_SHS,xwave_PCR_SHS) |
---|
356 | Display/K=1 ywave_PCR_SHS vs xwave_PCR_SHS |
---|
357 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
358 | Label bottom "q (\\S-1\\M)" |
---|
359 | Label left "Intensity (cm\\S-1\\M)" |
---|
360 | |
---|
361 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
362 | End |
---|
363 | |
---|
364 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
365 | Proc PlotSmearedPolyCSRatio_SHS(str) |
---|
366 | String str |
---|
367 | Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) |
---|
368 | |
---|
369 | // if any of the resolution waves are missing => abort |
---|
370 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
371 | Abort |
---|
372 | endif |
---|
373 | |
---|
374 | SetDataFolder $("root:"+str) |
---|
375 | |
---|
376 | // Setup parameter table for model function |
---|
377 | Make/O/D smear_coef_PCR_SHS = {0.1,60,10,0.1,1e-6,2e-6,3e-6,0.05,0.2,0.0001} |
---|
378 | make/o/t smear_parameters_PCR_SHS = {"volume fraction","avg radius(A)","avg shell thickness (A)","overall polydispersity","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
379 | Edit smear_parameters_PCR_SHS,smear_coef_PCR_SHS |
---|
380 | |
---|
381 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
382 | // make extra copy of experimental q-values for easy plotting |
---|
383 | Duplicate/O $(str+"_q") smeared_PCR_SHS,smeared_qvals |
---|
384 | SetScale d,0,0,"1/cm",smeared_PCR_SHS |
---|
385 | |
---|
386 | Variable/G gs_PCR_SHS=0 |
---|
387 | gs_PCR_SHS := fSmearedPolyCSRatio_SHS(smear_coef_PCR_SHS,smeared_PCR_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
388 | |
---|
389 | Display smeared_PCR_SHS vs smeared_qvals |
---|
390 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
391 | Label bottom "q (\\S-1\\M)" |
---|
392 | Label left "Intensity (cm\\S-1\\M)" |
---|
393 | |
---|
394 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
395 | |
---|
396 | SetDataFolder root: |
---|
397 | End |
---|
398 | |
---|
399 | |
---|
400 | Function PolyCSRatio_SHS(w,yw,xw) : FitFunc |
---|
401 | Wave w,yw,xw |
---|
402 | |
---|
403 | Variable inten |
---|
404 | |
---|
405 | //setup form factor coefficient wave |
---|
406 | Make/O/D/N=8 form_PCR_SHS |
---|
407 | form_PCR_SHS[0] = 1 |
---|
408 | form_PCR_SHS[1] = w[1] |
---|
409 | form_PCR_SHS[2] = w[2] |
---|
410 | form_PCR_SHS[3] = w[3] |
---|
411 | form_PCR_SHS[4] = w[4] |
---|
412 | form_PCR_SHS[5] = w[5] |
---|
413 | form_PCR_SHS[6] = w[6] |
---|
414 | form_PCR_SHS[7] = 0 |
---|
415 | |
---|
416 | //calculate the diameter of the effective one-component sphere |
---|
417 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
418 | pd = w[3] |
---|
419 | zz = (1/pd)^2 - 1 |
---|
420 | Ravg = w[1] |
---|
421 | thick = w[2] |
---|
422 | |
---|
423 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
424 | diam = (6*Vpoly/pi)^(1/3) |
---|
425 | |
---|
426 | //setup structure factor coefficient wave |
---|
427 | Make/O/D/N=4 struct_PCR_SHS |
---|
428 | struct_PCR_SHS[0] = diam/2 |
---|
429 | struct_PCR_SHS[1] = w[0] |
---|
430 | struct_PCR_SHS[2] = w[7] |
---|
431 | struct_PCR_SHS[3] = w[8] |
---|
432 | |
---|
433 | //calculate each and combine |
---|
434 | Duplicate/O xw temp_PCR_SHS_PQ,temp_PCR_SHS_SQ //make waves for the AAO |
---|
435 | PolyCoreShellRatio(form_PCR_SHS,temp_PCR_SHS_PQ,xw) |
---|
436 | StickyHS_Struct(struct_PCR_SHS,temp_PCR_SHS_SQ,xw) |
---|
437 | yw = temp_PCR_SHS_PQ * temp_PCR_SHS_SQ |
---|
438 | yw *= w[0] |
---|
439 | yw += w[9] |
---|
440 | |
---|
441 | //cleanup waves |
---|
442 | // Killwaves/Z form_PCR_SHS,struct_PCR_SHS |
---|
443 | |
---|
444 | return (0) |
---|
445 | End |
---|
446 | |
---|
447 | |
---|
448 | |
---|
449 | // this is all there is to the smeared calculation! |
---|
450 | Function SmearedPolyCSRatio_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(PolyCSRatio_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 SmearedPolyCSRatio_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(PolyCSRatio_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 SmearedPolyCSRatio_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(PolyCSRatio_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 SmearedPolyCSRatio_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(PolyCSRatio_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 fSmearedPolyCSRatio_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 = SmearedPolyCSRatio_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 fSmearedPolyCSRatio_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 = SmearedPolyCSRatio_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 fSmearedPolyCSRatio_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 = SmearedPolyCSRatio_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 fSmearedPolyCSRatio_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 = SmearedPolyCSRatio_SHS(fs) |
---|
585 | |
---|
586 | return (0) |
---|
587 | End |
---|