Changeset 2493


Ignore:
Timestamp:
Oct 17, 2016 10:30:33 AM (7 years ago)
Author:
vondreele
Message:

add display of phase weight fraction to DData tab

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIddataGUI.py

    r2431 r2493  
    151151        scaleVal.Bind(wx.EVT_KILL_FOCUS,OnScaleVal)
    152152        scaleSizer.Add(scaleVal,0,WACV)
     153        if 'PWDR' in G2frame.hist and generalData['Type'] != 'magnetic':
     154            wtSum = G2pwd.PhaseWtSum(G2frame,G2frame.hist)
     155            weightFr = UseList[G2frame.hist]['Scale'][0]*generalData['Mass']/wtSum
     156            scaleSizer.Add(wx.StaticText(DData,label=' Wt. fraction: %.3f'%(weightFr)),0,WACV)
    153157        return scaleSizer
    154158       
  • trunk/GSASIIpwd.py

    r2481 r2493  
    6262npT2q = lambda tth,wave: 2.0*np.pi*npT2stl(tth,wave)    #=2pi*d*
    6363ateln2 = 8.0*math.log(2.0)
    64    
     64
     65################################################################################
     66#### Powder utilities
     67################################################################################
     68
     69def PhaseWtSum(G2frame,histo):
     70    '''
     71    Calculate sum of phase mass*shase fraction for PWDR data (exclude magnetic phases)
     72   
     73    :param G2frame: GSASII main frame structure
     74    :param str histo: histogram name
     75    :returns sum(scale*mass) for phases in histo
     76    '''
     77    Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
     78    wtSum = 0.0
     79    for phase in Phases:
     80        if Phases[phase]['General']['Type'] != 'magnetic':
     81            if histo in Phases[phase]['Histograms']:
     82                mass = Phases[phase]['General']['Mass']
     83                phFr = Phases[phase]['Histograms'][histo]['Scale'][0]
     84                wtSum += mass*phFr
     85    return wtSum
     86   
     87################################################################################
    6588#GSASII pdf calculation routines
     89################################################################################
    6690       
    6791def Transmission(Geometry,Abs,Diam):
  • trunk/GSASIIstrMath.py

    r2492 r2493  
    774774            else:
    775775                mphase = phase
    776 #            mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']])
    777             mphase = np.array([mphase for cen in SGData['SGCen']])
     776            mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']])
    778777            mphase = np.concatenate(mphase,axis=1)              #Nref,full Nop,Natm
    779778            sinm = np.sin(mphase)                               #ditto - match magstrfc.for
     
    10501049    SGT = np.array([ops[1] for ops in SGData['SGOps']])
    10511050    Ncen = len(SGData['SGCen'])
     1051    Nops = len(SGMT)
    10521052    FFtables = calcControls['FFtables']
    10531053    BLtables = calcControls['BLtables']
     
    10651065        if SGData['SGInv']:
    10661066            Gdata = np.hstack((Gdata,-Gdata))       #inversion if any
    1067         Gdata = np.repeat(Gdata,Ncen,axis=1)        #dup over cell centering
     1067        Gdata = np.hstack([Gdata for icen in range(Ncen)])        #dup over cell centering
    10681068        Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip
    10691069        Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen
     
    10851085    dFdfr = np.zeros((nRef,mSize))
    10861086    dFdx = np.zeros((nRef,mSize,3))
     1087    dFdmx = np.zeros((nRef,mSize,3))
    10871088    dFdui = np.zeros((nRef,mSize))
    10881089    dFdua = np.zeros((nRef,mSize,6))
     
    11351136        if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']:
    11361137            MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    1137             TMcorr = 0.5*0.539*Tcorr[:,0,:]*MF*len(SGMT)/Mdata                                  #Nref,Natm
     1138            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*MF/(2*Nops*Ncen)     #Nref,Natm                                  #Nref,Natm
    11381139            if SGData['SGInv']:
    11391140                mphase = np.hstack((phase,-phase))
     1141                TMcorr = TMcorr/2.
    11401142            else:
    11411143                mphase = phase
    11421144            mphase = np.array([mphase+twopi*np.inner(cen,H)[:,nxs,nxs] for cen in SGData['SGCen']])
    1143 #            GSASIIpath.IPyBreak()
    11441145            mphase = np.concatenate(mphase,axis=1)              #Nref,Nop,Natm
    11451146            sinm = np.sin(mphase)                               #ditto - match magstrfc.for
     
    11481149            HM = HM/np.sqrt(np.sum(HM**2,axis=0))               #Gdata = MAGS & HM = UVEC in magstrfc.for both OK
    11491150            eDotK = np.sum(HM[:,:,nxs,nxs]*Gdata[:,nxs,:,:],axis=0)
    1150             Q = -HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]+Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK
    1151             fam = Q*TMcorr[nxs,:,nxs,:]*SGData['MagMom'][nxs,nxs,:,nxs]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
    1152             fbm = Q*TMcorr[nxs,:,nxs,:]*SGData['MagMom'][nxs,nxs,:,nxs]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
     1151            Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #xyz,Nref,Nop,Natm = BPM in magstrfc.for OK
     1152            fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
     1153            fbm = Q*TMcorr[nxs,:,nxs,:]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
    11531154            fams = np.sum(np.sum(fam,axis=-1),axis=-1)                          #xyz,Nref
    11541155            fbms = np.sum(np.sum(fbm,axis=-1),axis=-1)                          #ditto
    11551156            Hij = np.hstack((Hij,Hij))
     1157#            GSASIIpath.IPyBreak()
    11561158        if 'T' in calcControls[hfx+'histType']:
    11571159            fa = np.array([fot*cosp,-np.reshape(Flack*FPP,sinp.shape)*sinp*Tcorr])
     
    11661168        #sum below is over Uniq
    11671169        if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']:
    1168             dfadfr = np.sum(fam/occ,axis=-2)        #array(refBlk,nAtom) Fdata != 0 avoids /0. problem
     1170            dfadfr = np.sum(fams/occ,axis=-2)        #array(refBlk,nAtom) Fdata != 0 avoids /0. problem
    11691171            dfadba = np.sum(-cosm*TMcorr[:,nxs,:],axis=-2)    #array(refBlk,nAtom)
    11701172            dfadx = np.sum(twopi*Uniq[:,nxs,:,:]*np.swapaxes(fax[0],-2,-1)[:,:,:,nxs],axis=-2)
    1171             dfadui = np.sum(-SQfactor[:,nxs,nxs]*fam,axis=-2) #array(Ops,refBlk,nAtoms)
    1172             dfadua = np.sum(-Hij[nxs,:,:,nxs,:]*fam[:,:,:,:,nxs],axis=-3)
     1173            dfadui = np.sum(-SQfactor[:,nxs,nxs]*fams,axis=-2) #array(Ops,refBlk,nAtoms)
     1174            dfadua = np.sum(-Hij[nxs,:,:,nxs,:]*fams[:,:,:,:,nxs],axis=-3)
    11731175        else:
    11741176            dfadfr = np.sum(fa/occ,axis=-2)        #array(2,refBlk,nAtom) Fdata != 0 avoids /0. problem
Note: See TracChangeset for help on using the changeset viewer.