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

Last change on this file since 941 was 941, checked in by srkline, 9 years ago

Moved rescaling panel from Wrapper.ipf to PlotUtils?.ipf, a more natural location.

Added "Manual Optimization" utility to the SANS Models/1D operations menu. this is a simple panel that allows users to "optimize" the fit in 1 or 2 directions. Very instructive to see whether you're near a minimum, and what the chi2 surface looks like around the minimum.

Did a similar Manual Optimization for the Real-space MultiClyinder? calculations from Ken Rubinson. simpler interface here.

All of the "CGB" fixes are present here, including the calculation of the number of guides.

File size: 4.1 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                "-"
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                "Vary_One_Cyl_Param",Vary_One_Cyl_Param()
57                "Vary_Two_Cyl_Param",Vary_Two_Cyl_Param()
58//              "Hexagonal Cylinders"
59//              "Conc Sphere Loop"
60//              "-"
61//              "Overnight"
62        end
63//      Submenu "2D testing"
64//              "Test 2D"
65//              "Connect Dots 2D"
66//              "Erase 2D"
67//      end
68//      "-"
69//      "Include FFT Fit Functions"             //automatically loaded now...
70End
71
72// analysis must be loaded first
73Proc IncludeFFTFitFunctions()
74        NCNR_AnalysisLoader("Load NCNR Analysis Macros")
75        Execute/P "INSERTINCLUDE \"FFT_Fit_Includes\""
76        Execute/P "COMPILEPROCEDURES "
77end
78
79
80////// examples of different structures, shapes and techniques for generating structures
81// other examples that could be added are:
82// -- a tetrahedron w/ 4 different colors (rotation, transformation)
83// -- core-shell spheres
84// -- binary (touching) spheres of different SLD (would make a simple fit function too)
85// -- ? other
86// -- orientation-dependent structures vs. 2D analytic
87// -- simple automation examples
88
89
90Proc PolydisperseSpheres(nSph,rad,pd,nPass,tagStr)
91        Variable nSph=505,rad=20,pd=0.25,nPass=10
92        String tagStr="_Poly"
93// nSph = number of LARGE spheres to add (not the voxel size)
94// rad = mean radius of these large spheres
95// pd = polydispersity (0,1)
96// nPass = number of repeat averaging passes
97// tagStr = extension string for the output name = "iBin"+tagStr
98        TestConcSpheres(nSph,rad,pd,nPass,tagStr)
99        Display $("iBin"+tagStr) vs $("qBin"+tagStr)
100        ModifyGraph grid=1,mirror=2,log=1
101        ModifyGraph mode=4,marker=2,msize=2
102        Legend
103End
104
105Proc PutXAxisCoreShellCyl_HexGrid(w,rad,len,sep,fill)
106        String w="mat"
107        Variable rad=30,len=300,sep=100,fill=10
108        Prompt w,"matrix"
109        prompt rad,"radius of cylinders"
110        prompt len,"length of cylinders"
111        prompt sep,"center-to-center separation of cylinders"
112        Prompt fill,"fill SLD value"
113       
114//      $w=0
115        X_CoreShellCylinderHexGrid($w,rad,len,sep,fill)
116       
117        NumberOfPoints()
118end
119
120Function X_CoreShellCylinderHexGrid(mat,rad,len,sep,fill)
121        Wave mat
122        variable rad,len                //length of cylinders
123        Variable sep                    // EDGE separation, in same units as cylinder
124        Variable fill
125       
126        NVAR    solventSLD = root:FFT_SolventSLD
127       
128        NVAR grid=root:FFT_T
129        Variable np,spacing
130        np = DimSize(mat,0)                     // assumes that all dimensions are the same
131       
132        // fill a 2D plane with points
133        Make/O/B/N=(np,np) plane
134        plane = solventSLD
135
136        spacing = round(sep/grid)               // so it's an integer
137        FillPlaneHexagonal(plane,spacing,fill)
138       
139        // put it in the proper plane of the matrix
140        mat[np/2][][] = plane[q][r]                     // in the YZ plane
141       
142        ParseMatrix3D_rho(mat)
143        Wave x3d=x3d
144        Wave y3d=y3d
145        Wave z3d=z3d
146       
147        Variable ii=0,num
148        num = numpnts(x3d)     
149       
150        for(ii=0;ii<num;ii+=1)
151                FillXCylinder(mat,grid,rad,x3d[ii],y3d[ii],z3d[ii],len,fill)            //cylinder 1
152        endfor
153
154// makes a crude core-shell cylinder   
155        for(ii=0;ii<num;ii+=1)
156                FillXCylinder(mat,grid,rad-20,x3d[ii],y3d[ii],z3d[ii],len,3*fill)               //cylinder 1
157        endfor
158       
159        return(0)
160End
Note: See TracBrowser for help on using the repository browser.