Changeset 2727


Ignore:
Timestamp:
Feb 27, 2017 3:06:07 PM (6 years ago)
Author:
vondreele
Message:

fix issue with formula volume in PDF creation
block Lebail selection if DoPawley? is selected
force Flat Bkg >= 0
avoid crash if Refine done with no atoms

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2726 r2727  
    35743574                    Qlimits.append([0.9*qMax,qMax])
    35753575                    ElList = {}
     3576                    sumnum = 1.
    35763577                    for item in Comments:           #grab chemical formula from Comments
    35773578                        if 'formula' in item[:15].lower():
     
    35813582                                nums = formula[1::2]
    35823583                                Formula = zip(elems,nums)
     3584                                sumnum = 0.
    35833585                                for [elem,num] in Formula:
    35843586                                    ElData = G2elem.GetElInfo(elem,Parms)
    35853587                                    ElData['FormulaNo'] = float(num)
     3588                                    sumnum += float(num)
    35863589                                    ElList[elem] = ElData
     3590                               
    35873591                            except ValueError:
    35883592                                ElData = G2elem.GetElInfo(formula[0],Parms)
     
    35993603                    for i in dlg.GetSelections():
    36003604                        PDFnames = G2gd.GetPatternTreeDataNames(self,['PDF ',])
    3601                         G2obj.CreatePDFitems(self,TextList[i],ElLists[i],Qlimits[i],pwdrMin,PDFnames)
     3605                        G2obj.CreatePDFitems(self,TextList[i],ElLists[i],Qlimits[i],sumnum,pwdrMin,PDFnames)
    36023606                for item in self.ExportPDF: item.Enable(True)
    36033607            finally:
     
    38673871        Called from the Calculate/Refine menu.
    38683872        '''
     3873        self.dataFrame.userReSize = False               #avoids bad resizing based on MessageDialog
    38693874        Id = G2gd.GetPatternTreeItemId(self,self.root,'Sequential results')
    38703875        if Id:
     
    39283933        else:
    39293934            self.ErrorDialog('Refinement error',Msg)
    3930         self.dataFrame.userReSize = False
    39313935       
    39323936    def SaveTreeSetting(self):
  • trunk/GSASIIddataGUI.py

    r2718 r2727  
    867867        useData.SetValue(UseList[G2frame.hist]['Use'])
    868868        useBox.Add(useData,0,WACV)
    869         lebail = wx.CheckBox(DData,wx.ID_ANY,label='Do LeBail extraction?')
    870         lebail.Bind(wx.EVT_CHECKBOX, OnLeBail)
    871         lebail.SetValue(UseList[G2frame.hist]['LeBail'])
    872         useBox.Add(lebail,0,WACV)
     869        if not generalData['doPawley']:
     870            lebail = wx.CheckBox(DData,wx.ID_ANY,label='Do LeBail extraction?')
     871            lebail.Bind(wx.EVT_CHECKBOX, OnLeBail)
     872            lebail.SetValue(UseList[G2frame.hist]['LeBail'])
     873            useBox.Add(lebail,0,WACV)
    873874        bottomSizer.Add(useBox,0,WACV|wx.TOP|wx.BOTTOM|wx.LEFT,5)
    874875       
  • trunk/GSASIIimgGUI.py

    r2723 r2727  
    29222922                    G2frame,imgId, 'Comments'))
    29232923                ElList = {}
     2924                sumnum = 1.0
    29242925                for item in Comments:           #grab chemical formula from Comments, if there
    29252926                    if 'formula' in item[:15].lower():
     
    29282929                        nums = formula[1::2]
    29292930                        formula = zip(elems,nums)
     2931                        sumnum = 0.
    29302932                        for [elem,num] in formula:
    29312933                            ElData = G2elem.GetElInfo(elem,Parms)
    29322934                            ElData['FormulaNo'] = float(num)
     2935                            sumnum += float(num)
    29332936                            ElList[elem] = ElData
    29342937                PDFnames = G2gd.GetPatternTreeDataNames(G2frame,['PDF ',])
    2935                 PDFid = G2obj.CreatePDFitems(G2frame,pwdr,ElList.copy(),Qlimits,pwdrMin,PDFnames)
     2938                PDFid = G2obj.CreatePDFitems(G2frame,pwdr,ElList.copy(),Qlimits,sumnum,pwdrMin,PDFnames)
    29362939                if not PDFid: continue
    29372940                PDFdata = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(
  • trunk/GSASIIobj.py

    r2721 r2727  
    20922092        return repr(self.msg)
    20932093
    2094 def CreatePDFitems(G2frame,PWDRtree,ElList,Qlimits,FltBkg=0,PDFnames=[]):
     2094def CreatePDFitems(G2frame,PWDRtree,ElList,Qlimits,numAtm=1,FltBkg=0,PDFnames=[]):
    20952095    '''Create and initialize a new set of PDF tree entries
    20962096
     
    20992099    :param dict ElList: data structure with composition
    21002100    :param list Qlimits: Q limits to be used for computing the PDF
     2101    :param float numAtm: no. atom in chemical formula
     2102    :param float FltBkg: flat background value
     2103    :param list PDFnames: previously used PDF names
     2104   
    21012105    :returns: the Id of the newly created PDF entry
    21022106    '''
     
    21122116        'Container':{'Name':'','Mult':-1.0,'Refine':False},
    21132117        'Container Bkg.':{'Name':'','Mult':-1.0},'ElList':ElList,
    2114         'Geometry':'Cylinder','Diam':1.0,'Pack':0.50,'Form Vol':10.0,'Flat Bkg':FltBkg,
     2118        'Geometry':'Cylinder','Diam':1.0,'Pack':0.50,'Form Vol':10.0*numAtm,'Flat Bkg':FltBkg,
    21152119        'DetType':'Area detector','ObliqCoeff':0.2,'Ruland':0.025,'QScaleLim':Qlimits,
    21162120        'Lorch':False,'BackRatio':0.0,'Rmax':100.,'noRing':False,'IofQmin':1.0,
  • trunk/GSASIIpwdGUI.py

    r2715 r2727  
    48024802                    Cmin += CBmin*data['Container Bkg.']['Mult']
    48034803                Smin += Cmul*Cmin
    4804             data['Flat Bkg'] = Smin
     4804            data['Flat Bkg'] = max(0,Smin)
    48054805                           
    48064806        PDFfileSizer = wx.BoxSizer(wx.VERTICAL)
     
    49844984            sqBox.Add(obliqCoeff,0)
    49854985        sqBox.Add(wx.StaticText(G2frame.dataDisplay,label=' Flat Bkg.: '),0,WACV)
    4986         flatBkg = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'Flat Bkg',nDig=(10,0),
     4986        flatBkg = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data,'Flat Bkg',nDig=(10,0),min=0,
    49874987                typeHint=float,OnLeave=AfterChangeNoRefresh)
    49884988        sqBox.Add(flatBkg,0)
  • trunk/GSASIIstrIO.py

    r2718 r2727  
    187187    Natoms,atomIndx,phaseVary,phaseDict,pawleyLookup,FFtables,BLtables,MFtables,maxSSwave = \
    188188        GetPhaseData(Phases,RestraintDict=None,rbIds=rbIds,Print=False) # generates atom symmetry constraints
    189     hapVary,hapDict,controlDict = GetHistogramPhaseData(Phases,Histograms,Print=False)
     189    hapVary,hapDict,controlDict = GetHistogramPhaseData(Phases,Histograms,Print=False,resetRefList=False)
    190190    histVary,histDict,controlDict = GetHistogramData(Histograms,Print=False)
    191191    varyList = rbVary+phaseVary+hapVary+histVary
  • trunk/GSASIIstrMath.py

    r2718 r2727  
    30793079        GA,GB = G2lat.Gmat2AB(G)    #Orthogonalization matricies
    30803080        Vst = np.sqrt(nl.det(G))    #V*
    3081         if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail']:
     3081        if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail'] and len(refDict['FF']):
    30823082            if im:
    30833083                SStructureFactor(refDict,G,hfx,pfx,SGData,SSGData,calcControls,parmDict)
     
    32543254        G,g = G2lat.A2Gmat(A)       #recip & real metric tensors
    32553255        GA,GB = G2lat.Gmat2AB(G)    #Orthogonalization matricies
    3256         if not Phase['General'].get('doPawley')  and not parmDict[phfx+'LeBail']:
     3256        if not Phase['General'].get('doPawley')  and not parmDict[phfx+'LeBail'] and len(refDict['FF']):
    32573257            if im:
    32583258                dFdvDict = SStructureFactorDerv(refDict,im,G,hfx,pfx,SGData,SSGData,calcControls,parmDict)
     
    34493449                        if Ka2 and iFin2-iBeg2:
    34503450                            depDerivDict[phfx+name][iBeg2:iFin2] += parmDict[phfx+'Scale']*dFdvDict[phfx+name][iref]*dervDict2['int']/refl[9+im]                 
    3451             if not Phase['General'].get('doPawley')  and not parmDict[phfx+'LeBail']:
     3451            if not Phase['General'].get('doPawley')  and not parmDict[phfx+'LeBail'] and len(refDict['FF']):
    34523452                #do atom derivatives -  for RB,F,X & U so far - how do I scale mixed phase constraints?
    34533453                corr = 0.
Note: See TracChangeset for help on using the changeset viewer.