Changeset 2206
- Timestamp:
- Apr 11, 2016 4:27:22 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r2205 r2206 2979 2979 2980 2980 def OnSimulate(event): 2981 debug = False 2982 idebug = 0 2983 if debug: idebug = 1 2981 2984 ctrls = '' 2982 2985 dlg = G2gd.DIFFaXcontrols(G2frame,ctrls) … … 3016 3019 return 3017 3020 profile = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[1] 3018 ctrls = '0\n0\n3\n' 3019 G2pwd.StackSim(data['Layers'],ctrls,scale,background,limits,inst,profile) 3020 test1 = np.copy(profile[3]) 3021 test1 = np.where(test1,test1,1.0) 3022 G2pwd.CalcStackingPWDR(data['Layers'],scale,background,limits,inst,profile) 3023 test2 = np.copy(profile[3]) 3024 rat = (test1-test2)/test1 3025 XY = np.vstack((profile[0],rat)) 3026 G2plt.PlotXY(G2frame,[XY,],XY2=[],labelX=r'$\mathsf{2\theta}$', 3027 labelY='ratio',newPlot=True,Title='DIFFaX vs GSASII',lines=True) 3021 G2pwd.CalcStackingPWDR(data['Layers'],scale,background,limits,inst,profile,debug) 3022 if debug: 3023 ctrls = '0\n%d\n3\n'%(idebug) 3024 G2pwd.StackSim(data['Layers'],ctrls,scale,background,limits,inst,profile) 3025 test1 = np.copy(profile[3]) 3026 test1 = np.where(test1,test1,1.0) 3027 G2pwd.CalcStackingPWDR(data['Layers'],scale,background,limits,inst,profile,debug) 3028 test2 = np.copy(profile[3]) 3029 rat = test1-test2 3030 XY = np.vstack((profile[0],rat)) 3031 G2plt.PlotXY(G2frame,[XY,],XY2=[],labelX=r'$\mathsf{2\theta}$', 3032 labelY='ratio',newPlot=True,Title='DIFFaX vs GSASII',lines=True) 3028 3033 # GSASIIpath.IPyBreak() 3029 3034 G2plt.PlotPatterns(G2frame,plotType='PWDR') … … 3034 3039 planeChoice = ['h0l','0kl','hhl','h-hl',] 3035 3040 lmaxChoice = [str(i+1) for i in range(6)] 3036 ctrls = '0\n 0\n4\n1\n%d\n1\n16\n1\n%d\n0\nend\n'% \3037 ( planeChoice.index(simCodes[1])+1,lmaxChoice.index(simCodes[2])+1)3041 ctrls = '0\n%d\n4\n1\n%d\n%d\n16\n1\n1\n0\nend\n'% \ 3042 (idebug,planeChoice.index(simCodes[1])+1,lmaxChoice.index(simCodes[2])+1) 3038 3043 G2pwd.StackSim(data['Layers'],ctrls) 3039 G2pwd.CalcStackingSADP(data['Layers'] )3044 G2pwd.CalcStackingSADP(data['Layers'],debug) 3040 3045 wx.CallAfter(UpdateLayerData) 3041 3046 -
trunk/GSASIIplot.py
r2205 r2206 1113 1113 RenderDots(HKL,RC) 1114 1114 time0 = time.time() 1115 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix1115 # if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix 1116 1116 Page.canvas.SwapBuffers() 1117 1117 … … 5625 5625 RenderBackbone(Backbone,BackboneColor,bondR) 5626 5626 # print time.time()-time0 5627 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix5627 # if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix 5628 5628 Page.canvas.SwapBuffers() 5629 5629 … … 5932 5932 RenderBonds(x,y,z,Bonds[iat],0.05,color) 5933 5933 RenderLabel(x,y,z,' '+atNames[iat],matRot) 5934 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix5934 # if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix 5935 5935 Page.canvas.SwapBuffers() 5936 5936 … … 6316 6316 if Page.labels: 6317 6317 RenderLabel(x,y,z,' '+AtNames[iat],matRot) 6318 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix6318 # if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix 6319 6319 Page.canvas.SwapBuffers() 6320 6320 -
trunk/GSASIIpwd.py
r2197 r2206 1816 1816 #make DIFFaX control.dif file - future use GUI to set some of these flags 1817 1817 cf = open('control.dif','w') 1818 if ctrls == '0\n0\n3\n' :1818 if ctrls == '0\n0\n3\n' or ctrls == '0\n1\n3\n': 1819 1819 x0 = profile[0] 1820 1820 iBeg = np.searchsorted(x0,limits[0]) … … 1836 1836 elif 'N' in inst['Type'][0]: 1837 1837 df.write('NEUTRON\n') 1838 if ctrls == '0\n0\n3\n' :1838 if ctrls == '0\n0\n3\n' or ctrls == '0\n1\n3\n': 1839 1839 df.write('%.4f\n'%(G2mth.getMeanWave(inst))) 1840 1840 U = ateln2*inst['U'][1]/10000. … … 1963 1963 return iFin-iBeg 1964 1964 1965 def SetStackingSF(Layers ):1965 def SetStackingSF(Layers,debug): 1966 1966 # Load scattering factors into DIFFaX arrays 1967 1967 import atmdata … … 1983 1983 SFdat.append(SF) 1984 1984 SFdat = np.array(SFdat) 1985 pyx.pyloadscf(len(atTypes),aTypes,SFdat.T )1985 pyx.pyloadscf(len(atTypes),aTypes,SFdat.T,debug) 1986 1986 1987 1987 def SetStackingClay(Layers,Type): … … 2063 2063 TransP.append([trans[0] for trans in Ytrans]) #get just the numbers 2064 2064 TransX.append([trans[1:4] for trans in Ytrans]) #get just the numbers 2065 TransP = np.array(TransP,dtype='float') 2065 TransP = np.array(TransP,dtype='float').T 2066 2066 TransX = np.array(TransX,dtype='float') 2067 # GSASIIpath.IPyBreak() 2067 2068 pyx.pygettrans(Nlayers,TransP,TransX) 2068 2069 2069 def CalcStackingPWDR(Layers,scale,background,limits,inst,profile ):2070 def CalcStackingPWDR(Layers,scale,background,limits,inst,profile,debug): 2070 2071 # Scattering factors 2071 SetStackingSF(Layers )2072 SetStackingSF(Layers,debug) 2072 2073 # Controls & sequences 2073 2074 laueId,controls = SetStackingClay(Layers,'PWDR') … … 2094 2095 W = ateln2*inst['W'][1]/10000. 2095 2096 HWHM = U*nptand(x0[iBeg:iFin]/2.)**2+V*nptand(x0[iBeg:iFin]/2.)+W 2096 HW = np. mean(HWHM)2097 HW = np.sqrt(np.mean(HWHM)) 2097 2098 BrdSpec = np.zeros(Nsteps) 2098 2099 if 'Mean' in Layers['selInst']: … … 2117 2118 print ' Broadening time = %.2fs'%(time.time()-time0) 2118 2119 2119 2120 # GSASIIpath.IPyBreak() 2121 2122 def CalcStackingSADP(Layers): 2120 def CalcStackingSADP(Layers,debug): 2123 2121 2124 2122 # Scattering factors 2125 SetStackingSF(Layers )2123 SetStackingSF(Layers,debug) 2126 2124 # Controls & sequences 2127 2125 laueId,controls = SetStackingClay(Layers,'SADP') -
trunk/fsource/pydiffax.for
r2197 r2206 1 SUBROUTINE PYLOADSCF(NATP,ATYPES,SFDAT )1 SUBROUTINE PYLOADSCF(NATP,ATYPES,SFDAT,DEBG) 2 2 3 3 Cf2py intent(in) NATP … … 5 5 Cf2py intent(in) SFDAT 6 6 cf2py depend(NATP) ATYPES,SFDAT 7 cf2py intent(in) DEBG 7 8 8 9 INCLUDE 'DIFFaXsubs/DIFFaX.par' … … 12 13 CHARACTER*4 ATYPES(NATP) 13 14 REAL*4 SFDAT(9,NATP) 15 LOGICAL DEBG 14 16 15 17 C fill common x-ray scattering factors 16 debug = .FALSE.18 debug = DEBG 17 19 DO J=1,NATP 18 20 WRITE(atom_l(J),'(A4)') ATYPES(J) … … 195 197 l_alpha(J,I) = TRP(I,J) 196 198 DO K=1,3 197 l_r(K,J,I) = TRX( I,J,K)199 l_r(K,J,I) = TRX(J,I,K) 198 200 END DO 199 201 END DO … … 218 220 EXTERNAL AGLQ16,GETSPC 219 221 220 221 C print *,n_actual,(l_n_atoms(i),i=1,n_actual) 222 C do j=1,n_actual 223 C do i=1,l_n_atoms(j) 224 C print *,a_name(i,j),(a_pos(k,i,j),k=1,3) 225 C end do 226 C end do 227 c print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror 228 C do i=1,n_layers 229 C print *,' layer',i 230 C do j=1,n_layers 231 C print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3) 232 C end do 233 C end do 234 c print *,cell_a,cell_b,cell_c,cell_gamma,pnt_grp,SymGrpNo 235 c DoSymDump = .TRUE. 222 DoSymDump = .FALSE. 236 223 237 224 ok = .TRUE. … … 239 226 CALL DETUN() 240 227 CALL OPTIMZ('GSAS-II',ok) 228 If (debug) then 229 print *,cell_a,cell_b,cell_c,cell_gamma,pnt_grp,SymGrpNo 230 DoSymDump = .TRUE. 231 print *,n_actual,(l_n_atoms(i),i=1,n_actual) 232 do j=1,n_actual 233 do i=1,l_n_atoms(j) 234 print *,a_name(i,j),(a_pos(k,i,j),k=1,3) 235 end do 236 end do 237 do i=1,n_layers 238 print *,' layer',i 239 do j=1,n_layers 240 print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3) 241 end do 242 end do 243 print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror 244 end if 241 245 242 246 C print *,lambda,max_angle,h_bnd,k_bnd,l_bnd,no_trials, … … 314 318 i_plane = CNTRLS(2) 315 319 l_upper = CNTRLS(3) 316 C print *,n_actual,(l_n_atoms(i),i=1,n_actual) 317 C do j=1,n_actual 318 C do i=1,l_n_atoms(j) 319 C print *,a_name(i,j),(a_pos(k,i,j),k=1,3) 320 C end do 321 C end do 322 c print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror 323 C do i=1,n_layers 324 C print *,' layer',i 325 C do j=1,n_layers 326 C print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3) 327 C end do 328 C end do 320 DoSymDump = .FALSE. 321 if (debug) then 322 print *,cell_a,cell_b,cell_c,cell_gamma 323 print *,pnt_grp,SymGrpNo 324 DoSymDump = .TRUE. 325 print *,n_actual,(l_n_atoms(i),i=1,n_actual) 326 do j=1,n_actual 327 do i=1,l_n_atoms(j) 328 print *,a_name(i,j),(a_pos(k,i,j),k=1,3) 329 end do 330 end do 331 do i=1,n_layers 332 print *,' layer',i 333 do j=1,n_layers 334 print *,'layer',j,l_alpha(i,j),(l_r(k,i,j),k=1,3) 335 end do 336 end do 337 print *, recrsv,inf_thick,xplcit,rndm,l_cnt,has_l_mirror 338 end if 329 339 ok = .TRUE. 330 340 331 c print *,cell_a,cell_b,cell_c,cell_gamma,pnt_grp,SymGrpNo332 c DoSymDump = .TRUE.333 341 CALL SPHCST() 334 342 CALL DETUN()
Note: See TracChangeset
for help on using the changeset viewer.