Changeset 3719


Ignore:
Timestamp:
Nov 5, 2018 1:37:50 PM (5 years ago)
Author:
vondreele
Message:

patch for old k-SUBGROUPSMAG results
modifications to views of super groups & conjugancy lists to allow further exploration.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r3716 r3719  
    25272527        UCdata = list(G2frame.GPXtree.GetItemPyData(UnitCellsId))
    25282528        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]
    25302533        magKeep = []
    25312534        magIds = []
  • trunk/GSASIIpwdGUI.py

    r3716 r3719  
    8484
    8585class SubCellsDialog(wx.Dialog):
    86     def __init__(self,parent,title,items,phaseDict):
     86    def __init__(self,parent,title,controls,SGData,items,phaseDict):
    8787        wx.Dialog.__init__(self,parent,-1,title,
    8888            pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE)
    8989        self.panel = None
     90        self.controls = controls
     91        self.SGData = SGData         #for parent phase
    9092        self.items = items
    9193        self.phaseDict = phaseDict
     
    9496   
    9597    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       
    96160        if self.panel: self.panel.Destroy()
    97161        self.panel = wx.Panel(self)
    98162        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,]+ \
    101165            3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2']
    102166        table = []
     
    113177            trans = G2spc.Trans2Text(phase['Trans'])
    114178            vec = G2spc.Latt2text([phase['Uvec'],])
    115             row = [phase['Name'],phase['Use'],phase['Keep'],natms,nConj,nSup,trans,vec]+cell
     179            row = [phase['Name'],natms,nConj,nSup,trans,vec]+cell
    116180            table.append(row)
    117181        CellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
     
    119183        magDisplay = G2G.GSGrid(self.panel)
    120184        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)
    123186        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)
    130187        mainSizer.Add(magDisplay,0,WACV)
    131188       
     
    142199        self.Fit()
    143200
     201               
    144202    def OnOk(self,event):
    145203        parent = self.GetParent()
     
    511569                ).update(copy.deepcopy(copyDict))
    512570                         
     571def 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
     605def 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
    513626################################################################################
    514627#####  Powder Peaks
     
    34763589        controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(UnitCellsId)
    34773590        r,c =  event.GetRow(),event.GetCol()
     3591        rLab = magDisplay.GetRowLabelValue(r)
    34783592        br = baseList[r]
    34793593        phase = phaseDict[br]
     3594        pname = '(%s) %s'%(rLab,phase['Name'])
    34803595        if magcells:
    34813596            if c == 0:
     
    34833598                text,table = G2spc.SGPrint(mSGData,AddInv=True)
    34843599                if 'magAtms' in phase:
    3485                     msg = 'Magnetic space group information for '+phase['Name']
     3600                    msg = 'Magnetic space group information'
    34863601                    text[0] = ' Magnetic Space Group: '+mSGData['MagSpGrp']
    34873602                    text[3] = ' The magnetic lattice point group is '+mSGData['MagPtGp']
     
    35143629            elif c ==3:
    35153630                maxequiv = magcells[0].get('maxequiv',100)
    3516                 pname = '(%d) %s'%(br,phase['Name'])
    35173631                mSGData = phase['SGData']
    35183632                Uvec = phase['Uvec']
     
    35453659                if 'altList' not in phase: return
    35463660                if c == 4:
    3547                     title = 'Conjugacy list for '+phase['Name']
     3661                    title = 'Conjugacy list for '+pname
    35483662                    items = phase['altList']
    35493663                   
    35503664                elif c == 5:
    3551                     title = 'Super groups list list for '+phase['Name']
     3665                    title = 'Super groups list for '+pname
    35523666                    items = phase['supList']
    35533667                    if not items[0]:
    3554                         wx.MessageBox(phase['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)
    35553669                        return
    35563670                   
    3557                 SubCellsDialog(G2frame,title,items,phaseDict).ShowModal()
     3671                SubCellsDialog(G2frame,title,controls,SGData,items,phaseDict).ShowModal()
    35583672               
    35593673            data = [controls,bravais,cells,dminx,ssopt,magcells]
     
    37083822        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    37093823       
    3710     def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100,maximal=False):
    3711         found = False
    3712         anymom = False
    3713         phase['Keep'] = False
    3714         if not magAtms:
    3715             phase['Keep'] = True
    3716             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 = True
    3732                 if allmom:
    3733                     if not any(CSI[0]):
    3734                         phase['Keep'] = False
    3735                         found = True
    3736         uAtms = G2lat.GetUnique(Phase,atCodes)[0]
    3737         natm = len(uAtms)
    3738         if anymom and natm <= maxequiv and not found:
    3739             phase['Keep'] = True
    3740             if maximal and phase['supList'][0]:
    3741                 phase['Keep'] = False
    3742         return uAtms
    3743 
    3744     def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100,maximal=False):
    3745         phase['Keep'] = True
    3746         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 found
    3760             phase['Keep'] = False
    3761         if maximal and phase['supList'][0]:
    3762             phase['Keep'] = False
    3763         return uAtms
    3764 
    37653824    def OnRunSubs(event):
    37663825        import SUBGROUPS as kSUB
Note: See TracChangeset for help on using the changeset viewer.