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

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

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