Changeset 1888


Ignore:
Timestamp:
Jun 15, 2015 8:56:19 AM (7 years ago)
Author:
vondreele
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1887 r1888  
    946946            FP,FPP = G2el.BlenResCW(Tdata,BLtables,refl.T[12])
    947947        H = np.array(refl[:3])
    948         H = np.squeeze(np.inner(H.T,TwinLaw))   #maybe array(blkSize,3,nTwins) or (blkSize,3)
     948        H = np.squeeze(np.inner(H.T,TwinLaw))   #maybe array(3,nTwins) or (3)
    949949        SQ = 1./(2.*refl[4])**2             # or (sin(theta)/lambda)**2
    950950        SQfactor = 8.0*SQ*np.pi**2
     
    953953        Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata])
    954954        FF = refDict['FF']['FF'][iref].T[Tindx].T
    955         Uniq = np.inner(H,SGMT)
     955        Uniq = np.inner(H,SGMT)             # array(3,nSGOp) or
    956956        Phi = np.inner(H,SGT)
    957957        phase = twopi*(np.inner(Uniq,(dXdata+Xdata).T).T+Phi.T).T
     
    979979        dfadui = np.sum(-SQfactor*fa,axis=-2)
    980980        if len(TwinLaw) > 1:
    981             dfadx = np.array([np.sum(twopi*Uniq[it]*np.swapaxes(fax[it],-2,-1)[:,:,:,np.newaxis],axis=-2) for it in range(nTwin)])
    982             dfadua = np.array([np.sum(-Hij[it]*np.swapaxes(fa[it],-2,-1)[:,:,:,np.newaxis],axis=-2) for it in range(nTwin)])
     981            dfadx = np.array([np.sum(twopi*Uniq[it]*np.swapaxes(fax,-2,-1)[:,it,:,:,np.newaxis],axis=-2) for it in range(nTwin)])
     982            dfadua = np.array([np.sum(-Hij[it]*np.swapaxes(fa,-2,-1)[:,it,:,:,np.newaxis],axis=-2) for it in range(nTwin)])
    983983        else:
    984984            dfadx = np.sum(twopi*Uniq*np.swapaxes(fax,-2,-1)[:,:,:,np.newaxis],axis=-2)
     
    991991            dfbdui = np.sum(-SQfactor*fb,axis=-2)
    992992            if len(TwinLaw) > 1:
    993                 dfbdx = np.array([np.sum(twopi*Uniq[it]*np.swapaxes(fbx[it],-2,-1)[:,:,:,np.newaxis],axis=2) for it in range(nTwin)])           
    994                 dfbdua = np.array([np.sum(-Hij[it]*np.swapaxes(fb[it],-2,-1)[:,:,:,np.newaxis],axis=2) for it in range(nTwin)])
     993                dfbdx = np.array([np.sum(twopi*Uniq[it]*np.swapaxes(fbx,-2,-1)[:,it,:,:,np.newaxis],axis=2) for it in range(nTwin)])           
     994                dfbdua = np.array([np.sum(-Hij[it]*np.swapaxes(fb,-2,-1)[:,it,:,:,np.newaxis],axis=2) for it in range(nTwin)])
    995995            else:
    996996                dfbdx = np.sum(twopi*Uniq*np.swapaxes(fbx,-2,-1)[:,:,:,np.newaxis],axis=2)           
     
    10181018            SB = fbs[0]+fas[1]
    10191019            if nTwin > 1:
    1020                 dFdfr[iref] = [2.*SA[it]*(dfadfr[it][0]+dfbdfr[it][1])*Mdata/len(Uniq[it])+ \
    1021                     2.*SB[it]*(dfbdfr[it][0]+dfadfr[it][1])*Mdata/len(Uniq[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)]
    1023                 dFdui[iref] = [2.*SA[it]*(dfadui[it][0]+dfbdui[it][1])+2.*SB[it]*(dfbdui[it][0]+dfadui[it][1]) for it in range(nTwin)]
     1020                dFdfr[iref] = [2.*SA[it]*(dfadfr[0][it]+dfbdfr[1][it])*Mdata/len(Uniq[it])+ \
     1021                    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)]
     1023                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)]
    10251025                dFdfl[iref] = -SA*dfadfl-SB*dfbdfl
Note: See TracChangeset for help on using the changeset viewer.