Changeset 5152
- Timestamp:
- Jan 21, 2022 2:55:16 PM (23 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r5147 r5152 4920 4920 Indx = {} 4921 4921 mainSizer = wx.BoxSizer(wx.VERTICAL) 4922 if G2frame.RMCchoice == 'PDFfit' and RMCPdict['refinement'] != 'sequential':4922 if G2frame.RMCchoice == 'PDFfit': 4923 4923 topSizer = wx.BoxSizer(wx.HORIZONTAL) 4924 4924 reftype = wx.RadioBox(G2frame.FRMC,label='PDFfit refinement type:',choices=['normal','sequential']) … … 4996 4996 fileSizer.Add((-1,-1),0) 4997 4997 fileSizer.Add((-1,-1),0) 4998 elif Rfile != 'Select file': # file specified, but must not exist4999 RMCPdict['files'][fil][0] = 'Select file' # set filSel?4998 elif 'Select' not in Rfile: # file specified, but must not exist 4999 RMCPdict['files'][fil][0] = 'Select' # set filSel? 5000 5000 fileSizer.Add(wx.StaticText(G2frame.FRMC, 5001 5001 label='Warning: file not found.\nWill be removed'),0) … … 5003 5003 fileSizer.Add((-1,-1),0) 5004 5004 else: 5005 RMCPdict['files'][fil][0] = 'Select file' # set filSel?5005 RMCPdict['files'][fil][0] = 'Select' # set filSel? 5006 5006 #fileSizer.Add((-1,-1),0) 5007 5007 fileSizer.Add((-1,-1),0) … … 5011 5011 return mainSizer 5012 5012 5013 elif G2frame.RMCchoice == 'PDFfit' and RMCPdict['refinement'] == 'sequential':5013 if G2frame.RMCchoice == 'PDFfit' and RMCPdict['refinement'] == 'sequential': 5014 5014 5015 5015 def OnAddPDF(event): … … 5212 5212 (2016), 37, 1102-1111. doi: https://doi.org/10.1002/jcc.24304 5213 5213 ''')) 5214 if G2pwd.findfullrmc() is None:5215 mainSizer.Add(wx.StaticText(G2frame.FRMC,5216 label="\nsorry, fullrmc not installed or was not located"))5217 return mainSizer5214 # if G2pwd.findfullrmc() is None: 5215 # mainSizer.Add(wx.StaticText(G2frame.FRMC, 5216 # label="\nsorry, fullrmc not installed or was not located")) 5217 # return mainSizer 5218 5218 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_SETUPRMC,True) 5219 5219 G2frame.dataWindow.FRMCDataEdit.Enable(G2G.wxID_RUNRMC,True) … … 5226 5226 Atypes = [atype.split('+')[0].split('-')[0] for atype in data['General']['AtomTypes']] 5227 5227 aTypes = dict(zip(Atypes,len(Atypes)*[0.10,])) 5228 if len(data['RMC']['fullrmc'].get('aTypes', -1)) != len(aTypes):5228 if len(data['RMC']['fullrmc'].get('aTypes',{})) != len(aTypes): 5229 5229 #print('atypes has changed') 5230 5230 atSeq = list(aTypes.keys()) … … 6022 6022 strval = atmGrid.GetCellValue(r,c).strip() 6023 6023 try: 6024 if strval == '' or ('@' in strval and int(strval.split('@')[-1]) >= 20): 6024 # if strval == '' or ('@' in strval and int(strval.split('@')[-1]) >= 20): 6025 if strval == '' or '@' in strval: 6025 6026 RMCPdict['AtomConstr'][r][c+1] = strval 6026 6027 else: … … 6028 6029 except ValueError: 6029 6030 atmGrid.SetCellValue(r,c,RMCPdict['AtomConstr'][r][c+1]) 6030 wx.MessageBox('ERROR - atom constraints must be blank or have "@n" at endwith n >= 20',6031 wx.MessageBox('ERROR - atom constraints must be blank or have "@n" with n >= 20', 6031 6032 style=wx.ICON_ERROR) 6032 6033 … … 6051 6052 atomVarSizer.Add(wx.StaticText(G2frame.FRMC,label=item),0,WACV) 6052 6053 atomVarSizer.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['AtomVar'], 6053 item,xmin=- 1.,xmax=1.,size=(70,25)),0,WACV)6054 item,xmin=-3.,xmax=3.,size=(70,25)),0,WACV) 6054 6055 return atomVarSizer 6055 6056 … … 6319 6320 SeqResult = {'SeqPseudoVars':{},'SeqParFitEqList':[]} 6320 6321 SeqResult['histNames'] = [] #this clears the previous seq. result! 6322 SeqNames = [] 6321 6323 for itm in range(len(RMCPdict['seqfiles'])): 6322 Seq Result['histNames'].append([itm,RMCPdict['seqfiles'][itm][0]])6324 SeqNames.append([itm,RMCPdict['seqfiles'][itm][0]]) 6323 6325 if RMCPdict['SeqReverse']: 6324 Seq Result['histNames'].reverse()6325 nPDF = len(Seq Result['histNames'])6326 SeqNames.reverse() 6327 nPDF = len(SeqNames) 6326 6328 pgbar = wx.ProgressDialog('Sequential PDFfit','PDF G(R) done = 0',nPDF+1, 6327 6329 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT) 6328 6330 newParms = {} 6329 for itm, item in enumerate(SeqResult['histNames']):6330 PDFfile = RMCPdict['seqfiles'][ item[0]]6331 for itm,Item in enumerate(SeqNames): 6332 PDFfile = RMCPdict['seqfiles'][Item[0]] 6331 6333 pfdata = PDFfile[1]['G(R)'][1].T 6332 6334 # pfname = PDFfile[0].replace(' ','_') … … 6398 6400 PDFctrl['G(R)'][1] = XYobs 6399 6401 G2frame.GPXtree.SetItemPyData(G2gd.GetGPXtreeItemId(G2frame,pId,'PDF Controls'),PDFctrl) 6402 SeqResult['histNames'].append(Item[1]) 6400 6403 GoOn = pgbar.Update(itm,newmsg='PDF G(R) done = %d'%(itm)) 6401 6404 if not GoOn[0]: -
trunk/GSASIIpwd.py
r5144 r5152 900 900 if 'T' in dataType: 901 901 q = 2.*np.pi*parmDict[pfx+'difC']/xdata 902 elif 'E' in dataType: 903 const = 4.*np.pi*npsind(parmDict[pfx+'2-theta']/2.0) 904 q = const*xdata 902 905 else: 903 906 wave = parmDict.get(pfx+'Lam',parmDict.get(pfx+'Lam1',1.0)) … … 991 994 pkP = parmDict[pfx+'BkPkpos;'+str(iD)] 992 995 pkI = max(parmDict[pfx+'BkPkint;'+str(iD)],0.1) 993 pkS = max(parmDict[pfx+'BkPksig;'+str(iD)], 1.)996 pkS = max(parmDict[pfx+'BkPksig;'+str(iD)],0.01) 994 997 pkG = max(parmDict[pfx+'BkPkgam;'+str(iD)],0.1) 995 998 if 'C' in dataType: 996 999 Wd,fmin,fmax = getWidthsCW(pkP,pkS,pkG,.002) 1000 elif 'E' in dataType: 1001 Wd,fmin,fmax = getWidthsED(pkP,pkS) 997 1002 else: #'T'OF 998 1003 Wd,fmin,fmax = getWidthsTOF(pkP,1.,1.,pkS,pkG) … … 1015 1020 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS/100.,pkG/1.e4,xdata[iBeg:iFin])[0] 1016 1021 yb[iBeg:iFin] += ybi 1022 elif 'E' in dataType: 1023 ybi = pkI*getPsVoigt(pkP,pkS*10.**4,pkG*100.,xdata[iBeg:iFin])[0] 1024 yb[iBeg:iFin] += ybi 1017 1025 sumBk[2] += np.sum(ybi) 1018 1026 iD += 1 … … 1031 1039 if 'T' in dataType: 1032 1040 q = 2.*np.pi*parmDict[hfx+'difC']/xdata 1041 elif 'E' in dataType: 1042 const = 4.*np.pi*npsind(parmDict[hfx+'2-theta']/2.0) 1043 q = const*xdata 1033 1044 else: 1034 1045 wave = parmDict.get(hfx+'Lam',parmDict.get(hfx+'Lam1',1.0)) … … 1123 1134 pkP = parmDict[hfx+'BkPkpos;'+str(iD)] 1124 1135 pkI = max(parmDict[hfx+'BkPkint;'+str(iD)],0.1) 1125 pkS = max(parmDict[hfx+'BkPksig;'+str(iD)], 1.0)1136 pkS = max(parmDict[hfx+'BkPksig;'+str(iD)],0.01) 1126 1137 pkG = max(parmDict[hfx+'BkPkgam;'+str(iD)],0.1) 1127 1138 if 'C' in dataType: 1128 1139 Wd,fmin,fmax = getWidthsCW(pkP,pkS,pkG,.002) 1140 elif 'E' in dataType: 1141 Wd,fmin,fmax = getWidthsED(pkP,pkS) 1129 1142 else: #'T' or 'B' 1130 1143 Wd,fmin,fmax = getWidthsTOF(pkP,1.,1.,pkS,pkG) … … 1140 1153 if 'C' in dataType: 1141 1154 Df,dFdp,dFds,dFdg,x = getdFCJVoigt3(pkP,pkS,pkG,.002,xdata[iBeg:iFin]) 1155 elif 'E' in dataType: 1156 Df,dFdp,dFds,dFdg = getdPsVoigt(pkP,pkS*10.**4,pkG*100.,xdata[iBeg:iFin]) 1142 1157 else: #'T'OF 1143 1158 Df,dFdp,x,x,dFds,dFdg = getdEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin]) … … 3077 3092 for it,item in enumerate(atom): 3078 3093 if it > 1 and item: 3079 itnum = item.split('@')[1] 3080 varname = '@%s'%itnum 3081 varnames.append(varname) 3082 if it < 6: 3083 if varname not in AtomVar: 3084 AtomVar[varname] = 0.0 #put ISODISTORT mode displ here? 3085 else: 3086 for i in range(3): 3094 itms = item.split('@') 3095 for itm in itms[1:]: 3096 itnum = itm[:2] 3097 varname = '@%s'%itnum 3098 varnames.append(varname) 3099 if it < 6: 3087 3100 if varname not in AtomVar: 3088 AtomVar[varname] = Atoms[iat][cia+i+2] 3101 AtomVar[varname] = 0.0 #put ISODISTORT mode displ here? 3102 else: 3103 for i in range(3): 3104 if varname not in AtomVar: 3105 AtomVar[varname] = Atoms[iat][cia+i+2] 3089 3106 varnames = set(varnames) 3090 3107 for name in list(AtomVar.keys()): #clear out unused parameters … … 3222 3239 names = ['pf.x(%d)'%(iat+1),'pf.y(%d)'%(iat+1),'pf.z(%d)'%(iat+1),'pf.occ(%d)'%(iat+1)] 3223 3240 if it > 1 and item: 3224 itnum = item.split('@')[1] 3225 if it < 6: 3226 rundata += 'pf.constrain(%s,"%s")\n'%(names[it-2],item) 3227 if itnum not in used: 3228 parms[itnum] = [AtomVar['@%s'%itnum],names[it-2].split('.')[1]] 3229 used.append(itnum) 3230 else: 3231 uijs = ['pf.u11(%d)'%(iat+1),'pf.u22(%d)'%(iat+1),'pf.u33(%d)'%(iat+1)] 3232 for i in range(3): 3233 rundata += 'pf.constrain(%s,"%s")\n'%(uijs[i],item) 3241 itms = item.split('@') 3242 for itm in itms[1:]: 3243 itnum = itm[:2] 3244 if it < 6: 3245 rundata += 'pf.constrain(%s,"%s")\n'%(names[it-2],item) 3234 3246 if itnum not in used: 3235 parms[itnum] = [AtomVar['@%s'%itnum], uijs[i].split('.')[1]]3247 parms[itnum] = [AtomVar['@%s'%itnum],names[it-2].split('.')[1]] 3236 3248 used.append(itnum) 3249 else: 3250 uijs = ['pf.u11(%d)'%(iat+1),'pf.u22(%d)'%(iat+1),'pf.u33(%d)'%(iat+1)] 3251 for i in range(3): 3252 rundata += 'pf.constrain(%s,"%s")\n'%(uijs[i],item) 3253 if itnum not in used: 3254 parms[itnum] = [AtomVar['@%s'%itnum],uijs[i].split('.')[1]] 3255 used.append(itnum) 3237 3256 3238 3257 if 'sequential' in RMCPdict['refinement']: … … 3332 3351 for iline,line in enumerate(lines): 3333 3352 if 'Rw - ' in line: 3334 Rwp = float(line.split(':')[1]) 3353 if 'nan' in line: 3354 Rwp = 100.0 3355 else: 3356 Rwp = float(line.split(':')[1]) 3335 3357 results = resline.replace('(','').split(')')[:-1] 3336 3358 results = ['@'+result.lstrip() for result in results]
Note: See TracChangeset
for help on using the changeset viewer.