Changeset 3307
- Timestamp:
- Mar 3, 2018 12:40:36 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r3302 r3307 81 81 self.names = names 82 82 self.spins = spins 83 self.PrintTable = [' Magnetic symmetry operations for %s:'%self.text[0].split(':')[1],] 83 84 self.panel = wxscroll.ScrolledPanel(self) 84 85 mainSizer = wx.BoxSizer(wx.VERTICAL) … … 92 93 ncol = self.table[0].count(',')+2 93 94 for ic,cent in enumerate(cents): 95 Cent = np.array(Cents[ic]) 94 96 if ic: 95 97 cent = cent.strip(' (').strip(')+\n') … … 99 101 Red = False 100 102 for item in self.table: 101 if 'for' in item:102 mainSizer.Add(tableSizer,0,WACV)103 mainSizer.Add(wx.StaticText(self.panel,label=item),0,WACV)104 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0)105 Red = True106 lentable //= 2107 j = 0108 continue109 103 flds = item.split(')')[1] 110 104 tableSizer.Add(wx.StaticText(self.panel,label=' (%2d) '%(j+1)),0,WACV) … … 121 115 if self.spins[j+ic*lentable] < 0 or Red: 122 116 text.SetForegroundColour('Red') 117 item += ',-1' 118 else: 119 item += ',+1' 123 120 except IndexError: 124 121 print(self.spins,j,ic,lentable,self.names[j]) 122 M,T,S = G2spc.MagText2MTS(item.split(')')[1].replace(' ',''),CIF=False) 123 T = (T+Cent)%1. 124 item = G2spc.MT2text([M,T],reverse=True) 125 if S > 0: 126 item += ',+1' 127 else: 128 item += ',-1' 129 self.PrintTable.append(item.replace(' ','').lower()) 125 130 tableSizer.Add(text,0,WACV) 126 131 if not j%2: 127 132 tableSizer.Add((20,0)) 128 j += 1 133 j += 1 129 134 mainSizer.Add(tableSizer,0,WACV) 130 135 136 def OnPrintOps(event): 137 for item in self.PrintTable: 138 print(item) 139 131 140 btnsizer = wx.StdDialogButtonSizer() 141 printBtn = wx.Button(self.panel,label='Print Ops') 142 printBtn.Bind(wx.EVT_BUTTON, OnPrintOps) 143 btnsizer.Add(printBtn) 132 144 OKbtn = wx.Button(self.panel, wx.ID_OK) 133 145 OKbtn.SetDefault() … … 452 464 Obj = event.GetEventObject() 453 465 BNSlatt = Obj.GetValue() 466 if BNSlatt == SGData['SGLatt']: 467 return 454 468 SGData['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]] 455 469 self.Trans = G2spc.ApplyBNSlatt(SGData,SGData['BNSlattsym']) … … 515 529 BNSizer = wx.BoxSizer(wx.HORIZONTAL) 516 530 BNSizer.Add(wx.StaticText(self.panel,label=' Select BNS lattice:'),0,WACV) 517 BNS = wx.ComboBox(self.panel,value=SGData['BNSlattsym'][0],choices=list(BNSsym.keys()),style=wx.CB_READONLY|wx.CB_DROPDOWN) 531 BNSkeys = [SGData['SGLatt'],]+list(BNSsym.keys()) 532 BNS = wx.ComboBox(self.panel,value=SGData['SGLatt'],choices=BNSkeys,style=wx.CB_READONLY|wx.CB_DROPDOWN) 518 533 BNS.Bind(wx.EVT_COMBOBOX,OnBNSlatt) 519 534 BNSizer.Add(BNS,0,WACV) … … 1841 1856 OprNames = G2spc.GenMagOps(SGData)[0] 1842 1857 else: 1843 if not len(GenSym) or SGData['SGGray'] or '(' in MagSym: #not if BNS centered either1858 if not len(GenSym) or SGData['SGGray']: 1844 1859 magSizer.Add(wx.StaticText(General,label=' No spin inversion allowed'),0,WACV) 1845 1860 OprNames,SpnFlp = G2spc.GenMagOps(SGData) -
trunk/GSASIIspc.py
r3306 r3307 496 496 return SGTextList,offsetList,symOpList,G2oprList,G2opcodes 497 497 498 def MT2text(Opr ):498 def MT2text(Opr,reverse=False): 499 499 "From space group matrix/translation operator returns text version" 500 500 XYZ = ('-Z','-Y','-X','X-Y','ERR','Y-X','X','Y','Z') … … 507 507 if IK: 508 508 if IJ < 3: 509 Fld += (TRA[IK]+XYZ[IJ]).rjust(5) 509 if reverse: 510 Fld += (XYZ[IJ]+'+'+TRA[IK]).rjust(5) 511 else: 512 Fld += (TRA[IK]+XYZ[IJ]).rjust(5) 510 513 else: 511 Fld += (TRA[IK]+'+'+XYZ[IJ]).rjust(5) 514 if reverse: 515 Fld += (XYZ[IJ]+'+'+TRA[IK]).rjust(5) 516 else: 517 Fld += (TRA[IK]+'+'+XYZ[IJ]).rjust(5) 512 518 else: 513 519 Fld += XYZ[IJ].rjust(5) … … 1044 1050 return ' '.join(magSym) 1045 1051 1046 def MagText2MTS(mcifOpr ):1052 def MagText2MTS(mcifOpr,CIF=True): 1047 1053 "From magnetic space group cif text returns matrix/translation + spin flip" 1048 XYZ = {'x':[1,0,0],' -x':[-1,0,0],'y':[0,1,0],'-y':[0,-1,0],'z':[0,0,1],'-z':[0,0,-1],1049 ' x-y':[1,-1,0],'-x+y':[-1,1,0],}1054 XYZ = {'x':[1,0,0],'+x':[1,0,0],'-x':[-1,0,0],'y':[0,1,0],'+y':[0,1,0],'-y':[0,-1,0], 1055 'z':[0,0,1],'+z':[0,0,1],'-z':[0,0,-1],'x-y':[1,-1,0],'-x+y':[-1,1,0],} 1050 1056 ops = mcifOpr.split(",") 1051 1057 M = [] … … 1054 1060 ip = len(op) 1055 1061 if '/' in op: 1056 ip = op.index('/')-2 1057 T.append(eval(op[ip:])) 1058 # T.append(TRA[op[ip:]]) 1062 if CIF: 1063 opMT = op.split('+') 1064 T.append(eval(opMT[1])) 1065 else: 1066 ip = op.index('/') 1067 T.append(eval(op[:ip+2])) 1068 opMT = [op[ip+2:],''] 1059 1069 else: 1070 opMT = [op,''] 1060 1071 T.append(0.) 1061 M.append(XYZ[op [:ip]])1072 M.append(XYZ[opMT[0].lower()]) 1062 1073 spnflp = 1 1063 1074 if '-1' in ops[3]: … … 2185 2196 else: 2186 2197 csi = CSxinel[indx[3]] #Q 2187 print(opr,SpnFlp[dupDir[opr]],indx,csi,CSI)2198 # print(opr,SpnFlp[dupDir[opr]],indx,csi,CSI) 2188 2199 if not len(csi): 2189 2200 return [[0,0,0],[0.,0.,0.]]
Note: See TracChangeset
for help on using the changeset viewer.