Changeset 5482 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Jan 27, 2023 5:45:24 PM (2 years ago)
Author:
toby
Message:

implement NIST*LATTICE search for higher sym cells; change numbering of sequential Rietveld table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASIIpwdGUI.py

    r5473 r5482  
    43784378        wx.EndBusyCursor()
    43794379        if not page: return
    4380 #        while cells: cells.pop() # cells.clear() is much cleaner but not Py2
     4380        cells.clear()
    43814381        for i,(cell,mat) in enumerate(kSUB.parseBilbaoCheckLattice(page)):
    43824382            cells.append([])
    43834383            cells[-1] += [mat,0,16]
    43844384            cells[-1] += cell
    4385             cells[-1] += [G2lat.calc_V(G2lat.cell2A(cell)),False,False]           
     4385            cells[-1] += [G2lat.calc_V(G2lat.cell2A(cell)),False,False]
     4386        G2frame.GPXtree.SetItemPyData(pUCid,data)
     4387        G2frame.OnFileSave(event)
     4388        wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
     4389       
     4390    def OnNISTLatSym(event):
     4391        'Run NIST*LATTICE cell search'
     4392        pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
     4393        controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(pUCid)
     4394        nistInput=[0.2,1.,2,3]
     4395        msg = G2G.NISTlatUse(True)
     4396        dlg = wx.Dialog(G2frame,style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
     4397        sizer = wx.BoxSizer(wx.VERTICAL)
     4398        sizer.Add(wx.StaticText(dlg,label='NIST*LATTICE Cell Symmetry Search Settings'),
     4399                      0,wx.ALIGN_CENTER_HORIZONTAL,0)
     4400        sizer.Add((-1,15))
     4401        sizer.Add(wx.StaticText(dlg,label=msg))
     4402        sizer.Add((-1,15))
     4403        tableSizer = wx.FlexGridSizer(0,2,0,0)
     4404        tableSizer.Add(wx.StaticText(dlg,label='Cell length tolerance (A) '),
     4405            0,WACV|wx.ALIGN_LEFT)
     4406        w = G2G.ValidatedTxtCtrl(dlg,nistInput,0,nDig=(6,2))
     4407        tableSizer.Add(w)
     4408        tableSizer.Add(wx.StaticText(dlg,label='Cell angle tolerance (deg) '),
     4409            0,WACV|wx.ALIGN_LEFT)
     4410        w = G2G.ValidatedTxtCtrl(dlg,nistInput,1,nDig=(6,1))
     4411        tableSizer.Add(w)
     4412        tableSizer.Add(wx.StaticText(dlg,label='Cell volume range (ratio) '),
     4413            0,WACV|wx.ALIGN_LEFT)
     4414        w = G2G.ValidatedTxtCtrl(dlg,nistInput,2)
     4415        tableSizer.Add(w)
     4416        tableSizer.Add(wx.StaticText(dlg,label='Search mode: Generate '),
     4417            0,WACV|wx.ALIGN_LEFT)
     4418        tableSizer.Add(G2G.EnumSelector(dlg,nistInput,3,
     4419                    ['supercells', 'subcells', 'sub- and supercells'],
     4420                    [1,2,3]))
     4421        sizer.Add(tableSizer,1,wx.EXPAND)
     4422        btnsizer = wx.StdDialogButtonSizer()
     4423        btn = wx.Button(dlg, wx.ID_OK)
     4424        btn.SetDefault()
     4425        btn.Bind(wx.EVT_BUTTON, lambda x: dlg.EndModal(wx.ID_OK))
     4426        btnsizer.AddButton(btn)
     4427        btn = wx.Button(dlg, wx.ID_CANCEL)
     4428        btn.Bind(wx.EVT_BUTTON, lambda x: dlg.EndModal(wx.ID_CANCEL))
     4429        btnsizer.AddButton(btn)
     4430        btnsizer.Realize()
     4431        sizer.Add(btnsizer, 0, wx.EXPAND|wx.ALL, 5)
     4432        dlg.SetSizer(sizer)
     4433        sizer.Fit(dlg)
     4434        dlg.CenterOnParent()
     4435        if dlg.ShowModal() == wx.ID_OK:
     4436            dlg.Destroy()   
     4437        else:
     4438            dlg.Destroy()   
     4439            return
     4440        tol = 3*[nistInput[0]]+3*[nistInput[1]]
     4441        cell = controls[6:12]
     4442        center = controls[13].strip()[0]
     4443        delta = nistInput[2]
     4444        mode = nistInput[3]
     4445        wx.BeginBusyCursor()
     4446        import nistlat
     4447        out = nistlat.CellSymSearch(cell, center, tolerance=tol, mode=mode,
     4448                      deltaV=delta)
     4449        wx.EndBusyCursor()
     4450   
     4451        if not out: return
     4452        cells.clear()
     4453        for o in out:
     4454            cells.append([])
     4455            c = o[2][0]
     4456            # assign a Laue class
     4457            laue = 16 # P1
     4458            if c[0] == c[1] == c[2] and c[3] == c[4] == c[5] == 90:
     4459                if o[2][1] == 'F':
     4460                    laue = 0 # Fm3m
     4461                elif o[2][1] == 'I':
     4462                    laue = 1 # Im3m
     4463                else:
     4464                    laue = 2 # Pm3m
     4465            elif o[2][1] == 'R':
     4466                laue = 3 # R3
     4467            elif c[0] == c[1] and c[5] == 120:
     4468                laue = 4 # P6/mmm
     4469            elif c[0] == c[1] and c[3] == c[4] == c[5] == 90 and o[2][1] == 'I':
     4470                laue = 5 # I4/mmm
     4471            elif c[0] == c[1] and c[3] == c[4] == c[5] == 90 and o[2][1] == 'P':
     4472                laue = 6 # P4/mmm
     4473            elif c[3] == c[4] == c[5] == 90 and o[2][1] == 'F':
     4474                laue =  7 # 'Fmmm'
     4475            elif c[3] == c[4] == c[5] == 90 and o[2][1] == 'I':
     4476                laue =  8 # 'Immm'
     4477            elif c[3] == c[4] == c[5] == 90 and o[2][1] == 'A':
     4478                laue =  9 # 'Ammm'
     4479            elif c[3] == c[4] == c[5] == 90 and o[2][1] == 'B':
     4480                laue =  10 # 'Bmmm'
     4481            elif c[3] == c[4] == c[5] == 90 and o[2][1] == 'C':
     4482                laue =  11 # 'Cmmm'
     4483            elif c[3] == c[4] == c[5] == 90 and o[2][1] == 'P':
     4484                laue =  12 # 'Pmmm'
     4485            elif c[3] == c[5] == 90 and o[2][1] == 'C':
     4486                laue =  13 # 'C2/m'
     4487            elif c[3] == c[5] == 90 and o[2][1] == 'P':
     4488                laue =  14 # 'P2/m'
     4489            elif o[2][1] == 'C':
     4490                laue =  15 # 'C1'
     4491            cells[-1] += [o[4],0,laue]
     4492            cells[-1] += c
     4493            cells[-1] += [G2lat.calc_V(G2lat.cell2A(c)),False,False]
    43864494        G2frame.GPXtree.SetItemPyData(pUCid,data)
    43874495        G2frame.OnFileSave(event)
     
    44054513            formats=[['choice','choice','choice'],['choice','choice','choice'],['choice','choice','choice'],'bool','choice',
    44064514                    'bool','%d',])
     4515        dlg.CenterOnParent()
    44074516        if dlg.ShowModal() == wx.ID_OK:
    44084517            magcells = []
     
    46274736    G2frame.Bind(wx.EVT_MENU, OnRunSubsMag, id=G2G.wxID_RUNSUBMAG)
    46284737    G2frame.Bind(wx.EVT_MENU, OnLatSym, id=G2G.wxID_LATSYM)
     4738    G2frame.Bind(wx.EVT_MENU, OnNISTLatSym, id=G2G.wxID_NISTLATSYM)
    46294739    G2frame.Bind(wx.EVT_MENU, CopyUnitCell, id=G2G.wxID_COPYCELL)
    46304740    G2frame.Bind(wx.EVT_MENU, LoadUnitCell, id=G2G.wxID_LOADCELL)
Note: See TracChangeset for help on using the changeset viewer.