1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | #include "FFT_Panel" |
---|
4 | #include "FFT_Cubes" |
---|
5 | #include "FFT_VoxelDisplay" |
---|
6 | #include "FFT_FillMatrixShapes" |
---|
7 | #include "FFT_Debye_Spheres" |
---|
8 | |
---|
9 | #include "FFT_Cylinder_Fills" |
---|
10 | #include "FFT_Cylinder_2D_Fill" |
---|
11 | #include "FFT_Plane_Fills" |
---|
12 | #include "FFT_Lattice_Fills" |
---|
13 | #include "FFT_Sphere_Fills" |
---|
14 | |
---|
15 | #include "FFT_FillTests" // testing and example routines (MAR 2012) |
---|
16 | |
---|
17 | #include "FFT_ConcentratedSpheres" |
---|
18 | #include "FFT_ConnectedRods" |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | Init_FFT() |
---|
23 | |
---|
24 | |
---|
25 | Menu "Macros" |
---|
26 | "-" |
---|
27 | "Init_FFT" |
---|
28 | Submenu "Matrix Info" |
---|
29 | "Number of Points" |
---|
30 | // "Fill Statistics" //only valid for concentrated spheres... |
---|
31 | "Center_to_Center" |
---|
32 | "Davg_to_Np" |
---|
33 | end |
---|
34 | Submenu "3D Examples" |
---|
35 | "Polydisperse Spheres" |
---|
36 | "-" |
---|
37 | "Connect Points With Cylinders",ConnectDots3D() |
---|
38 | "Connect Triangulated Points",ConnectTriangulatedRods() |
---|
39 | "-" |
---|
40 | "Put Random Cylinders at Points" |
---|
41 | "Put X-axis Cylinders at Points" |
---|
42 | "Put X-axis Cylinders Square Grid",PutXAxisCylindersSquare() |
---|
43 | "Put X-axis Cylinders Hexagonal Grid",PutXAxisCylindersHexagonal() |
---|
44 | "Core-shell Cylinders Hex Grid",PutXAxisCoreShellCyl_HexGrid() |
---|
45 | // "-" |
---|
46 | // "Anisotropic_FFT_to_USANS" |
---|
47 | // "Isotropic_FFT_to_USANS" |
---|
48 | end |
---|
49 | Submenu "Matrix Viewing" |
---|
50 | // "ParseMatrix 3D to XYZ" |
---|
51 | // "Plot XYZ" //replaced by Gizmo |
---|
52 | "Animated Slices" |
---|
53 | // "Show Full Matrix" |
---|
54 | end |
---|
55 | Submenu "Automation Examples" |
---|
56 | // "Hexagonal Cylinders" |
---|
57 | // "Conc Sphere Loop" |
---|
58 | // "-" |
---|
59 | // "Overnight" |
---|
60 | end |
---|
61 | // Submenu "2D testing" |
---|
62 | // "Test 2D" |
---|
63 | // "Connect Dots 2D" |
---|
64 | // "Erase 2D" |
---|
65 | // end |
---|
66 | // "-" |
---|
67 | // "Include FFT Fit Functions" //automatically loaded now... |
---|
68 | End |
---|
69 | |
---|
70 | // analysis must be loaded first |
---|
71 | Proc IncludeFFTFitFunctions() |
---|
72 | NCNR_AnalysisLoader("Load NCNR Analysis Macros") |
---|
73 | Execute/P "INSERTINCLUDE \"FFT_Fit_Includes\"" |
---|
74 | Execute/P "COMPILEPROCEDURES " |
---|
75 | end |
---|
76 | |
---|
77 | |
---|
78 | ////// examples of different structures, shapes and techniques for generating structures |
---|
79 | // other examples that could be added are: |
---|
80 | // -- a tetrahedron w/ 4 different colors (rotation, transformation) |
---|
81 | // -- core-shell spheres |
---|
82 | // -- binary (touching) spheres of different SLD (would make a simple fit function too) |
---|
83 | // -- ? other |
---|
84 | // -- orientation-dependent structures vs. 2D analytic |
---|
85 | // -- simple automation examples |
---|
86 | |
---|
87 | |
---|
88 | Proc PolydisperseSpheres(nSph,rad,pd,nPass,tagStr) |
---|
89 | Variable nSph=505,rad=20,pd=0.25,nPass=10 |
---|
90 | String tagStr="_Poly" |
---|
91 | // nSph = number of LARGE spheres to add (not the voxel size) |
---|
92 | // rad = mean radius of these large spheres |
---|
93 | // pd = polydispersity (0,1) |
---|
94 | // nPass = number of repeat averaging passes |
---|
95 | // tagStr = extension string for the output name = "iBin"+tagStr |
---|
96 | TestConcSpheres(nSph,rad,pd,nPass,tagStr) |
---|
97 | Display $("iBin"+tagStr) vs $("qBin"+tagStr) |
---|
98 | ModifyGraph grid=1,mirror=2,log=1 |
---|
99 | ModifyGraph mode=4,marker=2,msize=2 |
---|
100 | Legend |
---|
101 | End |
---|
102 | |
---|
103 | Proc PutXAxisCoreShellCyl_HexGrid(w,rad,len,sep,fill) |
---|
104 | String w="mat" |
---|
105 | Variable rad=30,len=300,sep=100,fill=10 |
---|
106 | Prompt w,"matrix" |
---|
107 | prompt rad,"radius of cylinders" |
---|
108 | prompt len,"length of cylinders" |
---|
109 | prompt sep,"center-to-center separation of cylinders" |
---|
110 | Prompt fill,"fill SLD value" |
---|
111 | |
---|
112 | // $w=0 |
---|
113 | X_CoreShellCylinderHexGrid($w,rad,len,sep,fill) |
---|
114 | |
---|
115 | NumberOfPoints() |
---|
116 | end |
---|
117 | |
---|
118 | Function X_CoreShellCylinderHexGrid(mat,rad,len,sep,fill) |
---|
119 | Wave mat |
---|
120 | variable rad,len //length of cylinders |
---|
121 | Variable sep // EDGE separation, in same units as cylinder |
---|
122 | Variable fill |
---|
123 | |
---|
124 | NVAR solventSLD = root:FFT_SolventSLD |
---|
125 | |
---|
126 | NVAR grid=root:FFT_T |
---|
127 | Variable np,spacing |
---|
128 | np = DimSize(mat,0) // assumes that all dimensions are the same |
---|
129 | |
---|
130 | // fill a 2D plane with points |
---|
131 | Make/O/B/N=(np,np) plane |
---|
132 | plane = solventSLD |
---|
133 | |
---|
134 | spacing = round(sep/grid) // so it's an integer |
---|
135 | FillPlaneHexagonal(plane,spacing,fill) |
---|
136 | |
---|
137 | // put it in the proper plane of the matrix |
---|
138 | mat[np/2][][] = plane[q][r] // in the YZ plane |
---|
139 | |
---|
140 | ParseMatrix3D_rho(mat) |
---|
141 | Wave x3d=x3d |
---|
142 | Wave y3d=y3d |
---|
143 | Wave z3d=z3d |
---|
144 | |
---|
145 | Variable ii=0,num |
---|
146 | num = numpnts(x3d) |
---|
147 | |
---|
148 | for(ii=0;ii<num;ii+=1) |
---|
149 | FillXCylinder(mat,grid,rad,x3d[ii],y3d[ii],z3d[ii],len,fill) //cylinder 1 |
---|
150 | endfor |
---|
151 | |
---|
152 | // makes a crude core-shell cylinder |
---|
153 | for(ii=0;ii<num;ii+=1) |
---|
154 | FillXCylinder(mat,grid,rad-20,x3d[ii],y3d[ii],z3d[ii],len,3*fill) //cylinder 1 |
---|
155 | endfor |
---|
156 | |
---|
157 | return(0) |
---|
158 | End |
---|