Changeset 4514 for trunk/GSASIImath.py


Ignore:
Timestamp:
Jul 6, 2020 1:35:05 PM (3 years ago)
Author:
vondreele
Message:

remove non gpx entries from recent projects
continue work on magnetism

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r4513 r4514  
    14681468    MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs]
    14691469    return MmodA,MmodB    #Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments
     1470       
     1471def MagMod2(m,glTau,XYZ,modQ,MSSdata,SGData,SSGData):
     1472    '''
     1473    this needs to make magnetic moment modulations & magnitudes as
     1474    fxn of gTau points; NB: this allows only 1 mag. wave fxn.
     1475    '''
     1476    Am = np.array(MSSdata[3:]).T[:,0,:]   #atoms x cos pos mods; only 1 wave
     1477    Bm = np.array(MSSdata[:3]).T[:,0,:]  #...sin pos mods
     1478    SGMT = np.array([ops[0] for ops in SGData['SGOps']])        #not .T!!
     1479    Sinv = np.array([nl.inv(ops[0]) for ops in SSGData['SSGOps']])
     1480    SGT = np.array([ops[1] for ops in SSGData['SSGOps']])
     1481    if SGData['SGInv']:
     1482        SGMT = np.vstack((SGMT,-SGMT))
     1483        Sinv = np.vstack((Sinv,-Sinv))
     1484        SGT = np.vstack((SGT,-SGT))
     1485    SGMT = np.vstack([SGMT for cen in SGData['SGCen']])
     1486    Sinv = np.vstack([Sinv for cen in SGData['SGCen']])
     1487    SGT = np.vstack([SGT+cen for cen in SSGData['SSGCen']])%1.
     1488    if SGData['SGGray']:
     1489        SGMT = np.vstack((SGMT,SGMT))
     1490        Sinv = np.vstack((Sinv,Sinv))
     1491        SGT = np.vstack((SGT,SGT+.5))%1.
     1492    mst = Sinv[:,3,:3]
     1493    epsinv = Sinv[:,3,3]
     1494    phase = np.inner(XYZ,modQ).T+(np.inner(mst,modQ)-epsinv)[:,nxs]+glTau
     1495   
     1496    psin = np.sin(twopi*m*phase).T
     1497    pcos = np.cos(twopi*m*phase).T
     1498    MmodA = Am[nxs,nxs,:,:]*pcos[:,:,nxs,nxs]    #cos term
     1499    MmodB = Bm[nxs,nxs,:,:]*psin[:,:,nxs,nxs]    #sin term
     1500    MmodA = np.sum(SGMT[nxs,:,nxs,:,:]*MmodA[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs]
     1501    MmodB = np.sum(SGMT[nxs,:,nxs,:,:]*MmodB[:,:,:,nxs,:],axis=-1)*SGData['SpnFlp'][nxs,:,nxs,nxs]
     1502    return MmodA,MmodB    #Nref,Ntau,Nops,Natm,Mxyz; cos & sin parts; sum matches drawn atom moments
    14701503       
    14711504def Modulation(H,HP,nWaves,Fmod,Xmod,Umod,glTau,glWt):
Note: See TracChangeset for help on using the changeset viewer.