Changeset 4499
- Timestamp:
- Jun 19, 2020 4:19:13 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r4498 r4499 1057 1057 return # Returning without calling event.Skip, which eats the keystroke 1058 1058 1059 def G2SliderWidget(parent,loc,key,label,xmin,xmax,iscale): 1059 def G2SliderWidget(parent,loc,key,label,xmin,xmax,iscale, 1060 onChange=None,onChangeArgs=[]): 1060 1061 '''A customized combination of a wx.Slider and a validated 1061 1062 wx.TextCtrl (see :class:`ValidatedTxtCtrl`) that allows either … … 1081 1082 :param float iscale: number to scale values to integers which is what the 1082 1083 Scale widget uses. If the xmin=1 and xmax=4 and iscale=1 then values 1083 only the values 1,2,3 and 4 can be set with the slider. If 1084 only the values 1,2,3 and 4 can be set with the slider. 1085 1086 :param callable onChange: function to call when value is changed. 1087 Default is None where nothing will be called. 1084 1088 1089 :param list onChangeArgs: arguments to be passed to onChange function 1090 when called. 1085 1091 :returns: returns a wx.BoxSizer containing the widgets 1086 1092 ''' … … 1089 1095 loc[key] = vScale.GetValue()/float(iscale) 1090 1096 wx.TextCtrl.SetValue(vEntry,str(loc[key])) # will not trigger onValSet 1097 if onChange: onChange(*onChangeArgs) 1091 1098 def onValSet(*args,**kwargs): 1092 1099 vScale.SetValue(int(0.5+iscale*loc[key])) 1100 if onChange: onChange(*onChangeArgs) 1093 1101 loc[key] = min(xmax,max(xmin,loc[key])) 1094 1102 hSizer = wx.BoxSizer(wx.HORIZONTAL) -
trunk/GSASIIphsGUI.py
r4494 r4499 233 233 cx,ct,cs = self.Drawing['atomPtrs'][:3] 234 234 for Id in self.indx: 235 atom = self.Drawing['Atoms'][Id] 236 self.centers.append(atom[cx:cx+3]) 237 atoms.append('%s(%s)'%(atom[ct-1],atom[cs-1])) 235 if Id < len(self.Drawing['Atoms']): 236 atom = self.Drawing['Atoms'][Id] 237 self.centers.append(atom[cx:cx+3]) 238 atoms.append('%s(%s)'%(atom[ct-1],atom[cs-1])) 239 else: 240 self.centers.append(list(self.Drawing['viewPoint'][0])) 241 atoms.append('View point') 238 242 topSizer.Add(wx.ComboBox(self.panel,choices=atoms,value=atoms[0], 239 243 style=wx.CB_READONLY|wx.CB_DROPDOWN),0,WACV) … … 1095 1099 #### Phase editing routines 1096 1100 ################################################################################ 1097 def getAtomSelections(AtmTbl,cn=0,action='action' ):1101 def getAtomSelections(AtmTbl,cn=0,action='action',includeView=False): 1098 1102 '''get selected atoms from table or ask user if none are selected 1099 1103 1100 param: AtmTbl list atom or draw atom table 1101 param: int cn atom name position 1102 action: str description 1103 returns: list indx selected atoms fr tom indices in table 1104 :param list AtmTbl: atom or draw atom table 1105 :param int cn: atom name position 1106 :param str action: description for prompt, when needed 1107 :param bool includeView: if True, the viewpoint is included 1108 as an option in the selection dialog 1109 :returns: indx (list) selected atoms from indices in table. 1110 If includeView is True, indx can contain index n (where there 1111 are n atoms in table). This is indicates the viewpoint. 1104 1112 ''' 1105 1113 indx = AtmTbl.GetSelectedRows() … … 1117 1125 choices.append(val) 1118 1126 if not choices: return 1127 if includeView: 1128 choices.append('View point') 1119 1129 dlg = G2G.G2MultiChoiceDialog(AtmTbl.GetTopLevelParent(), 1120 1130 'Select atoms','Select atoms for '+action,choices) … … 1469 1479 'peakMoveView':True,'PeakDistRadius':0.0,'showVoids':False,'showMap':False, 1470 1480 'atomsExpandRadius':5.,'atomsDistRadius':2.5,'Voids':[], 1481 'VPPeakDistRad':0.,'VPatomsExpandRad':0.,'VPatomsDistRad':0., 1471 1482 } 1472 1483 for key in defaultDrawing: … … 7855 7866 def AddSphere(event): 7856 7867 cx,ct,cs,ci = getAtomPtrs(data,draw=True) 7857 indx = getAtomSelections(drawAtoms,ct-1) 7868 indx = getAtomSelections(drawAtoms,ct-1,'as center of sphere addition', 7869 includeView=True) 7858 7870 if not indx: return 7859 7871 generalData = data['General'] … … 8344 8356 def OnDrawDistVP(event): 8345 8357 # distance to view point 8346 indx = getAtomSelections(drawAtoms, 'distance calc')8358 indx = getAtomSelections(drawAtoms,action='distance calc') 8347 8359 if not indx: return 8348 8360 generalData = data['General'] … … 8505 8517 G2plt.PlotStructure(G2frame,data) 8506 8518 8507 def OnContourLevel(event):8508 drawingData['contourLevel'] = contourLevel.GetValue()/100.8509 contourLevelTxt.SetLabel(' Rho maximum: '+'%.2f'%(drawingData['contourLevel']*generalData['Map']['rhoMax']))8510 G2plt.PlotStructure(G2frame,data)8511 8512 def OnMapSize(event):8513 drawingData['mapSize'] = mapSize.GetValue()/10.8514 mapSizeTxt.SetLabel(' Map radius, A: '+'%.1f'%(drawingData['mapSize']))8515 G2plt.PlotStructure(G2frame,data)8516 8517 8518 8519 slopSizer = wx.BoxSizer(wx.HORIZONTAL) 8519 8520 slideSizer = wx.FlexGridSizer(0,2,0,0) … … 8584 8585 magMult.Bind(wx.EVT_SLIDER, OnMagMult) 8585 8586 slideSizer.Add(magMult,1,wx.EXPAND|wx.RIGHT) 8586 8587 if generalData['Map']['rhoMax'] and not generalData.get('4DmapData',{}): 8588 contourLevelTxt = wx.StaticText(drawOptions,-1,' Rho maximum: '+'%.2f'%(drawingData['contourLevel']*generalData['Map']['rhoMax'])) 8589 slideSizer.Add(contourLevelTxt,0,WACV) 8590 contourLevel = wx.Slider(drawOptions,style=wx.SL_HORIZONTAL,value=int(100*drawingData['contourLevel'])) 8591 contourLevel.SetRange(1,100) 8592 contourLevel.Bind(wx.EVT_SLIDER, OnContourLevel) 8593 slideSizer.Add(contourLevel,1,wx.EXPAND|wx.RIGHT) 8594 mapSizeTxt = wx.StaticText(drawOptions,-1,' Map radius, A: '+'%.1f'%(drawingData['mapSize'])) 8595 slideSizer.Add(mapSizeTxt,0,WACV) 8596 mapSize = wx.Slider(drawOptions,style=wx.SL_HORIZONTAL,value=int(10*drawingData['mapSize'])) 8597 mapSize.SetRange(1,100) 8598 mapSize.Bind(wx.EVT_SLIDER, OnMapSize) 8599 slideSizer.Add(mapSize,1,wx.EXPAND|wx.RIGHT) 8600 8587 8601 8588 slopSizer.Add(slideSizer,1,wx.EXPAND|wx.RIGHT) 8602 8589 slopSizer.Add((10,5),0) … … 8631 8618 def OnSymFade(event): 8632 8619 drawingData['SymFade'] = symFade.GetValue() 8633 G2plt.PlotStructure(G2frame,data)8634 8635 def OnShowMap(event):8636 drawingData['showMap'] = showMap.GetValue()8637 8620 G2plt.PlotStructure(G2frame,data) 8638 8621 … … 8749 8732 lineSizer.Add(viewPoint,0,WACV) 8750 8733 showSizer.Add(lineSizer) 8734 mapSizer = DistanceSettingSizer(drawingData, 8735 'VPPeakDistRad','VPatomsExpandRad','VPatomsDistRad') 8736 showSizer.Add(mapSizer,0,wx.LEFT,20) 8751 8737 showSizer.Add((0,5),0) 8752 8738 … … 8775 8761 symFade.SetValue(drawingData['SymFade']) 8776 8762 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 8763 showVoids = wx.CheckBox(drawOptions,-1,label=' Show void map?') 8782 8764 showVoids.Bind(wx.EVT_CHECKBOX, OnShowVoids) … … 8882 8864 planeSizer.Add(planeSizer2) 8883 8865 return planeSizer 8866 8867 def DistanceSettingSizer(var,key1,key2,key3): 8868 '''Sizer to get distances to show''' 8869 def onLeave(*args,**kwargs): 8870 print('On leave') 8871 G2plt.PlotStructure(G2frame,data) 8872 #wx.CallAfter(G2plt.PlotStructure,G2frame,data) 8873 for key in key1,key2,key3: 8874 if key not in var: var[key] = 0 8875 mapSizer = wx.FlexGridSizer(0,3,5,5) 8876 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Show Map points within:'),0,WACV) 8877 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,var,key1, 8878 xmin=0.0,xmax=5.0,nDig=(10,1),size=(50,-1), 8879 OnLeave=onLeave)) 8880 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8881 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Show atoms within:'),0,WACV) 8882 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,var,key2, 8883 xmin=0.0,xmax=15.0,nDig=(10,1),size=(50,-1), 8884 OnLeave=onLeave)) 8885 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8886 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Label distance to atoms within:'),0,WACV) 8887 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,var,key3, 8888 xmin=0.0,xmax=15.0,nDig=(10,1),size=(50,-1), 8889 OnLeave=onLeave)) 8890 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8891 return mapSizer 8884 8892 8885 8893 … … 8905 8913 G2G.HorizontalLine(mainSizer,drawOptions) 8906 8914 mainSizer.Add(PlaneSizer(),0,) 8907 G2G.HorizontalLine(mainSizer,drawOptions) 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')) 8910 mapSizer = wx.FlexGridSizer(0,3,5,5) 8911 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Show Map points within:'),0,WACV) 8912 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,drawingData,'PeakDistRadius', 8913 xmin=0.0,xmax=5.0,nDig=(10,1),size=(50,-1))) 8914 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8915 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Show atoms within:'),0,WACV) 8916 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,drawingData,'atomsExpandRadius', 8917 xmin=0.0,xmax=15.0,nDig=(10,1),size=(50,-1))) 8918 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8919 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'Label distance to atoms within:'),0,WACV) 8920 mapSizer.Add(G2G.ValidatedTxtCtrl(drawOptions,drawingData,'atomsDistRadius', 8921 xmin=0.0,xmax=15.0,nDig=(10,1),size=(50,-1))) 8922 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,u"\u212B"),0,WACV) 8923 mainSizer.Add(mapSizer) 8915 if generalData['Map']['rhoMax'] and not generalData.get('4DmapData',{}): 8916 G2G.HorizontalLine(mainSizer,drawOptions) 8917 def OnShowMap(event): 8918 drawingData['showMap'] = showMap.GetValue() 8919 G2plt.PlotStructure(G2frame,data) 8920 showMap = wx.CheckBox(drawOptions,-1,label=' Show density map?') 8921 showMap.Bind(wx.EVT_CHECKBOX, OnShowMap) 8922 showMap.SetValue(drawingData['showMap']) 8923 mainSizer.Add(showMap,0,WACV) 8924 mainSizer.Add(G2G.G2SliderWidget(drawOptions, 8925 drawingData,'contourLevel', 8926 'Max relative to rho max ({:.2f}): ' 8927 .format(generalData['Map']['rhoMax']), 8928 0.01,1.0,100, 8929 onChange=G2plt.PlotStructure,onChangeArgs=(G2frame,data) 8930 )) 8931 mainSizer.Add(G2G.G2SliderWidget(drawOptions, 8932 drawingData,'mapSize', 8933 'Range of map surrounding view point: ',0.1,10.,10., 8934 onChange=G2plt.PlotStructure,onChangeArgs=(G2frame,data) 8935 )) 8936 mapSizer = wx.BoxSizer(wx.HORIZONTAL) 8937 mapSizer.Add(wx.StaticText(drawOptions,wx.ID_ANY,'On map peak selection: '),0,WACV) 8938 mapSizer.Add(G2G.G2CheckBox(drawOptions,'Move view point',drawingData,'peakMoveView')) 8939 mainSizer.Add(mapSizer) 8940 mapSizer = DistanceSettingSizer(drawingData, 8941 'PeakDistRadius','atomsExpandRadius','atomsDistRadius') 8942 mainSizer.Add(mapSizer,0,wx.LEFT,20) 8943 8924 8944 SetPhaseWindow(drawOptions,mainSizer) 8925 8945 … … 12178 12198 FillRigidBodyGrid() 12179 12199 elif text == 'Map peaks': 12200 #print('reimport GSASIIplot') 12201 #import imp 12202 #imp.reload(G2plt) 12180 12203 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.MapPeaksMenu) 12181 12204 G2plt.PlotStructure(G2frame,data,firstCall=True) -
trunk/GSASIIplot.py
r4495 r4499 8911 8911 GL.glShadeModel(GL.GL_SMOOTH) 8912 8912 8913 def distances2Peaks(x,y,z,PeakDistRadius,mapPeaks,peakMax,radius,Amat,matRot): 8914 ''' show distances to other peaks within PeakDistRadius A 8915 ''' 8916 XYZ = mapPeaks.T[1:4].T 8917 Dx = XYZ-(x,y,z) 8918 dist = np.sqrt(np.sum(np.inner(Dx,Amat)**2,axis=1)) 8919 for i in ma.nonzero(ma.masked_greater(dist,PeakDistRadius))[0]: 8920 lbl = '{:.2f}'.format(dist[i]) 8921 RenderLines(x,y,z,[Dx[i]],Gr) 8922 lx,ly,lz = (x,y,z)+(Dx[i]/2) 8923 RenderLabel(lx,ly,lz,lbl,radius,wxGreen,matRot) 8924 [mag,x1,y1,z1] = mapPeaks[:,:4][i] 8925 lbl = '{:.2f}'.format(mag) 8926 if mag > 0.: 8927 RenderMapPeak(x1,y1,z1,Wt,mag/peakMax) 8928 RenderLabel(x1,y1,z1,lbl,radius,wx.Colour(Wt),matRot) 8929 else: 8930 RenderMapPeak(x1,y1,z1,Or,-2*mag/peakMax) 8931 RenderLabel(x1,y1,z1,lbl,radius,wx.Colour(Or),matRot) 8932 8933 def distances2Atoms(x,y,z,atomsExpandRadius,atomsdistRadius,Amat,matRot): 8934 # find and display atoms within atomsExpandRadius A 8935 vdwScale = drawingData['vdwScale'] 8936 ballScale = drawingData['ballScale'] 8937 xyzA = np.array((x,y,z)) 8938 cx,ct,cs,ci = G2phG.getAtomPtrs(data) 8939 cellArray = G2lat.CellBlock(1) 8940 radDict = dict(zip(*G2phG.getAtomRadii(data))) 8941 Names = [] 8942 Atoms = [] 8943 Radii = [] 8944 Color = [] 8945 for atomB in data['Atoms']: 8946 atNum = generalData['AtomTypes'].index(atomB[ct]) 8947 if 'vdW' in atomB[cs]: 8948 radius = vdwScale*vdWRadii[atNum] 8949 elif 'H' == atomB[ct]: 8950 radius = ballScale*drawingData['sizeH'] 8951 else: 8952 radius = ballScale*BondRadii[atNum] 8953 xyzB = np.array(atomB[cx:cx+3]) 8954 color = np.array(generalData['Color'][generalData['AtomTypes'].index(atomB[ct])])/255. 8955 result = G2spc.GenAtom(xyzB,SGData,False,6*[0.],True) 8956 for item in result: 8957 for xyz in cellArray+np.array(item[0]): 8958 dist = np.sqrt(np.sum(np.inner(Amat,xyz-xyzA)**2)) 8959 if 0 < dist <= max(atomsdistRadius,atomsExpandRadius): 8960 ax,ay,az = xyz 8961 RenderSphere(ax,ay,az,radius,color) 8962 Atoms.append(xyz) 8963 Radii.append(radDict[atomB[ct]]) 8964 Names.append(atomB[0]) 8965 Color.append(color) 8966 if dist < atomsdistRadius: 8967 RenderLines(x,y,z,[xyz-xyzA],Gr) 8968 lx,ly,lz = (xyzA+xyz)/2 8969 lbl = '{:.2f}'.format(dist) 8970 RenderLabel(lx,ly,lz,lbl,radius,wxGreen,matRot) 8971 ax,ay,az = xyz 8972 RenderLabel(ax,ay,az,' '+atomB[0],radius,wxGreen,matRot) 8973 # find bonds 8974 bondData = [[] for i in range(len(Atoms))] 8975 Atoms = np.array(Atoms) 8976 Radii = np.array(Radii) 8977 for i,atom in enumerate(Atoms): 8978 Dx = Atoms-atom 8979 sumR = Radii + Radii[i] 8980 dist = ma.masked_less(np.sqrt(np.sum(np.inner(Amat,Dx)**2,axis=0)),0.5) 8981 IndB = ma.nonzero(ma.masked_greater(dist-data['Drawing']['radiusFactor']*sumR,0.)) #get indices of bonded atoms 8982 for j in IndB[0]: 8983 bondData[i].append(Dx[j]*Radii[i]/sumR[j]) 8984 bondData[j].append(-Dx[j]*Radii[j]/sumR[j]) 8985 # draw bonds 8986 bondR = drawingData['bondRadius'] 8987 for i,xyz in enumerate(Atoms): 8988 ax,ay,az = xyz 8989 RenderBonds(ax,ay,az,bondData[i],bondR,Color[i]) 8990 8913 8991 def Draw(caller='',Fade=[]): 8914 8992 vdWRadii = generalData['vdWRadii'] … … 9114 9192 if not FourD and len(rhoXYZ) and drawingData['showMap']: #no green dot map for 4D - it's wrong! 9115 9193 RenderMap(rho,rhoXYZ,indx,Rok) 9116 if len(Ind) == 1 and pageName == 'Map peaks': 9194 if (pageName == 'Draw Atoms' or pageName == 'Draw Options') and ( 9195 drawingData['VPPeakDistRad'] + drawingData['VPatomsExpandRad'] 9196 + drawingData['VPatomsDistRad'] 9197 ) > 0: 9198 PeakDistRadius = drawingData['VPPeakDistRad'] 9199 atomsExpandRadius = drawingData['VPatomsExpandRad'] 9200 atomsdistRadius = drawingData['VPatomsDistRad'] 9201 x,y,z = drawingData['viewPoint'][0] 9202 # distances to other peaks within PeakDistRadius A 9203 if PeakDistRadius > 0: 9204 distances2Peaks(x,y,z,PeakDistRadius,mapPeaks,radius,peakMax,Amat,matRot) 9205 # find and display atoms within atomsExpandRadius A 9206 if atomsExpandRadius > 0: 9207 distances2Atoms(x,y,z,atomsExpandRadius,atomsdistRadius,Amat,matRot) 9208 elif len(Ind) == 1 and (pageName == 'Map peaks' or 9209 pageName == 'Draw Options'): 9117 9210 # one peak has been selected, show as selected by draw options 9118 9211 PeakDistRadius = drawingData['PeakDistRadius'] … … 9122 9215 mag,x,y,z = mapPeaks[:,:4][ind] 9123 9216 RenderMapPeak(x,y,z,Gr,1.0) 9124 # distances to other peaks within PeakDistRadius A9125 9217 if PeakDistRadius > 0: 9126 XYZ = mapPeaks.T[1:4].T 9127 Dx = XYZ-(x,y,z) 9128 dist = np.sqrt(np.sum(np.inner(Dx,Amat)**2,axis=1)) 9129 for i in ma.nonzero(ma.masked_greater(dist,PeakDistRadius))[0]: 9130 lbl = '{:.2f}'.format(dist[i]) 9131 RenderLines(x,y,z,[Dx[i]],Gr) 9132 lx,ly,lz = (x,y,z)+(Dx[i]/2) 9133 RenderLabel(lx,ly,lz,lbl,radius,wxGreen,matRot) 9134 [mag,x1,y1,z1] = mapPeaks[:,:4][i] 9135 if mag > 0.: 9136 RenderMapPeak(x1,y1,z1,Wt,mag/peakMax) 9137 else: 9138 RenderMapPeak(x1,y1,z1,Or,-2*mag/peakMax) 9218 distances2Peaks(x,y,z,PeakDistRadius,mapPeaks,radius,peakMax,Amat,matRot) 9139 9219 # find and display atoms within atomsExpandRadius A 9140 9220 if atomsExpandRadius > 0: 9141 xyzA = np.array((x,y,z)) 9142 cx,ct,cs,ci = G2phG.getAtomPtrs(data) 9143 cellArray = G2lat.CellBlock(1) 9144 radDict = dict(zip(*G2phG.getAtomRadii(data))) 9145 Names = [] 9146 Atoms = [] 9147 Radii = [] 9148 Color = [] 9149 for atomB in data['Atoms']: 9150 xyzB = np.array(atomB[cx:cx+3]) 9151 color = np.array(generalData['Color'][generalData['AtomTypes'].index(atomB[ct])])/255. 9152 result = G2spc.GenAtom(xyzB,SGData,False,6*[0.],True) 9153 for item in result: 9154 for xyz in cellArray+np.array(item[0]): 9155 dist = np.sqrt(np.sum(np.inner(Amat,xyz-xyzA)**2)) 9156 if 0 < dist <= max(atomsdistRadius,atomsExpandRadius): 9157 ax,ay,az = xyz 9158 RenderSphere(ax,ay,az,radius,color) 9159 Atoms.append(xyz) 9160 Radii.append(radDict[atomB[ct]]) 9161 Names.append(atomB[0]) 9162 Color.append(color) 9163 if dist < atomsdistRadius: 9164 RenderLines(x,y,z,[xyz-xyzA],Gr) 9165 lx,ly,lz = (xyzA+xyz)/2 9166 lbl = '{:.2f}'.format(dist) 9167 RenderLabel(lx,ly,lz,lbl,radius,wxGreen,matRot) 9168 ax,ay,az = xyz 9169 RenderLabel(ax,ay,az,' '+atomB[0],radius,wxGreen,matRot) 9170 # find bonds 9171 bondData = [[] for i in range(len(Atoms))] 9172 Atoms = np.array(Atoms) 9173 Radii = np.array(Radii) 9174 for i,atom in enumerate(Atoms): 9175 Dx = Atoms-atom 9176 sumR = Radii + Radii[i] 9177 dist = ma.masked_less(np.sqrt(np.sum(np.inner(Amat,Dx)**2,axis=0)),0.5) 9178 IndB = ma.nonzero(ma.masked_greater(dist-data['Drawing']['radiusFactor']*sumR,0.)) #get indices of bonded atoms 9179 for j in IndB[0]: 9180 bondData[i].append(Dx[j]*Radii[i]/sumR[j]) 9181 bondData[j].append(-Dx[j]*Radii[j]/sumR[j]) 9182 # draw bonds 9183 bondR = drawingData['bondRadius'] 9184 for i,xyz in enumerate(Atoms): 9185 ax,ay,az = xyz 9186 RenderBonds(ax,ay,az,bondData[i],bondR,Color[i]) 9221 distances2Atoms(x,y,z,atomsExpandRadius,atomsdistRadius,Amat,matRot) 9187 9222 elif len(mapPeaks): 9188 9223 XYZ = mapPeaks.T[1:4].T
Note: See TracChangeset
for help on using the changeset viewer.