source: sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/FlexibleCylinder.ipf @ 131

Last change on this file since 131 was 131, checked in by srkline, 15 years ago

Typo in dialog in every model...

File size: 14.8 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma IgorVersion = 6.0
3
4//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
5//CCCCCCCC
6//C      SUBROUTINE FOR THE CALCULATION OF THE SCATTERING FUNCTIONS
7//C      OF RODLIKE MICELLES.  METHODLOGY FOLLOWS THAT OF PEDERSEN AND
8//C      SCHURTENBERGER, MACORMOLECULES, VOL 29,PG 7602, 1996.
9//C      WITH EXCULDED VOLUME EFFECTS (METHOD 3)
10//
11// - copied directly from FORTRAN code supplied by Jan Pedersen
12//              SRK - 2002, but shows discontinuity at Qlb = 3.1
13//
14//  Jan 2006 - re-worked FORTRAN correcting typos in paper: now is smooth, but
15// the splicing is actually at Qlb = 2, which is not what the paper
16// says is to be done (and not from earlier models)
17//
18// July 2006 - now is CORRECT with Wei-Ren's changes to the code
19// Matlab code was not too difficult to convert to Igor (only a few hours...)
20//
21Proc PlotFlexExclVolCyl(num,qmin,qmax)
22        Variable num=128,qmin=0.001,qmax=0.7
23        Prompt num "Enter number of data points for model: "
24        Prompt qmin "Enter minimum q-value (^-1) for model: "
25        Prompt qmax "Enter maximum q-value (^-1) for model: "
26               
27        Make/O/D/n=(num) xwave_fle,ywave_fle
28        xwave_fle =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
29        Make/O/D coef_fle = {1.,1000,100,20,3.0e-6,0.0001}
30        make/o/t parameters_fle = {"scale","Contour Length (A)","Kuhn Length, b (A)","Radius (A)","contrast (A^-2)","bkgd (cm^-1)"}
31        Edit parameters_fle,coef_fle
32       
33        Variable/G root:g_fle
34        g_fle := FlexExclVolCyl(coef_fle,ywave_fle,xwave_fle)
35        Display ywave_fle vs xwave_fle
36        ModifyGraph log=1,marker=29,msize=2,mode=4
37        Label bottom "q (\\S-1\\M)"
38        Label left "Intensity (cm\\S-1\\M)"
39        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
40End
41///////////////////////////////////////////////////////////
42
43// - sets up a dependency to a wrapper, not the actual SmearedModelFunction
44Proc PlotSmearedFlexExclVolCyl(str)                                                             
45        String str
46        Prompt str,"Pick the data folder containing the resolution you want",popup,getAList(4)
47       
48        // if any of the resolution waves are missing => abort
49        if(ResolutionWavesMissingDF(str))               //updated to NOT use global strings (in GaussUtils)
50                Abort
51        endif
52       
53        SetDataFolder $("root:"+str)
54       
55        // Setup parameter table for model function
56        Make/O/D smear_coef_fle = {1.,1000,100,20,3.0e-6,0.0001}                                       
57        make/o/t smear_parameters_fle = {"scale","ContourLength (A)","KuhnLength, b (A)","Radius (A)","contrast (A^-2)","bkgd (cm^-1)"}         
58        Edit smear_parameters_fle,smear_coef_fle                                       
59       
60        // output smeared intensity wave, dimensions are identical to experimental QSIG values
61        // make extra copy of experimental q-values for easy plotting
62        Duplicate/O $(str+"_q") smeared_fle,smeared_qvals                               
63        SetScale d,0,0,"1/cm",smeared_fle                                                       
64                                       
65        Variable/G gs_fle=0
66        gs_fle := fSmearedFlexExclVolCyl(smear_coef_fle,smeared_fle,smeared_qvals)      //this wrapper fills the STRUCT
67       
68        Display smeared_fle vs smeared_qvals                                                                   
69        ModifyGraph log=1,marker=29,msize=2,mode=4
70        Label bottom "q (\\S-1\\M)"
71        Label left "Intensity (cm\\S-1\\M)"
72        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
73       
74        SetDataFolder root:
75End
76       
77
78//AAO version, uses XOP if available
79// simply calls the original single point calculation with
80// a wave assignment (this will behave nicely if given point ranges)
81Function FlexExclVolCyl(cw,yw,xw) : FitFunc
82        Wave cw,yw,xw
83       
84#if exists("FlexExclVolCylX")
85        yw = FlexExclVolCylX(cw,xw)
86#else
87        yw = fFlexExclVolCyl(cw,xw)
88#endif
89        return(0)
90End
91
92//
93Function fFlexExclVolCyl(ww,x)
94        Wave ww
95        Variable x
96
97        //nice names to the input params
98        //ww[0] = scale
99        //ww[1] = L [A]
100        //ww[2] = B [A]
101        //ww[3] = rad [A] cross-sectional radius
102        //ww[4] = contrast [A^-2]
103        //ww[5] = bkg [cm-1]
104        Variable scale,L,B,bkg,rad,qr,cont
105       
106        scale = ww[0]
107        L = ww[1]
108        B = ww[2]
109        rad = ww[3]
110        cont = ww[4]
111        bkg = ww[5]
112        qr = x*rad              //used for cross section contribution only
113       
114        Variable flex,crossSect
115        flex = Sk_WR(x,L,B)
116     
117        crossSect = (2*bessJ(1,qr)/qr)^2
118       
119        //normalize form factor by multiplying by cylinder volume * cont^2
120   // then convert to cm-1 by multiplying by 10^8
121   // then scale = phi
122
123        flex *= crossSect
124        flex *= Pi*rad*rad*L
125        flex *= cont^2
126        flex *= 1.0e8
127       
128   return (scale*flex + bkg)
129End
130
131//////////////////WRC corrected code below
132// main function
133function Sk_WR(q,L,b)
134        Variable q,L,b
135        //
136        Variable p1,p2,p1short,p2short,q0,qconnect
137        Variable c,epsilon,ans,q0short,Sexvmodify
138       
139        p1 = 4.12
140        p2 = 4.42
141        p1short = 5.36
142        p2short = 5.62
143        q0 = 3.1
144        qconnect = q0/b
145        //     
146        q0short = max(1.9/sqrt(Rgsquareshort(q,L,b)),3)
147       
148        //
149        if(L/b > 10)
150                C = 3.06/(L/b)^0.44
151                epsilon = 0.176
152        else
153                C = 1
154                epsilon = 0.170
155        endif
156        //
157       
158        if( L > 4*b ) // Longer Chains
159                if (q*b <= 3.1)
160                        //Modified by Yun on Oct. 15,
161                        Sexvmodify = Sexvnew(q, L, b)
162                        ans = Sexvmodify + C * (4/15 + 7./(15*u_WR(q,L,b)) - (11/15 + 7./(15*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L)
163                else //q(i)*b > 3.1
164                        ans = a1long(q, L, b, p1, p2, q0)/((q*b)^p1) + a2long(q, L, b, p1, p2, q0)/((q*b)^p2) + pi/(q*L)
165                endif
166        else //L <= 4*b Shorter Chains
167                if (q*b <= max(1.9/sqrt(Rgsquareshort(q,L,b)),3) )
168                        if (q*b<=0.01)
169                                ans = 1 - Rgsquareshort(q,L,b)*(q^2)/3
170                        else
171                                ans = Sdebye1(q,L,b)
172                        endif
173                else    //q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3)
174                        ans = a1short(q,L,b,p1short,p2short,q0short)/((q*b)^p1short) + a2short(q,L,b,p1short,p2short,q0short)/((q*b)^p2short) + pi/(q*L)
175                endif
176        endif
177       
178        return(ans)
179end
180
181//WR named this w (too generic)
182Function w_WR(x)
183    Variable x
184
185    //C4 = 1.523;
186    //C5 = 0.1477;
187    Variable yy
188    yy = 0.5*(1 + tanh((x - 1.523)/0.1477))
189
190    return (yy)
191end
192
193//
194function u1(q,L,b)
195    Variable q,L,b
196    Variable yy
197
198    yy = Rgsquareshort(q,L,b)*q^2
199   
200    return yy
201end
202
203// was named u
204function u_WR(q,L,b)
205    Variable q,L,b
206   
207    Variable yy
208    yy = Rgsquare(q,L,b)*(q^2)
209    return yy
210end
211
212
213
214//
215function Rgsquarezero(q,L,b)
216    Variable q,L,b
217   
218    Variable yy
219    yy = (L*b/6) * (1 - 1.5*(b/L) + 1.5*(b/L)^2 - 0.75*(b/L)^3*(1 - exp(-2*(L/b))))
220   
221    return yy
222end
223
224//
225function Rgsquareshort(q,L,b)
226    Variable q,L,b
227   
228    Variable yy
229    yy = AlphaSquare(L/b) * Rgsquarezero(q,L,b)
230   
231    return yy
232end
233
234//
235function Rgsquare(q,L,b)
236    Variable q,L,b
237   
238    Variable yy
239    yy = AlphaSquare(L/b)*L*b/6
240   
241    return yy
242end
243
244//
245function AlphaSquare(x)
246    Variable x
247   
248    Variable yy
249    yy = (1 + (x/3.12)^2 + (x/8.67)^3)^(0.176/3)
250
251    return yy
252end
253
254//
255function miu(x)
256    Variable x
257   
258    Variable yy
259    yy = (1/8)*(9*x - 2 + 2*log(1 + x)/x)*exp(1/2.565*(1/x + (1 - 1/(x^2))*log(1 + x)))
260   
261    return yy
262end
263
264//
265function Sdebye(q,L,b)
266    Variable q,L,b
267   
268    Variable yy
269    yy = 2*(exp(-u_WR(q,L,b)) + u_WR(q,L,b) -1)/((u_WR(q,L,b))^2)
270
271    return yy
272end
273
274//
275function Sdebye1(q,L,b)
276    Variable q,L,b
277   
278    Variable yy
279    yy = 2*(exp(-u1(q,L,b)) + u1(q,L,b) -1)/((u1(q,L,b))^2)
280   
281    return yy
282end
283
284//
285function Sexv(q,L,b)
286    Variable q,L,b
287   
288    Variable yy,C1,C2,C3,miu,Rg2
289    C1=1.22
290    C2=0.4288
291    C3=-1.651
292    miu = 0.585
293
294    Rg2 = Rgsquare(q,L,b)
295   
296    yy = (1 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + w_WR(q*sqrt(Rg2))*(C1*(q*sqrt(Rg2))^(-1/miu) +  C2*(q*sqrt(Rg2))^(-2/miu) +    C3*(q*sqrt(Rg2))^(-3/miu))
297   
298    return yy
299end
300
301// this must be WR modified version
302function Sexvnew(q,L,b)
303    Variable q,L,b
304   
305    Variable yy,C1,C2,C3,miu
306    C1=1.22
307    C2=0.4288
308    C3=-1.651
309    miu = 0.585
310
311    //calculating the derivative to decide on the corection (cutoff) term?
312    // I have modified this from WRs original code
313    Variable del=1.05,C_star2,Rg2
314    if( (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q) >= 0 )
315        C_star2 = 0
316    else
317        C_star2 = 1
318    endif
319
320    Rg2 = Rgsquare(q,L,b)
321   
322    yy = (1 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + C_star2*w_WR(q*sqrt(Rg2))*(C1*(q*sqrt(Rg2))^(-1/miu) + C2*(q*sqrt(Rg2))^(-2/miu) + C3*(q*sqrt(Rg2))^(-3/miu))
323
324    return yy
325end
326
327
328
329// these are the messy ones
330function a2short(q, L, b, p1short, p2short, q0)
331    Variable q, L, b, p1short, p2short, q0
332   
333    Variable yy,Rg2_sh
334    Rg2_sh = Rgsquareshort(q,L,b)
335   
336    Variable t1
337    t1 = ((q0^2*Rg2_sh)/b^2)
338   
339    //E is the number e
340    yy = ((-(1/(L*((p1short - p2short))*Rg2_sh^2)*((b*E^(-t1)*q0^(-4 + p2short)*((8*b^3*L - 8*b^3*E^t1*L - 2*b^3*L*p1short + 2*b^3*E^t1*L*p1short + 4*b*L*q0^2*Rg2_sh + 4*b*E^t1*L*q0^2*Rg2_sh - 2*b*E^t1*L*p1short*q0^2*Rg2_sh - E^t1*pi*q0^3*Rg2_sh^2 + E^t1*p1short*pi*q0^3*Rg2_sh^2)))))))
341         
342    return yy
343end
344
345//
346function a1short(q, L, b, p1short, p2short, q0)
347    Variable q, L, b, p1short, p2short, q0
348   
349    Variable yy,Rg2_sh
350    Rg2_sh = Rgsquareshort(q,L,b)
351
352    Variable t1
353    t1 = ((q0^2*Rg2_sh)/b^2)
354   
355    yy = ((1/(L*((p1short - p2short))*Rg2_sh^2)*((b*E^(-t1)*q0^((-4) + p1short)*((8*b^3*L - 8*b^3*E^t1*L - 2*b^3*L*p2short + 2*b^3*E^t1*L*p2short + 4*b*L*q0^2*Rg2_sh + 4*b*E^t1*L*q0^2*Rg2_sh - 2*b*E^t1*L*p2short*q0^2*Rg2_sh - E^t1*pi*q0^3*Rg2_sh^2 + E^t1*p2short*pi*q0^3*Rg2_sh^2))))))
356       
357    return yy
358end
359
360// this one will be lots of trouble
361function a2long(q, L, b, p1, p2, q0)
362    variable q, L, b, p1, p2, q0
363
364    Variable yy,c1,c2,c3,c4,c5,miu,c,Rg2,rRg
365    Variable t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13
366
367    if( L/b > 10)
368        C = 3.06/(L/b)^0.44
369    else
370        C = 1
371    endif
372
373    C1 = 1.22
374    C2 = 0.4288
375    C3 = -1.651
376    C4 = 1.523
377    C5 = 0.1477
378    miu = 0.585
379
380    Rg2 = Rgsquare(q,L,b)
381    t1 = (1/(b* p1*q0^((-1) - p1 - p2) - b*p2*q0^((-1) - p1 - p2)))
382    t2 = (b*C*(((-1*((14*b^3)/(15*q0^3*Rg2))) + (14*b^3*E^(-((q0^2*Rg2)/b^2)))/(15*q0^3*Rg2) + (2*E^(-((q0^2*Rg2)/b^2))*q0*((11/15 + (7*b^2)/(15*q0^2*Rg2)))*Rg2)/b)))/L
383    t3 = (sqrt(Rg2)*((C3*(((sqrt(Rg2)*q0)/b))^((-3)/miu) + C2*(((sqrt(Rg2)*q0)/b))^((-2)/miu) + C1*(((sqrt(Rg2)*q0)/b))^((-1)/miu)))*sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5)^2)/(2*C5)
384    t4 = (b^4*sqrt(Rg2)*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5)^2)/(C5*q0^4*Rg2^2)
385    t5 = (2*b^4*(((2*q0*Rg2)/b - (2*E^(-((q0^2*Rg2)/b^2))*q0*Rg2)/b))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q0^4*Rg2^2)
386    t6 = (8*b^5*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q0^5*Rg2^2)
387    t7 = (((-((3*C3*sqrt(Rg2)*(((sqrt(Rg2)*q0)/b))^((-1) - 3/miu))/miu)) - (2*C2*sqrt(Rg2)*(((sqrt(Rg2)*q0)/b))^((-1) - 2/miu))/miu - (C1*sqrt(Rg2)*(((sqrt(Rg2)*q0)/b))^((-1) - 1/miu))/miu))
388    t8 = ((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))
389    t9 = (b*C*((4/15 - E^(-((q0^2*Rg2)/b^2))*((11/15 + (7*b^2)/(15*q0^2*Rg2))) + (7*b^2)/(15*q0^2*Rg2))))/L
390    t10 = (2*b^4*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q0^4*Rg2^2)
391 
392   
393    yy = ((-1*(t1* (((-q0^(-p1))*(((b^2*pi)/(L*q0^2) + t2 + t3 - t4 + t5 - t6 + 1/2*t7*t8)) - b*p1*q0^((-1) - p1)*(((-((b*pi)/(L*q0))) + t9 + t10 + 1/2*((C3*(((sqrt(Rg2)*q0)/b))^((-3)/miu) + C2*(((sqrt(Rg2)*q0)/b))^((-2)/miu) + C1*(((sqrt(Rg2)*q0)/b))^((-1)/miu)))*((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))))
394
395
396    return yy
397end
398
399//need to define this on my own
400Function sech_WR(x)
401        variable x
402       
403        return(1/cosh(x))
404end
405//
406function a1long(q, L, b, p1, p2, q0)
407    Variable q, L, b, p1, p2, q0
408   
409    Variable yy,c,c1,c2,c3,c4,c5,miu,Rg2,rRg
410    Variable t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16
411   
412    if( L/b > 10)
413        C = 3.06/(L/b)^0.44
414    else
415        C = 1
416    endif
417
418    C1 = 1.22
419    C2 = 0.4288
420    C3 = -1.651
421    C4 = 1.523
422    C5 = 0.1477
423    miu = 0.585
424
425    Rg2 = Rgsquare(q,L,b)
426    t1 = (b*C*((4/15 - E^(-((q0^2*Rg2)/b^2))*((11/15 + (7*b^2)/(15*q0^2*Rg2))) + (7*b^2)/(15*q0^2*Rg2))))
427    t2 = (2*b^4*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))
428    t3 = ((C3*(((sqrt(Rg2)*q0)/b))^((-3)/miu) + C2*(((sqrt(Rg2)*q0)/b))^((-2)/miu) + C1*(((sqrt(Rg2)*q0)/b))^((-1)/miu)))
429    t4 = ((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))
430    t5 = (1/(b*p1*q0^((-1) - p1 - p2) - b*p2*q0^((-1) - p1 - p2)))
431    t6 = (b*C*(((-((14*b^3)/(15*q0^3*Rg2))) + (14*b^3*E^(-((q0^2*Rg2)/b^2)))/(15*q0^3*Rg2) + (2*E^(-((q0^2*Rg2)/b^2))*q0*((11/15 + (7*b^2)/(15*q0^2*Rg2)))*Rg2)/b)))
432    t7 = (sqrt(Rg2)*((C3*(((sqrt(Rg2)*q0)/b))^((-3)/miu) + C2*(((sqrt(Rg2)*q0)/b))^((-2)/miu) + C1*(((sqrt(Rg2)*q0)/b))^((-1)/miu)))*sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5)^2)
433    t8 = (b^4*sqrt(Rg2)*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5)^2)
434    t9 = (2*b^4*(((2*q0*Rg2)/b - (2*E^(-((q0^2*Rg2)/b^2))*q0*Rg2)/b))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))
435    t10 = (8*b^5*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))
436    t11 = (((-((3*C3*sqrt(Rg2)*(((sqrt(Rg2)*q0)/b))^((-1) - 3/miu))/miu)) - (2*C2*sqrt(Rg2)*(((sqrt(Rg2)*q0)/b))^((-1) - 2/miu))/miu - (C1*sqrt(Rg2)*(((sqrt(Rg2)*q0)/b))^((-1) - 1/miu))/miu))
437    t12 = ((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))
438    t13 = (b*C*((4/15 - E^(-((q0^2*Rg2)/b^2))*((11/15 + (7*b^2)/(15*q0^2* Rg2))) + (7*b^2)/(15*q0^2*Rg2))))
439    t14 = (2*b^4*(((-1) + E^(-((q0^2*Rg2)/b^2)) + (q0^2*Rg2)/b^2))*((1 + 1/2*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))
440    t15 = ((C3*(((sqrt(Rg2)*q0)/b))^((-3)/miu) + C2*(((sqrt(Rg2)*q0)/b))^((-2)/miu) + C1*(((sqrt(Rg2)*q0)/b))^((-1)/miu)))
441
442   
443    yy = (q0^p1*(((-((b*pi)/(L*q0))) +t1/L +t2/(q0^4*Rg2^2) + 1/2*t3*t4)) + (t5*((q0^(p1 - p2)*(((-q0^(-p1))*(((b^2*pi)/(L*q0^2) +t6/L +t7/(2*C5) -t8/(C5*q0^4*Rg2^2) +t9/(q0^4*Rg2^2) -t10/(q0^5*Rg2^2) + 1/2*t11*t12)) - b*p1*q0^((-1) - p1)*(((-((b*pi)/(L*q0))) +t13/L +t14/(q0^4*Rg2^2) + 1/2*t15*((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))))
444
445   
446    return yy
447end
448
449
450// unused functions copied from WRC Matlab code
451
452
453//function Vmic(phi)
454//    Variable phi
455//   
456//    Variable yy
457//    yy = 2.53*10^6*(phi)^(0.5) + 8.35*(phi)^(-2)
458//   
459//    return yy
460//end
461
462//function Scs(x)
463//    Variable x
464//   
465//    Variable yy
466//    yy = (2*bessj(1,x)/x)^2
467//   
468//    return yy
469//end
470
471//function Srod(q,L,b)
472//    Variable q,L,b
473//   
474//    Variable yy
475//    yy = 2 * Si(q,L,b)/(q*L) - 4 * (sin(q*L/2)^2)/((q*L)^2)
476//
477//    return yy
478//end
479//
480//function Si(q,L,b)
481//    Variable q,L,b
482//   
483//    Variable yy
484//   
485////   for i=1:length(q)
486////   y(i) = quadl('sin(x)./(x)',10e-8,q(i)*L);
487////   end
488//   
489//    return yy
490//end
491
492//////////////////
493
494//wrapper to calculate the smeared model as an AAO-Struct
495// fills the struct and calls the ususal function with the STRUCT parameter
496//
497// used only for the dependency, not for fitting
498//
499Function fSmearedFlexExclVolCyl(coefW,yW,xW)
500        Wave coefW,yW,xW
501       
502        String str = getWavesDataFolder(yW,0)
503        String DF="root:"+str+":"
504       
505        WAVE resW = $(DF+str+"_res")
506       
507        STRUCT ResSmearAAOStruct fs
508        WAVE fs.coefW = coefW   
509        WAVE fs.yW = yW
510        WAVE fs.xW = xW
511        WAVE fs.resW = resW
512       
513        Variable err
514        err = SmearedFlexExclVolCyl(fs)
515       
516        return (0)
517End
518
519// this is all there is to the smeared calculation!
520Function SmearedFlexExclVolCyl(s) :FitFunc
521        Struct ResSmearAAOStruct &s
522
523//      the name of your unsmeared model (AAO) is the first argument
524        s.yW = Smear_Model_20(FlexExclVolCyl,s.coefW,s.xW,s.resW)
525
526        return(0)
527End
Note: See TracBrowser for help on using the repository browser.