1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion = 6.0 |
---|
3 | |
---|
4 | // |
---|
5 | // be sure to include all of the necessary files |
---|
6 | // |
---|
7 | #include "LogNormalSphere_v40" |
---|
8 | |
---|
9 | #include "HardSphereStruct_v40" |
---|
10 | #include "HPMSA_v40" |
---|
11 | #include "SquareWellStruct_v40" |
---|
12 | #include "StickyHardSphereStruct_v40" |
---|
13 | |
---|
14 | Proc PlotLogNormalSphere_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 (^-1) for model: " |
---|
18 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
19 | |
---|
20 | Make/O/D/N=(num) xwave_lns_HS,ywave_lns_HS |
---|
21 | xwave_lns_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
22 | Make/O/D coef_lns_HS = {0.01,60,0.2,1e-6,3e-6,0.001} |
---|
23 | make/O/T parameters_lns_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} |
---|
24 | Edit parameters_lns_HS,coef_lns_HS |
---|
25 | |
---|
26 | Variable/G root:g_lns_HS |
---|
27 | g_lns_HS := LogNormalSphere_HS(coef_lns_HS,ywave_lns_HS,xwave_lns_HS) |
---|
28 | Display ywave_lns_HS vs xwave_lns_HS |
---|
29 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
30 | Label bottom "q (\\S-1\\M)" |
---|
31 | Label left "Intensity (cm\\S-1\\M)" |
---|
32 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
33 | |
---|
34 | AddModelToStrings("LogNormalSphere_HS","coef_lns_HS","lns_HS") |
---|
35 | End |
---|
36 | |
---|
37 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
38 | Proc PlotSmearedLogNormalSphere_HS(str) |
---|
39 | String str |
---|
40 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
41 | |
---|
42 | // if any of the resolution waves are missing => abort |
---|
43 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
44 | Abort |
---|
45 | endif |
---|
46 | |
---|
47 | SetDataFolder $("root:"+str) |
---|
48 | |
---|
49 | // Setup parameter table for model function |
---|
50 | Make/O/D smear_coef_lns_HS = {0.01,60,0.2,1e-6,3e-6,0.001} |
---|
51 | make/o/t smear_parameters_lns_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} |
---|
52 | Edit smear_parameters_lns_HS,smear_coef_lns_HS |
---|
53 | |
---|
54 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
55 | // make extra copy of experimental q-values for easy plotting |
---|
56 | Duplicate/O $(str+"_q") smeared_lns_HS,smeared_qvals |
---|
57 | SetScale d,0,0,"1/cm",smeared_lns_HS |
---|
58 | |
---|
59 | Variable/G gs_lns_HS=0 |
---|
60 | gs_lns_HS := fSmearedLogNormalSphere_HS(smear_coef_lns_HS,smeared_lns_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
61 | |
---|
62 | Display smeared_lns_HS vs smeared_qvals |
---|
63 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
64 | Label bottom "q (\\S-1\\M)" |
---|
65 | Label left "Intensity (cm\\S-1\\M)" |
---|
66 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
67 | |
---|
68 | SetDataFolder root: |
---|
69 | AddModelToStrings("SmearedLogNormalSphere_HS","smear_coef_lns_HS","lns_HS") |
---|
70 | End |
---|
71 | |
---|
72 | |
---|
73 | Function LogNormalSphere_HS(w,yw,xw) : FitFunc |
---|
74 | Wave w,yw,xw |
---|
75 | |
---|
76 | Variable inten |
---|
77 | |
---|
78 | //setup form factor coefficient wave |
---|
79 | Make/O/D/N=6 form_lns_HS |
---|
80 | form_lns_HS[0] = 1 |
---|
81 | form_lns_HS[1] = w[1] |
---|
82 | form_lns_HS[2] = w[2] |
---|
83 | form_lns_HS[3] = w[3] |
---|
84 | form_lns_HS[4] = w[4] |
---|
85 | form_lns_HS[5] = 0 |
---|
86 | |
---|
87 | //calculate the diameter of the effective one-component sphere |
---|
88 | Variable r3,mu,sig,diam |
---|
89 | sig = w[2] //polydispersity |
---|
90 | mu = ln(w[1]) //ln of mean radius |
---|
91 | r3 = exp(3*mu + 9/2*sig^2) // <R^3> calculated directly for log-normal distr. |
---|
92 | |
---|
93 | diam = 2*(r3)^(1/3) |
---|
94 | |
---|
95 | |
---|
96 | //setup structure factor coefficient wave |
---|
97 | Make/O/D/N=2 struct_lns_HS |
---|
98 | struct_lns_HS[0] = diam/2 |
---|
99 | struct_lns_HS[1] = w[0] |
---|
100 | |
---|
101 | //calculate each and combine |
---|
102 | Duplicate/O xw tmp_lns_HS_PQ,tmp_lns_HS_SQ |
---|
103 | LogNormalSphere(form_lns_HS,tmp_lns_HS_PQ,xw) |
---|
104 | HardSphereStruct(struct_lns_HS,tmp_lns_HS_SQ,xw) |
---|
105 | yw = tmp_lns_HS_PQ *tmp_lns_HS_SQ |
---|
106 | yw *= w[0] |
---|
107 | yw += w[5] |
---|
108 | |
---|
109 | //cleanup waves |
---|
110 | // Killwaves/Z form_lns_HS,struct_lns_HS |
---|
111 | |
---|
112 | return (0) |
---|
113 | End |
---|
114 | |
---|
115 | ///////////////////////////////////////// |
---|
116 | Proc PlotLogNormalSphere_SW(num,qmin,qmax) |
---|
117 | Variable num=128,qmin=0.001,qmax=0.7 |
---|
118 | Prompt num "Enter number of data points for model: " |
---|
119 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
120 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
121 | |
---|
122 | Make/O/D/N=(num) xwave_lns_SW,ywave_lns_SW |
---|
123 | xwave_lns_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
124 | Make/O/D coef_lns_SW = {0.01,60,0.2,1e-6,3e-6,1.0,1.2,0.001} |
---|
125 | make/O/T parameters_lns_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
126 | Edit parameters_lns_SW,coef_lns_SW |
---|
127 | |
---|
128 | Variable/G root:g_lns_SW |
---|
129 | g_lns_SW := LogNormalSphere_SW(coef_lns_SW,ywave_lns_SW,xwave_lns_SW) |
---|
130 | Display ywave_lns_SW vs xwave_lns_SW |
---|
131 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
132 | Label bottom "q (\\S-1\\M)" |
---|
133 | Label left "Intensity (cm\\S-1\\M)" |
---|
134 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
135 | |
---|
136 | AddModelToStrings("LogNormalSphere_SW","coef_lns_SW","lns_SW") |
---|
137 | End |
---|
138 | |
---|
139 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
140 | Proc PlotSmearedLogNormalSphere_SW(str) |
---|
141 | String str |
---|
142 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
143 | |
---|
144 | // if any of the resolution waves are missing => abort |
---|
145 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
146 | Abort |
---|
147 | endif |
---|
148 | |
---|
149 | SetDataFolder $("root:"+str) |
---|
150 | |
---|
151 | // Setup parameter table for model function |
---|
152 | Make/O/D smear_coef_lns_SW = {0.01,60,0.2,1e-6,3e-6,1.0,1.2,0.001} |
---|
153 | make/o/t smear_parameters_lns_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} |
---|
154 | Edit smear_parameters_lns_SW,smear_coef_lns_SW |
---|
155 | |
---|
156 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
157 | // make extra copy of experimental q-values for easy plotting |
---|
158 | Duplicate/O $(str+"_q") smeared_lns_SW,smeared_qvals |
---|
159 | SetScale d,0,0,"1/cm",smeared_lns_SW |
---|
160 | |
---|
161 | Variable/G gs_lns_SW=0 |
---|
162 | gs_lns_SW := fSmearedLogNormalSphere_SW(smear_coef_lns_SW,smeared_lns_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
163 | |
---|
164 | Display smeared_lns_SW vs smeared_qvals |
---|
165 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
166 | Label bottom "q (\\S-1\\M)" |
---|
167 | Label left "Intensity (cm\\S-1\\M)" |
---|
168 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
169 | |
---|
170 | SetDataFolder root: |
---|
171 | AddModelToStrings("SmearedLogNormalSphere_SW","smear_coef_lns_SW","lns_SW") |
---|
172 | End |
---|
173 | |
---|
174 | |
---|
175 | Function LogNormalSphere_SW(w,yw,xw) : FitFunc |
---|
176 | Wave w,yw,xw |
---|
177 | |
---|
178 | Variable inten |
---|
179 | |
---|
180 | //setup form factor coefficient wave |
---|
181 | Make/O/D/N=6 form_lns_SW |
---|
182 | form_lns_SW[0] = 1 |
---|
183 | form_lns_SW[1] = w[1] |
---|
184 | form_lns_SW[2] = w[2] |
---|
185 | form_lns_SW[3] = w[3] |
---|
186 | form_lns_SW[4] = w[4] |
---|
187 | form_lns_SW[5] = 0 |
---|
188 | |
---|
189 | //calculate the diameter of the effective one-component sphere |
---|
190 | Variable r3,mu,sig,diam |
---|
191 | sig = w[2] //polydispersity |
---|
192 | mu = ln(w[1]) //ln of mean radius |
---|
193 | r3 = exp(3*mu + 9/2*sig^2) // <R^3> calculated directly for log-normal distr. |
---|
194 | |
---|
195 | diam = 2*(r3)^(1/3) |
---|
196 | |
---|
197 | //setup structure factor coefficient wave |
---|
198 | Make/O/D/N=4 struct_lns_SW |
---|
199 | struct_lns_SW[0] = diam/2 |
---|
200 | struct_lns_SW[1] = w[0] |
---|
201 | struct_lns_SW[2] = w[5] |
---|
202 | struct_lns_SW[3] = w[6] |
---|
203 | |
---|
204 | //calculate each and combine |
---|
205 | Duplicate/O xw tmp_lns_SW_PQ,tmp_lns_SW_SQ |
---|
206 | LogNormalSphere(form_lns_SW,tmp_lns_SW_PQ,xw) |
---|
207 | SquareWellStruct(struct_lns_SW,tmp_lns_SW_SQ,xw) |
---|
208 | yw = tmp_lns_SW_PQ * tmp_lns_SW_SQ |
---|
209 | yw *= w[0] |
---|
210 | yw += w[7] |
---|
211 | |
---|
212 | //cleanup waves |
---|
213 | // Killwaves/Z form_lns_SW,struct_lns_SW |
---|
214 | |
---|
215 | return (0) |
---|
216 | End |
---|
217 | |
---|
218 | |
---|
219 | ///////////////////////////////////////// |
---|
220 | Proc PlotLogNormalSphere_SC(num,qmin,qmax) |
---|
221 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
222 | Prompt num "Enter number of data points for model: " |
---|
223 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
224 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
225 | |
---|
226 | if(!DataFolderExists(":HayPenMSA")) |
---|
227 | NewDataFolder :HayPenMSA |
---|
228 | endif |
---|
229 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
230 | |
---|
231 | Make/O/D/N=(num) xwave_lns_SC,ywave_lns_SC |
---|
232 | xwave_lns_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
233 | Make/O/D coef_lns_SC = {0.01,60,0.2,1e-6,3e-6,20,0,298,78,0.001} |
---|
234 | make/O/T parameters_lns_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
235 | Edit parameters_lns_SC,coef_lns_SC |
---|
236 | |
---|
237 | Variable/G root:g_lns_SC |
---|
238 | g_lns_SC := LogNormalSphere_SC(coef_lns_SC,ywave_lns_SC,xwave_lns_SC) |
---|
239 | Display ywave_lns_SC vs xwave_lns_SC |
---|
240 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
241 | Label bottom "q (\\S-1\\M)" |
---|
242 | Label left "Intensity (cm\\S-1\\M)" |
---|
243 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
244 | |
---|
245 | AddModelToStrings("LogNormalSphere_SC","coef_lns_SC","lns_SC") |
---|
246 | End |
---|
247 | |
---|
248 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
249 | Proc PlotSmearedLogNormalSphere_SC(str) |
---|
250 | String str |
---|
251 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
252 | |
---|
253 | // if any of the resolution waves are missing => abort |
---|
254 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
255 | Abort |
---|
256 | endif |
---|
257 | |
---|
258 | SetDataFolder $("root:"+str) |
---|
259 | |
---|
260 | if(!DataFolderExists(":HayPenMSA")) |
---|
261 | NewDataFolder :HayPenMSA |
---|
262 | endif |
---|
263 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
264 | |
---|
265 | // Setup parameter table for model function |
---|
266 | Make/O/D smear_coef_lns_SC = {0.01,60,0.2,1e-6,3e-6,20,0,298,78,0.001} |
---|
267 | make/o/t smear_parameters_lns_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} |
---|
268 | Edit smear_parameters_lns_SC,smear_coef_lns_SC |
---|
269 | |
---|
270 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
271 | // make extra copy of experimental q-values for easy plotting |
---|
272 | Duplicate/O $(str+"_q") smeared_lns_SC,smeared_qvals |
---|
273 | SetScale d,0,0,"1/cm",smeared_lns_SC |
---|
274 | |
---|
275 | Variable/G gs_lns_SC=0 |
---|
276 | gs_lns_SC := fSmearedLogNormalSphere_SC(smear_coef_lns_SC,smeared_lns_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
277 | |
---|
278 | Display smeared_lns_SC vs smeared_qvals |
---|
279 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
280 | Label bottom "q (\\S-1\\M)" |
---|
281 | Label left "Intensity (cm\\S-1\\M)" |
---|
282 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
283 | |
---|
284 | SetDataFolder root: |
---|
285 | AddModelToStrings("SmearedLogNormalSphere_SC","smear_coef_lns_SC","lns_SC") |
---|
286 | End |
---|
287 | |
---|
288 | |
---|
289 | |
---|
290 | Function LogNormalSphere_SC(w,yw,xw) : FitFunc |
---|
291 | Wave w,yw,xw |
---|
292 | |
---|
293 | Variable inten |
---|
294 | |
---|
295 | //setup form factor coefficient wave |
---|
296 | Make/O/D/N=6 form_lns_SC |
---|
297 | form_lns_SC[0] = 1 |
---|
298 | form_lns_SC[1] = w[1] |
---|
299 | form_lns_SC[2] = w[2] |
---|
300 | form_lns_SC[3] = w[3] |
---|
301 | form_lns_SC[4] = w[4] |
---|
302 | form_lns_SC[5] = 0 |
---|
303 | |
---|
304 | //calculate the diameter of the effective one-component sphere |
---|
305 | Variable r3,mu,sig,diam |
---|
306 | sig = w[2] //polydispersity |
---|
307 | mu = ln(w[1]) //ln of mean radius |
---|
308 | r3 = exp(3*mu + 9/2*sig^2) // <R^3> calculated directly for log-normal distr. |
---|
309 | |
---|
310 | diam = 2*(r3)^(1/3) |
---|
311 | |
---|
312 | //setup structure factor coefficient wave |
---|
313 | Make/O/D/N=6 struct_lns_SC |
---|
314 | struct_lns_SC[0] = diam |
---|
315 | struct_lns_SC[1] = w[5] |
---|
316 | struct_lns_SC[2] = w[0] |
---|
317 | struct_lns_SC[3] = w[7] |
---|
318 | struct_lns_SC[4] = w[6] |
---|
319 | struct_lns_SC[5] = w[8] |
---|
320 | |
---|
321 | //calculate each and combine |
---|
322 | Duplicate/O xw tmp_lns_SC_PQ,tmp_lns_SC_SQ |
---|
323 | LogNormalSphere(form_lns_SC,tmp_lns_SC_PQ,xw) |
---|
324 | HayterPenfoldMSA(struct_lns_SC,tmp_lns_SC_SQ,xw) |
---|
325 | yw = tmp_lns_SC_PQ * tmp_lns_SC_SQ |
---|
326 | yw *= w[0] |
---|
327 | yw += w[9] |
---|
328 | |
---|
329 | //cleanup waves |
---|
330 | // Killwaves/Z form_lns_SC,struct_lns_SC |
---|
331 | |
---|
332 | return (0) |
---|
333 | End |
---|
334 | |
---|
335 | ///////////////////////////////////////// |
---|
336 | Proc PlotLogNormalSphere_SHS(num,qmin,qmax) |
---|
337 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
338 | Prompt num "Enter number of data points for model: " |
---|
339 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
340 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
341 | |
---|
342 | Make/O/D/N=(num) xwave_lns_SHS,ywave_lns_SHS |
---|
343 | xwave_lns_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) ) |
---|
344 | Make/O/D coef_lns_SHS = {0.01,60,0.2,1e-6,3e-6,0.05,0.2,0.001} |
---|
345 | make/O/T parameters_lns_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
346 | Edit parameters_lns_SHS,coef_lns_SHS |
---|
347 | |
---|
348 | Variable/G root:g_lns_SHS |
---|
349 | g_lns_SHS := LogNormalSphere_SHS(coef_lns_SHS,ywave_lns_SHS,xwave_lns_SHS) |
---|
350 | Display ywave_lns_SHS vs xwave_lns_SHS |
---|
351 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
352 | Label bottom "q (\\S-1\\M)" |
---|
353 | Label left "Intensity (cm\\S-1\\M)" |
---|
354 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
355 | |
---|
356 | AddModelToStrings("LogNormalSphere_SHS","coef_lns_SHS","lns_SHS") |
---|
357 | End |
---|
358 | |
---|
359 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
360 | Proc PlotSmearedLogNormalSphere_SHS(str) |
---|
361 | String str |
---|
362 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
363 | |
---|
364 | // if any of the resolution waves are missing => abort |
---|
365 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
366 | Abort |
---|
367 | endif |
---|
368 | |
---|
369 | SetDataFolder $("root:"+str) |
---|
370 | |
---|
371 | // Setup parameter table for model function |
---|
372 | Make/O/D smear_coef_lns_SHS = {0.01,60,0.2,1e-6,3e-6,0.05,0.2,0.001} |
---|
373 | make/o/t smear_parameters_lns_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} |
---|
374 | Edit smear_parameters_lns_SHS,smear_coef_lns_SHS |
---|
375 | |
---|
376 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
377 | // make extra copy of experimental q-values for easy plotting |
---|
378 | Duplicate/O $(str+"_q") smeared_lns_SHS,smeared_qvals |
---|
379 | SetScale d,0,0,"1/cm",smeared_lns_SHS |
---|
380 | |
---|
381 | Variable/G gs_lns_SHS=0 |
---|
382 | gs_lns_SHS := fSmearedLogNormalSphere_SHS(smear_coef_lns_SHS,smeared_lns_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
383 | |
---|
384 | Display smeared_lns_SHS vs smeared_qvals |
---|
385 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
386 | Label bottom "q (\\S-1\\M)" |
---|
387 | Label left "Intensity (cm\\S-1\\M)" |
---|
388 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
389 | |
---|
390 | SetDataFolder root: |
---|
391 | AddModelToStrings("SmearedLogNormalSphere_SHS","smear_coef_lns_SHS","lns_SHS") |
---|
392 | End |
---|
393 | |
---|
394 | |
---|
395 | Function LogNormalSphere_SHS(w,yw,xw) : FitFunc |
---|
396 | Wave w,yw,xw |
---|
397 | |
---|
398 | Variable inten |
---|
399 | |
---|
400 | //setup form factor coefficient wave |
---|
401 | Make/O/D/N=6 form_lns_SHS |
---|
402 | form_lns_SHS[0] = 1 |
---|
403 | form_lns_SHS[1] = w[1] |
---|
404 | form_lns_SHS[2] = w[2] |
---|
405 | form_lns_SHS[3] = w[3] |
---|
406 | form_lns_SHS[4] = w[4] |
---|
407 | form_lns_SHS[5] = 0 |
---|
408 | |
---|
409 | //calculate the diameter of the effective one-component sphere |
---|
410 | Variable r3,mu,sig,diam |
---|
411 | sig = w[2] //polydispersity |
---|
412 | mu = ln(w[1]) //ln of mean radius |
---|
413 | r3 = exp(3*mu + 9/2*sig^2) // <R^3> calculated directly for log-normal distr. |
---|
414 | |
---|
415 | diam = 2*(r3)^(1/3) |
---|
416 | |
---|
417 | //setup structure factor coefficient wave |
---|
418 | Make/O/D/N=4 struct_lns_SHS |
---|
419 | struct_lns_SHS[0] = diam/2 |
---|
420 | struct_lns_SHS[1] = w[0] |
---|
421 | struct_lns_SHS[2] = w[5] |
---|
422 | struct_lns_SHS[3] = w[6] |
---|
423 | |
---|
424 | //calculate each and combine |
---|
425 | Duplicate/O xw tmp_lns_SHS_PQ,tmp_lns_SHS_SQ |
---|
426 | LogNormalSphere(form_lns_SHS,tmp_lns_SHS_PQ,xw) |
---|
427 | StickyHS_Struct(struct_lns_SHS,tmp_lns_SHS_SQ,xw) |
---|
428 | yw = tmp_lns_SHS_PQ * tmp_lns_SHS_SQ |
---|
429 | yw *= w[0] |
---|
430 | yw += w[7] |
---|
431 | |
---|
432 | //cleanup waves |
---|
433 | // Killwaves/Z form_lns_SHS,struct_lns_SHS |
---|
434 | |
---|
435 | return (0) |
---|
436 | End |
---|
437 | |
---|
438 | |
---|
439 | // this is all there is to the smeared calculation! |
---|
440 | Function SmearedLogNormalSphere_HS(s) : FitFunc |
---|
441 | Struct ResSmearAAOStruct &s |
---|
442 | |
---|
443 | // the name of your unsmeared model (AAO) is the first argument |
---|
444 | Smear_Model_20(LogNormalSphere_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
445 | |
---|
446 | return(0) |
---|
447 | End |
---|
448 | |
---|
449 | // this is all there is to the smeared calculation! |
---|
450 | Function SmearedLogNormalSphere_SW(s) : FitFunc |
---|
451 | Struct ResSmearAAOStruct &s |
---|
452 | |
---|
453 | // the name of your unsmeared model (AAO) is the first argument |
---|
454 | Smear_Model_20(LogNormalSphere_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
455 | |
---|
456 | return(0) |
---|
457 | End |
---|
458 | |
---|
459 | // this is all there is to the smeared calculation! |
---|
460 | Function SmearedLogNormalSphere_SC(s) : FitFunc |
---|
461 | Struct ResSmearAAOStruct &s |
---|
462 | |
---|
463 | // the name of your unsmeared model (AAO) is the first argument |
---|
464 | Smear_Model_20(LogNormalSphere_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
465 | |
---|
466 | return(0) |
---|
467 | End |
---|
468 | |
---|
469 | // this is all there is to the smeared calculation! |
---|
470 | Function SmearedLogNormalSphere_SHS(s) : FitFunc |
---|
471 | Struct ResSmearAAOStruct &s |
---|
472 | |
---|
473 | // the name of your unsmeared model (AAO) is the first argument |
---|
474 | Smear_Model_20(LogNormalSphere_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
475 | |
---|
476 | return(0) |
---|
477 | End |
---|
478 | |
---|
479 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
480 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
481 | // |
---|
482 | // used only for the dependency, not for fitting |
---|
483 | // |
---|
484 | Function fSmearedLogNormalSphere_HS(coefW,yW,xW) |
---|
485 | Wave coefW,yW,xW |
---|
486 | |
---|
487 | String str = getWavesDataFolder(yW,0) |
---|
488 | String DF="root:"+str+":" |
---|
489 | |
---|
490 | WAVE resW = $(DF+str+"_res") |
---|
491 | |
---|
492 | STRUCT ResSmearAAOStruct fs |
---|
493 | WAVE fs.coefW = coefW |
---|
494 | WAVE fs.yW = yW |
---|
495 | WAVE fs.xW = xW |
---|
496 | WAVE fs.resW = resW |
---|
497 | |
---|
498 | Variable err |
---|
499 | err = SmearedLogNormalSphere_HS(fs) |
---|
500 | |
---|
501 | return (0) |
---|
502 | End |
---|
503 | |
---|
504 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
505 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
506 | // |
---|
507 | // used only for the dependency, not for fitting |
---|
508 | // |
---|
509 | Function fSmearedLogNormalSphere_SW(coefW,yW,xW) |
---|
510 | Wave coefW,yW,xW |
---|
511 | |
---|
512 | String str = getWavesDataFolder(yW,0) |
---|
513 | String DF="root:"+str+":" |
---|
514 | |
---|
515 | WAVE resW = $(DF+str+"_res") |
---|
516 | |
---|
517 | STRUCT ResSmearAAOStruct fs |
---|
518 | WAVE fs.coefW = coefW |
---|
519 | WAVE fs.yW = yW |
---|
520 | WAVE fs.xW = xW |
---|
521 | WAVE fs.resW = resW |
---|
522 | |
---|
523 | Variable err |
---|
524 | err = SmearedLogNormalSphere_SW(fs) |
---|
525 | |
---|
526 | return (0) |
---|
527 | End |
---|
528 | |
---|
529 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
530 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
531 | // |
---|
532 | // used only for the dependency, not for fitting |
---|
533 | // |
---|
534 | Function fSmearedLogNormalSphere_SC(coefW,yW,xW) |
---|
535 | Wave coefW,yW,xW |
---|
536 | |
---|
537 | String str = getWavesDataFolder(yW,0) |
---|
538 | String DF="root:"+str+":" |
---|
539 | |
---|
540 | WAVE resW = $(DF+str+"_res") |
---|
541 | |
---|
542 | STRUCT ResSmearAAOStruct fs |
---|
543 | WAVE fs.coefW = coefW |
---|
544 | WAVE fs.yW = yW |
---|
545 | WAVE fs.xW = xW |
---|
546 | WAVE fs.resW = resW |
---|
547 | |
---|
548 | Variable err |
---|
549 | err = SmearedLogNormalSphere_SC(fs) |
---|
550 | |
---|
551 | return (0) |
---|
552 | End |
---|
553 | |
---|
554 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
555 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
556 | // |
---|
557 | // used only for the dependency, not for fitting |
---|
558 | // |
---|
559 | Function fSmearedLogNormalSphere_SHS(coefW,yW,xW) |
---|
560 | Wave coefW,yW,xW |
---|
561 | |
---|
562 | String str = getWavesDataFolder(yW,0) |
---|
563 | String DF="root:"+str+":" |
---|
564 | |
---|
565 | WAVE resW = $(DF+str+"_res") |
---|
566 | |
---|
567 | STRUCT ResSmearAAOStruct fs |
---|
568 | WAVE fs.coefW = coefW |
---|
569 | WAVE fs.yW = yW |
---|
570 | WAVE fs.xW = xW |
---|
571 | WAVE fs.resW = resW |
---|
572 | |
---|
573 | Variable err |
---|
574 | err = SmearedLogNormalSphere_SHS(fs) |
---|
575 | |
---|
576 | return (0) |
---|
577 | End |
---|
578 | |
---|