Changeset 5482


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

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

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r5480 r5482  
    89048904        colorButton.Bind(wcs.EVT_COLOURSELECT, OnColor)
    89058905    return colorButton
    8906    
     8906
     8907def NISTlatUse(msgonly=False):
     8908        msg = '''Performing cell symmetry search using NIST*LATTICE. Please cite:
     8909        V. L. Karen and A. D. Mighell, NIST Technical Note 1290 (1991),
     8910        https://nvlpubs.nist.gov/nistpubs/Legacy/TN/nbstechnicalnote1290.pdf 
     8911        and
     8912        V. L. Karen & A. D. Mighell, U.S. Patent 5,235,523,
     8913        https://patents.google.com/patent/US5235523A/en?oq=5235523'''
     8914        print(msg)
     8915        if msgonly: return msg
     8916        wx.MessageBox(msg,caption='Using NIST*LATTICE',style=wx.ICON_INFORMATION)
     8917
    89078918if __name__ == '__main__':
    89088919    app = wx.App()
  • trunk/GSASIIdataGUI.py

    r5479 r5482  
    65976597        self.IndexPeaks = self.IndexEdit.Append(G2G.wxID_INDEXPEAKS,'Index Cell',
    65986598            'Find cells that index fitted peaks')
    6599         self.IndexEdit.Append(G2G.wxID_LATSYM,'Cell Symmetry Search',
     6599        self.IndexEdit.Append(G2G.wxID_LATSYM,'Cell Symmetry Search-Bilbao',
    66006600            'Run Bilboa "Lattice Symmetry" to find higher symmetry cells')
     6601        G2G.Define_wxId('wxID_NISTLATSYM')
     6602        self.IndexEdit.Append(G2G.wxID_NISTLATSYM,'Cell Symmetry Search-NIST*LATTICE',
     6603            'Run NIST*LATTICE to find higher symmetry cells')
    66016604        self.RunSubGroups = self.IndexEdit.Append(G2G.wxID_RUNSUB,'Run SUBGROUPS',
    66026605            'If disabled, do Load Phase first')
  • trunk/GSASIIphsGUI.py

    r5478 r5482  
    343343        self.kvec = [0.,0.,0.]
    344344        self.Draw()
     345        self.CenterOnParent()
    345346
    346347    def Draw(self):
  • 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)
  • trunk/GSASIIseqGUI.py

    r5479 r5482  
    12151215    posdict = {}    # defines position for each entry in table; for inner
    12161216                    # dict key is column number & value is parameter name
     1217    histNumList = []
    12171218    for i,name in enumerate(histNames):
     1219        if name in Histograms:
     1220            histNumList.append(list(Histograms.keys()).index(name))
    12181221        # if prevVaryList != data[name]['varyList']: # this refinement has a different refinement list from previous
    12191222        #     prevVaryList = data[name]['varyList']
    1220             posdict[name] = {}
    1221             for var in data[name]['varyList']:
    1222                 svar = striphist(var,'*')
    1223                 if 'PWL' in svar:
    1224                     if int(svar.split(':')[-1]) > maxPWL:
    1225                         continue
    1226                 posdict[name][combinedVaryList.index(svar)] = svar
     1223        posdict[name] = {}
     1224        for var in data[name]['varyList']:
     1225            svar = striphist(var,'*')
     1226            if 'PWL' in svar:
     1227                if int(svar.split(':')[-1]) > maxPWL:
     1228                    continue
     1229            posdict[name][combinedVaryList.index(svar)] = svar
    12271230    ####--  build up the data table by columns -----------------------------------------------
    12281231    nRows = len(histNames)
    1229     G2frame.colList = [list(range(nRows))]
     1232    if len(histNumList) != nRows:
     1233        G2frame.colList = [list(range(nRows))]
     1234    else:
     1235        G2frame.colList = [histNumList]
    12301236    if len(data.get('Use',[])) != nRows:
    12311237        data['Use'] = nRows*[True]
     
    15651571    if histNames[0][:4] not in ['SASD','IMG ','REFD',] and deltaChiCol is not None:
    15661572        for row,name in enumerate(histNames):
     1573            if name not in Controls['Seq Data']:
     1574                G2frame.dataDisplay.SetCellTextColour(row,0,wx.Colour(255,0,0))
    15671575            deltaChi = G2frame.SeqTable.GetValue(row,deltaChiCol)
    15681576            try:
  • trunk/exports/G2export_CIF.py

    r5479 r5482  
    47344734            dlg.Destroy()
    47354735        if result != wx.ID_YES: return
    4736         # import imp
    4737         # print('reloading ',G2G)
    4738         # imp.reload(G2G)
    47394736        Trans = np.eye(3)
    47404737        if 'MagXform' not in self.Phases[MagPhase]:
     
    47464743                cell2 = self.Phases[ChemPhase]['General']['Cell'][1:7]
    47474744                cntr2 = self.Phases[ChemPhase]['General']['SGData']['SpGrp'].strip()[0]
     4745                G2G.NISTlatUse()
    47484746                out = nistlat.CompareCell(cell1, cntr1, cell2, cntr2)
    47494747        #, tolerance=3*[0.2]+3*[1], mode='I', vrange=8, output=None)
  • trunk/help/gsasII.html

    r5481 r5482  
    78897889body can be refined.</p>
    78907890
    7891 <h4><a name=Sequential></a><span style='mso-fareast-font-family:"Times New Roman"'>Sequential
    7892 refinement results</span></h4>
    7893 
    7894 <p class=MsoNormal>This tree entry is available after a sequential refinement
    7895 has been run. (See the <a href="#Controls">Controls tree item</a> to set the
    7896 histograms to be used in a sequential refinement and use the
    7897 Calculate/Sequential refine menu command to run the refinement.) A number of
    7898 other fitting processes within GSAS-II can be done sequentially, each will have
    7899 its own differently named set of sequential results When any one is selected,
    7900 the window tabulates the sequential refinement results. The columns are the
     7891<h4><a name=Sequential></a><span style='mso-fareast-font-family:"Times
     7892New Roman"'>
     7893Sequential Refinement Results</span></h4>
     7894
     7895<p class=MsoNormal>This tree entry becomes available after a
     7896sequential fit has been run. Note there are the following types
     7897of sequential fits:
     7898<OL>
     7899 <LI> Rietveld: Sequential results
     7900 <LI> PDF: Sequential PDFfit2 results
     7901 <LI> Peak fit: Sequential peak fit results
     7902 <LI> Small angle: Sequential SASD fit results
     7903 <LI> Reflectometry: Sequential REFD results
     7904 <LI> Image (strain): Sequential strain fit results
     7905 <LI> Image (calibration): Sequential image calibration results
     7906</OL>
     7907Each sequential fitting process within GSAS-II will have
     7908its own differently named set of sequential results, as listed above.
     7909When any of these tree items is selected,
     7910the window tabulates the sequential fit results. The columns are the
    79017911parameter names; the naming convention is generally ‘p:h:name:n’ where ‘p’ is
    79027912the phase number,’ h’ is the histogram number, ‘name’ is the parameter name,
    79037913and ‘n’ (if needed) is the item number (e.g. atom number). The rows are the
    79047914data sets used in the sequential refinement.</p>
     7915
     7916For a sequential Rietveld refinement, set
     7917the PWDR histograms to be used in the sequential refinement in the
     7918<a href="#Controls">Controls tree item</a>. Note that the
     7919Calculate/Refine menu command will be renamed as "Sequential Refine."
     7920Since not all histograms need be used in a sequential Rietveld
     7921fit, after a sequential fit, histograms that have been fit will be
     7922included in the table. Previously fit histograms will not be removed
     7923unless the table is cleared (in the <a href="#Controls">Controls tree
     7924item</a>). In this way, a large sequential fit may be worked on in
     7925sections.
     7926The first column of the table will list the histogram number and the
     7927number will be shown in red if it was not fit in the last sequential refinement.
    79057928
    79067929<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     
    1180111824</span></div>
    1180211825
    11803 <p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><!-- hhmts start -->Last modified: Wed Jan 25 20:20:57 CST 2023 <!-- hhmts end -->
     11826<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><!-- hhmts start -->Last modified: Fri Jan 27 18:42:33 CST 2023 <!-- hhmts end -->
    1180411827</body>
    1180511828
  • trunk/nistlat.py

    r5479 r5482  
    2525https://patents.google.com/patent/US5235523A/en?oq=5235523 if this module
    2626is used.
    27 
    28 This will be deployed in GSAS-II after a release of updated binary images.
    2927
    3028'''
Note: See TracChangeset for help on using the changeset viewer.