Changeset 4499


Ignore:
Timestamp:
Jun 19, 2020 4:19:13 PM (3 years ago)
Author:
toby
Message:

Add sphere of atoms arround view point; show distances to peaks and atoms around view point

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r4498 r4499  
    10571057        return  # Returning without calling event.Skip, which eats the keystroke
    10581058
    1059 def G2SliderWidget(parent,loc,key,label,xmin,xmax,iscale):
     1059def G2SliderWidget(parent,loc,key,label,xmin,xmax,iscale,
     1060                       onChange=None,onChangeArgs=[]):
    10601061    '''A customized combination of a wx.Slider and a validated
    10611062    wx.TextCtrl (see :class:`ValidatedTxtCtrl`) that allows either
     
    10811082    :param float iscale: number to scale values to integers which is what the
    10821083       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.
    10841088       
     1089    :param list onChangeArgs: arguments to be passed to onChange function
     1090       when called.
    10851091    :returns: returns a wx.BoxSizer containing the widgets
    10861092    '''
     
    10891095        loc[key] = vScale.GetValue()/float(iscale)
    10901096        wx.TextCtrl.SetValue(vEntry,str(loc[key])) # will not trigger onValSet
     1097        if onChange: onChange(*onChangeArgs)
    10911098    def onValSet(*args,**kwargs):
    10921099        vScale.SetValue(int(0.5+iscale*loc[key]))       
     1100        if onChange: onChange(*onChangeArgs)
    10931101    loc[key] = min(xmax,max(xmin,loc[key]))
    10941102    hSizer = wx.BoxSizer(wx.HORIZONTAL)
  • trunk/GSASIIphsGUI.py

    r4494 r4499  
    233233            cx,ct,cs = self.Drawing['atomPtrs'][:3]
    234234            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')
    238242            topSizer.Add(wx.ComboBox(self.panel,choices=atoms,value=atoms[0],
    239243                style=wx.CB_READONLY|wx.CB_DROPDOWN),0,WACV)
     
    10951099#### Phase editing routines
    10961100################################################################################
    1097 def getAtomSelections(AtmTbl,cn=0,action='action'):
     1101def getAtomSelections(AtmTbl,cn=0,action='action',includeView=False):
    10981102    '''get selected atoms from table or ask user if none are selected
    10991103   
    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.
    11041112    '''
    11051113    indx = AtmTbl.GetSelectedRows()
     
    11171125        choices.append(val)
    11181126    if not choices: return
     1127    if includeView:
     1128        choices.append('View point')
    11191129    dlg = G2G.G2MultiChoiceDialog(AtmTbl.GetTopLevelParent(),
    11201130        'Select atoms','Select atoms for '+action,choices)
     
    14691479            'peakMoveView':True,'PeakDistRadius':0.0,'showVoids':False,'showMap':False,
    14701480            'atomsExpandRadius':5.,'atomsDistRadius':2.5,'Voids':[],
     1481            'VPPeakDistRad':0.,'VPatomsExpandRad':0.,'VPatomsDistRad':0.,
    14711482        }
    14721483    for key in defaultDrawing:
     
    78557866    def AddSphere(event):
    78567867        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)
    78587870        if not indx: return
    78597871        generalData = data['General']
     
    83448356    def OnDrawDistVP(event):
    83458357        # distance to view point
    8346         indx = getAtomSelections(drawAtoms,'distance calc')
     8358        indx = getAtomSelections(drawAtoms,action='distance calc')
    83478359        if not indx: return
    83488360        generalData = data['General']
     
    85058517                G2plt.PlotStructure(G2frame,data)
    85068518               
    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            
    85188519            slopSizer = wx.BoxSizer(wx.HORIZONTAL)
    85198520            slideSizer = wx.FlexGridSizer(0,2,0,0)
     
    85848585                magMult.Bind(wx.EVT_SLIDER, OnMagMult)
    85858586                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                       
    86018588            slopSizer.Add(slideSizer,1,wx.EXPAND|wx.RIGHT)
    86028589            slopSizer.Add((10,5),0)
     
    86318618            def OnSymFade(event):
    86328619                drawingData['SymFade'] = symFade.GetValue()
    8633                 G2plt.PlotStructure(G2frame,data)
    8634                
    8635             def OnShowMap(event):
    8636                 drawingData['showMap'] = showMap.GetValue()
    86378620                G2plt.PlotStructure(G2frame,data)
    86388621               
     
    87498732            lineSizer.Add(viewPoint,0,WACV)
    87508733            showSizer.Add(lineSizer)
     8734            mapSizer = DistanceSettingSizer(drawingData,
     8735                        'VPPeakDistRad','VPatomsExpandRad','VPatomsDistRad')
     8736            showSizer.Add(mapSizer,0,wx.LEFT,20)
    87518737            showSizer.Add((0,5),0)
    87528738           
     
    87758761            symFade.SetValue(drawingData['SymFade'])
    87768762            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)
    87818763            showVoids = wx.CheckBox(drawOptions,-1,label=' Show void map?')
    87828764            showVoids.Bind(wx.EVT_CHECKBOX, OnShowVoids)
     
    88828864            planeSizer.Add(planeSizer2)
    88838865            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
    88848892           
    88858893
     
    89058913        G2G.HorizontalLine(mainSizer,drawOptions)
    89068914        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
    89248944        SetPhaseWindow(drawOptions,mainSizer)
    89258945
     
    1217812198            FillRigidBodyGrid()
    1217912199        elif text == 'Map peaks':
     12200            #print('reimport GSASIIplot')
     12201            #import imp
     12202            #imp.reload(G2plt)
    1218012203            G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.MapPeaksMenu)
    1218112204            G2plt.PlotStructure(G2frame,data,firstCall=True)
  • trunk/GSASIIplot.py

    r4495 r4499  
    89118911        GL.glShadeModel(GL.GL_SMOOTH)
    89128912                           
     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               
    89138991    def Draw(caller='',Fade=[]):
    89148992        vdWRadii = generalData['vdWRadii']
     
    91149192        if not FourD and len(rhoXYZ) and drawingData['showMap']:       #no green dot map for 4D - it's wrong!
    91159193            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'):
    91179210            # one peak has been selected, show as selected by draw options
    91189211            PeakDistRadius = drawingData['PeakDistRadius']
     
    91229215            mag,x,y,z = mapPeaks[:,:4][ind]
    91239216            RenderMapPeak(x,y,z,Gr,1.0)
    9124             # distances to other peaks within PeakDistRadius A
    91259217            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)
    91399219            # find and display atoms within atomsExpandRadius A
    91409220            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)
    91879222        elif len(mapPeaks):
    91889223            XYZ = mapPeaks.T[1:4].T
Note: See TracChangeset for help on using the changeset viewer.