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 "PolyCoreShellRatio_v40" |
---|
7 | |
---|
8 | #include "HardSphereStruct_v40" |
---|
9 | #include "HPMSA_v40" |
---|
10 | #include "SquareWellStruct_v40" |
---|
11 | #include "StickyHardSphereStruct_v40" |
---|
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 (A^-1) for model: " |
---|
17 | Prompt qmax "Enter maximum q-value (A^-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 (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("PolyCSRatio_HS","coef_PCR_HS","parameters_PCR_HS","PCR_HS") |
---|
35 | End |
---|
36 | |
---|
37 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
38 | Proc PlotSmearedPolyCSRatio_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_PCR_HS = {0.1,60,10,0.1,1e-6,2e-6,6e-6,0.0001} |
---|
51 | 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)"} |
---|
52 | Edit smear_parameters_PCR_HS,smear_coef_PCR_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_PCR_HS,smeared_qvals |
---|
57 | SetScale d,0,0,"1/cm",smeared_PCR_HS |
---|
58 | |
---|
59 | Variable/G gs_PCR_HS=0 |
---|
60 | gs_PCR_HS := fSmearedPolyCSRatio_HS(smear_coef_PCR_HS,smeared_PCR_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
61 | |
---|
62 | Display smeared_PCR_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("SmearedPolyCSRatio_HS","smear_coef_PCR_HS","smear_parameters_PCR_HS","PCR_HS") |
---|
71 | End |
---|
72 | |
---|
73 | |
---|
74 | Function PolyCSRatio_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=8 form_PCR_HS |
---|
81 | form_PCR_HS[0] = 1 |
---|
82 | form_PCR_HS[1] = w[1] |
---|
83 | form_PCR_HS[2] = w[2] |
---|
84 | form_PCR_HS[3] = w[3] |
---|
85 | form_PCR_HS[4] = w[4] |
---|
86 | form_PCR_HS[5] = w[5] |
---|
87 | form_PCR_HS[6] = w[6] |
---|
88 | form_PCR_HS[7] = 0 |
---|
89 | |
---|
90 | //calculate the diameter of the effective one-component sphere |
---|
91 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
92 | pd = w[3] |
---|
93 | zz = (1/pd)^2 - 1 |
---|
94 | Ravg = w[1] |
---|
95 | thick = w[2] |
---|
96 | |
---|
97 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
98 | diam = (6*Vpoly/pi)^(1/3) |
---|
99 | |
---|
100 | //setup structure factor coefficient wave |
---|
101 | Make/O/D/N=2 struct_PCR_HS |
---|
102 | struct_PCR_HS[0] = diam/2 |
---|
103 | struct_PCR_HS[1] = w[0] |
---|
104 | |
---|
105 | //calculate each and combine |
---|
106 | Duplicate/O xw temp_PCR_HS_PQ,temp_PCR_HS_SQ //make waves for the AAO |
---|
107 | PolyCoreShellRatio(form_PCR_HS,temp_PCR_HS_PQ,xw) |
---|
108 | HardSphereStruct(struct_PCR_HS,temp_PCR_HS_SQ,xw) |
---|
109 | yw = temp_PCR_HS_PQ * temp_PCR_HS_SQ |
---|
110 | yw *= w[0] |
---|
111 | yw += w[7] |
---|
112 | |
---|
113 | //cleanup waves |
---|
114 | // Killwaves/Z form_PCR_HS,struct_PCR_HS |
---|
115 | |
---|
116 | return (0) |
---|
117 | End |
---|
118 | |
---|
119 | ///////////////////////////////////////// |
---|
120 | Proc PlotPolyCSRatio_SW(num,qmin,qmax) |
---|
121 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
122 | Prompt num "Enter number of data points for model: " |
---|
123 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
124 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
125 | |
---|
126 | Make/O/D/n=(num) xwave_PCR_SW,ywave_PCR_SW |
---|
127 | xwave_PCR_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
128 | Make/O/D coef_PCR_SW = {0.1,60,10,0.1,1e-6,2e-6,3e-6,1,1.2,0.0001} |
---|
129 | 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)"} |
---|
130 | Edit/K=1 parameters_PCR_SW,coef_PCR_SW |
---|
131 | |
---|
132 | Variable/G root:g_PCR_SW |
---|
133 | g_PCR_SW := PolyCSRatio_SW(coef_PCR_SW,ywave_PCR_SW,xwave_PCR_SW) |
---|
134 | Display/K=1 ywave_PCR_SW vs xwave_PCR_SW |
---|
135 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
136 | Label bottom "q (A\\S-1\\M)" |
---|
137 | Label left "Intensity (cm\\S-1\\M)" |
---|
138 | |
---|
139 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
140 | |
---|
141 | AddModelToStrings("PolyCSRatio_SW","coef_PCR_SW","parameters_PCR_SW","PCR_SW") |
---|
142 | End |
---|
143 | |
---|
144 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
145 | Proc PlotSmearedPolyCSRatio_SW(str) |
---|
146 | String str |
---|
147 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
148 | |
---|
149 | // if any of the resolution waves are missing => abort |
---|
150 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
151 | Abort |
---|
152 | endif |
---|
153 | |
---|
154 | SetDataFolder $("root:"+str) |
---|
155 | |
---|
156 | // Setup parameter table for model function |
---|
157 | Make/O/D smear_coef_PCR_SW = {0.1,60,10,0.1,1e-6,2e-6,3e-6,1,1.2,0.0001} |
---|
158 | 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)"} |
---|
159 | Edit smear_parameters_PCR_SW,smear_coef_PCR_SW |
---|
160 | |
---|
161 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
162 | // make extra copy of experimental q-values for easy plotting |
---|
163 | Duplicate/O $(str+"_q") smeared_PCR_SW,smeared_qvals |
---|
164 | SetScale d,0,0,"1/cm",smeared_PCR_SW |
---|
165 | |
---|
166 | Variable/G gs_PCR_SW=0 |
---|
167 | gs_PCR_SW := fSmearedPolyCSRatio_SW(smear_coef_PCR_SW,smeared_PCR_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
168 | |
---|
169 | Display smeared_PCR_SW vs smeared_qvals |
---|
170 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
171 | Label bottom "q (A\\S-1\\M)" |
---|
172 | Label left "Intensity (cm\\S-1\\M)" |
---|
173 | |
---|
174 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
175 | |
---|
176 | SetDataFolder root: |
---|
177 | AddModelToStrings("SmearedPolyCSRatio_SW","smear_coef_PCR_SW","smear_parameters_PCR_SW","PCR_SW") |
---|
178 | End |
---|
179 | |
---|
180 | |
---|
181 | Function PolyCSRatio_SW(w,yw,xw) : FitFunc |
---|
182 | Wave w,yw,xw |
---|
183 | |
---|
184 | Variable inten |
---|
185 | |
---|
186 | //setup form factor coefficient wave |
---|
187 | Make/O/D/N=8 form_PCR_SW |
---|
188 | form_PCR_SW[0] = 1 |
---|
189 | form_PCR_SW[1] = w[1] |
---|
190 | form_PCR_SW[2] = w[2] |
---|
191 | form_PCR_SW[3] = w[3] |
---|
192 | form_PCR_SW[4] = w[4] |
---|
193 | form_PCR_SW[5] = w[5] |
---|
194 | form_PCR_SW[6] = w[6] |
---|
195 | form_PCR_SW[7] = 0 |
---|
196 | |
---|
197 | //calculate the diameter of the effective one-component sphere |
---|
198 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
199 | pd = w[3] |
---|
200 | zz = (1/pd)^2 - 1 |
---|
201 | Ravg = w[1] |
---|
202 | thick = w[2] |
---|
203 | |
---|
204 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
205 | diam = (6*Vpoly/pi)^(1/3) |
---|
206 | |
---|
207 | //setup structure factor coefficient wave |
---|
208 | Make/O/D/N=4 struct_PCR_SW |
---|
209 | struct_PCR_SW[0] = diam/2 |
---|
210 | struct_PCR_SW[1] = w[0] |
---|
211 | struct_PCR_SW[2] = w[7] |
---|
212 | struct_PCR_SW[3] = w[8] |
---|
213 | |
---|
214 | //calculate each and combine |
---|
215 | Duplicate/O xw temp_PCR_SW_PQ,temp_PCR_SW_SQ //make waves for the AAO |
---|
216 | PolyCoreShellRatio(form_PCR_SW,temp_PCR_SW_PQ,xw) |
---|
217 | SquareWellStruct(struct_PCR_SW,temp_PCR_SW_SQ,xw) |
---|
218 | yw = temp_PCR_SW_PQ * temp_PCR_SW_SQ |
---|
219 | yw *= w[0] |
---|
220 | yw += w[9] |
---|
221 | |
---|
222 | //cleanup waves |
---|
223 | // Killwaves/Z form_PCR_SW,struct_PCR_SW |
---|
224 | |
---|
225 | return (0) |
---|
226 | End |
---|
227 | |
---|
228 | |
---|
229 | ///////////////////////////////////////// |
---|
230 | Proc PlotPolyCSRatio_SC(num,qmin,qmax) |
---|
231 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
232 | Prompt num "Enter number of data points for model: " |
---|
233 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
234 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
235 | |
---|
236 | if(!DataFolderExists(":HayPenMSA")) |
---|
237 | NewDataFolder :HayPenMSA |
---|
238 | endif |
---|
239 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
240 | |
---|
241 | Make/O/D/n=(num) xwave_PCR_SC,ywave_PCR_SC |
---|
242 | xwave_PCR_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
243 | Make/O/D coef_PCR_SC = {0.1,60,10,0.1,1e-6,2e-6,6e-6,10,0,298,78,0.0001} |
---|
244 | 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)"} |
---|
245 | Edit/K=1 parameters_PCR_SC,coef_PCR_SC |
---|
246 | |
---|
247 | Variable/G root:g_PCR_SC |
---|
248 | g_PCR_SC := PolyCSRatio_SC(coef_PCR_SC,ywave_PCR_SC,xwave_PCR_SC) |
---|
249 | Display/K=1 ywave_PCR_SC vs xwave_PCR_SC |
---|
250 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
251 | Label bottom "q (A\\S-1\\M)" |
---|
252 | Label left "Intensity (cm\\S-1\\M)" |
---|
253 | |
---|
254 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
255 | |
---|
256 | AddModelToStrings("PolyCSRatio_SC","coef_PCR_SC","parameters_PCR_SC","PCR_SC") |
---|
257 | End |
---|
258 | |
---|
259 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
260 | Proc PlotSmearedPolyCSRatio_SC(str) |
---|
261 | String str |
---|
262 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
263 | |
---|
264 | // if any of the resolution waves are missing => abort |
---|
265 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
266 | Abort |
---|
267 | endif |
---|
268 | |
---|
269 | SetDataFolder $("root:"+str) |
---|
270 | |
---|
271 | if(!DataFolderExists(":HayPenMSA")) |
---|
272 | NewDataFolder :HayPenMSA |
---|
273 | endif |
---|
274 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
275 | |
---|
276 | // Setup parameter table for model function |
---|
277 | 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} |
---|
278 | 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)"} |
---|
279 | Edit smear_parameters_PCR_SC,smear_coef_PCR_SC |
---|
280 | |
---|
281 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
282 | // make extra copy of experimental q-values for easy plotting |
---|
283 | Duplicate/O $(str+"_q") smeared_PCR_SC,smeared_qvals |
---|
284 | SetScale d,0,0,"1/cm",smeared_PCR_SC |
---|
285 | |
---|
286 | Variable/G gs_PCR_SC=0 |
---|
287 | gs_PCR_SC := fSmearedPolyCSRatio_SC(smear_coef_PCR_SC,smeared_PCR_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
288 | |
---|
289 | Display smeared_PCR_SC vs smeared_qvals |
---|
290 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
291 | Label bottom "q (A\\S-1\\M)" |
---|
292 | Label left "Intensity (cm\\S-1\\M)" |
---|
293 | |
---|
294 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
295 | |
---|
296 | SetDataFolder root: |
---|
297 | AddModelToStrings("SmearedPolyCSRatio_SC","smear_coef_PCR_SC","smear_parameters_PCR_SC","PCR_SC") |
---|
298 | End |
---|
299 | |
---|
300 | |
---|
301 | Function PolyCSRatio_SC(w,yw,xw) : FitFunc |
---|
302 | Wave w,yw,xw |
---|
303 | |
---|
304 | Variable inten |
---|
305 | |
---|
306 | //setup form factor coefficient wave |
---|
307 | Make/O/D/N=8 form_PCR_SC |
---|
308 | form_PCR_SC[0] = 1 |
---|
309 | form_PCR_SC[1] = w[1] |
---|
310 | form_PCR_SC[2] = w[2] |
---|
311 | form_PCR_SC[3] = w[3] |
---|
312 | form_PCR_SC[4] = w[4] |
---|
313 | form_PCR_SC[5] = w[5] |
---|
314 | form_PCR_SC[6] = w[6] |
---|
315 | form_PCR_SC[7] = 0 |
---|
316 | |
---|
317 | //calculate the diameter of the effective one-component sphere |
---|
318 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
319 | pd = w[3] |
---|
320 | zz = (1/pd)^2 - 1 |
---|
321 | Ravg = w[1] |
---|
322 | thick = w[2] |
---|
323 | |
---|
324 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
325 | diam = (6*Vpoly/pi)^(1/3) |
---|
326 | |
---|
327 | //setup structure factor coefficient wave |
---|
328 | Make/O/D/N=6 struct_PCR_SC |
---|
329 | struct_PCR_SC[0] = diam |
---|
330 | struct_PCR_SC[1] = w[7] |
---|
331 | struct_PCR_SC[2] = w[0] |
---|
332 | struct_PCR_SC[3] = w[9] |
---|
333 | struct_PCR_SC[4] = w[8] |
---|
334 | struct_PCR_SC[5] = w[10] |
---|
335 | |
---|
336 | //calculate each and combine |
---|
337 | Duplicate/O xw temp_PCR_SC_PQ,temp_PCR_SC_SQ //make waves for the AAO |
---|
338 | PolyCoreShellRatio(form_PCR_SC,temp_PCR_SC_PQ,xw) |
---|
339 | HayterPenfoldMSA(struct_PCR_SC,temp_PCR_SC_SQ,xw) |
---|
340 | yw = temp_PCR_SC_PQ * temp_PCR_SC_SQ |
---|
341 | yw *= w[0] |
---|
342 | yw += w[11] |
---|
343 | |
---|
344 | //cleanup waves |
---|
345 | // Killwaves/Z form_PCR_SC,struct_PCR_SC |
---|
346 | |
---|
347 | return (0) |
---|
348 | End |
---|
349 | |
---|
350 | ///////////////////////////////////////// |
---|
351 | Proc PlotPolyCSRatio_SHS(num,qmin,qmax) |
---|
352 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
353 | Prompt num "Enter number of data points for model: " |
---|
354 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
355 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
356 | |
---|
357 | Make/O/D/n=(num) xwave_PCR_SHS,ywave_PCR_SHS |
---|
358 | xwave_PCR_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
359 | Make/O/D coef_PCR_SHS = {0.1,60,10,0.1,1e-6,2e-6,3e-6,0.05,0.2,0.0001} |
---|
360 | 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)"} |
---|
361 | Edit/K=1 parameters_PCR_SHS,coef_PCR_SHS |
---|
362 | |
---|
363 | Variable/G root:g_PCR_SHS |
---|
364 | g_PCR_SHS := PolyCSRatio_SHS(coef_PCR_SHS,ywave_PCR_SHS,xwave_PCR_SHS) |
---|
365 | Display/K=1 ywave_PCR_SHS vs xwave_PCR_SHS |
---|
366 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
367 | Label bottom "q (A\\S-1\\M)" |
---|
368 | Label left "Intensity (cm\\S-1\\M)" |
---|
369 | |
---|
370 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
371 | |
---|
372 | AddModelToStrings("PolyCSRatio_SHS","coef_PCR_SHS","parameters_PCR_SHS","PCR_SHS") |
---|
373 | End |
---|
374 | |
---|
375 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
376 | Proc PlotSmearedPolyCSRatio_SHS(str) |
---|
377 | String str |
---|
378 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
379 | |
---|
380 | // if any of the resolution waves are missing => abort |
---|
381 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
382 | Abort |
---|
383 | endif |
---|
384 | |
---|
385 | SetDataFolder $("root:"+str) |
---|
386 | |
---|
387 | // Setup parameter table for model function |
---|
388 | 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} |
---|
389 | 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)"} |
---|
390 | Edit smear_parameters_PCR_SHS,smear_coef_PCR_SHS |
---|
391 | |
---|
392 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
393 | // make extra copy of experimental q-values for easy plotting |
---|
394 | Duplicate/O $(str+"_q") smeared_PCR_SHS,smeared_qvals |
---|
395 | SetScale d,0,0,"1/cm",smeared_PCR_SHS |
---|
396 | |
---|
397 | Variable/G gs_PCR_SHS=0 |
---|
398 | gs_PCR_SHS := fSmearedPolyCSRatio_SHS(smear_coef_PCR_SHS,smeared_PCR_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
399 | |
---|
400 | Display smeared_PCR_SHS vs smeared_qvals |
---|
401 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
402 | Label bottom "q (A\\S-1\\M)" |
---|
403 | Label left "Intensity (cm\\S-1\\M)" |
---|
404 | |
---|
405 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
406 | |
---|
407 | SetDataFolder root: |
---|
408 | AddModelToStrings("SmearedPolyCSRatio_SHS","smear_coef_PCR_SHS","smear_parameters_PCR_SHS","PCR_SHS") |
---|
409 | End |
---|
410 | |
---|
411 | |
---|
412 | Function PolyCSRatio_SHS(w,yw,xw) : FitFunc |
---|
413 | Wave w,yw,xw |
---|
414 | |
---|
415 | Variable inten |
---|
416 | |
---|
417 | //setup form factor coefficient wave |
---|
418 | Make/O/D/N=8 form_PCR_SHS |
---|
419 | form_PCR_SHS[0] = 1 |
---|
420 | form_PCR_SHS[1] = w[1] |
---|
421 | form_PCR_SHS[2] = w[2] |
---|
422 | form_PCR_SHS[3] = w[3] |
---|
423 | form_PCR_SHS[4] = w[4] |
---|
424 | form_PCR_SHS[5] = w[5] |
---|
425 | form_PCR_SHS[6] = w[6] |
---|
426 | form_PCR_SHS[7] = 0 |
---|
427 | |
---|
428 | //calculate the diameter of the effective one-component sphere |
---|
429 | Variable pd,diam,zz,Vpoly,Ravg,thick |
---|
430 | pd = w[3] |
---|
431 | zz = (1/pd)^2 - 1 |
---|
432 | Ravg = w[1] |
---|
433 | thick = w[2] |
---|
434 | |
---|
435 | Vpoly = 4*pi/3*(Ravg+thick)^3*(zz+3)*(zz+2)/(zz+1)^2 |
---|
436 | diam = (6*Vpoly/pi)^(1/3) |
---|
437 | |
---|
438 | //setup structure factor coefficient wave |
---|
439 | Make/O/D/N=4 struct_PCR_SHS |
---|
440 | struct_PCR_SHS[0] = diam/2 |
---|
441 | struct_PCR_SHS[1] = w[0] |
---|
442 | struct_PCR_SHS[2] = w[7] |
---|
443 | struct_PCR_SHS[3] = w[8] |
---|
444 | |
---|
445 | //calculate each and combine |
---|
446 | Duplicate/O xw temp_PCR_SHS_PQ,temp_PCR_SHS_SQ //make waves for the AAO |
---|
447 | PolyCoreShellRatio(form_PCR_SHS,temp_PCR_SHS_PQ,xw) |
---|
448 | StickyHS_Struct(struct_PCR_SHS,temp_PCR_SHS_SQ,xw) |
---|
449 | yw = temp_PCR_SHS_PQ * temp_PCR_SHS_SQ |
---|
450 | yw *= w[0] |
---|
451 | yw += w[9] |
---|
452 | |
---|
453 | //cleanup waves |
---|
454 | // Killwaves/Z form_PCR_SHS,struct_PCR_SHS |
---|
455 | |
---|
456 | return (0) |
---|
457 | End |
---|
458 | |
---|
459 | |
---|
460 | |
---|
461 | // this is all there is to the smeared calculation! |
---|
462 | Function SmearedPolyCSRatio_HS(s) :FitFunc |
---|
463 | Struct ResSmearAAOStruct &s |
---|
464 | |
---|
465 | // the name of your unsmeared model is the first argument |
---|
466 | Smear_Model_20(PolyCSRatio_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
467 | |
---|
468 | return(0) |
---|
469 | End |
---|
470 | |
---|
471 | // this is all there is to the smeared calculation! |
---|
472 | Function SmearedPolyCSRatio_SW(s) :FitFunc |
---|
473 | Struct ResSmearAAOStruct &s |
---|
474 | |
---|
475 | // the name of your unsmeared model is the first argument |
---|
476 | Smear_Model_20(PolyCSRatio_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
477 | |
---|
478 | return(0) |
---|
479 | End |
---|
480 | |
---|
481 | // this is all there is to the smeared calculation! |
---|
482 | Function SmearedPolyCSRatio_SC(s) :FitFunc |
---|
483 | Struct ResSmearAAOStruct &s |
---|
484 | |
---|
485 | // the name of your unsmeared model is the first argument |
---|
486 | Smear_Model_20(PolyCSRatio_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
487 | |
---|
488 | return(0) |
---|
489 | End |
---|
490 | |
---|
491 | // this is all there is to the smeared calculation! |
---|
492 | Function SmearedPolyCSRatio_SHS(s) :FitFunc |
---|
493 | Struct ResSmearAAOStruct &s |
---|
494 | |
---|
495 | // the name of your unsmeared model is the first argument |
---|
496 | Smear_Model_20(PolyCSRatio_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
497 | |
---|
498 | return(0) |
---|
499 | End |
---|
500 | |
---|
501 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
502 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
503 | // |
---|
504 | // used only for the dependency, not for fitting |
---|
505 | // |
---|
506 | Function fSmearedPolyCSRatio_HS(coefW,yW,xW) |
---|
507 | Wave coefW,yW,xW |
---|
508 | |
---|
509 | String str = getWavesDataFolder(yW,0) |
---|
510 | String DF="root:"+str+":" |
---|
511 | |
---|
512 | WAVE resW = $(DF+str+"_res") |
---|
513 | |
---|
514 | STRUCT ResSmearAAOStruct fs |
---|
515 | WAVE fs.coefW = coefW |
---|
516 | WAVE fs.yW = yW |
---|
517 | WAVE fs.xW = xW |
---|
518 | WAVE fs.resW = resW |
---|
519 | |
---|
520 | Variable err |
---|
521 | err = SmearedPolyCSRatio_HS(fs) |
---|
522 | |
---|
523 | return (0) |
---|
524 | End |
---|
525 | |
---|
526 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
527 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
528 | // |
---|
529 | // used only for the dependency, not for fitting |
---|
530 | // |
---|
531 | Function fSmearedPolyCSRatio_SW(coefW,yW,xW) |
---|
532 | Wave coefW,yW,xW |
---|
533 | |
---|
534 | String str = getWavesDataFolder(yW,0) |
---|
535 | String DF="root:"+str+":" |
---|
536 | |
---|
537 | WAVE resW = $(DF+str+"_res") |
---|
538 | |
---|
539 | STRUCT ResSmearAAOStruct fs |
---|
540 | WAVE fs.coefW = coefW |
---|
541 | WAVE fs.yW = yW |
---|
542 | WAVE fs.xW = xW |
---|
543 | WAVE fs.resW = resW |
---|
544 | |
---|
545 | Variable err |
---|
546 | err = SmearedPolyCSRatio_SW(fs) |
---|
547 | |
---|
548 | return (0) |
---|
549 | End |
---|
550 | |
---|
551 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
552 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
553 | // |
---|
554 | // used only for the dependency, not for fitting |
---|
555 | // |
---|
556 | Function fSmearedPolyCSRatio_SC(coefW,yW,xW) |
---|
557 | Wave coefW,yW,xW |
---|
558 | |
---|
559 | String str = getWavesDataFolder(yW,0) |
---|
560 | String DF="root:"+str+":" |
---|
561 | |
---|
562 | WAVE resW = $(DF+str+"_res") |
---|
563 | |
---|
564 | STRUCT ResSmearAAOStruct fs |
---|
565 | WAVE fs.coefW = coefW |
---|
566 | WAVE fs.yW = yW |
---|
567 | WAVE fs.xW = xW |
---|
568 | WAVE fs.resW = resW |
---|
569 | |
---|
570 | Variable err |
---|
571 | err = SmearedPolyCSRatio_SC(fs) |
---|
572 | |
---|
573 | return (0) |
---|
574 | End |
---|
575 | |
---|
576 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
577 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
578 | // |
---|
579 | // used only for the dependency, not for fitting |
---|
580 | // |
---|
581 | Function fSmearedPolyCSRatio_SHS(coefW,yW,xW) |
---|
582 | Wave coefW,yW,xW |
---|
583 | |
---|
584 | String str = getWavesDataFolder(yW,0) |
---|
585 | String DF="root:"+str+":" |
---|
586 | |
---|
587 | WAVE resW = $(DF+str+"_res") |
---|
588 | |
---|
589 | STRUCT ResSmearAAOStruct fs |
---|
590 | WAVE fs.coefW = coefW |
---|
591 | WAVE fs.yW = yW |
---|
592 | WAVE fs.xW = xW |
---|
593 | WAVE fs.resW = resW |
---|
594 | |
---|
595 | Variable err |
---|
596 | err = SmearedPolyCSRatio_SHS(fs) |
---|
597 | |
---|
598 | return (0) |
---|
599 | End |
---|