Changeset 3716


Ignore:
Timestamp:
Nov 4, 2018 8:21:47 AM (5 years ago)
Author:
vondreele
Message:

implement new version of SUBGROUPS & k-SUBGROUPDMAG that return conjugacy & super group lists
display the results from these
remove lattice parameter constraints (for now at least) - occasionally fail with bad consequences

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIconstrGUI.py

    r3711 r3716  
    13791379           
    13801380        #how do I do Uij's for most Trans?
    1381     As = ['A0','A1','A2','A3','A4','A5']
    1382     Aids = [[0,0,'A0'],[1,1,'A1'],[2,2,'A2'],[0,1,'A3'],[0,2,'A4'],[1,2,'A5']]
    1383     DepConsDict = dict(zip(As,[[],[],[],[],[],[]]))
    1384     for iA,Aid in enumerate(Aids):
    1385         GT = np.zeros((3,3))
    1386         if abs(nAcof[iA]) > 1.e-8:
    1387             GT[Aid[0],Aid[1]] = 1
    1388             nGT = G2lat.prodMGMT(GT,Trans)
    1389             nAT = G2lat.Gmat2A(nGT)
    1390             for ia,nA in enumerate(nAT):
    1391                 if abs(nA) > 1.e-8 and abs(nAcof[ia]) > 1.e-8:
    1392                     parm = SetUniqAj(npId,As[ia],nSGData['SGLaue'])
    1393                     DepConsDict[Aid[2]].append([nA,G2obj.G2VarObj(parm)])
     1381#unfortunately, this doesn't always work!
     1382#    As = ['A0','A1','A2','A3','A4','A5']
     1383#    Aids = [[0,0,'A0'],[1,1,'A1'],[2,2,'A2'],[0,1,'A3'],[0,2,'A4'],[1,2,'A5']]
     1384#    DepConsDict = dict(zip(As,[[],[],[],[],[],[]]))
     1385#    for iA,Aid in enumerate(Aids):
     1386#        GT = np.zeros((3,3))
     1387#        if abs(nAcof[iA]) > 1.e-8:
     1388#            GT[Aid[0],Aid[1]] = 1.
     1389#            nGT = G2lat.prodMGMT(GT,Trans)
     1390#            nAT = G2lat.Gmat2A(nGT)
     1391#            for ia,nA in enumerate(nAT):
     1392#                if abs(nA) > 1.e-8 and abs(nAcof[ia]) > 1.e-8:
     1393#                    parm = SetUniqAj(npId,As[ia],nSGData['SGLaue'])
     1394#                    DepConsDict[Aid[2]].append([nA,G2obj.G2VarObj(parm)])
    13941395    conStrings = []
    13951396    for iA,Asi in enumerate(As):
  • trunk/GSASIIlattice.py

    r3686 r3716  
    468468        if result[1]:
    469469            BNSlatt += '_'+result[1]
     470            if 'P_S' in BNSlatt: BNSlatt = 'P_c'    #triclinic fix
    470471            phase['SGData']['BNSlattsym'] = [BNSlatt,BNSsym[BNSlatt]]
    471472            G2spc.ApplyBNSlatt(phase['SGData'],phase['SGData']['BNSlattsym'])
  • trunk/GSASIIphsGUI.py

    r3714 r3716  
    25272527        UCdata = list(G2frame.GPXtree.GetItemPyData(UnitCellsId))
    25282528        magData = UCdata[5]
     2529        baseList = UCdata[0][16]
    25292530        magKeep = []
    25302531        magIds = []
    25312532        magchoices = []
    25322533        ifMag = False
    2533         for mid,magdata in enumerate(magData):
     2534        itemList = [phase.get('gid',ip+1) for ip,phase in enumerate(magData)]
     2535        phaseDict = dict(zip(itemList,magData))
     2536        for im,mid in enumerate(baseList):
     2537            magdata = phaseDict[mid]
    25342538            if magdata['Keep']:
    25352539                if 'magAtms' in magdata:
    25362540                    ifMag = True
    2537                 magdata['No.'] = mid+1
     2541                magdata['No.'] = im+1
    25382542                trans = G2spc.Trans2Text(magdata['Trans'])
    25392543                vec = G2spc.Latt2text([magdata['Uvec'],])
    25402544                magKeep.append(magdata)
    25412545                magIds.append(mid)
    2542                 magchoices.append('(%d) %s; (%s) + (%s)'%(mid+1,magdata['Name'],trans,vec))
     2546                magchoices.append('(%d) %s; (%s) + (%s)'%(im+1,magdata['Name'],trans,vec))
    25432547        if not len(magKeep):
    25442548            G2frame.ErrorDialog('Subgroup/magnetic phase selection error','No magnetic phases found; be sure to "Keep" some')
  • trunk/GSASIIpwdGUI.py

    r3712 r3716  
    8282###### class definitions
    8383################################################################################
     84
     85class SubCellsDialog(wx.Dialog):
     86    def __init__(self,parent,title,items,phaseDict):
     87        wx.Dialog.__init__(self,parent,-1,title,
     88            pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE)
     89        self.panel = None
     90        self.items = items
     91        self.phaseDict = phaseDict
     92       
     93        self.Draw()
     94   
     95    def Draw(self):
     96        if self.panel: self.panel.Destroy()
     97        self.panel = wx.Panel(self)
     98        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,]+ \
     101            3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2']
     102        table = []
     103        for ip in self.items:
     104            phase = self.phaseDict[ip]
     105            natms = phase.get('nAtoms',1)
     106            try:
     107                nConj = len(phase['altList'])
     108                nSup = len(phase['supList'])
     109            except KeyError:
     110                nConj = 0
     111                nSup = 0
     112            cell  = list(phase['Cell'])
     113            trans = G2spc.Trans2Text(phase['Trans'])
     114            vec = G2spc.Latt2text([phase['Uvec'],])
     115            row = [phase['Name'],phase['Use'],phase['Keep'],natms,nConj,nSup,trans,vec]+cell
     116            table.append(row)
     117        CellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
     118        mainSizer = wx.BoxSizer(wx.VERTICAL)
     119        magDisplay = G2G.GSGrid(self.panel)
     120        magDisplay.SetTable(CellsTable, True)
     121#        magDisplay.Bind(wg.EVT_GRID_CELL_LEFT_CLICK,RefreshMagCellsGrid)
     122#        magDisplay.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK,OnRefreshKeep)
     123        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        mainSizer.Add(magDisplay,0,WACV)
     131       
     132        OkBtn = wx.Button(self.panel,-1,"Ok")
     133        OkBtn.Bind(wx.EVT_BUTTON, self.OnOk)
     134        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
     135        btnSizer.Add((20,20),1)
     136        btnSizer.Add(OkBtn)
     137        btnSizer.Add((20,20),1)
     138       
     139        mainSizer.Add(btnSizer,0,wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
     140        self.panel.SetSizer(mainSizer)
     141        self.panel.Fit()
     142        self.Fit()
     143
     144    def OnOk(self,event):
     145        parent = self.GetParent()
     146        parent.Raise()
     147        self.Destroy()
     148#        self.EndModal(wx.ID_OK)
    84149
    85150class RDFDialog(wx.Dialog):
     
    34113476        controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(UnitCellsId)
    34123477        r,c =  event.GetRow(),event.GetCol()
     3478        br = baseList[r]
     3479        phase = phaseDict[br]
    34133480        if magcells:
    34143481            if c == 0:
    3415                 r = event.GetRow()
    3416                 phase = magcells[r]
    34173482                mSGData = phase['SGData']
    34183483                text,table = G2spc.SGPrint(mSGData,AddInv=True)
     
    34303495                for i in range(len(magcells)):
    34313496                    magcells[i]['Use'] = False
     3497                for i in range(len(baseList)):
    34323498                    MagCellsTable.SetValue(i,c,False)
    34333499                MagCellsTable.SetValue(r,c,True)
    34343500                magDisplay.ForceRefresh()
    3435                 magcells[r]['Use'] = True
    3436                 mSGData = magcells[r]['SGData']
    3437                 A = G2lat.cell2A(magcells[r]['Cell'][:6]) 
     3501                phase['Use'] = True
     3502                mSGData = phase['SGData']
     3503                A = G2lat.cell2A(phase['Cell'][:6]) 
    34383504                G2frame.HKL = G2pwd.getHKLpeak(1.0,mSGData,A,Inst)
    34393505                G2plt.PlotPatterns(G2frame,extraKeys=KeyList)
     
    34413507                if MagCellsTable.GetValue(r,c):
    34423508                    MagCellsTable.SetValue(r,c,False)
    3443                     magcells[r]['Keep'] = False
     3509                    phase['Keep'] = False
    34443510                else:
    3445                     magcells[r]['Keep'] = True
     3511                    phase['Keep'] = True
    34463512                    MagCellsTable.SetValue(r,c,True)
    34473513                magDisplay.ForceRefresh()
    34483514            elif c ==3:
    3449                 r = event.GetRow()
    34503515                maxequiv = magcells[0].get('maxequiv',100)
    3451                 phase = magcells[r]
    3452                 mSGData = magcells[r]['SGData']
     3516                pname = '(%d) %s'%(br,phase['Name'])
     3517                mSGData = phase['SGData']
    34533518                Uvec = phase['Uvec']
    34543519                Trans = phase['Trans']
    34553520                ifMag = False
    3456                 if 'magAtms' in magcells[r]:
     3521                if 'magAtms' in phase:
    34573522                    ifMag = True
    3458                     allmom = magcells[r].get('allmom',False)
    3459                     magAtms = magcells[r].get('magAtms','')
     3523                    allmom = phase.get('allmom',False)
     3524                    magAtms = phase.get('magAtms','')
    34603525                    mAtoms = TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv)
    34613526                else:
     
    34693534                    Atms.append(atom[:2]+['',]+atom[2:5])
    34703535                    AtCods.append('1')
    3471                     if 'magAtms' in magcells[r]:
     3536                    if 'magAtms' in phase:
    34723537                        MagSytSym = G2spc.MagSytSym(SytSym,dupDir,mSGData)
    34733538                        CSI = G2spc.GetCSpqinel(mSGData['SpnFlp'],dupDir)
     
    34763541                        CSI = G2spc.GetCSxinel(SytSym)
    34773542                        atMxyz.append([SytSym,CSI[0]])
    3478                 G2phsG.UseMagAtomDialog(G2frame,magcells[r]['Name'],Atms,AtCods,atMxyz,ifMag=ifMag,ifOK=True).ShowModal()
     3543                G2phsG.UseMagAtomDialog(G2frame,pname,Atms,AtCods,atMxyz,ifMag=ifMag,ifOK=True).ShowModal()
     3544            elif c in [4,5]:
     3545                if 'altList' not in phase: return
     3546                if c == 4:
     3547                    title = 'Conjugacy list for '+phase['Name']
     3548                    items = phase['altList']
     3549                   
     3550                elif c == 5:
     3551                    title = 'Super groups list list for '+phase['Name']
     3552                    items = phase['supList']
     3553                    if not items[0]:
     3554                        wx.MessageBox(phase['Name']+' is a maximal subgroup',caption='Super group is parent',style=wx.ICON_INFORMATION)
     3555                        return
     3556                   
     3557                SubCellsDialog(G2frame,title,items,phaseDict).ShowModal()
     3558               
    34793559            data = [controls,bravais,cells,dminx,ssopt,magcells]
    34803560            G2frame.GPXtree.SetItemPyData(UnitCellsId,data)
     
    34863566        if c == 2:
    34873567            testAtoms = ['',]+list(set([atom[1] for atom in controls[15]]))
    3488             allmom = magcells[0].get('allmom',False)
    3489             magAtms = magcells[0].get('magAtms','')
    3490             maxequiv = magcells[0].get('maxequiv',100)
    3491             dlg = G2G.MultiDataDialog(G2frame,title='Keep options',
    3492                 prompts=['max unique','test for mag. atoms','all have moment',],
    3493                 values=[maxequiv,'',allmom],limits=[[1,100],testAtoms,[True,False]],
    3494                 formats=['%d','choice','bool'])
     3568            ifMag = False
     3569            maxequiv = magcells[0]['maxequiv']
     3570            maximal = False
     3571            if 'magAtms' in magcells[0]:
     3572                ifMag = True
     3573                allmom = magcells[0]['allmom']
     3574                magAtms = magcells[0]['magAtms']
     3575                dlg = G2G.MultiDataDialog(G2frame,title='Keep options',
     3576                    prompts=['max unique','test for mag. atoms','all have moment','only maximal subgroups',],
     3577                    values=[maxequiv,'',allmom,False],limits=[[1,100],testAtoms,[True,False],[True,False]],
     3578                    formats=['%d','choice','bool','bool'])
     3579            else:
     3580                dlg = G2G.MultiDataDialog(G2frame,title='Keep options',
     3581                    prompts=['max unique','only maximal subgroups',],
     3582                    values=[maxequiv,False],limits=[[1,100],[True,False],],
     3583                    formats=['%d','bool',])
    34953584            if dlg.ShowModal() == wx.ID_OK:
    3496                 maxequiv,atype,allmom = dlg.GetValues()
    3497                 magAtms = [atom for atom in controls[15] if atom[1] == atype]
    3498             for phase in magcells:
     3585                if ifMag:
     3586                    maxequiv,atype,allmom,maximal = dlg.GetValues()
     3587                    magAtms = [atom for atom in controls[15] if atom[1] == atype]
     3588                else:
     3589                    maxequiv,maximal = dlg.GetValues()
     3590            dlg = wx.ProgressDialog('Setting Keep flags','Processing '+magcells[0]['Name'],len(magcells),
     3591                style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME)
     3592            for ip,phase in enumerate(magcells):
     3593                dlg.Update(ip,newmsg='Processing '+phase['Name'])
    34993594                Uvec = phase['Uvec']
    35003595                Trans = phase['Trans']
    3501                 phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv))
     3596                if ifMag:
     3597                    phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv,maximal))
     3598                else:
     3599                    phase['nAtoms'] = len(TestAtoms(phase,controls[15],SGData,Uvec,Trans,maxequiv,maximal))
     3600            dlg.Destroy()
    35023601            data = controls,bravais,cells,dminx,ssopt,magcells
    35033602            G2frame.GPXtree.SetItemPyData(UnitCellsId,data)
     
    36093708        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    36103709       
    3611     def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100):
     3710    def TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv=100,maximal=False):
    36123711        found = False
     3712        anymom = False
    36133713        phase['Keep'] = False
    36143714        if not magAtms:
     
    36293729                CSI = G2spc.GetCSpqinel(phase['SGData']['SpnFlp'],dupDir)
    36303730                if any(CSI[0]):     
    3631                     phase['Keep'] = True
     3731                    anymom = True
    36323732                if allmom:
    36333733                    if not any(CSI[0]):
     
    36363736        uAtms = G2lat.GetUnique(Phase,atCodes)[0]
    36373737        natm = len(uAtms)
    3638         if natm > maxequiv or found: #too many allowed atoms found
    3639             phase['Keep'] = False
     3738        if anymom and natm <= maxequiv and not found:
     3739            phase['Keep'] = True
     3740            if maximal and phase['supList'][0]:
     3741                phase['Keep'] = False
    36403742        return uAtms
    36413743
    3642     def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100):
    3643         phase['Keep'] = False
    3644         if not magAtms:
    3645             phase['Keep'] = True
    3646             return []
     3744    def TestAtoms(phase,magAtms,SGData,Uvec,Trans,maxequiv=100,maximal=False):
     3745        phase['Keep'] = True
    36473746        invTrans = nl.inv(Trans)
    36483747        atCodes = []
     
    36603759        if natm > maxequiv: #too many allowed atoms found
    36613760            phase['Keep'] = False
     3761        if maximal and phase['supList'][0]:
     3762            phase['Keep'] = False
    36623763        return uAtms
    36633764
    36643765    def OnRunSubs(event):
    3665         import kSUBGROUPSMAG as kMAG
     3766        import SUBGROUPS as kSUB
    36663767        G2frame.dataWindow.RunSubGroupsMag.Enable(False)
    36673768        pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
     
    37123813      doi: 10.1146/annurev-matsci-070214-021008''',caption='Bilbao SUBGROUPS',style=wx.ICON_INFORMATION)
    37133814           
    3714             SUBGROUPS = kMAG.GetNonStdSubgroups(SGData,kvec[:9],star,Landau,maximal)
     3815            SUBGROUPS,baseList = kSUB.GetNonStdSubgroups(SGData,kvec[:9],star,Landau)
     3816#            SUBGROUPS,baseList = kMAG.GetNonStdSubgroups(SGData,kvec[:9],star,Landau,maximal)
    37153817            wx.EndBusyCursor()
    37163818            if SUBGROUPS is None:
     
    37263828                return
    37273829            controls[14] = kvec[:9]
     3830            controls[16] = baseList
    37283831            dlg = wx.ProgressDialog('SUBGROUPS results','Processing '+SUBGROUPS[0][0],len(SUBGROUPS),
    37293832                style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME)
    3730            
    37313833            for ir,result in enumerate(SUBGROUPS):
    37323834                dlg.Update(ir,newmsg='Processing '+result[0])
    3733                 numbs = [eval(item+'.') for item in result[1].split()]
    3734                 Uvec = np.array(numbs[3::4])
    3735                 Trans = np.array([numbs[:3],numbs[4:7],numbs[8:11]]).T         #Bilbao gives transpose
     3835                Trans = np.array(eval(result[1][0]))
     3836                Uvec = np.array(eval(result[1][1]))
    37363837                phase = G2lat.makeBilbaoPhase(result,Uvec,Trans)
     3838                phase['gid'] = result[2]
     3839                phase['altList'] = result[3]
     3840                phase['supList'] = eval(result[4])
    37373841                RVT = None
    37383842                if keepaxes:
     
    37403844                if RVT is not None:
    37413845                    result,Uvec,Trans = RVT
    3742                 phase = G2lat.makeBilbaoPhase(result,Uvec,Trans)
     3846                phase.update(G2lat.makeBilbaoPhase(result,Uvec,Trans))
    37433847                phase['Cell'] = G2lat.TransformCell(controls[6:12],Trans)   
    37443848                phase['maxequiv'] = maxequiv
    3745                 phase['nAtoms'] = len(TestAtoms(phase,controls[15],SGData,Uvec,Trans,maxequiv))
     3849                phase['nAtoms'] = len(TestAtoms(phase,controls[15],SGData,Uvec,Trans,maxequiv,maximal))
    37463850                magcells.append(phase)
    37473851            dlg.Destroy()
     
    37573861       
    37583862    def OnRunSubsMag(event):
    3759         import kSUBGROUPSMAG as kMAG
     3863        import SUBGROUPS as kSUB
    37603864        G2frame.dataWindow.RunSubGroups.Enable(False)
    37613865        pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
     
    38113915      doi: 10.1146/annurev-matsci-070214-021008''',caption='Bilbao k-SUBGROUPSMAG',style=wx.ICON_INFORMATION)
    38123916           
    3813             MAXMAGN = kMAG.GetNonStdSubgroupsmag(SGData,kvec[:9],star,Landau,maximal)
     3917            MAXMAGN,baseList = kSUB.GetNonStdSubgroupsmag(SGData,kvec[:9],star,Landau)
    38143918            wx.EndBusyCursor()
    38153919            if MAXMAGN is None:
     
    38253929                return
    38263930            controls[14] = kvec[:9]
     3931            controls[16] = baseList
    38273932            dlg = wx.ProgressDialog('k-SUBGROUPSMAG results','Processing '+MAXMAGN[0][0],len(MAXMAGN),
    38283933                style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_REMAINING_TIME)
    38293934           
    38303935            for ir,result in enumerate(MAXMAGN):
     3936                # result is SPGP,BNS,MV,itemList,altList,superList
    38313937                dlg.Update(ir,newmsg='Processing '+result[0])
    3832                 if result[0].strip().endswith("1'"):    #skip gray groups
    3833                     continue
    3834                 numbs = [eval(item+'.') for item in result[2].split()]
    3835                 Uvec = np.array(numbs[3::4])
    3836                 Trans = np.array([numbs[:3],numbs[4:7],numbs[8:11]]).T         #Bilbao gives transpose
     3938                Trans = np.array(eval(result[2][0]))
     3939                Uvec = np.array(eval(result[2][1]))
    38373940                phase = G2lat.makeBilbaoPhase(result[:2],Uvec,Trans,True)
     3941                phase['gid'] = result[3]
     3942                phase['altList'] = result[4]
     3943                phase['supList'] = eval(result[5])
    38383944                RVT = None
    38393945                if keepaxes:
     
    38413947                if RVT is not None:
    38423948                    result,Uvec,Trans = RVT
    3843                 phase = G2lat.makeBilbaoPhase(result,Uvec,Trans,True)
     3949                phase.update(G2lat.makeBilbaoPhase(result,Uvec,Trans,True))
    38443950                phase['Cell'] = G2lat.TransformCell(controls[6:12],Trans)   
    38453951                phase['aType'] = atype
     
    38473953                phase['magAtms'] = magAtms
    38483954                phase['maxequiv'] = maxequiv
    3849                 phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv))
     3955                phase['nAtoms'] = len(TestMagAtoms(phase,magAtms,SGData,Uvec,Trans,allmom,maxequiv,maximal))
    38503956                magcells.append(phase)
    38513957            dlg.Destroy()
     
    38793985    if len(controls) < 14:              #add space group if missing
    38803986        controls.append(spaceGroups[bravaisSymb.index(controls[5])])
     3987    if len(controls) < 17:
     3988        controls.append(range(1,len(magcells)+1))
    38813989    if len(bravais) < 16:
    38823990        bravais += [0,0,]
     
    41384246                    gridDisplay.SetReadOnly(r,c,isReadOnly=True)
    41394247        mainSizer.Add(gridDisplay,0,WACV)
    4140     if magcells:       
     4248    if magcells:
     4249        itemList = [phase.get('gid',ip+1) for ip,phase in enumerate(magcells)]
     4250        phaseDict = dict(zip(itemList,magcells))
    41414251        G2frame.dataWindow.CopyCell.Enable(False)
    41424252        kvec1 = ','.join(controls[14][:3])
    41434253        kvec2 = ','.join(controls[14][3:6])
    41444254        kvec3 = ','.join(controls[14][6:])
     4255        baseList = controls[16]
    41454256        if 'magAtms' in magcells[0]:
    41464257            G2frame.dataWindow.RunSubGroupsMag.Enable(True)
     
    41554266        Label += ':'
    41564267        mainSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=Label),0,WACV)
    4157         rowLabels = []
    4158         for i in range(len(magcells)): rowLabels.append(str(i+1))
    4159         colLabels = ['Space Gp','Try','Keep','Uniq','Trans','Vec','a','b','c','alpha','beta','gamma','Volume']
    4160         Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_LONG,wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+ \
     4268        rowLabels = [str(i+1) for i in range(len(baseList))]
     4269        colLabels = ['Space Gp','Try','Keep','Uniq','nConj','nSup','Trans','Vec','a','b','c','alpha','beta','gamma','Volume']
     4270        Types = [wg.GRID_VALUE_STRING,]+2*[wg.GRID_VALUE_BOOL,]+3*[wg.GRID_VALUE_LONG,]+2*[wg.GRID_VALUE_STRING,]+ \
    41614271            3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2']
    41624272        table = []
    4163         for phase in magcells:
     4273        for ip in baseList:
     4274            phase = phaseDict[ip]
    41644275            natms = phase.get('nAtoms',1)
     4276            try:
     4277                nConj = len(phase['altList'])
     4278                nSup = len(phase['supList'])
     4279            except KeyError:
     4280                nConj = 0
     4281                nSup = 0
    41654282            cell  = list(phase['Cell'])
    41664283            trans = G2spc.Trans2Text(phase['Trans'])
    41674284            vec = G2spc.Latt2text([phase['Uvec'],])
    4168             row = [phase['Name'],phase['Use'],phase['Keep'],natms,trans,vec]+cell
     4285            row = [phase['Name'],phase['Use'],phase['Keep'],natms,nConj,nSup,trans,vec]+cell
    41694286            table.append(row)
    41704287        MagCellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
  • trunk/GSASIIspc.py

    r3710 r3716  
    17021702            '31m':['(00g)','(1/31/3g)'],
    17031703            '6/m':['(00g)',],
    1704             '6/mmm':['(00g)',]}
     1704            '6/mmm':['(00g)',],
     1705            'm3':['',],'m3m':['',]}
    17051706           
    17061707    laueTS = {'-1':['',],
     
    17131714            '31m':['','t00','0ss'],
    17141715            '6/m':['','h','t','s','s0'],
    1715             '6/mmm':['','h00','t00','s00','ss0','0ss','s0s','s0s0','00ss','s00s','ss00','0ss0','0s0s']}
     1716            '6/mmm':['','h00','t00','s00','ss0','0ss','s0s','s0s0','00ss','s00s','ss00','0ss0','0s0s'],
     1717            'm3':['',],'m3m':['',]}
    17161718    laue = SGData['SGLaue']
    17171719    SSChoice = []
     
    28392841        dM = posFourier(tau,nH,delt6[:3],delt6[3:]) #+np.array(Mxyz)[:,nxs,nxs]
    28402842        dMTP = []
    2841         CSI = [[1,0,0],[2,0,0],[3,0,0], [4,0,0],[5,0,0],[6,0,0]],6*[[1.,0.,0.],]
     2843        CSI = [np.zeros((6,3),dtype='i'),np.zeros((6,3))]
     2844        print(siteSym)
    28422845        if siteSym == '1':
    28432846            CSI = [[1,0,0],[2,0,0],[3,0,0],[4,0,0],[5,0,0],[6,0,0]],6*[[1.,0.,0.],]
    2844         elif siteSym in ['-1',]:
     2847        elif siteSym in ['-1','mmm',]:
    28452848            CSI = 3*[[0,0,0],]+[[1,0,0],[2,0,0],[3,0,0]],3*[[0.,0.,0.],]+3*[[1.,0.,0.],]
     2849        elif siteSym in ['4(z)','422(z)']:
     2850            CSI[0][0][0] = CSI[0][4][1] = 1
     2851            CSI[1][0][0] = 1.0
     2852            CSI[1][4][1] = -1.0
     2853        elif siteSym in ['-4m2(z)','422(z)',]:
     2854            CSI[0][5][0] = 1
     2855            CSI[1][5][0] = 1.0
     2856        elif siteSym in ['-32(100)',]:
     2857            CSI[0][2][0] = 1
     2858            CSI[1][2][0] = 1.0
     2859        elif siteSym in ['3',]:
     2860            CSI[0][0][0] = CSI[0][3][0] = CSI[0][4][0] = 1
     2861            CSI[1][0][0] = -np.sqrt(3.0)
     2862            CSI[1][3][0] = 2.0
     2863            CSI[1][4][0] = 1.0
     2864        elif siteSym in ['622','2(100)',]:
     2865            CSI[0][0][0] = CSI[0][1][0] = CSI[0][3][0] = 1
     2866            CSI[1][0][0] = 1.0
     2867            CSI[1][1][0] = 2.0
     2868            CSI[1][3][0] = np.sqrt(3.0)
    28462869        else:
    28472870              #3x6x12 modulated moment array (M,Spos,tau)& force positive
     
    28602883                dMTP.append(dMT)
    28612884                for i in range(3):
    2862                     if not np.allclose(dM[i,i,:],-dMT[i,i,:]):
     2885                    if 'm(' in siteSym and not np.allclose(dM[i,i,:],-dMT[i,i,:]):
    28632886                        msc[i] = 0
    2864                     if not np.allclose(dM[i,i+3,:],-dMT[i,i+3,:]):
     2887                    elif '2(' in siteSym and not np.allclose(dM[i,i,:],dMT[i,i,:]):
     2888                        msc[i] = 0
     2889                    if 'm(' in siteSym and not np.allclose(dM[i,i+3,:],-dMT[i,i+3,:]):
     2890                        msc[i+3] = 0
     2891                    elif '2(' in siteSym and not np.allclose(dM[i,i+3,:],dMT[i,i+3,:]):
    28652892                        msc[i+3] = 0
    28662893                if np.any(dtau%.5) and ('1/2' in SSGData['modSymb'] or '1' in SSGData['modSymb']):
     
    28842911                        CSI[1][3:] = [0.,0.,0.],[0.,0.,0.],[0.,0.,0.]
    28852912                if '4/mmm' in laue:
     2913                    if siteSym in ['4/mmm(z)',]:
     2914                        CSI = 3*[[0,0,0],]+[[0,0,0],[0,0,0],[1,0,0]],3*[[0.,0.,0.],]+3*[[1.,0.,0.],]
    28862915                    if np.any(dtau%.5) and '1/2' in SSGData['modSymb']:
    28872916                        if '(xy)' in siteSym:
  • trunk/kSUBGROUPSMAG.py

    r3686 r3716  
    8282        elif tag == 'pre':
    8383            self.in_pre = False
    84             self.MVs.append(self.MV.replace('\n',' '))
    85 #            print('MV:')
    86 #            print(self.MV)
     84            MV = self.MV.split()
     85            MV = ['[[%s,%s,%s],[%s,%s,%s],[%s,%s,%s]]'%(MV[0],MV[4],MV[8],MV[1],MV[5],MV[9],MV[2],MV[6],MV[10]),'[%s.,%s.,%s.]'%(MV[3],MV[7],MV[11])]
     86            self.MVs.append(MV)
     87#            print('MV:',self.MV)
    8788        elif tag == 'sub':
    8889            self.in_sub = False
     
    144145        page = ''
    145146        print('connection error - not on internet')
    146         return None
     147        return None,None
    147148    if r.status_code == 200:
    148149        print('request OK')
     
    152153        page = ''
    153154        print('request failed. Reason=',r.reason)
    154         return None
     155        return None,None
    155156    r.close()
    156157
    157158    p = TableParser()
    158159    p.feed(page)
    159     result = list(zip(p.SPGPs,p.BNSs,p.MVs))
    160     return result
     160    nItms = len(p.MVs)
     161    result = list(zip(p.SPGPs,p.BNSs,p.MVs,range(nItms),nItms*[[],],nItms*['[]',]))
     162    return result,range(nItms)
    161163
    162164def GetNonStdSubgroups(SGData, kvec,star=False,landau=False,maximal=False):
     
    229231    p = TableParser()
    230232    p.feed(page)
    231     result = list(zip(p.SPGPs,p.MVs))
    232     return result
     233    nItms = len(p.MVs)
     234    result = list(zip(p.SPGPs,p.MVs,range(nItms),range(nItms),nItms*[0,]))
     235    return result,range(nItms)
    233236
    234237def test():
    235238    SGData = G2spc.SpcGroup('p -3 m 1')[1]
    236     results = GetNonStdSubgroupsmag(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' '))
     239    results,baseList = GetNonStdSubgroupsmag(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' '))
    237240    if results:
    238         for spgp,bns,mv in results:
    239             print('Space group:',spgp, 'BNS:',bns)
    240             print('MV')
    241             print(mv)
    242     results = GetNonStdSubgroups(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' '))
     241        for [spgp,mv,bns,gid,altList,supList] in results:
     242            if gid in baseList:
     243                print('Space group:',spgp, 'BNS:',bns)
     244                print('MV')
     245                print(mv)
     246    results,baseList = GetNonStdSubgroups(SGData,('1/3','1/3','1/2',' ',' ',' ',' ',' ',' ',' '))
    243247    if results:
    244         for spgp,mv in results:
    245             print('Space group:',spgp)
    246             print('MV')
    247             print(mv)
     248        for [spgp,mv,gid,altList,supList] in results:
     249            if gid in baseList:
     250                print('Space group:',spgp)
     251                print('MV')
     252                print(mv)
    248253       
    249254
Note: See TracChangeset for help on using the changeset viewer.