Changeset 2523


Ignore:
Timestamp:
Nov 14, 2016 12:53:55 PM (5 years ago)
Author:
vondreele
Message:

fix errors in Frac function/derivs for magnetic structures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2522 r2523  
    756756        if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']:
    757757            MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    758             TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*MF/(2*Nops*Ncen)     #Nref,Natm
     758            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops*Ncen)     #Nref,Natm
    759759            if SGData['SGInv']:
    760760                mphase = np.hstack((phase,-phase))
     
    995995    SGT = np.array([ops[1] for ops in SGData['SGOps']])
    996996    Ncen = len(SGData['SGCen'])
    997     Nops = len(SGMT)
     997    Nops = len(SGMT)*Ncen*(1+SGData['SGInv'])
    998998    MFtables = calcControls['MFtables']
    999999    Amat,Bmat = G2lat.Gmat2AB(G)
     
    10041004    Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
    10051005    Gdata = np.where(Mag>0.,Gdata/Mag,0.)       #normalze mag. moments
    1006     dGdM = np.repeat(Gdata[:,nxs,:],Nops*Ncen*(1+SGData['SGInv']),axis=1)
     1006    dGdM = np.repeat(Gdata[:,nxs,:],Nops,axis=1)
    10071007    Gdata = np.inner(Bmat,Gdata.T)              #convert to crystal space
    10081008    Gdata = np.inner(Gdata.T,SGMT).T            #apply sym. ops.
     
    10111011    Gdata = np.hstack([Gdata for icen in range(Ncen)])        #dup over cell centering
    10121012    Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip
    1013     Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps*Inv*Ncen
     1013    Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps
    10141014    dGdM = SGData['MagMom'][nxs,:,nxs]*dGdM
    10151015    Gdata = np.swapaxes(Gdata,1,2)              # put Natoms last - Mxyz,Nops,Natms
     
    10421042        Phi = np.inner(H,SGT)
    10431043        phase = twopi*(np.inner(Uniq,(dXdata+Xdata).T).T+Phi.T).T
    1044         occ = Mdata*Fdata/len(SGT)
     1044        occ = Mdata*Fdata/Nops
    10451045        biso = -SQfactor*Uisodata[:,nxs]
    10461046        Tiso = np.repeat(np.where(biso<1.,np.exp(biso),1.0),len(SGT),axis=1).T
     
    10511051        Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata])
    10521052        MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    1053         TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*MF/(2*Nops*Ncen)     #Nref,Natm                                  #Nref,Natm
     1053        TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/Nops     #Nref,Natm                                  #Nref,Natm
    10541054        if SGData['SGInv']:
    10551055            mphase = np.hstack((phase,-phase))
     
    10931093        dfbdua = np.sum(-Hij[nxs,:,:,nxs,:]*fbm[:,:,:,:,nxs],axis=2)
    10941094        #accumulate derivatives   
    1095         dFdfr[iBeg:iFin] = 2.*np.sum((fams[:,:,nxs]*dfadfr+fbms[:,:,nxs]*dfbdfr)*Mdata/(2*Nops*Ncen),axis=0)
     1095        dFdfr[iBeg:iFin] = 2.*np.sum((fams[:,:,nxs]*dfadfr+fbms[:,:,nxs]*dfbdfr)*Mdata/Nops,axis=0)
    10961096        dFdx[iBeg:iFin] =  2.*np.sum(fams[:,:,nxs,nxs]*dfadx+fbms[:,:,nxs,nxs]*dfbdx,axis=0)
    10971097        dFdMx[:,iBeg:iFin,:] = 2.*(fams[:,:,nxs]*dfadmx+fbms[:,:,nxs]*dfbdmx)
    10981098        dFdui[iBeg:iFin] = 2.*np.sum(fams[:,:,nxs]*dfadui+fbms[:,:,nxs]*dfbdui,axis=0)
    10991099        dFdua[iBeg:iFin] = 2.*np.sum(fams[:,:,nxs,nxs]*dfadua+fbms[:,:,nxs,nxs]*dfbdua,axis=0)
    1100         GSASIIpath.IPyBreak()
     1100#        GSASIIpath.IPyBreak()
    11011101        iBeg += blkSize
    11021102    print ' %d derivative time %.4f\r'%(nRef,time.time()-time0)
Note: See TracChangeset for help on using the changeset viewer.