Changeset 816 for sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha
- Timestamp:
- Jul 13, 2011 3:02:15 PM (12 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Debye_Spheres.ipf
r798 r816 838 838 // make a lookup table to get from rho@xyz to the index 839 839 Variable maxSLD = WaveMax(SLD_id) 840 Make/O/D/N=(maxSLD+1) SLDlookup 840 Variable minSLD = abs(WaveMin(SLD_id)) 841 // Make/O/D/N=(maxSLD+1) SLDlookup 842 Make/O/D/N=(maxSLD+minSLD+1) SLDlookup 841 843 SLDLookup = NaN 842 844 ii=0 843 845 do 844 SLDLookup[SLD_id[ii] ] = ii846 SLDLookup[SLD_id[ii]+minSLD] = ii 845 847 ii+=1 846 848 while(ii<numpnts(SLD_id)) … … 880 882 rhoi = rho[ii] 881 883 // find the Nij. Not sure if these are what I really need... 882 PSFIndex = psf_id_mat[ SLDLookup[rhoi ] ][ SLDlookup[rhoi] ]884 PSFIndex = psf_id_mat[ SLDLookup[rhoi+minSLD] ][ SLDlookup[rhoi+minSLD] ] 883 885 Nij[PSFIndex] += 1 //these are just the Ni counts 884 886 endfor … … 887 889 // t1 = ticks 888 890 889 // this is the double loop that has been XOPed891 ////// this is the double loop that has been XOPed 890 892 // for(ii=0;ii<num;ii+=1) 891 893 // for(kk=(ii+1);kk<num;kk+=1) … … 898 900 // rhoi = rho[ii] 899 901 // rhok = rho[kk] 900 // PSFIndex = psf_id_mat[ SLDLookup[rhoi ] ][ SLDlookup[rhok] ]902 // PSFIndex = psf_id_mat[ SLDLookup[rhoi+minSLD] ][ SLDlookup[rhok+minSLD] ] 901 903 // binMatrix[binIndex][PSFIndex] += 1 902 904 // … … 907 909 // binMatrix is returned 908 910 911 912 909 913 nthreads=ThreadProcessorCount 910 914 if(nthreads == 1) 911 binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth,0,numpnts(xv))915 binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth,0,numpnts(xv)) 912 916 else 913 binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth) 914 endif 917 binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth) 918 endif 919 920 915 921 916 922 // Printf "binned the distances and SLDs = %g seconds\r",(ticks-t1)/60.15 … … 960 966 // now add up everything to get the intensity 961 967 // use the psf_id_mat[][] to get the Gij index 968 // 969 // 962 970 963 971 vol=4*Pi/3*rval*rval*rval … … 972 980 index = psf_id_mat[ii][ii] 973 981 974 F2Q = fQR*fQR*SLD_id[ii]*SLD_id[ii]*vol*vol 982 // F2Q = fQR*fQR*(SLD_id[ii]-solventSLD)*(SLD_id[ii]-solventSLD)*vol*vol 983 F2Q = fQR*fQR*(SLD_id[ii])*(SLD_id[ii])*vol*vol 975 984 976 985 Iqr[kk] += Nij[index]*F2Q //these are just the "ii" numbers … … 981 990 WAVE Sij = $("root:Sij"+num2str(index)) //switch the Sij 982 991 983 Iqr[kk] += fQR*fQR*SLD_id[ii]*SLD_id[jj]*vol*vol*Sij[kk] //factor of 2 removed, not sure why 992 // Iqr[kk] += fQR*fQR*(SLD_id[ii]-solventSLD)*(SLD_id[jj]-solventSLD)*vol*vol*Sij[kk] //factor of 2 removed, not sure why 993 Iqr[kk] += fQR*fQR*(SLD_id[ii])*(SLD_id[jj])*vol*vol*Sij[kk] //factor of 2 removed, not sure why 984 994 985 995 endfor … … 995 1005 996 1006 // support up to 8 threads at this time 997 Function binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth)1007 Function binSLDDistance_SLD_Threaded(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth) 998 1008 Wave xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat 999 Variable grid, binWidth1009 Variable minSLD, grid, binWidth 1000 1010 1001 1011 Variable nthreads,mt,left,right … … 1032 1042 //Print (ii*num/nthreads),((ii+1)*num/nthreads) 1033 1043 //ThreadStart mt,ii,binDistance_WF(xv, yv, zv, binMatrix0, grid, binWidth,(ii*num/nthreads),((ii+1)*num/nthreads)) 1034 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix0, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1044 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix0, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1035 1045 endif 1036 1046 if(ii==1) 1037 1047 Wave binMatrix1 1038 1048 binMatrix1 = 0 1039 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix1, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1049 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix1, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1040 1050 endif 1041 1051 if(ii==2) 1042 1052 Wave binMatrix2 1043 1053 binMatrix2 = 0 1044 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix2, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1054 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix2, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1045 1055 endif 1046 1056 if(ii==3) 1047 1057 Wave binMatrix3 1048 1058 binMatrix3 = 0 1049 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix3, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1059 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix3, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1050 1060 endif 1051 1061 if(ii==4) 1052 1062 Wave binMatrix4 1053 1063 binMatrix4 = 0 1054 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix4, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1064 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix4, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1055 1065 endif 1056 1066 if(ii==5) 1057 1067 Wave binMatrix5 1058 1068 binMatrix5 = 0 1059 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix5, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1069 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix5, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1060 1070 endif 1061 1071 if(ii==6) 1062 1072 Wave binMatrix6 1063 1073 binMatrix6 = 0 1064 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix6, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1074 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix6, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1065 1075 endif 1066 1076 if(ii==7) 1067 1077 Wave binMatrix7 1068 1078 binMatrix7 = 0 1069 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix7, SLDLookup, psf_id_mat, grid, binWidth, left*num, right*num)1079 ThreadStart mt,ii,binDistance_SLD_WF(xv, yv, zv, rho, binMatrix7, SLDLookup, psf_id_mat, minSLD, grid, binWidth, left*num, right*num) 1070 1080 endif 1071 1081 … … 1116 1126 1117 1127 // this is just a worker function to get the ThreadStart operation to compile 1118 ThreadSafe Function binDistance_SLD_WF(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth, p1,p2)1128 ThreadSafe Function binDistance_SLD_WF(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth, p1,p2) 1119 1129 Wave xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat 1120 Variable grid, binWidth, p1,p21130 Variable minSLD, grid, binWidth, p1,p2 1121 1131 1122 1132 Variable ret 1123 ret = binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, grid, binWidth, p1,p2)1133 ret = binSLDDistanceX(xv, yv, zv, rho, binMatrix, SLDLookup, psf_id_mat, minSLD, grid, binWidth, p1,p2) 1124 1134 1125 1135 return(0)
Note: See TracChangeset
for help on using the changeset viewer.