Changeset 4494
- Timestamp:
- Jun 18, 2020 10:10:00 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r4493 r4494 1467 1467 'showABC':True,'selectedAtoms':[],'Atoms':[],'oldxy':[],'magMult':1.0, 1468 1468 'bondList':{},'viewDir':[1,0,0],'Plane':[[0,0,1],False,False,0.0,[255,255,0]], 1469 'peakMoveView':True,'PeakDistRadius':0.0, 1470 'atomsExpandRadius':5.,'atomsDistRadius':2.5, 1469 'peakMoveView':True,'PeakDistRadius':0.0,'showVoids':False,'showMap':False, 1470 'atomsExpandRadius':5.,'atomsDistRadius':2.5,'Voids':[], 1471 1471 } 1472 1472 for key in defaultDrawing: … … 7356 7356 if 'SymFade' not in drawingData: 7357 7357 drawingData['SymFade'] = False 7358 if 'Voids' not in drawingData: 7359 drawingData['Voids'] = [] 7360 drawinData['showVoids'] = False 7361 drawingData['showMap'] = False 7358 7362 cx,ct,cs,ci = [0,0,0,0] 7359 7363 if generalData['Type'] in ['nuclear','faulted',]: … … 8397 8401 rMax = max(data['General']['vdWRadii']) 8398 8402 cell = data['General']['Cell'][1:7] 8403 drawingData = data['Drawing'] 8399 8404 voidDlg = wx.Dialog(G2frame,wx.ID_ANY, 8400 8405 'Void computation parameters', … … 8407 8412 voidPar = {'a':1., 'b':1., 'c':1., 'grid':.25, 'probe':0.5} 8408 8413 for i in ('a', 'b', 'c'): 8409 mainSizer.Add( 8410 G2G.G2SliderWidget(voidDlg,voidPar,i, 8411 'Max '+i+' value: ',0.,xmax,100)) 8412 8414 mainSizer.Add(G2G.G2SliderWidget(voidDlg,voidPar,i, 8415 'Max '+i+' value: ',0.,xmax,100)) 8413 8416 hSizer = wx.BoxSizer(wx.HORIZONTAL) 8414 8417 hSizer.Add(wx.StaticText(voidDlg,wx.ID_ANY,'Grid spacing (A)')) … … 8440 8443 voidDlg.Destroy() 8441 8444 if res != wx.ID_OK: return 8442 res= VoidMap(data, voidPar['a'], voidPar['b'], voidPar['c'],8445 drawingData['Voids'] = VoidMap(data, voidPar['a'], voidPar['b'], voidPar['c'], 8443 8446 voidPar['grid'],voidPar['probe']) 8444 G2plt.PlotStructure(G2frame,data,8445 voidMap=res,voidRadius=voidPar['probe'])8447 drawingData['showVoids'] = True 8448 G2plt.PlotStructure(G2frame,data) 8446 8449 8447 8450 ################################################################################ … … 8628 8631 def OnSymFade(event): 8629 8632 drawingData['SymFade'] = symFade.GetValue() 8633 G2plt.PlotStructure(G2frame,data) 8634 8635 def OnShowMap(event): 8636 drawingData['showMap'] = showMap.GetValue() 8637 G2plt.PlotStructure(G2frame,data) 8638 8639 def OnShowVoids(event): 8640 drawingData['showVoids'] = showVoids.GetValue() 8630 8641 G2plt.PlotStructure(G2frame,data) 8631 8642 … … 8764 8775 symFade.SetValue(drawingData['SymFade']) 8765 8776 line3Sizer.Add(symFade,0,WACV) 8777 showMap = wx.CheckBox(drawOptions,-1,label=' Show density map?') 8778 showMap.Bind(wx.EVT_CHECKBOX, OnShowMap) 8779 showMap.SetValue(drawingData['showMap']) 8780 line3Sizer.Add(showMap,0,WACV) 8781 showVoids = wx.CheckBox(drawOptions,-1,label=' Show void map?') 8782 showVoids.Bind(wx.EVT_CHECKBOX, OnShowVoids) 8783 showVoids.SetValue(drawingData['showVoids']) 8784 line3Sizer.Add(showVoids,0,WACV) 8766 8785 showSizer.Add(line3Sizer) 8767 8786 … … 8887 8906 mainSizer.Add(PlaneSizer(),0,) 8888 8907 G2G.HorizontalLine(mainSizer,drawOptions) 8889 mainSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY, 8890 'On map peak selection:'),0,WACV) 8891 mainSizer.Add(G2G.G2CheckBox(drawOptions,'Move view point', 8892 drawingData,'peakMoveView')) 8908 mainSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'On map peak selection:'),0,WACV) 8909 mainSizer.Add(G2G.G2CheckBox(drawOptions,'Move view point',drawingData,'peakMoveView')) 8893 8910 mapSizer = wx.FlexGridSizer(0,3,5,5) 8894 8911 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Show Map points within:'),0,WACV) 8895 8912 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,drawingData,'PeakDistRadius', 8896 8913 xmin=0.0,xmax=5.0,nDig=(10,1),size=(50,-1))) 8897 8914 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8898 8915 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Show atoms within:'),0,WACV) 8899 8916 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,drawingData,'atomsExpandRadius', 8900 8917 xmin=0.0,xmax=15.0,nDig=(10,1),size=(50,-1))) 8901 8918 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8902 8919 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Label distance to atoms within:'),0,WACV) 8903 8920 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,drawingData,'atomsDistRadius', 8904 8921 xmin=0.0,xmax=15.0,nDig=(10,1),size=(50,-1))) 8905 8922 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8906 8923 mainSizer.Add(mapSizer) … … 11884 11901 data['Drawing']['contourLevel'] = 1. 11885 11902 data['Drawing']['mapSize'] = 10. 11903 data['Drawing']['showMap'] = True 11886 11904 print (dim+mapData['MapType']+' computed: rhomax = %.3f rhomin = %.3f sigma = %.3f'%(np.max(mapData['rho']),np.min(mapData['rho']),mapSig)) 11887 11905 UpdateDrawAtoms() … … 11891 11909 generalData = data['General'] 11892 11910 generalData['Map'] = mapDefault.copy() 11911 data['Drawing']['showMap'] = False 11893 11912 G2plt.PlotStructure(G2frame,data) 11894 11913 … … 12028 12047 data['Drawing']['contourLevel'] = 1. 12029 12048 data['Drawing']['mapSize'] = 10. 12049 data['Drawing']['showMap'] = True 12030 12050 print (' Charge flip map computed: rhomax = %.3f rhomin = %.3f sigma = %.3f'%(np.max(mapData['rho']),np.min(mapData['rho']),mapSig)) 12031 12051 if mapData['Rcf'] < 99.: -
trunk/GSASIIplot.py
r4491 r4494 7928 7928 ################################################################################ 7929 7929 7930 def PlotStructure(G2frame,data,firstCall=False,pageCallback=None, 7931 voidMap=[],voidRadius=.1): 7930 def PlotStructure(G2frame,data,firstCall=False,pageCallback=None): 7932 7931 '''Crystal structure plotting package. Can show structures as balls, sticks, lines, 7933 7932 thermal motion ellipsoids and polyhedra. Magnetic moments shown as black/red … … 7942 7941 update items on the parent page. Currently implemented for 7943 7942 RB Models tab only 7944 :param list voidMap: a list of coordinates to be plotted as small spheres7945 :param float voidRadius: radius of spheres drawn for void map7946 7943 ''' 7947 7944 … … 8713 8710 GL.glPopMatrix() 8714 8711 8712 def RenderFadeSphere(x,y,z,radius,color): 8713 fade = list(color) + [1.0,] 8714 GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_AMBIENT_AND_DIFFUSE,fade) 8715 GL.glShadeModel(GL.GL_FLAT) 8716 GL.glEnable(GL.GL_BLEND) 8717 GL.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA) 8718 GL.glPushMatrix() 8719 GL.glTranslate(x,y,z) 8720 GL.glMultMatrixf(B4mat.T) 8721 q = GLU.gluNewQuadric() 8722 GLU.gluSphere(q,radius,20,10) 8723 GL.glPopMatrix() 8724 GL.glDisable(GL.GL_BLEND) 8725 GL.glShadeModel(GL.GL_SMOOTH) 8726 8715 8727 def RenderDots(XYZ,RC): 8716 8728 GL.glEnable(GL.GL_COLOR_MATERIAL) … … 9094 9106 RenderLabel(x,y,z,' '+atom[ct-2],radius,wxGreen,matRot) 9095 9107 # glDisable(GL_BLEND) 9096 if not FourD and len(rhoXYZ) : #no green dot map for 4D - it's wrong!9108 if not FourD and len(rhoXYZ) and drawingData['showMap']: #no green dot map for 4D - it's wrong! 9097 9109 RenderMap(rho,rhoXYZ,indx,Rok) 9098 9110 if len(Ind) == 1 and pageName == 'Map peaks': … … 9251 9263 # agg = canvas.switch_backends(Canvas) 9252 9264 RenderViewPlane(msize*eplane,Zimg,width,height) 9253 for x,y,z in voidMap: 9254 RenderSphere(x,y,z,voidRadius,(0,1.,0)) 9265 if drawingData['showVoids']: 9266 for x,y,z in drawingData['Voids']: 9267 RenderFadeSphere(x,y,z,.05,(0.,0.,1.)) 9255 9268 try: 9256 9269 if Page.context: Page.canvas.SetCurrent(Page.context)
Note: See TracChangeset
for help on using the changeset viewer.