Changeset 4138


Ignore:
Timestamp:
Sep 5, 2019 4:08:51 PM (4 years ago)
Author:
vondreele
Message:

comment out unused MagMod2 (no tau variation)
SGGray distinction in incomm. Mag. Str Fctr. - still not there!

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r4125 r4138  
    13961396        MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    13971397        MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    1398     return MmodA,MmodB    #Ntau,Nops,Natm,,Mxyz; cos & sin parts; sum matches drwa
     1398    return MmodA,MmodB    #Ntau,Nops,Natm,,Mxyz; cos & sin parts; sum matches drawn atom moments
    13991399       
    1400 def MagMod2(XYZ,modQ,MSSdata,SGData,SSGData):
    1401     '''
    1402     this needs to make magnetic moment modulations & magnitudes
    1403     '''
    1404     Am = np.array(MSSdata[:3]).T   #atoms x waves x sin mag mods
    1405     Bm = np.array(MSSdata[3:]).T  #...cos mag mods
    1406     nWaves = Am.shape[1]
    1407     if not nWaves:
    1408         return 0.0,0.0
    1409     SGMT = np.array([ops[0] for ops in SGData['SGOps']])        #not .T!!
    1410     Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']])
    1411     SGT = np.array([ops[1] for ops in SSGData['SSGOps']])
    1412     if SGData['SGInv']:
    1413         SGMT = np.vstack((SGMT,-SGMT))
    1414         Sinv = np.vstack((Sinv,-Sinv))
    1415         SGT = np.vstack((SGT,-SGT))
    1416     SGMT = np.vstack([SGMT for cen in SGData['SGCen']])     #Nops,3,3
    1417     Sinv = np.vstack([Sinv for cen in SGData['SGCen']])     #Nops,4,4
    1418     SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1.
    1419     detSM = nl.det(SGMT)
    1420     mst = Sinv[:,3,:3]
    1421     epsinv = Sinv[:,3,3]            #Nops
    1422     kdr = np.inner(XYZ,modQ).T      #Nops,Natm
    1423    
    1424     phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3])
    1425    
    1426     psin = np.sin(twopi*phase)      #Nops,Natm
    1427     pcos = np.cos(twopi*phase)
    1428     MmodA = np.sum(Bm[nxs,:,:,:]*pcos[:,:,nxs,nxs],axis=2)
    1429     MmodB = np.sum(Am[nxs,:,:,:]*psin[:,:,nxs,nxs],axis=2)      #Nops,Natm,3
    1430     MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1)
    1431     MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1)
    1432     if SGData['SGGray']:
    1433         MmodA = -MmodA*detSM[:,nxs,nxs]
    1434         MmodB = -MmodB*detSM[:,nxs,nxs]
    1435     else:       
    1436         MmodA = MmodA*SGData['MagMom'][:,nxs,nxs]
    1437         MmodB = MmodB*SGData['MagMom'][:,nxs,nxs]
    1438 #MmodA+MmodB matches drawn tau=0 atom moments
    1439     return MmodA,MmodB    #Nops,Natm,Mxyz; cos & sin parts
    1440        
     1400#def MagMod2(XYZ,modQ,MSSdata,SGData,SSGData):
     1401#    '''
     1402#    this needs to make magnetic moment modulations & magnitudes
     1403#    '''
     1404#    Am = np.array(MSSdata[:3]).T   #atoms x waves x sin mag mods
     1405#    Bm = np.array(MSSdata[3:]).T  #...cos mag mods
     1406#    nWaves = Am.shape[1]
     1407#    if not nWaves:
     1408#        return 0.0,0.0
     1409#    SGMT = np.array([ops[0] for ops in SGData['SGOps']])        #not .T!!
     1410#    Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']])
     1411#    SGT = np.array([ops[1] for ops in SSGData['SSGOps']])
     1412#    if SGData['SGInv']:
     1413#        SGMT = np.vstack((SGMT,-SGMT))
     1414#        Sinv = np.vstack((Sinv,-Sinv))
     1415#        SGT = np.vstack((SGT,-SGT))
     1416#    SGMT = np.vstack([SGMT for cen in SGData['SGCen']])     #Nops,3,3
     1417#    Sinv = np.vstack([Sinv for cen in SGData['SGCen']])     #Nops,4,4
     1418#    SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1.
     1419#    detSM = nl.det(SGMT)
     1420#    mst = Sinv[:,3,:3]
     1421#    epsinv = Sinv[:,3,3]            #Nops
     1422#    kdr = np.inner(XYZ,modQ).T      #Nops,Natm
     1423#   
     1424#    phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3])
     1425#   
     1426#    psin = np.sin(twopi*phase)      #Nops,Natm
     1427#    pcos = np.cos(twopi*phase)
     1428#    MmodA = np.sum(Bm[nxs,:,:,:]*pcos[:,:,nxs,nxs],axis=2)
     1429#    MmodB = np.sum(Am[nxs,:,:,:]*psin[:,:,nxs,nxs],axis=2)      #Nops,Natm,3
     1430#    MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1)
     1431#    MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1)
     1432#    if SGData['SGGray']:
     1433#        MmodA = -MmodA*detSM[:,nxs,nxs]
     1434#        MmodB = -MmodB*detSM[:,nxs,nxs]
     1435#    else:       
     1436#        MmodA = MmodA*SGData['MagMom'][:,nxs,nxs]
     1437#        MmodB = MmodB*SGData['MagMom'][:,nxs,nxs]
     1438##MmodA+MmodB matches drawn tau=0 atom moments
     1439#    return MmodA,MmodB    #Nops,Natm,Mxyz; cos & sin parts
     1440#       
    14411441def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
    14421442    '''
  • trunk/GSASIIstrMath.py

    r4137 r4138  
    15101510       
    15111511        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
    1512 #        TmagA,TmagB = G2mth.MagMod2(mXYZ,modQ,MSSdata,SGData,SSGData)   #Nops,Natm,Mxyz-TmagA+TmagB matches drawing moments @ tau=0.
    15131512        MmodA,MmodB = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Ntau,Nops,Natm,Mxyz sum matches drawing
    15141513       
    15151514        if not SGData['SGGray']:    #for fixed Mx,My,Mz
    1516 #            Mmod += Gdata.T[:,nxs,:]
    15171515            GSdata = np.inner(Gdata.T,np.swapaxes(SGMT,1,2))  #apply sym. ops.--> Natm,Nops,Nxyz
    15181516            if SGData['SGInv'] and not SGData['SGFixed']:   #inversion if any
     
    16131611           
    16141612            if not SGData['SGGray']:
     1613                fams *= 0.5
     1614                fbms *= 0.5
    16151615                fams += fam0[:,nxs,:,:,:]
    16161616                fbms += fbm0[:,nxs,:,:,:]
Note: See TracChangeset for help on using the changeset viewer.