Changeset 4573 for trunk/GSASIIconstrGUI.py
- Timestamp:
- Sep 21, 2020 3:43:06 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r4505 r4573 44 44 import GSASIIpy3 as G2py3 45 45 import GSASIIphsGUI as G2phG 46 import GSASIIIO as G2IO 46 47 import GSASIIscriptable as G2sc 47 48 VERY_LIGHT_GREY = wx.Colour(235,235,235) … … 2055 2056 Page2() 2056 2057 2058 if 'macromolecular' == rd.Phase['General']['Type']: 2059 # for PDB imports, lets see if a quick reformat of atoms list will work 2060 rd.Phase['Atoms'] = [a[3:] for a in rd.Phase['Atoms']] 2061 rd.Phase['General']['AtomPtrs'] = [i-3 for i in rd.Phase['General']['AtomPtrs']] 2062 rd.Phase['General']['Type'] = 'nuclear' 2057 2063 SetupDrawing(rd.Phase) # add information to reader object to allow plotting 2058 2064 atomlist = [atom[0] for atom in rd.Phase['Atoms']] … … 2267 2273 UpdateDraw() 2268 2274 2275 def onWriteXYZ(event): 2276 '''Writes selected atoms in a .xyz file for use in Avogadro, etc. 2277 ''' 2278 grid.completeEdits() 2279 center = np.array([0.,0.,0.]) 2280 count = 0 2281 for i in range(len(rd.Phase['RBselection'])): 2282 if rd.Phase['RBselection'][i]: 2283 count += 1 2284 center += rd.Phase['RBcoords'][i] 2285 if count: 2286 center /= count 2287 else: 2288 print('nothing selected') 2289 return 2290 obj = G2IO.ExportBaseclass(G2frame,'XYZ','.xyz') 2291 #obj.InitExport(None) 2292 if obj.ExportSelect(): # set export parameters; ask for file name 2293 return 2294 fp = obj.OpenFile() 2295 obj.Write(str(count)) 2296 obj.Write('') 2297 for i in range(len(rd.Phase['RBselection'])): 2298 if rd.Phase['RBselection'][i]: 2299 line = ' ' + rd.Phase['RBtypes'][i] 2300 for xyz in rd.Phase['RBcoords'][i]: 2301 line += ' ' + str(xyz) 2302 obj.Write(line) 2303 obj.CloseFile() 2304 #GSASIIpath.IPyBreak() 2305 2269 2306 def onAddVector(event): 2270 2307 '''Adds selected atoms as a new vector rigid body. … … 2381 2418 0,wx.ALL) 2382 2419 btnSizer.Add((-1,5)) 2420 btn = wx.Button(RBImpPnl, wx.ID_ANY, 'export as xyz') 2421 btn.Bind(wx.EVT_BUTTON,onWriteXYZ) 2422 btnSizer.Add(btn,0,wx.ALIGN_CENTER) 2423 btnSizer.Add((-1,10)) 2383 2424 btn = wx.Button(RBImpPnl, wx.ID_ANY, 'a Vector Body') 2384 2425 btn.Bind(wx.EVT_BUTTON,onAddVector) … … 2482 2523 else: 2483 2524 col = None 2525 return 2484 2526 finally: 2485 2527 dlg.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.