Changeset 4221


Ignore:
Timestamp:
Dec 25, 2019 8:27:44 AM (22 months ago)
Author:
vondreele
Message:

more RMCProfile enhancements

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r4220 r4221  
    10881088    '''
    10891089    def __init__(self,parent,Name,Phase):
    1090         title = 'RMCProfile setup'
     1090        title = 'RMCProfile setup for '+Name
    10911091        wx.Dialog.__init__(self,parent,wx.ID_ANY,title,size=(700,500),
    10921092            pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
     
    11051105        self.Pairs = dict(zip(self.Pairs,len(self.Pairs)*[0.0,]))
    11061106        self.histogram = ['',1.0]
     1107        self.RB = ['',0]
    11071108        self.files = {'Neutron real space data; G(r): ':['',0.05,'G(r)','RMC',],
    11081109                      'Neutron reciprocal space data; F(Q): ':['',0.05,'F(Q)','RMC',],
     
    11541155            fil = Indx[Obj.GetId()]
    11551156            self.files[fil][3] = Obj.GetStringSelection()
     1157           
     1158        def OnRBchoice(event):
     1159            self.RB = [rigBod.GetStringSelection(),rigBod.GetSelection()+1]
    11561160       
    11571161        Indx = {}
     
    11591163        self.panel = wxscroll.ScrolledPanel(self,style = wx.DEFAULT_DIALOG_STYLE,size=(700,500))
    11601164        mainSizer = wx.BoxSizer(wx.VERTICAL)
    1161         mainSizer.Add(wx.StaticText(self.panel,label=' Setup for: %s'%self.Name),0,WACV)
     1165        mainSizer.Add(wx.StaticText(self.panel,label=' Enter metadata items:'),0,WACV)
     1166        metalist = ['title','owner','material','phase','comment','source','temperature',]
     1167        metaSizer = wx.FlexGridSizer(0,2,5,5)
     1168        for item in metalist:
     1169            metaSizer.Add(wx.StaticText(self.panel,label=' Metadata item: '+item+' '),0,WACV)
     1170            metaSizer.Add(G2G.ValidatedTxtCtrl(self.panel,self.metadata,item),0,WACV)
     1171        mainSizer.Add(metaSizer,0,WACV)
     1172        mainSizer.Add(wx.StaticText(self.panel,label=' Lattice multipliers:'),0,WACV)
    11621173        superSizer = wx.BoxSizer(wx.HORIZONTAL)
    11631174        axes = ['X','Y','Z']
     
    12351246                fileSizer.Add((5,5),0)
    12361247        mainSizer.Add(fileSizer,0,WACV)
    1237         mainSizer.Add(wx.StaticText(self.panel,label=' Enter metadata items:'),0,WACV)
    1238         metalist = ['title','owner','material','phase','comment','source','temperature',]
    1239         metaSizer = wx.FlexGridSizer(0,2,5,5)
    1240         for item in metalist:
    1241             metaSizer.Add(wx.StaticText(self.panel,label=' Metadata item: '+item+' '),0,WACV)
    1242             metaSizer.Add(G2G.ValidatedTxtCtrl(self.panel,self.metadata,item),0,WACV)
    1243         mainSizer.Add(metaSizer,0,WACV)
     1248       
     1249        RBchoice = ['SiO2','SrTiO3','CD4','SF6','AlPO4','PZT','ZrP2O7','ZrW2O8',
     1250            'Na3PO4','NaNO3','KCN','AgCN','Zn(CN)2','C4F8']
     1251        RBSizer = wx.BoxSizer(wx.HORIZONTAL)
     1252        RBSizer.Add(wx.StaticText(self.panel,label=' Select rigid body restraint(if any): '),0,WACV)
     1253        rigBod = wx.ComboBox(self.panel,choices=RBchoice,style=wx.CB_DROPDOWN|wx.TE_READONLY)
     1254        rigBod.Bind(wx.EVT_COMBOBOX,OnRBchoice)
     1255        RBSizer.Add(rigBod,0,WACV)
     1256        mainSizer.Add(RBSizer,0,WACV)
    12441257        mainSizer.Add(wx.StaticText(self.panel,label=' WARNING: this can take time - be patient'),0,WACV)
    12451258        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    12581271    def GetData(self):
    12591272        'Returns the values from the dialog'
    1260         return self.SuperCell,self.histogram,self.UseSampBrd,       \
    1261             self.atSeq,self.aTypes,self.Pairs,self.files,self.metadata
     1273        return self.SuperCell,self.histogram,self.UseSampBrd,self.atSeq,self.aTypes,       \
     1274            self.Pairs,self.files,self.RB,self.metadata
    12621275       
    12631276    def OnOK(self,event):
     
    46954708            dlg = SetUpRMCProfileDialog(G2frame,Name=pName,Phase=data)
    46964709            if dlg.ShowModal() == wx.ID_OK:
    4697                 superCell,histoName,useSamBrd,atSeq,aTypes,atPairs,files,meta = dlg.GetData()
     4710                superCell,histoName,useSamBrd,atSeq,aTypes,atPairs,files,rigBod,meta = dlg.GetData()
    46984711                PWId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,histoName[0])
    46994712                if PWId:
     
    47064719                    print(G2pwd.MakeBragg(G2frame,pName,data,PWId)+ ' written')
    47074720                    print(G2pwd.MakeRMC6f(G2frame,pName,data,meta,atSeq,superCell,PWId)+ ' written')
    4708                     print(G2pwd.MakeRMCPdat(G2frame,pName,data,meta,atSeq,aTypes,atPairs,superCell,files,PWId,histoName[1])+ ' written')
     4721                    print(G2pwd.MakeRMCPdat(G2frame,pName,data,meta,atSeq,aTypes,atPairs,superCell,files,rigBod,PWId,histoName[1])+ ' written')
     4722                    if rigBod:
     4723                        print(' Make rigid body restraint files for %s - TBD'%rigBod)
    47094724                    print('RMCProfile file build completed')
    47104725                else:
  • trunk/GSASIIpwd.py

    r4220 r4221  
    21202120        fl.write('1\n')
    21212121        fl.write('%d\n'%int(inst[prms[0]][1]))
    2122         fl.write('%10.3f%10.3f%10.3f%10.3f\n'%(inst[prms[1]][1],inst[prms[2]][1],inst[prms[3]][1],inst[prms[4]][1]))
    2123         fl.write('%10.3f%10.6f%10.6f\n'%(inst[prms[5]][1],inst[prms[6]][1],inst[prms[7]][1]))
    2124         fl.write('%10.3f%10.3f%10.3f\n'%(inst[prms[8]][1],inst[prms[9]][1],inst[prms[10]][1]))   
    2125         fl.write('%10.4f%10.3f%10.3f%10.3f%10.3f\n'%(inst[prms[11]][1],inst[prms[12]][1]+Xsb,inst[prms[13]][1]+Ysb,0.0,0.0))
     2122        fl.write('%19.11f%19.11f%19.11f%19.11f\n'%(inst[prms[1]][1],inst[prms[2]][1],inst[prms[3]][1],inst[prms[4]][1]))
     2123        fl.write('%12.6e%14.6e%14.6e\n'%(inst[prms[5]][1],inst[prms[6]][1],inst[prms[7]][1]))
     2124        fl.write('%12.6e%14.6e%14.6e\n'%(inst[prms[8]][1],inst[prms[9]][1],inst[prms[10]][1]))   
     2125        fl.write('%12.6e%14.6e%14.6e%14.6e%14.6e\n'%(inst[prms[11]][1],inst[prms[12]][1]+Ysb,inst[prms[13]][1]+Xsb,0.0,0.0))
    21262126        fl.close()
    21272127    else:
     
    22432243    return fname
    22442244
    2245 def MakeRMCPdat(G2frame,Name,Phase,Meta,Atseq,Atypes,atPairs,Supercell,Files,PWId,BraggWt):
     2245def MakeRMCPdat(G2frame,Name,Phase,Meta,Atseq,Atypes,atPairs,Supercell,Files,rigBod,PWId,BraggWt):
    22462246    PWDdata = G2frame.GetPWDRdatafromTree(PWId)
    22472247    inst = PWDdata['Instrument Parameters'][0]
     
    22692269    fname = Name+'.dat'
    22702270    fl = open(fname,'w')
    2271     fl.write(' %% hand edit the following as needed\n')
     2271    fl.write(' %% Hand edit the following as needed\n')
    22722272    fl.write('TITLE :: '+Name+'\n')
    22732273    fl.write('MATERIAL :: '+Meta['material']+'\n')
     
    23032303            fl.write('  > END_POINT :: 3000\n')
    23042304            fl.write('  > CONSTANT_OFFSET 0.000\n')
     2305            fl.write('  > NO_FITTED_OFFSET\n')
     2306            if Files[File][3] !='RMC':
     2307                fl.write('  > %s\n'%Files[File][3])
    23052308            fl.write('  > WEIGHT :: %.4f\n'%Files[File][1])
    23062309            if 'reciprocal' in File:
    23072310                fl.write('  > CONVOLVE ::\n')
    23082311                fl.write('  > NO_FITTED_SCALE\n')
    2309             fl.write('  > NO_FITTED_OFFSET\n')
    2310             if Files[File][3] !='RMC':
    2311                 fl.write('  > %s\n'%Files[File][3])
     2312                if 'Xray' in File:
     2313                    fl.write('  > REAL_SPACE_FIT :: 1 3000 1\n')
     2314                    fl.write('  > REAL_SPACE_PARAMETERS :: 1 3000 %.4f\n'%Files[File][1])
    23122315    fl.write('BRAGG ::\n')
    23132316    fl.write('  > BRAGG_SHAPE :: %s\n'%gsasType)
     
    23162319    fl.write('  > WEIGHT :: %10.3f\n'%BraggWt)
    23172320    fl.write('\n')
     2321    if rigBod[1]:
     2322        fl.write('  %% future? POLYHEDRAL_RESTRAINT ::  %d\n'%rigBod[1])
     2323    fl.write('\n')
    23182324    fl.write('END  ::\n')
    23192325    fl.close()
    2320     return fname
    2321    
     2326    return fname   
    23222327
    23232328def MakePDB(G2frame,Name,Phase,Atseq,Supercell):
Note: See TracChangeset for help on using the changeset viewer.