Changeset 5122


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

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIElemGUI.py

    r4660 r5122  
    2020import os
    2121import wx.lib.colourselect as wscs
     22# for Python 3.10+, define a version of wxPoint that accepts float params
     23def wxPoint(x,y): return wx.Point(int(x),int(y))
    2224class PickElement(wx.Dialog):
    2325    '''Makes periodic table widget for picking element. Modes:
     
    4951                color=E[6]
    5052            self.ElButton(name=E[0],
    51                pos=wx.Point(E[1]*self.butWid+25,E[2]*24+24),
     53               pos=wxPoint(E[1]*self.butWid+25,E[2]*24+24),
    5254               tip=E[3],color=color)
    5355            i+=1
    5456        if self.multiple:
    5557            b = wx.Button(self,wx.ID_CLOSE,
    56                 pos=wx.Point(16.5*self.butWid+25,7.75*24+24),label="Done")
     58                pos=wxPoint(16.5*self.butWid+25,7.75*24+24),label="Done")
    5759            b.Bind(wx.EVT_BUTTON, self.OnClose)
    5860
     
    246248        for E in self.ElTable:
    247249            PickElements.ElButton(self,parent=elPanel,name=E[0],
    248                 pos=wx.Point(E[1]*30+20,E[2]*30+25),tip=E[3],color=E[4])
     250                pos=wxPoint(E[1]*30+20,E[2]*30+25),tip=E[3],color=E[4])
    249251            i+=1
    250252        mainSizer.Add(elPanel,0,wx.EXPAND)
     
    321323        Elem = []
    322324        for Elem in choice:
    323             self.ElButton(name=Elem,pos=wx.Point(16+i*24, 16))
     325            self.ElButton(name=Elem,pos=wxPoint(16+i*24, 16))
    324326            i+=1
    325327             
  • 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):
  • trunk/help/gsasII-phase.html

    r4971 r5122  
    55255525can I do here?</h5>
    55265526
    5527 <div class=MsoNormal align=center style='text-align:center;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'><a
    5528 name="Phase-Pawley_reflections"></a><span style='mso-fareast-font-family:"Times New Roman";
    5529 mso-no-proof:yes'>
     5527
     5528<h4 style='margin-left:.25in'>
     5529<a name="Phase-RMC">RMC</a></h4>
     5530<h5 style='margin-left:.5in'>
     5531What can I do here?</h5>
     5532
     5533<h4 style='margin-left:.25in'>
     5534<a name="Phase-ISODISTORT">ISODISTORT</a></h4>
     5535<h5 style='margin-left:.5in'>
     5536What can I do here?</h5>
     5537
     5538<h4 style='margin-left:.25in'>
     5539<a name="Phase-Pawley_reflections">Pawley_reflections</a></h4>
     5540<h5 style='margin-left:.5in'>
     5541What can I do here?</h5>
     5542
     5543
    55305544
    55315545<hr size=3 width="100%" align=center>
    55325546
    5533 </span></div>
    5534 
    5535 <div class=MsoNormal align=center style='text-align:center;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'><span
    5536 style='mso-fareast-font-family:"Times New Roman";mso-no-proof:yes'>
    5537 
    5538 <hr size=3 width="100%" align=center>
    5539 
    5540 </span></div>
    5541 
    55425547<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'><span
    5543 style='mso-fareast-font-family:"Times New Roman"'><!-- hhmts start -->Last
    5544 modified: Sat Jun 19 21:43:10 CDT 2021 <!-- hhmts end --><o:p></o:p></span></p>
     5548style='mso-fareast-font-family:"Times New Roman"'><!-- hhmts start -->Last modified: Sat Jan  1 14:45:09 CST 2022 <!-- hhmts end --><o:p></o:p></span></p>
    55455549
    55465550</div>
Note: See TracChangeset for help on using the changeset viewer.