1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | // this is intended to be a series of methods to fill points |
---|
4 | // on a particular lattice spacing |
---|
5 | // |
---|
6 | // possible methods include: |
---|
7 | // filling a specified 3D volume |
---|
8 | // filling a planar region |
---|
9 | // filling a line (not really a crystal) |
---|
10 | // |
---|
11 | // once the points are located, then objects can be drawn at each |
---|
12 | // point, possibly spheres, or cylinders in a given direction |
---|
13 | |
---|
14 | // |
---|
15 | // Hexagonal Close Packed |
---|
16 | // |
---|
17 | // |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | Macro PutXAxisCylindersAt3DPoints(w,num,rad,len,periodic,sobol,fill,centered) |
---|
22 | String w="mat" |
---|
23 | Variable num=100,rad=20,len=300,periodic=1,sobol=1,fill=10,centered=0 |
---|
24 | Prompt w,"matrix" |
---|
25 | Prompt num,"number of starting points" |
---|
26 | prompt rad,"radius of cylinders" |
---|
27 | prompt len,"length of cylinders" |
---|
28 | prompt periodic,"1=periodic, 0=non-periodic boundaries" |
---|
29 | Prompt sobol,"1=Sobol, 0=random" |
---|
30 | Prompt fill,"fill SLD value" |
---|
31 | Prompt centered,"concentrate at center (0|1)" |
---|
32 | |
---|
33 | |
---|
34 | // $w=0 |
---|
35 | // always start fresh |
---|
36 | FFTEraseMatrixButtonProc("") |
---|
37 | |
---|
38 | X_CylindersAt3DPoints($w,num,rad,len,sobol,periodic,fill,centered) |
---|
39 | |
---|
40 | NumberOfPoints() |
---|
41 | end |
---|
42 | |
---|
43 | |
---|
44 | Function X_CylindersAt3DPoints(mat,num,rad,len,sobol,periodic,fill,centered) |
---|
45 | Wave mat |
---|
46 | variable num,rad,len //length in direction |
---|
47 | Variable periodic //==1 if periodic boundaries |
---|
48 | Variable sobol //==1 if sobol selection of points (2D) |
---|
49 | Variable fill |
---|
50 | Variable centered |
---|
51 | |
---|
52 | NVAR solventSLD = root:FFT_SolventSLD |
---|
53 | |
---|
54 | Variable np |
---|
55 | np = DimSize(mat,0) // assumes that all dimensions are the same |
---|
56 | |
---|
57 | if(centered) |
---|
58 | Make/O/D/N=(np/2,np/2,np/2) small |
---|
59 | if(sobol) |
---|
60 | SobolFill3DMat(small,num,fill) |
---|
61 | else |
---|
62 | RandomFill3DMat(small,num,fill) |
---|
63 | endif |
---|
64 | ParseMatrix3D_rho(small) |
---|
65 | killwaves small |
---|
66 | |
---|
67 | Wave x3d=x3d |
---|
68 | Wave y3d=y3d |
---|
69 | Wave z3d=z3d |
---|
70 | x3d += np/4 |
---|
71 | y3d += np/4 |
---|
72 | z3d += np/4 |
---|
73 | |
---|
74 | else |
---|
75 | //use the full matrix |
---|
76 | if(sobol) |
---|
77 | SobolFill3DMat(mat,num,fill) |
---|
78 | else |
---|
79 | RandomFill3DMat(mat,num,fill) |
---|
80 | endif |
---|
81 | |
---|
82 | ParseMatrix3D_rho(mat) |
---|
83 | Wave x3d=x3d |
---|
84 | Wave y3d=y3d |
---|
85 | Wave z3d=z3d |
---|
86 | |
---|
87 | endif |
---|
88 | |
---|
89 | |
---|
90 | Variable ii=0 |
---|
91 | NVAR grid=root:FFT_T |
---|
92 | |
---|
93 | for(ii=0;ii<num;ii+=1) |
---|
94 | FillXCylinder(mat,grid,rad,x3d[ii],y3d[ii],z3d[ii],len,fill) //cylinder 1 |
---|
95 | endfor |
---|
96 | |
---|
97 | return(0) |
---|
98 | End |
---|
99 | |
---|