Changeset 1308


Ignore:
Timestamp:
Apr 30, 2014 11:01:48 AM (8 years ago)
Author:
vondreele
Message:

fix problem when atom site fraction exactly zero

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1299 r1308  
    527527            if parm in parmDict:
    528528                keys[key][iatm] = parmDict[parm]
     529    Fdata = np.where(Fdata,Fdata,1.e-8)         #avoid divide by zero in derivative calc.?
    529530    return Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata
    530531   
     
    747748        fbx = np.array([fot[:,np.newaxis]*cosp,-fot[:,np.newaxis]*cosp])
    748749        #sum below is over Uniq
    749         dfadfr = np.sum(fa/occ[:,np.newaxis],axis=2)
     750        dfadfr = np.sum(fa/occ[:,np.newaxis],axis=2)        #Fdata != 0 ever avoids /0. problem
    750751        dfadx = np.sum(twopi*Uniq*fax[:,:,:,np.newaxis],axis=2)
    751752        dfadui = np.sum(-SQfactor*fa,axis=2)
     
    759760        dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
    760761        if not SGData['SGInv']:
    761             dfbdfr = np.sum(fb/occ[:,np.newaxis],axis=2)        #problem here if occ=0 for some atom
    762             dfbdx = np.sum(twopi*Uniq*fbx[:,:,:,np.newaxis],axis=2)         
     762            dfbdfr = np.sum(fb/occ[:,np.newaxis],axis=2)        #Fdata != 0 ever avoids /0. problem
     763            dfbdx = np.sum(twopi*Uniq*fbx[:,:,:,np.newaxis],axis=2)           
    763764            dfbdui = np.sum(-SQfactor*fb,axis=2)
    764765            dfbdua = np.sum(-Hij*fb[:,:,:,np.newaxis],axis=2)
Note: See TracChangeset for help on using the changeset viewer.