Changeset 5122 for trunk/GSASIIphsGUI.py


Ignore:
Timestamp:
Jan 1, 2022 3:00:59 PM (11 months ago)
Author:
toby
Message:

start on fullrmc mods; wx4.1 fix; address wx.Point with float args warning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r5117 r5122  
    49404940            def OnRefSel(event):
    49414941                RMCPdict['refinement'] = reftype.GetStringSelection()
    4942                 wx.CallAfter(UpdateRMC)
     4942                wx.CallLater(100,UpdateRMC)
    49434943               
    49444944            def OnDataSel(event):
     
    49524952
    49534953            Indx = {}
    4954             topSizer = wx.BoxSizer(wx.HORIZONTAL)
    4955             topSizer.Add(wx.StaticText(G2frame.FRMC,label='  Select data for processing: '))
    49564954            if G2frame.RMCchoice == 'PDFfit':
     4955                topSizer = wx.BoxSizer(wx.HORIZONTAL)
    49574956                reftype = wx.RadioBox(G2frame.FRMC,label='PDFfit refinement type:',choices=['normal','sequential'])
    49584957                reftype.SetStringSelection(RMCPdict.get('refinement','normal'))
     
    49744973                    endSizer.Add(seqreverse)
    49754974                    topSizer.Add(endSizer,0,WACV)
    4976                    
    4977             mainSizer.Add(topSizer)
    4978             if G2frame.RMCchoice == 'fullrmc':
     4975                mainSizer.Add(topSizer)
     4976            elif G2frame.RMCchoice == 'fullrmc':
     4977                topSizer = wx.BoxSizer(wx.HORIZONTAL)
     4978                topSizer.Add(wx.StaticText(G2frame.FRMC,label='  Select data for processing (files must be 2 columns w/headers preceeded by "#"; edit if needed)'))
     4979                mainSizer.Add(topSizer)
    49794980                Heads = ['Name','File','type','Plot','Delete']
    49804981                fileSizer = wx.FlexGridSizer(5,5,5)
     
    50445045                fitscale.Bind(wx.EVT_CHECKBOX,OnFitScale)
    50455046                mainSizer.Add(fitscale,0)
    5046                 mainSizer.Add(wx.StaticText(G2frame.FRMC,
    5047                     label=' NB: fullrmc data files must be 2 columns; all other lines preceeded by "#". Edit before use.'),0)
    50485047                return
    50495048            elif G2frame.RMCchoice == 'PDFfit' and RMCPdict['refinement'] == 'sequential':
    5050                
    50515049                def OnAddPDF(event):
    50525050                    ''' Add PDF G(r)s while maintanining original sequence
     
    50845082               
    50855083                def OnSetColVal(event):
    5086                    
    50875084                    parms = {'Rmin':[0.0,5.0],'Rmax':[5.,30.],'dscale':[0.5,2.0],
    50885085                        'qdamp':[0.0,0.5],'qbroad':[0.0,0.1],'Temp':300}
     
    51335130                            else:
    51345131                                RMCPdict['seqfiles'][r][1]['Fitrange'][c] = float(seqGrid.GetCellValue(r,c))
    5135                                
     5132
     5133                topSizer = wx.BoxSizer(wx.HORIZONTAL)
     5134                topSizer.Add(wx.StaticText(G2frame.FRMC,label='  Select data for processing: '))
     5135                mainSizer.Add(topSizer)               
    51365136                G2frame.GetStatusBar().SetStatusText('NB: All PDFs used in sequential PDFfit must be the same type ("X" or "N") - there is no check',1)
    51375137                if 'seqfiles' not in RMCPdict:
     
    51625162                seqGrid.Bind(wg.EVT_GRID_CELL_CHANGED, OnSetVal)
    51635163                mainSizer.Add(seqGrid)
    5164                
    51655164                return
     5165            topSizer = wx.BoxSizer(wx.HORIZONTAL)
     5166            topSizer.Add(wx.StaticText(G2frame.FRMC,label='  Select data for processing: '))
     5167            mainSizer.Add(topSizer)
    51665168            # RMCProfile & PDFfit (Normal)
    51675169            Heads = ['Name','File','Format','Weight','Plot','Delete']
     
    52425244        def fullrmcSizer(RMCPdict):
    52435245            mainSizer = wx.BoxSizer(wx.VERTICAL)
    5244             if G2pwd.findfullrmc() is None:
    5245                 dlg = wx.MessageDialog(G2frame,
    5246                     'The fullrmc code is not installed or could not be'
    5247                     ' located. Do you want help information on fullrmc?',
    5248                     'Install info',
    5249                     wx.YES|wx.NO)
    5250                 try:
    5251                     dlg.CenterOnParent()
    5252                     result = dlg.ShowModal()
    5253                 finally:
    5254                     dlg.Destroy()
    5255                 if result == wx.ID_YES:
    5256                     G2G.ShowHelp('fullrmc',G2frame)
    5257                 return mainSizer
    52585246            mainSizer.Add(wx.StaticText(G2frame.FRMC,label=
    52595247''' "Fullrmc, a Rigid Body Reverse Monte Carlo Modeling Package Enabled with
     
    52615249(2016), 37, 1102-1111. doi: https://doi.org/10.1002/jcc.24304
    52625250 '''))
     5251            if G2pwd.findfullrmc() is None:
     5252                mainSizer.Add(wx.StaticText(G2frame.FRMC,
     5253                    label="\nsorry, fullrmc not installed or was not located"))
     5254                return mainSizer
    52635255            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True)
    52645256            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,True)
    52655257            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,True)
    52665258            #mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' fullrmc big box starting pdb file preparation:'),0)
    5267             if not data['RMC']['fullrmc']:
    5268                 Atypes = [atype.split('+')[0].split('-')[0] for atype in data['General']['AtomTypes']]
    5269                 aTypes = dict(zip(Atypes,len(Atypes)*[0.10,]))
    5270                 atSeq = list(aTypes.keys())
    5271                 lenA = len(atSeq)
    5272                 Pairs= []
    5273                 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]]:
    5274                     Pairs += pair
    5275                 Pairs = {pairs:[0.0,0.0,0.0] for pairs in Pairs}
    5276                 files = {'Neutron real space data; G(r): ':['Select',1.,'G(r)',0,True],
    5277                           'Neutron reciprocal space data; S(Q)-1: ':['Select',1.,'F(Q)',0,True],
    5278                           'Xray real space data; G(r): ':['Select',1.,'G(r)',0,True],
    5279                           'Xray reciprocal space data; S(Q)-1: ':['Select',1.,'F(Q)',0,True],}
    5280                 data['RMC']['fullrmc'] = {'SuperCell':[1,1,1],'Box':[10.,10.,10.],'aTypes':aTypes,
    5281                     'atSeq':atSeq,'Pairs':Pairs,'files':files,'ReStart':[False,False],'Cycles':1,
    5282                     'Swaps':[],'useBVS':False,'FitScale':False,'AveCN':[],'FxCN':[],'Angles':[],'Angle Weight':1.e-5,
    5283                     'moleculePdb':'Select','targetDensity':1.0,'maxRecursion':10000,'Torsions':[],'Torsion Weight':1.e-5,
    5284                     'Bond Weight':1.e-5,'min Contact':1.5,'periodicBound':True}
     5259
     5260            # initialize fullrmc dictionary if needed
     5261            RMCPdict = data['RMC']['fullrmc'] = data['RMC'].get('fullrmc',{})
     5262            # always update, in case atoms have been updated
     5263            Atypes = [atype.split('+')[0].split('-')[0] for atype in data['General']['AtomTypes']]
     5264            aTypes = dict(zip(Atypes,len(Atypes)*[0.10,]))
     5265            atSeq = list(aTypes.keys())
     5266            lenA = len(atSeq)
     5267            Pairs= []
     5268            for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]]
     5269                                 for i in range(lenA) if 'Va' not in atSeq[i]]:
     5270                Pairs += pair
     5271            Pairs = {pairs:[0.0,0.0,0.0] for pairs in Pairs}
     5272            RMCPdict.update({'aTypes':aTypes,'atSeq':atSeq,'Pairs':Pairs})
     5273            RMCPdict['files'] = RMCPdict.get('files',
     5274                            {'Neutron real space data; G(r): ':['Select',1.,'G(r)',0,True],
     5275                            'Neutron reciprocal space data; S(Q)-1: ':['Select',1.,'F(Q)',0,True],
     5276                            'Xray real space data; G(r): ':['Select',1.,'G(r)',0,True],
     5277                            'Xray reciprocal space data; S(Q)-1: ':['Select',1.,'F(Q)',0,True]})
     5278            if 'moleculePdb' not in RMCPdict:
     5279                RMCPdict.update({'moleculePdb':'Select','targetDensity':1.0,'maxRecursion':10000})
     5280            if 'Angles' not in RMCPdict:
     5281                RMCPdict.update({'Angles':[],'Angle Weight':1.e-5,'Bond Weight':1.e-5,'Torsions':[],'Torsion Weight':1.e-5})
     5282            for key,val in {'SuperCell':[1,1,1],'Box':[10.,10.,10.],'ReStart':[False,False],'Cycles':1,
     5283                    'Swaps':[],'useBVS':False,'FitScale':False,'AveCN':[],'FxCN':[],
     5284                    'min Contact':1.5,'periodicBound':True}.items():
     5285                RMCPdict[key] = RMCPdict.get(key,val)                   
    52855286
    52865287            def GetSuperSizer():
     
    54255426            #             torsionSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,torsion,i,xmin=0.,xmax=360.,OnLeave=SetRestart1,size=(50,25)),0,WACV)
    54265427            #     return torsionSizer
    5427 #patches
    5428             if 'useBVS' not in RMCPdict:
    5429                 RMCPdict['useBVS'] = False
    5430             if 'moleculePdb' not in RMCPdict:
    5431                 RMCPdict.update({'moleculePdb':'Select','targetDensity':1.0,'maxRecursion':10000})
    5432             if 'FitScale' not in RMCPdict:
    5433                 RMCPdict['FitScale'] = False
    5434 #            if 'atomPDB' not in RMCPdict:
    5435 #                RMCPdict['atomPDB'] = ''
    5436             if 'Angles' not in RMCPdict:
    5437                 RMCPdict.update({'Angles':[],'Angle Weight':1.e-5,'Bond Weight':1.e-5,'Torsions':[],'Torsion Weight':1.e-5})
    5438             if 'Cycles' not in RMCPdict:
    5439                 RMCPdict['Cycles'] = 1
    5440             if 'min Contact' not in RMCPdict:
    5441                 RMCPdict['min Contact'] = 1.5
    5442             #if 'periodicBound' not in RMCPdict:
    5443             #    RMCPdict['periodicBound'] = True
    5444 #end patches
    54455428
    54465429            generalData = data['General']
     
    62106193        G2G.HorizontalLine(mainSizer,G2frame.FRMC)
    62116194        mainSizer.Add(wx.StaticText(G2frame.FRMC,
    6212             label=' NB: if you change any of the entries below, you must redo the Operations/Setup RMC step \n above to apply them before doing Operations/Execute'),0,WACV)
     6195            label=' NB: if you change any of the entries below, you must redo the Operations/Setup RMC step \n above to apply them before doing Operations/Execute'),0)
    62136196        G2G.HorizontalLine(mainSizer,G2frame.FRMC)
    62146197        if G2frame.RMCchoice == 'fullrmc':
     
    62266209        bigSizer.Add(G2G.HelpButton(G2frame.FRMC,helpIndex=G2frame.dataWindow.helpKey))
    62276210        SetPhaseWindow(G2frame.FRMC,bigSizer)
     6211        if G2frame.RMCchoice == 'fullrmc' and G2pwd.findfullrmc() is None:
     6212            dlg = wx.MessageDialog(G2frame,
     6213                    'The fullrmc code is not installed or could not be'
     6214                    ' located. Do you want help information on fullrmc?',
     6215                    'Install info',
     6216                    wx.YES|wx.NO)
     6217            try:
     6218                dlg.CenterOnParent()
     6219                result = dlg.ShowModal()
     6220            finally:
     6221                dlg.Destroy()
     6222            if result == wx.ID_YES:
     6223                G2G.ShowHelp('fullrmc',G2frame)
     6224            return mainSizer
    62286225       
    62296226    def OnSetupRMC(event):
Note: See TracChangeset for help on using the changeset viewer.