Ignore:
Timestamp:
Jan 27, 2019 9:04:12 AM (4 years ago)
Author:
vondreele
Message:

combine cell2AB & Gmat2AB in G2lat
fixes to mag. str. fctr. math. Correct sym. op. transformation of moments & fix moment to cartesian axis problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r3795 r3801  
    976976        return
    977977    Mag = np.array([np.sqrt(np.inner(mag,np.inner(mag,Ginv))) for mag in Gdata.T])
    978     Gdata = np.inner(Gdata.T,SGMT).T            #apply sym. ops.
     978    Gdata = np.inner(Gdata.T,np.swapaxes(SGMT,1,2)).T            #apply sym. ops.
    979979    if SGData['SGInv'] and not SGData['SGFixed']:
    980980        Gdata = np.hstack((Gdata,-Gdata))       #inversion if any
     
    982982    Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip * det(opM)
    983983    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    984     VGi = np.sqrt(nl.det(Ginv))
    985     Kdata = np.inner(Gdata.T,uAmat).T*VGi/Mag     #Cartesian unit vectors
     984    Kdata = np.inner(Gdata.T,uAmat.T).T/Mag     #Cartesian unit vectors
    986985    Uij = np.array(G2lat.U6toUij(Uijdata))
    987986    bij = Mast*Uij.T
     
    11301129    Mag = np.array([np.sqrt(np.inner(mag,np.inner(mag,Ginv))) for mag in Gdata.T])
    11311130    Gones = np.ones_like(Gdata)
    1132     Gdata = np.inner(Gdata.T,SGMT).T            #apply sym. ops.
     1131    Gdata = np.inner(Gdata.T,np.swapaxes(SGMT,1,2)).T            #apply sym. ops.
    11331132    Gones = np.inner(Gones.T,SGMT).T
    11341133    if SGData['SGInv'] and not SGData['SGFixed']:
     
    11401139    Gones = SGData['MagMom'][nxs,:,nxs]*Gones   #flip vectors according to spin flip
    11411140    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    1142     VGi = np.sqrt(nl.det(Ginv))
    1143     Kdata = np.inner(Gdata.T,uAmat).T*VGi/Mag       #make unit vectors in Cartesian space
     1141    Kdata = np.inner(Gdata.T,uAmat.T).T/Mag     #Cartesian unit vectors
    11441142    Uij = np.array(G2lat.U6toUij(Uijdata))
    11451143    bij = Mast*Uij.T
     
    14171415    GS = G/np.outer(ast,ast)
    14181416    Ginv = g/np.outer(ainv,ainv)
    1419     VGi = np.sqrt(nl.det(Ginv))
    14201417    uAmat = G2lat.Gmat2AB(GS)[0]
    14211418    Mast = twopisq*np.multiply.outer(ast,ast)   
     
    14421439
    14431440    if parmDict[pfx+'isMag']:       #TODO: fix the math
    1444         GSdata = Gdata[:,nxs,:]+Mmod.T
    1445         GSdata = np.inner(GSdata.T,SGMT).T            #apply sym. ops.
     1441        GSdata = Gdata[:,nxs,:]+Mmod.T                  #Mxyz,Ntau,nAtm
     1442        GSdata = np.inner(GSdata.T,np.swapaxes(SGMT,1,2)).T            #apply sym. ops.
    14461443        if SGData['SGInv'] and not SGData['SGFixed']:
    14471444            GSdata = np.hstack((GSdata,-GSdata))       #inversion if any
     
    14491446        GSdata = SGData['MagMom'][nxs,:,nxs,nxs]*GSdata   #flip vectors according to spin flip * det(opM)
    14501447        SMag = np.sqrt(np.sum((np.inner(GSdata.T,Ginv)*GSdata.T),axis=-1)).T
    1451         Kdata = np.inner(GSdata.T,uAmat).T*VGi/SMag[nxs,:,:,:]     #Cartesian unit vectors = 0.9626 for hexagonal???
     1448        Kdata = np.inner(Gdata.T,uAmat.T).T/SMag[nxs,:,:,:]     #Cartesian unit vectors
    14521449
    14531450    FF = np.zeros(len(Tdata))
Note: See TracChangeset for help on using the changeset viewer.