Changeset 4125 for trunk/GSASIImath.py


Ignore:
Timestamp:
Aug 30, 2019 2:03:45 PM (4 years ago)
Author:
vondreele
Message:

back to incomm. mag. str. fctr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r4073 r4125  
    13601360    return ngl,nWaves,Fmod,Xmod,Umod,Mmod,glTau,glWt
    13611361
    1362 def MagMod(ngl,XYZ,modQ,MSSdata,SGData,SSGData):
     1362def MagMod(glTau,XYZ,modQ,MSSdata,SGData,SSGData):
    13631363    '''
    13641364    this needs to make magnetic moment modulations & magnitudes as
    1365     fxn of ngl tau points
     1365    fxn of gTau points
    13661366    '''
    13671367    Am = np.array(MSSdata[:3]).T   #atoms x waves x sin pos mods
    13681368    Bm = np.array(MSSdata[3:]).T  #...cos pos mods
    13691369    nWaves = Am.shape[1]
    1370     tau = np.arange(ngl)/ngl
    1371     if not nWaves:
    1372         return 0.0,0.0
    13731370    SGMT = np.array([ops[0] for ops in SGData['SGOps']])        #not .T!!
    13741371    Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']])
     
    13861383    phi = np.inner(XYZ,modQ).T
    13871384    TA = np.sum(mst[nxs,:,:]*(XYZ-SGT[:,:3][nxs,:,:]),axis=-1).T
    1388     tauT =  TA[nxs,:,:] + epsinv[nxs,:,nxs]*(tau[:,nxs,nxs]-SGT[:,3][nxs,:,nxs]+phi[nxs,:,:])
     1385    tauT =  TA[nxs,:,:] + epsinv[nxs,:,nxs]*(glTau[:,nxs,nxs]-SGT[:,3][nxs,:,nxs]+phi[nxs,:,:])
    13891386    modind = np.arange(nWaves)+1.
    13901387    phase = (modind[:,nxs,nxs]*tauT)     #Nops,Natm,Nwave
    13911388    psin = np.sin(twopi*phase)
    13921389    pcos = np.cos(twopi*phase)
    1393     MmodB = np.sum(Bm[nxs,nxs,:,:,:]*pcos[:,:,:,nxs,nxs],axis=3)
    1394     MmodA = np.sum(Am[nxs,nxs,:,:,:]*psin[:,:,:,nxs,nxs],axis=3)
     1390    MmodA = np.sum(Bm[nxs,nxs,:,:,:]*pcos[:,:,:,nxs,nxs],axis=3)
     1391    MmodB = np.sum(Am[nxs,nxs,:,:,:]*psin[:,:,:,nxs,nxs],axis=3)
    13951392    if SGData['SGGray']:
    13961393        MmodA = -np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*detSM[nxs,:,nxs,nxs]
     
    13991396        MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    14001397        MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['MagMom'][nxs,:,nxs,nxs]
    1401     Mmod = MmodA+MmodB
    1402     return Mmod,MmodA,MmodB    #Ntau,Nops,Natm,,Mxyz; sum,sin & cos parts
     1398    return MmodA,MmodB    #Ntau,Nops,Natm,,Mxyz; cos & sin parts; sum matches drwa
    14031399       
    14041400def MagMod2(XYZ,modQ,MSSdata,SGData,SSGData):
     
    14251421    epsinv = Sinv[:,3,3]            #Nops
    14261422    kdr = np.inner(XYZ,modQ).T      #Nops,Natm
    1427 #    phase = kdr+(epsinv*(np.inner(SGT[:,:3],modQ)-SGT[:,3]))[:,nxs]     #Nops,Natm
    14281423   
    14291424    phase = (np.sum(mst*(XYZ-SGT[nxs,:,:3]),axis=-1)).T+epsinv[:,nxs]*(kdr-SGT[:,nxs,3])
     
    14311426    psin = np.sin(twopi*phase)      #Nops,Natm
    14321427    pcos = np.cos(twopi*phase)
    1433     MmodA = np.sum(Am[nxs,:,:,:]*psin[:,:,nxs,nxs],axis=2)      #Nops,Natm,3
    1434     MmodB = np.sum(Bm[nxs,:,:,:]*pcos[:,:,nxs,nxs],axis=2)
     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
    14351430    MmodA = np.sum(SGMT[:,nxs,:,:]*MmodA[:,:,nxs,:],axis=-1)
    14361431    MmodB = np.sum(SGMT[:,nxs,:,:]*MmodB[:,:,nxs,:],axis=-1)
     
    14421437        MmodB = MmodB*SGData['MagMom'][:,nxs,nxs]
    14431438#MmodA+MmodB matches drawn tau=0 atom moments
    1444     return MmodA,MmodB    #Nops,Natm,Mxyz; sin & cos parts
     1439    return MmodA,MmodB    #Nops,Natm,Mxyz; cos & sin parts
    14451440       
    14461441def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
Note: See TracChangeset for help on using the changeset viewer.