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