source: sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/OblateCoreShell_Sq_v40.ipf @ 774

Last change on this file since 774 was 774, checked in by srkline, 12 years ago

Added the Two-Yukawa structure factor calculations to those model functions with S(Q).

Fixed the name of Vesicle_UL_Sq.ipf to be consistent.

File size: 22.2 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma IgorVersion=6.1
3
4// be sure to include all of the necessary files
5
6#include "OblateCoreShell_v40"
7#include "EffectiveDiameter_v40"
8
9#include "HardSphereStruct_v40"
10#include "HPMSA_v40"
11#include "SquareWellStruct_v40"
12#include "StickyHardSphereStruct_v40"
13#include "Two_Yukawa_v40"
14
15Proc PlotOblate_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_OEF_HS,ywave_OEF_HS
22        xwave_OEF_HS =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
23        Make/O/D coef_OEF_HS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.0001}
24        make/o/t parameters_OEF_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)"}
25        Edit parameters_OEF_HS,coef_OEF_HS
26       
27        Variable/G root:g_OEF_HS
28        g_OEF_HS := Oblate_HS(coef_OEF_HS,ywave_OEF_HS,xwave_OEF_HS)
29        Display ywave_OEF_HS vs xwave_OEF_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
34        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
35       
36        AddModelToStrings("Oblate_HS","coef_OEF_HS","parameters_OEF_HS","OEF_HS")
37End
38
39// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
40Proc PlotSmearedOblate_HS(str)                                                         
41        String str
42        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
43       
44        // if any of the resolution waves are missing => abort
45        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
46                Abort
47        endif
48       
49        SetDataFolder $("root:"+str)
50       
51        // Setup parameter table for model function
52        Make/O/D smear_coef_OEF_HS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.0001}
53        make/o/t smear_parameters_OEF_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)"}
54        Edit smear_parameters_OEF_HS,smear_coef_OEF_HS                                 
55       
56        // output smeared intensity wave, dimensions are identical to experimental QSIG values
57        // make extra copy of experimental q-values for easy plotting
58        Duplicate/O $(str+"_q") smeared_OEF_HS,smeared_qvals                           
59        SetScale d,0,0,"1/cm",smeared_OEF_HS                                                   
60                                       
61        Variable/G gs_OEF_HS=0
62        gs_OEF_HS := fSmearedOblate_HS(smear_coef_OEF_HS,smeared_OEF_HS,smeared_qvals)  //this wrapper fills the STRUCT
63       
64        Display smeared_OEF_HS vs smeared_qvals                                                                 
65        ModifyGraph log=1,marker=29,msize=2,mode=4
66        Label bottom "q (A\\S-1\\M)"
67        Label left "Intensity (cm\\S-1\\M)"
68
69        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
70       
71        SetDataFolder root:
72        AddModelToStrings("SmearedOblate_HS","smear_coef_OEF_HS","smear_parameters_OEF_HS","OEF_HS")
73End
74       
75
76Function Oblate_HS(w,yw,xw) : FitFunc
77        Wave w,yw,xw
78       
79        Variable inten,Ras,Rbs
80        Ras = w[4]      //Ras is the rotation axis, the minor axis for an oblate ellipsoid
81        Rbs = w[3]
82       
83        //setup form factor coefficient wave
84        Make/O/D/N=9 form_OEF_HS
85        form_OEF_HS[0] = 1
86        form_OEF_HS[1] = w[1]
87        form_OEF_HS[2] = w[2]
88        form_OEF_HS[3] = w[3]
89        form_OEF_HS[4] = w[4]
90        form_OEF_HS[5] = w[5]
91        form_OEF_HS[6] = w[6]
92        form_OEF_HS[7] = w[7]
93        form_OEF_HS[8] = 0
94       
95        //setup structure factor coefficient wave
96        Make/O/D/N=2 struct_OEF_HS
97        struct_OEF_HS[0] = 0.5*DiamEllip(Ras,Rbs)
98        struct_OEF_HS[1] = w[0]
99       
100        //calculate each and combine
101        Duplicate/O xw temp_OEF_HS_PQ,temp_OEF_HS_SQ            //make waves for the AAO
102        OblateForm(form_OEF_HS,temp_OEF_HS_PQ,xw)
103        HardSphereStruct(struct_OEF_HS,temp_OEF_HS_SQ,xw)
104        yw = temp_OEF_HS_PQ * temp_OEF_HS_SQ
105        yw *= w[0]
106        yw += w[8]
107       
108        //cleanup waves
109//      Killwaves/Z form_OEF_HS,struct_OEF_HS
110       
111        return (0)
112End
113
114Proc PlotOblate_SW(num,qmin,qmax)
115        Variable num=128,qmin=0.001,qmax=0.7
116        Prompt num "Enter number of data points for model: "
117        Prompt qmin "Enter minimum q-value (A^-1) for model: "
118        Prompt qmax "Enter maximum q-value (A^-1) for model: "
119       
120        Make/O/D/n=(num) xwave_OEF_SW,ywave_OEF_SW
121        xwave_OEF_SW =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
122        Make/O/D coef_OEF_SW = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,1.0,1.2,0.0001}
123        make/o/t parameters_OEF_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)"}
124        Edit parameters_OEF_SW,coef_OEF_SW
125       
126        Variable/G root:g_OEF_SW
127        g_OEF_SW := Oblate_SW(coef_OEF_SW,ywave_OEF_SW,xwave_OEF_SW)
128        Display ywave_OEF_SW vs xwave_OEF_SW
129        ModifyGraph log=1,marker=29,msize=2,mode=4
130        Label bottom "q (A\\S-1\\M)"
131        Label left "Intensity (cm\\S-1\\M)"
132
133        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
134       
135        AddModelToStrings("Oblate_SW","coef_OEF_SW","parameters_OEF_SW","OEF_SW")
136End
137
138// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
139Proc PlotSmearedOblate_SW(str)                                                         
140        String str
141        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
142       
143        // if any of the resolution waves are missing => abort
144        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
145                Abort
146        endif
147       
148        SetDataFolder $("root:"+str)
149       
150        // Setup parameter table for model function
151        Make/O/D smear_coef_OEF_SW = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,1.0,1.2,0.0001}
152        make/o/t smear_parameters_OEF_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)"}
153        Edit smear_parameters_OEF_SW,smear_coef_OEF_SW                                 
154       
155        // output smeared intensity wave, dimensions are identical to experimental QSIG values
156        // make extra copy of experimental q-values for easy plotting
157        Duplicate/O $(str+"_q") smeared_OEF_SW,smeared_qvals                           
158        SetScale d,0,0,"1/cm",smeared_OEF_SW                                                   
159                                       
160        Variable/G gs_OEF_SW=0
161        gs_OEF_SW := fSmearedOblate_SW(smear_coef_OEF_SW,smeared_OEF_SW,smeared_qvals)  //this wrapper fills the STRUCT
162       
163        Display smeared_OEF_SW vs smeared_qvals                                                                 
164        ModifyGraph log=1,marker=29,msize=2,mode=4
165        Label bottom "q (A\\S-1\\M)"
166        Label left "Intensity (cm\\S-1\\M)"
167
168        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
169       
170        SetDataFolder root:
171        AddModelToStrings("SmearedOblate_SW","smear_coef_OEF_SW","smear_parameters_OEF_SW","OEF_SW")
172End
173
174
175Function Oblate_SW(w,yw,xw) : FitFunc
176        Wave w,yw,xw
177       
178        Variable inten,Ras,Rbs
179        Ras = w[4]      //Ras is the rotation axis
180        Rbs = w[3]
181       
182        //setup form factor coefficient wave
183        Make/O/D/N=9 form_OEF_SW
184        form_OEF_SW[0] = 1
185        form_OEF_SW[1] = w[1]
186        form_OEF_SW[2] = w[2]
187        form_OEF_SW[3] = w[3]
188        form_OEF_SW[4] = w[4]
189        form_OEF_SW[5] = w[5]
190        form_OEF_SW[6] = w[6]
191        form_OEF_SW[7] = w[7]
192        form_OEF_SW[8] = 0
193       
194        //setup structure factor coefficient wave
195        Make/O/D/N=4 struct_OEF_SW
196        struct_OEF_SW[0] = 0.5*DiamEllip(Ras,Rbs)
197        struct_OEF_SW[1] = w[0]
198        struct_OEF_SW[2] = w[8]
199        struct_OEF_SW[3] = w[9]
200       
201        //calculate each and combine
202        Duplicate/O xw temp_OEF_SW_PQ,temp_OEF_SW_SQ            //make waves for the AAO
203        OblateForm(form_OEF_SW,temp_OEF_SW_PQ,xw)
204        SquareWellStruct(struct_OEF_SW,temp_OEF_SW_SQ,xw)
205        yw = temp_OEF_SW_PQ * temp_OEF_SW_SQ
206        yw *= w[0]
207        yw += w[10]
208       
209        //cleanup waves
210//      Killwaves/Z form_OEF_SW,struct_OEF_SW
211       
212        return (0)
213End
214
215Proc PlotOblate_SC(num,qmin,qmax)
216        Variable num=128,qmin=0.001,qmax=0.7
217        Prompt num "Enter number of data points for model: "
218        Prompt qmin "Enter minimum q-value (A^-1) for model: "
219        Prompt qmax "Enter maximum q-value (A^-1) for model: "
220       
221        if(!DataFolderExists(":HayPenMSA"))
222                NewDataFolder :HayPenMSA
223        endif
224        Make/O/D/N=17 :HayPenMSA:gMSAWave
225       
226        Make/O/D/n=(num) xwave_OEF_SC,ywave_OEF_SC
227        xwave_OEF_SC =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
228        Make/O/D coef_OEF_SC = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,20,0,298,78,0.0001}
229        make/o/t parameters_OEF_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)"}
230        Edit parameters_OEF_SC,coef_OEF_SC
231       
232        Variable/G root:g_OEF_SC
233        g_OEF_SC := Oblate_SC(coef_OEF_SC,ywave_OEF_SC,xwave_OEF_SC)
234        Display ywave_OEF_SC vs xwave_OEF_SC
235        ModifyGraph log=1,marker=29,msize=2,mode=4
236        Label bottom "q (A\\S-1\\M)"
237        Label left "Intensity (cm\\S-1\\M)"
238
239        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
240       
241        AddModelToStrings("Oblate_SC","coef_OEF_SC","parameters_OEF_SC","OEF_SC")
242End
243
244// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
245Proc PlotSmearedOblate_SC(str)                                                         
246        String str
247        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
248       
249        // if any of the resolution waves are missing => abort
250        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
251                Abort
252        endif
253       
254        SetDataFolder $("root:"+str)
255       
256        if(!DataFolderExists(":HayPenMSA"))
257                NewDataFolder :HayPenMSA
258        endif
259        Make/O/D/N=17 :HayPenMSA:gMSAWave
260       
261        // Setup parameter table for model function
262        Make/O/D smear_coef_OEF_SC = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,20,0,298,78,0.0001}
263        make/o/t smear_parameters_OEF_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)"}
264        Edit smear_parameters_OEF_SC,smear_coef_OEF_SC                                 
265       
266        // output smeared intensity wave, dimensions are identical to experimental QSIG values
267        // make extra copy of experimental q-values for easy plotting
268        Duplicate/O $(str+"_q") smeared_OEF_SC,smeared_qvals                           
269        SetScale d,0,0,"1/cm",smeared_OEF_SC                                                   
270                                       
271        Variable/G gs_OEF_SC=0
272        gs_OEF_SC := fSmearedOblate_SC(smear_coef_OEF_SC,smeared_OEF_SC,smeared_qvals)  //this wrapper fills the STRUCT
273       
274        Display smeared_OEF_SC vs smeared_qvals                                                                 
275        ModifyGraph log=1,marker=29,msize=2,mode=4
276        Label bottom "q (A\\S-1\\M)"
277        Label left "Intensity (cm\\S-1\\M)"
278
279        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
280       
281        SetDataFolder root:
282        AddModelToStrings("SmearedOblate_SC","smear_coef_OEF_SC","smear_parameters_OEF_SC","OEF_SC")
283End
284
285
286Function Oblate_SC(w,yw,xw) : FitFunc
287        Wave w,yw,xw
288       
289        Variable inten,Ras,Rbs
290        Ras = w[4]      //Ras is the rotation axis
291        Rbs = w[3]
292       
293        //setup form factor coefficient wave
294        Make/O/D/N=9 form_OEF_SC
295        form_OEF_SC[0] = 1
296        form_OEF_SC[1] = w[1]
297        form_OEF_SC[2] = w[2]
298        form_OEF_SC[3] = w[3]
299        form_OEF_SC[4] = w[4]
300        form_OEF_SC[5] = w[5]
301        form_OEF_SC[6] = w[6]
302        form_OEF_SC[7] = w[7]
303        form_OEF_SC[8] = 0
304       
305        //setup structure factor coefficient wave
306        Make/O/D/N=6 struct_OEF_SC
307        struct_OEF_SC[0] = DiamEllip(Ras,Rbs)
308        struct_OEF_SC[1] = w[8]
309        struct_OEF_SC[2] = w[0]
310        struct_OEF_SC[3] = w[10]
311        struct_OEF_SC[4] = w[9]
312        struct_OEF_SC[5] = w[11]
313       
314        //calculate each and combine
315        Duplicate/O xw temp_OEF_SC_PQ,temp_OEF_SC_SQ            //make waves for the AAO
316        OblateForm(form_OEF_SC,temp_OEF_SC_PQ,xw)
317        HayterPenfoldMSA(struct_OEF_SC,temp_OEF_SC_SQ,xw)
318        yw = temp_OEF_SC_PQ * temp_OEF_SC_SQ
319        yw *= w[0]
320        yw += w[12]
321       
322        //cleanup waves
323//      Killwaves/Z form_OEF_SC,struct_OEF_SC
324       
325        return (0)
326End
327
328
329Proc PlotOblate_SHS(num,qmin,qmax)
330        Variable num=128,qmin=0.001,qmax=0.7
331        Prompt num "Enter number of data points for model: "
332        Prompt qmin "Enter minimum q-value (A^-1) for model: "
333        Prompt qmax "Enter maximum q-value (A^-1) for model: "
334       
335        Make/O/D/n=(num) xwave_OEF_SHS,ywave_OEF_SHS
336        xwave_OEF_SHS =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
337        Make/O/D coef_OEF_SHS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.05,0.2,0.0001}
338        make/o/t parameters_OEF_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)"}
339        Edit parameters_OEF_SHS,coef_OEF_SHS
340       
341        Variable/G root:g_OEF_SHS
342        g_OEF_SHS := Oblate_SHS(coef_OEF_SHS,ywave_OEF_SHS,xwave_OEF_SHS)
343        Display ywave_OEF_SHS vs xwave_OEF_SHS
344        ModifyGraph log=1,marker=29,msize=2,mode=4
345        Label bottom "q (A\\S-1\\M)"
346        Label left "Intensity (cm\\S-1\\M)"
347
348        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
349       
350        AddModelToStrings("Oblate_SHS","coef_OEF_SHS","parameters_OEF_SHS","OEF_SHS")
351End
352
353// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
354Proc PlotSmearedOblate_SHS(str)                                                         
355        String str
356        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
357       
358        // if any of the resolution waves are missing => abort
359        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
360                Abort
361        endif
362       
363        SetDataFolder $("root:"+str)
364       
365        // Setup parameter table for model function
366        Make/O/D smear_coef_OEF_SHS = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,0.05,0.2,0.0001}
367        make/o/t smear_parameters_OEF_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)"}
368        Edit smear_parameters_OEF_SHS,smear_coef_OEF_SHS                                       
369       
370        // output smeared intensity wave, dimensions are identical to experimental QSIG values
371        // make extra copy of experimental q-values for easy plotting
372        Duplicate/O $(str+"_q") smeared_OEF_SHS,smeared_qvals                           
373        SetScale d,0,0,"1/cm",smeared_OEF_SHS                                                   
374                                       
375        Variable/G gs_OEF_SHS=0
376        gs_OEF_SHS := fSmearedOblate_SHS(smear_coef_OEF_SHS,smeared_OEF_SHS,smeared_qvals)      //this wrapper fills the STRUCT
377       
378        Display smeared_OEF_SHS vs smeared_qvals                                                                       
379        ModifyGraph log=1,marker=29,msize=2,mode=4
380        Label bottom "q (A\\S-1\\M)"
381        Label left "Intensity (cm\\S-1\\M)"
382
383        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
384       
385        SetDataFolder root:
386        AddModelToStrings("SmearedOblate_SHS","smear_coef_OEF_SHS","smear_parameters_OEF_SHS","OEF_SHS")
387End
388       
389
390Function Oblate_SHS(w,yw,xw) : FitFunc
391        Wave w,yw,xw
392       
393        Variable inten,Ras,Rbs
394        Ras = w[4]      //Ras is the rotation axis
395        Rbs = w[3]
396       
397        //setup form factor coefficient wave
398        Make/O/D/N=9 form_OEF_SHS
399        form_OEF_SHS[0] = 1
400        form_OEF_SHS[1] = w[1]
401        form_OEF_SHS[2] = w[2]
402        form_OEF_SHS[3] = w[3]
403        form_OEF_SHS[4] = w[4]
404        form_OEF_SHS[5] = w[5]
405        form_OEF_SHS[6] = w[6]
406        form_OEF_SHS[7] = w[7]
407        form_OEF_SHS[8] = 0
408       
409        //setup structure factor coefficient wave
410        Make/O/D/N=4 struct_OEF_SHS
411        struct_OEF_SHS[0] = 0.5*DiamEllip(Ras,Rbs)
412        struct_OEF_SHS[1] = w[0]
413        struct_OEF_SHS[2] = w[8]
414        struct_OEF_SHS[3] = w[9]
415       
416        //calculate each and combine
417        Duplicate/O xw temp_OEF_SHS_PQ,temp_OEF_SHS_SQ          //make waves for the AAO
418        OblateForm(form_OEF_SHS,temp_OEF_SHS_PQ,xw)
419        StickyHS_Struct(struct_OEF_SHS,temp_OEF_SHS_SQ,xw)
420        yw = temp_OEF_SHS_PQ * temp_OEF_SHS_SQ
421        yw *= w[0]
422        yw += w[10]
423       
424        //cleanup waves
425//      Killwaves/Z form_OEF_SHS,struct_OEF_SHS
426       
427        return (0)
428End
429
430//two yukawa
431Proc PlotOblate_2Y(num,qmin,qmax)
432        Variable num=128,qmin=0.001,qmax=0.7
433        Prompt num "Enter number of data points for model: "
434        Prompt qmin "Enter minimum q-value (A^-1) for model: "
435        Prompt qmax "Enter maximum q-value (A^-1) for model: "
436       
437        Make/O/D/n=(num) xwave_OEF_2Y,ywave_OEF_2Y
438        xwave_OEF_2Y =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
439        Make/O/D coef_OEF_2Y = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,6,10,-1,2,0.0001}
440        make/o/t parameters_OEF_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)"}
441        Edit parameters_OEF_2Y,coef_OEF_2Y
442       
443        Variable/G root:g_OEF_2Y
444        g_OEF_2Y := Oblate_2Y(coef_OEF_2Y,ywave_OEF_2Y,xwave_OEF_2Y)
445        Display ywave_OEF_2Y vs xwave_OEF_2Y
446        ModifyGraph log=1,marker=29,msize=2,mode=4
447        Label bottom "q (A\\S-1\\M)"
448        Label left "Intensity (cm\\S-1\\M)"
449
450        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
451       
452        AddModelToStrings("Oblate_2Y","coef_OEF_2Y","parameters_OEF_2Y","OEF_2Y")
453End
454
455// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
456Proc PlotSmearedOblate_2Y(str)                                                         
457        String str
458        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
459       
460        // if any of the resolution waves are missing => abort
461        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
462                Abort
463        endif
464       
465        SetDataFolder $("root:"+str)
466       
467        // Setup parameter table for model function
468        Make/O/D smear_coef_OEF_2Y = {0.01,100,50,110,60,1e-6,2e-6,6.3e-6,6,10,-1,2,0.0001}
469        make/o/t smear_parameters_OEF_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)"}
470        Edit smear_parameters_OEF_2Y,smear_coef_OEF_2Y                                 
471       
472        // output smeared intensity wave, dimensions are identical to experimental QSIG values
473        // make extra copy of experimental q-values for easy plotting
474        Duplicate/O $(str+"_q") smeared_OEF_2Y,smeared_qvals                           
475        SetScale d,0,0,"1/cm",smeared_OEF_2Y                                                   
476                                       
477        Variable/G gs_OEF_2Y=0
478        gs_OEF_2Y := fSmearedOblate_2Y(smear_coef_OEF_2Y,smeared_OEF_2Y,smeared_qvals)  //this wrapper fills the STRUCT
479       
480        Display smeared_OEF_2Y vs smeared_qvals                                                                 
481        ModifyGraph log=1,marker=29,msize=2,mode=4
482        Label bottom "q (A\\S-1\\M)"
483        Label left "Intensity (cm\\S-1\\M)"
484
485        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
486       
487        SetDataFolder root:
488        AddModelToStrings("SmearedOblate_2Y","smear_coef_OEF_2Y","smear_parameters_OEF_2Y","OEF_2Y")
489End
490       
491
492Function Oblate_2Y(w,yw,xw) : FitFunc
493        Wave w,yw,xw
494       
495        Variable inten,Ras,Rbs
496        Ras = w[4]      //Ras is the rotation axis, the minor axis for an oblate ellipsoid
497        Rbs = w[3]
498       
499        //setup form factor coefficient wave
500        Make/O/D/N=9 form_OEF_2Y
501        form_OEF_2Y[0] = 1
502        form_OEF_2Y[1] = w[1]
503        form_OEF_2Y[2] = w[2]
504        form_OEF_2Y[3] = w[3]
505        form_OEF_2Y[4] = w[4]
506        form_OEF_2Y[5] = w[5]
507        form_OEF_2Y[6] = w[6]
508        form_OEF_2Y[7] = w[7]
509        form_OEF_2Y[8] = 0
510       
511        //setup structure factor coefficient wave
512        Make/O/D/N=6 struct_OEF_2Y
513        struct_OEF_2Y[0] = w[0]
514        struct_OEF_2Y[1] = 0.5*DiamEllip(Ras,Rbs)
515        struct_OEF_2Y[2] = w[8]
516        struct_OEF_2Y[3] = w[9]
517        struct_OEF_2Y[4] = w[10]
518        struct_OEF_2Y[5] = w[11]
519       
520        //calculate each and combine
521        Duplicate/O xw temp_OEF_2Y_PQ,temp_OEF_2Y_SQ            //make waves for the AAO
522        OblateForm(form_OEF_2Y,temp_OEF_2Y_PQ,xw)
523        TwoYukawa(struct_OEF_2Y,temp_OEF_2Y_SQ,xw)
524        yw = temp_OEF_2Y_PQ * temp_OEF_2Y_SQ
525        yw *= w[0]
526        yw += w[12]
527       
528        //cleanup waves
529//      Killwaves/Z form_OEF_2Y,struct_OEF_2Y
530       
531        return (0)
532End
533
534// this is all there is to the smeared calculation!
535Function SmearedOblate_HS(s) :FitFunc
536        Struct ResSmearAAOStruct &s
537
538//      the name of your unsmeared model is the first argument
539        Smear_Model_20(Oblate_HS,s.coefW,s.xW,s.yW,s.resW)
540
541        return(0)
542End
543
544// this is all there is to the smeared calculation!
545Function SmearedOblate_SW(s) :FitFunc
546        Struct ResSmearAAOStruct &s
547
548//      the name of your unsmeared model is the first argument
549        Smear_Model_20(Oblate_SW,s.coefW,s.xW,s.yW,s.resW)
550
551        return(0)
552End
553
554// this is all there is to the smeared calculation!
555Function SmearedOblate_SC(s) :FitFunc
556        Struct ResSmearAAOStruct &s
557
558//      the name of your unsmeared model is the first argument
559        Smear_Model_20(Oblate_SC,s.coefW,s.xW,s.yW,s.resW)
560
561        return(0)
562End
563
564// this is all there is to the smeared calculation!
565Function SmearedOblate_SHS(s) :FitFunc
566        Struct ResSmearAAOStruct &s
567
568//      the name of your unsmeared model is the first argument
569        Smear_Model_20(Oblate_SHS,s.coefW,s.xW,s.yW,s.resW)
570
571        return(0)
572End
573
574// this is all there is to the smeared calculation!
575Function SmearedOblate_2Y(s) :FitFunc
576        Struct ResSmearAAOStruct &s
577
578//      the name of your unsmeared model is the first argument
579        Smear_Model_20(Oblate_2Y,s.coefW,s.xW,s.yW,s.resW)
580
581        return(0)
582End
583
584//wrapper to calculate the smeared model as an AAO-Struct
585// fills the struct and calls the ususal function with the STRUCT parameter
586//
587// used only for the dependency, not for fitting
588//
589Function fSmearedOblate_HS(coefW,yW,xW)
590        Wave coefW,yW,xW
591       
592        String str = getWavesDataFolder(yW,0)
593        String DF="root:"+str+":"
594       
595        WAVE resW = $(DF+str+"_res")
596       
597        STRUCT ResSmearAAOStruct fs
598        WAVE fs.coefW = coefW   
599        WAVE fs.yW = yW
600        WAVE fs.xW = xW
601        WAVE fs.resW = resW
602       
603        Variable err
604        err = SmearedOblate_HS(fs)
605       
606        return (0)
607End
608
609//wrapper to calculate the smeared model as an AAO-Struct
610// fills the struct and calls the ususal function with the STRUCT parameter
611//
612// used only for the dependency, not for fitting
613//
614Function fSmearedOblate_SW(coefW,yW,xW)
615        Wave coefW,yW,xW
616       
617        String str = getWavesDataFolder(yW,0)
618        String DF="root:"+str+":"
619       
620        WAVE resW = $(DF+str+"_res")
621       
622        STRUCT ResSmearAAOStruct fs
623        WAVE fs.coefW = coefW   
624        WAVE fs.yW = yW
625        WAVE fs.xW = xW
626        WAVE fs.resW = resW
627       
628        Variable err
629        err = SmearedOblate_SW(fs)
630       
631        return (0)
632End
633
634//wrapper to calculate the smeared model as an AAO-Struct
635// fills the struct and calls the ususal function with the STRUCT parameter
636//
637// used only for the dependency, not for fitting
638//
639Function fSmearedOblate_SC(coefW,yW,xW)
640        Wave coefW,yW,xW
641       
642        String str = getWavesDataFolder(yW,0)
643        String DF="root:"+str+":"
644       
645        WAVE resW = $(DF+str+"_res")
646       
647        STRUCT ResSmearAAOStruct fs
648        WAVE fs.coefW = coefW   
649        WAVE fs.yW = yW
650        WAVE fs.xW = xW
651        WAVE fs.resW = resW
652       
653        Variable err
654        err = SmearedOblate_SC(fs)
655       
656        return (0)
657End
658
659//wrapper to calculate the smeared model as an AAO-Struct
660// fills the struct and calls the ususal function with the STRUCT parameter
661//
662// used only for the dependency, not for fitting
663//
664Function fSmearedOblate_SHS(coefW,yW,xW)
665        Wave coefW,yW,xW
666       
667        String str = getWavesDataFolder(yW,0)
668        String DF="root:"+str+":"
669       
670        WAVE resW = $(DF+str+"_res")
671       
672        STRUCT ResSmearAAOStruct fs
673        WAVE fs.coefW = coefW   
674        WAVE fs.yW = yW
675        WAVE fs.xW = xW
676        WAVE fs.resW = resW
677       
678        Variable err
679        err = SmearedOblate_SHS(fs)
680       
681        return (0)
682End
683
684//wrapper to calculate the smeared model as an AAO-Struct
685// fills the struct and calls the ususal function with the STRUCT parameter
686//
687// used only for the dependency, not for fitting
688//
689Function fSmearedOblate_2Y(coefW,yW,xW)
690        Wave coefW,yW,xW
691       
692        String str = getWavesDataFolder(yW,0)
693        String DF="root:"+str+":"
694       
695        WAVE resW = $(DF+str+"_res")
696       
697        STRUCT ResSmearAAOStruct fs
698        WAVE fs.coefW = coefW   
699        WAVE fs.yW = yW
700        WAVE fs.xW = xW
701        WAVE fs.resW = resW
702       
703        Variable err
704        err = SmearedOblate_2Y(fs)
705       
706        return (0)
707End
Note: See TracBrowser for help on using the repository browser.