Changeset 3853


Ignore:
Timestamp:
Mar 15, 2019 8:37:20 AM (3 years ago)
Author:
vondreele
Message:

incomm.mag. mods

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3851 r3853  
    13561356    return ngl,nWaves,Fmod,Xmod,Umod,Mmod,glTau,glWt
    13571357
    1358 def MagMod(XYZ,modQ,MSSdata):
     1358def MagMod(XYZ,modQ,MSSdata,SSGData):
    13591359    Bm = np.array(MSSdata[:3]).T   #atoms x waves x sin pos mods
    13601360    Am = np.array(MSSdata[3:]).T   #...cos pos mods
    13611361    nWaves = Am.shape[1]
    13621362    MmodA = 0; MmodB = 0
     1363    nCen = len(SSGData['SSGCen'])
     1364    nEqv = XYZ.shape[1]         #full no. of equivalent pos incl centering
     1365    mEqv = nEqv//nCen           #no. operators not with centering; includes inversion
    13631366    if nWaves:
    13641367        modind = np.arange(nWaves)+1.
    13651368        phase = np.sum(twopi*XYZ[:,:,nxs,:]*modind[nxs,nxs,:,nxs]*modQ[nxs,nxs,nxs,:],axis=-1)
    13661369        phase = np.swapaxes(phase,0,1)  #Nops,Natm,Nwave
     1370        if nCen > 0:
     1371            phshp = phase.shape
     1372            phase = np.reshape(phase,(nCen,mEqv,phshp[1],-1))
     1373            for ic,cen in enumerate(SSGData['SSGCen']):
     1374                phase[ic] += twopi*cen[3]/2.
     1375            phase = np.reshape(phase,phshp)               
    13671376        MmodA = Am[nxs,:,:,:]*np.cos(phase[:,:,:,nxs])-Bm[nxs,:,:,:]*np.sin(phase[:,:,:,nxs])
    13681377        MmodB = Am[nxs,:,:,:]*np.sin(phase[:,:,:,nxs])+Bm[nxs,:,:,:]*np.cos(phase[:,:,:,nxs])
  • trunk/GSASIIstrMath.py

    r3851 r3853  
    15181518       
    15191519        mXYZ = np.array([[xyz[0] for xyz in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T])%1. #Natn,Nop,xyz
    1520         MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata)   #Re cos/Im sin,Nops,Natm,Nwaves,Mxyz
    1521         MmodA = np.inner(MmodA,uAmat.T)         #*(SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs]   #make cartesian * apply det(ops)
    1522         MmodB = np.inner(MmodB,uAmat.T)         #*(SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs]
     1520        MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata,SSGData)   #Re cos/Im sin,Nops,Natm,Nwaves,Mxyz
     1521        MmodA = np.inner(MmodA,uAmat.T)*(SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs]   #make cartesian * apply det(ops)
     1522        MmodB = np.inner(MmodB,uAmat.T)*(SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs]
    15231523       
    15241524    FF = np.zeros(len(Tdata))
Note: See TracChangeset for help on using the changeset viewer.