Changeset 5141


Ignore:
Timestamp:
Jan 14, 2022 12:58:49 PM (7 months ago)
Author:
vondreele
Message:

avoid crash & provide error message on console if EDX data used in a Rietveld refinement

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r5137 r5141  
    224224        G2fil.G2Print('Use Calculate/"View LS parms" to list all parameter values\n',mode='warn')
    225225        G2fil.G2Print('Error message: '+Msg.msg,mode='warn')
    226         raise Exception('HessianLSQ -- ouch #0: look for invalid parameter (see console)')
     226        raise G2obj.G2Exception('HessianLSQ -- ouch #0: look for invalid parameter (see console)')
    227227    chisq00 = np.sum(M2**2) # starting Chi**2
    228228    Nobs = len(M2)
  • trunk/GSASIIstrIO.py

    r5137 r5141  
    271271            hId = Histogram['hId']
    272272            hfx = ':%d:'%(hId)
    273             if 'X' in controlDict[hfx+'histType']:
     273            if 'E' in controlDict[hfx+'histType']:
     274                for El in FFtables:
     275                    FFtables[El][hfx+'FP'] = 0.
     276                    FFtables[El][hfx+'FPP'] = 0.
     277            elif 'X' in controlDict[hfx+'histType']:
    274278                keV = controlDict[hfx+'keV']
    275279                for El in FFtables:
  • trunk/GSASIIstrMath.py

    r5117 r5141  
    33223322        if msg:
    33233323            print('\nInvalid cell metric tensor for phase #{} ({})\n'.format(
    3324                 pId,Phase['General']['Name']),
    3325                 'values (A): {:.3f} {:.3f} {:.3f} {:.3f} {:.3f} {:.3f}\n'
    3326                 .format(*A))
    3327             raise G2obj.G2Exception('Error: '+msg+
    3328                         ' See console.\nCheck for refinement of conflicting variables')
     3324                pId,Phase['General']['Name']),'values (A): {:.3f} {:.3f} {:.3f} {:.3f} {:.3f} {:.3f}\n'.format(*A))
     3325            raise G2obj.G2Exception('Error: '+msg+' See console.\nCheck for refinement of conflicting variables')
    33293326        GA,GB = G2lat.Gmat2AB(G)    #Orthogonalization matrices
    33303327        Vst = np.sqrt(nl.det(G))    #V*
    33313328        if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail']:
    3332             if im:
    3333                 SStructureFactor(refDict,G,hfx,pfx,SGData,SSGData,calcControls,parmDict)
    3334             elif parmDict[pfx+'isMag'] and 'N' in calcControls[hfx+'histType']:
    3335                 MagStructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict)
     3329            if 'E' in calcControls[hfx+'histType']:
     3330                print('\n\n**** Error: EDX data not suitable for Rietveld refinement ****\n\n')
    33363331            else:
    3337                 StructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict)
     3332                if im:
     3333                    SStructureFactor(refDict,G,hfx,pfx,SGData,SSGData,calcControls,parmDict)
     3334                elif parmDict[pfx+'isMag'] and 'N' in calcControls[hfx+'histType']:
     3335                    MagStructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict)
     3336                else:
     3337                    StructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict)
    33383338        badPeak = False
    33393339        # test to see if we are using multiprocessing here
     
    36413641        G,g = G2lat.A2Gmat(A)       #recip & real metric tensors
    36423642        GA,GB = G2lat.Gmat2AB(G)    #Orthogonalization matricies
    3643         if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail']:
     3643        if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail'] and 'E' not in calcControls[hfx+'histType']:
    36443644            if im:
    36453645                dFdvDict = SStructureFactorDerv(refDict,im,G,hfx,pfx,SGData,SSGData,calcControls,parmDict)
     
    39043904                        if Ka2 and iFin2-iBeg2:
    39053905                            depDerivDict[phfx+name][iBeg2:iFin2] += parmDict[phfx+'Scale']*dFdvDict[phfx+name][iref]*dervDict2['int']/refl[9+im]                 
    3906             if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail']:
     3906            if not Phase['General'].get('doPawley') and not parmDict[phfx+'LeBail'] and 'E' not in calcControls[hfx+'histType']:
    39073907                #do atom derivatives -  for RB,F,X & U so far - how do I scale mixed phase constraints?
    39083908                corr = 0.
Note: See TracChangeset for help on using the changeset viewer.