Changeset 4514


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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4511 r4514  
    41084108        for f in files:
    41094109            dirname,filroot = os.path.split(f)
    4110             if os.path.exists(f):
     4110            if os.path.exists(f) and '.gpx' in f:
    41114111                sellist.append("{} from {}".format(filroot,dirname))
    41124112#            else:
  • 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):
  • trunk/GSASIIstrMath.py

    r4513 r4514  
    14861486    ast = np.sqrt(np.diag(G))
    14871487    GS = G/np.outer(ast,ast)
     1488    gs = nl.inv(GS)
    14881489    uAmat,uBmat = G2lat.Gmat2AB(GS)
    14891490    Mast = twopisq*np.multiply.outer(ast,ast)   
     
    15141515    if parmDict[pfx+'isMag']:       #This part correct for making modulated mag moments on equiv atoms - Mmod matched drawing & Bilbao drawings
    15151516   
    1516 #        mTau = np.linspace(0,1.,ngl,False)   
    15171517        mXYZ = np.array([[XYZ[0] for XYZ in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T]) #Natn,Nop,xyz
    15181518        if SGData['SGGray']:
     
    15971597        if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']:           
    15981598           
     1599            MmodA,MmodB = G2mth.MagMod2(H[3],glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Nref,Ntau,Nops,Natm,Mxyz
    15991600            phasem = twopi*np.inner(mXYZ,HP.T).T    #2pi(Q.r)
    16001601            cosm = np.cos(phasem)                   #Nref,nops,natm
     
    16021603            MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    16031604            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops)     #Nref,Natm
    1604             HM = np.inner(uBmat,HP.T)                            #put into cartesian space X||H,Z||H*L
     1605            HM = np.inner(uAmat,HP.T)                            #put into cartesian space X||H,Z||H*L; uAmat better than uBmat
    16051606            eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T              # normalize  HP  Nref,hkl=Unit vectors || Q
    16061607
     
    16111612                fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs]
    16121613                           
    1613             fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs]+    \
    1614                 np.sign(H[3,i])*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz
     1614            fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA[i]*cosm[i,nxs,:,:,nxs]+   
     1615                np.sign(H[3,i])*MmodB[i]*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz
    16151616                       
    1616             fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+    \
    1617                 np.sign(H[3,i])*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz
     1617            fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA[i]*sinm[i,nxs,:,:,nxs]+   
     1618                np.sign(H[3,i])*MmodB[i]*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])/2.          #Nref,Ntau,Nops,Natm,Mxyz
    16181619           
    16191620            if not SGData['SGGray']:
    16201621                fams += fam0[:,nxs,:,:,:]
    16211622                fbms += fbm0[:,nxs,:,:,:]
    1622             # else:
    1623             #     fams /= 2.
    1624             #     fbms /= 2.
    16251623                               
    16261624# # do sum on ops, atms 1st                       
     
    16281626            fbsm = np.sum(np.sum(fbms,axis=-2),axis=-2)
    16291627# #put into cartesian space
    1630             facm = np.inner(fasm,uBmat.T)
     1628            facm = np.inner(fasm,uBmat.T)       #uBmat better than uAmat
    16311629            fbcm = np.inner(fbsm,uBmat.T)
    16321630# #form e.F dot product
    16331631            eDotFa = np.sum(eM[:,nxs,:]*facm,axis=-1)    #Nref,Ntau       
    16341632            eDotFb = np.sum(eM[:,nxs,:]*fbcm,axis=-1)
    1635 # #intensity
    1636             fass = np.sum((facm-eM[:,nxs,:]*eDotFa[:,:,nxs])**2,axis=-1)
    1637             fbss = np.sum((fbcm-eM[:,nxs,:]*eDotFb[:,:,nxs])**2,axis=-1)
    1638             # fass = np.sum(facm**2,axis=-1)-eDotFa**2
    1639             # fbss = np.sum(fbcm**2,axis=-1)-eDotFb**2
     1633# #intensity    Halpern & Johnson
     1634            fass = np.sum(facm**2,axis=-1)-eDotFa**2
     1635            fbss = np.sum(fbcm**2,axis=-1)-eDotFb**2
    16401636           
    16411637# #do integration           
Note: See TracChangeset for help on using the changeset viewer.