1 | Function MixTest() |
---|
2 | |
---|
3 | // make sure all of the globals are set correctly |
---|
4 | NVAR FFT_T = root:FFT_T |
---|
5 | NVAR FFT_N = root:FFT_N |
---|
6 | NVAR FFT_SolventSLD = root:FFT_SolventSLD |
---|
7 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
8 | |
---|
9 | Variable rho1,rho2,rhos,radius1,radius2,ctr,separation,fill1,fill2 |
---|
10 | rho1=1e-6 |
---|
11 | rho2=3e-6 |
---|
12 | rhos=6e-6 |
---|
13 | |
---|
14 | radius1 = 40 |
---|
15 | radius2 = 80 |
---|
16 | ctr=50 |
---|
17 | separation = radius1 + radius2 |
---|
18 | |
---|
19 | FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct |
---|
20 | |
---|
21 | // generate the matrix and erase it |
---|
22 | // FFT_MakeMatrixButtonProc("") |
---|
23 | FFTEraseMatrixButtonProc("") |
---|
24 | Wave m=root:mat |
---|
25 | |
---|
26 | // fill the matrix with solvent |
---|
27 | FFTFillSolventMatrixProc("") |
---|
28 | |
---|
29 | // with the input parameters, build the structure |
---|
30 | ctr = trunc(FFT_N/2) |
---|
31 | fill1 = trunc(rho1/FFT_delRho) |
---|
32 | fill2 = trunc(rho2/FFT_delRho) |
---|
33 | |
---|
34 | FillSphereRadius(m,FFT_T,radius1,ctr,ctr,ctr,fill1) |
---|
35 | FillSphereRadius(m,FFT_T,radius2,ctr+separation/FFT_T,ctr,ctr,fill2) |
---|
36 | return(0) |
---|
37 | End |
---|
38 | |
---|
39 | |
---|
40 | Function CoreShellTest() |
---|
41 | |
---|
42 | // make sure all of the globals are set correctly |
---|
43 | NVAR FFT_T = root:FFT_T |
---|
44 | NVAR FFT_N = root:FFT_N |
---|
45 | NVAR FFT_SolventSLD = root:FFT_SolventSLD |
---|
46 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
47 | |
---|
48 | Variable rho1,rho2,rhos,radius1,radius2,ctr,separation,fill1,fill2 |
---|
49 | rho1=1e-6 |
---|
50 | rho2=3e-6 |
---|
51 | rhos=6e-6 |
---|
52 | |
---|
53 | // rho1 += 3e-6 |
---|
54 | // rho2 += 3e-6 |
---|
55 | // rhos += 3e-6 |
---|
56 | |
---|
57 | radius1 = 20 |
---|
58 | radius2 = 40 |
---|
59 | ctr=50 |
---|
60 | |
---|
61 | FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct |
---|
62 | |
---|
63 | // generate the matrix and erase it |
---|
64 | // FFT_MakeMatrixButtonProc("") |
---|
65 | FFTEraseMatrixButtonProc("") |
---|
66 | Wave m=root:mat |
---|
67 | |
---|
68 | // fill the matrix with solvent |
---|
69 | FFTFillSolventMatrixProc("") |
---|
70 | |
---|
71 | // with the input parameters, build the structure |
---|
72 | ctr = trunc(FFT_N/2) |
---|
73 | fill1 = trunc(rho1/FFT_delRho) |
---|
74 | fill2 = trunc(rho2/FFT_delRho) |
---|
75 | |
---|
76 | FillSphereRadius(m,FFT_T,radius2,ctr,ctr,ctr,fill2) |
---|
77 | FillSphereRadius(m,FFT_T,radius1,ctr,ctr,ctr,fill1) |
---|
78 | return(0) |
---|
79 | End |
---|
80 | |
---|
81 | Function ThreeShellTest() |
---|
82 | |
---|
83 | // make sure all of the globals are set correctly |
---|
84 | NVAR FFT_T = root:FFT_T |
---|
85 | NVAR FFT_N = root:FFT_N |
---|
86 | NVAR FFT_SolventSLD = root:FFT_SolventSLD |
---|
87 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
88 | |
---|
89 | Variable rcore,rhocore,thick1,rhoshel1,thick2,rhoshel2,thick3,rhoshel3,rhos,fill1,fill2,fill3,fillc,ctr |
---|
90 | WAVE w=root:coef_ThreeShell |
---|
91 | |
---|
92 | rcore = w[1] |
---|
93 | rhocore = w[2] |
---|
94 | thick1 = w[3] |
---|
95 | rhoshel1 = w[4] |
---|
96 | thick2 = w[5] |
---|
97 | rhoshel2 = w[6] |
---|
98 | thick3 = w[7] |
---|
99 | rhoshel3 = w[8] |
---|
100 | rhos = w[9] |
---|
101 | |
---|
102 | // rho1 += 3e-6 |
---|
103 | // rho2 += 3e-6 |
---|
104 | // rhos += 3e-6 |
---|
105 | |
---|
106 | FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct |
---|
107 | |
---|
108 | // generate the matrix and erase it |
---|
109 | // FFT_MakeMatrixButtonProc("") |
---|
110 | FFTEraseMatrixButtonProc("") |
---|
111 | Wave m=root:mat |
---|
112 | |
---|
113 | // fill the matrix with solvent |
---|
114 | FFTFillSolventMatrixProc("") |
---|
115 | |
---|
116 | // with the input parameters, build the structure |
---|
117 | ctr = trunc(FFT_N/2) |
---|
118 | fillc = trunc(rhocore/FFT_delRho) |
---|
119 | fill1 = trunc(rhoshel1/FFT_delRho) |
---|
120 | fill2 = trunc(rhoshel2/FFT_delRho) |
---|
121 | fill3 = trunc(rhoshel3/FFT_delRho) |
---|
122 | |
---|
123 | FillSphereRadius(m,FFT_T,rcore+thick1+thick2+thick3,ctr,ctr,ctr,fill3) //outer size (shell 3) |
---|
124 | FillSphereRadius(m,FFT_T,rcore+thick1+thick2,ctr,ctr,ctr,fill2) //outer size (shell 2) |
---|
125 | FillSphereRadius(m,FFT_T,rcore+thick1,ctr,ctr,ctr,fill1) //outer size (shell 1) |
---|
126 | FillSphereRadius(m,FFT_T,rcore,ctr,ctr,ctr,fillc) //core |
---|
127 | return(0) |
---|
128 | End |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | Function TetrahedronFill() |
---|
133 | |
---|
134 | // make sure all of the globals are set correctly |
---|
135 | NVAR FFT_T = root:FFT_T |
---|
136 | NVAR FFT_N = root:FFT_N |
---|
137 | NVAR FFT_SolventSLD = root:FFT_SolventSLD |
---|
138 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
139 | |
---|
140 | Variable rho1,rho2,rho3,rho4,rhos,radius1,radius2,ctr,separation,fill1,fill2,fill3,fill4 |
---|
141 | rho1 = 1e-6 |
---|
142 | rho2 = 2e-6 |
---|
143 | rho3 = 3e-6 |
---|
144 | rho4 = 4e-6 |
---|
145 | rhos = 6e-6 |
---|
146 | |
---|
147 | radius1 = 150 |
---|
148 | ctr=50 |
---|
149 | separation = radius1 |
---|
150 | separation = sqrt(2)*radius1/2 |
---|
151 | |
---|
152 | FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct |
---|
153 | |
---|
154 | // generate the matrix and erase it |
---|
155 | // FFT_MakeMatrixButtonProc("") |
---|
156 | FFTEraseMatrixButtonProc("") |
---|
157 | Wave m=root:mat |
---|
158 | |
---|
159 | // fill the matrix with solvent |
---|
160 | FFTFillSolventMatrixProc("") |
---|
161 | |
---|
162 | // with the input parameters, build the structure |
---|
163 | ctr = trunc(FFT_N/2) |
---|
164 | fill1 = trunc(rho1/FFT_delRho) |
---|
165 | fill2 = trunc(rho2/FFT_delRho) |
---|
166 | fill3 = trunc(rho3/FFT_delRho) |
---|
167 | fill4 = trunc(rho4/FFT_delRho) |
---|
168 | |
---|
169 | // vertices are (relative) - 4 corners of a cube |
---|
170 | // (1,1,1) |
---|
171 | // (-1,-1,1) |
---|
172 | // (-1,1,-1) |
---|
173 | // (1,-1,-1) |
---|
174 | |
---|
175 | FillSphereRadius(m,FFT_T,radius1,ctr+separation/FFT_T,ctr+separation/FFT_T,ctr+separation/FFT_T,fill1) |
---|
176 | FillSphereRadius(m,FFT_T,radius1,ctr-separation/FFT_T,ctr-separation/FFT_T,ctr+separation/FFT_T,fill2) |
---|
177 | FillSphereRadius(m,FFT_T,radius1,ctr-separation/FFT_T,ctr+separation/FFT_T,ctr-separation/FFT_T,fill3) |
---|
178 | FillSphereRadius(m,FFT_T,radius1,ctr+separation/FFT_T,ctr-separation/FFT_T,ctr-separation/FFT_T,fill4) |
---|
179 | return(0) |
---|
180 | End |
---|
181 | |
---|
182 | |
---|
183 | |
---|
184 | Function AxisCylinderFill() |
---|
185 | |
---|
186 | // make sure all of the globals are set correctly |
---|
187 | NVAR FFT_T = root:FFT_T |
---|
188 | NVAR FFT_N = root:FFT_N |
---|
189 | NVAR FFT_SolventSLD = root:FFT_SolventSLD |
---|
190 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
191 | |
---|
192 | Variable rho1,rho2,rho3,rho4,rhos,radius1,radius2,ctr,separation,fill1,fill2,fill3,fill4 |
---|
193 | Variable len |
---|
194 | |
---|
195 | rho1 = 1e-6 |
---|
196 | rho2 = 2e-6 |
---|
197 | rho3 = 3e-6 |
---|
198 | rho4 = 4e-6 |
---|
199 | rhos = 6e-6 |
---|
200 | |
---|
201 | radius1=40 |
---|
202 | len = 300 |
---|
203 | |
---|
204 | FFT_SolventSLD = trunc(rhos/FFT_delRho) //spits back an integer, maybe not correct |
---|
205 | |
---|
206 | // generate the matrix and erase it |
---|
207 | // FFT_MakeMatrixButtonProc("") |
---|
208 | FFTEraseMatrixButtonProc("") |
---|
209 | Wave m=root:mat |
---|
210 | |
---|
211 | // fill the matrix with solvent |
---|
212 | FFTFillSolventMatrixProc("") |
---|
213 | |
---|
214 | // with the input parameters, build the structure |
---|
215 | ctr = trunc(FFT_N/2) |
---|
216 | fill1 = trunc(rho1/FFT_delRho) |
---|
217 | fill2 = trunc(rho2/FFT_delRho) |
---|
218 | fill3 = trunc(rho3/FFT_delRho) |
---|
219 | fill4 = trunc(rho4/FFT_delRho) |
---|
220 | |
---|
221 | |
---|
222 | FillXCylinder(m,FFT_T,radius1,ctr+len/2/FFT_T,ctr,ctr,len,fill1) |
---|
223 | FillYCylinder(m,FFT_T,radius1,ctr,ctr+len/2/FFT_T,ctr,len,fill2) |
---|
224 | FillZCylinder(m,FFT_T,radius1,ctr,ctr,ctr+len/2/FFT_T,len,fill3) |
---|
225 | |
---|
226 | return(0) |
---|
227 | |
---|
228 | End |
---|
229 | |
---|
230 | |
---|
231 | // rad1 > rad2 |
---|
232 | // |
---|
233 | Function FilledPores(rad1,rad2,rho1,rho2,len,sep) |
---|
234 | variable rad1,rad2,rho1,rho2,len,sep //length of cylinders |
---|
235 | |
---|
236 | Variable fill1,fill2 |
---|
237 | |
---|
238 | Wave mat=mat |
---|
239 | NVAR solventSLD = root:FFT_SolventSLD |
---|
240 | |
---|
241 | NVAR grid=root:FFT_T |
---|
242 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
243 | |
---|
244 | // fill the matrix with solvent |
---|
245 | FFTFillSolventMatrixProc("") |
---|
246 | |
---|
247 | |
---|
248 | fill1 = trunc(rho1/FFT_delRho) |
---|
249 | fill2 = trunc(rho2/FFT_delRho) |
---|
250 | |
---|
251 | Variable np,spacing |
---|
252 | np = DimSize(mat,0) // assumes that all dimensions are the same |
---|
253 | |
---|
254 | // fill a 2D plane with points |
---|
255 | Make/O/B/N=(np,np) plane |
---|
256 | plane = solventSLD |
---|
257 | |
---|
258 | spacing = round(sep/grid) // so it's an integer |
---|
259 | FillPlaneHexagonal(plane,spacing,fill2) //use the core SLD |
---|
260 | |
---|
261 | // put it in the proper plane of the matrix |
---|
262 | mat[np/2][][] = plane[q][r] // in the YZ plane |
---|
263 | |
---|
264 | ParseMatrix3D_rho(mat) |
---|
265 | Wave x3d=x3d |
---|
266 | Wave y3d=y3d |
---|
267 | Wave z3d=z3d |
---|
268 | |
---|
269 | Variable ii=0,num |
---|
270 | num = numpnts(x3d) |
---|
271 | |
---|
272 | for(ii=0;ii<num;ii+=1) |
---|
273 | FillXCylinder(mat,grid,rad1,x3d[ii],y3d[ii],z3d[ii],len,fill1) //cylinder 1 |
---|
274 | Print "cyl = ",ii,num |
---|
275 | endfor |
---|
276 | |
---|
277 | // makes a crude core-shell cylinder |
---|
278 | for(ii=0;ii<num;ii+=1) |
---|
279 | FillXCylinder(mat,grid,rad2,x3d[ii],y3d[ii],z3d[ii],len,fill2) //cylinder 2 |
---|
280 | Print "core = ",ii,num |
---|
281 | endfor |
---|
282 | |
---|
283 | return(0) |
---|
284 | End |
---|
285 | |
---|
286 | //draw several structures |
---|
287 | // save them |
---|
288 | // re-load them |
---|
289 | // do the FFT calcualtion + rename |
---|
290 | // do the Binned SLD calculation + rename |
---|
291 | // |
---|
292 | Function TestSaveLoad_Hexagonal_vs_Sep() |
---|
293 | |
---|
294 | |
---|
295 | Wave mat=mat |
---|
296 | NVAR solventSLD = root:FFT_SolventSLD |
---|
297 | |
---|
298 | NVAR grid=root:FFT_T |
---|
299 | NVAR FFT_delRho = root:FFT_delRho //the SLD multiplier, should have been initialized to 1e-7 |
---|
300 | |
---|
301 | // this function takes care of everything in clearing/filling the matrix |
---|
302 | FilledPores(40,25,2e-6,0e-6,400,100) |
---|
303 | SaveMyMatrix("mat_R40C25_L400_S100.ibw") |
---|
304 | Print "Done with save 1 of 7" |
---|
305 | |
---|
306 | FilledPores(40,25,2e-6,0e-6,400,120) |
---|
307 | SaveMyMatrix("mat_R40C25_L400_S120.ibw") |
---|
308 | Print "Done with save 2 of 7" |
---|
309 | |
---|
310 | FilledPores(40,25,2e-6,0e-6,400,140) |
---|
311 | SaveMyMatrix("mat_R40C25_L400_S140.ibw") |
---|
312 | Print "Done with save 3 of 7" |
---|
313 | |
---|
314 | FilledPores(40,25,2e-6,0e-6,400,160) |
---|
315 | SaveMyMatrix("mat_R40C25_L400_S160.ibw") |
---|
316 | Print "Done with save 4 of 7" |
---|
317 | |
---|
318 | FilledPores(40,25,2e-6,0e-6,400,180) |
---|
319 | SaveMyMatrix("mat_R40C25_L400_S180.ibw") |
---|
320 | Print "Done with save 5 of 7" |
---|
321 | |
---|
322 | FilledPores(40,25,2e-6,0e-6,400,200) |
---|
323 | SaveMyMatrix("mat_R40C25_L400_S200.ibw") |
---|
324 | Print "Done with save 6 of 7" |
---|
325 | |
---|
326 | FilledPores(40,25,2e-6,0e-6,400,220) |
---|
327 | SaveMyMatrix("mat_R40C25_L400_S220.ibw") |
---|
328 | Print "Done with save 7 of 7" |
---|
329 | |
---|
330 | |
---|
331 | //re-load the matrices |
---|
332 | Variable num,qmin,qmax |
---|
333 | num=1000 |
---|
334 | qmin=0.01 |
---|
335 | qmax=0.6 |
---|
336 | |
---|
337 | Make/O/D/N=(num) qval_SLD,ival_SLD |
---|
338 | qval_SLD = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
339 | |
---|
340 | |
---|
341 | ReloadMatrix("mat_R40C25_L400_S100.ibw") |
---|
342 | Execute "DoFFT()" |
---|
343 | Duplicate/O iBin iBin_R40C25_L400_S100 |
---|
344 | Duplicate/O qBin qBin_R40C25_L400_S100 |
---|
345 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
346 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S100 |
---|
347 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S100 |
---|
348 | Print "Done with calculation 1 of 7" |
---|
349 | |
---|
350 | ReloadMatrix("mat_R40C25_L400_S120.ibw") |
---|
351 | Execute "DoFFT()" |
---|
352 | Duplicate/O iBin iBin_R40C25_L400_S120 |
---|
353 | Duplicate/O qBin qBin_R40C25_L400_S120 |
---|
354 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
355 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S120 |
---|
356 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S120 |
---|
357 | Print "Done with calculation 2 of 7" |
---|
358 | |
---|
359 | ReloadMatrix("mat_R40C25_L400_S140.ibw") |
---|
360 | Execute "DoFFT()" |
---|
361 | Duplicate/O iBin iBin_R40C25_L400_S140 |
---|
362 | Duplicate/O qBin qBin_R40C25_L400_S140 |
---|
363 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
364 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S140 |
---|
365 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S140 |
---|
366 | Print "Done with calculation 3 of 7" |
---|
367 | |
---|
368 | ReloadMatrix("mat_R40C25_L400_S160.ibw") |
---|
369 | Execute "DoFFT()" |
---|
370 | Duplicate/O iBin iBin_R40C25_L400_S160 |
---|
371 | Duplicate/O qBin qBin_R40C25_L400_S160 |
---|
372 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
373 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S160 |
---|
374 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S160 |
---|
375 | Print "Done with calculation 4 of 7" |
---|
376 | |
---|
377 | ReloadMatrix("mat_R40C25_L400_S180.ibw") |
---|
378 | Execute "DoFFT()" |
---|
379 | Duplicate/O iBin iBin_R40C25_L400_S180 |
---|
380 | Duplicate/O qBin qBin_R40C25_L400_S180 |
---|
381 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
382 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S180 |
---|
383 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S180 |
---|
384 | Print "Done with calculation 5 of 7" |
---|
385 | |
---|
386 | ReloadMatrix("mat_R40C25_L400_S200.ibw") |
---|
387 | Execute "DoFFT()" |
---|
388 | Duplicate/O iBin iBin_R40C25_L400_S200 |
---|
389 | Duplicate/O qBin qBin_R40C25_L400_S200 |
---|
390 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
391 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S200 |
---|
392 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S200 |
---|
393 | Print "Done with calculation 6 of 7" |
---|
394 | |
---|
395 | ReloadMatrix("mat_R40C25_L400_S220.ibw") |
---|
396 | Execute "DoFFT()" |
---|
397 | Duplicate/O iBin iBin_R40C25_L400_S220 |
---|
398 | Duplicate/O qBin qBin_R40C25_L400_S220 |
---|
399 | fDoCalc(qval_SLD,ival_SLD,grid,3,1) |
---|
400 | Duplicate/O ival_SLD ival_SLD_R40C25_L400_S220 |
---|
401 | Duplicate/O qval_SLD qval_SLD_R40C25_L400_S220 |
---|
402 | Print "Done with calculation 7 of 7" |
---|
403 | |
---|
404 | |
---|
405 | Print "All calculations done" |
---|
406 | |
---|
407 | |
---|
408 | |
---|
409 | return(0) |
---|
410 | End |
---|