source: sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Cubes_Includes.ipf @ 840

Last change on this file since 840 was 840, checked in by srkline, 11 years ago

fixing the shape filling functions to explicitly take fill as a parameter, and make the default fill value = 10 == 10 e-7 A-2

More additions to the RealSpeca? help file

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