Changeset 4911
- Timestamp:
- May 20, 2021 12:07:05 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r4909 r4911 4809 4809 self.nextval = self.startValue 4810 4810 val = self._tc.GetValue().lower().strip() 4811 val = val.replace(',','.') # allow , for decimal 4811 4812 if val != str(self.startValue): 4812 4813 changed = True … … 4855 4856 def OnChar(self, evt): 4856 4857 key = evt.GetKeyCode() 4857 if key < 32 or key >= 127: 4858 if key < 32 or key >= 127: # outside printable ascii range; needed for backspace etc. 4858 4859 evt.Skip() 4859 elif chr(key).lower() in '.+-*/0123456789cosind() ':4860 elif chr(key).lower() in '.+-*/0123456789cosind(),': 4860 4861 evt.Skip() 4861 4862 else: -
trunk/GSASIIphsGUI.py
r4900 r4911 3416 3416 3417 3417 def Paint(Scroll=0): 3418 3418 'Place atom info into the table' 3419 3419 table = [] 3420 3420 rowLabels = [] … … 3442 3442 # Lande = generalData['Lande g'] 3443 3443 # AtInfo = dict(zip(atTypes,Lande)) 3444 attr = wx.grid.GridCellAttr() 3445 attr.IncRef() #fix from Jim Hester 3446 attr.SetEditor(G2G.GridFractionEditor(Atoms)) 3447 for c in range(colX,colX+4): 3444 # next 3 lines do not seem to do anything. Removed 5/20/21 BHT 3445 # attr = wx.grid.GridCellAttr() 3446 # attr.IncRef() #fix from Jim Hester 3447 # attr.SetEditor(G2G.GridFractionEditor(Atoms)) 3448 # 3449 # loop over all cols in table, set cell editor for numerical items 3450 for c,t in enumerate(Types): 3451 if not t.startswith(wg.GRID_VALUE_FLOAT): continue 3448 3452 attr = wx.grid.GridCellAttr() 3449 3453 attr.IncRef() #fix from Jim Hester 3450 3454 attr.SetEditor(G2G.GridFractionEditor(Atoms)) 3455 if c in range(colU11-1,colU11+6): 3456 Atoms.SetColSize(c,50) 3457 attr.SetBackgroundColour(VERY_LIGHT_GREY) 3458 attr.SetTextColour(VERY_LIGHT_GREY) 3459 attr.SetReadOnly(True) 3451 3460 Atoms.SetColAttr(c, attr) 3452 for i in range(colU11-1,colU11+6):3453 Atoms.SetColSize(i,50)3454 attr = wx.grid.GridCellAttr()3455 attr.IncRef() #fix from Jim Hester3456 attr.SetBackgroundColour(VERY_LIGHT_GREY)3457 attr.SetTextColour(VERY_LIGHT_GREY)3458 attr.SetReadOnly(True)3459 Atoms.SetColAttr(i, attr)3460 3461 for row in range(Atoms.GetNumberRows()): #this is slow for large numbers of atoms 3461 3462 atId = atomData[row][colIA+8] … … 4772 4773 Obj = event.GetEventObject() 4773 4774 fil = Indx[Obj.GetId()] 4775 G2frame.OnFileSave(event) 4774 4776 dlg = wx.FileDialog(G2frame.FRMC, 'Choose '+fil,G2G.GetImportPath(G2frame), 4775 4777 style=wx.FD_OPEN ,wildcard=fil+'(*.*)|*.*') … … 4943 4945 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,False) 4944 4946 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_VIEWRMC,False) 4945 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,True) 4947 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,False) 4948 #G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_STOPRMC,True) 4946 4949 if G2frame.FRMC.GetSizer(): 4947 4950 G2frame.FRMC.GetSizer().Clear(True) … … 4956 4959 mainSizer.Add((5,5),0) 4957 4960 if G2frame.RMCchoice == 'fullrmc': 4958 try: 4959 import fullrmc 4960 except ModuleNotFoundError: 4961 wx.MessageBox(''' fullrmc is not correctly installed for use in GSAS-II 4962 Install it in your python according to the instructions in 4963 https://bachiraoun.github.io/fullrmc/index.html. ''', 4964 caption='fullrmc not installed',style=wx.ICON_INFORMATION) 4961 if G2pwd.findfullrmc() is None: 4962 dlg = wx.MessageDialog(G2frame, 4963 'The fullrmc code is not installed or could not be' 4964 ' located. Do you want help information on fullrmc?', 4965 'Install info', 4966 wx.YES|wx.NO) 4967 try: 4968 dlg.CenterOnParent() 4969 result = dlg.ShowModal() 4970 finally: 4971 dlg.Destroy() 4972 if result == wx.ID_YES: 4973 G2G.ShowHelp('fullrmc',G2frame) 4965 4974 return 4966 if int(fullrmc.__version__.split('.')[0]) < 5: 4967 wx.MessageBox('This module requires fullrmc >= 5.0. You have {}.'.format(fullrmc.__version__) + 4968 ' Revert to GSAS-II version <=4517 to use older versions of fullrmc. ', 4969 caption='fullrmc to old',style=wx.ICON_INFORMATION) 4970 return 4971 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=''' "Fullrmc, a Rigid Body Reverse Monte Carlo Modeling Package Enabled with Machine Learning and Artificial Intelligence", 4972 B. Aoun, Jour. Comp. Chem. 2016, 37, 1102-1111. doi: https://doi.org/10.1002/jcc.24304 4975 mainSizer.Add(wx.StaticText(G2frame.FRMC,label= 4976 ''' "Fullrmc, a Rigid Body Reverse Monte Carlo Modeling Package Enabled with 4977 Machine Learning and Artificial Intelligence", B. Aoun, Jour. Comp. Chem. 4978 (2016), 37, 1102-1111. doi: https://doi.org/10.1002/jcc.24304 4973 4979 ''')) 4974 4980 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True) … … 5190 5196 mainSizer.Add(molecSizer,0) 5191 5197 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 5192 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' fullrmc run file preparation:') ,0,WACV)5198 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' fullrmc run file preparation:')) 5193 5199 resLine = wx.BoxSizer(wx.HORIZONTAL) 5194 restart = wx.CheckBox(G2frame.FRMC,label=' Restart fullrmc Engine? (will clear old result!) ') 5200 resLine.Add(wx.StaticText(G2frame.FRMC,label=' Run '),0,WACV) 5201 resLine.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict,'Cycles',xmin=1,size=[60,25])) 5202 resLine.Add(wx.StaticText(G2frame.FRMC, 5203 label=' Computation cycles of '),0,WACV) 5204 RMCPdict['Steps/cycle'] = RMCPdict.get('Steps/cycle',5000) 5205 resLine.Add(G2G.EnumSelector(G2frame.FRMC,RMCPdict,'Steps/cycle', 5206 ['1K','5K','10K','50K'],[1000,5000,10000,50000]),0,WACV) 5207 resLine.Add(wx.StaticText(G2frame.FRMC, 5208 label=' steps per cycle'),0,WACV) 5209 mainSizer.Add(resLine,0) 5210 resLine = wx.BoxSizer(wx.HORIZONTAL) 5211 resLine.Add(wx.StaticText(G2frame.FRMC, 5212 label=' Restart fullrmc Engine? '),0,WACV) 5213 restart = wx.CheckBox(G2frame.FRMC,label='(will clear old result!) ') 5214 resLine.Add(restart,0,WACV) 5215 5195 5216 restart.SetValue(RMCPdict['ReStart'][0]) 5196 5217 restart.Bind(wx.EVT_CHECKBOX,OnReStart) 5197 resLine.Add(restart,0,WACV)5198 resLine.Add(wx.StaticText(G2frame.FRMC,label=' 10,000X Computation cycles: '),0,WACV)5199 resLine.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict,'Cycles',xmin=1,size=[60,25]),0,WACV)5200 5218 mainSizer.Add(resLine,0) 5201 5219 5202 5220 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 5203 mainSizer.Add(GetAtmChoice( RMCPdict),0)5221 mainSizer.Add(GetAtmChoice(G2frame.FRMC,RMCPdict),0) 5204 5222 5205 5223 G2G.HorizontalLine(mainSizer,G2frame.FRMC) … … 5221 5239 distBox.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict,'min Contact',xmin=0.,xmax=4.,size=(50,25)),0,WACV) 5222 5240 mainSizer.Add(distBox,0) 5223 mainSizer.Add(GetPairSizer( RMCPdict),0)5241 mainSizer.Add(GetPairSizer(G2frame.FRMC,RMCPdict),0) 5224 5242 5225 5243 mainSizer.Add((-1,10)) … … 5695 5713 RMCPdict = data['RMC']['fullrmc'] 5696 5714 # debug stuff 5697 # if GSASIIpath.GetConfigValue('debug'):5698 # print('reloading',G2pwd)5699 # import imp5700 # imp.reload(G2pwd)5715 # if GSASIIpath.GetConfigValue('debug'): 5716 # print('reloading',G2pwd) 5717 # import imp 5718 # imp.reload(G2pwd) 5701 5719 # end debug stuff 5702 5720 rname = G2pwd.MakefullrmcRun(pName,data,RMCPdict) … … 5771 5789 # #import shutil 5772 5790 # #shutil.rmtree(rmcname) 5773 G2G.G2MessageBox(G2frame, '''For use of fullrmc, please cite:5774 5791 G2G.G2MessageBox(G2frame, 5792 '''For use of fullrmc, please cite: 5775 5793 "Fullrmc, a Rigid Body Reverse Monte Carlo 5776 5794 Modeling Package Enabled with Machine Learning 5777 5795 and Artificial Intelligence", 5778 5796 B. Aoun, Jour. Comp. Chem. 2016, 37, 1102-1111. 5779 DOI: https://doi.org/10.1002/jcc.24304''','Please cite fullrmc') 5797 DOI: https://doi.org/10.1002/jcc.24304 5798 ''', 5799 'Please cite fullrmc') 5780 5800 ilog = 0 5781 5801 while True: … … 5868 5888 5869 5889 def OnStopRMC(event): 5870 if G2frame.RMCchoice == 'fullrmc': 5871 generalData = data['General'] 5872 pName = G2frame.GSASprojectfile.split('.')[0] + '-' + generalData['Name'] 5873 pName = pName.replace(' ','_') 5874 engineFilePath = pName+'.rmc' 5875 if not os.path.exists(engineFilePath): 5876 print('fullrmc repository {} not found'.format(engineFilePath)) 5877 return 5878 try: 5879 from fullrmc import InterceptHook 5880 hook = InterceptHook(path=engineFilePath) 5881 hook.stop_engine() 5882 print('hook.stop_engine() sent to {}'.format(engineFilePath)) 5883 except Exception as msg: 5884 print('failed, msg=',msg) 5890 pass 5891 # if G2frame.RMCchoice == 'fullrmc': 5892 # generalData = data['General'] 5893 # pName = G2frame.GSASprojectfile.split('.')[0] + '-' + generalData['Name'] 5894 # pName = pName.replace(' ','_') 5895 # engineFilePath = pName+'.rmc' 5896 # if not os.path.exists(engineFilePath): 5897 # print('fullrmc repository {} not found'.format(engineFilePath)) 5898 # return 5899 # try: 5900 # from fullrmc import InterceptHook 5901 # hook = InterceptHook(path=engineFilePath) 5902 # hook.stop_engine() 5903 # print('hook.stop_engine() sent to {}'.format(engineFilePath)) 5904 # except Exception as msg: 5905 # print('failed, msg=',msg) 5885 5906 5886 5907 def OnViewRMC(event): … … 6678 6699 atomGrid.SetTable(atomTable,True) 6679 6700 # atomGrid.SetScrollRate(0,0) #get rid of automatic scroll bars 6680 for c in range(2,5): 6701 # loop over all cols in table, set cell editor for numerical items 6702 for c,t in enumerate(colTypes): 6703 if not t.startswith(wg.GRID_VALUE_FLOAT): continue 6681 6704 attr = wx.grid.GridCellAttr() 6682 6705 attr.IncRef() #fix from Jim Hester … … 6765 6788 # transGrid.SetScrollRate(0,0) #get rid of automatic scroll bars 6766 6789 Indx[transGrid.GetId()] = Yi 6767 for c in range(0,4): 6790 for c,t in enumerate(transTypes): 6791 if not t.startswith(wg.GRID_VALUE_FLOAT): continue 6768 6792 attr = wx.grid.GridCellAttr() 6769 6793 attr.IncRef() #fix from Jim Hester
Note: See TracChangeset
for help on using the changeset viewer.