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 | #include "ProlateCoreShell_v40" |
---|
6 | #include "EffectiveDiameter_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 PlotProlate_HS(num,qmin,qmax) |
---|
15 | Variable num=128,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_PEF_HS,ywave_PEF_HS |
---|
21 | xwave_PEF_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
22 | Make/O/D coef_PEF_HS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.0001} |
---|
23 | make/o/t parameters_PEF_HS = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","bkg (cm-1)"} |
---|
24 | Edit parameters_PEF_HS,coef_PEF_HS |
---|
25 | |
---|
26 | Variable/G root:g_PEF_HS |
---|
27 | g_PEF_HS := Prolate_HS(coef_PEF_HS,ywave_PEF_HS,xwave_PEF_HS) |
---|
28 | Display ywave_PEF_HS vs xwave_PEF_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("Prolate_HS","coef_PEF_HS","parameters_PEF_HS","PEF_HS") |
---|
36 | End |
---|
37 | |
---|
38 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
39 | Proc PlotSmearedProlate_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_PEF_HS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.0001} |
---|
52 | make/o/t smear_parameters_PEF_HS = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","bkg (cm-1)"} |
---|
53 | Edit smear_parameters_PEF_HS,smear_coef_PEF_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_PEF_HS,smeared_qvals |
---|
58 | SetScale d,0,0,"1/cm",smeared_PEF_HS |
---|
59 | |
---|
60 | Variable/G gs_PEF_HS=0 |
---|
61 | gs_PEF_HS := fSmearedProlate_HS(smear_coef_PEF_HS,smeared_PEF_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
62 | |
---|
63 | Display smeared_PEF_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("SmearedProlate_HS","smear_coef_PEF_HS","smear_parameters_PEF_HS","PEF_HS") |
---|
72 | End |
---|
73 | |
---|
74 | |
---|
75 | Function Prolate_HS(w,yw,xw) : FitFunc |
---|
76 | Wave w,yw,xw |
---|
77 | |
---|
78 | Variable inten,Ras,Rbs |
---|
79 | Ras = w[3] //Ras is the rotation axis |
---|
80 | Rbs = w[4] |
---|
81 | |
---|
82 | //setup form factor coefficient wave |
---|
83 | Make/O/D/N=9 form_PEF_HS |
---|
84 | form_PEF_HS[0] = 1 |
---|
85 | form_PEF_HS[1] = w[1] |
---|
86 | form_PEF_HS[2] = w[2] |
---|
87 | form_PEF_HS[3] = w[3] |
---|
88 | form_PEF_HS[4] = w[4] |
---|
89 | form_PEF_HS[5] = w[5] |
---|
90 | form_PEF_HS[6] = w[6] |
---|
91 | form_PEF_HS[7] = w[7] |
---|
92 | form_PEF_HS[8] = 0 |
---|
93 | |
---|
94 | //setup structure factor coefficient wave |
---|
95 | Make/O/D/N=2 struct_PEF_HS |
---|
96 | struct_PEF_HS[0] = 0.5*DiamEllip(Ras,Rbs) |
---|
97 | struct_PEF_HS[1] = w[0] |
---|
98 | |
---|
99 | //calculate each and combine |
---|
100 | Duplicate/O xw temp_PEF_HS_PQ,temp_PEF_HS_SQ //make waves for the AAO |
---|
101 | ProlateForm(form_PEF_HS,temp_PEF_HS_PQ,xw) |
---|
102 | HardSphereStruct(struct_PEF_HS,temp_PEF_HS_SQ,xw) |
---|
103 | yw = temp_PEF_HS_PQ *temp_PEF_HS_SQ |
---|
104 | yw *= w[0] |
---|
105 | yw += w[8] |
---|
106 | |
---|
107 | //cleanup waves |
---|
108 | // Killwaves/Z form_PEF_HS,struct_PEF_HS |
---|
109 | |
---|
110 | return (0) |
---|
111 | End |
---|
112 | |
---|
113 | Proc PlotProlate_SW(num,qmin,qmax) |
---|
114 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
115 | Prompt num "Enter number of data points for model: " |
---|
116 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
117 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
118 | |
---|
119 | Make/O/D/n=(num) xwave_PEF_SW,ywave_PEF_SW |
---|
120 | xwave_PEF_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
121 | Make/O/D coef_PEF_SW = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,1.0,1.2,0.0001} |
---|
122 | make/o/t parameters_PEF_SW = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
123 | Edit parameters_PEF_SW,coef_PEF_SW |
---|
124 | |
---|
125 | Variable/G root:g_PEF_SW |
---|
126 | g_PEF_SW := Prolate_SW(coef_PEF_SW,ywave_PEF_SW,xwave_PEF_SW) |
---|
127 | Display ywave_PEF_SW vs xwave_PEF_SW |
---|
128 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
129 | Label bottom "q (A\\S-1\\M)" |
---|
130 | Label left "Intensity (cm\\S-1\\M)" |
---|
131 | |
---|
132 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
133 | |
---|
134 | AddModelToStrings("Prolate_SW","coef_PEF_SW","parameters_PEF_SW","PEF_SW") |
---|
135 | End |
---|
136 | |
---|
137 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
138 | Proc PlotSmearedProlate_SW(str) |
---|
139 | String str |
---|
140 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
141 | |
---|
142 | // if any of the resolution waves are missing => abort |
---|
143 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
144 | Abort |
---|
145 | endif |
---|
146 | |
---|
147 | SetDataFolder $("root:"+str) |
---|
148 | |
---|
149 | // Setup parameter table for model function |
---|
150 | Make/O/D smear_coef_PEF_SW = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,1.0,1.2,0.0001} |
---|
151 | make/o/t smear_parameters_PEF_SW = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1)"} |
---|
152 | Edit smear_parameters_PEF_SW,smear_coef_PEF_SW |
---|
153 | |
---|
154 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
155 | // make extra copy of experimental q-values for easy plotting |
---|
156 | Duplicate/O $(str+"_q") smeared_PEF_SW,smeared_qvals |
---|
157 | SetScale d,0,0,"1/cm",smeared_PEF_SW |
---|
158 | |
---|
159 | Variable/G gs_PEF_SW=0 |
---|
160 | gs_PEF_SW := fSmearedProlate_SW(smear_coef_PEF_SW,smeared_PEF_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
161 | |
---|
162 | Display smeared_PEF_SW vs smeared_qvals |
---|
163 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
164 | Label bottom "q (A\\S-1\\M)" |
---|
165 | Label left "Intensity (cm\\S-1\\M)" |
---|
166 | |
---|
167 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
168 | |
---|
169 | SetDataFolder root: |
---|
170 | AddModelToStrings("SmearedProlate_SW","smear_coef_PEF_SW","smear_parameters_PEF_SW","PEF_SW") |
---|
171 | End |
---|
172 | |
---|
173 | |
---|
174 | Function Prolate_SW(w,yw,xw) : FitFunc |
---|
175 | Wave w,yw,xw |
---|
176 | |
---|
177 | Variable inten,Ras,Rbs |
---|
178 | Ras = w[3] //Ras is the rotation axis |
---|
179 | Rbs = w[4] |
---|
180 | |
---|
181 | //setup form factor coefficient wave |
---|
182 | Make/O/D/N=9 form_PEF_SW |
---|
183 | form_PEF_SW[0] = 1 |
---|
184 | form_PEF_SW[1] = w[1] |
---|
185 | form_PEF_SW[2] = w[2] |
---|
186 | form_PEF_SW[3] = w[3] |
---|
187 | form_PEF_SW[4] = w[4] |
---|
188 | form_PEF_SW[5] = w[5] |
---|
189 | form_PEF_SW[6] = w[6] |
---|
190 | form_PEF_SW[7] = w[7] |
---|
191 | form_PEF_SW[8] = 0 |
---|
192 | |
---|
193 | //setup structure factor coefficient wave |
---|
194 | Make/O/D/N=4 struct_PEF_SW |
---|
195 | struct_PEF_SW[0] = 0.5*DiamEllip(Ras,Rbs) |
---|
196 | struct_PEF_SW[1] = w[0] |
---|
197 | struct_PEF_SW[2] = w[8] |
---|
198 | struct_PEF_SW[3] = w[9] |
---|
199 | |
---|
200 | //calculate each and combine |
---|
201 | Duplicate/O xw temp_PEF_SW_PQ,temp_PEF_SW_SQ //make waves for the AAO |
---|
202 | ProlateForm(form_PEF_SW,temp_PEF_SW_PQ,xw) |
---|
203 | SquareWellStruct(struct_PEF_SW,temp_PEF_SW_SQ,xw) |
---|
204 | yw = temp_PEF_SW_PQ * temp_PEF_SW_SQ |
---|
205 | yw *= w[0] |
---|
206 | yw += w[10] |
---|
207 | |
---|
208 | //cleanup waves |
---|
209 | // Killwaves/Z form_PEF_SW,struct_PEF_SW |
---|
210 | |
---|
211 | return (0) |
---|
212 | End |
---|
213 | |
---|
214 | Proc PlotProlate_SC(num,qmin,qmax) |
---|
215 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
216 | Prompt num "Enter number of data points for model: " |
---|
217 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
218 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
219 | |
---|
220 | if(!DataFolderExists(":HayPenMSA")) |
---|
221 | NewDataFolder :HayPenMSA |
---|
222 | endif |
---|
223 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
224 | |
---|
225 | Make/O/D/n=(num) xwave_PEF_SC,ywave_PEF_SC |
---|
226 | xwave_PEF_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
227 | Make/O/D coef_PEF_SC = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,20,0,298,78,0.0001} |
---|
228 | make/o/t parameters_PEF_SC = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1)"} |
---|
229 | Edit parameters_PEF_SC,coef_PEF_SC |
---|
230 | |
---|
231 | Variable/G root:g_PEF_SC |
---|
232 | g_PEF_SC := Prolate_SC(coef_PEF_SC,ywave_PEF_SC,xwave_PEF_SC) |
---|
233 | Display ywave_PEF_SC vs xwave_PEF_SC |
---|
234 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
235 | Label bottom "q (A\\S-1\\M)" |
---|
236 | Label left "Intensity (cm\\S-1\\M)" |
---|
237 | |
---|
238 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
239 | |
---|
240 | AddModelToStrings("Prolate_SC","coef_PEF_SC","parameters_PEF_SC","PEF_SC") |
---|
241 | End |
---|
242 | |
---|
243 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
244 | Proc PlotSmearedProlate_SC(str) |
---|
245 | String str |
---|
246 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
247 | |
---|
248 | // if any of the resolution waves are missing => abort |
---|
249 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
250 | Abort |
---|
251 | endif |
---|
252 | |
---|
253 | SetDataFolder $("root:"+str) |
---|
254 | |
---|
255 | if(!DataFolderExists(":HayPenMSA")) |
---|
256 | NewDataFolder :HayPenMSA |
---|
257 | endif |
---|
258 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
259 | |
---|
260 | // Setup parameter table for model function |
---|
261 | Make/O/D smear_coef_PEF_SC = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,20,0,298,78,0.0001} |
---|
262 | make/o/t smear_parameters_PEF_SC = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1)"} |
---|
263 | Edit smear_parameters_PEF_SC,smear_coef_PEF_SC |
---|
264 | |
---|
265 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
266 | // make extra copy of experimental q-values for easy plotting |
---|
267 | Duplicate/O $(str+"_q") smeared_PEF_SC,smeared_qvals |
---|
268 | SetScale d,0,0,"1/cm",smeared_PEF_SC |
---|
269 | |
---|
270 | Variable/G gs_PEF_SC=0 |
---|
271 | gs_PEF_SC := fSmearedProlate_SC(smear_coef_PEF_SC,smeared_PEF_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
272 | |
---|
273 | Display smeared_PEF_SC vs smeared_qvals |
---|
274 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
275 | Label bottom "q (A\\S-1\\M)" |
---|
276 | Label left "Intensity (cm\\S-1\\M)" |
---|
277 | |
---|
278 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
279 | |
---|
280 | SetDataFolder root: |
---|
281 | AddModelToStrings("SmearedProlate_SC","smear_coef_PEF_SC","smear_parameters_PEF_SC","PEF_SC") |
---|
282 | End |
---|
283 | |
---|
284 | |
---|
285 | Function Prolate_SC(w,yw,xw) : FitFunc |
---|
286 | Wave w,yw,xw |
---|
287 | |
---|
288 | Variable inten,Ras,Rbs |
---|
289 | Ras = w[3] //Ras is the rotation axis |
---|
290 | Rbs = w[4] |
---|
291 | |
---|
292 | //setup form factor coefficient wave |
---|
293 | Make/O/D/N=9 form_PEF_SC |
---|
294 | form_PEF_SC[0] = 1 |
---|
295 | form_PEF_SC[1] = w[1] |
---|
296 | form_PEF_SC[2] = w[2] |
---|
297 | form_PEF_SC[3] = w[3] |
---|
298 | form_PEF_SC[4] = w[4] |
---|
299 | form_PEF_SC[5] = w[5] |
---|
300 | form_PEF_SC[6] = w[6] |
---|
301 | form_PEF_SC[7] = w[7] |
---|
302 | form_PEF_SC[8] = 0 |
---|
303 | |
---|
304 | //setup structure factor coefficient wave |
---|
305 | Make/O/D/N=6 struct_PEF_SC |
---|
306 | struct_PEF_SC[0] = DiamEllip(Ras,Rbs) |
---|
307 | struct_PEF_SC[1] = w[8] |
---|
308 | struct_PEF_SC[2] = w[0] |
---|
309 | struct_PEF_SC[3] = w[10] |
---|
310 | struct_PEF_SC[4] = w[9] |
---|
311 | struct_PEF_SC[5] = w[11] |
---|
312 | |
---|
313 | //calculate each and combine |
---|
314 | Duplicate/O xw temp_PEF_SC_PQ,temp_PEF_SC_SQ //make waves for the AAO |
---|
315 | ProlateForm(form_PEF_SC,temp_PEF_SC_PQ,xw) |
---|
316 | HayterPenfoldMSA(struct_PEF_SC,temp_PEF_SC_SQ,xw) |
---|
317 | yw = temp_PEF_SC_PQ * temp_PEF_SC_SQ |
---|
318 | yw *= w[0] |
---|
319 | yw += w[12] |
---|
320 | |
---|
321 | //cleanup waves |
---|
322 | // Killwaves/Z form_PEF_SC,struct_PEF_SC |
---|
323 | |
---|
324 | return (0) |
---|
325 | End |
---|
326 | |
---|
327 | |
---|
328 | Proc PlotProlate_SHS(num,qmin,qmax) |
---|
329 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
330 | Prompt num "Enter number of data points for model: " |
---|
331 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
332 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
333 | |
---|
334 | Make/O/D/n=(num) xwave_PEF_SHS,ywave_PEF_SHS |
---|
335 | xwave_PEF_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
336 | Make/O/D coef_PEF_SHS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.05,0.2,0.0001} |
---|
337 | make/o/t parameters_PEF_SHS = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
338 | Edit parameters_PEF_SHS,coef_PEF_SHS |
---|
339 | |
---|
340 | Variable/G root:g_PEF_SHS |
---|
341 | g_PEF_SHS := Prolate_SHS(coef_PEF_SHS,ywave_PEF_SHS,xwave_PEF_SHS) |
---|
342 | Display ywave_PEF_SHS vs xwave_PEF_SHS |
---|
343 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
344 | Label bottom "q (A\\S-1\\M)" |
---|
345 | Label left "Intensity (cm\\S-1\\M)" |
---|
346 | |
---|
347 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
348 | |
---|
349 | AddModelToStrings("Prolate_SHS","coef_PEF_SHS","parameters_PEF_SHS","PEF_SHS") |
---|
350 | End |
---|
351 | |
---|
352 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
353 | Proc PlotSmearedProlate_SHS(str) |
---|
354 | String str |
---|
355 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
356 | |
---|
357 | // if any of the resolution waves are missing => abort |
---|
358 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
359 | Abort |
---|
360 | endif |
---|
361 | |
---|
362 | SetDataFolder $("root:"+str) |
---|
363 | |
---|
364 | // Setup parameter table for model function |
---|
365 | Make/O/D smear_coef_PEF_SHS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.05,0.2,0.0001} |
---|
366 | make/o/t smear_parameters_PEF_SHS = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1)"} |
---|
367 | Edit smear_parameters_PEF_SHS,smear_coef_PEF_SHS |
---|
368 | |
---|
369 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
370 | // make extra copy of experimental q-values for easy plotting |
---|
371 | Duplicate/O $(str+"_q") smeared_PEF_SHS,smeared_qvals |
---|
372 | SetScale d,0,0,"1/cm",smeared_PEF_SHS |
---|
373 | |
---|
374 | Variable/G gs_PEF_SHS=0 |
---|
375 | gs_PEF_SHS := fSmearedProlate_SHS(smear_coef_PEF_SHS,smeared_PEF_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
376 | |
---|
377 | Display smeared_PEF_SHS vs smeared_qvals |
---|
378 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
379 | Label bottom "q (A\\S-1\\M)" |
---|
380 | Label left "Intensity (cm\\S-1\\M)" |
---|
381 | |
---|
382 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
383 | |
---|
384 | SetDataFolder root: |
---|
385 | AddModelToStrings("SmearedProlate_SHS","smear_coef_PEF_SHS","smear_parameters_PEF_SHS","PEF_SHS") |
---|
386 | End |
---|
387 | |
---|
388 | |
---|
389 | Function Prolate_SHS(w,yw,xw) : FitFunc |
---|
390 | Wave w,yw,xw |
---|
391 | |
---|
392 | Variable inten,Ras,Rbs |
---|
393 | Ras = w[3] //Ras is the rotation axis |
---|
394 | Rbs = w[4] |
---|
395 | |
---|
396 | //setup form factor coefficient wave |
---|
397 | Make/O/D/N=9 form_PEF_SHS |
---|
398 | form_PEF_SHS[0] = 1 |
---|
399 | form_PEF_SHS[1] = w[1] |
---|
400 | form_PEF_SHS[2] = w[2] |
---|
401 | form_PEF_SHS[3] = w[3] |
---|
402 | form_PEF_SHS[4] = w[4] |
---|
403 | form_PEF_SHS[5] = w[5] |
---|
404 | form_PEF_SHS[6] = w[6] |
---|
405 | form_PEF_SHS[7] = w[7] |
---|
406 | form_PEF_SHS[8] = 0 |
---|
407 | |
---|
408 | //setup structure factor coefficient wave |
---|
409 | Make/O/D/N=4 struct_PEF_SHS |
---|
410 | struct_PEF_SHS[0] = 0.5*DiamEllip(Ras,Rbs) |
---|
411 | struct_PEF_SHS[1] = w[0] |
---|
412 | struct_PEF_SHS[2] = w[8] |
---|
413 | struct_PEF_SHS[3] = w[9] |
---|
414 | |
---|
415 | //calculate each and combine |
---|
416 | Duplicate/O xw temp_PEF_SHS_PQ,temp_PEF_SHS_SQ //make waves for the AAO |
---|
417 | ProlateForm(form_PEF_SHS,temp_PEF_SHS_PQ,xw) |
---|
418 | StickyHS_Struct(struct_PEF_SHS,temp_PEF_SHS_SQ,xw) |
---|
419 | yw = temp_PEF_SHS_PQ * temp_PEF_SHS_SQ |
---|
420 | yw *= w[0] |
---|
421 | yw += w[10] |
---|
422 | |
---|
423 | //cleanup waves |
---|
424 | // Killwaves/Z form_PEF_SHS,struct_PEF_SHS |
---|
425 | |
---|
426 | return (0) |
---|
427 | End |
---|
428 | |
---|
429 | // two yukawa |
---|
430 | Proc PlotProlate_2Y(num,qmin,qmax) |
---|
431 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
432 | Prompt num "Enter number of data points for model: " |
---|
433 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
434 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
435 | |
---|
436 | Make/O/D/n=(num) xwave_PEF_2Y,ywave_PEF_2Y |
---|
437 | xwave_PEF_2Y = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
438 | Make/O/D coef_PEF_2Y = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,6,10,-1,2,0.0001} |
---|
439 | make/o/t parameters_PEF_2Y = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","scale, K1","charge, Z1","scale, K2","charge, Z2","bkg (cm-1)"} |
---|
440 | Edit parameters_PEF_2Y,coef_PEF_2Y |
---|
441 | |
---|
442 | Variable/G root:g_PEF_2Y |
---|
443 | g_PEF_2Y := Prolate_2Y(coef_PEF_2Y,ywave_PEF_2Y,xwave_PEF_2Y) |
---|
444 | Display ywave_PEF_2Y vs xwave_PEF_2Y |
---|
445 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
446 | Label bottom "q (A\\S-1\\M)" |
---|
447 | Label left "Intensity (cm\\S-1\\M)" |
---|
448 | |
---|
449 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
450 | |
---|
451 | AddModelToStrings("Prolate_2Y","coef_PEF_2Y","parameters_PEF_2Y","PEF_2Y") |
---|
452 | End |
---|
453 | |
---|
454 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
455 | Proc PlotSmearedProlate_2Y(str) |
---|
456 | String str |
---|
457 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
458 | |
---|
459 | // if any of the resolution waves are missing => abort |
---|
460 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
461 | Abort |
---|
462 | endif |
---|
463 | |
---|
464 | SetDataFolder $("root:"+str) |
---|
465 | |
---|
466 | // Setup parameter table for model function |
---|
467 | Make/O/D smear_coef_PEF_2Y = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,6,10,-1,2,0.0001} |
---|
468 | make/o/t smear_parameters_PEF_2Y = {"volume fraction","major core radius (A)","minor core radius (A)","major shell radius (A)","minor shell radius (A)","SLD core (A-2)","SLD shell (A-2)","SLD solvent (A-2)","scale, K1","charge, Z1","scale, K2","charge, Z2","bkg (cm-1)"} |
---|
469 | Edit smear_parameters_PEF_2Y,smear_coef_PEF_2Y |
---|
470 | |
---|
471 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
472 | // make extra copy of experimental q-values for easy plotting |
---|
473 | Duplicate/O $(str+"_q") smeared_PEF_2Y,smeared_qvals |
---|
474 | SetScale d,0,0,"1/cm",smeared_PEF_2Y |
---|
475 | |
---|
476 | Variable/G gs_PEF_2Y=0 |
---|
477 | gs_PEF_2Y := fSmearedProlate_2Y(smear_coef_PEF_2Y,smeared_PEF_2Y,smeared_qvals) //this wrapper fills the STRUCT |
---|
478 | |
---|
479 | Display smeared_PEF_2Y vs smeared_qvals |
---|
480 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
481 | Label bottom "q (A\\S-1\\M)" |
---|
482 | Label left "Intensity (cm\\S-1\\M)" |
---|
483 | |
---|
484 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
485 | |
---|
486 | SetDataFolder root: |
---|
487 | AddModelToStrings("SmearedProlate_2Y","smear_coef_PEF_2Y","smear_parameters_PEF_2Y","PEF_2Y") |
---|
488 | End |
---|
489 | |
---|
490 | |
---|
491 | Function Prolate_2Y(w,yw,xw) : FitFunc |
---|
492 | Wave w,yw,xw |
---|
493 | |
---|
494 | Variable inten,Ras,Rbs |
---|
495 | Ras = w[3] //Ras is the rotation axis |
---|
496 | Rbs = w[4] |
---|
497 | |
---|
498 | //setup form factor coefficient wave |
---|
499 | Make/O/D/N=9 form_PEF_2Y |
---|
500 | form_PEF_2Y[0] = 1 |
---|
501 | form_PEF_2Y[1] = w[1] |
---|
502 | form_PEF_2Y[2] = w[2] |
---|
503 | form_PEF_2Y[3] = w[3] |
---|
504 | form_PEF_2Y[4] = w[4] |
---|
505 | form_PEF_2Y[5] = w[5] |
---|
506 | form_PEF_2Y[6] = w[6] |
---|
507 | form_PEF_2Y[7] = w[7] |
---|
508 | form_PEF_2Y[8] = 0 |
---|
509 | |
---|
510 | //setup structure factor coefficient wave |
---|
511 | Make/O/D/N=6 struct_PEF_2Y |
---|
512 | struct_PEF_2Y[0] = w[0] |
---|
513 | struct_PEF_2Y[1] = 0.5*DiamEllip(Ras,Rbs) |
---|
514 | struct_PEF_2Y[2] = w[8] |
---|
515 | struct_PEF_2Y[3] = w[9] |
---|
516 | struct_PEF_2Y[4] = w[10] |
---|
517 | struct_PEF_2Y[5] = w[11] |
---|
518 | |
---|
519 | //calculate each and combine |
---|
520 | Duplicate/O xw temp_PEF_2Y_PQ,temp_PEF_2Y_SQ //make waves for the AAO |
---|
521 | ProlateForm(form_PEF_2Y,temp_PEF_2Y_PQ,xw) |
---|
522 | TwoYukawa(struct_PEF_2Y,temp_PEF_2Y_SQ,xw) |
---|
523 | yw = temp_PEF_2Y_PQ *temp_PEF_2Y_SQ |
---|
524 | yw *= w[0] |
---|
525 | yw += w[12] |
---|
526 | |
---|
527 | //cleanup waves |
---|
528 | // Killwaves/Z form_PEF_2Y,struct_PEF_2Y |
---|
529 | |
---|
530 | return (0) |
---|
531 | End |
---|
532 | |
---|
533 | // this is all there is to the smeared calculation! |
---|
534 | Function SmearedProlate_HS(s) :FitFunc |
---|
535 | Struct ResSmearAAOStruct &s |
---|
536 | |
---|
537 | // the name of your unsmeared model is the first argument |
---|
538 | Smear_Model_20(Prolate_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
539 | |
---|
540 | return(0) |
---|
541 | End |
---|
542 | |
---|
543 | // this is all there is to the smeared calculation! |
---|
544 | Function SmearedProlate_SW(s) :FitFunc |
---|
545 | Struct ResSmearAAOStruct &s |
---|
546 | |
---|
547 | // the name of your unsmeared model is the first argument |
---|
548 | Smear_Model_20(Prolate_Sw,s.coefW,s.xW,s.yW,s.resW) |
---|
549 | |
---|
550 | return(0) |
---|
551 | End |
---|
552 | |
---|
553 | // this is all there is to the smeared calculation! |
---|
554 | Function SmearedProlate_SC(s) :FitFunc |
---|
555 | Struct ResSmearAAOStruct &s |
---|
556 | |
---|
557 | // the name of your unsmeared model is the first argument |
---|
558 | Smear_Model_20(Prolate_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
559 | |
---|
560 | return(0) |
---|
561 | End |
---|
562 | |
---|
563 | // this is all there is to the smeared calculation! |
---|
564 | Function SmearedProlate_SHS(s) :FitFunc |
---|
565 | Struct ResSmearAAOStruct &s |
---|
566 | |
---|
567 | // the name of your unsmeared model is the first argument |
---|
568 | Smear_Model_20(Prolate_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
569 | |
---|
570 | return(0) |
---|
571 | End |
---|
572 | |
---|
573 | // this is all there is to the smeared calculation! |
---|
574 | Function SmearedProlate_2Y(s) :FitFunc |
---|
575 | Struct ResSmearAAOStruct &s |
---|
576 | |
---|
577 | // the name of your unsmeared model is the first argument |
---|
578 | Smear_Model_20(Prolate_2Y,s.coefW,s.xW,s.yW,s.resW) |
---|
579 | |
---|
580 | return(0) |
---|
581 | End |
---|
582 | |
---|
583 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
584 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
585 | // |
---|
586 | // used only for the dependency, not for fitting |
---|
587 | // |
---|
588 | Function fSmearedProlate_HS(coefW,yW,xW) |
---|
589 | Wave coefW,yW,xW |
---|
590 | |
---|
591 | String str = getWavesDataFolder(yW,0) |
---|
592 | String DF="root:"+str+":" |
---|
593 | |
---|
594 | WAVE resW = $(DF+str+"_res") |
---|
595 | |
---|
596 | STRUCT ResSmearAAOStruct fs |
---|
597 | WAVE fs.coefW = coefW |
---|
598 | WAVE fs.yW = yW |
---|
599 | WAVE fs.xW = xW |
---|
600 | WAVE fs.resW = resW |
---|
601 | |
---|
602 | Variable err |
---|
603 | err = SmearedProlate_HS(fs) |
---|
604 | |
---|
605 | return (0) |
---|
606 | End |
---|
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 fSmearedProlate_SW(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 = SmearedProlate_SW(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 fSmearedProlate_SC(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 = SmearedProlate_SC(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 fSmearedProlate_SHS(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 = SmearedProlate_SHS(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 fSmearedProlate_2Y(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 = SmearedProlate_2Y(fs) |
---|
704 | |
---|
705 | return (0) |
---|
706 | End |
---|