Changeset 1890


Ignore:
Timestamp:
Jun 15, 2015 3:46:01 PM (7 years ago)
Author:
vondreele
Message:

fix Flack derivative & other adjustments to single crystal derivatives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1888 r1890  
    965965        Hij = np.squeeze(np.reshape(np.array([G2lat.UijtoU6(Uij) for Uij in Hij]),(nTwin,-1,6)))
    966966        Tuij = np.where(HbH<1.,np.exp(HbH),1.0).T
    967         Tcorr = np.reshape(Tiso,Tuij.shape)*Tuij*Mdata*Fdata/len(SGMT)
    968         fot = (FF+FP-Bab)*occ*Tcorr
    969         fotp = FPP*occ*Tcorr       
     967        Tcorr = np.reshape(Tiso,Tuij.shape)*Tuij*occ
     968        fot = (FF+FP-Bab)*Tcorr
     969        fotp = FPP*Tcorr       
    970970        fa = np.array([((FF+FP).T-Bab).T*cosp*Tcorr,-Flack*FPP*sinp*Tcorr])
    971971        fb = np.array([((FF+FP).T-Bab).T*sinp*Tcorr,Flack*FPP*cosp*Tcorr])
     
    976976        #sum below is over Uniq
    977977        dfadfr = np.sum(fa/occ,axis=-2)        #Fdata != 0 ever avoids /0. problem
    978         dfadba = np.sum(-cosp*(occ*Tcorr)[:,np.newaxis],axis=1)
     978        dfadba = np.sum(-cosp*Tcorr[:,np.newaxis],axis=1)
    979979        dfadui = np.sum(-SQfactor*fa,axis=-2)
    980980        if len(TwinLaw) > 1:
     
    986986        if not SGData['SGInv']:
    987987            dfbdfr = np.sum(fb/occ,axis=-2)        #Fdata != 0 ever avoids /0. problem
    988             dfbdba = np.sum(-sinp*(occ*Tcorr)[:,np.newaxis],axis=1)
    989             dfadfl = np.sum(-fotp[:,np.newaxis]*sinp)
    990             dfbdfl = np.sum(fotp[:,np.newaxis]*cosp)
     988            dfbdba = np.sum(-sinp*Tcorr[:,np.newaxis],axis=1)
     989            dfadfl = np.sum(-FPP*Tcorr*sinp)
     990            dfbdfl = np.sum(FPP*Tcorr*cosp)
    991991            dfbdui = np.sum(-SQfactor*fb,axis=-2)
    992992            if len(TwinLaw) > 1:
     
    10201020                dFdfr[iref] = [2.*SA[it]*(dfadfr[0][it]+dfbdfr[1][it])*Mdata/len(Uniq[it])+ \
    10211021                    2.*SB[it]*(dfbdfr[0][it]+dfadfr[1][it])*Mdata/len(Uniq[it]) for it in range(nTwin)]
    1022                 dFdx[iref] = [2.*SA[it]*(dfadx[0][it]+dfbdx[1][it])+2.*SB[it]*(dfbdx[0][it]+dfadx[1][it]) for it in range(nTwin)]
     1022                dFdx[iref] = [2.*SA[it]*(dfadx[it][0]+dfbdx[it][1])+2.*SB[it]*(dfbdx[it][0]+dfadx[it][1]) for it in range(nTwin)]
    10231023                dFdui[iref] = [2.*SA[it]*(dfadui[0][it]+dfbdui[1][it])+2.*SB[it]*(dfbdui[0][it]+dfadui[1][it]) for it in range(nTwin)]
    10241024                dFdua[iref] = [2.*SA[it]*(dfadua[it][0]+dfbdua[it][1])+2.*SB[it]*(dfbdua[it][0]+dfadua[it][1]) for it in range(nTwin)]
     
    10321032                dFdua[iref] = 2.*SA*(dfadua[0]+dfbdua[1])+2.*SB*(dfbdua[0]+dfadua[1])
    10331033                dFdfl[iref] = -SA*dfadfl-SB*dfbdfl
    1034         dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
    1035             2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
     1034#        dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
     1035#            2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
    10361036           
    10371037        #loop over atoms - each dict entry is list of derivatives for all the reflections
     
    10491049            dFdvDict[pfx+'AU13:'+str(i)] = np.sum(0.5*dFdua.T[4][i]*TwinFr[:,np.newaxis],axis=0)
    10501050            dFdvDict[pfx+'AU23:'+str(i)] = np.sum(0.5*dFdua.T[5][i]*TwinFr[:,np.newaxis],axis=0)
    1051         dFdvDict[phfx+'Flack'] = np.sum(dFdfl.T*TwinFr[:,np.newaxis],axis=0)
     1051        dFdvDict[phfx+'Flack'] = 4.*np.sum(dFdfl.T*TwinFr[:,np.newaxis],axis=0)
    10521052    else:
    10531053        for i in range(len(Mdata)):
     
    10631063            dFdvDict[pfx+'AU13:'+str(i)] = 0.5*dFdua.T[4][i]
    10641064            dFdvDict[pfx+'AU23:'+str(i)] = 0.5*dFdua.T[5][i]
    1065         dFdvDict[phfx+'Flack'] = dFdfl.T
     1065        dFdvDict[phfx+'Flack'] = 4.*dFdfl.T
    10661066    dFdvDict[phfx+'BabA'] = dFdbab.T[0]
    10671067    dFdvDict[phfx+'BabU'] = dFdbab.T[1]
Note: See TracChangeset for help on using the changeset viewer.