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