Ignore:
Timestamp:
Aug 25, 2014 4:47:28 PM (9 years ago)
Author:
vondreele
Message:

Fix CW & TOF hydrostatic strain calculations & change disply formats
work on TOF size/mustrain calcs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1475 r1478  
    12001200            cosP,sinP = G2lat.CosSinAngle(H,P,G)
    12011201            Sgam = 1.e-4*parmDict[hfx+'difC']*(parmDict[phfx+'Size;i']*parmDict[phfx+'Size;a'])
    1202             Sgam *= np.sqrt((sinP*parmDict[phfx+'Size;a'])**2+(cosP*parmDict[phfx+'Size;i'])**2)
     1202            Sgam /= np.sqrt((sinP*parmDict[phfx+'Size;a'])**2+(cosP*parmDict[phfx+'Size;i'])**2)
    12031203        else:           #ellipsoidal crystallites
    12041204            Sij =[parmDict[phfx+'Size:%d'%(i)] for i in range(6)]
     
    12081208        #microstrain               
    12091209        if calcControls[phfx+'MustrainType'] == 'isotropic':
    1210             Mgam = 1.e-6*parmDict[hfx+'difC']*parmDict[phfx+'Mustrain;i']
     1210            Mgam = 1.e-6*parmDict[hfx+'difC']*refl[4]*parmDict[phfx+'Mustrain;i']
    12111211        elif calcControls[phfx+'MustrainType'] == 'uniaxial':
    12121212            H = np.array(refl[:3])
     
    12151215            Si = parmDict[phfx+'Mustrain;i']
    12161216            Sa = parmDict[phfx+'Mustrain;a']
    1217             Mgam = 1.e-6*parmDict[hfx+'difC']*Si*Sa/np.sqrt((Si*cosP)**2+(Sa*sinP)**2)
     1217            Mgam = 1.e-6*parmDict[hfx+'difC']*refl[4]*Si*Sa/np.sqrt((Si*cosP)**2+(Sa*sinP)**2)
    12181218        else:       #generalized - P.W. Stephens model
    12191219            pwrs = calcControls[phfx+'MuPwrs']
     
    13051305    else:   #'T'OF
    13061306        if calcControls[phfx+'SizeType'] == 'isotropic':
    1307             Sgam = 1.e-4*parmDict[hfx+'difC']*parmDict[phfx+'Size;i']
    1308             gamDict[phfx+'Size;i'] = 1.e-4*parmDict[hfx+'difC']*parmDict[phfx+'Size;mx']
    1309             sigDict[phfx+'Size;i'] = 1.e-4*parmDict[hfx+'difC']*Sgam*(1.-parmDict[phfx+'Size;mx'])**2/ateln2
     1307            Sgam = 1.e-4*parmDict[hfx+'difC']*refl[4]*parmDict[phfx+'Size;i']
     1308            gamDict[phfx+'Size;i'] = 1.e-4*parmDict[hfx+'difC']*refl[4]*parmDict[phfx+'Size;mx']
     1309            sigDict[phfx+'Size;i'] = 2.e-4*parmDict[hfx+'difC']*refl[4]*Sgam*(1.-parmDict[phfx+'Size;mx'])**2/ateln2
    13101310        elif calcControls[phfx+'SizeType'] == 'uniaxial':
    1311             const = 1.e-4*parmDict[hfx+'difC']
     1311            const = 1.e-4*parmDict[hfx+'difC']*refl[4]
    13121312            H = np.array(refl[:3])
    13131313            P = np.array(calcControls[phfx+'SizeAxis'])
     
    13381338        #microstrain derivatives               
    13391339        if calcControls[phfx+'MustrainType'] == 'isotropic':
    1340             Mgam = 1.e-6*parmDict[hfx+'difC']*parmDict[phfx+'Mustrain;i']
     1340            Mgam = 1.e-6*parmDict[hfx+'difC']*refl[4]*parmDict[phfx+'Mustrain;i']
    13411341            gamDict[phfx+'Mustrain;i'] =  1.e-6*parmDict[hfx+'difC']*parmDict[phfx+'Mustrain;mx']
    13421342            sigDict[phfx+'Mustrain;i'] =  2.e-6*parmDict[hfx+'difC']*Mgam*(1.-parmDict[phfx+'Mustrain;mx'])**2/ateln2       
     
    14251425        return dpdA,dpdZ,dpdDC,dpdDA,dpdDB
    14261426           
    1427 def GetHStrainShift(refl,SGData,phfx,parmDict):
     1427def GetHStrainShift(refl,SGData,phfx,hfx,calcControls,parmDict):
    14281428    'Needs a doc string'
    14291429    laue = SGData['SGLaue']
     
    14521452        Dij = parmDict[phfx+'D11']*h**2+parmDict[phfx+'D22']*k**2+parmDict[phfx+'D33']*l**2+ \
    14531453            parmDict[phfx+'D12']*h*k+parmDict[phfx+'D13']*h*l+parmDict[phfx+'D23']*k*l
    1454     return -Dij*refl[4]**2*tand(refl[5]/2.0)
     1454    if 'C' in calcControls[hfx+'histType']:
     1455        return -180.*Dij*refl[4]**2*tand(refl[5]/2.0)/np.pi
     1456    else:
     1457        return -Dij*parmDict[hfx+'difC']*refl[4]**2/2.
    14551458           
    1456 def GetHStrainShiftDerv(refl,SGData,phfx):
     1459def GetHStrainShiftDerv(refl,SGData,phfx,hfx,calcControls,parmDict):
    14571460    'Needs a doc string'
    14581461    laue = SGData['SGLaue']
     
    14821485        dDijDict = {phfx+'D11':h**2,phfx+'D22':k**2,phfx+'D33':l**2,
    14831486            phfx+'D12':h*k,phfx+'D13':h*l,phfx+'D23':k*l}
    1484     for item in dDijDict:
    1485         dDijDict[item] *= -refl[4]**2*tand(refl[5]/2.0)
     1487    if 'C' in calcControls[hfx+'histType']:
     1488        for item in dDijDict:
     1489            dDijDict[item] *= -180.0*refl[4]**2*tand(refl[5]/2.0)/np.pi
     1490    else:
     1491        for item in dDijDict:
     1492            dDijDict[item] *= -parmDict[hfx+'difC']*refl[4]**2/2.
    14861493    return dDijDict
    14871494   
     
    15831590        gam = parmDict[hfx+'X']*refl[4]+parmDict[hfx+'Y']*refl[4]**2
    15841591        Ssig,Sgam = GetSampleSigGam(refl,0.0,G,GB,hfx,phfx,calcControls,parmDict)
    1585         sig += Ssig     #save peak sigma
     1592        sig += Ssig
    15861593        sig = max(0.001,sig)
    1587         gam += Sgam     #save peak gamma
     1594        gam += Sgam
    15881595        gam = max(0.001,gam)
    15891596        return sig,gam
     
    16361643                refl[5] = GetReflPos(refl,wave,G,hfx,calcControls,parmDict)         #corrected reflection position
    16371644                Lorenz = 1./(2.*sind(refl[5]/2.)**2*cosd(refl[5]/2.))           #Lorentz correction
    1638                 refl[5] += GetHStrainShift(refl,SGData,phfx,parmDict)               #apply hydrostatic strain shift
     1645                refl[5] += GetHStrainShift(refl,SGData,phfx,hfx,calcControls,parmDict)               #apply hydrostatic strain shift
    16391646                refl[6:8] = GetReflSigGamCW(refl,wave,G,GB,phfx,calcControls,parmDict)    #peak sig & gam
    16401647                refl[11:15] = GetIntensityCorr(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict)
     
    16711678                refl[5] = GetReflPos(refl,0.0,G,hfx,calcControls,parmDict)         #corrected reflection position
    16721679                Lorenz = sind(parmDict[hfx+'2-theta']/2)*refl[4]**4                                                #TOF Lorentz correction
    1673                 refl[5] += GetHStrainShift(refl,SGData,phfx,parmDict)               #apply hydrostatic strain shift
     1680                refl[5] += GetHStrainShift(refl,SGData,phfx,hfx,calcControls,parmDict)               #apply hydrostatic strain shift
    16741681                refl[6:8] = GetReflSigGamTOF(refl,G,GB,phfx,calcControls,parmDict)    #peak sig & gam
    16751682                refl[12:14] = GetReflAlpBet(refl,hfx,parmDict)
     
    19041911                    if Ka2:
    19051912                        depDerivDict[name][iBeg2:iFin2] += dpdA*dervDict2['pos']
    1906             dDijDict = GetHStrainShiftDerv(refl,SGData,phfx)
     1913            dDijDict = GetHStrainShiftDerv(refl,SGData,phfx,hfx,calcControls,parmDict)
    19071914            for name in dDijDict:
    19081915                if name in varylist:
Note: See TracChangeset for help on using the changeset viewer.