Changeset 3719
- Timestamp:
- Nov 5, 2018 1:37:50 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r3716 r3719 2527 2527 UCdata = list(G2frame.GPXtree.GetItemPyData(UnitCellsId)) 2528 2528 magData = UCdata[5] 2529 baseList = UCdata[0][16] 2529 if len(UCdata[0]) < 17: #old version of k-SUBGROUPSMAG 2530 baseList = range(1,len(magData)+1) 2531 else: 2532 baseList = UCdata[0][16] 2530 2533 magKeep = [] 2531 2534 magIds = [] -
trunk/GSASIIpwdGUI.py
r3716 r3719 84 84 85 85 class SubCellsDialog(wx.Dialog): 86 def __init__(self,parent,title, items,phaseDict):86 def __init__(self,parent,title,controls,SGData,items,phaseDict): 87 87 wx.Dialog.__init__(self,parent,-1,title, 88 88 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE) 89 89 self.panel = None 90 self.controls = controls 91 self.SGData = SGData #for parent phase 90 92 self.items = items 91 93 self.phaseDict = phaseDict … … 94 96 95 97 def Draw(self): 98 99 def RefreshGrid(event): 100 r,c = event.GetRow(),event.GetCol() 101 br = self.items[r] 102 phase = self.phaseDict[br] 103 rLab = magDisplay.GetRowLabelValue(r) 104 pname = '(%s) %s'%(rLab,phase['Name']) 105 if c == 0: 106 mSGData = phase['SGData'] 107 text,table = G2spc.SGPrint(mSGData,AddInv=True) 108 if 'magAtms' in phase: 109 msg = 'Magnetic space group information' 110 text[0] = ' Magnetic Space Group: '+mSGData['MagSpGrp'] 111 text[3] = ' The magnetic lattice point group is '+mSGData['MagPtGp'] 112 OprNames,SpnFlp = G2spc.GenMagOps(mSGData) 113 G2G.SGMagSpinBox(self.panel,msg,text,table,mSGData['SGCen'],OprNames, 114 mSGData['SpnFlp'],False).Show() 115 else: 116 msg = 'Space Group Information' 117 G2G.SGMessageBox(self.panel,msg,text,table).Show() 118 elif c == 1: 119 maxequiv = phase['maxequiv'] 120 mSGData = phase['SGData'] 121 Uvec = phase['Uvec'] 122 Trans = phase['Trans'] 123 ifMag = False 124 if 'magAtms' in phase: 125 ifMag = True 126 allmom = phase.get('allmom',False) 127 magAtms = phase.get('magAtms','') 128 mAtoms = TestMagAtoms(phase,magAtms,self.SGData,Uvec,Trans,allmom,maxequiv) 129 else: 130 mAtoms = TestAtoms(phase,self.controls[15],self.SGData,Uvec,Trans,maxequiv) 131 Atms = [] 132 AtCods = [] 133 atMxyz = [] 134 for ia,atom in enumerate(mAtoms): 135 atom[0] += '_%d'%ia 136 SytSym,Mul,Nop,dupDir = G2spc.SytSym(atom[2:5],mSGData) 137 Atms.append(atom[:2]+['',]+atom[2:5]) 138 AtCods.append('1') 139 if 'magAtms' in phase: 140 MagSytSym = G2spc.MagSytSym(SytSym,dupDir,mSGData) 141 CSI = G2spc.GetCSpqinel(mSGData['SpnFlp'],dupDir) 142 atMxyz.append([MagSytSym,CSI[0]]) 143 else: 144 CSI = G2spc.GetCSxinel(SytSym) 145 atMxyz.append([SytSym,CSI[0]]) 146 G2phsG.UseMagAtomDialog(self.panel,pname,Atms,AtCods,atMxyz,ifMag=ifMag,ifOK=True).Show() 147 elif c in [2,3]: 148 if c == 2: 149 title = 'Conjugacy list for '+pname 150 items = phase['altList'] 151 152 elif c == 3: 153 title = 'Super groups list list for '+pname 154 items = phase['supList'] 155 if not items[0]: 156 wx.MessageBox(pname+' is a maximal subgroup',caption='Super group is parent',style=wx.ICON_INFORMATION) 157 return 158 SubCellsDialog(self.panel,title,self.controls,self.SGData,items,self.phaseDict).Show() 159 96 160 if self.panel: self.panel.Destroy() 97 161 self.panel = wx.Panel(self) 98 162 rowLabels = [str(i+1) for i in range(len(self.items))] 99 colLabels = ['Space Gp',' Try','Keep','Uniq','nConj','nSup','Trans','Vec','a','b','c','alpha','beta','gamma','Volume']100 Types = [wg.GRID_VALUE_STRING,]+ 2*[wg.GRID_VALUE_BOOL,]+3*[wg.GRID_VALUE_LONG,]+2*[wg.GRID_VALUE_STRING,]+ \163 colLabels = ['Space Gp','Uniq','nConj','nSup','Trans','Vec','a','b','c','alpha','beta','gamma','Volume'] 164 Types = [wg.GRID_VALUE_STRING,]+3*[wg.GRID_VALUE_LONG,]+2*[wg.GRID_VALUE_STRING,]+ \ 101 165 3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2'] 102 166 table = [] … … 113 177 trans = G2spc.Trans2Text(phase['Trans']) 114 178 vec = G2spc.Latt2text([phase['Uvec'],]) 115 row = [phase['Name'], phase['Use'],phase['Keep'],natms,nConj,nSup,trans,vec]+cell179 row = [phase['Name'],natms,nConj,nSup,trans,vec]+cell 116 180 table.append(row) 117 181 CellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types) … … 119 183 magDisplay = G2G.GSGrid(self.panel) 120 184 magDisplay.SetTable(CellsTable, True) 121 # magDisplay.Bind(wg.EVT_GRID_CELL_LEFT_CLICK,RefreshMagCellsGrid) 122 # magDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK,OnRefreshKeep) 185 magDisplay.Bind(wg.EVT_GRID_CELL_LEFT_CLICK,RefreshGrid) 123 186 magDisplay.AutoSizeColumns(False) 124 for r in range(magDisplay.GetNumberRows()):125 for c in range(magDisplay.GetNumberCols()):126 if c in [1,2]:127 magDisplay.SetReadOnly(r,c,isReadOnly=False)128 else:129 magDisplay.SetReadOnly(r,c,isReadOnly=True)130 187 mainSizer.Add(magDisplay,0,WACV) 131 188 … … 142 199 self.Fit() 143 200 201 144 202 def OnOk(self,event): 145 203 parent = self.GetParent() … … 511 569 ).update(copy.deepcopy(copyDict)) 512 570 571 def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100,maximal=False): 572 found = False 573 anymom = False 574 phase['Keep'] = False 575 if not magAtms: 576 phase['Keep'] = True 577 return [] 578 invTrans = nl.inv(Trans) 579 atCodes = [] 580 Phase = {'General':{'AtomPtrs':[2,1],'SGData':copy.deepcopy(phase['SGData'])},'Atoms':[]} 581 for matm in magAtms: 582 XYZ = G2spc.GenAtom(matm[3:6],SGData,False,Move=True) 583 xyzs = [xyz[0] for xyz in XYZ] 584 atCodes += len(xyzs)*['1',] 585 xyzs,atCodes = G2lat.ExpandCell(xyzs,atCodes,0,Trans) 586 for ix,x in enumerate(xyzs): 587 xyz = G2lat.TransformXYZ(x-Uvec,invTrans.T,np.zeros(3))%1. 588 Phase['Atoms'].append(matm[:2]+list(xyz)) 589 SytSym,Mul,Nop,dupDir = G2spc.SytSym(xyz,phase['SGData']) 590 CSI = G2spc.GetCSpqinel(phase['SGData']['SpnFlp'],dupDir) 591 if any(CSI[0]): 592 anymom = True 593 if allmom: 594 if not any(CSI[0]): 595 phase['Keep'] = False 596 found = True 597 uAtms = G2lat.GetUnique(Phase,atCodes)[0] 598 natm = len(uAtms) 599 if anymom and natm <= maxequiv and not found: 600 phase['Keep'] = True 601 if maximal and phase['supList'][0]: 602 phase['Keep'] = False 603 return uAtms 604 605 def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100,maximal=False): 606 phase['Keep'] = True 607 invTrans = nl.inv(Trans) 608 atCodes = [] 609 Phase = {'General':{'AtomPtrs':[2,1],'SGData':copy.deepcopy(phase['SGData'])},'Atoms':[]} 610 for matm in magAtms: 611 XYZ = G2spc.GenAtom(matm[3:6],SGData,False,Move=True) 612 xyzs = [xyz[0] for xyz in XYZ] 613 atCodes += len(xyzs)*['1',] 614 xyzs,atCodes = G2lat.ExpandCell(xyzs,atCodes,0,Trans) 615 for ix,x in enumerate(xyzs): 616 xyz = G2lat.TransformXYZ(x-Uvec,invTrans.T,np.zeros(3))%1. 617 Phase['Atoms'].append(matm[:2]+list(xyz)) 618 uAtms = G2lat.GetUnique(Phase,atCodes)[0] 619 natm = len(uAtms) 620 if natm > maxequiv: #too many allowed atoms found 621 phase['Keep'] = False 622 if maximal and phase['supList'][0]: 623 phase['Keep'] = False 624 return uAtms 625 513 626 ################################################################################ 514 627 ##### Powder Peaks … … 3476 3589 controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(UnitCellsId) 3477 3590 r,c = event.GetRow(),event.GetCol() 3591 rLab = magDisplay.GetRowLabelValue(r) 3478 3592 br = baseList[r] 3479 3593 phase = phaseDict[br] 3594 pname = '(%s) %s'%(rLab,phase['Name']) 3480 3595 if magcells: 3481 3596 if c == 0: … … 3483 3598 text,table = G2spc.SGPrint(mSGData,AddInv=True) 3484 3599 if 'magAtms' in phase: 3485 msg = 'Magnetic space group information for '+phase['Name']3600 msg = 'Magnetic space group information' 3486 3601 text[0] = ' Magnetic Space Group: '+mSGData['MagSpGrp'] 3487 3602 text[3] = ' The magnetic lattice point group is '+mSGData['MagPtGp'] … … 3514 3629 elif c ==3: 3515 3630 maxequiv = magcells[0].get('maxequiv',100) 3516 pname = '(%d) %s'%(br,phase['Name'])3517 3631 mSGData = phase['SGData'] 3518 3632 Uvec = phase['Uvec'] … … 3545 3659 if 'altList' not in phase: return 3546 3660 if c == 4: 3547 title = 'Conjugacy list for '+p hase['Name']3661 title = 'Conjugacy list for '+pname 3548 3662 items = phase['altList'] 3549 3663 3550 3664 elif c == 5: 3551 title = 'Super groups list list for '+phase['Name']3665 title = 'Super groups list for '+pname 3552 3666 items = phase['supList'] 3553 3667 if not items[0]: 3554 wx.MessageBox(p hase['Name']+' is a maximal subgroup',caption='Super group is parent',style=wx.ICON_INFORMATION)3668 wx.MessageBox(pname+' is a maximal subgroup',caption='Super group is parent',style=wx.ICON_INFORMATION) 3555 3669 return 3556 3670 3557 SubCellsDialog(G2frame,title, items,phaseDict).ShowModal()3671 SubCellsDialog(G2frame,title,controls,SGData,items,phaseDict).ShowModal() 3558 3672 3559 3673 data = [controls,bravais,cells,dminx,ssopt,magcells] … … 3708 3822 wx.CallAfter(UpdateUnitCellsGrid,G2frame,data) 3709 3823 3710 def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100,maximal=False):3711 found = False3712 anymom = False3713 phase['Keep'] = False3714 if not magAtms:3715 phase['Keep'] = True3716 return []3717 invTrans = nl.inv(Trans)3718 atCodes = []3719 Phase = {'General':{'AtomPtrs':[2,1],'SGData':copy.deepcopy(phase['SGData'])},'Atoms':[]}3720 for matm in magAtms:3721 XYZ = G2spc.GenAtom(matm[3:6],SGData,False,Move=True)3722 xyzs = [xyz[0] for xyz in XYZ]3723 atCodes += len(xyzs)*['1',]3724 xyzs,atCodes = G2lat.ExpandCell(xyzs,atCodes,0,Trans)3725 for ix,x in enumerate(xyzs):3726 xyz = G2lat.TransformXYZ(x-Uvec,invTrans.T,np.zeros(3))%1.3727 Phase['Atoms'].append(matm[:2]+list(xyz))3728 SytSym,Mul,Nop,dupDir = G2spc.SytSym(xyz,phase['SGData'])3729 CSI = G2spc.GetCSpqinel(phase['SGData']['SpnFlp'],dupDir)3730 if any(CSI[0]):3731 anymom = True3732 if allmom:3733 if not any(CSI[0]):3734 phase['Keep'] = False3735 found = True3736 uAtms = G2lat.GetUnique(Phase,atCodes)[0]3737 natm = len(uAtms)3738 if anymom and natm <= maxequiv and not found:3739 phase['Keep'] = True3740 if maximal and phase['supList'][0]:3741 phase['Keep'] = False3742 return uAtms3743 3744 def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100,maximal=False):3745 phase['Keep'] = True3746 invTrans = nl.inv(Trans)3747 atCodes = []3748 Phase = {'General':{'AtomPtrs':[2,1],'SGData':copy.deepcopy(phase['SGData'])},'Atoms':[]}3749 for matm in magAtms:3750 XYZ = G2spc.GenAtom(matm[3:6],SGData,False,Move=True)3751 xyzs = [xyz[0] for xyz in XYZ]3752 atCodes += len(xyzs)*['1',]3753 xyzs,atCodes = G2lat.ExpandCell(xyzs,atCodes,0,Trans)3754 for ix,x in enumerate(xyzs):3755 xyz = G2lat.TransformXYZ(x-Uvec,invTrans.T,np.zeros(3))%1.3756 Phase['Atoms'].append(matm[:2]+list(xyz))3757 uAtms = G2lat.GetUnique(Phase,atCodes)[0]3758 natm = len(uAtms)3759 if natm > maxequiv: #too many allowed atoms found3760 phase['Keep'] = False3761 if maximal and phase['supList'][0]:3762 phase['Keep'] = False3763 return uAtms3764 3765 3824 def OnRunSubs(event): 3766 3825 import SUBGROUPS as kSUB
Note: See TracChangeset
for help on using the changeset viewer.