Changeset 2750


Ignore:
Timestamp:
Mar 8, 2017 9:23:16 AM (5 years ago)
Author:
vondreele
Message:

fix issues with adding new phase, forgetting to add atoms to it,
and also having a phase unused in histogram
add 'newLeBail':True to add histogram to phase so reflections get generated
also to copy Data parms (but not selected parms)
fix issue with changing atom type - caused crash in LS refinement

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r2745 r2750  
    835835            pawleySizer.Add(wx.StaticText(General,label=' Pawley controls: '),0,WACV)
    836836            pawlRef = wx.CheckBox(General,-1,label=' Do Pawley refinement?')
    837             #ToDo: change parameter to ComboBox of blank, Pawley, LeBail
    838837            pawlRef.SetValue(generalData['doPawley'])
    839838            pawlRef.Bind(wx.EVT_CHECKBOX,OnPawleyRef)
     
    55575556            refDict,reflData = G2frame.PatternTree.GetItemPyData(Id)
    55585557            UseList[histoName] = {'Histogram':histoName,'Show':False,'Scale':[1.0,True],
    5559                 'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},'LeBail':False,
     5558                'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]},'LeBail':False,'newLeBail':True,
    55605559                'Extinction':['Lorentzian','None',
    55615560                {'Tbar':0.1,'Cos2TM':0.955,'Eg':[1.e-7,False],'Es':[1.e-7,False],'Ep':[1.e-7,False]},],
     
    56145613            copyNames = ['Scale','Extinction','Babinet','Flack','Twins']
    56155614        else:  #PWDR 
    5616             copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail']
     5615            copyNames = ['Scale','Pref.Ori.','Size','Mustrain','HStrain','Extinction','Babinet','LeBail','newLeBail',]
    56175616        copyDict = {}
    56185617        for name in copyNames:
     
    56815680                                    UseList[item]['Twins'][0][1][1] = copyDict['Twins']
    56825681                                else:
    5683                                     UseList[item][name][1] = copy.deepcopy(copyDict[name])
     5682                                    try:
     5683                                        UseList[item][name][1] = copy.deepcopy(copyDict[name])
     5684                                    except KeyError:
     5685                                        continue
    56845686                            elif name in ['Size','Mustrain']:
    56855687                                UseList[item][name][0] = copy.deepcopy(copyDict[name][0])
     
    57585760                    for histoName in newList:
    57595761                        Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,histoName)
    5760                         UseList[histoName] = {'Histogram':histoName,'Show':False,'LeBail':False,
     5762                        UseList[histoName] = {'Histogram':histoName,'Show':False,'LeBail':False,'newLeBail':True,
    57615763                            'Scale':[1.0,False],'Pref.Ori.':['MD',1.0,False,[0,0,1],0,{},['',],0.1],
    57625764                            'Size':['isotropic',[1.,1.,1.],[False,False,False],[0,0,1],
     
    59935995                Obj = event.GetEventObject()
    59945996                RBId = Indx[Obj.GetId()]
    5995                 RBData['Residue'][RBId]['useCount'] -= 1
    59965997                RBObjs = data['RBModels']['Residue']
    59975998                for rbObj in RBObjs:
    59985999                    if RBId == rbObj['RBId']:
    5999                        data['RBModels']['Residue'].remove(rbObj)                 
     6000                        RBData['Residue'][RBId]['useCount'] -= 1
     6001                        data['RBModels']['Residue'].remove(rbObj)                 
    60006002                G2plt.PlotStructure(G2frame,data)
    60016003                wx.CallAfter(FillRigidBodyGrid,True)
  • trunk/GSASIIstrIO.py

    r2748 r2750  
    27742774                    #skip if histogram not included e.g. in a sequential refinement
    27752775                    continue
    2776                 print >>pFile,'\n Phase: ',phase,' in histogram: ',histogram
    2777                 print >>pFile,135*'='
    27782776                hapData = HistoPhase[histogram]
    27792777                hId = Histogram['hId']
     
    27812779                pfx = str(pId)+':'+str(hId)+':'
    27822780                hfx = ':%s:'%(hId)
     2781                if pfx+'Nref' not in Histogram['Residuals']:    #skip not used phase in histogram
     2782                    continue
     2783                print >>pFile,'\n Phase: ',phase,' in histogram: ',histogram
     2784                print >>pFile,135*'='
    27832785                if 'PWDR' in histogram:
    27842786                    print >>pFile,' Final refinement RF, RF^2 = %.2f%%, %.2f%% on %d reflections'   \
  • trunk/GSASIIstrMath.py

    r2732 r2750  
    667667    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    668668        GetAtomFXU(pfx,calcControls,parmDict)
     669    if not Xdata.size:          #no atoms in phase!
     670        return
    669671    if parmDict[pfx+'isMag']:
    670672        Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
     
    691693    blkSize = 100       #no. of reflections in a block - size seems optimal
    692694    nRef = refDict['RefList'].shape[0]
    693     if not len(refDict['FF']):                #no form factors - 1st time thru StructureFactor
    694         SQ = 1./(2.*refDict['RefList'].T[4])**2
    695         if 'N' in calcControls[hfx+'histType']:
    696             dat = G2el.getBLvalues(BLtables)
    697             refDict['FF']['El'] = dat.keys()
    698             refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
    699             refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
    700             for iel,El in enumerate(refDict['FF']['El']):
    701                 if El in MFtables:
    702                     refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
    703         else:       #'X'
    704             dat = G2el.getFFvalues(FFtables,0.)
    705             refDict['FF']['El'] = dat.keys()
    706             refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
    707             for iel,El in enumerate(refDict['FF']['El']):
    708                 refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
     695    SQ = 1./(2.*refDict['RefList'].T[4])**2
     696    if 'N' in calcControls[hfx+'histType']:
     697        dat = G2el.getBLvalues(BLtables)
     698        refDict['FF']['El'] = dat.keys()
     699        refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
     700        refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
     701        for iel,El in enumerate(refDict['FF']['El']):
     702            if El in MFtables:
     703                refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
     704    else:       #'X'
     705        dat = G2el.getFFvalues(FFtables,0.)
     706        refDict['FF']['El'] = dat.keys()
     707        refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
     708        for iel,El in enumerate(refDict['FF']['El']):
     709            refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
    709710#reflection processing begins here - big arrays!
    710711    iBeg = 0
     
    827828    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    828829        GetAtomFXU(pfx,calcControls,parmDict)
     830    if not Xdata.size:          #no atoms in phase!
     831        return {}
    829832    mSize = len(Mdata)
    830833    FF = np.zeros(len(Tdata))
     
    983986    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    984987        GetAtomFXU(pfx,calcControls,parmDict)
     988    if not Xdata.size:          #no atoms in phase!
     989        return {}
    985990    mSize = len(Mdata)
    986991    Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
     
    10501055        dqmx = dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]
    10511056        dqmx2 = np.sum(dqmx,axis=1)   #matrix * vector = vector
    1052         dqmx1 = np.swapaxes(np.swapaxes(np.inner(dqdm.T,dGdm.T),0,1),2,3)
     1057#        dqmx1 = np.swapaxes(np.swapaxes(np.inner(dqdm.T,dGdm.T),0,1),2,3)
    10531058        dmx = NQ*Q*dGdM[:,nxs,:,:]-Q*dqmx2                                #*Mag canceled out of dqmx term
    10541059       
     
    11331138    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    11341139        GetAtomFXU(pfx,calcControls,parmDict)
     1140    if not Xdata.size:          #no atoms in phase!
     1141        return {}
    11351142    mSize = len(Mdata)
    11361143    FF = np.zeros(len(Tdata))
     
    12931300    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    12941301        GetAtomFXU(pfx,calcControls,parmDict)
     1302    if not Xdata.size:          #no atoms in phase!
     1303        return
    12951304    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
    12961305    ngl,nWaves,Fmod,Xmod,Umod,glTau,glWt = G2mth.makeWaves(waveTypes,FSSdata,XSSdata,USSdata,Mast)
     
    13061315    blkSize = 32       #no. of reflections in a block
    13071316    nRef = refDict['RefList'].shape[0]
    1308     if not len(refDict['FF']):
    1309         SQ = 1./(2.*refDict['RefList'].T[5])**2
    1310         if 'N' in calcControls[hfx+'histType']:
    1311             dat = G2el.getBLvalues(BLtables)
    1312             refDict['FF']['El'] = dat.keys()
    1313             refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
    1314             refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
    1315             for iel,El in enumerate(refDict['FF']['El']):
    1316                 if El in MFtables:
    1317                     refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
    1318         else:
    1319             dat = G2el.getFFvalues(FFtables,0.)
    1320             refDict['FF']['El'] = dat.keys()
    1321             refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
    1322             for iel,El in enumerate(refDict['FF']['El']):
    1323                 refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
     1317    SQ = 1./(2.*refDict['RefList'].T[5])**2
     1318    if 'N' in calcControls[hfx+'histType']:
     1319        dat = G2el.getBLvalues(BLtables)
     1320        refDict['FF']['El'] = dat.keys()
     1321        refDict['FF']['FF'] = np.ones((nRef,len(dat)))*dat.values()
     1322        refDict['FF']['MF'] = np.zeros((nRef,len(dat)))
     1323        for iel,El in enumerate(refDict['FF']['El']):
     1324            if El in MFtables:
     1325                refDict['FF']['MF'].T[iel] = G2el.MagScatFac(MFtables[El],SQ)
     1326    else:
     1327        dat = G2el.getFFvalues(FFtables,0.)
     1328        refDict['FF']['El'] = dat.keys()
     1329        refDict['FF']['FF'] = np.zeros((nRef,len(dat)))
     1330        for iel,El in enumerate(refDict['FF']['El']):
     1331            refDict['FF']['FF'].T[iel] = G2el.ScatFac(FFtables[El],SQ)
    13241332    time0 = time.time()
    13251333#reflection processing begins here - big arrays!
     
    14201428    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    14211429        GetAtomFXU(pfx,calcControls,parmDict)
     1430    if not Xdata.size:          #no atoms in phase!
     1431        return
    14221432    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
    14231433    ngl,nWaves,Fmod,Xmod,Umod,glTau,glWt = G2mth.makeWaves(waveTypes,FSSdata,XSSdata,USSdata,Mast)
     
    15491559    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    15501560        GetAtomFXU(pfx,calcControls,parmDict)
     1561    if not Xdata.size:          #no atoms in phase!
     1562        return {}
    15511563    mSize = len(Mdata)  #no. atoms
    15521564    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
     
    17611773    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    17621774        GetAtomFXU(pfx,calcControls,parmDict)
     1775    if not Xdata.size:          #no atoms in phase!
     1776        return {}
    17631777    mSize = len(Mdata)  #no. atoms
    17641778    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
     
    19892003    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata,Gdata = \
    19902004        GetAtomFXU(pfx,calcControls,parmDict)
     2005    if not Xdata.size:          #no atoms in phase!
     2006        return {}
    19912007    mSize = len(Mdata)  #no. atoms
    19922008    waveTypes,FSSdata,XSSdata,USSdata,MSSdata = GetAtomSSFXU(pfx,calcControls,parmDict)
Note: See TracChangeset for help on using the changeset viewer.