- Timestamp:
- Apr 20, 2020 7:23:39 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r4404 r4405 4412 4412 return atmChoice 4413 4413 4414 def GetSwapSizer(RMCPdict): 4415 4416 def OnDelSwap(event): 4417 Obj = event.GetEventObject() 4418 swap = Indx[Obj.GetId()] 4419 del RMCPdict['Swaps'][swap] 4420 wx.CallAfter(UpdateRMC) 4421 4422 def OnSwapAtSel(event): 4423 Obj = event.GetEventObject() 4424 swap,i = Indx[Obj.GetId()] 4425 RMCPdict['Swaps'][swap][i] = Obj.GetStringSelection() 4426 4427 Indx = {} 4428 atChoice = RMCPdict['atSeq'] 4429 swapSizer = wx.FlexGridSizer(4,5,5) 4430 swapLabels = [' ','Atom-A','Atom-B',' Swap prob.'] 4431 for lab in swapLabels: 4432 swapSizer.Add(wx.StaticText(G2frame.FRMC,label=lab),0,WACV) 4433 for ifx,swap in enumerate(RMCPdict['Swaps']): 4434 delBtn = wx.Button(G2frame.FRMC,label='Delete') 4435 delBtn.Bind(wx.EVT_BUTTON,OnDelSwap) 4436 Indx[delBtn.GetId()] = ifx 4437 swapSizer.Add(delBtn,0,WACV) 4438 for i in [0,1]: 4439 atmSel = wx.ComboBox(G2frame.FRMC,choices=atChoice,style=wx.CB_DROPDOWN|wx.TE_READONLY) 4440 atmSel.SetStringSelection(swap[i]) 4441 atmSel.Bind(wx.EVT_COMBOBOX,OnSwapAtSel) 4442 Indx[atmSel.GetId()] = [ifx,i] 4443 swapSizer.Add(atmSel,0,WACV) 4444 swapSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,swap,2,min=0.,max=1.,size=(50,25)),0,WACV) 4445 return swapSizer 4446 4447 def GetPairSizer(RMCdict): 4448 pairSizer = wx.FlexGridSizer(len(RMCPdict['Pairs'])+1,5,5) 4449 pairSizer.Add((5,5),0) 4450 for pair in RMCPdict['Pairs']: 4451 pairSizer.Add(wx.StaticText(G2frame.FRMC,label=pair),0,WACV) 4452 if G2frame.RMCchoice == 'RMCProfile': 4453 pairSizer.Add(wx.StaticText(G2frame.FRMC,label='%14s'%' Hard min: '),0,WACV) 4454 for pair in RMCPdict['Pairs']: 4455 pairSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Pairs'][pair],0,min=0.,max=10.,size=(50,25)),0,WACV) 4456 pairSizer.Add(wx.StaticText(G2frame.FRMC,label='%14s'%' Search from: '),0,WACV) 4457 for pair in RMCPdict['Pairs']: 4458 pairSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Pairs'][pair], 4459 1,min=0.,max=10.,size=(50,25)),0,WACV) 4460 pairSizer.Add(wx.StaticText(G2frame.FRMC,label='%14s'%'to: '),0,WACV) 4461 for pair in RMCPdict['Pairs']: 4462 pairSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Pairs'][pair],2,min=0.,max=10.,size=(50,25)),0,WACV) 4463 return pairSizer 4464 4414 4465 def FileSizer(RMCdict): 4415 4466 … … 4557 4608 data['RMC']['fullrmc'] = {'SuperCell':[1,1,1],'Box':[10.,10.,10.],'aTypes':aTypes,'byMolec':False, 4558 4609 'Natoms':1,'atSeq':atSeq,'Pairs':Pairs,'files':files,'ReStart':[False,False], 4559 'Swaps':[],'useBVS':False,'FitScale':False,'AveCN':[],'FxCN':[], 4610 'Swaps':[],'useBVS':False,'FitScale':False,'AveCN':[],'FxCN':[],'Angles':[],'Angle Weight':1.e-5, 4560 4611 'moleculePdb':'Select','targetDensity':1.0,'maxRecursion':10000, 4561 4612 'atomPDB':''} … … 4585 4636 def OnReStart(event): 4586 4637 RMCPdict['ReStart'][0] = not RMCPdict['ReStart'][0] 4638 4639 def OnAddSwap(event): 4640 RMCPdict['Swaps'].append(['','',0.0,]) 4641 wx.CallAfter(UpdateRMC) 4587 4642 4588 4643 def OnPdbButton(event): … … 4627 4682 dlg.Destroy() 4628 4683 4684 def OnAddAngle(event): 4685 RMCPdict['Angles'].append(['','','',0.,0.]) 4686 wx.CallAfter(UpdateRMC) 4687 4688 def GetAngleSizer(): 4689 4690 def OnDelAngle(event): 4691 Obj = event.GetEventObject() 4692 angle = Indx[Obj.GetId()] 4693 del RMCPdict['Angles'][angle] 4694 wx.CallAfter(UpdateRMC) 4695 4696 def OnAngleAtSel(event): 4697 Obj = event.GetEventObject() 4698 angle,i = Indx[Obj.GetId()] 4699 RMCPdict['Angles'][angle][i] = Obj.GetStringSelection() 4700 4701 def SetRestart1(invalid,value,tc): 4702 RMCPdict['ReStart'][1] = True 4703 4704 Indx = {} 4705 atChoice = RMCPdict['atSeq'] 4706 angleSizer = wx.FlexGridSizer(6,5,5) 4707 fxcnLabels = [' ','Atom-A','Atom-B','Atom-C',' min angle',' max angle'] 4708 for lab in fxcnLabels: 4709 angleSizer.Add(wx.StaticText(G2frame.FRMC,label=lab),0,WACV) 4710 for ifx,angle in enumerate(RMCPdict['Angles']): 4711 delBtn = wx.Button(G2frame.FRMC,label='Delete') 4712 delBtn.Bind(wx.EVT_BUTTON,OnDelAngle) 4713 Indx[delBtn.GetId()] = ifx 4714 angleSizer.Add(delBtn,0,WACV) 4715 for i in [0,1,2]: 4716 atmSel = wx.ComboBox(G2frame.FRMC,choices=atChoice,style=wx.CB_DROPDOWN|wx.TE_READONLY) 4717 atmSel.SetStringSelection(angle[i]) 4718 atmSel.Bind(wx.EVT_COMBOBOX,OnAngleAtSel) 4719 Indx[atmSel.GetId()] = [ifx,i] 4720 angleSizer.Add(atmSel,0,WACV) 4721 angleSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,angle,3,min=0.,max=180.,OnLeave=SetRestart1,size=(50,25)),0,WACV) 4722 angleSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,angle,4,min=0.,max=180.,OnLeave=SetRestart1,size=(50,25)),0,WACV) 4723 return angleSizer 4629 4724 #patches 4630 4725 if 'useBVS' not in RMCPdict: … … 4640 4735 if 'atomPDB' not in RMCPdict: 4641 4736 RMCPdict['atomPDB'] = '' 4737 if 'Angles' not in RMCPdict: 4738 RMCPdict.update({'Angles':[],'Angle Weight':1.e-5,'Bond Weight':1.e-5,'Torsions':[],'Torsion Weight':1.e-5}) 4642 4739 #end patches 4643 4740 … … 4690 4787 4691 4788 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 4789 swapBox = wx.BoxSizer(wx.HORIZONTAL) 4790 swapAdd = wx.Button(G2frame.FRMC,label='Add') 4791 swapAdd.Bind(wx.EVT_BUTTON,OnAddSwap) 4792 swapBox.Add(swapAdd,0,WACV) 4793 swapBox.Add(wx.StaticText(G2frame.FRMC,label=' Atom swap probabiities: '),0,WACV) 4794 mainSizer.Add(swapBox,0,WACV) 4795 if len(RMCPdict['Swaps']): 4796 mainSizer.Add(GetSwapSizer(RMCPdict),0,WACV) 4797 4798 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 4799 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' Enter constraints && restraints:'),0,WACV) 4800 distBox = wx.BoxSizer(wx.HORIZONTAL) 4801 distBox.Add(wx.StaticText(G2frame.FRMC,label=' Distance constraints, weight: :'),0,WACV) 4802 distBox.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict,'Bond Weight',min=0.,max=100.,size=(50,25)),0,WACV) 4803 mainSizer.Add(distBox,0,WACV) 4804 mainSizer.Add(GetPairSizer(RMCPdict),0,WACV) 4805 4806 angBox = wx.BoxSizer(wx.HORIZONTAL) 4807 angAdd = wx.Button(G2frame.FRMC,label='Add') 4808 angAdd.Bind(wx.EVT_BUTTON,OnAddAngle) 4809 angBox.Add(angAdd,0,WACV) 4810 angBox.Add(wx.StaticText(G2frame.FRMC,label=' A-B-C angle restraints, weight: '),0,WACV) 4811 angBox.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict,'Angle Weight',min=0.,max=100.,size=(50,25)),0,WACV) 4812 mainSizer.Add(angBox,0,WACV) 4813 if len(RMCPdict['Angles']): 4814 mainSizer.Add(GetAngleSizer(),0,WACV) 4815 4816 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 4692 4817 mainSizer.Add(FileSizer(RMCPdict),0,WACV) 4693 4818 … … 4795 4920 return superSizer 4796 4921 4797 def GetPairSizer():4798 pairSizer = wx.FlexGridSizer(len(RMCPdict['Pairs'])+1,5,5)4799 pairSizer.Add((5,5),0)4800 for pair in RMCPdict['Pairs']:4801 pairSizer.Add(wx.StaticText(G2frame.FRMC,label=pair),0,WACV)4802 pairSizer.Add(wx.StaticText(G2frame.FRMC,label='%14s'%' Hard min: '),0,WACV)4803 for pair in RMCPdict['Pairs']:4804 pairSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Pairs'][pair],0,min=0.,max=10.,size=(50,25)),0,WACV)4805 pairSizer.Add(wx.StaticText(G2frame.FRMC,label='%14s'%' Search from: '),0,WACV)4806 for pair in RMCPdict['Pairs']:4807 pairSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Pairs'][pair],4808 1,min=0.,max=10.,size=(50,25)),0,WACV)4809 pairSizer.Add(wx.StaticText(G2frame.FRMC,label='%14s'%'to: '),0,WACV)4810 for pair in RMCPdict['Pairs']:4811 pairSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Pairs'][pair],2,min=0.,max=10.,size=(50,25)),0,WACV)4812 return pairSizer4813 4814 4922 def GetBvsSizer(): 4815 4923 … … 4994 5102 return bondSizer 4995 5103 4996 def GetSwapSizer():4997 4998 def OnDelSwap(event):4999 Obj = event.GetEventObject()5000 swap = Indx[Obj.GetId()]5001 del RMCPdict['Swaps'][swap]5002 wx.CallAfter(UpdateRMC)5003 5004 def OnSwapAtSel(event):5005 Obj = event.GetEventObject()5006 swap,i = Indx[Obj.GetId()]5007 RMCPdict['Swaps'][swap][i] = Obj.GetStringSelection()5008 5009 atChoice = RMCPdict['atSeq']5010 swapSizer = wx.FlexGridSizer(4,5,5)5011 swapLabels = [' ','Atom-A','Atom-B',' Swap prob.']5012 for lab in swapLabels:5013 swapSizer.Add(wx.StaticText(G2frame.FRMC,label=lab),0,WACV)5014 for ifx,swap in enumerate(RMCPdict['Swaps']):5015 delBtn = wx.Button(G2frame.FRMC,label='Delete')5016 delBtn.Bind(wx.EVT_BUTTON,OnDelSwap)5017 Indx[delBtn.GetId()] = ifx5018 swapSizer.Add(delBtn,0,WACV)5019 for i in [0,1]:5020 atmSel = wx.ComboBox(G2frame.FRMC,choices=atChoice,style=wx.CB_DROPDOWN|wx.TE_READONLY)5021 atmSel.SetStringSelection(swap[i])5022 atmSel.Bind(wx.EVT_COMBOBOX,OnSwapAtSel)5023 Indx[atmSel.GetId()] = [ifx,i]5024 swapSizer.Add(atmSel,0,WACV)5025 swapSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,swap,2,min=0.,max=1.,size=(50,25)),0,WACV)5026 return swapSizer5027 5104 5028 5105 Indx = {} … … 5048 5125 mainSizer.Add(swapBox,0,WACV) 5049 5126 if len(RMCPdict['Swaps']): 5050 mainSizer.Add(GetSwapSizer( ),0,WACV)5127 mainSizer.Add(GetSwapSizer(RMCPdict),0,WACV) 5051 5128 5052 5129 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 5053 5130 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' Enter constraints && restraints:'),0,WACV) 5054 5131 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' Set minimum && maximum distances for:'),0,WACV) 5055 mainSizer.Add(GetPairSizer( ),0,WACV)5132 mainSizer.Add(GetPairSizer(RMCPdict),0,WACV) 5056 5133 5057 5134 G2G.HorizontalLine(mainSizer,G2frame.FRMC) … … 5201 5278 if msg != wx.OK: 5202 5279 return 5280 if os.path.isfile('pdbparser_0.log'): 5281 os.remove('pdbparser_0.log') 5203 5282 ilog = 0 5204 5283 while True: … … 8206 8285 for h in data['Histograms']: 8207 8286 PatternId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,h) 8287 if not PatternId: #skip bogus histograms 8288 continue 8208 8289 Inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId,'Instrument Parameters'))[0] 8209 8290 Sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId,'Sample Parameters')) -
trunk/GSASIIpwd.py
r4404 r4405 2503 2503 sfwt = 'xrays' 2504 2504 if 'G(r)' in File: 2505 rundata += ' GofR = PairDistributionConstraint(experimentalData=%s, weighting="%s" \n'%(filDat[0],sfwt)2505 rundata += ' GofR = PairDistributionConstraint(experimentalData=%s, weighting="%s")\n'%(filDat[0],sfwt) 2506 2506 rundata += ' GofR.set_variance_squared(%f)\n'%filDat[1] 2507 2507 rundata += ' ENGINE.add_constraints([GofR])\n' 2508 2508 else: 2509 rundata += ' FofQ = StructureFactorConstraint(experimentalData=%s, weighting="%s" \n'%(filDat[0],sfwt)2509 rundata += ' FofQ = StructureFactorConstraint(experimentalData=%s, weighting="%s")\n'%(filDat[0],sfwt) 2510 2510 rundata += ' FofQ.set_variance_squared(%f)\n'%filDat[1] 2511 2511 rundata += ' ENGINE.add_constraints([FofQ])\n'
Note: See TracChangeset
for help on using the changeset viewer.