Changeset 5054
- Timestamp:
- Oct 27, 2021 2:18:24 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r5051 r5054 6316 6316 G2G.Define_wxId('wxID_FOURCALC', 'wxID_FOURSEARCH', 'wxID_FOURCLEAR','wxID_CHARGEFLIP','wxID_VALIDPROTEIN', 6317 6317 'wxID_MULTIMCSA','wxID_SINGLEMCSA', 'wxID_4DCHARGEFLIP', 'wxID_TRANSFORMSTRUCTURE','wxID_USEBILBAOMAG', 6318 'wxID_COMPARESTRUCTURE', )6318 'wxID_COMPARESTRUCTURE','wxID_ISODISTORT') 6319 6319 self.DataGeneral = wx.MenuBar() 6320 6320 self.PrefillDataMenu(self.DataGeneral) … … 6331 6331 self.GeneralCalc.Append(G2G.wxID_MULTIMCSA,'Multi MC/SA','Run Monte Carlo - Simulated Annealing on multiprocessors') 6332 6332 self.GeneralCalc.Append(G2G.wxID_TRANSFORMSTRUCTURE,'Transform','Transform crystal structure') 6333 self.GeneralCalc.Append(G2G.wxID_ISODISTORT,'Run ISODISTORT','Run ISODISTORT for PDFfit constraints') 6333 6334 self.GeneralCalc.Append(G2G.wxID_COMPARESTRUCTURE,'Compare','Compare polyhedra to ideal octahedra/tetrahedra') 6334 6335 self.GeneralCalc.Enable(G2G.wxID_COMPARESTRUCTURE,False) … … 6433 6434 6434 6435 #Phase / fullrmc & RMCprofile (Reverse Monte Carlo method) tab 6435 G2G.Define_wxId('wxID_SETUPRMC','wxID_RUNRMC','wxID_VIEWRMC', 6436 'wxID_STOPRMC', 'wxID_ISODISTORT') 6436 G2G.Define_wxId('wxID_SETUPRMC','wxID_RUNRMC','wxID_VIEWRMC','wxID_STOPRMC', ) 6437 6437 self.FRMCMenu = wx.MenuBar() 6438 6438 self.PrefillDataMenu(self.FRMCMenu) … … 6444 6444 self.FRMCDataEdit.Append(G2G.wxID_STOPRMC,'Stop run','Stop fullrmc run') 6445 6445 self.FRMCDataEdit.Append(G2G.wxID_VIEWRMC,'Plot','View fullrmc or RMCprofile results') 6446 self.FRMCDataEdit.Append(G2G.wxID_ISODISTORT,'Run ISODISTORT','Run ISODISTORT for PDFfit constraints')6447 6446 self.PostfillDataMenu() 6448 6447 6448 # Phase/ ISODISTORT tab 6449 G2G.Define_wxId('wxID_ISODNEWPHASE',) 6450 self.ISODData = wx.MenuBar() 6451 self.PrefillDataMenu(self.ISODData) 6452 self.ISODData.Append(menu=wx.Menu(title=''),title='Select tab') 6453 self.ISODDataEdit = wx.Menu(title='') 6454 self.ISODData.Append(menu=self.ISODDataEdit, title='Operations') 6455 self.ISODDataEdit.Append(G2G.wxID_ISODNEWPHASE,'Make new phase','From ISODISTORT cif file') 6456 self.PostfillDataMenu() 6457 6449 6458 # Phase / Layer tab 6450 6459 G2G.Define_wxId('wxID_LOADDIFFAX', 'wxID_LAYERSIMULATE', 'wxID_SEQUENCESIMULATE', 'wxID_LAYERSFIT', 'wxID_COPYPHASE',) -
trunk/GSASIIphsGUI.py
r5050 r5054 2912 2912 G2cnstG.TransConstraints(G2frame,data,newPhase,Trans,Vvec,atCodes) #data is old phase 2913 2913 G2frame.GPXtree.SelectItem(sub) 2914 2915 def OnRunISODISTORT(event): 2916 import ISODISTORT as ISO 2917 dlg = wx.FileDialog(General, 'Choose parent cif file for ISODISTORT',G2G.GetImportPath(G2frame), 2918 style=wx.FD_OPEN ,wildcard='(*.cif)|*.cif') 2919 if dlg.ShowModal() == wx.ID_OK: 2920 fpath,parentcif = os.path.split(dlg.GetPath()) 2921 radio,rundata = ISO.GetISODISTORT(data,parentcif) 2922 data['ISODISTORT']['radio'] = radio 2923 data['ISODISTORT']['rundata'] = rundata 2924 data['ISODISTORT']['SGselect'] = {'Tric':True,'Mono':True,'Orth':True,'Tetr':True,'Trig':True,'Hexa':True,'Cubi':True} 2925 data['ISODISTORT']['selection'] = None 2926 print('ISODISTORT run complete') 2927 UpdateISODISTORT() 2928 else: 2929 print('ISODISTORT run cancelled') 2914 2930 2915 2931 def OnCompare(event): … … 5797 5813 return parmSizer 5798 5814 5815 def OnSpaceGroup(event): 5816 # try a lookup on the user-supplied name 5817 SpcGp = GetSpGrpfromUser(G2frame.FRMC,SpGrp) 5818 SGErr,SGData = G2spc.SpcGroup(SpcGp) 5819 if SGErr: 5820 text = [G2spc.SGErrors(SGErr)+'\nSpace Group set to previous'] 5821 SGTxt.SetLabel(RMCPdict.get('Target SpGrp','P 1')) 5822 msg = 'Space Group Error' 5823 Text = '\n'.join(text) 5824 wx.MessageBox(Text,caption=msg,style=wx.ICON_EXCLAMATION) 5825 else: 5826 text,table = G2spc.SGPrint(SGData) 5827 RMCPdict['SGData'] = SGData 5828 SGTxt.SetLabel(RMCPdict['SGData']['SpGrp']) 5829 msg = 'Target Space Group Information' 5830 G2G.SGMessageBox(G2frame.FRMC,msg,text,table).Show() 5831 G2spc.UpdateSytSym(data) 5832 5833 def OnCellRef(event): 5834 RMCPdict['cellref'] = not RMCPdict['cellref'] 5835 5836 def AtomSizer(): 5837 return None 5838 5839 5799 5840 subSizer = wx.BoxSizer(wx.HORIZONTAL) 5800 5841 subSizer.Add((-1,-1),1,wx.EXPAND) … … 5810 5851 mainSizer.Add((5,5)) 5811 5852 if 'PDFfit' not in data['RMC']: 5812 Atypes = [atype.split('+')[0].split('-')[0] for atype in data['General']['AtomTypes']] 5813 aTypes = dict(zip(Atypes,len(Atypes)*[0.10,])) 5853 SGData = G2spc.SpcGroup('P 1')[1] 5814 5854 metadata = {'title':'none','date':str(time.ctime()),'temperature':'300K', 5815 5855 'doping':0} … … 5818 5858 data['RMC']['PDFfit'] = {'files':files,'ReStart':[False,False],'metadata':metadata, 5819 5859 'delta1':[0.,False],'delta2':[0.,False],'spdiameter':[0.,False], 5820 'sratio':[1.,False],'rcut':0.0,'stepcut':0.0,'shape':'sphere', 5860 'sratio':[1.,False],'rcut':0.0,'stepcut':0.0,'shape':'sphere','SGData':SGData,'cellref':False, 5821 5861 'Xdata':{'dscale':[1.0,False],'Datarange':[0.,30.],'Fitrange':[0.,30.],'qdamp':[0.03,False],'qbroad':[0,False]}, 5822 5862 'Ndata':{'dscale':[1.0,False],'Datarange':[0.,30.],'Fitrange':[0.,30.],'qdamp':[0.03,False],'qbroad':[0,False]},} 5823 5863 5824 5864 RMCPdict = data['RMC']['PDFfit'] 5865 #patch 5866 if 'SGData' not in RMCPdict: 5867 RMCPdict['SGData'] = G2spc.SpcGroup('P 1')[1] 5868 if 'cellref' not in RMCPdict: 5869 RMCPdict['cellref'] = False 5870 #end patch 5825 5871 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' Enter metadata items:'),0) 5826 5872 mainSizer.Add(GetMetaSizer(RMCPdict,['title','date','temperature','doping']),0) 5827 5873 5828 5874 G2G.HorizontalLine(mainSizer,G2frame.FRMC) 5829 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' PDF phase profile coefficients:'),0,WACV) 5875 SgSizer = wx.BoxSizer(wx.HORIZONTAL) 5876 SgSizer.Add(wx.StaticText(G2frame.FRMC,label=' Target space group: '),0,WACV) 5877 5878 mainSizer.Add(wx.StaticText(G2frame.FRMC,label='PDFfit phase structure parameters:'),0,WACV) 5879 5880 SpGrp = RMCPdict['SGData']['SpGrp'] 5881 SGTxt = wx.Button(G2frame.FRMC,wx.ID_ANY,SpGrp,size=(100,-1)) 5882 SGTxt.Bind(wx.EVT_BUTTON,OnSpaceGroup) 5883 SgSizer.Add(SGTxt,0,WACV) 5884 mainSizer.Add(SgSizer,0,WACV) 5885 5886 cellref = wx.CheckBox(G2frame.FRMC,label=' Refine unit cell?') 5887 cellref.SetValue(RMCPdict['cellref']) 5888 cellref.Bind(wx.EVT_CHECKBOX,OnCellRef) 5889 mainSizer.Add(cellref,0,WACV) 5890 5891 mainSizer.Add(wx.StaticText(G2frame.FRMC,label='PDFfit atom parameters:'),0,WACV) 5892 mainSizer.Add(AtomSizer()) 5893 5894 mainSizer.Add(wx.StaticText(G2frame.FRMC,label=' PDFfit phase profile coefficients:'),0,WACV) 5830 5895 mainSizer.Add(PDFParmSizer(),0) 5831 5896 … … 5946 6011 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,True) 5947 6012 RMCPdict = data['RMC']['PDFfit'] 5948 title = RMCPdict['metadata']['title']5949 6013 G2pwd.MakePDFfitAtomsFile(data,RMCPdict) 5950 6014 G2pwd.MakePDFfitRunFile(data,RMCPdict) … … 6547 6611 lines=False,names=['G(R) obs','G(R) calc','diff',]) 6548 6612 6549 def OnRunISODISTORT(event): 6613 6614 #### ISOTDISTORT results tab ############################################################################### 6615 6616 def UpdateISODISTORT(Scroll=0): 6617 ''' Present the results of an ISODISTORT run & allow selection of a distortion model for PDFfit 6618 & refinement constraints 6619 ''' 6620 def OnLaue(event): 6621 Obj = event.GetEventObject() 6622 name = Indx[Obj.GetId()] 6623 data['ISODISTORT']['SGselect'][name[:4]] = not data['ISODISTORT']['SGselect'][name[:4]] 6624 data['ISODISTORT']['selection'] = None 6625 UpdateISODISTORT() 6626 6627 def OnAllBtn(event): 6628 for item in data['ISODISTORT']['SGselect']: 6629 data['ISODISTORT']['SGselect'][item] = not data['ISODISTORT']['SGselect'][item] 6630 data['ISODISTORT']['selection'] = None 6631 UpdateISODISTORT() 6632 6633 def CheckItem(item): 6634 SGnum = int(item.split()[1].split('*')[0]) 6635 for SGtype in data['ISODISTORT']['SGselect']: 6636 if data['ISODISTORT']['SGselect'][SGtype] and SGnum in SGrange[SGtype]: 6637 return True 6638 return False 6639 6640 def OnSelect(event): 6641 r,c = event.GetRow(),event.GetCol() 6642 if c == 0: 6643 data['ISODISTORT']['selection'] = [r,isoTable.GetValue(r,1)] 6644 for row in range(isoGrid.GetNumberRows()): 6645 isoTable.SetValue(row,c,False) 6646 isoTable.SetValue(r,c,True) 6647 isoGrid.ForceRefresh() 6648 6649 if not data['ISODISTORT']: 6650 return 6651 if ISODIST.GetSizer(): 6652 ISODIST.GetSizer().Clear(True) 6653 SGrange = {'Cubi':np.arange(195,231),'Hexa':np.arange(168,195),'Trig':np.arange(143,168),'Tetr':np.arange(75,143), 6654 'Orth':np.arange(16,75),'Mono':np.arange(3,16),'Tric':np.arange(1,3)} 6655 colLabels = ['select',' ISODISTORT order parameter direction description'] 6656 colTypes = [wg.GRID_VALUE_BOOL,wg.GRID_VALUE_STRING,] 6657 mainSizer = wx.BoxSizer(wx.VERTICAL) 6658 topSizer = wx.BoxSizer(wx.VERTICAL) 6659 bottomSizer = wx.BoxSizer(wx.VERTICAL) 6660 topSizer.Add(wx.StaticText(ISODIST,label=' ISODISTORT distortion search results:'),0,WACV) 6661 topSizer.Add(wx.StaticText(ISODIST,label=''' 6662 For use of ISODISTORT, please cite: 6663 H. T. Stokes, D. M. Hatch, and B. J. Campbell, ISODISTORT, ISOTROPY Software Suite, iso.byu.edu. 6664 B. J. Campbell, H. T. Stokes, D. E. Tanner, and D. M. Hatch, "ISODISPLACE: An Internet Tool for Exploring Structural Distortions." 6665 J. Appl. Cryst. 39, 607-614 (2006). 6666 '''),0,WACV) 6667 topSizer.Add(wx.StaticText(ISODIST,label=' Subset selection if desired:')) 6668 laueName = ['Cubic','Hexagonal','Trigonal','Tetragonal','Orthorhombic','Monoclinic','Triclinic'] 6669 littleSizer = wx.FlexGridSizer(0,8,5,5) 6670 Indx = {} 6671 for name in laueName: 6672 laueCk = wx.CheckBox(ISODIST,label=name) 6673 Indx[laueCk.GetId()] = name 6674 laueCk.SetValue(data['ISODISTORT']['SGselect'][name[:4]]) 6675 laueCk.Bind(wx.EVT_CHECKBOX,OnLaue) 6676 littleSizer.Add(laueCk,0,WACV) 6677 allBtn = wx.Button(ISODIST,label='Toggle all') 6678 allBtn.Bind(wx.EVT_BUTTON,OnAllBtn) 6679 littleSizer.Add(allBtn) 6680 topSizer.Add(littleSizer) 6681 6682 mainSizer.Add(topSizer) 6683 6684 if 'radio' in data['ISODISTORT']: 6685 Radio = data['ISODISTORT']['radio'] 6686 rowLabels = [] 6687 table = [] 6688 for i,item in enumerate(Radio): 6689 if CheckItem(Radio[item]): 6690 if data['ISODISTORT']['selection'] and data['ISODISTORT']['selection'][0] == i: 6691 table.append([True,Radio[item]]) 6692 else: 6693 table.append([False,Radio[item]]) 6694 rowLabels.append(str(i)) 6695 isoTable = G2G.Table(table,rowLabels=rowLabels,colLabels=colLabels,types=colTypes) 6696 isoGrid = G2G.GSGrid(ISODIST) 6697 isoGrid.SetTable(isoTable,True,useFracEdit=False) 6698 isoGrid.AutoSizeColumns(True) 6699 isoGrid.SetColLabelAlignment(wx.ALIGN_LEFT,wx.ALIGN_CENTRE) 6700 bottomSizer.Add(isoGrid) 6701 attr = wg.GridCellAttr() 6702 attr.SetReadOnly(True) 6703 attr.SetBackgroundColour(VERY_LIGHT_GREY) 6704 isoGrid.SetColAttr(1,attr) 6705 isoGrid.Bind(wg.EVT_GRID_CELL_LEFT_CLICK, OnSelect) 6706 mainSizer.Add(bottomSizer) 6707 SetPhaseWindow(ISODIST,mainSizer,Scroll=Scroll) 6708 6709 def OnNewISOPhase(event): 6710 ''' Make cif file with ISODISTORT 6711 ''' 6550 6712 import ISODISTORT as ISO 6551 ISO.GetISODISTORT(data) 6552 print('run ISODISTORT under construction') 6553 6554 6555 6713 6714 if data['ISODISTORT']: 6715 CIFfile = ISO.GetISODISTORTcif(data) 6716 print(CIFfile) 6717 else: 6718 print('ERROR-need to run ISODISTORT first - see General/Compute menu') 6719 6720 6721 6556 6722 #### DIFFax Layer Data page ################################################################################ 6557 6723 def UpdateLayerData(Scroll=0): … … 13114 13280 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.FRMCMenu) 13115 13281 UpdateRMC() 13282 elif text == 'ISODISTORT': 13283 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.ISODData) 13284 UpdateISODISTORT() 13116 13285 elif text == 'Draw Options': 13117 13286 G2gd.SetDataMenuBar(G2frame,G2frame.dataWindow.DataDrawOptions) … … 13156 13325 G2frame.Bind(wx.EVT_MENU, OnRunMultiMCSA, id=G2G.wxID_MULTIMCSA) 13157 13326 G2frame.Bind(wx.EVT_MENU, OnTransform, id=G2G.wxID_TRANSFORMSTRUCTURE) 13327 G2frame.Bind(wx.EVT_MENU, OnRunISODISTORT, id=G2G.wxID_ISODISTORT) 13158 13328 G2frame.Bind(wx.EVT_MENU, OnCompare, id=G2G.wxID_COMPARESTRUCTURE) 13159 13329 G2frame.Bind(wx.EVT_MENU, OnUseBilbao, id=G2G.wxID_USEBILBAOMAG) … … 13272 13442 G2frame.Bind(wx.EVT_MENU, OnPeaksDelete, id=G2G.wxID_PEAKSDELETE) 13273 13443 G2frame.Bind(wx.EVT_MENU, OnPeaksClear, id=G2G.wxID_PEAKSCLEAR) 13274 # fullrmc13444 # RMCProfile/fullrmc/PDFfit 13275 13445 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.FRMCMenu) 13276 13446 G2frame.Bind(wx.EVT_MENU, OnSetupRMC, id=G2G.wxID_SETUPRMC) … … 13278 13448 G2frame.Bind(wx.EVT_MENU, OnViewRMC, id=G2G.wxID_VIEWRMC) 13279 13449 G2frame.Bind(wx.EVT_MENU, OnStopRMC, id=G2G.wxID_STOPRMC) 13280 G2frame.Bind(wx.EVT_MENU, On RunISODISTORT, id=G2G.wxID_ISODISTORT)13450 G2frame.Bind(wx.EVT_MENU, OnNewISOPhase, id=G2G.wxID_ISODNEWPHASE) 13281 13451 # MC/SA 13282 13452 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataWindow.MCSAMenu) … … 13368 13538 if 'RMC' not in data: 13369 13539 data['RMC'] = {'RMCProfile':{},'fullrmc':{},'PDFfit':{}} 13540 if 'ISODISTORT' not in data: 13541 data['ISODISTORT'] = {} 13370 13542 #end patch 13371 13543 … … 13415 13587 RigidBodies.Bind(wx.EVT_CHAR,rbKeyPress) 13416 13588 Pages.append('RB Models') 13589 13417 13590 MapPeaks = G2G.GSGrid(G2frame.phaseDisplay) 13418 13591 # MapPeaks.SetScrollRate(0,0) 13419 13592 G2frame.phaseDisplay.gridList.append(MapPeaks) 13420 13593 G2frame.phaseDisplay.AddPage(MapPeaks,'Map peaks') 13594 13421 13595 if data['General']['doDysnomia']: 13422 13596 G2frame.MEMData = wx.ScrolledWindow(G2frame.phaseDisplay) 13423 13597 G2frame.phaseDisplay.AddPage(G2frame.MEMData,'Dysnomia') 13424 Pages.append('Dysnomia') 13598 Pages.append('Dysnomia') 13599 13425 13600 Pages.append('Map peaks') 13426 13601 if data['General']['Type'] not in ['faulted',] and not data['General']['Modulated']: … … 13431 13606 G2frame.phaseDisplay.AddPage(G2frame.FRMC,'RMC') 13432 13607 Pages.append('RMC') 13608 13609 if data['General']['Type'] == 'nuclear': 13610 ISODIST = wx.ScrolledWindow(G2frame.phaseDisplay) 13611 G2frame.phaseDisplay.AddPage(ISODIST,'ISODISTORT') 13612 Pages.append('ISODISTORT') 13613 13433 13614 Texture = wx.ScrolledWindow(G2frame.phaseDisplay) 13434 13615 G2frame.phaseDisplay.AddPage(Texture,'Texture') -
trunk/GSASIIpwd.py
r5050 r5054 2963 2963 fatm.write('format pdffit\n') 2964 2964 fatm.write('scale 1.000000\n') #fixed 2965 sharp = '%10.6f,%10.6f,%10.6f,%10.6f\n'%(RMCPdict['delta2'][0],RMCPdict['delta1'][0],RMCPdict['sratio'][0],RMCPdict['rcut'][0]) 2965 if RMCPdict['shape'] == 'sphere': 2966 sharp = '%10.6f,%10.6f,%10.6f\n'%(RMCPdict['delta2'][0],RMCPdict['delta1'][0],RMCPdict['sratio'][0]) 2967 else: 2968 sharp = '%10.6f,%10.6f,%10.6f,%10.6f\n'%(RMCPdict['delta2'][0],RMCPdict['delta1'][0],RMCPdict['sratio'][0],RMCPdict['rcut']) 2966 2969 fatm.write('sharp '+sharp) 2967 2970 shape = '' 2968 if RMCPdict['s pdiameter'] > 0.:2969 shape = ' sphere, %10.6f\n'%RMCPdict['spdiameter']2971 if RMCPdict['shape'] == 'sphere' and RMCPdict['spdiameter'][0] > 0.: 2972 shape = ' sphere, %10.6f\n'%RMCPdict['spdiameter'][0] 2970 2973 elif RMCPdict['stepcut'] > 0.: 2971 2974 shape = 'stepcut, %10.6f\n'%RMCPdict['stepcut'] … … 2991 2994 2992 2995 def MakePDFfitRunFile(Phase,RMCPdict): 2993 '''Make the PDFfit atomsfile2996 '''Make the PDFfit python run file 2994 2997 ''' 2995 print(RMCPdict) 2998 2999 def GetCellConstr(SGData): 3000 if SGData['SGLaue'] in ['m3', 'm3m']: 3001 return [1,1,1,0,0,0] 3002 elif SGData['SGLaue'] in ['3','3m1','31m','6/m','6/mmm','4/m','4/mmm']: 3003 return [1,1,2,0,0,0] 3004 elif SGData['SGLaue'] in ['3R','3mR']: 3005 return [1,1,1,2,2,2] 3006 elif SGData['SGLaue'] == 'mmm': 3007 return [1,2,3,0,0,0] 3008 elif SGData['SGLaue'] == '2/m': 3009 if SGData['SGUniq'] == 'a': 3010 return [1,2,3,4,0,0] 3011 elif SGData['SGUniq'] == 'b': 3012 return [1,2,3,0,4,0] 3013 elif SGData['SGUniq'] == 'c': 3014 return [1,2,3,0,0,4] 3015 else: 3016 return [1,2,3,4,5,6] 3017 2996 3018 General = Phase['General'] 2997 3019 rundata = ''' … … 3000 3022 from diffpy.pdffit2 import PdfFit 3001 3023 pf = PdfFit() 3002 # Load data ------------------------------------------------------------------3003 qmax = 30.0 # Q-cutoff used in PDF calculation in 1/A3004 qdamp = 0.01 # instrument Q-resolution factor, responsible for PDF decay3005 3024 ''' 3006 rundata += "pf.read_data(%s, 'X', qmax, qdamp)\n" 3007 rundata += "pf.read_data(%s, 'N', qmax, qdamp)\n" 3008 rundata += "pf.read_struct(%s)\n" 3025 Nd = 0 3026 Np = 0 3027 for file in RMCPdict['files']: 3028 if 'Neutron' in file: 3029 Nd += 1 3030 dType = 'Ndata' 3031 else: 3032 Nd += 1 3033 dType = 'Xdata' 3034 rundata += "pf.read_data(%s, '%s', 30.0, %.4f)\n"%(dType[0],RMCPdict['files'][file][0],RMCPdict[dType]['qdamp'][0]) 3035 rundata += 'pf.pdfrange(%d, %6.2f, %6.2f\n'%(Nd,RMCPdict[dType]['Fitrange'][0],RMCPdict[dType]['Fitrange'][1]) 3036 rundata += 'pf.setdata(%d)\n'%Nd 3037 for item in ['dscale','qdamp','qbroad']: 3038 rundata += "pf.setvar('%s', %.2f)\n"%(item,RMCPdict[dType][item][0]) 3039 if RMCPdict[dType][item][1]: 3040 Np += 1 3041 rundata += 'pf.constrain("%s","@%d")\n'%(item,Np) 3042 rundata += "pf.read_struct(%s)\n"%(General['Name']+'-PDFfit.stru') 3043 for item in ['delta1','delta2','sratio']: 3044 if RMCPdict[item][1]: 3045 Np += 1 3046 rundata += 'pf.constrain(pf.%s,"@%d")\n'%(item,Np) 3047 if 'sphere' in RMCPdict['shape'][0] and RMCPdict['spdiameter'][1]: 3048 Np += 1 3049 rundata += 'pf.constrain(pf.spdiameter,"@%d")\n'%Np 3050 3051 if RMCPdict['cellref']: 3052 cellconst = GetCellConstr(RMCPdict['SGData']) 3053 for ic in range(6): 3054 if cellconst[ic]: 3055 rundata += 'pf.constrain(pf.lat(%d), "@%d")\n'%(ic+1,Np+cellconst[ic]) 3056 #Atom constraints here ------------------------------------------------------- 3057 3058 3059 3060 # Refine & Save results --------------------------------------------------------------- 3061 rundata += 'pf.refine()\n' 3062 fName = General['Name'].replace(' ','_')+'-PDFfit' 3063 Nd = 0 3064 for file in RMCPdict['files']: 3065 Nd += 1 3066 rundata += 'pf.save_pdf(%d, %s)\n'%(Nd,fName+file[0]+'.fgr') 3067 3068 rundata += 'pf.save_struct(1, %s)\n'%(fName+'.rstr') 3069 rundata += 'pf.save_res(%s)\n'%(fName+'.res') 3070 3071 3072 print(rundata) 3073 3074 3009 3075 3010 fName = General['Name']+'.py' 3011 rfile = open(fName,'w') 3012 rfile.writelines(rundata) 3013 rfile.close() 3076 # rfile = open(fName+.py','w') 3077 # rfile.writelines(rundata) 3078 # rfile.close() 3014 3079 3015 3080
Note: See TracChangeset
for help on using the changeset viewer.