Changeset 484
- Timestamp:
- Feb 15, 2012 2:36:53 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/G2importphase.py
r475 r484 1 ########### SVN repository information ################### 2 # $Date: 2012-02-13 11:33:35 -0600 (Mon, 13 Feb 2012) $ 3 # $Author: vondreele & toby $ 4 # $Revision: 482 $ 5 # $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/G2importphase.py $ 6 # $Id: G2importphase.py 482 2012-02-13 17:33:35Z vondreele $ 7 ########### SVN repository information ################### 1 8 # a set of short routines to read in phases from various file formats 2 9 # -
trunk/G2importphase_CIF.py
r469 r484 1 ########### SVN repository information ################### 2 # $Date: 2012-02-13 11:33:35 -0600 (Mon, 13 Feb 2012) $ 3 # $Author: vondreele & toby $ 4 # $Revision: 482 $ 5 # $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/G2importphase_CIF.py $ 6 # $Id: G2importphase_CIF.py 482 2012-02-13 17:33:35Z vondreele $ 7 ########### SVN repository information ################### 1 8 # Routines to import Phase information from CIF files 2 9 import sys -
trunk/G2importphase_GPX.py
r469 r484 1 ########### SVN repository information ################### 2 # $Date: 2012-02-13 11:33:35 -0600 (Mon, 13 Feb 2012) $ 3 # $Author: vondreele & toby $ 4 # $Revision: 482 $ 5 # $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/G2importphase_GPX.py $ 6 # $Id: G2importphase_GPX.py 482 2012-02-13 17:33:35Z vondreele $ 7 ########### SVN repository information ################### 1 8 # Routines to import Phase information from GSAS-II .gpx files 2 9 import cPickle -
trunk/GSASIIElem.py
r456 r484 1 1 """Element: functions for element types 2 Copyright: 2008, Robert B. Von Dreele (Argonne National Laboratory)2 Copyright: 2008, Robert B. Von Dreele & Brian H. Toby (Argonne National Laboratory) 3 3 """ 4 4 ########### SVN repository information ################### … … 10 10 ########### SVN repository information ################### 11 11 12 import wx13 12 import math 14 import sys15 13 import os.path 16 import wx.lib.colourselect as wscs17 14 import GSASIIpath 18 15 import numpy as np … … 39 36 FFdata = open(filename,'Ur') 40 37 except: 41 wx.MessageBox(message="File atmdata.dat not found in directory %s" % sys.path[0], 42 caption="No atmdata.dat file",style=wx.OK | wx.ICON_EXCLAMATION | wx.STAY_ON_TOP) 38 print "**** ERROR - File atmdata.dat not found in directory %s" % sys.path[0] 43 39 sys.exit() 44 40 S = '1' … … 89 85 FFdata = open(filename,'Ur') 90 86 except: 91 wx.MessageBox(message="File atmdata.dat not found in directory %s" % sys.path[0], 92 caption="No atmdata.dat file",style=wx.OK | wx.ICON_EXCLAMATION | wx.STAY_ON_TOP) 87 print '**** ERROR - File atmdata.dat not found in directory %s' % sys.path[0] 93 88 sys.exit() 94 89 S = '1' … … 151 146 xsec = open(filename,'Ur') 152 147 except: 153 wx.MessageBox(message="File Xsect.dat not found in directory %s" % sys.path[0], 154 caption="No Xsect.dat file",style=wx.OK | wx.ICON_EXCLAMATION |wx.STAY_ON_TOP) 148 print '**** ERROR - File Xsect.dat not found in directory %s' % sys.path[0] 155 149 sys.exit() 156 150 S = '1' … … 226 220 FFdata = open(filename,'Ur') 227 221 except: 228 wx.MessageBox(message="File atmdata.dat not found in directory %s" % sys.path[0], 229 caption="No atmdata.dat file",style=wx.OK | wx.ICON_EXCLAMATION |wx.STAY_ON_TOP) 222 print '**** ERROR - File atmdata.dat not found in directory %s' % sys.path[0] 230 223 sys.exit() 231 224 S = '1' … … 387 380 388 381 389 class PickElement(wx.Dialog):390 "Makes periodic table widget for picking element - caller maintains element list"391 Elem=None392 def _init_ctrls(self, prnt,oneOnly):393 wx.Dialog.__init__(self, id=-1, name='PickElement',394 parent=prnt, pos=wx.DefaultPosition,395 style=wx.DEFAULT_DIALOG_STYLE, title='Pick Element')396 import ElementTable as ET397 self.SetClientSize(wx.Size(770, 250))398 399 i=0400 for E in ET.ElTable:401 if oneOnly:402 color=E[4]403 else:404 color=E[6]405 PickElement.ElButton(self,name=E[0],406 pos=wx.Point(E[1]*40+25,E[2]*24+24),tip=E[3],color=color,oneOnly=oneOnly)407 i+=1408 409 def __init__(self, parent,oneOnly=False):410 self._init_ctrls(parent,oneOnly)411 412 def ElButton(self, name, pos, tip, color, oneOnly):413 Black = wx.Colour(0,0,0)414 if oneOnly:415 El = wscs.ColourSelect(label=name[0], parent=self,colour=color,416 pos=pos, size=wx.Size(40,23), style=wx.RAISED_BORDER)417 # El.SetLabel(name)418 El.Bind(wx.EVT_BUTTON, self.OnElButton)419 else:420 El = wx.ComboBox(choices=name, parent=self, pos=pos, size=wx.Size(40,23),421 style=wx.CB_READONLY, value=name[0])422 El.Bind(wx.EVT_COMBOBOX,self.OnElButton)423 424 El.SetBackgroundColour(color)425 El.SetToolTipString(tip)426 427 def OnElButton(self, event):428 El = event.GetEventObject().GetLabel()429 self.Elem = El430 self.EndModal(wx.ID_OK)431 432 class DeleteElement(wx.Dialog):433 "Delete element from selected set widget"434 def _init_ctrls(self, parent,choice):435 l = len(choice)-1436 wx.Dialog.__init__(self, id=-1, name='Delete', parent=parent,437 pos=wx.DefaultPosition, size=wx.Size(max(128,64+l*24), 87),438 style=wx.DEFAULT_DIALOG_STYLE, title='Delete Element')439 self.Show(True)440 self.SetAutoLayout(True)441 self.SetHelpText('Select element to delete')442 self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)443 444 i = 0445 Elem = []446 for Elem in choice:447 self.ElButton(id=-1,name=Elem,pos=wx.Point(16+i*24, 16))448 i+=1449 450 def __init__(self, parent,choice):451 DeleteElement.El = ' '452 self._init_ctrls(parent,choice)453 454 def ElButton(self, id, name, pos):455 White = wx.Colour(255, 255, 255)456 El = wscs.ColourSelect(label=name, parent=self, colour = White,457 pos=pos, size=wx.Size(24, 23), style=wx.RAISED_BORDER)458 El.Bind(wx.EVT_BUTTON, self.OnDeleteButton)459 460 def OnDeleteButton(self, event):461 DeleteElement.El=event.GetEventObject().GetLabel()462 self.EndModal(wx.ID_OK)463 464 def GetDeleteElement(self):465 return DeleteElement.El466 467 -
trunk/GSASIIgrid.py
r483 r484 47 47 [ wxID_DRAWATOMSTYLE, wxID_DRAWATOMLABEL, wxID_DRAWATOMCOLOR, wxID_DRAWATOMRESETCOLOR, 48 48 wxID_DRAWVIEWPOINT, wxID_DRAWTRANSFORM, wxID_DRAWDELETE, wxID_DRAWFILLCELL, 49 wxID_DRAWADDEQUIV, wxID_DRAWFILLCOORD, wxID_DRAWDISAGL , wxID_DRAWTORSION,wxID_DRAWPLANE,50 ] = [wx.NewId() for _init_coll_DrawAtom_Items in range(1 3)]49 wxID_DRAWADDEQUIV, wxID_DRAWFILLCOORD, wxID_DRAWDISAGLTOR, wxID_DRAWPLANE, 50 ] = [wx.NewId() for _init_coll_DrawAtom_Items in range(12)] 51 51 52 52 [ wxID_IMCALIBRATE,wxID_IMRECALIBRATE,wxID_IMINTEGRATE, wxID_IMCLEARCALIB, … … 169 169 info.Version = __version__ 170 170 info.Copyright = ''' 171 Robert B. Von Dreele 171 Robert B. Von Dreele & Brian H. Toby 172 172 Argonne National Laboratory(C) 173 173 This product includes software developed … … 175 175 Operator of Argonne National Laboratory. ''' 176 176 info.Description = ''' 177 General Structure Analysis System - II177 General Structure Analysis System - GSAS-II 178 178 ''' 179 179 wx.AboutBox(info) … … 519 519 self.DrawAtomEdit.Append(id=wxID_DRAWDELETE, kind=wx.ITEM_NORMAL,text='Delete atoms', 520 520 help='Delete atoms from drawing set') 521 self.DrawAtomCompute.Append(id=wxID_DRAWDISAGL, kind=wx.ITEM_NORMAL,text='Distances & Angles', 522 help='Compute distances & angles for selected atoms') 523 self.DrawAtomCompute.Append(id=wxID_DRAWTORSION, kind=wx.ITEM_NORMAL,text='Torsion angle', 524 help='Compute torsion angle for 4 selected atoms') 521 self.DrawAtomCompute.Append(id=wxID_DRAWDISAGLTOR, kind=wx.ITEM_NORMAL,text='Dist. Ang. Tors.', 522 help='Compute distance, angle or torsion for 2-4 selected atoms') 525 523 self.DrawAtomCompute.Append(id=wxID_DRAWPLANE, kind=wx.ITEM_NORMAL,text='Best plane', 526 help='Compute best plane for 3+ selected atoms')524 help='Compute best plane for 4+ selected atoms') 527 525 528 526 # end of GSAS-II menu definitions -
trunk/GSASIImapvars.py
r425 r484 1 ########### SVN repository information ################### 1 2 # $Date: 2011-01-07 13:27:24 -0600 (Fri, 07 Jan 2011) $ 2 # $Author: toby $3 # $Author: vondreele & toby $ 3 4 # $Revision: 230 $ 4 5 # $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIImapvars.py $ -
trunk/GSASIImath.py
r477 r484 2 2 ########### SVN repository information ################### 3 3 # $Date: 2012-01-13 11:48:53 -0600 (Fri, 13 Jan 2012) $ 4 # $Author: vondreele $4 # $Author: vondreele & toby $ 5 5 # $Revision: 451 $ 6 6 # $URL: https://subversion.xor.aps.anl.gov/pyGSAS/trunk/GSASIImath.py $ … … 234 234 else: 235 235 return calcAngle(OxA,TxA,TxB,unitA,unitB,invA,CA,MA,TA,invB,CB,MB,TB,Amat),0.0 236 236 237 def GetDistSig(Oatoms,Atoms,Amat,SGData,covData={}): 238 239 def calcDist(Atoms,SyOps,Amat): 240 XYZ = [] 241 for i,atom in enumerate(Atoms): 242 Inv,M,T,C,U = SyOps[i] 243 XYZ.append(np.array(atom[1:4])) 244 XYZ[-1] = Inv*(np.inner(M,np.array(XYZ[-1]))+T)+C+U 245 XYZ[-1] = np.inner(Amat,XYZ[-1]).T 246 V1 = XYZ[1]-XYZ[0] 247 return np.sqrt(np.sum(V1**2)) 248 249 Inv = [] 250 SyOps = [] 251 names = [] 252 for i,atom in enumerate(Oatoms): 253 names += atom[-1] 254 Op,unit = Atoms[i][-1] 255 inv = Op/abs(Op) 256 m,t = SGData['SGOps'][abs(Op)%100-1] 257 c = SGData['SGCen'][abs(Op)/100] 258 SyOps.append([inv,m,t,c,unit]) 259 Dist = calcDist(Oatoms,SyOps,Amat) 260 261 sig = -0.001 262 if 'covMatrix' in covData: 263 parmNames = [] 264 dx = .00001 265 dadx = np.zeros(6) 266 for i in range(6): 267 ia = i/3 268 ix = i%3 269 Oatoms[ia][ix+1] += dx 270 a0 = calcDist(Oatoms,SyOps,Amat) 271 Oatoms[ia][ix+1] -= 2*dx 272 dadx[i] = (calcDist(Oatoms,SyOps,Amat)-a0)/(2.*dx) 273 covMatrix = covData['covMatrix'] 274 varyList = covData['varyList'] 275 DistVcov = getVCov(names,varyList,covMatrix) 276 sig = np.sqrt(np.inner(dadx,np.inner(DistVcov,dadx))) 277 if sig < 0.001: 278 sig = -0.001 279 280 return Dist,sig 281 282 def GetAngleSig(Oatoms,Atoms,Amat,SGData,covData={}): 283 284 def calcAngle(Atoms,SyOps,Amat): 285 XYZ = [] 286 for i,atom in enumerate(Atoms): 287 Inv,M,T,C,U = SyOps[i] 288 XYZ.append(np.array(atom[1:4])) 289 XYZ[-1] = Inv*(np.inner(M,np.array(XYZ[-1]))+T)+C+U 290 XYZ[-1] = np.inner(Amat,XYZ[-1]).T 291 V1 = XYZ[1]-XYZ[0] 292 V1 /= np.sqrt(np.sum(V1**2)) 293 V2 = XYZ[1]-XYZ[2] 294 V2 /= np.sqrt(np.sum(V2**2)) 295 V3 = V2-V1 296 cang = min(1.,max((2.-np.sum(V3**2))/2.,-1.)) 297 return acosd(cang) 298 299 Inv = [] 300 SyOps = [] 301 names = [] 302 for i,atom in enumerate(Oatoms): 303 names += atom[-1] 304 Op,unit = Atoms[i][-1] 305 inv = Op/abs(Op) 306 m,t = SGData['SGOps'][abs(Op)%100-1] 307 c = SGData['SGCen'][abs(Op)/100] 308 SyOps.append([inv,m,t,c,unit]) 309 Angle = calcAngle(Oatoms,SyOps,Amat) 310 311 sig = -0.01 312 if 'covMatrix' in covData: 313 parmNames = [] 314 dx = .00001 315 dadx = np.zeros(9) 316 for i in range(9): 317 ia = i/3 318 ix = i%3 319 Oatoms[ia][ix+1] += dx 320 a0 = calcAngle(Oatoms,SyOps,Amat) 321 Oatoms[ia][ix+1] -= 2*dx 322 dadx[i] = (calcAngle(Oatoms,SyOps,Amat)-a0)/(2.*dx) 323 covMatrix = covData['covMatrix'] 324 varyList = covData['varyList'] 325 AngVcov = getVCov(names,varyList,covMatrix) 326 sig = np.sqrt(np.inner(dadx,np.inner(AngVcov,dadx))) 327 if sig < 0.01: 328 sig = -0.01 329 330 return Angle,sig 331 237 332 def GetTorsionSig(Oatoms,Atoms,Amat,SGData,covData={}): 238 333 … … 277 372 dx = .00001 278 373 dadx = np.zeros(12) 279 ang = calcTorsion(Oatoms,SyOps,Amat)280 374 for i in range(12): 281 375 ia = i/3 … … 294 388 return Tors,sig 295 389 390 def GetDATSig(Oatoms,Atoms,Amat,SGData,covData={}): 391 392 def calcDist(Atoms,SyOps,Amat): 393 XYZ = [] 394 for i,atom in enumerate(Atoms): 395 Inv,M,T,C,U = SyOps[i] 396 XYZ.append(np.array(atom[1:4])) 397 XYZ[-1] = Inv*(np.inner(M,np.array(XYZ[-1]))+T)+C+U 398 XYZ[-1] = np.inner(Amat,XYZ[-1]).T 399 V1 = XYZ[1]-XYZ[0] 400 return np.sqrt(np.sum(V1**2)) 401 402 def calcAngle(Atoms,SyOps,Amat): 403 XYZ = [] 404 for i,atom in enumerate(Atoms): 405 Inv,M,T,C,U = SyOps[i] 406 XYZ.append(np.array(atom[1:4])) 407 XYZ[-1] = Inv*(np.inner(M,np.array(XYZ[-1]))+T)+C+U 408 XYZ[-1] = np.inner(Amat,XYZ[-1]).T 409 V1 = XYZ[1]-XYZ[0] 410 V1 /= np.sqrt(np.sum(V1**2)) 411 V2 = XYZ[1]-XYZ[2] 412 V2 /= np.sqrt(np.sum(V2**2)) 413 V3 = V2-V1 414 cang = min(1.,max((2.-np.sum(V3**2))/2.,-1.)) 415 return acosd(cang) 416 417 def calcTorsion(Atoms,SyOps,Amat): 418 419 XYZ = [] 420 for i,atom in enumerate(Atoms): 421 Inv,M,T,C,U = SyOps[i] 422 XYZ.append(np.array(atom[1:4])) 423 XYZ[-1] = Inv*(np.inner(M,np.array(XYZ[-1]))+T)+C+U 424 XYZ[-1] = np.inner(Amat,XYZ[-1]).T 425 V1 = XYZ[1]-XYZ[0] 426 V2 = XYZ[2]-XYZ[1] 427 V3 = XYZ[3]-XYZ[2] 428 V1 /= np.sqrt(np.sum(V1**2)) 429 V2 /= np.sqrt(np.sum(V2**2)) 430 V3 /= np.sqrt(np.sum(V3**2)) 431 M = np.array([V1,V2,V3]) 432 D = nl.det(M) 433 Ang = 1.0 434 P12 = np.dot(V1,V2) 435 P13 = np.dot(V1,V3) 436 P23 = np.dot(V2,V3) 437 Tors = acosd((P12*P23-P13)/(np.sqrt(1.-P12**2)*np.sqrt(1.-P23**2)))*D/abs(D) 438 return Tors 439 440 Inv = [] 441 SyOps = [] 442 names = [] 443 for i,atom in enumerate(Oatoms): 444 names += atom[-1] 445 Op,unit = Atoms[i][-1] 446 inv = Op/abs(Op) 447 m,t = SGData['SGOps'][abs(Op)%100-1] 448 c = SGData['SGCen'][abs(Op)/100] 449 SyOps.append([inv,m,t,c,unit]) 450 M = len(Oatoms) 451 if M == 2: 452 Val = calcDist(Oatoms,SyOps,Amat) 453 elif M == 3: 454 Val = calcAngle(Oatoms,SyOps,Amat) 455 else: 456 Val = calcTorsion(Oatoms,SyOps,Amat) 457 458 sigVals = [-0.001,-0.01,-0.01] 459 if 'covMatrix' in covData: 460 parmNames = [] 461 dx = .00001 462 N = M*3 463 sig = sigVals[M-3] 464 dadx = np.zeros(N) 465 for i in range(N): 466 ia = i/3 467 ix = i%3 468 Oatoms[ia][ix+1] += dx 469 if M == 2: 470 a0 = calcDist(Oatoms,SyOps,Amat) 471 elif M == 3: 472 a0 = calcAngle(Oatoms,SyOps,Amat) 473 else: 474 a0 = calcTorsion(Oatoms,SyOps,Amat) 475 Oatoms[ia][ix+1] -= 2*dx 476 if M == 2: 477 dadx[i] = (calcDist(Oatoms,SyOps,Amat)-a0)/(2.*dx) 478 elif M == 3: 479 dadx[i] = (calcAngle(Oatoms,SyOps,Amat)-a0)/(2.*dx) 480 else: 481 dadx[i] = (calcTorsion(Oatoms,SyOps,Amat)-a0)/(2.*dx) 482 covMatrix = covData['covMatrix'] 483 varyList = covData['varyList'] 484 Vcov = getVCov(names,varyList,covMatrix) 485 sig = np.sqrt(np.inner(dadx,np.inner(Vcov,dadx))) 486 if sig < sigVals[M-3]: 487 sig = sigVals[M-3] 488 489 return Val,sig 490 296 491 297 492 def ValEsd(value,esd=0,nTZ=False): #NOT complete - don't use -
trunk/GSASIIphsGUI.py
r483 r484 20 20 import GSASIIspc as G2spc 21 21 import GSASIIElem as G2elem 22 import GSASIIElemGUI as G2elemGUI 22 23 import GSASIIplot as G2plt 23 24 import GSASIIgrid as G2gd … … 818 819 r,c = event.GetRow(),event.GetCol() 819 820 if Atoms.GetColLabelValue(c) == 'Type': 820 PE = G2elem .PickElement(G2frame)821 PE = G2elemGUI.PickElement(G2frame) 821 822 if PE.ShowModal() == wx.ID_OK: 822 823 atomData[r][c] = PE.Elem.strip() … … 1831 1832 atomData[ind][col] = value 1832 1833 1833 def OnDrawTorsion(event):1834 indx = drawAtoms.GetSelectedRows()1835 if len(indx) != 4:1836 print '**** ERROR - need 4 atoms for torsion calculation'1837 return1838 TorsionData = {}1839 ocx,oct,ocs,cia = data['General']['AtomPtrs']1840 drawingData = data['Drawing']1841 atomData = data['Atoms']1842 # for atom in atomData: print atom1843 atomDData = drawingData['Atoms']1844 # for atom in atomDData: print atom1845 colLabels = [drawAtoms.GetColLabelValue(c) for c in range(drawAtoms.GetNumberCols())]1846 cx = colLabels.index('x')1847 cn = colLabels.index('Name')1848 cid = colLabels.index('I/A')+81849 xyz = []1850 Oxyz = []1851 for i,atom in enumerate(atomDData):1852 if i in indx:1853 xyz.append([i,]+atom[cn:cn+2]+atom[cx:cx+4]) #also gets Sym Op1854 id = FindAtomIndexByIDs(atomData,[atom[cid],],False)[0]1855 Oxyz.append([id,]+atomData[id][cx+1:cx+4])1856 TorsionData['Datoms'] = xyz1857 TorsionData['Oatoms'] = Oxyz1858 generalData = data['General']1859 TorsionData['Name'] = generalData['Name']1860 TorsionData['SGData'] = generalData['SGData']1861 TorsionData['Cell'] = generalData['Cell'][1:] #+ volume1862 if 'pId' in data:1863 TorsionData['pId'] = data['pId']1864 TorsionData['covData'] = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.root, 'Covariance'))1865 G2str.Torsion(TorsionData)1866 1867 1834 def OnDrawPlane(event): 1868 1835 indx = drawAtoms.GetSelectedRows() 1869 if len(indx) < 3:1870 print '**** ERROR - need 3+ atoms for plane calculation'1836 if len(indx) < 4: 1837 print '**** ERROR - need 4+ atoms for plane calculation' 1871 1838 return 1872 1839 PlaneData = {} … … 1886 1853 G2str.BestPlane(PlaneData) 1887 1854 1888 def OnDrawDistAngle(event): 1855 def OnDrawDAT(event): 1856 #distance, angle, torsion 1889 1857 indx = drawAtoms.GetSelectedRows() 1890 print 'Future bond dist/angles for atoms',indx 1858 if len(indx) not in [2,3,4]: 1859 print '**** ERROR - wrong number of atoms for distance, angle or torsion calculation' 1860 return 1861 DATData = {} 1862 ocx,oct,ocs,cia = data['General']['AtomPtrs'] 1863 drawingData = data['Drawing'] 1864 atomData = data['Atoms'] 1865 atomDData = drawingData['Atoms'] 1866 colLabels = [drawAtoms.GetColLabelValue(c) for c in range(drawAtoms.GetNumberCols())] 1867 cx = colLabels.index('x') 1868 cn = colLabels.index('Name') 1869 cid = colLabels.index('I/A')+8 1870 xyz = [] 1871 Oxyz = [] 1872 DATData['Natoms'] = len(indx) 1873 for i in indx: 1874 atom = atomDData[i] 1875 xyz.append([i,]+atom[cn:cn+2]+atom[cx:cx+4]) #also gets Sym Op 1876 id = FindAtomIndexByIDs(atomData,[atom[cid],],False)[0] 1877 Oxyz.append([id,]+atomData[id][cx+1:cx+4]) 1878 DATData['Datoms'] = xyz 1879 DATData['Oatoms'] = Oxyz 1880 generalData = data['General'] 1881 DATData['Name'] = generalData['Name'] 1882 DATData['SGData'] = generalData['SGData'] 1883 DATData['Cell'] = generalData['Cell'][1:] #+ volume 1884 if 'pId' in data: 1885 DATData['pId'] = data['pId'] 1886 DATData['covData'] = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.root, 'Covariance')) 1887 G2str.DisAglTor(DATData) 1891 1888 1892 1889 def UpdateDrawOptions(): … … 3147 3144 G2frame.dataFrame.Bind(wx.EVT_MENU, FillUnitCell, id=G2gd.wxID_DRAWFILLCELL) 3148 3145 G2frame.dataFrame.Bind(wx.EVT_MENU, DrawAtomsDelete, id=G2gd.wxID_DRAWDELETE) 3149 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDrawDistAngle, id=G2gd.wxID_DRAWDISAGL) 3150 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDrawTorsion, id=G2gd.wxID_DRAWTORSION) 3146 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDrawDAT, id=G2gd.wxID_DRAWDISAGLTOR) 3151 3147 G2frame.dataFrame.Bind(wx.EVT_MENU, OnDrawPlane, id=G2gd.wxID_DRAWPLANE) 3152 3148 UpdateDrawAtoms() -
trunk/GSASIIplot.py
r483 r484 2694 2694 RenderLabel(x,y,z,atom[ct-1],radius) 2695 2695 elif atom[cs+1] == 'number': 2696 RenderLabel(x,y,z,str(iat +1),radius)2696 RenderLabel(x,y,z,str(iat),radius) 2697 2697 elif atom[cs+1] == 'residue' and atom[ct-1] == 'CA': 2698 2698 RenderLabel(x,y,z,atom[ct-4],radius) -
trunk/GSASIIsolve.py
r230 r484 22 22 print 80*'*' 23 23 print ' General Structure Analysis System-II Crystal Structure Solution' 24 print ' by Robert B. Von Dreele, Argonne National Laboratory(C), 2010' 24 print ' by Robert B. Von Dreele & Brian H. Toby' 25 print ' Argonne National Laboratory(C), 2010' 25 26 print ' This product includes software developed by the UChicago Argonne, LLC,' 26 27 print ' as Operator of Argonne National Laboratory.' -
trunk/GSASIIstruct.py
r482 r484 371 371 print 80*'*' 372 372 print ' General Structure Analysis System-II Crystal Structure Refinement' 373 print ' by Robert B. Von Dreele, Argonne National Laboratory(C), 2010' 373 print ' by Robert B. Von Dreele & Brian H. Toby' 374 print ' Argonne National Laboratory(C), 2010' 374 375 print ' This product includes software developed by the UChicago Argonne, LLC,' 375 376 print ' as Operator of Argonne National Laboratory.' … … 3012 3013 print ' %8s%10s+(%4d) %12s'%(dist[1].ljust(8),dist[2].ljust(10),dist[3],val.center(12)),line 3013 3014 3014 def Torsion(TorsionData): 3015 3016 def ShowBanner(name): 3017 print 80*'*' 3018 print ' Torsion angle for phase '+name 3019 print 80*'*' 3020 3021 ShowBanner(TorsionData['Name']) 3022 SGData = TorsionData['SGData'] 3023 Cell = TorsionData['Cell'] 3015 def DisAglTor(DATData): 3016 SGData = DATData['SGData'] 3017 Cell = DATData['Cell'] 3024 3018 3025 3019 Amat,Bmat = G2lat.cell2AB(Cell[:6]) 3026 3020 covData = {} 3027 3021 pfx = '' 3028 if 'covData' in TorsionData:3029 covData = TorsionData['covData']3022 if 'covData' in DATData: 3023 covData = DATData['covData'] 3030 3024 covMatrix = covData['covMatrix'] 3031 3025 varyList = covData['varyList'] 3032 pfx = str(TorsionData['pId'])+'::' 3033 #find one end of 4 atom string - involved in longest distance 3034 dist = {} 3035 for i,X1 in enumerate(TorsionData['Datoms']): 3036 for j,X2 in enumerate(TorsionData['Datoms'][:i]): 3037 dist[np.sqrt(np.sum(np.inner(Amat,np.array(X2[3:6])-np.array(X1[3:6]))**2))] = [i,j] 3038 sortdist = dist.keys() 3039 sortdist.sort() 3040 end = dist[sortdist[-1]][0] 3041 #order atoms in distance from end - defines sequence of atoms for the torsion angle 3042 dist = {} 3043 X1 = TorsionData['Datoms'][end] 3044 for i,X2 in enumerate(TorsionData['Datoms']): 3045 dist[np.sqrt(np.sum(np.inner(Amat,np.array(X2[3:6])-np.array(X1[3:6]))**2))] = i 3046 sortdist = dist.keys() 3047 sortdist.sort() 3026 pfx = str(DATData['pId'])+'::' 3048 3027 Datoms = [] 3049 3028 Oatoms = [] 3050 for d in sortdist: 3051 atom = TorsionData['Datoms'][dist[d]] 3029 for i,atom in enumerate(DATData['Datoms']): 3052 3030 symop = atom[-1].split('+') 3053 3031 if len(symop) == 1: … … 3055 3033 symop[0] = int(symop[0]) 3056 3034 symop[1] = eval(symop[1]) 3057 atom [-1] = symop3035 atom.append(symop) 3058 3036 Datoms.append(atom) 3059 oatom = TorsionData['Oatoms'][dist[d]]3037 oatom = DATData['Oatoms'][i] 3060 3038 names = ['','',''] 3061 3039 if pfx: … … 3063 3041 oatom += [names,] 3064 3042 Oatoms.append(oatom) 3065 Tors,sig = G2mth.GetTorsionSig(Oatoms,Datoms,Amat,SGData,covData) 3066 print ' Torsion angle for atom sequence: ',[Datoms[i][1] for i in range(4)],'=',G2mth.ValEsd(Tors,sig) 3067 print ' NB: Atom sequence determined by interatomic distances' 3043 atmSeq = [atom[1]+'('+atom[-2]+')' for atom in Datoms] 3044 if DATData['Natoms'] == 4: #torsion 3045 Tors,sig = G2mth.GetDATSig(Oatoms,Datoms,Amat,SGData,covData) 3046 print ' Torsion angle for '+DATData['Name']+' atom sequence: ',atmSeq,'=',G2mth.ValEsd(Tors,sig) 3047 print ' NB: Atom sequence determined by selection order' 3048 return # done with torsion 3049 elif DATData['Natoms'] == 3: #angle 3050 Ang,sig = G2mth.GetDATSig(Oatoms,Datoms,Amat,SGData,covData) 3051 print ' Angle in '+DATData['Name']+' for atom sequence: ',atmSeq,'=',G2mth.ValEsd(Ang,sig) 3052 print ' NB: Atom sequence determined by selection order' 3053 else: #2 atoms - distance 3054 Dist,sig = G2mth.GetDATSig(Oatoms,Datoms,Amat,SGData,covData) 3055 print ' Distance in '+DATData['Name']+' for atom sequence: ',atmSeq,'=',G2mth.ValEsd(Dist,sig) 3068 3056 3069 3057 def BestPlane(PlaneData):
Note: See TracChangeset
for help on using the changeset viewer.