Changeset 165
- Timestamp:
- Oct 19, 2010 1:46:03 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r164 r165 453 453 generalData = data['General'] 454 454 atomData = data['Atoms'] 455 Items = [G2gd.wxID_ATOMSEDITINSERT, G2gd.wxID_ATOMSEDITDELETE, G2gd.wxID_ATOMSREFINE, 456 G2gd.wxID_ATOMSMODIFY, G2gd.wxID_ATOMSTRANSFORM, G2gd.wxID_ATONTESTINSERT] 457 if atomData: 458 for item in Items: 459 self.dataFrame.AtomsMenu.Enable(item,True) 460 else: 461 for item in Items: 462 self.dataFrame.AtomsMenu.Enable(item,False) 463 455 464 AAchoice = ": ,ALA,ARG,ASN,ASP,CYS,GLN,GLU,GLY,HIS,ILE,LEU,LYS,MET,PHE,PRO,SER,THR,TRP,TYR,VAL,MSE,HOH,UNK" 456 465 Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,wg.GRID_VALUE_CHOICE+": ,X,XU,U,F,FX,FXU,FU", … … 1505 1514 i = atomA[0] 1506 1515 for j in IndB[0]: 1507 if j > i: 1508 if Styles[i] == 'polyhedra': 1509 atomData[i][-1].append(np.inner(Amat,Dx[j])) 1510 elif Styles[j] != 'polyhedra': 1511 atomData[i][-1].append(Dx[j]*Radii[i]/sumR[j]) 1512 atomData[j][-1].append(-Dx[j]*Radii[j]/sumR[j]) 1516 if Styles[i] == 'polyhedra': 1517 atomData[i][-1].append(np.inner(Amat,Dx[j])) 1518 elif Styles[j] != 'polyhedra' and j > i: 1519 atomData[i][-1].append(Dx[j]*Radii[i]/sumR[j]) 1520 atomData[j][-1].append(-Dx[j]*Radii[j]/sumR[j]) 1513 1521 1514 1522 def DrawAtomsDelete(event): … … 1756 1764 def UpdateDData(): 1757 1765 UseList = data['Histograms'] 1766 if UseList: 1767 self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,True) 1768 else: 1769 self.dataFrame.DataMenu.Enable(G2gd.wxID_DATADELETE,False) 1758 1770 generalData = data['General'] 1759 1771 SGData = generalData['SGData'] … … 1782 1794 Obj.SetValue("%.4f"%(UseList[Indx[Obj.GetId()]]['Scale'][0])) #reset in case of error 1783 1795 1796 def OnCutoffVal(event): 1797 Obj = event.GetEventObject() 1798 try: 1799 cutoff = float(Obj.GetValue()) 1800 if cutoff > 0: 1801 UseList[Indx[Obj.GetId()]]['Cutoff'] = cutoff 1802 except ValueError: 1803 pass 1804 Obj.SetValue("%.3f"%(UseList[Indx[Obj.GetId()]]['Cutoff'])) #reset in case of error 1805 1784 1806 def OnSizeType(event): 1785 1807 Obj = event.GetEventObject() … … 1849 1871 Obj = event.GetEventObject() 1850 1872 hist = Indx[Obj.GetId()] 1851 UseList[hist]['MDtexture'][1] [pid]= Obj.GetValue()1873 UseList[hist]['MDtexture'][1] = Obj.GetValue() 1852 1874 1853 1875 def OnMDVal(event): … … 1922 1944 1923 1945 if item[:4] == 'PWDR' and UseList[item]['Show']: 1946 cutoffSizer = wx.BoxSizer(wx.HORIZONTAL) 1947 cutoffSizer.Add(wx.StaticText(dataDisplay,label=' Peak cutoff ratio: '),0,wx.ALIGN_CENTER_VERTICAL) 1948 cutoffVal = wx.TextCtrl(dataDisplay,wx.ID_ANY,'%.3f'%(UseList[item]['Cutoff']), 1949 style=wx.TE_PROCESS_ENTER) 1950 Indx[cutoffVal.GetId()] = item 1951 cutoffVal.Bind(wx.EVT_TEXT_ENTER,OnCutoffVal) 1952 cutoffVal.Bind(wx.EVT_KILL_FOCUS,OnCutoffVal) 1953 cutoffSizer.Add(cutoffVal,0,wx.ALIGN_CENTER_VERTICAL) 1954 mainSizer.Add(cutoffSizer) 1955 mainSizer.Add((0,5),0) 1924 1956 sizeSizer = wx.BoxSizer(wx.HORIZONTAL) 1925 1957 choices = ['isotropic','uniaxial',] … … 2142 2174 'Size':['isotropic',[10000.,0,],[False,False],[0,0,1]], 2143 2175 'Mustrain':['isotropic',[0.0,0,],[False,False],[0,0,1]], 2144 'Extinction':[0.0,False] }2176 'Extinction':[0.0,False],'Cutoff':0.01} 2145 2177 data['Histograms'] = UseList 2146 2178 UpdateDData() -
trunk/GSASIIplot.py
r164 r165 1126 1126 drawingData = data['Drawing'] 1127 1127 drawAtoms = drawingData['Atoms'] 1128 Wt = [255,255,255 ,255]1129 Rd = [255,0,0 ,255]1130 Gr = [0,255,0 ,255]1131 Bl = [0,0,255 ,255]1128 Wt = [255,255,255] 1129 Rd = [255,0,0] 1130 Gr = [0,255,0] 1131 Bl = [0,0,255] 1132 1132 uBox = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]]) 1133 1133 uEdges = np.array([ … … 1319 1319 glBegin(GL_LINES) 1320 1320 for line,color in zip(uEdges,uColors): 1321 glColor 4ubv(color)1321 glColor3ubv(color) 1322 1322 glVertex3fv(line[0]) 1323 1323 glVertex3fv(line[1]) … … 1337 1337 glBegin(GL_LINES) 1338 1338 for line,color in zip(uEdges,uColors)[:3]: 1339 glColor 4ubv(color)1339 glColor3ubv(color) 1340 1340 glVertex3fv(line[0]) 1341 1341 glVertex3fv(line[1]) … … 1390 1390 glEnable(GL_COLOR_MATERIAL) 1391 1391 glLineWidth(1) 1392 glColor 4fv(color)1392 glColor3fv(color) 1393 1393 glPushMatrix() 1394 1394 glBegin(GL_LINES) … … 1533 1533 R4 = np.concatenate((np.concatenate((R,[[0],[0],[0]]),axis=1),[[0,0,0,1],]),axis=0) 1534 1534 E = np.sqrt(E) 1535 RenderEllipsoid(x,y,z,ellipseProb,E,R4,color) 1535 if atom[ct] == 'H' and not drawingData['showHydrogen']: 1536 pass 1537 else: 1538 RenderEllipsoid(x,y,z,ellipseProb,E,R4,color) 1536 1539 else: 1537 radius = ellipseProb*math.sqrt(abs(atom[cs+4])) 1538 RenderSphere(x,y,z,radius,color) 1540 if atom[ct] == 'H' and not drawingData['showHydrogen']: 1541 pass 1542 else: 1543 radius = ellipseProb*math.sqrt(abs(atom[cs+4])) 1544 RenderSphere(x,y,z,radius,color) 1539 1545 elif 'lines' in atom[cs]: 1540 1546 radius = 0.1 -
trunk/GSASIIspc.py
r163 r165 3 3 import numpy as np 4 4 import numpy.ma as ma 5 import numpy.linalg as nl 5 6 import math 6 7 import sys … … 595 596 return GetKNsym(str(Isym)),Mult 596 597 598 def ElemPosition(SGData): 599 ''' Under development 600 Object here is to return a list of symmetry element types and locations suitable 601 for say drawing them. 602 So far I have the element type... getting all possible locations without lookup may be impossible! 603 ''' 604 SymElements = [] 605 Inv = SGData['SGInv'] 606 Cen = SGData['SGCen'] 607 eleSym = {-3:['','-1'],-2:['',-6],-1:['2','-4'],0:['3','-3'],1:['4','m'],2:['6',''],3:['1','']} 608 # get operators & expand if centrosymmetric 609 Ops = SGData['SGOps'] 610 opM = np.array([op[0].T for op in Ops]) 611 opT = np.array([op[1] for op in Ops]) 612 if Inv: 613 opM = np.concatenate((opM,-opM)) 614 opT = np.concatenate((opT,-opT)) 615 opMT = zip(opM,opT) 616 for M,T in opMT[1:]: #skip I 617 Dt = int(nl.det(M)) 618 Tr = int(np.trace(M)) 619 Dt = -(Dt-1)/2 620 Es = eleSym[Tr][Dt] 621 if Dt: #rotation-inversion 622 I = np.eye(3) 623 if Tr == 1: #mirrors/glides 624 if np.any(T): #glide 625 M2 = np.inner(M,M) 626 MT = np.inner(M,T)+T 627 print 'glide',Es,MT 628 print M2 629 else: #mirror 630 print 'mirror',Es,T 631 print I-M 632 X = [-1,-1,-1] 633 elif Tr == -3: # pure inversion 634 X = np.inner(nl.inv(I-M),T) 635 print 'inversion',Es,X 636 else: #other rotation-inversion 637 M2 = np.inner(M,M) 638 MT = np.inner(M,T)+T 639 print 'rot-inv',Es,MT 640 print M2 641 X = [-1,-1,-1] 642 643 644 645 else: #rotations 646 print 'rotation',Es 647 X = [-1,-1,-1] 648 #SymElements.append([Es,X]) 649 650 return #SymElements 651 652 653 654 655 597 656 def U2Uij(U): 598 657 #returns the UIJ vector U11,U22,U33,U12,U13,U23 from tensor U
Note: See TracChangeset
for help on using the changeset viewer.