1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion = 6.0 |
---|
3 | |
---|
4 | |
---|
5 | // the "scale" or "volume fraction" factor is the "material" volume fraction |
---|
6 | // - i.e. the volume fraction of surfactant added. NOT the excluded volume |
---|
7 | // of the vesicles, which can be much larger. See the Vesicle_Volume_N_Rg macro |
---|
8 | // |
---|
9 | // this excluded volume is accounted for in the structure factor calculations. |
---|
10 | // |
---|
11 | |
---|
12 | #include "Vesicle_UL_v40" |
---|
13 | |
---|
14 | #include "HardSphereStruct_v40" |
---|
15 | #include "HPMSA_v40" |
---|
16 | #include "SquareWellStruct_v40" |
---|
17 | #include "StickyHardSphereStruct_v40" |
---|
18 | |
---|
19 | Proc PlotVesicle_HS(num,qmin,qmax) |
---|
20 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
21 | Prompt num "Enter number of data points for model: " |
---|
22 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
23 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
24 | |
---|
25 | //make the normal model waves |
---|
26 | Make/O/D/n=(num) xwave_ves_HS,ywave_ves_HS |
---|
27 | xwave_ves_HS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
28 | Make/O/D coef_ves_HS = {0.1,100,30,6.36e-6,0.5e-6,0} |
---|
29 | make/o/t parameters_ves_HS = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","bkg (cm-1)"} |
---|
30 | Edit/K=1 parameters_ves_HS,coef_ves_HS |
---|
31 | |
---|
32 | Variable/G root:g_ves_HS |
---|
33 | g_ves_HS := Vesicle_HS(coef_ves_HS,ywave_ves_HS,xwave_ves_HS) |
---|
34 | Display/K=1 ywave_ves_HS vs xwave_ves_HS |
---|
35 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
36 | Label bottom "q (\\S-1\\M)" |
---|
37 | Label left "Intensity (cm\\S-1\\M)" |
---|
38 | |
---|
39 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
40 | |
---|
41 | AddModelToStrings("Vesicle_HS","coef_ves_HS","ves_HS") |
---|
42 | End |
---|
43 | |
---|
44 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
45 | Proc PlotSmearedVesicle_HS(str) |
---|
46 | String str |
---|
47 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
48 | |
---|
49 | // if any of the resolution waves are missing => abort |
---|
50 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
51 | Abort |
---|
52 | endif |
---|
53 | |
---|
54 | SetDataFolder $("root:"+str) |
---|
55 | |
---|
56 | // Setup parameter table for model function |
---|
57 | Make/O/D smear_coef_ves_HS = {0.1,100,30,6.36e-6,0.5e-6,0} |
---|
58 | make/o/t smear_parameters_ves_HS = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","bkg (cm-1)"} |
---|
59 | Edit smear_parameters_ves_HS,smear_coef_ves_HS |
---|
60 | |
---|
61 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
62 | // make extra copy of experimental q-values for easy plotting |
---|
63 | Duplicate/O $(str+"_q") smeared_ves_HS,smeared_qvals |
---|
64 | SetScale d,0,0,"1/cm",smeared_ves_HS |
---|
65 | |
---|
66 | Variable/G gs_ves_HS=0 |
---|
67 | gs_ves_HS := fSmearedVesicle_HS(smear_coef_ves_HS,smeared_ves_HS,smeared_qvals) //this wrapper fills the STRUCT |
---|
68 | |
---|
69 | Display smeared_ves_HS vs smeared_qvals |
---|
70 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
71 | Label bottom "q (\\S-1\\M)" |
---|
72 | Label left "Intensity (cm\\S-1\\M)" |
---|
73 | |
---|
74 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
75 | |
---|
76 | SetDataFolder root: |
---|
77 | AddModelToStrings("SmearedVesicle_HS","smear_coef_ves_HS","ves_HS") |
---|
78 | End |
---|
79 | |
---|
80 | |
---|
81 | Function Vesicle_HS(w,yw,xw) : FitFunc |
---|
82 | Wave w,yw,xw |
---|
83 | |
---|
84 | Variable inten |
---|
85 | |
---|
86 | //setup form factor coefficient wave |
---|
87 | Make/O/D/N=6 form_ves_HS |
---|
88 | form_ves_HS[0] = 1 |
---|
89 | form_ves_HS[1] = w[1] |
---|
90 | form_ves_HS[2] = w[2] |
---|
91 | form_ves_HS[3] = w[3] |
---|
92 | form_ves_HS[4] = w[4] |
---|
93 | form_ves_HS[5] = 0 |
---|
94 | |
---|
95 | // calculate the excluded volume of the vesicles |
---|
96 | Variable totvol,core,shell,exclVol,nden |
---|
97 | totvol=4*pi/3*(w[1]+w[2])^3 |
---|
98 | core=4*pi/3*(w[1])^3 |
---|
99 | shell = totVol-core |
---|
100 | // nden = phi/(shell volume) or phi/Vtotal |
---|
101 | nden = w[0]/shell |
---|
102 | exclVol = nden*totvol |
---|
103 | |
---|
104 | //setup structure factor coefficient wave |
---|
105 | Make/O/D/N=2 struct_ves_HS |
---|
106 | struct_ves_HS[0] = w[1] + w[2] |
---|
107 | struct_ves_HS[1] = exclVol |
---|
108 | |
---|
109 | //calculate each and combine |
---|
110 | Duplicate/O xw tmp_ves_HS_PQ,tmp_ves_HS_SQ |
---|
111 | VesicleForm(form_ves_HS,tmp_ves_HS_PQ,xw) |
---|
112 | HardSphereStruct(struct_ves_HS,tmp_ves_HS_SQ,xw) |
---|
113 | yw = tmp_ves_HS_PQ * tmp_ves_HS_SQ |
---|
114 | yw *= w[0] |
---|
115 | yw += w[5] |
---|
116 | |
---|
117 | //cleanup waves |
---|
118 | //Killwaves/Z form_ves_HS,struct_ves_HS |
---|
119 | |
---|
120 | return (0) |
---|
121 | End |
---|
122 | |
---|
123 | ///////////////////////////////// |
---|
124 | Proc PlotVesicle_SW(num,qmin,qmax) |
---|
125 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
126 | Prompt num "Enter number of data points for model: " |
---|
127 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
128 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
129 | |
---|
130 | /// |
---|
131 | Make/O/D/N=4 form_ves_SW |
---|
132 | Make/O/D/N=4 struct_ves_SW |
---|
133 | /// |
---|
134 | Make/O/D/n=(num) xwave_ves_SW,ywave_ves_SW |
---|
135 | xwave_ves_SW = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
136 | Make/O/D coef_ves_SW = {0.1,100,30,6.36e-6,0.5e-6,1,1.2,0} |
---|
137 | make/o/t parameters_ves_SW = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","well depth (kT)","well width (diam.)","bkgd (cm-1)"} |
---|
138 | Edit/K=1 parameters_ves_SW,coef_ves_SW |
---|
139 | |
---|
140 | Variable/G root:g_ves_SW |
---|
141 | g_ves_SW := Vesicle_SW(coef_ves_SW,ywave_ves_SW,xwave_ves_SW) |
---|
142 | Display/K=1 ywave_ves_SW vs xwave_ves_SW |
---|
143 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
144 | Label bottom "q (\\S-1\\M)" |
---|
145 | Label left "Intensity (cm\\S-1\\M)" |
---|
146 | |
---|
147 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
148 | AddModelToStrings("Vesicle_SW","coef_ves_SW","ves_SW") |
---|
149 | End |
---|
150 | |
---|
151 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
152 | Proc PlotSmearedVesicle_SW(str) |
---|
153 | String str |
---|
154 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
155 | |
---|
156 | // if any of the resolution waves are missing => abort |
---|
157 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
158 | Abort |
---|
159 | endif |
---|
160 | |
---|
161 | SetDataFolder $("root:"+str) |
---|
162 | |
---|
163 | // Setup parameter table for model function |
---|
164 | Make/O/D smear_coef_ves_SW = {0.1,100,30,6.36e-6,0.5e-6,1,1.2,0} |
---|
165 | make/o/t smear_parameters_ves_SW = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","well depth (kT)","well width (diam.)","bkgd (cm-1)"} |
---|
166 | Edit smear_parameters_ves_SW,smear_coef_ves_SW |
---|
167 | |
---|
168 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
169 | // make extra copy of experimental q-values for easy plotting |
---|
170 | Duplicate/O $(str+"_q") smeared_ves_SW,smeared_qvals |
---|
171 | SetScale d,0,0,"1/cm",smeared_ves_SW |
---|
172 | |
---|
173 | Variable/G gs_ves_SW=0 |
---|
174 | gs_ves_SW := fSmearedVesicle_SW(smear_coef_ves_SW,smeared_ves_SW,smeared_qvals) //this wrapper fills the STRUCT |
---|
175 | |
---|
176 | Display smeared_ves_SW vs smeared_qvals |
---|
177 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
178 | Label bottom "q (\\S-1\\M)" |
---|
179 | Label left "Intensity (cm\\S-1\\M)" |
---|
180 | |
---|
181 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
182 | |
---|
183 | SetDataFolder root: |
---|
184 | AddModelToStrings("SmearedVesicle_SW","smear_coef_ves_SW","ves_SW") |
---|
185 | End |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | Function Vesicle_SW(w,yw,xw) : FitFunc |
---|
190 | Wave w,yw,xw |
---|
191 | |
---|
192 | Variable inten |
---|
193 | |
---|
194 | //setup form factor coefficient wave |
---|
195 | Make/O/D/N=6 form_ves_SW |
---|
196 | form_ves_SW[0] = 1 |
---|
197 | form_ves_SW[1] = w[1] |
---|
198 | form_ves_SW[2] = w[2] |
---|
199 | form_ves_SW[3] = w[3] |
---|
200 | form_ves_SW[4] = w[4] |
---|
201 | form_ves_SW[5] = 0 |
---|
202 | |
---|
203 | // calculate the excluded volume of the vesicles |
---|
204 | Variable totvol,core,shell,exclVol,nden |
---|
205 | totvol=4*pi/3*(w[1]+w[2])^3 |
---|
206 | core=4*pi/3*(w[1])^3 |
---|
207 | shell = totVol-core |
---|
208 | // nden = phi/(shell volume) or phi/Vtotal |
---|
209 | nden = w[0]/shell |
---|
210 | exclVol = nden*totvol |
---|
211 | |
---|
212 | //setup structure factor coefficient wave |
---|
213 | Make/O/D/N=4 struct_ves_SW |
---|
214 | struct_ves_SW[0] = w[1] + w[2] |
---|
215 | struct_ves_SW[1] = exclVol |
---|
216 | struct_ves_SW[2] = w[5] |
---|
217 | struct_ves_SW[3] = w[6] |
---|
218 | |
---|
219 | //calculate each and combine |
---|
220 | Duplicate/O xw tmp_ves_SW_PQ,tmp_ves_SW_SQ |
---|
221 | VesicleForm(form_ves_SW,tmp_ves_SW_PQ,xw) |
---|
222 | SquareWellStruct(struct_ves_SW,tmp_ves_SW_SQ,xw) |
---|
223 | yw = tmp_ves_SW_PQ * tmp_ves_SW_SQ |
---|
224 | yw *= w[0] |
---|
225 | yw += w[7] |
---|
226 | |
---|
227 | //cleanup waves |
---|
228 | //Killwaves/Z form_ves_SW,struct_ves_SW |
---|
229 | |
---|
230 | return (0) |
---|
231 | End |
---|
232 | |
---|
233 | ///////////////////////////////// |
---|
234 | Proc PlotVesicle_SC(num,qmin,qmax) |
---|
235 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
236 | Prompt num "Enter number of data points for model: " |
---|
237 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
238 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
239 | |
---|
240 | if(!DataFolderExists(":HayPenMSA")) |
---|
241 | NewDataFolder :HayPenMSA |
---|
242 | endif |
---|
243 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
244 | |
---|
245 | /// |
---|
246 | Make/O/D/n=(num) xwave_ves_SC,ywave_ves_SC |
---|
247 | xwave_ves_SC = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
248 | Make/O/D coef_ves_SC = {0.1,100,30,6.36e-6,0.5e-6,20,0,298,78,0} |
---|
249 | make/o/t parameters_ves_SC = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkgd (cm-1)"} |
---|
250 | Edit/K=1 parameters_ves_SC,coef_ves_SC |
---|
251 | |
---|
252 | Variable/G root:g_ves_SC |
---|
253 | g_ves_SC := Vesicle_SC(coef_ves_SC,ywave_ves_SC,xwave_ves_SC) |
---|
254 | Display/K=1 ywave_ves_SC vs xwave_ves_SC |
---|
255 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
256 | Label bottom "q (\\S-1\\M)" |
---|
257 | Label left "Intensity (cm\\S-1\\M)" |
---|
258 | |
---|
259 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
260 | AddModelToStrings("Vesicle_SC","coef_ves_SC","ves_SC") |
---|
261 | End |
---|
262 | |
---|
263 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
264 | Proc PlotSmearedVesicle_SC(str) |
---|
265 | String str |
---|
266 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
267 | |
---|
268 | // if any of the resolution waves are missing => abort |
---|
269 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
270 | Abort |
---|
271 | endif |
---|
272 | |
---|
273 | SetDataFolder $("root:"+str) |
---|
274 | |
---|
275 | if(!DataFolderExists(":HayPenMSA")) |
---|
276 | NewDataFolder :HayPenMSA |
---|
277 | endif |
---|
278 | Make/O/D/N=17 :HayPenMSA:gMSAWave |
---|
279 | |
---|
280 | // Setup parameter table for model function |
---|
281 | Make/O/D smear_coef_ves_SC = {0.1,100,30,6.36e-6,0.5e-6,20,0,298,78,0} |
---|
282 | make/o/t smear_parameters_ves_SC = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkgd (cm-1)"} |
---|
283 | Edit smear_parameters_ves_SC,smear_coef_ves_SC |
---|
284 | |
---|
285 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
286 | // make extra copy of experimental q-values for easy plotting |
---|
287 | Duplicate/O $(str+"_q") smeared_ves_SC,smeared_qvals |
---|
288 | SetScale d,0,0,"1/cm",smeared_ves_SC |
---|
289 | |
---|
290 | Variable/G gs_ves_SC=0 |
---|
291 | gs_ves_SC := fSmearedVesicle_SC(smear_coef_ves_SC,smeared_ves_SC,smeared_qvals) //this wrapper fills the STRUCT |
---|
292 | |
---|
293 | Display smeared_ves_SC vs smeared_qvals |
---|
294 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
295 | Label bottom "q (\\S-1\\M)" |
---|
296 | Label left "Intensity (cm\\S-1\\M)" |
---|
297 | |
---|
298 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
299 | |
---|
300 | SetDataFolder root: |
---|
301 | AddModelToStrings("SmearedVesicle_SC","smear_coef_ves_SC","ves_SC") |
---|
302 | End |
---|
303 | |
---|
304 | |
---|
305 | Function Vesicle_SC(w,yw,xw) : FitFunc |
---|
306 | Wave w,yw,xw |
---|
307 | |
---|
308 | // Variable timer=StartMSTimer |
---|
309 | Variable inten |
---|
310 | |
---|
311 | //setup form factor coefficient wave |
---|
312 | Make/O/D/N=6 form_ves_SC |
---|
313 | form_ves_SC[0] = 1 |
---|
314 | form_ves_SC[1] = w[1] |
---|
315 | form_ves_SC[2] = w[2] |
---|
316 | form_ves_SC[3] = w[3] |
---|
317 | form_ves_SC[4] = w[4] |
---|
318 | form_ves_SC[5] = 0 |
---|
319 | |
---|
320 | // calculate the excluded volume of the vesicles |
---|
321 | Variable totvol,core,shell,exclVol,nden |
---|
322 | totvol=4*pi/3*(w[1]+w[2])^3 |
---|
323 | core=4*pi/3*(w[1])^3 |
---|
324 | shell = totVol-core |
---|
325 | // nden = phi/(shell volume) or phi/Vtotal |
---|
326 | nden = w[0]/shell |
---|
327 | exclVol = nden*totvol |
---|
328 | |
---|
329 | //setup structure factor coefficient wave |
---|
330 | Make/O/D/N=6 struct_ves_SC |
---|
331 | struct_ves_SC[0] = 2*(w[1]+w[2]) //diameter |
---|
332 | struct_ves_SC[1] = w[5] |
---|
333 | struct_ves_SC[2] = exclVol |
---|
334 | struct_ves_SC[3] = w[7] |
---|
335 | struct_ves_SC[4] = w[6] |
---|
336 | struct_ves_SC[5] = w[8] |
---|
337 | |
---|
338 | //calculate each and combine |
---|
339 | Duplicate/O xw tmp_ves_SC_PQ,tmp_ves_SC_SQ |
---|
340 | VesicleForm(form_ves_SC,tmp_ves_SC_PQ,xw) |
---|
341 | HayterPenfoldMSA(struct_ves_SC,tmp_ves_SC_SQ,xw) |
---|
342 | yw = tmp_ves_SC_PQ * tmp_ves_SC_SQ |
---|
343 | yw *= w[0] |
---|
344 | yw += w[9] |
---|
345 | |
---|
346 | //cleanup waves |
---|
347 | //Killwaves/Z form_ves_SC,struct_ves_SC |
---|
348 | //Print "ps elapsed time = ",StopMSTimer(timer) |
---|
349 | return (0) |
---|
350 | End |
---|
351 | |
---|
352 | ///////////////////////////////// |
---|
353 | Proc PlotVesicle_SHS(num,qmin,qmax) |
---|
354 | Variable num=256,qmin=0.001,qmax=0.7 |
---|
355 | Prompt num "Enter number of data points for model: " |
---|
356 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
357 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
358 | |
---|
359 | /// |
---|
360 | Make/O/D/N=4 form_ves_SHS |
---|
361 | Make/O/D/N=4 struct_ves_SHS |
---|
362 | /// |
---|
363 | Make/O/D/n=(num) xwave_ves_SHS,ywave_ves_SHS |
---|
364 | xwave_ves_SHS = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
365 | Make/O/D coef_ves_SHS = {0.1,100,30,6.36e-6,0.5e-6,0.05,0.2,0} |
---|
366 | make/o/t parameters_ves_SHS = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","perturbation parameter (0.1)","stickiness, tau","bkgd (cm-1)"} |
---|
367 | Edit/K=1 parameters_ves_SHS,coef_ves_SHS |
---|
368 | |
---|
369 | Variable/G root:g_ves_SHS |
---|
370 | g_ves_SHS := Vesicle_SHS(coef_ves_SHS,ywave_ves_SHS,xwave_ves_SHS) |
---|
371 | Display/K=1 ywave_ves_SHS vs xwave_ves_SHS |
---|
372 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
373 | Label bottom "q (\\S-1\\M)" |
---|
374 | Label left "Intensity (cm\\S-1\\M)" |
---|
375 | |
---|
376 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
377 | AddModelToStrings("Vesicle_SHS","coef_ves_SHS","ves_SHS") |
---|
378 | End |
---|
379 | |
---|
380 | // - sets up a dependency to a wrapper, not the actual SmearedModelFunction |
---|
381 | Proc PlotSmearedVesicle_SHS(str) |
---|
382 | String str |
---|
383 | Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4) |
---|
384 | |
---|
385 | // if any of the resolution waves are missing => abort |
---|
386 | if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) |
---|
387 | Abort |
---|
388 | endif |
---|
389 | |
---|
390 | SetDataFolder $("root:"+str) |
---|
391 | |
---|
392 | // Setup parameter table for model function |
---|
393 | Make/O/D smear_coef_ves_SHS = {0.1,100,30,6.36e-6,0.5e-6,0.05,0.2,0} |
---|
394 | make/o/t smear_parameters_ves_SHS = {"Volume fraction","core radius (A)","shell thickness (A)","Core and Solvent SLD (A-2)","Shell SLD (A-2)","perturbation parameter (0.1)","stickiness, tau","bkgd (cm-1)"} |
---|
395 | Edit smear_parameters_ves_SHS,smear_coef_ves_SHS |
---|
396 | |
---|
397 | // output smeared intensity wave, dimensions are identical to experimental QSIG values |
---|
398 | // make extra copy of experimental q-values for easy plotting |
---|
399 | Duplicate/O $(str+"_q") smeared_ves_SHS,smeared_qvals |
---|
400 | SetScale d,0,0,"1/cm",smeared_ves_SHS |
---|
401 | |
---|
402 | Variable/G gs_ves_SHS=0 |
---|
403 | gs_ves_SHS := fSmearedVesicle_SHS(smear_coef_ves_SHS,smeared_ves_SHS,smeared_qvals) //this wrapper fills the STRUCT |
---|
404 | |
---|
405 | Display smeared_ves_SHS vs smeared_qvals |
---|
406 | ModifyGraph log=1,marker=29,msize=2,mode=4 |
---|
407 | Label bottom "q (\\S-1\\M)" |
---|
408 | Label left "Intensity (cm\\S-1\\M)" |
---|
409 | |
---|
410 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
411 | |
---|
412 | SetDataFolder root: |
---|
413 | AddModelToStrings("SmearedVesicle_SHS","smear_coef_ves_SHS","ves_SHS") |
---|
414 | End |
---|
415 | |
---|
416 | |
---|
417 | |
---|
418 | Function Vesicle_SHS(w,yw,xw) : FitFunc |
---|
419 | Wave w,yw,xw |
---|
420 | |
---|
421 | Variable inten |
---|
422 | |
---|
423 | //setup form factor coefficient wave |
---|
424 | Make/O/D/N=6 form_ves_SHS |
---|
425 | form_ves_SHS[0] = 1 |
---|
426 | form_ves_SHS[1] = w[1] |
---|
427 | form_ves_SHS[2] = w[2] |
---|
428 | form_ves_SHS[3] = w[3] |
---|
429 | form_ves_SHS[4] = w[4] |
---|
430 | form_ves_SHS[5] = 0 |
---|
431 | |
---|
432 | // calculate the excluded volume of the vesicles |
---|
433 | Variable totvol,core,shell,exclVol,nden |
---|
434 | totvol=4*pi/3*(w[1]+w[2])^3 |
---|
435 | core=4*pi/3*(w[1])^3 |
---|
436 | shell = totVol-core |
---|
437 | // nden = phi/(shell volume) or phi/Vtotal |
---|
438 | nden = w[0]/shell |
---|
439 | exclVol = nden*totvol |
---|
440 | |
---|
441 | //setup structure factor coefficient wave |
---|
442 | Make/O/D/N=4 struct_ves_SHS |
---|
443 | struct_ves_SHS[0] = w[1]+w[2] |
---|
444 | struct_ves_SHS[1] = exclVol |
---|
445 | struct_ves_SHS[2] = w[5] |
---|
446 | struct_ves_SHS[3] = w[6] |
---|
447 | |
---|
448 | //calculate each and combine |
---|
449 | Duplicate/O xw tmp_ves_SHS_PQ,tmp_ves_SHS_SQ |
---|
450 | VesicleForm(form_ves_SHS,tmp_ves_SHS_PQ,xw) |
---|
451 | StickyHS_Struct(struct_ves_SHS,tmp_ves_SHS_SQ,xw) |
---|
452 | yw = tmp_ves_SHS_PQ * tmp_ves_SHS_SQ |
---|
453 | yw *= w[0] |
---|
454 | yw += w[7] |
---|
455 | |
---|
456 | //cleanup waves |
---|
457 | //Killwaves/Z form_ves_SHS,struct_ves_SHS |
---|
458 | |
---|
459 | return (0) |
---|
460 | End |
---|
461 | |
---|
462 | |
---|
463 | |
---|
464 | // this is all there is to the smeared calculation! |
---|
465 | Function SmearedVesicle_HS(s) :FitFunc |
---|
466 | Struct ResSmearAAOStruct &s |
---|
467 | |
---|
468 | // the name of your unsmeared model (AAO) is the first argument |
---|
469 | Smear_Model_20(Vesicle_HS,s.coefW,s.xW,s.yW,s.resW) |
---|
470 | |
---|
471 | return(0) |
---|
472 | End |
---|
473 | |
---|
474 | // this is all there is to the smeared calculation! |
---|
475 | Function SmearedVesicle_SW(s) :FitFunc |
---|
476 | Struct ResSmearAAOStruct &s |
---|
477 | |
---|
478 | // the name of your unsmeared model (AAO) is the first argument |
---|
479 | Smear_Model_20(Vesicle_SW,s.coefW,s.xW,s.yW,s.resW) |
---|
480 | |
---|
481 | return(0) |
---|
482 | End |
---|
483 | |
---|
484 | // this is all there is to the smeared calculation! |
---|
485 | Function SmearedVesicle_SC(s) :FitFunc |
---|
486 | Struct ResSmearAAOStruct &s |
---|
487 | |
---|
488 | // the name of your unsmeared model (AAO) is the first argument |
---|
489 | Smear_Model_20(Vesicle_SC,s.coefW,s.xW,s.yW,s.resW) |
---|
490 | |
---|
491 | return(0) |
---|
492 | End |
---|
493 | |
---|
494 | // this is all there is to the smeared calculation! |
---|
495 | Function SmearedVesicle_SHS(s) :FitFunc |
---|
496 | Struct ResSmearAAOStruct &s |
---|
497 | |
---|
498 | // the name of your unsmeared model (AAO) is the first argument |
---|
499 | Smear_Model_20(Vesicle_SHS,s.coefW,s.xW,s.yW,s.resW) |
---|
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 fSmearedVesicle_HS(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 = SmearedVesicle_HS(fs) |
---|
525 | |
---|
526 | return (0) |
---|
527 | End |
---|
528 | |
---|
529 | |
---|
530 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
531 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
532 | // |
---|
533 | // used only for the dependency, not for fitting |
---|
534 | // |
---|
535 | Function fSmearedVesicle_SW(coefW,yW,xW) |
---|
536 | Wave coefW,yW,xW |
---|
537 | |
---|
538 | String str = getWavesDataFolder(yW,0) |
---|
539 | String DF="root:"+str+":" |
---|
540 | |
---|
541 | WAVE resW = $(DF+str+"_res") |
---|
542 | |
---|
543 | STRUCT ResSmearAAOStruct fs |
---|
544 | WAVE fs.coefW = coefW |
---|
545 | WAVE fs.yW = yW |
---|
546 | WAVE fs.xW = xW |
---|
547 | WAVE fs.resW = resW |
---|
548 | |
---|
549 | Variable err |
---|
550 | err = SmearedVesicle_SW(fs) |
---|
551 | |
---|
552 | return (0) |
---|
553 | End |
---|
554 | |
---|
555 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
556 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
557 | // |
---|
558 | // used only for the dependency, not for fitting |
---|
559 | // |
---|
560 | Function fSmearedVesicle_SC(coefW,yW,xW) |
---|
561 | Wave coefW,yW,xW |
---|
562 | |
---|
563 | String str = getWavesDataFolder(yW,0) |
---|
564 | String DF="root:"+str+":" |
---|
565 | |
---|
566 | WAVE resW = $(DF+str+"_res") |
---|
567 | |
---|
568 | STRUCT ResSmearAAOStruct fs |
---|
569 | WAVE fs.coefW = coefW |
---|
570 | WAVE fs.yW = yW |
---|
571 | WAVE fs.xW = xW |
---|
572 | WAVE fs.resW = resW |
---|
573 | |
---|
574 | Variable err |
---|
575 | err = SmearedVesicle_SC(fs) |
---|
576 | |
---|
577 | return (0) |
---|
578 | End |
---|
579 | |
---|
580 | //wrapper to calculate the smeared model as an AAO-Struct |
---|
581 | // fills the struct and calls the ususal function with the STRUCT parameter |
---|
582 | // |
---|
583 | // used only for the dependency, not for fitting |
---|
584 | // |
---|
585 | Function fSmearedVesicle_SHS(coefW,yW,xW) |
---|
586 | Wave coefW,yW,xW |
---|
587 | |
---|
588 | String str = getWavesDataFolder(yW,0) |
---|
589 | String DF="root:"+str+":" |
---|
590 | |
---|
591 | WAVE resW = $(DF+str+"_res") |
---|
592 | |
---|
593 | STRUCT ResSmearAAOStruct fs |
---|
594 | WAVE fs.coefW = coefW |
---|
595 | WAVE fs.yW = yW |
---|
596 | WAVE fs.xW = xW |
---|
597 | WAVE fs.resW = resW |
---|
598 | |
---|
599 | Variable err |
---|
600 | err = SmearedVesicle_SHS(fs) |
---|
601 | |
---|
602 | return (0) |
---|
603 | End |
---|
604 | |
---|