source: sans/Analysis/branches/ajj_23APR07/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LamellarFF_HG.ipf @ 91

Last change on this file since 91 was 42, checked in by srkline, 16 years ago

initial checkin of Analysis v.3.00 files

File size: 4.6 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2
3////////////////////////////////////////////////////
4//
5// model function that calculates the scattering from
6// lamellar surfactant structures. contrast is from the solvent,
7// surfactant headgroups, and surfactant tails
8//
9// The system is considered to be DILUTE - Interference (S(Q))
10// effects are NOT taken into account.
11// ONLY the form factor is calculated
12//
13// REFERENCE:   Nallet, Laversanne, and Roux, J. Phys. II France, 3, (1993) 487-502.
14//              also in J. Phys. Chem. B, 105, (2001) 11081-11088.
15//
16// 16 JULY 2003 SRK
17// 13 FEB 06 correct normalization (L.Porcar)
18//
19////////////////////////////////////////////////////
20
21//this macro sets up all the necessary parameters and waves that are
22//needed to calculate the model function.
23//
24Proc Plot_LamellarFF_HG(num,qmin,qmax)
25        Variable num=128, qmin=.001, qmax=.5
26        Prompt num "Enter number of data points for model: "
27        Prompt qmin "Enter minimum q-value (^1) for model: "
28        Prompt qmax "Enter maximum q-value (^1) for model: "
29//
30        Make/O/D/n=(num) xwave_LamellarFF_HG, ywave_LamellarFF_HG
31        xwave_LamellarFF_HG =  alog(log(qmin) + x*((log(qmax)-log(qmin))/num))
32        Make/O/D coef_LamellarFF_HG = {1,15,10,4e-7,3e-6,6e-6,0}                        //CH#2
33        make/o/t parameters_LamellarFF_HG = {"Scale","Tail length (A)","Headgroup thickness (A)","SLD Tails (A^-2)","SLD Headgroup (A^-2)","SLD Solvent (A^-2)","Incoherent Bgd (cm-1)"}        //CH#3
34        Edit parameters_LamellarFF_HG, coef_LamellarFF_HG
35        ModifyTable width(parameters_LamellarFF_HG)=160
36        ywave_LamellarFF_HG  := LamellarFF_HG(coef_LamellarFF_HG, xwave_LamellarFF_HG)
37        Display ywave_LamellarFF_HG vs xwave_LamellarFF_HG
38        ModifyGraph marker=29, msize=2, mode=4
39        ModifyGraph log=1
40        Label bottom "q (\\S-1\\M) "
41        Label left "I(q) (cm\\S-1\\M)"
42        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
43//
44End
45
46//
47//this macro sets up all the necessary parameters and waves that are
48//needed to calculate the  smeared model function.
49//
50//no input parameters are necessary, it MUST use the experimental q-values
51// from the experimental data read in from an AVE/QSIG data file
52////////////////////////////////////////////////////
53Proc PlotSmeared_LamellarFF_HG()                                                                //Lamellar
54       
55        // if no gQvals wave, data must not have been loaded => abort
56        If(ResolutionWavesMissing())            //part of GaussUtils
57                Abort
58        endif
59       
60        // Setup parameter table for model function
61        Make/O/D smear_coef_LamellarFF_HG = {1,15,10,4e-7,3e-6,6e-6,0}          //CH#4
62        make/o/t smear_parameters_LamellarFF_HG = {"Scale","Tail length (A)","Headgroup thickness (A)","SLD Tails (A^-2)","SLD Headgroup (A^-2)","SLD Solvent (A^-2)","Incoherent Bgd (cm-1)"}
63        Edit smear_parameters_LamellarFF_HG,smear_coef_LamellarFF_HG                                    //display parameters in a table
64       
65        // output smeared intensity wave, dimensions are identical to experimental QSIG values
66        // make extra copy of experimental q-values for easy plotting
67        Duplicate/O $gQvals smeared_LamellarFF_HG,smeared_qvals                         //
68        SetScale d,0,0,"1/cm",smeared_LamellarFF_HG                                                     //
69
70        smeared_LamellarFF_HG := LamellarFF_HG_Smeared(smear_coef_LamellarFF_HG,$gQvals)                // SMEARED function name
71        Display smeared_LamellarFF_HG vs smeared_qvals                                                                  //
72        ModifyGraph log=1,marker=29,msize=2,mode=4
73        Label bottom "q (\\S-1\\M)"
74        Label left "I(q) (cm\\S-1\\M)"
75        AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2)
76End     // end macro
77
78//CH#1
79// you should write your function to calculate the intensity
80// for a single q-value (that's the input parameter x)
81// based on the wave (array) of parameters that you send it (w)
82//
83Function LamellarFF_HG(w,x) : FitFunc
84        Wave w
85        Variable x
86//       Input (fitting) variables are:
87//[0]Scale
88//[1]tail length
89//[2]hg thickness
90//[3]sld tail
91//[4]sld HG
92//[5]sld solvent
93//[6]Incoherent Bgd (cm-1)
94       
95//      give them nice names
96        Variable scale,delT,delH,slds,sldh,sldt,sig,contr,NN,Cp,bkg
97        scale = w[0]
98        delT = w[1]
99        delH = w[2]
100        sldt = w[3]
101        sldh = w[4]
102        slds = w[5]
103        bkg = w[6]
104       
105//      local variables
106        Variable inten, qval,Pq,drh,drt
107       
108        //      x is the q-value for the calculation
109        qval = x
110        drh = sldh - slds
111        drt = sldt - slds               //correction 13FEB06 by L.Porcar
112       
113        Pq = drh*(sin(qval*(delH+delT))-sin(qval*delT)) + drt*sin(qval*delT)
114        Pq *= Pq
115        Pq *= 4/(qval^2)
116       
117        inten = 2*Pi*scale*Pq/Qval^2            //dimensionless...
118       
119        inten /= 2*(delT+delH)                  //normalize by the bilayer thickness
120       
121        inten *= 1e8            // 1/A to 1/cm
122        Return (inten+bkg)
123End
124
125//the smeared model calculation
126Function LamellarFF_HG_Smeared(w,x) :FitFunc
127        Wave w
128        Variable x
129       
130        Variable ans
131        SVAR sq = gSig_Q
132        SVAR qb = gQ_bar
133        SVAR sh = gShadow
134        SVAR gQ = gQVals
135       
136        ans = Smear_Model_20(LamellarFF_HG,$sq,$qb,$sh,$gQ,w,x)
137
138        return(ans)
139End
Note: See TracBrowser for help on using the repository browser.