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 "EffectiveDiameter_v40" |
---|
7 | #include "UniformEllipsoid_v40" |
---|
8 | |
---|
9 | #include "HardSphereStruct_v40" |
---|
10 | #include "HPMSA_v40" |
---|
11 | #include "SquareWellStruct_v40" |
---|
12 | #include "StickyHardSphereStruct_v40" |
---|
13 | #include "Two_Yukawa_v40" |
---|
14 | |
---|
15 | Proc PlotEllipsoid_HS(num,qmin,qmax) |
---|
16 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
17 | Prompt num "Enter number of data points for model: " |
---|
18 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
19 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
20 | |
---|
21 | Make/O/D/n=(num) xwave_EOR_HS,ywave_EOR_HS |
---|
22 | xwave_EOR_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
23 | Make/O/D coef_EOR_HS = {0.01,20.,400,1e-6,6.3e-6,0.01} |
---|
24 | make/o/t parameters_EOR_HS = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","incoh. bkg (cm^-1)"} |
---|
25 | Edit parameters_EOR_HS,coef_EOR_HS |
---|
26 | |
---|
27 | Variable/G root:g_EOR_HS |
---|
28 | g_EOR_HS := Ellipsoid_HS(coef_EOR_HS,ywave_EOR_HS,xwave_EOR_HS) |
---|
29 | Display ywave_EOR_HS vs xwave_EOR_HS |
---|
30 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
31 | Label bottom "q (A\\S-1\\M)" |
---|
32 | Label left "Intensity (cm\\S-1\\M)" |
---|
33 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
34 | |
---|
35 | AddModelToStrings("Ellipsoid_HS","coef_EOR_HS","parameters_EOR_HS","EOR_HS") |
---|
36 | End |
---|
37 | |
---|
38 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
39 | Proc PlotSmearedEllipsoid_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_EOR_HS = {0.01,20.,400,1e-6,6.3e-6,0.01} |
---|
52 | make/o/t smear_parameters_EOR_HS = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","incoh. bkg (cm^-1)"} |
---|
53 | Edit smear_parameters_EOR_HS,smear_coef_EOR_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_EOR_HS,smeared_qvals |
---|
58 | SetScale d,0,0,"1/cm",smeared_EOR_HS |
---|
59 | |
---|
60 | Variable/G gs_EOR_HS=0 |
---|
61 | gs_EOR_HS := fSmearedEllipsoid_HS(smear_coef_EOR_HS,smeared_EOR_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
62 | |
---|
63 | Display smeared_EOR_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("SmearedEllipsoid_HS","smear_coef_EOR_HS","smear_parameters_EOR_HS","EOR_HS") |
---|
72 | End |
---|
73 | |
---|
74 | |
---|
75 | //AAO function |
---|
76 | Function Ellipsoid_HS(w,yW,xW) : FitFunc |
---|
77 | Wave w,yW,xW |
---|
78 | |
---|
79 | Variable inten,aa,bb |
---|
80 | aa=w[1] |
---|
81 | bb=w[2] |
---|
82 | |
---|
83 | //setup form factor coefficient wave |
---|
84 | Make/O/D/N=6 form_EOR_HS |
---|
85 | form_EOR_HS[0] = 1 |
---|
86 | form_EOR_HS[1] = w[1] |
---|
87 | form_EOR_HS[2] = w[2] |
---|
88 | form_EOR_HS[3] = w[3] |
---|
89 | form_EOR_HS[4] = w[4] |
---|
90 | form_EOR_HS[5] = 0 |
---|
91 | |
---|
92 | //setup structure factor coefficient wave |
---|
93 | Make/O/D/N=2 struct_EOR_HS |
---|
94 | struct_EOR_HS[0] = 0.5*DiamEllip(aa,bb) |
---|
95 | struct_EOR_HS[1] = w[0] |
---|
96 | |
---|
97 | //calculate each and combine |
---|
98 | Duplicate/O xw, temp_EOR_HS_PQ,temp_EOR_HS_SQ |
---|
99 | EllipsoidForm(form_EOR_HS,temp_EOR_HS_PQ,xW) |
---|
100 | HardSphereStruct(struct_EOR_HS,temp_EOR_HS_SQ,xW) |
---|
101 | yw = temp_EOR_HS_PQ * temp_EOR_HS_SQ |
---|
102 | yw *= w[0] |
---|
103 | yw += w[5] |
---|
104 | |
---|
105 | //cleanup waves |
---|
106 | // Killwaves/Z form_EOR_HS,struct_EOR_HS |
---|
107 | |
---|
108 | return (0) |
---|
109 | End |
---|
110 | |
---|
111 | Proc PlotEllipsoid_SW(num,qmin,qmax) |
---|
112 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
113 | Prompt num "Enter number of data points for model: " |
---|
114 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
115 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
116 | |
---|
117 | Make/O/D/n=(num) xwave_EOR_SW,ywave_EOR_SW |
---|
118 | xwave_EOR_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
119 | Make/O/D coef_EOR_SW = {0.01,20.,400,1e-6,6.3e-6,1.0,1.2,0.01} |
---|
120 | make/o/t parameters_EOR_SW = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","well depth (kT)","well width (diam.)","incoh. bkg (cm^-1)"} |
---|
121 | Edit parameters_EOR_SW,coef_EOR_SW |
---|
122 | |
---|
123 | Variable/G root:g_EOR_SW |
---|
124 | g_EOR_SW := Ellipsoid_SW(coef_EOR_SW,ywave_EOR_SW,xwave_EOR_SW) |
---|
125 | Display ywave_EOR_SW vs xwave_EOR_SW |
---|
126 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
127 | Label bottom "q (A\\S-1\\M)" |
---|
128 | Label left "Intensity (cm\\S-1\\M)" |
---|
129 | |
---|
130 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
131 | |
---|
132 | AddModelToStrings("Ellipsoid_SW","coef_EOR_SW","parameters_EOR_SW","EOR_SW") |
---|
133 | End |
---|
134 | |
---|
135 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
136 | Proc PlotSmearedEllipsoid_SW(str) |
---|
137 | String str |
---|
138 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
139 | |
---|
140 | // if any of the resolution waves are missing => abort |
---|
141 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
142 | Abort |
---|
143 | endif |
---|
144 | |
---|
145 | SetDataFolder $("root:"+str) |
---|
146 | |
---|
147 | // Setup parameter table for model function |
---|
148 | Make/O/D smear_coef_EOR_SW = {0.01,20.,400,1e-6,6.3e-6,1.0,1.2,0.01} |
---|
149 | make/o/t smear_parameters_EOR_SW = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","well depth (kT)","well width (diam.)","incoh. bkg (cm^-1)"} |
---|
150 | Edit smear_parameters_EOR_SW,smear_coef_EOR_SW |
---|
151 | |
---|
152 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
153 | // make extra copy of experimental q-values for easy plotting |
---|
154 | Duplicate/O $(str+"_q") smeared_EOR_SW,smeared_qvals |
---|
155 | SetScale d,0,0,"1/cm",smeared_EOR_SW |
---|
156 | |
---|
157 | Variable/G gs_EOR_SW=0 |
---|
158 | gs_EOR_SW := fSmearedEllipsoid_SW(smear_coef_EOR_SW,smeared_EOR_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
159 | |
---|
160 | Display smeared_EOR_SW vs smeared_qvals |
---|
161 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
162 | Label bottom "q (A\\S-1\\M)" |
---|
163 | Label left "Intensity (cm\\S-1\\M)" |
---|
164 | |
---|
165 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
166 | |
---|
167 | SetDataFolder root: |
---|
168 | AddModelToStrings("SmearedEllipsoid_SW","smear_coef_EOR_SW","smear_parameters_EOR_SW","EOR_SW") |
---|
169 | End |
---|
170 | |
---|
171 | |
---|
172 | Function Ellipsoid_SW(w,yw,xw) : FitFunc |
---|
173 | Wave w,yw,xw |
---|
174 | |
---|
175 | Variable inten,aa,bb |
---|
176 | aa=w[1] |
---|
177 | bb=w[2] |
---|
178 | |
---|
179 | //setup form factor coefficient wave |
---|
180 | Make/O/D/N=6 form_EOR_SW |
---|
181 | form_EOR_SW[0] = 1 |
---|
182 | form_EOR_SW[1] = w[1] |
---|
183 | form_EOR_SW[2] = w[2] |
---|
184 | form_EOR_SW[3] = w[3] |
---|
185 | form_EOR_SW[4] = w[4] |
---|
186 | form_EOR_SW[5] = 0 |
---|
187 | |
---|
188 | //setup structure factor coefficient wave |
---|
189 | Make/O/D/N=4 struct_EOR_SW |
---|
190 | struct_EOR_SW[0] = 0.5*DiamEllip(aa,bb) |
---|
191 | struct_EOR_SW[1] = w[0] |
---|
192 | struct_EOR_SW[2] = w[5] |
---|
193 | struct_EOR_SW[3] = w[6] |
---|
194 | |
---|
195 | //calculate each and combine |
---|
196 | Duplicate/O xw, temp_EOR_SW_PQ,temp_EOR_SW_SQ |
---|
197 | EllipsoidForm(form_EOR_SW,temp_EOR_SW_PQ,xw) |
---|
198 | SquareWellStruct(struct_EOR_SW,temp_EOR_SW_SQ,xw) |
---|
199 | yw = temp_EOR_SW_PQ * temp_EOR_SW_SQ |
---|
200 | yw *= w[0] |
---|
201 | yw += w[7] |
---|
202 | |
---|
203 | //cleanup waves |
---|
204 | // Killwaves/Z form_EOR_SW,struct_EOR_SW |
---|
205 | |
---|
206 | return (0) |
---|
207 | End |
---|
208 | |
---|
209 | Proc PlotEllipsoid_SC(num,qmin,qmax) |
---|
210 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
211 | Prompt num "Enter number of data points for model: " |
---|
212 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
213 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
214 | |
---|
215 | if(!DataFolderExists(":HayPenMSA")) |
---|
216 | NewDataFolder :HayPenMSA |
---|
217 | endif |
---|
218 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
219 | |
---|
220 | Make/O/D/n=(num) xwave_EOR_SC,ywave_EOR_SC |
---|
221 | xwave_EOR_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
222 | Make/O/D coef_EOR_SC = {0.01,20.,400,1e-6,6.3e-6,20,0,298,78,0.01} |
---|
223 | make/o/t parameters_EOR_SC = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","incoh. bkg (cm^-1)"} |
---|
224 | Edit parameters_EOR_SC,coef_EOR_SC |
---|
225 | |
---|
226 | Variable/G root:g_EOR_SC |
---|
227 | g_EOR_SC := Ellipsoid_SC(coef_EOR_SC,ywave_EOR_SC,xwave_EOR_SC) |
---|
228 | Display ywave_EOR_SC vs xwave_EOR_SC |
---|
229 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
230 | Label bottom "q (A\\S-1\\M)" |
---|
231 | Label left "Intensity (cm\\S-1\\M)" |
---|
232 | |
---|
233 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
234 | |
---|
235 | AddModelToStrings("Ellipsoid_SC","coef_EOR_SC","parameters_EOR_SC","EOR_SC") |
---|
236 | End |
---|
237 | |
---|
238 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
239 | Proc PlotSmearedEllipsoid_SC(str) |
---|
240 | String str |
---|
241 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
242 | |
---|
243 | // if any of the resolution waves are missing => abort |
---|
244 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
245 | Abort |
---|
246 | endif |
---|
247 | |
---|
248 | SetDataFolder $("root:"+str) |
---|
249 | |
---|
250 | if(!DataFolderExists(":HayPenMSA")) |
---|
251 | NewDataFolder :HayPenMSA |
---|
252 | endif |
---|
253 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
254 | |
---|
255 | // Setup parameter table for model function |
---|
256 | Make/O/D smear_coef_EOR_SC = {0.01,20.,400,1e-6,6.3e-6,20,0,298,78,0.01} |
---|
257 | make/o/t smear_parameters_EOR_SC = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","incoh. bkg (cm^-1)"} |
---|
258 | Edit smear_parameters_EOR_SC,smear_coef_EOR_SC |
---|
259 | |
---|
260 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
261 | // make extra copy of experimental q-values for easy plotting |
---|
262 | Duplicate/O $(str+"_q") smeared_EOR_SC,smeared_qvals |
---|
263 | SetScale d,0,0,"1/cm",smeared_EOR_SC |
---|
264 | |
---|
265 | Variable/G gs_EOR_SC=0 |
---|
266 | gs_EOR_SC := fSmearedEllipsoid_SC(smear_coef_EOR_SC,smeared_EOR_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
267 | |
---|
268 | Display smeared_EOR_SC vs smeared_qvals |
---|
269 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
270 | Label bottom "q (A\\S-1\\M)" |
---|
271 | Label left "Intensity (cm\\S-1\\M)" |
---|
272 | |
---|
273 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
274 | |
---|
275 | SetDataFolder root: |
---|
276 | AddModelToStrings("SmearedEllipsoid_SC","smear_coef_EOR_SC","smear_parameters_EOR_SC","EOR_SC") |
---|
277 | End |
---|
278 | |
---|
279 | |
---|
280 | Function Ellipsoid_SC(w,yw,xw) : FitFunc |
---|
281 | Wave w,yw,xw |
---|
282 | |
---|
283 | Variable inten,aa,bb |
---|
284 | aa=w[1] |
---|
285 | bb=w[2] |
---|
286 | |
---|
287 | //setup form factor coefficient wave |
---|
288 | Make/O/D/N=6 form_EOR_SC |
---|
289 | form_EOR_SC[0] = 1 |
---|
290 | form_EOR_SC[1] = w[1] |
---|
291 | form_EOR_SC[2] = w[2] |
---|
292 | form_EOR_SC[3] = w[3] |
---|
293 | form_EOR_SC[4] = w[4] |
---|
294 | form_EOR_SC[5] = 0 |
---|
295 | |
---|
296 | //setup structure factor coefficient wave |
---|
297 | Make/O/D/N=6 struct_EOR_SC |
---|
298 | struct_EOR_SC[0] = DiamEllip(aa,bb) |
---|
299 | struct_EOR_SC[1] = w[5] |
---|
300 | struct_EOR_SC[2] = w[0] |
---|
301 | struct_EOR_SC[3] = w[7] |
---|
302 | struct_EOR_SC[4] = w[6] |
---|
303 | struct_EOR_SC[5] = w[8] |
---|
304 | |
---|
305 | //calculate each and combine |
---|
306 | Duplicate/O xw, temp_EOR_SC_PQ,temp_EOR_SC_SQ |
---|
307 | EllipsoidForm(form_EOR_SC,temp_EOR_SC_PQ,xw) |
---|
308 | HayterPenfoldMSA(struct_EOR_SC,temp_EOR_SC_SQ,xw) |
---|
309 | yw = temp_EOR_SC_PQ * temp_EOR_SC_SQ |
---|
310 | yw *= w[0] |
---|
311 | yw += w[9] |
---|
312 | |
---|
313 | //cleanup waves |
---|
314 | // Killwaves/Z form_EOR_SC,struct_EOR_SC |
---|
315 | |
---|
316 | return (0) |
---|
317 | End |
---|
318 | |
---|
319 | Proc PlotEllipsoid_SHS(num,qmin,qmax) |
---|
320 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
321 | Prompt num "Enter number of data points for model: " |
---|
322 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
323 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
324 | |
---|
325 | Make/O/D/n=(num) xwave_EOR_SHS,ywave_EOR_SHS |
---|
326 | xwave_EOR_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
327 | Make/O/D coef_EOR_SHS = {0.01,20.,400,1e-6,6.3e-6,0.05,0.2,0.01} |
---|
328 | make/o/t parameters_EOR_SHS = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","perturbation parameter (0.1)","stickiness, tau","incoh. bkg (cm^-1)"} |
---|
329 | Edit parameters_EOR_SHS,coef_EOR_SHS |
---|
330 | |
---|
331 | Variable/G root:g_EOR_SHS |
---|
332 | g_EOR_SHS := Ellipsoid_SHS(coef_EOR_SHS,ywave_EOR_SHS,xwave_EOR_SHS) |
---|
333 | Display ywave_EOR_SHS vs xwave_EOR_SHS |
---|
334 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
335 | Label bottom "q (A\\S-1\\M)" |
---|
336 | Label left "Intensity (cm\\S-1\\M)" |
---|
337 | |
---|
338 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
339 | |
---|
340 | AddModelToStrings("Ellipsoid_SHS","coef_EOR_SHS","parameters_EOR_SHS","EOR_SHS") |
---|
341 | End |
---|
342 | |
---|
343 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
344 | Proc PlotSmearedEllipsoid_SHS(str) |
---|
345 | String str |
---|
346 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
347 | |
---|
348 | // if any of the resolution waves are missing => abort |
---|
349 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
350 | Abort |
---|
351 | endif |
---|
352 | |
---|
353 | SetDataFolder $("root:"+str) |
---|
354 | |
---|
355 | // Setup parameter table for model function |
---|
356 | Make/O/D smear_coef_EOR_SHS = {0.01,20.,400,1e-6,6.3e-6,0.05,0.2,0.01} |
---|
357 | make/o/t smear_parameters_EOR_SHS = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","perturbation parameter (0.1)","stickiness, tau","incoh. bkg (cm^-1)"} |
---|
358 | Edit smear_parameters_EOR_SHS,smear_coef_EOR_SHS |
---|
359 | |
---|
360 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
361 | // make extra copy of experimental q-values for easy plotting |
---|
362 | Duplicate/O $(str+"_q") smeared_EOR_SHS,smeared_qvals |
---|
363 | SetScale d,0,0,"1/cm",smeared_EOR_SHS |
---|
364 | |
---|
365 | Variable/G gs_EOR_SHS=0 |
---|
366 | gs_EOR_SHS := fSmearedEllipsoid_SHS(smear_coef_EOR_SHS,smeared_EOR_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
367 | |
---|
368 | Display smeared_EOR_SHS vs smeared_qvals |
---|
369 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
370 | Label bottom "q (A\\S-1\\M)" |
---|
371 | Label left "Intensity (cm\\S-1\\M)" |
---|
372 | |
---|
373 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
374 | |
---|
375 | SetDataFolder root: |
---|
376 | AddModelToStrings("SmearedEllipsoid_SHS","smear_coef_EOR_SHS","smear_parameters_EOR_SHS","EOR_SHS") |
---|
377 | End |
---|
378 | |
---|
379 | |
---|
380 | Function Ellipsoid_SHS(w,yw,xw) : FitFunc |
---|
381 | Wave w,yw,xw |
---|
382 | |
---|
383 | Variable inten,aa,bb |
---|
384 | aa=w[1] |
---|
385 | bb=w[2] |
---|
386 | |
---|
387 | //setup form factor coefficient wave |
---|
388 | Make/O/D/N=6 form_EOR_SHS |
---|
389 | form_EOR_SHS[0] = 1 |
---|
390 | form_EOR_SHS[1] = w[1] |
---|
391 | form_EOR_SHS[2] = w[2] |
---|
392 | form_EOR_SHS[3] = w[3] |
---|
393 | form_EOR_SHS[4] = w[4] |
---|
394 | form_EOR_SHS[5] = 0 |
---|
395 | |
---|
396 | //setup structure factor coefficient wave |
---|
397 | Make/O/D/N=4 struct_EOR_SHS |
---|
398 | struct_EOR_SHS[0] = 0.5*DiamEllip(aa,bb) |
---|
399 | struct_EOR_SHS[1] = w[0] |
---|
400 | struct_EOR_SHS[2] = w[5] |
---|
401 | struct_EOR_SHS[3] = w[6] |
---|
402 | |
---|
403 | //calculate each and combine |
---|
404 | Duplicate/O xw, temp_EOR_SHS_PQ,temp_EOR_SHS_SQ |
---|
405 | EllipsoidForm(form_EOR_SHS,temp_EOR_SHS_PQ,xw) |
---|
406 | StickyHS_Struct(struct_EOR_SHS,temp_EOR_SHS_SQ,xw) |
---|
407 | yw = temp_EOR_SHS_PQ *temp_EOR_SHS_SQ |
---|
408 | yw *= w[0] |
---|
409 | yw += w[7] |
---|
410 | |
---|
411 | //cleanup waves |
---|
412 | // Killwaves/Z form_EOR_SHS,struct_EOR_SHS |
---|
413 | |
---|
414 | return (0) |
---|
415 | End |
---|
416 | |
---|
417 | //two yukawa |
---|
418 | Proc PlotEllipsoid_2Y(num,qmin,qmax) |
---|
419 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
420 | Prompt num "Enter number of data points for model: " |
---|
421 | Prompt qmin "Enter minimum q-value (A^-1) for model: " |
---|
422 | Prompt qmax "Enter maximum q-value (A^-1) for model: " |
---|
423 | |
---|
424 | Make/O/D/n=(num) xwave_EOR_2Y,ywave_EOR_2Y |
---|
425 | xwave_EOR_2Y = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
426 | Make/O/D coef_EOR_2Y = {0.01,20.,400,1e-6,6.3e-6,6,10,-1,2,0.01} |
---|
427 | make/o/t parameters_EOR_2Y = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","scale, K1","charge, Z1","scale, K2","charge, Z2","incoh. bkg (cm^-1)"} |
---|
428 | Edit parameters_EOR_2Y,coef_EOR_2Y |
---|
429 | |
---|
430 | Variable/G root:g_EOR_2Y |
---|
431 | g_EOR_2Y := Ellipsoid_2Y(coef_EOR_2Y,ywave_EOR_2Y,xwave_EOR_2Y) |
---|
432 | Display ywave_EOR_2Y vs xwave_EOR_2Y |
---|
433 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
434 | Label bottom "q (A\\S-1\\M)" |
---|
435 | Label left "Intensity (cm\\S-1\\M)" |
---|
436 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
437 | |
---|
438 | AddModelToStrings("Ellipsoid_2Y","coef_EOR_2Y","parameters_EOR_2Y","EOR_2Y") |
---|
439 | End |
---|
440 | |
---|
441 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
442 | Proc PlotSmearedEllipsoid_2Y(str) |
---|
443 | String str |
---|
444 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
445 | |
---|
446 | // if any of the resolution waves are missing => abort |
---|
447 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
448 | Abort |
---|
449 | endif |
---|
450 | |
---|
451 | SetDataFolder $("root:"+str) |
---|
452 | |
---|
453 | // Setup parameter table for model function |
---|
454 | Make/O/D smear_coef_EOR_2Y = {0.01,20.,400,1e-6,6.3e-6,6,10,-1,2,0.01} |
---|
455 | make/o/t smear_parameters_EOR_2Y = {"volume fraction","R(a) rotation axis (A)","R(b) (A)","SLD ellipsoid (A^-2)","SLD solvent (A^-2)","scale, K1","charge, Z1","scale, K2","charge, Z2","incoh. bkg (cm^-1)"} |
---|
456 | Edit smear_parameters_EOR_2Y,smear_coef_EOR_2Y |
---|
457 | |
---|
458 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
459 | // make extra copy of experimental q-values for easy plotting |
---|
460 | Duplicate/O $(str+"_q") smeared_EOR_2Y,smeared_qvals |
---|
461 | SetScale d,0,0,"1/cm",smeared_EOR_2Y |
---|
462 | |
---|
463 | Variable/G gs_EOR_2Y=0 |
---|
464 | gs_EOR_2Y := fSmearedEllipsoid_2Y(smear_coef_EOR_2Y,smeared_EOR_2Y,smeared_qvals) //this wrapper fills the STRUCT |
---|
465 | |
---|
466 | Display smeared_EOR_2Y vs smeared_qvals |
---|
467 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
468 | Label bottom "q (A\\S-1\\M)" |
---|
469 | Label left "Intensity (cm\\S-1\\M)" |
---|
470 | |
---|
471 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
472 | |
---|
473 | SetDataFolder root: |
---|
474 | AddModelToStrings("SmearedEllipsoid_2Y","smear_coef_EOR_2Y","smear_parameters_EOR_2Y","EOR_2Y") |
---|
475 | End |
---|
476 | |
---|
477 | |
---|
478 | //AAO function |
---|
479 | Function Ellipsoid_2Y(w,yW,xW) : FitFunc |
---|
480 | Wave w,yW,xW |
---|
481 | |
---|
482 | Variable inten,aa,bb |
---|
483 | aa=w[1] |
---|
484 | bb=w[2] |
---|
485 | |
---|
486 | //setup form factor coefficient wave |
---|
487 | Make/O/D/N=6 form_EOR_2Y |
---|
488 | form_EOR_2Y[0] = 1 |
---|
489 | form_EOR_2Y[1] = w[1] |
---|
490 | form_EOR_2Y[2] = w[2] |
---|
491 | form_EOR_2Y[3] = w[3] |
---|
492 | form_EOR_2Y[4] = w[4] |
---|
493 | form_EOR_2Y[5] = 0 |
---|
494 | |
---|
495 | //setup structure factor coefficient wave |
---|
496 | Make/O/D/N=6 struct_EOR_2Y |
---|
497 | struct_EOR_2Y[0] = w[0] |
---|
498 | struct_EOR_2Y[1] = 0.5*DiamEllip(aa,bb) |
---|
499 | struct_EOR_2Y[2] = w[5] |
---|
500 | struct_EOR_2Y[3] = w[6] |
---|
501 | struct_EOR_2Y[4] = w[7] |
---|
502 | struct_EOR_2Y[5] = w[8] |
---|
503 | |
---|
504 | //calculate each and combine |
---|
505 | Duplicate/O xw, temp_EOR_2Y_PQ,temp_EOR_2Y_SQ |
---|
506 | EllipsoidForm(form_EOR_2Y,temp_EOR_2Y_PQ,xW) |
---|
507 | TwoYukawa(struct_EOR_2Y,temp_EOR_2Y_SQ,xW) |
---|
508 | yw = temp_EOR_2Y_PQ * temp_EOR_2Y_SQ |
---|
509 | yw *= w[0] |
---|
510 | yw += w[9] |
---|
511 | |
---|
512 | //cleanup waves |
---|
513 | // Killwaves/Z form_EOR_2Y,struct_EOR_2Y |
---|
514 | |
---|
515 | return (0) |
---|
516 | End |
---|
517 | |
---|
518 | // this is all there is to the smeared calculation! |
---|
519 | Function SmearedEllipsoid_HS(s) :FitFunc |
---|
520 | Struct ResSmearAAOStruct &s |
---|
521 | |
---|
522 | // the name of your unsmeared model is the first argument |
---|
523 | Smear_Model_20(Ellipsoid_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
524 | |
---|
525 | return(0) |
---|
526 | End |
---|
527 | |
---|
528 | // this is all there is to the smeared calculation! |
---|
529 | Function SmearedEllipsoid_SW(s) :FitFunc |
---|
530 | Struct ResSmearAAOStruct &s |
---|
531 | |
---|
532 | // the name of your unsmeared model is the first argument |
---|
533 | Smear_Model_20(Ellipsoid_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
534 | |
---|
535 | return(0) |
---|
536 | End |
---|
537 | |
---|
538 | // this is all there is to the smeared calculation! |
---|
539 | Function SmearedEllipsoid_SC(s) :FitFunc |
---|
540 | Struct ResSmearAAOStruct &s |
---|
541 | |
---|
542 | // the name of your unsmeared model is the first argument |
---|
543 | Smear_Model_20(Ellipsoid_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
544 | |
---|
545 | return(0) |
---|
546 | End |
---|
547 | |
---|
548 | // this is all there is to the smeared calculation! |
---|
549 | Function SmearedEllipsoid_SHS(s) :FitFunc |
---|
550 | Struct ResSmearAAOStruct &s |
---|
551 | |
---|
552 | // the name of your unsmeared model is the first argument |
---|
553 | Smear_Model_20(Ellipsoid_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
554 | |
---|
555 | return(0) |
---|
556 | End |
---|
557 | |
---|
558 | // this is all there is to the smeared calculation! |
---|
559 | Function SmearedEllipsoid_2Y(s) :FitFunc |
---|
560 | Struct ResSmearAAOStruct &s |
---|
561 | |
---|
562 | // the name of your unsmeared model is the first argument |
---|
563 | Smear_Model_20(Ellipsoid_2Y,s.coefW,s.xW,s.yW,s.resW) |
---|
564 | |
---|
565 | return(0) |
---|
566 | End |
---|
567 | |
---|
568 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
569 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
570 | // |
---|
571 | // used only for the dependency, not for fitting |
---|
572 | // |
---|
573 | Function fSmearedEllipsoid_HS(coefW,yW,xW) |
---|
574 | Wave coefW,yW,xW |
---|
575 | |
---|
576 | String str = getWavesDataFolder(yW,0) |
---|
577 | String DF="root:"+str+":" |
---|
578 | |
---|
579 | WAVE resW = $(DF+str+"_res") |
---|
580 | |
---|
581 | STRUCT ResSmearAAOStruct fs |
---|
582 | WAVE fs.coefW = coefW |
---|
583 | WAVE fs.yW = yW |
---|
584 | WAVE fs.xW = xW |
---|
585 | WAVE fs.resW = resW |
---|
586 | |
---|
587 | Variable err |
---|
588 | err = SmearedEllipsoid_HS(fs) |
---|
589 | |
---|
590 | return (0) |
---|
591 | End |
---|
592 | |
---|
593 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
594 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
595 | // |
---|
596 | // used only for the dependency, not for fitting |
---|
597 | // |
---|
598 | Function fSmearedEllipsoid_SW(coefW,yW,xW) |
---|
599 | Wave coefW,yW,xW |
---|
600 | |
---|
601 | String str = getWavesDataFolder(yW,0) |
---|
602 | String DF="root:"+str+":" |
---|
603 | |
---|
604 | WAVE resW = $(DF+str+"_res") |
---|
605 | |
---|
606 | STRUCT ResSmearAAOStruct fs |
---|
607 | WAVE fs.coefW = coefW |
---|
608 | WAVE fs.yW = yW |
---|
609 | WAVE fs.xW = xW |
---|
610 | WAVE fs.resW = resW |
---|
611 | |
---|
612 | Variable err |
---|
613 | err = SmearedEllipsoid_SW(fs) |
---|
614 | |
---|
615 | return (0) |
---|
616 | End |
---|
617 | |
---|
618 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
619 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
620 | // |
---|
621 | // used only for the dependency, not for fitting |
---|
622 | // |
---|
623 | Function fSmearedEllipsoid_SC(coefW,yW,xW) |
---|
624 | Wave coefW,yW,xW |
---|
625 | |
---|
626 | String str = getWavesDataFolder(yW,0) |
---|
627 | String DF="root:"+str+":" |
---|
628 | |
---|
629 | WAVE resW = $(DF+str+"_res") |
---|
630 | |
---|
631 | STRUCT ResSmearAAOStruct fs |
---|
632 | WAVE fs.coefW = coefW |
---|
633 | WAVE fs.yW = yW |
---|
634 | WAVE fs.xW = xW |
---|
635 | WAVE fs.resW = resW |
---|
636 | |
---|
637 | Variable err |
---|
638 | err = SmearedEllipsoid_SC(fs) |
---|
639 | |
---|
640 | return (0) |
---|
641 | End |
---|
642 | |
---|
643 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
644 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
645 | // |
---|
646 | // used only for the dependency, not for fitting |
---|
647 | // |
---|
648 | Function fSmearedEllipsoid_SHS(coefW,yW,xW) |
---|
649 | Wave coefW,yW,xW |
---|
650 | |
---|
651 | String str = getWavesDataFolder(yW,0) |
---|
652 | String DF="root:"+str+":" |
---|
653 | |
---|
654 | WAVE resW = $(DF+str+"_res") |
---|
655 | |
---|
656 | STRUCT ResSmearAAOStruct fs |
---|
657 | WAVE fs.coefW = coefW |
---|
658 | WAVE fs.yW = yW |
---|
659 | WAVE fs.xW = xW |
---|
660 | WAVE fs.resW = resW |
---|
661 | |
---|
662 | Variable err |
---|
663 | err = SmearedEllipsoid_SHS(fs) |
---|
664 | |
---|
665 | return (0) |
---|
666 | End |
---|
667 | |
---|
668 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
669 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
670 | // |
---|
671 | // used only for the dependency, not for fitting |
---|
672 | // |
---|
673 | Function fSmearedEllipsoid_2Y(coefW,yW,xW) |
---|
674 | Wave coefW,yW,xW |
---|
675 | |
---|
676 | String str = getWavesDataFolder(yW,0) |
---|
677 | String DF="root:"+str+":" |
---|
678 | |
---|
679 | WAVE resW = $(DF+str+"_res") |
---|
680 | |
---|
681 | STRUCT ResSmearAAOStruct fs |
---|
682 | WAVE fs.coefW = coefW |
---|
683 | WAVE fs.yW = yW |
---|
684 | WAVE fs.xW = xW |
---|
685 | WAVE fs.resW = resW |
---|
686 | |
---|
687 | Variable err |
---|
688 | err = SmearedEllipsoid_2Y(fs) |
---|
689 | |
---|
690 | return (0) |
---|
691 | End |
---|