Changeset 2096


Ignore:
Timestamp:
Dec 16, 2015 3:31:54 PM (6 years ago)
Author:
vondreele
Message:

a bit more blocked derivative work - Babinet parms now OK.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2094 r2096  
    875875        if not SGData['SGInv']:
    876876            dfbdfr = np.sum(fb/occ,axis=-2)        #Fdata != 0 avoids /0. problem
    877             dfbdba = np.sum(-sinp*Tcorr[:,nxs],axis=1)
     877            dfadba /= 2.
     878            dfbdba = np.sum(-sinp*Tcorr[:,nxs],axis=1)/2.
    878879            dfbdui = np.sum(-SQfactor*fb,axis=-2)
    879880            if len(TwinLaw) > 1:
     
    919920                dFdua[iref] = 2.*SA*(dfadua[0]+dfadua[1])+2.*SB*(dfbdua[0]+dfbdua[1])
    920921                dFdfl[iref] = -SA*dfadfl-SB*dfbdfl  #array(nRef,)
    921         dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
    922             2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
     922        dFdbab[iref] = fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
     923            fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
    923924#        GSASIIpath.IPyBreak()
    924925        if not iref%100 :
     
    10461047        Phi = np.inner(H,SGT)
    10471048        phase = twopi*(np.inner(Uniq,(dXdata+Xdata).T).T+Phi.T).T
    1048         sinp = np.sin(phase)
     1049        sinp = np.sin(phase)        #refBlk x nOps x nAtoms
    10491050        cosp = np.cos(phase)
    10501051        occ = Mdata*Fdata/len(SGT)
     
    10741075        #sum below is over Uniq
    10751076        dfadfr = np.sum(fa/occ,axis=-2)        #array(2,refBlk,ntwin,nAtom) Fdata != 0 avoids /0. problem
    1076         dfadba = np.sum(-cosp*Tcorr[:,nxs],axis=-2)  #array(refBlk,nTwin,nOps,nAtom)
     1077        dfadba = np.sum(-cosp*Tcorr,axis=-2)  #array(refBlk,nAtom)
    10771078        if nTwin > 1:
    10781079            dfadfr = np.swapaxes(dfadfr,0,1)
     
    10881089        if not SGData['SGInv']:
    10891090            dfbdfr = np.sum(fb/occ,axis=-2)        #Fdata != 0 avoids /0. problem
    1090             dfbdba = np.sum(-sinp*Tcorr[:,nxs],axis=-2)
     1091            dfbdba = np.sum(-sinp*Tcorr,axis=-2)
    10911092            if len(TwinLaw) > 1:
    10921093                dfbdfr = np.swapaxes(dfbdfr,0,1)
     
    11381139                dFdua[iBeg:iFin] = 2.*SA[:,nxs,nxs]*(dfadua[0]+dfadua[1])+2.*SB[:,nxs,nxs]*(dfbdua[0]+dfbdua[1])
    11391140                dFdfl[iBeg:iFin] = -SA*dfadfl-SB*dfbdfl  #array(nRef,)
    1140 #        dFdbab[iBeg:iFin] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
    1141 #            2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
     1141        dFdbab[iBeg:iFin] = 2.*(fas[0,nxs]*np.array([np.sum(dfadba.T*dBabdA,axis=0),np.sum(-dfadba.T*parmDict[phfx+'BabA']*SQfactor*dBabdA,axis=0)])+ \
     1142                            fbs[0,nxs]*np.array([np.sum(dfbdba.T*dBabdA,axis=0),np.sum(-dfbdba.T*parmDict[phfx+'BabA']*SQfactor*dBabdA,axis=0)])).T
    11421143#        GSASIIpath.IPyBreak()
    11431144        iBeg += blkSize
     
    29802981                    for item in ['BabA','BabU']:
    29812982                        if phfx+item in varylist:
    2982                             dMdvh[varylist.index(phfx+item)][iref] = w*dFdvDict[pfx+item][iref]*parmDict[phfx+'Scale']*ref[11+im]
     2983                            dMdvh[varylist.index(phfx+item)][iref] = w*dFdvDict[phfx+item][iref]*parmDict[phfx+'Scale']*ref[11+im]
    29832984                        elif phfx+item in dependentVars:
    2984                             depDerivDict[phfx+item][iref] = w*dFdvDict[pfx+item][iref]*parmDict[phfx+'Scale']*ref[11+im]
     2985                            depDerivDict[phfx+item][iref] = w*dFdvDict[phfx+item][iref]*parmDict[phfx+'Scale']*ref[11+im]
    29852986    return dMdvh,depDerivDict,wdf
    29862987   
Note: See TracChangeset for help on using the changeset viewer.