Changeset 2229 for trunk/GSASIIphsGUI.py
- Timestamp:
- Apr 28, 2016 1:40:56 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r2218 r2229 2043 2043 css = colLabels.index('site sym') 2044 2044 atomData = data['Atoms'] 2045 generalData = data['General']2046 2045 SGData = generalData['SGData'] 2047 2046 dlg = G2gd.SymOpDialog(G2frame,SGData,True,True) … … 2085 2084 else: 2086 2085 print "select one or more rows of atoms" 2087 G2frame.ErrorDialog('Select atom',"select one or more atoms then redo") 2086 G2frame.ErrorDialog('Select atom',"select one or more atoms then redo") 2087 2088 def AtomRotate(event): 2089 Units = {'':np.zeros(3), 2090 'xy':np.array([[i,j,0] for i in range(3) for j in range(3)])-np.array([1,1,0]), 2091 'xz':np.array([[i,0,j] for i in range(3) for j in range(3)])-np.array([1,1,0]), 2092 'yz':np.array([[0,i,j] for i in range(3) for j in range(3)])-np.array([1,1,0]), 2093 'xyz':np.array([[i,j,k] for i in range(3) for j in range(3) for k in range(3)])-np.array([1,1,1])} 2094 indx = Atoms.GetSelectedRows() 2095 if indx: 2096 generalData = data['General'] 2097 A,B = G2lat.cell2AB(generalData['Cell'][1:7]) 2098 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())] 2099 cx = colLabels.index('x') 2100 cuia = colLabels.index('I/A') #need to not do aniso atoms - stop with error? or force isotropic? 2101 css = colLabels.index('site sym') 2102 atomData = data['Atoms'] 2103 SGData = generalData['SGData'] 2104 dlg = G2gd.RotationDialog(G2frame) 2105 try: 2106 if dlg.ShowModal() == wx.ID_OK: 2107 M,T,Expand = dlg.GetSelection() 2108 Unit = Units[Expand] 2109 for ind in indx: 2110 XYZ = np.array(atomData[ind][cx:cx+3]) 2111 for unit in Unit: 2112 XYZ += unit 2113 XYZ -= T 2114 XYZ = np.inner(A,XYZ) #to Cartesian 2115 XYZ = np.inner(M,XYZ) #rotate 2116 XYZ = np.inner(B,XYZ)+T #back to crystal & translate 2117 if np.all(XYZ>=0.) and np.all(XYZ<1.0): 2118 atom = atomData[ind] 2119 atom[cx:cx+3] = XYZ 2120 atom[css:css+2] = G2spc.SytSym(XYZ,SGData) 2121 break 2122 finally: 2123 dlg.Destroy() 2124 Atoms.ClearSelection() 2125 Atoms.ForceRefresh() 2126 else: 2127 print "select one or more rows of atoms" 2128 G2frame.ErrorDialog('Select atom',"select one or more atoms then redo") 2088 2129 2089 2130 def MakeMolecule(event): … … 7293 7334 G2frame.dataFrame.Bind(wx.EVT_MENU, AtomModify, id=G2gd.wxID_ATOMSMODIFY) 7294 7335 G2frame.dataFrame.Bind(wx.EVT_MENU, AtomTransform, id=G2gd.wxID_ATOMSTRANSFORM) 7336 G2frame.dataFrame.Bind(wx.EVT_MENU, AtomRotate, id=G2gd.wxID_ATOMSROTATE) 7295 7337 G2frame.dataFrame.Bind(wx.EVT_MENU, MakeMolecule, id=G2gd.wxID_MAKEMOLECULE) 7296 7338 G2frame.dataFrame.Bind(wx.EVT_MENU, OnReloadDrawAtoms, id=G2gd.wxID_RELOADDRAWATOMS)
Note: See TracChangeset
for help on using the changeset viewer.