Changeset 1914


Ignore:
Timestamp:
Jun 29, 2015 3:21:10 PM (7 years ago)
Author:
vondreele
Message:

now process non merohedral twins - still some problems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1913 r1914  
    819819        Flack = 1.-2.*parmDict[phfx+'Flack']
    820820    TwinLaw = np.array([[[1,0,0],[0,1,0],[0,0,1]],])
    821     TwinDict = refDict.get('TwinDict',{})           
     821    TwDict = refDict.get('TwDict',{})           
    822822    if 'S' in calcControls[hfx+'histType']:
    823823        TwinLaw = calcControls[phfx+'TwinLaw']
     
    855855        H = np.squeeze(np.inner(H.T,TwinLaw))   #maybe array(blkSize,nTwins,3) or (blkSize,3)
    856856        TwMask = np.any(H,axis=-1)
    857         if TwinLaw.shape[0] > 1 and TwinDict:
     857        if TwinLaw.shape[0] > 1 and TwDict:
    858858            for ir in range(blkSize):
    859859                iref = ir+iBeg
    860                 if iref in TwinDict:
    861                     for i in TwinDict[iref]:
    862                         H[ir][i] = TwinDict[iref][i]
     860                if iref in TwDict:
     861                    for i in TwDict[iref]:
     862                        H[ir][i] = TwDict[iref][i]
    863863            TwMask = np.any(H,axis=-1)
    864864        SQ = 1./(2.*refl.T[4])**2               #array(blkSize)
     
    900900            if len(TwinLaw) > 1:
    901901                refl.T[9] = np.sum(fas[:,:,0]**2,axis=0)+np.sum(fbs[:,:,0]**2,axis=0)   #FcT from primary twin element
    902                 refl.T[7] = np.sum(TwinFr*np.sum(fas,axis=0)**2,axis=-1)+   \
    903                     np.sum(TwinFr*np.sum(fbs,axis=0)**2,axis=-1)                        #Fc sum over twins
    904 #                what goes in refl.T[8]? (FoT)           
     902                refl.T[7] = np.sum(TwinFr*np.sum(TwMask[np.newaxis,:,:]*fas,axis=0)**2,axis=-1)+   \
     903                    np.sum(TwinFr*np.sum(TwMask[np.newaxis,:,:]*fbs,axis=0)**2,axis=-1)                        #Fc sum over twins
    905904                refl.T[10] = atan2d(fbs[0].T[0],fas[0].T[0])  #ignore f' & f"
    906905            else:
     
    921920    BLtables = calcControls['BLtables']
    922921    TwinLaw = np.array([[[1,0,0],[0,1,0],[0,0,1]],])
     922    TwDict = refDict.get('TwDict',{})           
    923923    if 'S' in calcControls[hfx+'histType']:
    924924        TwinLaw = calcControls[phfx+'TwinLaw']
     
    952952        H = np.array(refl[:3])
    953953        H = np.squeeze(np.inner(H.T,TwinLaw))   #maybe array(3,nTwins) or (3)
     954        TwMask = np.any(H,axis=-1)
     955        if TwinLaw.shape[0] > 1 and TwDict:
     956            if iref in TwDict:
     957                for i in TwDict[iref]:
     958                    H[i] = TwDict[iref][i]
     959            TwMask = np.any(H,axis=-1)
    954960        SQ = 1./(2.*refl[4])**2             # or (sin(theta)/lambda)**2
    955961        SQfactor = 8.0*SQ*np.pi**2
     
    10231029            SB = fbs[0]+fas[1]
    10241030            if nTwin > 1:
    1025                 dFdfr[iref] = [SA[it]*(dfadfr[0][it]+dfbdfr[1][it])*Mdata/len(Uniq[it])+ \
     1031                dFdfr[iref] = TwMask[:,np.newaxis]*[SA[it]*(dfadfr[0][it]+dfbdfr[1][it])*Mdata/len(Uniq[it])+ \
    10261032                    SB[it]*(dfbdfr[0][it]+dfadfr[1][it])*Mdata/len(Uniq[it]) for it in range(nTwin)]
    1027                 dFdx[iref] = [SA[it]*(dfadx[it][0]+dfbdx[it][1])+SB[it]*(dfbdx[it][0]+dfadx[it][1]) for it in range(nTwin)]
    1028                 dFdui[iref] = [SA[it]*(dfadui[0][it]+dfbdui[1][it])+SB[it]*(dfbdui[0][it]+dfadui[1][it]) for it in range(nTwin)]
    1029                 dFdua[iref] = [SA[it]*(dfadua[it][0]+dfbdua[it][1])+SB[it]*(dfbdua[it][0]+dfadua[it][1]) for it in range(nTwin)]
    1030                 dFdtw[iref] = np.sum(fas,axis=0)**2+np.sum(fbs,axis=0)**2
     1033                dFdx[iref] = TwMask[:,np.newaxis,np.newaxis]*[SA[it]*(dfadx[it][0]+dfbdx[it][1])+SB[it]*(dfbdx[it][0]+dfadx[it][1]) for it in range(nTwin)]
     1034                dFdui[iref] = TwMask[:,np.newaxis]*[SA[it]*(dfadui[0][it]+dfbdui[1][it])+SB[it]*(dfbdui[0][it]+dfadui[1][it]) for it in range(nTwin)]
     1035                dFdua[iref] = TwMask[:,np.newaxis,np.newaxis]*[SA[it]*(dfadua[it][0]+dfbdua[it][1])+SB[it]*(dfbdua[it][0]+dfadua[it][1]) for it in range(nTwin)]
     1036                dFdtw[iref] = TwMask*np.sum(fas,axis=0)**2+np.sum(fbs,axis=0)**2
    10311037            else:
    10321038                dFdfr[iref] = 2.*SA*(dfadfr[0]+dfbdfr[1])*Mdata/len(Uniq)+ \
Note: See TracChangeset for help on using the changeset viewer.