Changeset 3638


Ignore:
Timestamp:
Oct 3, 2018 11:17:31 AM (3 years ago)
Author:
vondreele
Message:

implement a count of unique magnetic atoms for each result from k-SUBGROUPSMAG, display it & add filter on how many are allowed
Modify RefreshKeep? to allow change of filters for magnetic space groups
change map Zstep size limit to 4A from 1A

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r3636 r3638  
    485485        return True
    486486
    487     cx,ct,cs,cia = Phase['General']['AtomPtrs']
     487    cx,ct = Phase['General']['AtomPtrs'][:2]
    488488    SGData = Phase['General']['SGData']
    489489    Atoms = Phase['Atoms']
  • trunk/GSASIIphsGUI.py

    r3636 r3638  
    60276027            ZstepSizer = wx.BoxSizer(wx.HORIZONTAL)
    60286028            ZstepSizer.Add(wx.StaticText(drawOptions,-1,' Z step:'),0,WACV)
    6029             Zstep = G2G.ValidatedTxtCtrl(drawOptions,drawingData,'Zstep',nDig=(10,2),min=0.01,max=1.0)
     6029            Zstep = G2G.ValidatedTxtCtrl(drawOptions,drawingData,'Zstep',nDig=(10,2),min=0.01,max=4.0)
    60306030            ZstepSizer.Add(Zstep,0,WACV)
    60316031            slideSizer.Add(ZstepSizer)
  • trunk/GSASIIpwdGUI.py

    r3633 r3638  
    33993399        E,SGData = G2spc.SpcGroup(controls[13])
    34003400        if c == 2:
     3401            testAtoms = ['',]+list(set([atom[1] for atom in controls[15]]))
     3402            allmom = magcells[0].get('allmom',False)
     3403            magAtms = magcells[0].get('magAtms','')
     3404            maxequiv = magcells[0].get('maxequiv',1000)
     3405            dlg = G2G.MultiDataDialog(G2frame,title='Keep options',
     3406                prompts=['test for mag. atoms','all have moment','max unique'],
     3407                values=['',allmom,maxequiv],limits=[testAtoms,[True,False],[1,100]],
     3408                formats=['choice','bool','%d',])
     3409            if dlg.ShowModal() == wx.ID_OK:
     3410                atype,allmom,maxequiv = dlg.GetValues()
     3411                magAtms = [atom for atom in controls[15] if atom[1] == atype]
    34013412            for phase in magcells:
    34023413                Uvec = phase['Uvec']
    34033414                Trans = phase['Trans']
    3404                 allmom = phase['allmom']
    34053415                invTrans = nl.inv(Trans)
    3406                 magAtms = phase['magAtms']
    3407                 TestMagAtoms(phase,magAtms,SGData,Uvec,invTrans,allmom)
     3416                phase['nAtoms'] = TestMagAtoms(phase,magAtms,SGData,Uvec,invTrans,allmom,maxequiv)
    34083417            data = controls,bravais,cells,dminx,ssopt,magcells
    34093418            G2frame.GPXtree.SetItemPyData(UnitCellsId,data)
     
    35263535        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
    35273536       
    3528     def TestMagAtoms(phase,magAtms,SGData,Uvec,invTrans,allmom):
     3537    def TestMagAtoms(phase,magAtms,SGData,Uvec,invTrans,allmom,maxequiv=1000):
    35293538        found = False
     3539        phase['Keep'] = False
    35303540        if not magAtms:
    35313541            phase['Keep'] = True
    35323542            return
     3543        Phase = {'General':{'AtomPtrs':[2,1],'SGData':copy.deepcopy(phase['SGData'])},'Atoms':[]}
    35333544        for matm in magAtms:
    35343545            xyzs = G2spc.GenAtom(matm[3:6],SGData,False,Move=True)
    3535             for x in xyzs:
     3546            for ix,x in enumerate(xyzs):
    35363547                xyz = G2lat.TransformXYZ(x[0]-Uvec,invTrans.T,np.zeros(3))%1.
     3548                Phase['Atoms'].append(matm[:2]+list(xyz))
    35373549                SytSym,Mul,Nop,dupDir = G2spc.SytSym(xyz,phase['SGData'])
    35383550                CSI = G2spc.GetCSpqinel(phase['SGData']['SpnFlp'],dupDir)
    3539                 if any(CSI[0]):     #found one - can quit looking
     3551                if any(CSI[0]):     
    35403552                    phase['Keep'] = True
    35413553                if allmom:
    3542                     if not any(CSI[0]):
     3554                    if not any(CSI[0]):         #found one - can quit looking
    35433555                        phase['Keep'] = False
    35443556                        found = True
    3545                         break
    3546             if found:   #found one
    3547                 break
     3557        atCodes = len(Phase['Atoms'])*['1',]
     3558        natm = len(G2lat.GetUnique(Phase,atCodes)[0])
     3559        if natm > maxequiv or found: #too many allowed atoms found
     3560            phase['Keep'] = False
     3561        return natm
    35483562       
    35493563    def OnRunSubsMag(event):
     
    35573571        Kz = [' ','0','1/2','3/2','1/3','2/3','1']
    35583572        dlg = G2G.MultiDataDialog(G2frame,title='k-SUBGROUPSMAG options',
    3559             prompts=[' kx1 as fr.',' ky1 as fr.',' kz1 as fr.',' kx2 as fr.',' ky2 as fr.',' kz2 as fr.',\
    3560                      ' Use whole star',' Landau transition',' Give intermediate cells','preserve axes','test for mag. atoms','all have moment'],
    3561             values=kvec+[False,False,False,True,'',False],
    3562             limits=[Kx[1:],Ky[1:],Kz[1:],Kx,Ky,Kz,[True,False],[True,False],[True,False],[True,False],testAtoms,[True,False]],
    3563             formats=['choice','choice','choice','choice','choice','choice','bool','bool','bool','bool',
    3564                      'choice','bool'])
     3573            prompts=[' kx1 as fr.',' ky1 as fr.',' kz1 as fr.',' kx2 as fr.',' ky2 as fr.',' kz2 as fr.', \
     3574                     ' Use whole star',' Landau transition',' Give intermediate cells','preserve axes', \
     3575                     'test for mag. atoms','all have moment','max unique'],
     3576            values=kvec+[False,False,False,True,'',False,100],
     3577            limits=[Kx[1:],Ky[1:],Kz[1:],Kx,Ky,Kz,[True,False],[True,False],[True,False],
     3578                [True,False],testAtoms,[True,False],[1,100]],
     3579            formats=['choice','choice','choice','choice','choice','choice','bool','bool',
     3580                    'bool','bool','choice','bool','%d',])
    35653581        if dlg.ShowModal() == wx.ID_OK:
    35663582            magcells = []
     
    35733589            atype = newVals[10]
    35743590            allmom = newVals[11]
     3591            maxequiv = newVals[12]
    35753592            magAtms = [atom for atom in controls[15] if atom[1] == atype]
    35763593            wx.BeginBusyCursor()
     
    36103627                phase['allmom'] = allmom
    36113628                phase['magAtms'] = magAtms
    3612                 TestMagAtoms(phase,magAtms,SGData,Uvec,invTrans,allmom)
     3629                phase['maxequiv'] = maxequiv
     3630                phase['nAtoms'] = TestMagAtoms(phase,magAtms,SGData,Uvec,invTrans,allmom,maxequiv)
    36133631                magcells.append(phase)
    36143632            magcells[0]['Use'] = True
     
    39053923        rowLabels = []
    39063924        for i in range(len(magcells)): rowLabels.append(str(i+1))
    3907         colLabels = ['Space Gp.','Try','Keep','Trans','Vec','a','b','c','alpha','beta','gamma','Volume']
    3908         Types = [wg.GRID_VALUE_STRING,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING,wg.GRID_VALUE_STRING,]+ \
     3925        colLabels = ['Space Gp.','Try','Keep','Uniq','Trans','Vec','a','b','c','alpha','beta','gamma','Volume']
     3926        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,]+ \
    39093927            3*[wg.GRID_VALUE_FLOAT+':10,5',]+3*[wg.GRID_VALUE_FLOAT+':10,3',]+[wg.GRID_VALUE_FLOAT+':10,2']
    39103928        table = []
    39113929        for phase in magcells:
     3930            natms = phase.get('nAtoms',1)
    39123931            cell  = list(phase['Cell'])
    39133932            trans = G2spc.Trans2Text(phase['Trans'])
    39143933            vec = G2spc.Latt2text([phase['Uvec'],])
    3915             row = [phase['Name'],phase['Use'],phase['Keep'],trans,vec]+cell
     3934            row = [phase['Name'],phase['Use'],phase['Keep'],natms,trans,vec]+cell
    39163935            table.append(row)
    39173936        MagCellsTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
Note: See TracChangeset for help on using the changeset viewer.