Changeset 850
- Timestamp:
- Feb 12, 2013 1:21:23 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Exercises/kryptonite/jadarite.cif
r382 r850 73 73 _atom_type_scat_source 74 74 Li 'D. Waasmaier & A. Kirfel. Acta Cryst. (1995). A51, 416-413' 75 Na 'D. Waasmaier & A. Kirfel. Acta Cryst. (1995). A51, 416-413'75 Na1+ 'D. Waasmaier & A. Kirfel. Acta Cryst. (1995). A51, 416-413' 76 76 B 'D. Waasmaier & A. Kirfel. Acta Cryst. (1995). A51, 416-413' 77 77 Si 'D. Waasmaier & A. Kirfel. Acta Cryst. (1995). A51, 416-413' … … 94 94 _atom_site_occupancy 95 95 Li Li1 0.462(2) 0.1995(6) 0.1383(15) 0.046(3) Uiso d 1.000 96 Na Na1 0.9733(3) 0.99060(10) 0.7544(3) 0.0764 Uani d 1.00096 Na1+ Na1 0.9733(3) 0.99060(10) 0.7544(3) 0.0764 Uani d 1.000 97 97 B B1 0.2096(17) 0.1602(8) 0.6623(18) 0.091(3) Uiso d 1.000 98 98 B B2 0.6920(14) 0.3493(6) 0.4160(15) 0.054(2) Uiso d 1.000 -
trunk/GSASIIElem.py
r762 r850 81 81 return True 82 82 else: 83 return False 83 return False 84 85 def FixValence(El): 86 if '+' in El[-1]: #converts An+/- to A+/-n 87 num = El[-2] 88 El = El.split(num)[0]+'+'+num 89 if '-' in El[-1]: 90 num = El[-2] 91 El = El.split(num)[0]+'-'+num 92 return El 84 93 85 94 def GetAtomInfo(El): -
trunk/GSASIIconstrGUI.py
r849 r850 627 627 data.update({'Vector':{'AtInfo':{}},'Residue':{'AtInfo':{}},'Z-matrix':{'AtInfo':{}}}) #empty dict - fill it 628 628 629 global resList 629 630 Indx = {} 631 resList = [] 630 632 plotDefaults = {'oldxy':[0.,0.],'Quaternion':[1.,0.,0.,0.],'cameraPos':30.,'viewDir':[0,0,1],} 631 633 632 634 def OnPageChanged(event): 635 global resList 636 resList = [] 633 637 if event: #page change event! 634 638 page = event.GetSelection() … … 705 709 elif 'Z-matrix' in G2frame.dataDisplay.GetPageText(page): 706 710 pass 711 712 def OnNewOrigin(event): #only for Residue RBs 713 for res in resList: 714 if res.IsSelection(): 715 rbId = Indx[res.GetId()] 716 ind = res.GetSelectedRows()[0] 717 if data['Residue'][rbId]['useCount'] or data['Residue'][rbId]['rbSeq']: 718 return 719 rbXYZ = data['Residue'][rbId]['rbXYZ'] 720 rbXYZ -= rbXYZ[ind] 721 data['Residue'][rbId]['rbRef'][0] = ind 722 res.ClearSelection() 723 resTable = res.GetTable() 724 for r in range(res.GetNumberRows()): 725 row = resTable.GetRowValues(r) 726 row[2:4] = rbXYZ[r] 727 resTable.SetRowValues(r,row) 728 res.ForceRefresh() 729 730 def OnNewRefAtoms(event): 731 for res in resList: 732 if res.IsSelection(): 733 rbId = Indx[res.GetId()] 734 if data['Residue'][rbId]['useCount']: 735 return 736 rbRef = data['Residue'][rbId]['rbRef'] 737 rbSeq = data['Residue'][rbId]['rbSeq'] 738 atNames = data['Residue'][rbId]['atNames'] 739 choices = [atNames[rbRef[1]],atNames[rbRef[2]]] 740 names = [] 741 for i,name in enumerate(atNames): 742 ok = True 743 for seq in rbSeq: #remove atom in flexible side chains 744 if i in seq[3]: 745 ok = False 746 if i == rbRef[0]: #remove origin choice 747 ok = False 748 if ok: 749 names.append(atNames[i]) 750 dlg = G2gd.PickTwoDialog(G2frame.dataDisplay,'Select reference atoms', 751 'Pick 2 atoms non-colinear with origin atom',names,choices) 752 if dlg.ShowModal() == wx.ID_OK: 753 sel = dlg.GetSelection() 754 rbRef[1:] = [atNames.index(sel[0]),atNames.index(sel[1])] 755 dlg.Destroy() 707 756 708 757 def AddVectorRB(): … … 1046 1095 def UpdateResidueRB(): 1047 1096 AtInfo = data['Residue']['AtInfo'] 1048 Indx = {}1049 1097 1050 1098 def rbNameSizer(rbId,rbData): … … 1113 1161 except ValueError: 1114 1162 pass 1163 1164 def RowSelect(event): 1165 r,c = event.GetRow(),event.GetCol() 1166 if c < 0: #only row clicks 1167 for vecgrid in resList: 1168 vecgrid.ClearSelection() 1169 vecGrid.SelectRow(r,True) 1115 1170 1116 1171 vecSizer = wx.BoxSizer() … … 1124 1179 vecTable = G2gd.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) 1125 1180 vecGrid = G2gd.GSGrid(ResidueRBDisplay) 1181 Indx[vecGrid.GetId()] = rbId 1182 resList.append(vecGrid) 1126 1183 vecGrid.SetTable(vecTable, True) 1127 1184 vecGrid.Bind(wg.EVT_GRID_CELL_CHANGE, ChangeCell) 1128 1185 vecGrid.Bind(wg.EVT_GRID_CELL_LEFT_DCLICK, TypeSelect) 1186 vecGrid.Bind(wg.EVT_GRID_LABEL_LEFT_CLICK, RowSelect) 1129 1187 attr = wx.grid.GridCellAttr() 1130 1188 attr.SetEditor(G2gd.GridFractionEditor(vecGrid)) … … 1223 1281 if rbData['rbSeq']: 1224 1282 slideSizer,angSlide = SlideSizer() 1225 ResidueRBSizer.Add(wx.StaticText(ResidueRBDisplay,-1, 1226 'Sel Bond Angle Riding atoms'), 1227 0,wx.ALIGN_CENTER_VERTICAL) 1283 if len(rbData['rbSeq']): 1284 ResidueRBSizer.Add(wx.StaticText(ResidueRBDisplay,-1, 1285 'Sel Bond Angle Riding atoms'), 1286 0,wx.ALIGN_CENTER_VERTICAL) 1228 1287 for iSeq,Seq in enumerate(rbData['rbSeq']): 1229 1288 ResidueRBSizer.Add(SeqSizer(angSlide,rbId,iSeq,Seq,rbData['atNames'])) … … 1273 1332 G2frame.dataFrame.Bind(wx.EVT_MENU, OnAddRigidBody, id=G2gd.wxID_RIGIDBODYADD) 1274 1333 G2frame.dataFrame.Bind(wx.EVT_MENU, OnImportRigidBody, id=G2gd.wxID_RIGIDBODYIMPORT) 1334 G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewOrigin, id=G2gd.wxID_RBNEWORIGIN) 1335 G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewRefAtoms, id=G2gd.wxID_RBREFATMS) 1275 1336 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDefineTorsSeq, id=G2gd.wxID_RESIDUETORSSEQ) 1276 1337 G2frame.dataDisplay = G2gd.GSNoteBook(parent=G2frame.dataFrame,size=G2frame.dataFrame.GetClientSize()) -
trunk/GSASIIgrid.py
r849 r850 10 10 import wx 11 11 import wx.grid as wg 12 import wx.wizard as wz 12 13 import time 13 14 import cPickle … … 33 34 import GSASIIrestrGUI as G2restG 34 35 36 # trig functions in degrees 37 sind = lambda x: np.sin(x*np.pi/180.) 38 tand = lambda x: np.tan(x*np.pi/180.) 39 cosd = lambda x: np.cos(x*np.pi/180.) 40 35 41 # globals we will use later 36 42 __version__ = None # gets overridden in GSASII.py … … 106 112 107 113 [ wxID_RIGIDBODYADD,wxID_DRAWDEFINERB,wxID_RIGIDBODYIMPORT,wxID_RESIDUETORSSEQ, 108 wxID_ZMATRIXADD,wxID_AUTOFINDRESRB,wxID_GLOBALRESREFINE,wxID_RBREMOVEALL 109 ] = [wx.NewId() for item in range(8)] 114 wxID_ZMATRIXADD,wxID_AUTOFINDRESRB,wxID_GLOBALRESREFINE,wxID_RBREMOVEALL, 115 wxID_RBNEWORIGIN,wxID_RBREFATMS 116 ] = [wx.NewId() for item in range(10)] 110 117 111 118 [ wxID_SAVESEQSEL, … … 124 131 #### GSAS-II class definitions 125 132 ################################################################################ 133 134 class GSASWizard(wz.WizardPageSimple): 135 def __init__(self,parent,title): 136 wz.WizardPageSimple.__init__(self,parent) 137 self.mainSizer = wx.BoxSizer(wx.VERTICAL) 138 self.SetSizer(self.mainSizer) 139 titleText = wx.StaticText(self,-1,title) 140 titleText.SetFont(wx.Font(16,wx.SWISS,wx.NORMAL,wx.BOLD)) 141 self.mainSizer.Add(titleText,0,wx.ALIGN_CENTRE|wx.ALL,5) 126 142 127 143 class SymOpDialog(wx.Dialog): … … 320 336 self.__default__(data,self.default) 321 337 self.Draw(self.data) 338 339 class PickTwoDialog(wx.Dialog): 340 341 def __init__(self,parent,title,prompt,names,choices): 342 wx.Dialog.__init__(self,parent,-1,title, 343 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE) 344 self.panel = wx.Panel(self) #just a dummy - gets destroyed in Draw! 345 self.prompt = prompt 346 self.choices = choices 347 self.names = names 348 self.Draw() 349 350 def Draw(self): 351 Indx = {} 352 353 def OnSelection(event): 354 Obj = event.GetEventObject() 355 id = Indx[Obj.GetId()] 356 self.choices[id] = Obj.GetValue().encode() #to avoid Unicode versions 357 self.Draw() 358 359 self.panel.DestroyChildren() 360 self.panel.Destroy() 361 self.panel = wx.Panel(self) 362 mainSizer = wx.BoxSizer(wx.VERTICAL) 363 mainSizer.Add(wx.StaticText(self.panel,-1,self.prompt),0,wx.ALIGN_CENTER) 364 for isel,name in enumerate(self.choices): 365 lineSizer = wx.BoxSizer(wx.HORIZONTAL) 366 lineSizer.Add(wx.StaticText(self.panel,-1,'Reference atom '+str(isel+1)),0,wx.ALIGN_CENTER) 367 nameList = self.names[:] 368 if isel: 369 if self.choices[0] in nameList: 370 nameList.remove(self.choices[0]) 371 choice = wx.ComboBox(self.panel,-1,value=name,choices=nameList, 372 style=wx.CB_READONLY|wx.CB_DROPDOWN) 373 Indx[choice.GetId()] = isel 374 choice.Bind(wx.EVT_COMBOBOX, OnSelection) 375 lineSizer.Add(choice,0,wx.ALIGN_CENTER) 376 mainSizer.Add(lineSizer) 377 OkBtn = wx.Button(self.panel,-1,"Ok") 378 OkBtn.Bind(wx.EVT_BUTTON, self.OnOk) 379 CancelBtn = wx.Button(self.panel,-1,'Cancel') 380 CancelBtn.Bind(wx.EVT_BUTTON, self.OnCancel) 381 btnSizer = wx.BoxSizer(wx.HORIZONTAL) 382 btnSizer.Add((20,20),1) 383 btnSizer.Add(OkBtn) 384 btnSizer.Add(CancelBtn) 385 btnSizer.Add((20,20),1) 386 mainSizer.Add(btnSizer,0,wx.EXPAND|wx.BOTTOM|wx.TOP, 10) 387 self.panel.SetSizer(mainSizer) 388 self.panel.Fit() 389 self.Fit() 390 391 def GetSelection(self): 392 return self.choices 393 394 def OnOk(self,event): 395 parent = self.GetParent() 396 parent.Raise() 397 self.EndModal(wx.ID_OK) 398 399 def OnCancel(self,event): 400 parent = self.GetParent() 401 parent.Raise() 402 self.EndModal(wx.ID_CANCEL) 322 403 323 404 class SingleFloatDialog(wx.Dialog): … … 774 855 self.ResidueRBMenu.Append(id=wxID_RIGIDBODYIMPORT, kind=wx.ITEM_NORMAL,text='Import XYZ from txt file', 775 856 help='Import rigid body XYZ from txt file') 857 self.ResidueRBMenu.Append(id=wxID_RBNEWORIGIN, kind=wx.ITEM_NORMAL,text='Set origin', 858 help='Select atom to be origin in RB to be edited') 859 self.ResidueRBMenu.Append(id=wxID_RBREFATMS, kind=wx.ITEM_NORMAL,text='Set reference atoms', 860 help='Select any atom in RB to be edited') 776 861 self.ResidueRBMenu.Append(id=wxID_RESIDUETORSSEQ, kind=wx.ITEM_NORMAL,text='Define sequence', 777 862 help='Define torsion sequence') -
trunk/GSASIIimage.py
r849 r850 236 236 ring.append([X,Y,dsp]) 237 237 delt = amax-amin 238 if len(ring) < 20: #want more than 20 deg238 if len(ring) < 10: #want more than 20 deg 239 239 return [],delt > 90 240 240 return ring,delt > 90 -
trunk/GSASIIphsGUI.py
r849 r850 11 11 import wx.grid as wg 12 12 import wx.lib.gridmovers as wgmove 13 import wx.wizard as wz 13 14 import matplotlib as mpl 14 15 import math … … 1177 1178 1178 1179 def OnRBAppend(event): 1179 1180 print 'RB append' 1180 rbData = G2frame.PatternTree.GetItemPyData( 1181 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Rigid bodies')) 1182 general = data['General'] 1183 atomData = data['Atoms'] 1181 1184 1182 1185 def OnRBAssign(event): 1183 print 'RB assign' 1186 1187 RBObjs = [] 1188 rbType = '' 1189 rbName = '' 1190 rbId = None 1191 1192 def OnSelectRB(event): 1193 rbName = selectRB.GetValue() 1194 rbType,rbId = rbNames[rbName] 1195 RBObjs = data['RBModels'].get(rbType,[]) 1196 page2.mainSizer.Add(wx.StaticText(page2,-1,'Select origin for '+rbName)) 1197 1198 rbData = G2frame.PatternTree.GetItemPyData( 1199 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Rigid bodies')) 1200 RBwizard = wz.Wizard(G2frame.dataFrame,-1,"Rigid body assign wizard") 1201 rbNames = {} 1202 for rbVec in rbData['Vector']: 1203 if rbVec != 'AtInfo': 1204 rbNames[rbData['Vector'][rbVec]['RBname']] =['Vector',rbVec] 1205 for rbRes in rbData['Residue']: 1206 if rbRes != 'AtInfo': 1207 rbNames[rbData['Residue'][rbRes]['RBname']] = ['Residue',rbRes] 1208 if not rbNames: 1209 print '**** ERROR - no rigid bodies defined ****' 1210 return 1211 page1 = G2gd.GSASWizard(RBwizard,"Select rigid body") 1212 page1.mainSizer.Add(wx.StaticText(page1,-1,'Select rigid body')) 1213 selectRB = wx.ComboBox(page1,-1,value=' ',choices=rbNames.keys(), 1214 style=wx.CB_READONLY|wx.CB_DROPDOWN) 1215 selectRB.Bind(wx.EVT_COMBOBOX,OnSelectRB) 1216 page1.mainSizer.Add(selectRB) 1217 1218 page2 = G2gd.GSASWizard(RBwizard,"Select origin") 1219 page3 = G2gd.GSASWizard(RBwizard,"Select 1st reference atom") 1220 page4 = G2gd.GSASWizard(RBwizard,"Select 2nd reference atom") 1221 page3.mainSizer.Add(wx.StaticText(page3,-1,'Select 1st reference atom')) 1222 page3.mainSizer.Add(wx.StaticText(page4,-1,'Select 2nd reference atom')) 1223 wz.WizardPageSimple_Chain(page1,page2) 1224 wz.WizardPageSimple_Chain(page2,page3) 1225 wz.WizardPageSimple_Chain(page3,page4) 1226 RBwizard.FitToPage(page1) 1227 if RBwizard.RunWizard(page1): 1228 print 'done' 1184 1229 1185 1230 def OnAtomMove(event): … … 1604 1649 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Restraints'),restData) 1605 1650 1606 def OnDefineRB(event): #suppose this made a residue type RB instead?1651 def OnDefineRB(event): 1607 1652 indx = drawAtoms.GetSelectedRows() 1653 indx.sort() 1608 1654 RBData = G2frame.PatternTree.GetItemPyData( 1609 1655 G2gd.GetPatternTreeItemId(G2frame,G2frame.root,'Rigid bodies')) … … 1615 1661 rbXYZ = [] 1616 1662 rbType = [] 1617 AtInfo = RBData['Vector']['AtInfo'] 1618 for item in indx: 1663 atNames = [] 1664 AtInfo = RBData['Residue']['AtInfo'] 1665 for i,item in enumerate(indx): 1619 1666 rbtype = atomData[item][ct] 1667 atNames.append(rbtype+str(i)) 1620 1668 rbType.append(rbtype) 1621 1669 if rbtype not in AtInfo: … … 1626 1674 rbXYZ -= rbXYZ[0] 1627 1675 rbId = ran.randint(0,sys.maxint) 1628 RBData['Vector'][rbId] = {'RBname':'UNKRB','VectMag':[1.0,], 1629 'VectRef':[False,],'rbTypes':rbType,'rbVect':[rbXYZ,]} 1630 print 'New rigid body added to set of rigid bodies' 1631 1676 RBData['Residue'][rbId] = {'RBname':'UNKRB','rbXYZ':rbXYZ,'rbTypes':rbType, 1677 'atNames':atNames,'rbRef':[0,1,2],'rbSeq':[],'SelSeq':[0,0],'useCount':0} 1678 G2frame.dataFrame.SetStatusText('New rigid body UNKRB added to set of Residue rigid bodies') 1632 1679 1633 1680 ################################################################################ -
trunk/GSASIIstruct.py
r848 r850 1365 1365 refine = False 1366 1366 if hapData[0] in ['isotropic','uniaxial']: 1367 line += ' equatorial:%12. 3f'%(hapData[1][0])1367 line += ' equatorial:%12.4f'%(hapData[1][0]) 1368 1368 if sizeSig[0][0]: 1369 line += ', sig:%8. 3f'%(sizeSig[0][0])1369 line += ', sig:%8.4f'%(sizeSig[0][0]) 1370 1370 refine = True 1371 1371 if hapData[0] == 'uniaxial': 1372 line += ' axial:%12. 3f'%(hapData[1][1])1372 line += ' axial:%12.4f'%(hapData[1][1]) 1373 1373 if sizeSig[0][1]: 1374 1374 refine = True 1375 line += ', sig:%8. 3f'%(sizeSig[0][1])1375 line += ', sig:%8.4f'%(sizeSig[0][1]) 1376 1376 line += ' LG mix coeff.:%12.4f'%(hapData[1][2]) 1377 1377 if sizeSig[0][2]: 1378 1378 refine = True 1379 line += ', sig:%8. 3f'%(sizeSig[0][2])1379 line += ', sig:%8.4f'%(sizeSig[0][2]) 1380 1380 if refine: 1381 1381 print >>pFile,line … … 1384 1384 if sizeSig[0][2]: 1385 1385 refine = True 1386 line += ', sig:%8. 3f'%(sizeSig[0][2])1386 line += ', sig:%8.4f'%(sizeSig[0][2]) 1387 1387 Snames = ['S11','S22','S33','S12','S13','S23'] 1388 1388 ptlbls = ' name :' -
trunk/imports/G2phase_CIF.py
r762 r850 201 201 atomlist[col] = cif.get_number_with_esd(val)[0] 202 202 atomlist[7],atomlist[8] = G2spc.SytSym(atomlist[3:6],SGData) 203 atomlist[1] = G2elem.FixValence(atomlist[1]) 203 204 self.Phase['Atoms'].append(atomlist) 204 205 for lbl in phasenamefields: # get a name for the phase
Note: See TracChangeset
for help on using the changeset viewer.