1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion=6.1 |
---|
3 | |
---|
4 | // be sure to include all the necessary files... |
---|
5 | |
---|
6 | #include "PolyRectSphere_v40" |
---|
7 | |
---|
8 | #include "HardSphereStruct_v40" |
---|
9 | #include "HPMSA_v40" |
---|
10 | #include "SquareWellStruct_v40" |
---|
11 | #include "StickyHardSphereStruct_v40" |
---|
12 | #include "Two_Yukawa_v40" |
---|
13 | |
---|
14 | Proc PlotPolyRectSphere_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_RECT_HS,ywave_RECT_HS |
---|
21 | xwave_RECT_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
22 | Make/O/D coef_RECT_HS = {0.1,60,0.1,1e-6,6.3e-6,0.0001} |
---|
23 | make/o/t parameters_RECT_HS = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","bkg (cm-1)"} |
---|
24 | Edit/K=1 parameters_RECT_HS,coef_RECT_HS |
---|
25 | |
---|
26 | Variable/G root:g_RECT_HS |
---|
27 | g_RECT_HS := PolyRectSphere_HS(coef_RECT_HS,ywave_RECT_HS,xwave_RECT_HS) |
---|
28 | Display/K=1 ywave_RECT_HS vs xwave_RECT_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("PolyRectSphere_HS","coef_RECT_HS","parameters_RECT_HS","RECT_HS") |
---|
36 | End |
---|
37 | |
---|
38 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
39 | Proc PlotSmearedPolyRectSphere_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_RECT_HS = {0.1,60,0.1,1e-6,6.3e-6,0.0001} |
---|
52 | make/o/t smear_parameters_RECT_HS = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","bkg (cm-1)"} |
---|
53 | Edit smear_parameters_RECT_HS,smear_coef_RECT_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_RECT_HS,smeared_qvals |
---|
58 | SetScale d,0,0,"1/cm",smeared_RECT_HS |
---|
59 | |
---|
60 | Variable/G gs_RECT_HS=0 |
---|
61 | gs_RECT_HS := fSmearedPolyRectSphere_HS(smear_coef_RECT_HS,smeared_RECT_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
62 | |
---|
63 | Display smeared_RECT_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("SmearedPolyRectSphere_HS","smear_coef_RECT_HS","smear_parameters_RECT_HS","RECT_HS") |
---|
72 | End |
---|
73 | |
---|
74 | |
---|
75 | Function PolyRectSphere_HS(w,yw,xw) : FitFunc |
---|
76 | Wave w,yw,xw |
---|
77 | |
---|
78 | Variable inten |
---|
79 | |
---|
80 | //setup form factor coefficient wave |
---|
81 | Make/O/D/N=6 form_RECT_HS |
---|
82 | form_RECT_HS[0] = 1 |
---|
83 | form_RECT_HS[1] = w[1] |
---|
84 | form_RECT_HS[2] = w[2] |
---|
85 | form_RECT_HS[3] = w[3] |
---|
86 | form_RECT_HS[4] = w[4] |
---|
87 | form_RECT_HS[5] = 0 |
---|
88 | |
---|
89 | //calculate the diameter of the effective one-component sphere |
---|
90 | Variable pd,diam,zz,Vpoly,Ravg |
---|
91 | pd = w[2] |
---|
92 | zz = (1/pd)^2 - 1 |
---|
93 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
94 | |
---|
95 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
96 | diam = (6*Vpoly/pi)^(1/3) |
---|
97 | |
---|
98 | //setup structure factor coefficient wave |
---|
99 | Make/O/D/N=2 struct_RECT_HS |
---|
100 | struct_RECT_HS[0] = diam/2 |
---|
101 | struct_RECT_HS[1] = w[0] |
---|
102 | |
---|
103 | //calculate each and combine |
---|
104 | Duplicate/O xw temp_RECT_HS_PQ,temp_RECT_HS_SQ //make waves for the AAO |
---|
105 | PolyRectSpheres(form_RECT_HS,temp_RECT_HS_PQ,xw) |
---|
106 | HardSphereStruct(struct_RECT_HS,temp_RECT_HS_SQ,xw) |
---|
107 | yw = temp_RECT_HS_PQ * temp_RECT_HS_SQ |
---|
108 | yw *= w[0] |
---|
109 | yw += w[5] |
---|
110 | |
---|
111 | //cleanup waves |
---|
112 | // Killwaves/Z form_RECT_HS,struct_RECT_HS |
---|
113 | |
---|
114 | return (0) |
---|
115 | End |
---|
116 | |
---|
117 | ///////////////////////////////////////// |
---|
118 | Proc PlotPolyRectSphere_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 (A^-1) for model: " |
---|
122 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
123 | |
---|
124 | Make/O/D/n=(num) xwave_RECT_SW,ywave_RECT_SW |
---|
125 | xwave_RECT_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
126 | Make/O/D coef_RECT_SW = {0.1,60,0.1,1e-6,6.3e-6,1.0,1.2,0.0001} |
---|
127 | make/o/t parameters_RECT_SW = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
128 | Edit/K=1 parameters_RECT_SW,coef_RECT_SW |
---|
129 | |
---|
130 | Variable/G root:g_RECT_SW |
---|
131 | g_RECT_SW := PolyRectSphere_SW(coef_RECT_SW,ywave_RECT_SW,xwave_RECT_SW) |
---|
132 | Display/K=1 ywave_RECT_SW vs xwave_RECT_SW |
---|
133 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
134 | Label bottom "q (A\\S-1\\M)" |
---|
135 | Label left "Intensity (cm\\S-1\\M)" |
---|
136 | |
---|
137 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
138 | |
---|
139 | AddModelToStrings("PolyRectSphere_SW","coef_RECT_SW","parameters_RECT_SW","RECT_SW") |
---|
140 | End |
---|
141 | |
---|
142 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
143 | Proc PlotSmearedPolyRectSphere_SW(str) |
---|
144 | String str |
---|
145 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
146 | |
---|
147 | // if any of the resolution waves are missing => abort |
---|
148 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
149 | Abort |
---|
150 | endif |
---|
151 | |
---|
152 | SetDataFolder $("root:"+str) |
---|
153 | |
---|
154 | // Setup parameter table for model function |
---|
155 | Make/O/D smear_coef_RECT_SW = {0.1,60,0.1,1e-6,6.3e-6,1.0,1.2,0.0001} |
---|
156 | make/o/t smear_parameters_RECT_SW = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
157 | Edit smear_parameters_RECT_SW,smear_coef_RECT_SW |
---|
158 | |
---|
159 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
160 | // make extra copy of experimental q-values for easy plotting |
---|
161 | Duplicate/O $(str+"_q") smeared_RECT_SW,smeared_qvals |
---|
162 | SetScale d,0,0,"1/cm",smeared_RECT_SW |
---|
163 | |
---|
164 | Variable/G gs_RECT_SW=0 |
---|
165 | gs_RECT_SW := fSmearedPolyRectSphere_SW(smear_coef_RECT_SW,smeared_RECT_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
166 | |
---|
167 | Display smeared_RECT_SW vs smeared_qvals |
---|
168 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
169 | Label bottom "q (A\\S-1\\M)" |
---|
170 | Label left "Intensity (cm\\S-1\\M)" |
---|
171 | |
---|
172 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
173 | |
---|
174 | SetDataFolder root: |
---|
175 | AddModelToStrings("SmearedPolyRectSphere_SW","smear_coef_RECT_SW","smear_parameters_RECT_SW","RECT_SW") |
---|
176 | End |
---|
177 | |
---|
178 | |
---|
179 | Function PolyRectSphere_SW(w,yw,xw) : FitFunc |
---|
180 | Wave w,yw,xw |
---|
181 | |
---|
182 | Variable inten |
---|
183 | |
---|
184 | //setup form factor coefficient wave |
---|
185 | Make/O/D/N=6 form_RECT_SW |
---|
186 | form_RECT_SW[0] = 1 |
---|
187 | form_RECT_SW[1] = w[1] |
---|
188 | form_RECT_SW[2] = w[2] |
---|
189 | form_RECT_SW[3] = w[3] |
---|
190 | form_RECT_SW[4] = w[4] |
---|
191 | form_RECT_SW[5] = 0 |
---|
192 | |
---|
193 | //calculate the diameter of the effective one-component sphere |
---|
194 | Variable pd,diam,zz,Vpoly,Ravg |
---|
195 | pd = w[2] |
---|
196 | zz = (1/pd)^2 - 1 |
---|
197 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
198 | |
---|
199 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
200 | diam = (6*Vpoly/pi)^(1/3) |
---|
201 | |
---|
202 | //setup structure factor coefficient wave |
---|
203 | Make/O/D/N=4 struct_RECT_SW |
---|
204 | struct_RECT_SW[0] = diam/2 |
---|
205 | struct_RECT_SW[1] = w[0] |
---|
206 | struct_RECT_SW[2] = w[5] |
---|
207 | struct_RECT_SW[3] = w[6] |
---|
208 | |
---|
209 | //calculate each and combine |
---|
210 | Duplicate/O xw temp_RECT_SW_PQ,temp_RECT_SW_SQ //make waves for the AAO |
---|
211 | PolyRectSpheres(form_RECT_SW,temp_RECT_SW_PQ,xw) |
---|
212 | SquareWellStruct(struct_RECT_SW,temp_RECT_SW_SQ,xw) |
---|
213 | yw = temp_RECT_SW_PQ * temp_RECT_SW_SQ |
---|
214 | yw *= w[0] |
---|
215 | yw += w[7] |
---|
216 | |
---|
217 | //cleanup waves |
---|
218 | // Killwaves/Z form_RECT_SW,struct_RECT_SW |
---|
219 | |
---|
220 | return (0) |
---|
221 | End |
---|
222 | |
---|
223 | |
---|
224 | ///////////////////////////////////////// |
---|
225 | Proc PlotPolyRectSphere_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 (A^-1) for model: " |
---|
229 | Prompt qmax "Enter maximum q-value (A^-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_RECT_SC,ywave_RECT_SC |
---|
237 | xwave_RECT_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
238 | Make/O/D coef_RECT_SC = {0.1,60,0.1,1e-6,6.3e-6,10,0,298,78,0.0001} |
---|
239 | make/o/t parameters_RECT_SC = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
240 | Edit/K=1 parameters_RECT_SC,coef_RECT_SC |
---|
241 | |
---|
242 | Variable/G root:g_RECT_SC |
---|
243 | g_RECT_SC := PolyRectSphere_SC(coef_RECT_SC,ywave_RECT_SC,xwave_RECT_SC) |
---|
244 | Display/K=1 ywave_RECT_SC vs xwave_RECT_SC |
---|
245 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
246 | Label bottom "q (A\\S-1\\M)" |
---|
247 | Label left "Intensity (cm\\S-1\\M)" |
---|
248 | |
---|
249 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
250 | |
---|
251 | AddModelToStrings("PolyRectSphere_SC","coef_RECT_SC","parameters_RECT_SC","RECT_SC") |
---|
252 | End |
---|
253 | |
---|
254 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
255 | Proc PlotSmearedPolyRectSphere_SC(str) |
---|
256 | String str |
---|
257 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
258 | |
---|
259 | // if any of the resolution waves are missing => abort |
---|
260 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
261 | Abort |
---|
262 | endif |
---|
263 | |
---|
264 | SetDataFolder $("root:"+str) |
---|
265 | |
---|
266 | if(!DataFolderExists(":HayPenMSA")) |
---|
267 | NewDataFolder :HayPenMSA |
---|
268 | endif |
---|
269 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
270 | |
---|
271 | // Setup parameter table for model function |
---|
272 | Make/O/D smear_coef_RECT_SC = {0.1,60,0.1,1e-6,6.3e-6,10,0,298,78,0.0001} |
---|
273 | make/o/t smear_parameters_RECT_SC = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","charge","Monovalent salt (M)","Temperature (K)","dielectric const.","bkg (cm-1)"} |
---|
274 | Edit smear_parameters_RECT_SC,smear_coef_RECT_SC |
---|
275 | |
---|
276 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
277 | // make extra copy of experimental q-values for easy plotting |
---|
278 | Duplicate/O $(str+"_q") smeared_RECT_SC,smeared_qvals |
---|
279 | SetScale d,0,0,"1/cm",smeared_RECT_SC |
---|
280 | |
---|
281 | Variable/G gs_RECT_SC=0 |
---|
282 | gs_RECT_SC := fSmearedPolyRectSphere_SC(smear_coef_RECT_SC,smeared_RECT_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
283 | |
---|
284 | Display smeared_RECT_SC vs smeared_qvals |
---|
285 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
286 | Label bottom "q (A\\S-1\\M)" |
---|
287 | Label left "Intensity (cm\\S-1\\M)" |
---|
288 | |
---|
289 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
290 | |
---|
291 | SetDataFolder root: |
---|
292 | AddModelToStrings("SmearedPolyRectSphere_SC","smear_coef_RECT_SC","smear_parameters_RECT_SC","RECT_SC") |
---|
293 | End |
---|
294 | |
---|
295 | |
---|
296 | Function PolyRectSphere_SC(w,yw,xw) : FitFunc |
---|
297 | Wave w,yw,xw |
---|
298 | |
---|
299 | Variable inten |
---|
300 | |
---|
301 | //setup form factor coefficient wave |
---|
302 | Make/O/D/N=6 form_RECT_SC |
---|
303 | form_RECT_SC[0] = 1 |
---|
304 | form_RECT_SC[1] = w[1] |
---|
305 | form_RECT_SC[2] = w[2] |
---|
306 | form_RECT_SC[3] = w[3] |
---|
307 | form_RECT_SC[4] = w[4] |
---|
308 | form_RECT_SC[5] = 0 |
---|
309 | |
---|
310 | //calculate the diameter of the effective one-component sphere |
---|
311 | Variable pd,diam,zz,Vpoly,Ravg |
---|
312 | pd = w[2] |
---|
313 | zz = (1/pd)^2 - 1 |
---|
314 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
315 | |
---|
316 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
317 | diam = (6*Vpoly/pi)^(1/3) |
---|
318 | |
---|
319 | //setup structure factor coefficient wave |
---|
320 | Make/O/D/N=6 struct_RECT_SC |
---|
321 | struct_RECT_SC[0] = diam |
---|
322 | struct_RECT_SC[1] = w[5] |
---|
323 | struct_RECT_SC[2] = w[0] |
---|
324 | struct_RECT_SC[3] = w[7] |
---|
325 | struct_RECT_SC[4] = w[6] |
---|
326 | struct_RECT_SC[5] = w[8] |
---|
327 | |
---|
328 | //calculate each and combine |
---|
329 | Duplicate/O xw temp_RECT_SC_PQ,temp_RECT_SC_SQ //make waves for the AAO |
---|
330 | PolyRectSpheres(form_RECT_SC,temp_RECT_SC_PQ,xw) |
---|
331 | HayterPenfoldMSA(struct_RECT_SC,temp_RECT_SC_SQ,xw) |
---|
332 | yw = temp_RECT_SC_PQ * temp_RECT_SC_SQ |
---|
333 | yw *= w[0] |
---|
334 | yw += w[9] |
---|
335 | |
---|
336 | //cleanup waves |
---|
337 | // Killwaves/Z form_RECT_SC,struct_RECT_SC |
---|
338 | |
---|
339 | return (0) |
---|
340 | End |
---|
341 | |
---|
342 | ///////////////////////////////////////// |
---|
343 | Proc PlotPolyRectSphere_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 (A^-1) for model: " |
---|
347 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
348 | |
---|
349 | Make/O/D/n=(num) xwave_RECT_SHS,ywave_RECT_SHS |
---|
350 | xwave_RECT_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
351 | Make/O/D coef_RECT_SHS = {0.1,60,0.1,1e-6,6.3e-6,0.05,0.2,0.0001} |
---|
352 | make/o/t parameters_RECT_SHS = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
353 | Edit/K=1 parameters_RECT_SHS,coef_RECT_SHS |
---|
354 | |
---|
355 | Variable/G root:g_RECT_SHS |
---|
356 | g_RECT_SHS := PolyRectSphere_SHS(coef_RECT_SHS,ywave_RECT_SHS,xwave_RECT_SHS) |
---|
357 | Display/K=1 ywave_RECT_SHS vs xwave_RECT_SHS |
---|
358 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
359 | Label bottom "q (A\\S-1\\M)" |
---|
360 | Label left "Intensity (cm\\S-1\\M)" |
---|
361 | |
---|
362 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
363 | |
---|
364 | AddModelToStrings("PolyRectSphere_SHS","coef_RECT_SHS","parameters_RECT_SHS","RECT_SHS") |
---|
365 | End |
---|
366 | |
---|
367 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
368 | Proc PlotSmearedPolyRectSphere_SHS(str) |
---|
369 | String str |
---|
370 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
371 | |
---|
372 | // if any of the resolution waves are missing => abort |
---|
373 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
374 | Abort |
---|
375 | endif |
---|
376 | |
---|
377 | SetDataFolder $("root:"+str) |
---|
378 | |
---|
379 | // Setup parameter table for model function |
---|
380 | Make/O/D smear_coef_RECT_SHS = {0.1,60,0.1,1e-6,6.3e-6,0.05,0.2,0.0001} |
---|
381 | make/o/t smear_parameters_RECT_SHS = {"volume fraction","avg radius(A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
382 | Edit smear_parameters_RECT_SHS,smear_coef_RECT_SHS |
---|
383 | |
---|
384 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
385 | // make extra copy of experimental q-values for easy plotting |
---|
386 | Duplicate/O $(str+"_q") smeared_RECT_SHS,smeared_qvals |
---|
387 | SetScale d,0,0,"1/cm",smeared_RECT_SHS |
---|
388 | |
---|
389 | Variable/G gs_RECT_SHS=0 |
---|
390 | gs_RECT_SHS := fSmearedPolyRectSphere_SHS(smear_coef_RECT_SHS,smeared_RECT_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
391 | |
---|
392 | Display smeared_RECT_SHS vs smeared_qvals |
---|
393 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
394 | Label bottom "q (A\\S-1\\M)" |
---|
395 | Label left "Intensity (cm\\S-1\\M)" |
---|
396 | |
---|
397 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
398 | |
---|
399 | SetDataFolder root: |
---|
400 | AddModelToStrings("SmearedPolyRectSphere_SHS","smear_coef_RECT_SHS","smear_parameters_RECT_SHS","RECT_SHS") |
---|
401 | End |
---|
402 | |
---|
403 | |
---|
404 | Function PolyRectSphere_SHS(w,yw,xw) : FitFunc |
---|
405 | Wave w,yw,xw |
---|
406 | |
---|
407 | Variable inten |
---|
408 | |
---|
409 | //setup form factor coefficient wave |
---|
410 | Make/O/D/N=6 form_RECT_SHS |
---|
411 | form_RECT_SHS[0] = 1 |
---|
412 | form_RECT_SHS[1] = w[1] |
---|
413 | form_RECT_SHS[2] = w[2] |
---|
414 | form_RECT_SHS[3] = w[3] |
---|
415 | form_RECT_SHS[4] = w[4] |
---|
416 | form_RECT_SHS[5] = 0 |
---|
417 | |
---|
418 | //calculate the diameter of the effective one-component sphere |
---|
419 | Variable pd,diam,zz,Vpoly,Ravg |
---|
420 | pd = w[2] |
---|
421 | zz = (1/pd)^2 - 1 |
---|
422 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
423 | |
---|
424 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
425 | diam = (6*Vpoly/pi)^(1/3) |
---|
426 | |
---|
427 | //setup structure factor coefficient wave |
---|
428 | Make/O/D/N=4 struct_RECT_SHS |
---|
429 | struct_RECT_SHS[0] = diam/2 |
---|
430 | struct_RECT_SHS[1] = w[0] |
---|
431 | struct_RECT_SHS[2] = w[5] |
---|
432 | struct_RECT_SHS[3] = w[6] |
---|
433 | |
---|
434 | //calculate each and combine |
---|
435 | Duplicate/O xw temp_RECT_SHS_PQ,temp_RECT_SHS_SQ //make waves for the AAO |
---|
436 | PolyRectSpheres(form_RECT_SHS,temp_RECT_SHS_PQ,xw) |
---|
437 | StickyHS_Struct(struct_RECT_SHS,temp_RECT_SHS_SQ,xw) |
---|
438 | yw = temp_RECT_SHS_PQ * temp_RECT_SHS_SQ |
---|
439 | yw *= w[0] |
---|
440 | yw += w[7] |
---|
441 | |
---|
442 | //cleanup waves |
---|
443 | // Killwaves/Z form_RECT_SHS,struct_RECT_SHS |
---|
444 | |
---|
445 | return (0) |
---|
446 | End |
---|
447 | |
---|
448 | //two yukawa |
---|
449 | Proc PlotPolyRectSphere_2Y(num,qmin,qmax) |
---|
450 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
451 | Prompt num "Enter number of data points for model: " |
---|
452 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
453 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
454 | |
---|
455 | Make/O/D/n=(num) xwave_RECT_2Y,ywave_RECT_2Y |
---|
456 | xwave_RECT_2Y = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
457 | Make/O/D coef_RECT_2Y = {0.1,60,0.1,1e-6,6.3e-6,6,10,-1,2,0.0001} |
---|
458 | make/o/t parameters_RECT_2Y = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","scale, K1","charge, Z1","scale, K2","charge, Z2","bkg (cm-1)"} |
---|
459 | Edit/K=1 parameters_RECT_2Y,coef_RECT_2Y |
---|
460 | |
---|
461 | Variable/G root:g_RECT_2Y |
---|
462 | g_RECT_2Y := PolyRectSphere_2Y(coef_RECT_2Y,ywave_RECT_2Y,xwave_RECT_2Y) |
---|
463 | Display/K=1 ywave_RECT_2Y vs xwave_RECT_2Y |
---|
464 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
465 | Label bottom "q (A\\S-1\\M)" |
---|
466 | Label left "Intensity (cm\\S-1\\M)" |
---|
467 | |
---|
468 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
469 | |
---|
470 | AddModelToStrings("PolyRectSphere_2Y","coef_RECT_2Y","parameters_RECT_2Y","RECT_2Y") |
---|
471 | End |
---|
472 | |
---|
473 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
474 | Proc PlotSmearedPolyRectSphere_2Y(str) |
---|
475 | String str |
---|
476 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
477 | |
---|
478 | // if any of the resolution waves are missing => abort |
---|
479 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
480 | Abort |
---|
481 | endif |
---|
482 | |
---|
483 | SetDataFolder $("root:"+str) |
---|
484 | |
---|
485 | // Setup parameter table for model function |
---|
486 | Make/O/D smear_coef_RECT_2Y = {0.1,60,0.1,1e-6,6.3e-6,6,10,-1,2,0.0001} |
---|
487 | make/o/t smear_parameters_RECT_2Y = {"volume fraction","avg radius (A)","polydispersity","SLD sphere (A^-2)","SLD solvent (A^-2)","scale, K1","charge, Z1","scale, K2","charge, Z2","bkg (cm-1)"} |
---|
488 | Edit smear_parameters_RECT_2Y,smear_coef_RECT_2Y |
---|
489 | |
---|
490 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
491 | // make extra copy of experimental q-values for easy plotting |
---|
492 | Duplicate/O $(str+"_q") smeared_RECT_2Y,smeared_qvals |
---|
493 | SetScale d,0,0,"1/cm",smeared_RECT_2Y |
---|
494 | |
---|
495 | Variable/G gs_RECT_2Y=0 |
---|
496 | gs_RECT_2Y := fSmearedPolyRectSphere_2Y(smear_coef_RECT_2Y,smeared_RECT_2Y,smeared_qvals) //this wrapper fills the STRUCT |
---|
497 | |
---|
498 | Display smeared_RECT_2Y vs smeared_qvals |
---|
499 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
500 | Label bottom "q (A\\S-1\\M)" |
---|
501 | Label left "Intensity (cm\\S-1\\M)" |
---|
502 | |
---|
503 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
504 | |
---|
505 | SetDataFolder root: |
---|
506 | AddModelToStrings("SmearedPolyRectSphere_2Y","smear_coef_RECT_2Y","smear_parameters_RECT_2Y","RECT_2Y") |
---|
507 | End |
---|
508 | |
---|
509 | |
---|
510 | Function PolyRectSphere_2Y(w,yw,xw) : FitFunc |
---|
511 | Wave w,yw,xw |
---|
512 | |
---|
513 | Variable inten |
---|
514 | |
---|
515 | //setup form factor coefficient wave |
---|
516 | Make/O/D/N=6 form_RECT_2Y |
---|
517 | form_RECT_2Y[0] = 1 |
---|
518 | form_RECT_2Y[1] = w[1] |
---|
519 | form_RECT_2Y[2] = w[2] |
---|
520 | form_RECT_2Y[3] = w[3] |
---|
521 | form_RECT_2Y[4] = w[4] |
---|
522 | form_RECT_2Y[5] = 0 |
---|
523 | |
---|
524 | //calculate the diameter of the effective one-component sphere |
---|
525 | Variable pd,diam,zz,Vpoly,Ravg |
---|
526 | pd = w[2] |
---|
527 | zz = (1/pd)^2 - 1 |
---|
528 | Ravg = w[1] // <R^3> = Ravg^3*(1+3*pd^2) |
---|
529 | |
---|
530 | Vpoly = 4*pi/3*Ravg^3*(1+3*pd^2) |
---|
531 | diam = (6*Vpoly/pi)^(1/3) |
---|
532 | |
---|
533 | //setup structure factor coefficient wave |
---|
534 | Make/O/D/N=6 struct_RECT_2Y |
---|
535 | struct_RECT_2Y[0] = w[0] |
---|
536 | struct_RECT_2Y[1] = diam/2 |
---|
537 | struct_RECT_2Y[2] = w[5] |
---|
538 | struct_RECT_2Y[3] = w[6] |
---|
539 | struct_RECT_2Y[4] = w[7] |
---|
540 | struct_RECT_2Y[5] = w[8] |
---|
541 | |
---|
542 | //calculate each and combine |
---|
543 | Duplicate/O xw temp_RECT_2Y_PQ,temp_RECT_2Y_SQ //make waves for the AAO |
---|
544 | PolyRectSpheres(form_RECT_2Y,temp_RECT_2Y_PQ,xw) |
---|
545 | TwoYukawa(struct_RECT_2Y,temp_RECT_2Y_SQ,xw) |
---|
546 | yw = temp_RECT_2Y_PQ * temp_RECT_2Y_SQ |
---|
547 | yw *= w[0] |
---|
548 | yw += w[9] |
---|
549 | |
---|
550 | //cleanup waves |
---|
551 | // Killwaves/Z form_RECT_2Y,struct_RECT_2Y |
---|
552 | |
---|
553 | return (0) |
---|
554 | End |
---|
555 | |
---|
556 | |
---|
557 | // this is all there is to the smeared calculation! |
---|
558 | Function SmearedPolyRectSphere_HS(s) :FitFunc |
---|
559 | Struct ResSmearAAOStruct &s |
---|
560 | |
---|
561 | // the name of your unsmeared model is the first argument |
---|
562 | Smear_Model_20(PolyRectSphere_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
563 | |
---|
564 | return(0) |
---|
565 | End |
---|
566 | |
---|
567 | // this is all there is to the smeared calculation! |
---|
568 | Function SmearedPolyRectSphere_SW(s) :FitFunc |
---|
569 | Struct ResSmearAAOStruct &s |
---|
570 | |
---|
571 | // the name of your unsmeared model is the first argument |
---|
572 | Smear_Model_20(PolyRectSphere_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
573 | |
---|
574 | return(0) |
---|
575 | End |
---|
576 | |
---|
577 | // this is all there is to the smeared calculation! |
---|
578 | Function SmearedPolyRectSphere_SC(s) :FitFunc |
---|
579 | Struct ResSmearAAOStruct &s |
---|
580 | |
---|
581 | // the name of your unsmeared model is the first argument |
---|
582 | Smear_Model_20(PolyRectSphere_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
583 | |
---|
584 | return(0) |
---|
585 | End |
---|
586 | |
---|
587 | // this is all there is to the smeared calculation! |
---|
588 | Function SmearedPolyRectSphere_SHS(s) :FitFunc |
---|
589 | Struct ResSmearAAOStruct &s |
---|
590 | |
---|
591 | // the name of your unsmeared model is the first argument |
---|
592 | Smear_Model_20(PolyRectSphere_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
593 | |
---|
594 | return(0) |
---|
595 | End |
---|
596 | |
---|
597 | // this is all there is to the smeared calculation! |
---|
598 | Function SmearedPolyRectSphere_2Y(s) :FitFunc |
---|
599 | Struct ResSmearAAOStruct &s |
---|
600 | |
---|
601 | // the name of your unsmeared model is the first argument |
---|
602 | Smear_Model_20(PolyRectSphere_2Y,s.coefW,s.xW,s.yW,s.resW) |
---|
603 | |
---|
604 | return(0) |
---|
605 | End |
---|
606 | |
---|
607 | |
---|
608 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
609 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
610 | // |
---|
611 | // used only for the dependency, not for fitting |
---|
612 | // |
---|
613 | Function fSmearedPolyRectSphere_HS(coefW,yW,xW) |
---|
614 | Wave coefW,yW,xW |
---|
615 | |
---|
616 | String str = getWavesDataFolder(yW,0) |
---|
617 | String DF="root:"+str+":" |
---|
618 | |
---|
619 | WAVE resW = $(DF+str+"_res") |
---|
620 | |
---|
621 | STRUCT ResSmearAAOStruct fs |
---|
622 | WAVE fs.coefW = coefW |
---|
623 | WAVE fs.yW = yW |
---|
624 | WAVE fs.xW = xW |
---|
625 | WAVE fs.resW = resW |
---|
626 | |
---|
627 | Variable err |
---|
628 | err = SmearedPolyRectSphere_HS(fs) |
---|
629 | |
---|
630 | return (0) |
---|
631 | End |
---|
632 | |
---|
633 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
634 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
635 | // |
---|
636 | // used only for the dependency, not for fitting |
---|
637 | // |
---|
638 | Function fSmearedPolyRectSphere_SW(coefW,yW,xW) |
---|
639 | Wave coefW,yW,xW |
---|
640 | |
---|
641 | String str = getWavesDataFolder(yW,0) |
---|
642 | String DF="root:"+str+":" |
---|
643 | |
---|
644 | WAVE resW = $(DF+str+"_res") |
---|
645 | |
---|
646 | STRUCT ResSmearAAOStruct fs |
---|
647 | WAVE fs.coefW = coefW |
---|
648 | WAVE fs.yW = yW |
---|
649 | WAVE fs.xW = xW |
---|
650 | WAVE fs.resW = resW |
---|
651 | |
---|
652 | Variable err |
---|
653 | err = SmearedPolyRectSphere_SW(fs) |
---|
654 | |
---|
655 | return (0) |
---|
656 | End |
---|
657 | |
---|
658 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
659 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
660 | // |
---|
661 | // used only for the dependency, not for fitting |
---|
662 | // |
---|
663 | Function fSmearedPolyRectSphere_SC(coefW,yW,xW) |
---|
664 | Wave coefW,yW,xW |
---|
665 | |
---|
666 | String str = getWavesDataFolder(yW,0) |
---|
667 | String DF="root:"+str+":" |
---|
668 | |
---|
669 | WAVE resW = $(DF+str+"_res") |
---|
670 | |
---|
671 | STRUCT ResSmearAAOStruct fs |
---|
672 | WAVE fs.coefW = coefW |
---|
673 | WAVE fs.yW = yW |
---|
674 | WAVE fs.xW = xW |
---|
675 | WAVE fs.resW = resW |
---|
676 | |
---|
677 | Variable err |
---|
678 | err = SmearedPolyRectSphere_SC(fs) |
---|
679 | |
---|
680 | return (0) |
---|
681 | End |
---|
682 | |
---|
683 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
684 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
685 | // |
---|
686 | // used only for the dependency, not for fitting |
---|
687 | // |
---|
688 | Function fSmearedPolyRectSphere_SHS(coefW,yW,xW) |
---|
689 | Wave coefW,yW,xW |
---|
690 | |
---|
691 | String str = getWavesDataFolder(yW,0) |
---|
692 | String DF="root:"+str+":" |
---|
693 | |
---|
694 | WAVE resW = $(DF+str+"_res") |
---|
695 | |
---|
696 | STRUCT ResSmearAAOStruct fs |
---|
697 | WAVE fs.coefW = coefW |
---|
698 | WAVE fs.yW = yW |
---|
699 | WAVE fs.xW = xW |
---|
700 | WAVE fs.resW = resW |
---|
701 | |
---|
702 | Variable err |
---|
703 | err = SmearedPolyRectSphere_SHS(fs) |
---|
704 | |
---|
705 | return (0) |
---|
706 | End |
---|
707 | |
---|
708 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
709 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
710 | // |
---|
711 | // used only for the dependency, not for fitting |
---|
712 | // |
---|
713 | Function fSmearedPolyRectSphere_2Y(coefW,yW,xW) |
---|
714 | Wave coefW,yW,xW |
---|
715 | |
---|
716 | String str = getWavesDataFolder(yW,0) |
---|
717 | String DF="root:"+str+":" |
---|
718 | |
---|
719 | WAVE resW = $(DF+str+"_res") |
---|
720 | |
---|
721 | STRUCT ResSmearAAOStruct fs |
---|
722 | WAVE fs.coefW = coefW |
---|
723 | WAVE fs.yW = yW |
---|
724 | WAVE fs.xW = xW |
---|
725 | WAVE fs.resW = resW |
---|
726 | |
---|
727 | Variable err |
---|
728 | err = SmearedPolyRectSphere_2Y(fs) |
---|
729 | |
---|
730 | return (0) |
---|
731 | End |
---|