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

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

changes to FFT routines to clean things up for a beta release at the next startup. No functionality changes, just cleaning up the operation, interface, and menu items.

Some important changes to the polarization routines. New equations for calculating the coefficient matrix. Now appears to be correct. Also, proper proportions are used when adding multiple files together to the matrix.

Change to the Model Docs is an updated reference.

WorkFileUtils? was broken when I changed to use linear_data exclusively. This has now been fixed and it operates as expected.

PackageLoader? now has menu items (under Macros) for the Polarization routines. These may later be moved to the SANS menu.

File size: 3.6 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"
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)
96        String w="mat"
97        Variable rad=30,len=300,sep=100
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       
103        $w=0
104        X_CoreShellCylinderHexGrid($w,rad,len,sep)
105       
106        NumberOfPoints()
107end
108
109Function X_CoreShellCylinderHexGrid(mat,rad,len,sep)
110        Wave mat
111        variable rad,len                //length of cylinders
112        Variable sep                    // EDGE separation, in same units as cylinder
113       
114       
115        NVAR grid=root:FFT_T
116        Variable np,spacing
117        np = DimSize(mat,0)                     // assumes that all dimensions are the same
118       
119        // fill a 2D plane with points
120        Make/O/B/N=(np,np) plane
121        plane = 0
122
123        spacing = round(sep/grid)               // so it's an integer
124        FillPlaneHexagonal(plane,spacing)
125       
126        // put it in the proper plane of the matrix
127        mat[np/2][][] = plane[q][r]                     // in the YZ plane
128       
129        ParseMatrix3D_rho(mat)
130        Wave x3d=x3d
131        Wave y3d=y3d
132        Wave z3d=z3d
133       
134        Variable ii=0,num
135        num = numpnts(x3d)     
136       
137        for(ii=0;ii<num;ii+=1)
138                FillXCylinder(mat,grid,rad,x3d[ii],y3d[ii],z3d[ii],len,1)               //cylinder 1
139        endfor
140
141// makes a crude core-shell cylinder   
142        for(ii=0;ii<num;ii+=1)
143                FillXCylinder(mat,grid,rad-20,x3d[ii],y3d[ii],z3d[ii],len,3)            //cylinder 1
144        endfor
145       
146        return(0)
147End
Note: See TracBrowser for help on using the repository browser.