Changeset 5066 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Nov 5, 2021 1:03:50 PM (2 years ago)
Author:
vondreele
Message:

fixes to RMCProfile stuff to accomodate creation of vacancies in partially occupied atom sites.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r5065 r5066  
    29142914       
    29152915    def OnRunISODISTORT(event):
     2916        ''' this needs to setup for method #3 or #4 in ISODISTORT
     2917        after providing parent cif:
     2918        #3 asks for transformation matrix & space group of child structure
     2919        #4 asks for cif file of child structure
     2920        '''
    29162921        import ISODISTORT as ISO
    29172922        dlg = wx.FileDialog(General, 'Choose parent cif file for ISODISTORT',G2G.GetImportPath(G2frame),
     
    49004905            def OnRefSel(event):
    49014906                RMCPdict['refinement'] = reftype.GetStringSelection()
    4902                 wx.CallAfter(UpdateRMC)               
    4903                                            
     4907                wx.CallAfter(UpdateRMC)
     4908
     4909            def OnAddPDF(event):
     4910                usedList = RMCPdict['seqfiles']
     4911                PDFdict = dict([item[1:] for item in G2frame.GetFileList('PDF')])
     4912                PDFnames = [item for item in PDFdict if item not in usedList]
     4913                dlg = G2G.G2MultiChoiceDialog(G2frame.FRMC,'PDF dataset',
     4914                    'Select G(r) data to use in seq. PDFfit',PDFnames)
     4915#                    style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.OK|wx.CENTRE)
     4916                if dlg.ShowModal() == wx.ID_OK:
     4917                    PDFuse = dlg.GetSelections()
     4918                    for item in PDFuse:
     4919                        pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,PDFnames[item])
     4920                        data = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'PDF Controls'))
     4921                        RMCPdict['seqfiles'].append([PDFnames[item],data])
     4922                dlg.Destroy()
     4923                wx.CallAfter(UpdateRMC)
     4924               
    49044925            Indx = {}
    49054926            topSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    49835004                return
    49845005            elif G2frame.RMCchoice == 'PDFfit' and RMCPdict['refinement'] == 'sequential':
    4985                 mainSizer.Add(wx.StaticText(G2frame.FRMC,label='sequential file list - TBD'))
     5006               
     5007                def OnSetColVal(event):
     5008                   
     5009                    parms = {'Rmin':[0.0,5.0],'Rmax':[5.,30.],'dscale':[0.5,2.0],'qdamp':[0.0,0.5],'qbroad':[0.0,0.1]}
     5010                    c =  event.GetCol()
     5011                    if c >= 0:
     5012                        if c in [3,5,7]:
     5013                            seqGrid.ClearSelection()
     5014                            seqGrid.SelectCol(c,True)
     5015                            if seqGrid.GetColLabelValue(c) != 'refine': return
     5016                            choice = ['Y - vary all','N - vary none',]
     5017                            dlg = wx.SingleChoiceDialog(G2frame,'Select refinement option for '+seqGrid.GetColLabelValue(c-1),
     5018                                'Refinement controls',choice)
     5019                            dlg.CenterOnParent()
     5020                            if dlg.ShowModal() == wx.ID_OK:
     5021                                sel = dlg.GetSelection()
     5022                                varib = colLabels[c-1]
     5023                                if sel == 0:
     5024                                    for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1][varib][1]=True
     5025                                else:
     5026                                    for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1][varib][1]=False
     5027                        elif c in [0,1,2,4,6]:
     5028                            seqGrid.ClearSelection()
     5029                            seqGrid.SelectCol(c,True)
     5030                            parm = colLabels[c]
     5031                            dlg = G2G.SingleFloatDialog(G2frame,'New value','Enter value for '+parm,0.0,parms[parm])
     5032                            if dlg.ShowModal() == wx.ID_OK:
     5033                                value = dlg.GetValue()
     5034                                if c in [2,4,6]:
     5035                                    for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1][parm][0] = value
     5036                                else:
     5037                                    for row in range(seqGrid.GetNumberRows()): RMCPdict['seqfiles'][row][1]['Fitrange'][c] = value
     5038                        wx.CallAfter(UpdateRMC)
     5039                               
     5040                if 'seqfiles' not in RMCPdict:
     5041                    RMCPdict['seqfiles'] = []
     5042                topSizer = wx.BoxSizer(wx.HORIZONTAL)
     5043                topSizer.Add(wx.StaticText(G2frame.FRMC,label=' Sequential file list for PDFfit:  '),0,WACV)
     5044                addPDF = wx.Button(G2frame.FRMC,label='Add PDF G(r) data sets')
     5045                addPDF.Bind(wx.EVT_BUTTON,OnAddPDF)
     5046                topSizer.Add(addPDF,0,WACV)
     5047                mainSizer.Add(topSizer)
     5048                table = [[item[1]['Fitrange'][0],item[1]['Fitrange'][1],
     5049                    item[1]['dscale'][0],item[1]['dscale'][1],item[1]['qdamp'][0],item[1]['qdamp'][1],
     5050                    item[1]['qbroad'][0],item[1]['qbroad'][1],] for item in RMCPdict['seqfiles']]
     5051                colLabels = ['Rmin','Rmax','dscale','refine','qdamp','refine','qbroad','refine']
     5052                rowLabels = [item[0] for item in RMCPdict['seqfiles']]
     5053                Types = [wg.GRID_VALUE_FLOAT+':10,2',wg.GRID_VALUE_FLOAT+':10,2',
     5054                         wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
     5055                         wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,
     5056                         wg.GRID_VALUE_FLOAT+':10,4',wg.GRID_VALUE_BOOL,]
     5057                seqTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=Types)
     5058                seqGrid = G2G.GSGrid(G2frame.FRMC)
     5059                seqGrid.SetTable(seqTable, True)
     5060                seqGrid.AutoSizeColumns(True)
     5061                seqGrid.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, OnSetColVal)
     5062                mainSizer.Add(seqGrid)
     5063               
    49865064                return
    49875065            # RMCProfile & PDFfit (Normal)
     
    54065484                oldPairs = data['RMC']['RMCProfile'].get('Pairs',{})
    54075485                Pairs = {}
    5408                 for pairs in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]:
     5486#                for pairs in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]:
     5487                for pairs in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA)] for i in range(lenA)]:
    54095488                    for pair in pairs:
    54105489                        if pair in oldPairs:
     
    54165495            if not data['RMC']['RMCProfile'] or 'metadata' not in RMCPdict:
    54175496                Pairs = {}
    5418                 for pairs in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]:
     5497#                for pairs in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]:
     5498                for pairs in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA)] for i in range(lenA)]:
    54195499                    for pair in pairs:
    54205500                        Pairs[pair] = [0.0,0.0,0.0]
    54215501                BVSpairs = []
    54225502                if lenA > 1:
    5423                     for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]:
     5503#                    for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]:
     5504                    for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA)] for i in range(lenA)]:
    54245505                        BVSpairs += pair
    54255506                BVS = {pairs:[0.0,0.0,0.0,0.0] for pairs in BVSpairs}
     
    54385519                    'Stretch search':10.,'Pot. Temp.':300.,'useGPU':False,}})
    54395520               
     5521#            data['RMC']['RMCProfile']['aTypes'] = {aTypes[atype] for atype in aTypes if atype in Atypes}
    54405522            data['RMC']['RMCProfile']['Isotope'] = copy.copy(data['General']['Isotope'])
    54415523            data['RMC']['RMCProfile']['Isotopes'] = copy.deepcopy(data['General']['Isotopes'])
Note: See TracChangeset for help on using the changeset viewer.