Changeset 4264 for trunk/GSASIIphsGUI.py
- Timestamp:
- Jan 23, 2020 10:09:25 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r4263 r4264 1162 1162 parent.Raise() 1163 1163 self.EndModal(wx.ID_OK) 1164 1165 1166 1164 1167 1165 ################################################################################ 1168 1166 #### Phase editing routines 1169 1167 ################################################################################ 1168 def SetPhaseWindow(phasePage,mainSizer=None,Scroll=0): 1169 if mainSizer is not None: 1170 phasePage.SetSizer(mainSizer) 1171 phasePage.SetAutoLayout(True) 1172 phasePage.SetScrollRate(10,10) 1173 phasePage.SendSizeEvent() 1174 phasePage.Scroll(0,Scroll) 1175 1170 1176 def GetSpGrpfromUser(parent,SpGrp): 1171 1177 helptext = '''\t\t\tGSAS-II space group information … … 1220 1226 return SpcGp 1221 1227 1222 1223 def SetPhaseWindow(phasePage,mainSizer=None,Scroll=0):1224 if mainSizer is not None:1225 phasePage.SetSizer(mainSizer)1226 phasePage.SetAutoLayout(True)1227 phasePage.SetScrollRate(10,10)1228 phasePage.SendSizeEvent()1229 phasePage.Scroll(0,Scroll)1230 1228 1231 1229 def FindBondsDraw(data): … … 2957 2955 return Uij 2958 2956 2957 SGData = generalData['SGData'] 2959 2958 r,c = event.GetRow(),event.GetCol() 2960 2959 replot = True … … 2962 2961 ci = colLabels.index('I/A') 2963 2962 ID = atomData[r][ci+8] 2964 SGData = generalData['SGData']2965 2963 if Atoms.GetColLabelValue(c) in ['x','y','z']: 2966 2964 ci = colLabels.index('x') … … 3034 3032 DrawAtomsReplaceByID(data['Drawing'],ci+8,atomData[r],ID) 3035 3033 G2plt.PlotStructure(G2frame,data) 3036 wx.CallAfter(Paint) 3034 if SGData['SpGrp'] != 'P 1': #no need to update P 1 structures! 3035 wx.CallAfter(Paint) 3037 3036 3038 3037 def AtomTypeSelect(event): … … 3159 3158 for i in range(colU11-1,colU11+6): 3160 3159 Atoms.SetColSize(i,50) 3160 attr = wx.grid.GridCellAttr() 3161 attr.IncRef() #fix from Jim Hester 3162 attr.SetBackgroundColour(VERY_LIGHT_GREY) 3163 attr.SetTextColour(VERY_LIGHT_GREY) 3164 attr.SetReadOnly(True) 3165 Atoms.SetColAttr(i, attr) 3161 3166 for row in range(Atoms.GetNumberRows()): #this is slow for large numbers of atoms 3162 3167 atId = atomData[row][colIA+8] … … 3183 3188 if 'U' in rbExcl: 3184 3189 Atoms.SetCellStyle(row,colUiso,VERY_LIGHT_GREY,True) 3185 for i in range(6):3186 cj = colU11+i3187 Atoms.SetCellStyle(row,cj,VERY_LIGHT_GREY,True)3188 Atoms.SetCellTextColour(row,cj,VERY_LIGHT_GREY)3189 3190 if colM: 3190 3191 SytSym,Mul,Nop,dupDir = G2spc.SytSym(atomData[row][colX:colX+3],SGData) … … 4465 4466 'material':'nothing','phase':'vacuum','comment':'none ','source':'nowhere'} 4466 4467 data['RMC']['RMCProfile'] = {'SuperCell':[1,1,1],'UseSampBrd':[True,True],'aTypes':aTypes, 4467 'atSeq':atSeq,'Pairs':Pairs,'histogram':['',1.0],'files':files,'metadata':metadata, 4468 'runTimes':runTimes,'ReStart':[False,False],'BVS':BVS,'Oxid':atOxid,'useBVS':False, 4469 'AveCN':[],'FxCN':[],'Potentials':{'Angles':[],'Angle search':10.,'Stretch':[],'Stretch search':10.}} 4468 'atSeq':atSeq,'Pairs':Pairs,'histogram':['',1.0],'files':files,'metadata':metadata, 4469 'runTimes':runTimes,'ReStart':[False,False],'BVS':BVS,'Oxid':atOxid,'useBVS':False,'Swaps':[], 4470 'AveCN':[],'FxCN':[],'Potentials':{'Angles':[],'Angle search':10.,'Stretch':[],'Stretch search':10., 4471 }} 4470 4472 RMCPdict = data['RMC']['RMCProfile'] 4471 4473 #patches … … 4491 4493 if 'Potentials' not in RMCPdict: 4492 4494 RMCPdict.update({'Potentials':{'Angles':[],'Angle search':10.,'Stretch':[],'Stretch search':10.}}) 4495 if 'Swaps' not in RMCPdict: 4496 RMCPdict['Swaps'] = [] 4493 4497 #end patches 4494 4498 … … 4527 4531 def OnUseBVS(event): 4528 4532 RMCPdict['useBVS'] = not RMCPdict['useBVS'] 4533 wx.CallAfter(UpdateRMC) 4534 4535 def OnAddSwap(event): 4536 RMCPdict['Swaps'].append(['','',0.0,]) 4529 4537 wx.CallAfter(UpdateRMC) 4530 4538 … … 4815 4823 return bondSizer 4816 4824 4825 def GetSwapSizer(): 4826 4827 def OnDelSwap(event): 4828 Obj = event.GetEventObject() 4829 swap = Indx[Obj.GetId()] 4830 del RMCPdict['Swaps'][swap] 4831 wx.CallAfter(UpdateRMC) 4832 4833 def OnSwapAtSel(event): 4834 Obj = event.GetEventObject() 4835 swap,i = Indx[Obj.GetId()] 4836 RMCPdict['Swaps'][swap][i] = Obj.GetStringSelection() 4837 4838 atChoice = RMCPdict['atSeq'] 4839 swapSizer = wx.FlexGridSizer(4,5,5) 4840 swapLabels = [' ','Atom-A','Atom-B',' Swap prob.'] 4841 for lab in swapLabels: 4842 swapSizer.Add(wx.StaticText(G2frame.FRMC,label=lab),0,WACV) 4843 for ifx,swap in enumerate(RMCPdict['Swaps']): 4844 delBtn = wx.Button(G2frame.FRMC,label='Delete') 4845 delBtn.Bind(wx.EVT_BUTTON,OnDelSwap) 4846 Indx[delBtn.GetId()] = ifx 4847 swapSizer.Add(delBtn,0,WACV) 4848 for i in [0,1]: 4849 atmSel = wx.ComboBox(G2frame.FRMC,choices=atChoice,style=wx.CB_DROPDOWN|wx.TE_READONLY) 4850 atmSel.SetStringSelection(swap[i]) 4851 atmSel.Bind(wx.EVT_COMBOBOX,OnSwapAtSel) 4852 Indx[atmSel.GetId()] = [ifx,i] 4853 swapSizer.Add(atmSel,0,WACV) 4854 swapSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,swap,2,min=0.,max=1.,size=(50,25)),0,WACV) 4855 return swapSizer 4856 4817 4857 Indx = {} 4818 4858 … … 4828 4868 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' NB: be sure to set cations first && anions last in atom ordering'),0,WACV) 4829 4869 mainSizer.Add(GetAtmChoice(),0,WACV) 4870 4871 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 4872 swapBox = wx.BoxSizer(wx.HORIZONTAL) 4873 swapAdd = wx.Button(G2frame.FRMC,label='Add') 4874 swapAdd.Bind(wx.EVT_BUTTON,OnAddSwap) 4875 swapBox.Add(swapAdd,0,WACV) 4876 swapBox.Add(wx.StaticText(G2frame.FRMC,label=' Atom swap probabiities: '),0,WACV) 4877 mainSizer.Add(swapBox,0,WACV) 4878 if len(RMCPdict['Swaps']): 4879 mainSizer.Add(GetSwapSizer(),0,WACV) 4830 4880 4831 4881 G2G.HorizontalLine(mainSizer,G2frame.FRMC) … … 4996 5046 PWId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,RMCPdict['histogram'][0]) 4997 5047 if PWId: 5048 reset = False 4998 5049 print(G2pwd.MakeInst(G2frame,pName,data,RMCPdict['UseSampBrd'],PWId)+ ' written') 4999 5050 backfile = G2pwd.MakeBack(G2frame,pName,PWId) … … 5010 5061 if os.path.isfile(pName+'.his6f'): 5011 5062 os.remove(pName+'.his6f') 5012 print(G2pwd.MakeRMC6f(G2frame,pName,data,RMCPdict,PWId)+ ' written') 5063 RMC6f,reset = G2pwd.MakeRMC6f(G2frame,pName,data,RMCPdict,PWId) 5064 print(RMC6f+ ' written') 5013 5065 print(G2pwd.MakeRMCPdat(G2frame,pName,data,RMCPdict,PWId)+ ' written') 5014 5066 print('RMCProfile file build completed') 5015 5067 RMCPdict['ReStart'] = [False,False] 5068 if reset: 5069 wx.MessageDialog(G2frame,' Vacancies found & "Va" atoms added to list. '+ \ 5070 'You may need to revise RMCProfile setup parameters.','Repeat Setup RMC',wx.OK).ShowModal() 5071 wx.CallAfter(UpdateRMC) 5016 5072 else: 5017 5073 print('RMCProfile file build failed - no histogram selected') … … 10581 10637 print ('clear texture? - does nothing') 10582 10638 10639 ############################################################################### 10640 ##### Phase page routines 10641 ############################################################################### 10642 10583 10643 def FillSelectPageMenu(TabSelectionIdDict, menuBar): 10584 10644 '''Fill "Select tab" menu with menu items for each tab and assign
Note: See TracChangeset
for help on using the changeset viewer.