Changeset 3864


Ignore:
Timestamp:
Mar 28, 2019 2:01:07 PM (3 years ago)
Author:
vondreele
Message:

incommensurate mgnetic str. fctr. calcs.latest attempt

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3861 r3864  
    13581358def MagMod(XYZ,modQ,MSSdata,SGData,SSGData):
    13591359   
    1360     SGMT = np.array([ops[0] for ops in SGData['SGOps']])
     1360    SGMT = np.array([ops[0] for ops in SGData['SGOps']])        #not .T!!
    13611361    SGT = np.array([ops[1] for ops in SSGData['SSGOps']])
     1362    RI = np.array([ops[0][3,3] for ops in SSGData['SSGOps']])
    13621363    if SGData['SGInv']:
    13631364        SGMT = np.vstack((SGMT,-SGMT))
    13641365        SGT = np.vstack((SGT,-SGT))
     1366        RI = np.concatenate((RI,-RI))
    13651367    SGMT = np.vstack([SGMT for cen in SGData['SGCen']])
     1368    thdetR = np.array([nl.det(op) for op in SGMT])*SGData['SpnFlp']
    13661369    SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1.
    1367 
    1368 #works for DyMn6Ge6 but not MnWO4
     1370    RI = np.hstack([RI for cen in SSGData['SSGCen']])
    13691371    Bm = np.array(MSSdata[:3]).T   #atoms x waves x sin pos mods
    13701372    Am = np.array(MSSdata[3:]).T   #...cos pos mods
    13711373    nWaves = Am.shape[1]
    1372     MmodA = 0; MmodB = 0
     1374
     1375#works for DyMn6Ge6 but not MnWO4
    13731376    nCen = len(SSGData['SSGCen'])
    13741377    nEqv = XYZ.shape[1]         #full no. of equivalent pos incl centering
    13751378    mEqv = nEqv//nCen           #no. operators not with centering; includes inversion
     1379    MmodAA = 0; MmodBA = 0
    13761380    if nWaves:
    13771381        modind = np.arange(nWaves)+1.
     
    13831387                phaseA[ic] += twopi*cen[3]/2.
    13841388            phaseA = np.reshape(phaseA,phshp)               
    1385         MmodAA = Am[nxs,:,:,:]*np.cos(phaseA[:,:,:,nxs])-Bm[nxs,:,:,:]*np.sin(phaseA[:,:,:,nxs])
    1386         MmodBA = Am[nxs,:,:,:]*np.sin(phaseA[:,:,:,nxs])+Bm[nxs,:,:,:]*np.cos(phaseA[:,:,:,nxs])   
     1389        psinA = np.sin(phaseA)
     1390        pcosA = np.cos(phaseA)
     1391        MmodAA = Am[nxs,:,:,:]*pcosA[:,:,:,nxs]-Bm[nxs,:,:,:]*psinA[:,:,:,nxs]
     1392        MmodBA = Am[nxs,:,:,:]*psinA[:,:,:,nxs]+Bm[nxs,:,:,:]*pcosA[:,:,:,nxs]   
    13871393   
    13881394#fails   
    1389     modQp = np.zeros(4); modQp[:3] = modQ; modQp[3] = 1.
    1390     poff = SGData['SpnFlp']*np.inner(modQp,SGT)
    1391     Bm = np.array(MSSdata[:3]).T   #atoms x waves x sin pos mods
    1392     Am = np.array(MSSdata[3:]).T   #...cos pos mods
    1393     nWaves = Am.shape[1]
     1395    modQp = np.zeros(4); modQp[:3] = modQ; modQp[3] = -1.
     1396    toff = RI*np.inner(modQp,SGT)
    13941397    MmodA = 0; MmodB = 0
    13951398    if nWaves:
    13961399        modind = np.arange(nWaves)+1.
    1397         phase = twopi*(modind[:,nxs,nxs]*(np.inner(XYZ,modQ)+poff)).T
     1400        phase = twopi*(modind[:,nxs,nxs]*(np.inner(XYZ,modQ)-toff)).T
    13981401        psin = np.sin(phase)
    13991402        pcos = np.cos(phase)
    14001403        RAM = np.rollaxis(np.inner(Am,SGMT),2)
    14011404        RBM = np.rollaxis(np.inner(Bm,SGMT),2)
    1402         MmodA = SGData['MagMom'][nxs,nxs,:,nxs]*(RAM*pcos[:,:,:,nxs]-RBM*psin[:,:,:,nxs])
    1403         MmodB = SGData['MagMom'][nxs,nxs,:,nxs]*(RAM*psin[:,:,:,nxs]+RBM*pcos[:,:,:,nxs])
    1404 #        MmodA = RAM*pcos[:,:,:,nxs]-RBM*psin[:,:,:,nxs]
    1405 #        MmodB = RAM*psin[:,:,:,nxs]+RBM*pcos[:,:,:,nxs]   
    1406 
    1407     return MmodA,MmodB    #cos & sin Nops,Natm,Nwaves,Mxyz
     1405        RAC = RAM*pcos[:,:,:,nxs]
     1406        RBS = RBM*psin[:,:,:,nxs]
     1407        RAS = RAM*psin[:,:,:,nxs]
     1408        RBC = RBM*pcos[:,:,:,nxs]
     1409        MmodA = RAC-RBS
     1410        MmodB = RAS+RBC
     1411        MmodA *= thdetR[:,nxs,nxs,nxs]
     1412        MmodB *= thdetR[:,nxs,nxs,nxs]
     1413
     1414    return MmodAA,MmodBA    #cos & sin Nops,Natm,Nwaves,Mxyz
    14081415       
    14091416def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
  • trunk/GSASIIstrMath.py

    r3861 r3864  
    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
    15201520        MmodA,MmodB = G2mth.MagMod(mXYZ,modQ,MSSdata,SGData,SSGData)   #Re cos/Im sin,Nops,Natm,Nwaves,Mxyz
    1521         MmodA *= (SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs]   #apply det(ops)
    1522         MmodB *= (SGData['MagMom']/SGData['SpnFlp'])[:,nxs,nxs,nxs]
    15231521        MmodA = np.inner(MmodA,uAmat.T)   #make cartesian
    15241522        MmodB = np.inner(MmodB,uAmat.T)
Note: See TracChangeset for help on using the changeset viewer.