Changeset 2450 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Aug 25, 2016 12:22:04 PM (7 years ago)
Author:
vondreele
Message:

fix error in matrix in getCellEsd & RetDistAngle?
Add new atom drawing option for sphere of enclosure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r2431 r2450  
    41664166            G2plt.PlotStructure(G2frame,data)
    41674167           
     4168    def AddSphere(event):
     4169        generalData = data['General']
     4170        Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7])
     4171        atomData = data['Drawing']['Atoms']
     4172        numAtoms = len(atomData)
     4173        cx,ct,cs,ci = data['Drawing']['atomPtrs']
     4174        cuij = cs+5
     4175        generalData = data['General']
     4176        SGData = generalData['SGData']
     4177        cellArray = G2lat.CellBlock(1)
     4178        indx = drawAtoms.GetSelectedRows()
     4179        indx.sort()
     4180        dlg = G2gd.SphereEnclosure(G2frame,data['General'],data['Drawing'],indx)
     4181        try:
     4182            if dlg.ShowModal() == wx.ID_OK:
     4183                centers,radius = dlg.GetSelection()
     4184                for orig in centers:
     4185                    xyzA = np.array(orig)
     4186                    for atomB in atomData[:numAtoms]:
     4187                        xyzB = np.array(atomB[cx:cx+3])
     4188                        Uij = atomB[cuij:cuij+6]
     4189#                        GSASIIpath.IPyBreak()
     4190                        result = G2spc.GenAtom(xyzB,SGData,False,Uij,True)
     4191                        for item in result:
     4192                            atom = copy.copy(atomB)
     4193                            atom[cx:cx+3] = item[0]
     4194                            atom[cx+3] = str(item[2])+'+'
     4195                            atom[cuij:cuij+6] = item[1]
     4196                            for xyz in cellArray+np.array(atom[cx:cx+3]):
     4197                                dist = np.sqrt(np.sum(np.inner(Amat,xyz-xyzA)**2))
     4198                                if 0 < dist <= radius:
     4199                                    if noDuplicate(xyz,atomData):
     4200                                        C = xyz-atom[cx:cx+3]+item[3]
     4201                                        newAtom = atom[:]
     4202                                        newAtom[cx:cx+3] = xyz
     4203                                        newAtom[cx+3] += str(int(round(C[0])))+','+str(int(round(C[1])))+','+str(int(round(C[2])))
     4204                                        atomData.append(newAtom)
     4205        finally:
     4206            dlg.Destroy()
     4207        UpdateDrawAtoms()
     4208        drawAtoms.ClearSelection()
     4209        G2plt.PlotStructure(G2frame,data)
     4210           
    41684211    def TransformSymEquiv(event):
    41694212        indx = drawAtoms.GetSelectedRows()
     
    75977640        G2frame.dataFrame.Bind(wx.EVT_MENU, SetViewPoint, id=G2gd.wxID_DRAWVIEWPOINT)
    75987641        G2frame.dataFrame.Bind(wx.EVT_MENU, AddSymEquiv, id=G2gd.wxID_DRAWADDEQUIV)
     7642        G2frame.dataFrame.Bind(wx.EVT_MENU, AddSphere, id=G2gd.wxID_DRAWADDSPHERE)
    75997643        G2frame.dataFrame.Bind(wx.EVT_MENU, TransformSymEquiv, id=G2gd.wxID_DRAWTRANSFORM)
    76007644        G2frame.dataFrame.Bind(wx.EVT_MENU, FillCoordSphere, id=G2gd.wxID_DRAWFILLCOORD)           
Note: See TracChangeset for help on using the changeset viewer.