Changeset 3307


Ignore:
Timestamp:
Mar 3, 2018 12:40:36 PM (6 years ago)
Author:
vondreele
Message:

provide print tool for magnetic space group operators that can be fed into Bilbao routine for determinimg std BNS space group with transformation

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r3302 r3307  
    8181        self.names = names
    8282        self.spins = spins
     83        self.PrintTable = [' Magnetic symmetry operations for %s:'%self.text[0].split(':')[1],]
    8384        self.panel = wxscroll.ScrolledPanel(self)
    8485        mainSizer = wx.BoxSizer(wx.VERTICAL)
     
    9293        ncol = self.table[0].count(',')+2
    9394        for ic,cent in enumerate(cents):
     95            Cent = np.array(Cents[ic])
    9496            if ic:
    9597                cent = cent.strip(' (').strip(')+\n')
     
    99101            Red = False
    100102            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 = True
    106                     lentable //= 2
    107                     j = 0
    108                     continue
    109103                flds = item.split(')')[1]
    110104                tableSizer.Add(wx.StaticText(self.panel,label='  (%2d)  '%(j+1)),0,WACV)           
     
    121115                    if self.spins[j+ic*lentable] < 0 or Red:
    122116                        text.SetForegroundColour('Red')
     117                        item += ',-1'
     118                    else:
     119                        item += ',+1'
    123120                except IndexError:
    124121                    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())
    125130                tableSizer.Add(text,0,WACV)
    126131                if not j%2:
    127132                    tableSizer.Add((20,0))
    128                 j += 1
     133                j += 1               
    129134            mainSizer.Add(tableSizer,0,WACV)
    130135           
     136        def OnPrintOps(event):
     137            for item in self.PrintTable:
     138                print(item)
     139           
    131140        btnsizer = wx.StdDialogButtonSizer()
     141        printBtn = wx.Button(self.panel,label='Print Ops')
     142        printBtn.Bind(wx.EVT_BUTTON, OnPrintOps)
     143        btnsizer.Add(printBtn)
    132144        OKbtn = wx.Button(self.panel, wx.ID_OK)
    133145        OKbtn.SetDefault()
     
    452464            Obj = event.GetEventObject()
    453465            BNSlatt = Obj.GetValue()
     466            if BNSlatt == SGData['SGLatt']:
     467                return
    454468            SGData['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]]
    455469            self.Trans = G2spc.ApplyBNSlatt(SGData,SGData['BNSlattsym'])
     
    515529                BNSizer = wx.BoxSizer(wx.HORIZONTAL)
    516530                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)
    518533                BNS.Bind(wx.EVT_COMBOBOX,OnBNSlatt)
    519534                BNSizer.Add(BNS,0,WACV)
     
    18411856                OprNames = G2spc.GenMagOps(SGData)[0]
    18421857            else:
    1843                 if not len(GenSym) or SGData['SGGray'] or '(' in MagSym:    #not if BNS centered either
     1858                if not len(GenSym) or SGData['SGGray']:
    18441859                    magSizer.Add(wx.StaticText(General,label=' No spin inversion allowed'),0,WACV)
    18451860                    OprNames,SpnFlp = G2spc.GenMagOps(SGData)                   
  • trunk/GSASIIspc.py

    r3306 r3307  
    496496    return SGTextList,offsetList,symOpList,G2oprList,G2opcodes
    497497   
    498 def MT2text(Opr):
     498def MT2text(Opr,reverse=False):
    499499    "From space group matrix/translation operator returns text version"
    500500    XYZ = ('-Z','-Y','-X','X-Y','ERR','Y-X','X','Y','Z')
     
    507507        if IK:
    508508            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)
    510513            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)
    512518        else:
    513519            Fld += XYZ[IJ].rjust(5)
     
    10441050    return ' '.join(magSym)
    10451051   
    1046 def MagText2MTS(mcifOpr):
     1052def MagText2MTS(mcifOpr,CIF=True):
    10471053    "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],}
    10501056    ops = mcifOpr.split(",")
    10511057    M = []
     
    10541060        ip = len(op)
    10551061        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:],'']
    10591069        else:
     1070            opMT = [op,'']
    10601071            T.append(0.)
    1061         M.append(XYZ[op[:ip]])
     1072        M.append(XYZ[opMT[0].lower()])
    10621073    spnflp = 1
    10631074    if '-1' in ops[3]:
     
    21852196        else:
    21862197            csi = CSxinel[indx[3]]  #Q
    2187         print(opr,SpnFlp[dupDir[opr]],indx,csi,CSI)
     2198#        print(opr,SpnFlp[dupDir[opr]],indx,csi,CSI)
    21882199        if not len(csi):
    21892200            return [[0,0,0],[0.,0.,0.]]
Note: See TracChangeset for help on using the changeset viewer.