Changeset 4378


Ignore:
Timestamp:
Mar 22, 2020 8:33:59 AM (19 months ago)
Author:
vondreele
Message:

begin fullrmc implementation - 1st avoid crash if not installed - give warning & disable RMC menu items for it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4375 r4378  
    45994599        def OnRMCselect(event):
    46004600            G2frame.RMCchoice = RMCsel.GetStringSelection()
    4601 #            G2frame.runtext.SetValue('')
    46024601            UpdateRMC()
    46034602       
    46044603        G2frame.GetStatusBar().SetStatusText('',1)
    46054604        if G2frame.RMCchoice == 'RMCProfile':
     4605            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True)
    46064606            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_LOADRMC,False)
    46074607            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SAVERMC,False)
     4608            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,True)
     4609            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,True)
    46084610        elif G2frame.RMCchoice == 'fullrmc':
    4609             G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_LOADRMC,True)
    4610             G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SAVERMC,True)
     4611            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,False)
     4612            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_LOADRMC,False)
     4613            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SAVERMC,False)
     4614            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,False)
     4615            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,False)
     4616            wx.MessageBox(''' fullrmc is not correctly installed for use in GSAS-II
     4617      Install it in your python according to the instructions in
     4618      https://bachiraoun.github.io/fullrmc/index.html. ''',
     4619                caption='fullrmc not installed',style=wx.ICON_INFORMATION)
    46114620        if G2frame.FRMC.GetSizer():
    46124621            G2frame.FRMC.GetSizer().Clear(True)
     
    46204629        mainSizer.Add((5,5),0,WACV)
    46214630        if G2frame.RMCchoice == 'fullrmc':
     4631            try:
     4632                from fullrmc import Engine
     4633            except ModuleNotFoundError:
     4634                return
     4635            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True)
     4636            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_LOADRMC,True)
     4637            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SAVERMC,True)
     4638            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,True)
     4639            G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,True)
    46224640            mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' fullrmc run.py file preparation:'),0,WACV)
    46234641#            font1 = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Consolas')
     
    46414659                    for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i+1,lenA)] for i in range(lenA)]:
    46424660                        BVSpairs += pair
    4643                     BVS = {pairs:[0.0,0.0,0.0,0.0] for pairs in BVSpairs}
     4661                BVS = {pairs:[0.0,0.0,0.0,0.0] for pairs in BVSpairs}
    46444662                files = {'Neutron real space data; G(r): ':['',0.05,'G(r)','RMC',],
    46454663                          'Neutron reciprocal space data; F(Q): ':['',0.05,'F(Q)','RMC',],
     
    53835401    def OnViewRMC(event):
    53845402        if G2frame.RMCchoice == 'fullrmc':
    5385             print('view fullrmc results - TBD')
     5403            try:
     5404                from fullrmc import Engine
     5405            except ModuleNotFoundError:
     5406                wx.MessageBox(''' fullrmc is not correctly installed for use in GSAS-II
     5407      Install it in your python according to the instructions in
     5408      https://bachiraoun.github.io/fullrmc/index.html. ''',
     5409          caption='fullrmc not installed',style=wx.ICON_INFORMATION)
     5410                return
     5411            DIR_PATH = os.path.dirname( os.path.realpath(__file__) )
     5412            engineFilePath = os.path.join(DIR_PATH, "engine.rmc")
     5413           
     5414            # load
     5415            ENGINE = Engine(path=None)
     5416            result, mes = ENGINE.is_engine(engineFilePath, mes=True)
     5417            if result:
     5418                ENGINE = ENGINE.load(engineFilePath)
     5419                GR, SQ, CN, MD = ENGINE.constraints
    53865420        else:
    53875421            generalData = data['General']
Note: See TracChangeset for help on using the changeset viewer.