source: sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/NewModels_2009/FuzzySpheres_Sq_v40.ipf @ 682

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

fixed the P*S combinations in Fuzzy Spheres.

File size: 19.4 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma IgorVersion=6.1
3
4
5// plots the form factor of spheres with a Gaussian radius distribution
6// and a fuzzy surface
7//
8// M. Stieger, J. S. Pedersen, P. Lindner, W. Richtering, Langmuir 20 (2004) 7283-7292.
9//
10// potentially a lorentzian could be added to the low Q, if absolutely necessary
11//
12// SRK JUL 2009
13//
14// Use different volume fraction and radius for hard sphere interaction as Stieger et al.
15//
16//
17// AJJ Feb 2010
18// added the lorentzian SRK APR 2010. this is a little different than other P*S, since the
19// Lorentzian is not scaled by phi, but rather is added on to the high q independently.
20// -- so it must be tacked on at the end, just like the form factor
21
22
23//
24// be sure to include all of the necessary files
25//
26#include "FuzzySpheres_v40"
27
28#include "HardSphereStruct_v40"
29#include "HPMSA_v40"
30#include "SquareWellStruct_v40"
31#include "StickyHardSphereStruct_v40"
32
33Proc PlotFuzzySphere_HS(num,qmin,qmax)
34        Variable num=128,qmin=0.001,qmax=0.7
35        Prompt num "Enter number of data points for model: "
36        Prompt qmin "Enter minimum q-value (A^-1) for model: "
37        Prompt qmax "Enter maximum q-value (A^-1) for model: "
38       
39        Make/O/D/N=(num) xwave_fuzz_HS,ywave_fuzz_HS
40        xwave_fuzz_HS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) )
41        Make/O/D coef_fuzz_HS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.001}
42        make/O/T parameters_fuzz_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","bkg (cm-1 sr-1)"}
43        Edit parameters_fuzz_HS,coef_fuzz_HS
44       
45        Variable/G root:g_fuzz_HS
46        g_fuzz_HS := FuzzySphere_HS(coef_fuzz_HS,ywave_fuzz_HS,xwave_fuzz_HS)
47        Display ywave_fuzz_HS vs xwave_fuzz_HS
48        ModifyGraph log=1,marker=29,msize=2,mode=4
49        Label bottom "q (A\\S-1\\M)"
50        Label left "Intensity (cm\\S-1\\M)"
51        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
52       
53        AddModelToStrings("FuzzySphere_HS","coef_fuzz_HS","parameters_fuzz_HS","fuzz_HS")
54End
55
56// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
57Proc PlotSmearedFuzzySphere_HS(str)                                                             
58        String str
59        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
60       
61        // if any of the resolution waves are missing => abort
62        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
63                Abort
64        endif
65       
66        SetDataFolder $("root:"+str)
67       
68        // Setup parameter table for model function
69        Make/O/D smear_coef_fuzz_HS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.001}                                     
70        make/o/t smear_parameters_fuzz_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","bkg (cm-1 sr-1)"}     
71        Edit smear_parameters_fuzz_HS,smear_coef_fuzz_HS                                       
72       
73        // output smeared intensity wave, dimensions are identical to experimental QSIG values
74        // make extra copy of experimental q-values for easy plotting
75        Duplicate/O $(str+"_q") smeared_fuzz_HS,smeared_qvals                           
76        SetScale d,0,0,"1/cm",smeared_fuzz_HS                                                   
77                                       
78        Variable/G gs_fuzz_HS=0
79        gs_fuzz_HS := fSmearedFuzzySphere_HS(smear_coef_fuzz_HS,smeared_fuzz_HS,smeared_qvals)  //this wrapper fills the STRUCT
80       
81        Display smeared_fuzz_HS vs smeared_qvals                                                                       
82        ModifyGraph log=1,marker=29,msize=2,mode=4
83        Label bottom "q (A\\S-1\\M)"
84        Label left "Intensity (cm\\S-1\\M)"
85        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
86       
87        SetDataFolder root:
88        AddModelToStrings("SmearedFuzzySphere_HS","smear_coef_fuzz_HS","smear_parameters_fuzz_HS","fuzz_HS")
89End
90
91
92
93Function FuzzySphere_HS(w,yw,xw) : FitFunc
94        Wave w,yw,xw
95       
96        Variable inten
97       
98        //setup form factor coefficient wave
99        Make/O/D/N=9 form_fuzz_HS
100        form_fuzz_HS[0] = w[0]          // send the real volume fraction in here, so the scaling is done correctly
101        form_fuzz_HS[1] = w[1]
102        form_fuzz_HS[2] = w[2]
103        form_fuzz_HS[3] = w[3]
104        form_fuzz_HS[4] = w[4]
105        form_fuzz_HS[5] = w[5]
106        form_fuzz_HS[6] = w[6]                  // w[6] is  the Lorentzian scale
107        form_fuzz_HS[7] = w[7]
108        form_fuzz_HS[8] = 0
109       
110        //calculate the diameter of the effective one-component sphere
111        Variable pd,diam,Vpoly,Ravg
112        pd = w[2]
113        Ravg = w[1]
114       
115        Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2)
116        diam = (6*Vpoly/pi)^(1/3)
117       
118       
119        //setup structure factor coefficient wave
120        Make/O/D/N=2 struct_fuzz_HS
121        struct_fuzz_HS[0] = diam/2
122        struct_fuzz_HS[1] = w[0]
123       
124        //calculate each and combine
125        Duplicate/O xw tmp_fuzz_HS_PQ,tmp_fuzz_HS_SQ
126        FuzzySpheres(form_fuzz_HS,tmp_fuzz_HS_PQ,xw)
127
128        HardSphereStruct(struct_fuzz_HS,tmp_fuzz_HS_SQ,xw)
129        yw = tmp_fuzz_HS_PQ * tmp_fuzz_HS_SQ
130       
131//      yw *= w[0]              // scaling is done in FuzzySpheres
132        yw += w[8]
133       
134        //cleanup waves
135//      Killwaves/Z form_fuzz_HS,struct_fuzz_HS
136       
137        return (0)
138End
139
140/////////////////////////////////////////
141Proc PlotFuzzySphere_SW(num,qmin,qmax)
142        Variable num=128,qmin=0.001,qmax=0.7
143        Prompt num "Enter number of data points for model: "
144        Prompt qmin "Enter minimum q-value (A^-1) for model: "
145        Prompt qmax "Enter maximum q-value (A^-1) for model: "
146       
147        Make/O/D/N=(num) xwave_fuzz_SW,ywave_fuzz_SW
148        xwave_fuzz_SW = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) )
149        Make/O/D coef_fuzz_SW = {0.01,60,0.2,10,1e-6,3e-6,1,50,1.0,1.2,0.001}
150        make/O/T parameters_fuzz_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"}
151        Edit parameters_fuzz_SW,coef_fuzz_SW
152       
153        Variable/G root:g_fuzz_SW
154        g_fuzz_SW := FuzzySphere_SW(coef_fuzz_SW,ywave_fuzz_SW,xwave_fuzz_SW)
155        Display ywave_fuzz_SW vs xwave_fuzz_SW
156        ModifyGraph log=1,marker=29,msize=2,mode=4
157        Label bottom "q (A\\S-1\\M)"
158        Label left "Intensity (cm\\S-1\\M)"
159        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
160       
161        AddModelToStrings("FuzzySphere_SW","coef_fuzz_SW","parameters_fuzz_SW","fuzz_SW")
162End
163
164// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
165Proc PlotSmearedFuzzySphere_SW(str)                                                             
166        String str
167        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
168       
169        // if any of the resolution waves are missing => abort
170        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
171                Abort
172        endif
173       
174        SetDataFolder $("root:"+str)
175       
176        // Setup parameter table for model function
177        Make/O/D smear_coef_fuzz_SW = {0.01,60,0.2,10,1e-6,3e-6,1,50,1.0,1.2,0.001}                                     
178        make/o/t smear_parameters_fuzz_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"}       
179        Edit smear_parameters_fuzz_SW,smear_coef_fuzz_SW                                       
180       
181        // output smeared intensity wave, dimensions are identical to experimental QSIG values
182        // make extra copy of experimental q-values for easy plotting
183        Duplicate/O $(str+"_q") smeared_fuzz_SW,smeared_qvals                           
184        SetScale d,0,0,"1/cm",smeared_fuzz_SW                                                   
185                                       
186        Variable/G gs_fuzz_SW=0
187        gs_fuzz_SW := fSmearedFuzzySphere_SW(smear_coef_fuzz_SW,smeared_fuzz_SW,smeared_qvals)  //this wrapper fills the STRUCT
188       
189        Display smeared_fuzz_SW vs smeared_qvals                                                                       
190        ModifyGraph log=1,marker=29,msize=2,mode=4
191        Label bottom "q (A\\S-1\\M)"
192        Label left "Intensity (cm\\S-1\\M)"
193        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
194       
195        SetDataFolder root:
196        AddModelToStrings("SmearedFuzzySphere_SW","smear_coef_fuzz_SW","smear_parameters_fuzz_SW","fuzz_SW")
197End
198       
199
200Function FuzzySphere_SW(w,yw,xw) : FitFunc
201        Wave w,yw,xw
202       
203        Variable inten
204       
205        //setup form factor coefficient wave
206        Make/O/D/N=9 form_fuzz_SW
207        form_fuzz_SW[0] = w[0]
208        form_fuzz_SW[1] = w[1]
209        form_fuzz_SW[2] = w[2]
210        form_fuzz_SW[3] = w[3]
211        form_fuzz_SW[4] = w[4]
212        form_fuzz_SW[5] = w[5]
213        form_fuzz_SW[6] = w[6]
214        form_fuzz_SW[7] = w[7]
215        form_fuzz_SW[8] = 0
216       
217        //calculate the diameter of the effective one-component sphere
218        Variable pd,diam,Vpoly,Ravg
219        pd = w[2]
220        Ravg = w[1]
221       
222        Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2)
223        diam = (6*Vpoly/pi)^(1/3)
224       
225        //setup structure factor coefficient wave
226        Make/O/D/N=4 struct_fuzz_SW
227        struct_fuzz_SW[0] = diam/2
228        struct_fuzz_SW[1] = w[0]
229        struct_fuzz_SW[2] = w[8]
230        struct_fuzz_SW[3] = w[9]
231       
232        //calculate each and combine
233        Duplicate/O xw tmp_fuzz_SW_PQ,tmp_fuzz_SW_SQ
234        FuzzySpheres(form_fuzz_SW,tmp_fuzz_SW_PQ,xw)
235        SquareWellStruct(struct_fuzz_SW,tmp_fuzz_SW_SQ,xw)
236        yw = tmp_fuzz_SW_PQ * tmp_fuzz_SW_SQ
237       
238//      yw *= w[0]              // scaling is done in FuzzySpheres
239        yw += w[10]
240       
241        //cleanup waves
242//      Killwaves/Z form_fuzz_SW,struct_fuzz_SW
243       
244        return (0)
245End
246
247
248/////////////////////////////////////////
249Proc PlotFuzzySphere_SC(num,qmin,qmax)
250        Variable num=256,qmin=0.001,qmax=0.7
251        Prompt num "Enter number of data points for model: "
252        Prompt qmin "Enter minimum q-value (A^-1) for model: "
253        Prompt qmax "Enter maximum q-value (A^-1) for model: "
254       
255        if(!DataFolderExists(":HayPenMSA"))
256                NewDataFolder :HayPenMSA
257        endif
258        Make/O/D/N=17 :HayPenMSA:gMSAWave
259
260        Make/O/D/N=(num) xwave_fuzz_SC,ywave_fuzz_SC
261        xwave_fuzz_SC = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) )
262        Make/O/D coef_fuzz_SC = {0.01,60,0.2,10,1e-6,3e-6,1,50,20,0,298,78,0.001}
263        make/O/T parameters_fuzz_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"}
264        Edit parameters_fuzz_SC,coef_fuzz_SC
265       
266        Variable/G root:g_fuzz_SC
267        g_fuzz_SC := FuzzySphere_SC(coef_fuzz_SC,ywave_fuzz_SC,xwave_fuzz_SC)
268        Display ywave_fuzz_SC vs xwave_fuzz_SC
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        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
273       
274        AddModelToStrings("FuzzySphere_SC","coef_fuzz_SC","parameters_fuzz_SC","fuzz_SC")
275End
276
277// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
278Proc PlotSmearedFuzzySphere_SC(str)                                                             
279        String str
280        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
281       
282        // if any of the resolution waves are missing => abort
283        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
284                Abort
285        endif
286       
287        SetDataFolder $("root:"+str)
288       
289        if(!DataFolderExists(":HayPenMSA"))
290                NewDataFolder :HayPenMSA
291        endif
292        Make/O/D/N=17 :HayPenMSA:gMSAWave
293       
294        // Setup parameter table for model function
295        Make/O/D smear_coef_fuzz_SC = {0.01,60,0.2,10,1e-6,3e-6,1,50,20,0,298,78,0.001}                                 
296        make/o/t smear_parameters_fuzz_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"}     
297        Edit smear_parameters_fuzz_SC,smear_coef_fuzz_SC                                       
298       
299        // output smeared intensity wave, dimensions are identical to experimental QSIG values
300        // make extra copy of experimental q-values for easy plotting
301        Duplicate/O $(str+"_q") smeared_fuzz_SC,smeared_qvals                           
302        SetScale d,0,0,"1/cm",smeared_fuzz_SC                                                   
303                                       
304        Variable/G gs_fuzz_SC=0
305        gs_fuzz_SC := fSmearedFuzzySphere_SC(smear_coef_fuzz_SC,smeared_fuzz_SC,smeared_qvals)  //this wrapper fills the STRUCT
306       
307        Display smeared_fuzz_SC vs smeared_qvals                                                                       
308        ModifyGraph log=1,marker=29,msize=2,mode=4
309        Label bottom "q (A\\S-1\\M)"
310        Label left "Intensity (cm\\S-1\\M)"
311        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
312       
313        SetDataFolder root:
314        AddModelToStrings("SmearedFuzzySphere_SC","smear_coef_fuzz_SC","smear_parameters_fuzz_SC","fuzz_SC")
315End
316
317
318Function FuzzySphere_SC(w,yw,xw) : FitFunc
319        Wave w,yw,xw
320       
321        Variable inten
322       
323        //setup form factor coefficient wave
324        Make/O/D/N=9 form_fuzz_SC
325        form_fuzz_SC[0] = w[0]
326        form_fuzz_SC[1] = w[1]
327        form_fuzz_SC[2] = w[2]
328        form_fuzz_SC[3] = w[3]
329        form_fuzz_SC[4] = w[4]
330        form_fuzz_SC[5] = w[5]
331        form_fuzz_SC[6] = w[6]
332        form_fuzz_SC[7] = w[7]
333        form_fuzz_SC[8] = 0
334       
335        //calculate the diameter of the effective one-component sphere
336        Variable pd,diam,Vpoly,Ravg
337        pd = w[2]
338        Ravg = w[1]
339       
340        Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2)
341        diam = (6*Vpoly/pi)^(1/3)
342       
343        //setup structure factor coefficient wave
344        Make/O/D/N=6 struct_fuzz_SC
345        struct_fuzz_SC[0] = diam
346        struct_fuzz_SC[1] = w[8]
347        struct_fuzz_SC[2] = w[0]
348        struct_fuzz_SC[3] = w[10]
349        struct_fuzz_SC[4] = w[9]
350        struct_fuzz_SC[5] = w[11]
351       
352        //calculate each and combine
353        Duplicate/O xw tmp_fuzz_SC_PQ,tmp_fuzz_SC_SQ
354        FuzzySpheres(form_fuzz_SC,tmp_fuzz_SC_PQ,xw)
355        HayterPenfoldMSA(struct_fuzz_SC,tmp_fuzz_SC_SQ,xw)
356        yw = tmp_fuzz_SC_PQ * tmp_fuzz_SC_SQ
357       
358//      yw *= w[0]              // scaling is done in FuzzySpheres
359        yw += w[12]
360       
361        //cleanup waves
362//      Killwaves/Z form_fuzz_SC,struct_fuzz_SC
363       
364        return (0)
365End
366
367/////////////////////////////////////////
368Proc PlotFuzzySphere_SHS(num,qmin,qmax)
369        Variable num=256,qmin=0.001,qmax=0.7
370        Prompt num "Enter number of data points for model: "
371        Prompt qmin "Enter minimum q-value (A^-1) for model: "
372        Prompt qmax "Enter maximum q-value (A^-1) for model: "
373       
374        Make/O/D/N=(num) xwave_fuzz_SHS,ywave_fuzz_SHS
375        xwave_fuzz_SHS = alog( log(qmin) + x*((log(qmax)-log(qmin))/num) )
376        Make/O/D coef_fuzz_SHS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.05,0.2,0.001}
377        make/O/T parameters_fuzz_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"}
378        Edit parameters_fuzz_SHS,coef_fuzz_SHS
379       
380        Variable/G root:g_fuzz_SHS
381        g_fuzz_SHS := FuzzySphere_SHS(coef_fuzz_SHS,ywave_fuzz_SHS,xwave_fuzz_SHS)
382        Display ywave_fuzz_SHS vs xwave_fuzz_SHS
383        ModifyGraph log=1,marker=29,msize=2,mode=4
384        Label bottom "q (A\\S-1\\M)"
385        Label left "Intensity (cm\\S-1\\M)"
386        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
387       
388        AddModelToStrings("FuzzySphere_SHS","coef_fuzz_SHS","parameters_fuzz_SHS","fuzz_SHS")
389End
390
391// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
392Proc PlotSmearedFuzzySphere_SHS(str)                                                           
393        String str
394        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
395       
396        // if any of the resolution waves are missing => abort
397        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
398                Abort
399        endif
400       
401        SetDataFolder $("root:"+str)
402       
403        // Setup parameter table for model function
404        Make/O/D smear_coef_fuzz_SHS = {0.01,60,0.2,10,1e-6,3e-6,1,50,0.05,0.2,0.001}                                   
405        make/o/t smear_parameters_fuzz_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","interface thickness (A)","SLD sphere (A-2)","SLD solvent (A-2)","Lorentz Scale","Lorentz length","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"}   
406        Edit smear_parameters_fuzz_SHS,smear_coef_fuzz_SHS                                     
407       
408        // output smeared intensity wave, dimensions are identical to experimental QSIG values
409        // make extra copy of experimental q-values for easy plotting
410        Duplicate/O $(str+"_q") smeared_fuzz_SHS,smeared_qvals                         
411        SetScale d,0,0,"1/cm",smeared_fuzz_SHS                                                 
412                                       
413        Variable/G gs_fuzz_SHS=0
414        gs_fuzz_SHS := fSmearedFuzzySphere_SHS(smear_coef_fuzz_SHS,smeared_fuzz_SHS,smeared_qvals)      //this wrapper fills the STRUCT
415       
416        Display smeared_fuzz_SHS vs smeared_qvals                                                                       
417        ModifyGraph log=1,marker=29,msize=2,mode=4
418        Label bottom "q (A\\S-1\\M)"
419        Label left "Intensity (cm\\S-1\\M)"
420        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
421       
422        SetDataFolder root:
423        AddModelToStrings("SmearedFuzzySphere_SHS","smear_coef_fuzz_SHS","smear_parameters_fuzz_SHS","fuzz_SHS")
424End
425       
426
427Function FuzzySphere_SHS(w,yw,xw) : FitFunc
428        Wave w,yw,xw
429       
430        Variable inten
431       
432        //setup form factor coefficient wave
433        Make/O/D/N=9 form_fuzz_SHS
434        form_fuzz_SHS[0] = w[0]
435        form_fuzz_SHS[1] = w[1]
436        form_fuzz_SHS[2] = w[2]
437        form_fuzz_SHS[3] = w[3]
438        form_fuzz_SHS[4] = w[4]
439        form_fuzz_SHS[5] = w[5]
440        form_fuzz_SHS[6] = w[6]
441        form_fuzz_SHS[7] = w[7]
442        form_fuzz_SHS[8] = 0
443       
444        //calculate the diameter of the effective one-component sphere
445        Variable pd,diam,Vpoly,Ravg
446        pd = w[2]
447        Ravg = w[1]
448       
449        Vpoly = (4*pi/3*Ravg^3)*(1+3*pd^2)
450        diam = (6*Vpoly/pi)^(1/3)
451       
452        //setup structure factor coefficient wave
453        Make/O/D/N=4 struct_fuzz_SHS
454        struct_fuzz_SHS[0] = diam/2
455        struct_fuzz_SHS[1] = w[0]
456        struct_fuzz_SHS[2] = w[8]
457        struct_fuzz_SHS[3] = w[9]
458       
459        //calculate each and combine
460        Duplicate/O xw tmp_fuzz_SHS_PQ,tmp_fuzz_SHS_SQ
461        FuzzySpheres(form_fuzz_SHS,tmp_fuzz_SHS_PQ,xw)
462        StickyHS_Struct(struct_fuzz_SHS,tmp_fuzz_SHS_SQ,xw)
463        yw = tmp_fuzz_SHS_PQ * tmp_fuzz_SHS_SQ
464       
465//      yw *= w[0]              // scaling is done in FuzzySpheres
466        yw += w[10]
467       
468        //cleanup waves
469//      Killwaves/Z form_fuzz_SHS,struct_fuzz_SHS
470       
471        return (0)
472End
473
474
475
476// this is all there is to the smeared calculation!
477Function SmearedFuzzySphere_HS(s) : FitFunc
478        Struct ResSmearAAOStruct &s
479
480//      the name of your unsmeared model (AAO) is the first argument
481        Smear_Model_20(FuzzySphere_HS,s.coefW,s.xW,s.yW,s.resW)
482
483        return(0)
484End
485
486// this is all there is to the smeared calculation!
487Function SmearedFuzzySphere_SW(s) : FitFunc
488        Struct ResSmearAAOStruct &s
489
490//      the name of your unsmeared model (AAO) is the first argument
491        Smear_Model_20(FuzzySphere_SW,s.coefW,s.xW,s.yW,s.resW)
492
493        return(0)
494End
495
496// this is all there is to the smeared calculation!
497Function SmearedFuzzySphere_SC(s) : FitFunc
498        Struct ResSmearAAOStruct &s
499
500//      the name of your unsmeared model (AAO) is the first argument
501        Smear_Model_20(FuzzySphere_SC,s.coefW,s.xW,s.yW,s.resW)
502
503        return(0)
504End
505
506// this is all there is to the smeared calculation!
507Function SmearedFuzzySphere_SHS(s) : FitFunc
508        Struct ResSmearAAOStruct &s
509
510//      the name of your unsmeared model (AAO) is the first argument
511        Smear_Model_20(FuzzySphere_SHS,s.coefW,s.xW,s.yW,s.resW)
512
513        return(0)
514End
515
516//wrapper to calculate the smeared model as an AAO-Struct
517// fills the struct and calls the ususal function with the STRUCT parameter
518//
519// used only for the dependency, not for fitting
520//
521Function fSmearedFuzzySphere_HS(coefW,yW,xW)
522        Wave coefW,yW,xW
523       
524        String str = getWavesDataFolder(yW,0)
525        String DF="root:"+str+":"
526       
527        WAVE resW = $(DF+str+"_res")
528       
529        STRUCT ResSmearAAOStruct fs
530        WAVE fs.coefW = coefW   
531        WAVE fs.yW = yW
532        WAVE fs.xW = xW
533        WAVE fs.resW = resW
534       
535        Variable err
536        err = SmearedFuzzySphere_HS(fs)
537       
538        return (0)
539End
540
541//wrapper to calculate the smeared model as an AAO-Struct
542// fills the struct and calls the ususal function with the STRUCT parameter
543//
544// used only for the dependency, not for fitting
545//
546Function fSmearedFuzzySphere_SW(coefW,yW,xW)
547        Wave coefW,yW,xW
548       
549        String str = getWavesDataFolder(yW,0)
550        String DF="root:"+str+":"
551       
552        WAVE resW = $(DF+str+"_res")
553       
554        STRUCT ResSmearAAOStruct fs
555        WAVE fs.coefW = coefW   
556        WAVE fs.yW = yW
557        WAVE fs.xW = xW
558        WAVE fs.resW = resW
559       
560        Variable err
561        err = SmearedFuzzySphere_SW(fs)
562       
563        return (0)
564End
565
566//wrapper to calculate the smeared model as an AAO-Struct
567// fills the struct and calls the ususal function with the STRUCT parameter
568//
569// used only for the dependency, not for fitting
570//
571Function fSmearedFuzzySphere_SC(coefW,yW,xW)
572        Wave coefW,yW,xW
573       
574        String str = getWavesDataFolder(yW,0)
575        String DF="root:"+str+":"
576       
577        WAVE resW = $(DF+str+"_res")
578       
579        STRUCT ResSmearAAOStruct fs
580        WAVE fs.coefW = coefW   
581        WAVE fs.yW = yW
582        WAVE fs.xW = xW
583        WAVE fs.resW = resW
584       
585        Variable err
586        err = SmearedFuzzySphere_SC(fs)
587       
588        return (0)
589End
590
591//wrapper to calculate the smeared model as an AAO-Struct
592// fills the struct and calls the ususal function with the STRUCT parameter
593//
594// used only for the dependency, not for fitting
595//
596Function fSmearedFuzzySphere_SHS(coefW,yW,xW)
597        Wave coefW,yW,xW
598       
599        String str = getWavesDataFolder(yW,0)
600        String DF="root:"+str+":"
601       
602        WAVE resW = $(DF+str+"_res")
603       
604        STRUCT ResSmearAAOStruct fs
605        WAVE fs.coefW = coefW   
606        WAVE fs.yW = yW
607        WAVE fs.xW = xW
608        WAVE fs.resW = resW
609       
610        Variable err
611        err = SmearedFuzzySphere_SHS(fs)
612       
613        return (0)
614End
Note: See TracBrowser for help on using the repository browser.